Merge "Snap for 12901447 from 2aabaa06a7010ba5d0115140ccf26a2d5fefa554 to simpleperf-release" into simpleperf-release
diff --git a/apps/CtsVerifier/Android.bp b/apps/CtsVerifier/Android.bp
index 19a2c0a..3da36dd 100644
--- a/apps/CtsVerifier/Android.bp
+++ b/apps/CtsVerifier/Android.bp
@@ -282,3 +282,22 @@
     srcs: [":android-cts-verifier"],
     export_to_make_var: "SOONG_ANDROID_CTS_VERIFIER_ZIP",
 }
+
+genrule {
+    name: "android-cts-verifier-app-list",
+    srcs: [
+        ":cts_apps_to_include",
+        ":multidevice-test-app-list",
+    ],
+    device_common_srcs: [
+        ":CtsVerifier",
+    ],
+    out: ["android-cts-verifier-app-list.txt"],
+    cmd: "echo $(locations :cts_apps_to_include) $(location :CtsVerifier) $(location :multidevice-test-app-list) > $(out)",
+}
+
+filegroup {
+    name: "android-cts-verifier-app-list-for-make",
+    srcs: [":android-cts-verifier-app-list"],
+    export_to_make_var: "SOONG_ANDROID_CTS_VERIFIER_APP_LIST",
+}
diff --git a/apps/CtsVerifier/res/layout/audio_loopback_latency_activity.xml b/apps/CtsVerifier/res/layout/audio_loopback_latency_activity.xml
index 587213a..73c6563 100644
--- a/apps/CtsVerifier/res/layout/audio_loopback_latency_activity.xml
+++ b/apps/CtsVerifier/res/layout/audio_loopback_latency_activity.xml
@@ -169,6 +169,18 @@
                         android:layout_height="match_parent"
                         android:textStyle="bold"
                         android:id="@+id/audio_loopback_is_handheld"/>
+
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="match_parent"
+                        android:layout_marginStart="5sp"
+                        android:text="@string/audio_loopback_emulator"/>
+
+                    <TextView
+                        android:layout_width="wrap_content"
+                        android:layout_height="match_parent"
+                        android:textStyle="bold"
+                        android:id="@+id/audio_loopback_emulator"/>
                 </LinearLayout>
 
                 <include layout="@layout/audio_loopback_utilities" />
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index b455016..19df2b6 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -5834,8 +5834,9 @@
         button and allow the test to proceed.</string>
 
     <string name="audio_loopback_failure">FAILURE - Could not allocate analyzer thread.</string>
-    <string name="audio_loopback_automobile">Automobile:</string>
+    <string name="audio_loopback_automobile">Auto:</string>
     <string name="audio_loopback_handheld">Handheld:</string>
+    <string name="audio_loopback_emulator">Emulator:</string>
     <string name="audio_loopback_tv">TV:</string>
     <string name="audio_loopback_watch">Watch:</string>
     <string name="audio_loopback_mmapexclusive">MMAP Exclusive:</string>
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackLatencyActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackLatencyActivity.java
index e526202..afc3e4a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackLatencyActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackLatencyActivity.java
@@ -132,6 +132,7 @@
     private boolean mIsTV;
     private boolean mIsAutomobile;
     private boolean mIsHandheld;
+    private boolean mIsEmulator;
     private int     mSpeakerDeviceId = AudioDeviceInfo.TYPE_UNKNOWN;
     private int     mMicDeviceId = AudioDeviceInfo.TYPE_UNKNOWN;
 
@@ -481,6 +482,7 @@
         mIsTV = AudioSystemFlags.isTV(this);
         mIsAutomobile = AudioSystemFlags.isAutomobile(this);
         mIsHandheld = AudioSystemFlags.isHandheld(this);
+        mIsEmulator = Build.IS_EMULATOR;
 
         mUSBAudioSupport = AudioDeviceUtils.supportsUsbAudio(this);
         mAnalogJackSupport = AudioDeviceUtils.supportsAnalogHeadset(this);
@@ -542,6 +544,8 @@
                 (mIsAutomobile ? mYesString : mNoString));
         ((TextView) findViewById(R.id.audio_loopback_is_handheld)).setText(
                 (mIsHandheld ? mYesString : mNoString));
+        ((TextView) findViewById(R.id.audio_loopback_emulator)).setText(
+                (mIsEmulator ? mYesString : mNoString));
 
         // Individual Test Results
         mRouteStatus[TESTROUTE_DEVICE] =
@@ -952,7 +956,12 @@
     }
 
     private boolean mustRunTest() {
-        return mIsHandheld  && hasInternalPath();
+        // Special handling for emulators
+        if (mIsEmulator) {
+            return false;
+        }
+
+        return mIsHandheld && hasInternalPath();
     }
 
     boolean hasInternalPath() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
index a134453..59852ce 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/ItsService.java
@@ -3089,7 +3089,8 @@
             aeTargetFpsMax = 30;
         }
         return new PreviewRecorder(cameraDeviceId, videoSize, aeTargetFpsMax,
-                sensorOrientation, outputFilePath, mCameraHandler, hlg10Enabled, this);
+                sensorOrientation, outputFilePath, mCameraHandler, hlg10Enabled,
+                getEncoderTimestampOffset(), this);
     }
 
     private void doStaticPreviewRecording(JSONObject cmdObj) throws JSONException, ItsException {
@@ -3317,7 +3318,8 @@
 
         int aeTargetFpsMax = 30;
         try (PreviewRecorder pr = new PreviewRecorder(cameraDeviceId, previewSize, aeTargetFpsMax,
-                sensorOrientation, outputFilePath, mCameraHandler, /*hlg10Enabled*/false, this)) {
+                sensorOrientation, outputFilePath, mCameraHandler, /*hlg10Enabled*/false,
+                getEncoderTimestampOffset(), this)) {
             CaptureRequest.Builder reqBuilder = mCamera.createCaptureRequest(
                     CameraDevice.TEMPLATE_PREVIEW);
             JSONObject captureReqJSON = params.getJSONObject("captureRequest");
@@ -5245,4 +5247,15 @@
                 || format == ImageFormat.JPEG_R
                 || format == ImageFormat.YCBCR_P010);
     }
+
+    private long getEncoderTimestampOffset() {
+        int timestampSource = mCameraCharacteristics.get(
+                CameraCharacteristics.SENSOR_INFO_TIMESTAMP_SOURCE);
+        long encoderTimestampOffset = 0;
+        if (timestampSource == CameraMetadata.SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME) {
+            long uptimeNanos = TimeUnit.MILLISECONDS.toNanos(SystemClock.uptimeMillis());
+            encoderTimestampOffset = uptimeNanos - SystemClock.elapsedRealtimeNanos();
+        }
+        return encoderTimestampOffset;
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/PreviewRecorder.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/PreviewRecorder.java
index 3533683..509fab8 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/PreviewRecorder.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/its/PreviewRecorder.java
@@ -147,14 +147,17 @@
     private final float[] mTexRotMatrix; // length = 4
     private final float[] mTransformMatrix = new float[16];
 
+    // An offset applied to convert from camera timestamp to codec timestamp, due to potentially
+    // different time bases (elapsedRealtime vs uptime).
+    private long mEncoderTimestampOffset;
     private List<Long> mFrameTimeStamps = new ArrayList();
     /**
      * Initializes MediaRecorder/MediaCodec and EGL context. The result of recorded video will
      * be stored in {@code outputFile}.
      */
     PreviewRecorder(int cameraId, Size previewSize, int maxFps, int sensorOrientation,
-            String outputFile, Handler handler, boolean hlg10Enabled, Context context)
-            throws ItsException {
+            String outputFile, Handler handler, boolean hlg10Enabled, long encoderTimestampOffset,
+            Context context) throws ItsException {
         // Ensure that we can record the given size
         int maxSupportedResolution = ItsUtils.RESOLUTION_TO_CAMCORDER_PROFILE
                                         .stream()
@@ -172,6 +175,7 @@
         mMaxFps = maxFps;
         // rotate the texture as needed by the sensor orientation
         mTexRotMatrix = getRotationMatrix(sensorOrientation);
+        mEncoderTimestampOffset = encoderTimestampOffset;
 
         ConditionVariable cv = new ConditionVariable();
         cv.close();
@@ -231,18 +235,20 @@
                 }
                 try {
                     // Set EGL presentation time to camera timestamp
+                    long timestamp = surfaceTexture.getTimestamp();
                     EGLExt.eglPresentationTimeANDROID(
-                            mEGLDisplay, mEGLRecorderSurface, surfaceTexture.getTimestamp());
+                            mEGLDisplay, mEGLRecorderSurface,
+                            timestamp + mEncoderTimestampOffset);
                     copyFrameToRecordSurface();
                     // Capture results are not collected for padded green frames
                     if (mIsPaintGreen) {
                         Logt.v(TAG, "Recorded frame# " + mFrameTimeStamps.size()
-                                + " timestamp = " + surfaceTexture.getTimestamp()
+                                + " timestamp = " + timestamp
                                 + " with color. mIsPaintGreen = " + mIsPaintGreen);
                     } else {
-                        mFrameTimeStamps.add(surfaceTexture.getTimestamp());
+                        mFrameTimeStamps.add(timestamp);
                         Logt.v(TAG, "Recorded frame# " + mFrameTimeStamps.size()
-                                + " timestamp = " + surfaceTexture.getTimestamp());
+                                + " timestamp = " + timestamp);
                     }
                 } catch (ItsException e) {
                     Logt.e(TAG, "Failed to copy texture to recorder.", e);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/os/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/os/OWNERS
index 827908f..f216c0b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/os/OWNERS
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/os/OWNERS
@@ -2,7 +2,6 @@
 # Bug component: 62965
 # Sensor team
 bduddie@google.com
-stange@google.com
 arthuri@google.com
 
 # WearOS team
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/OWNERS
index e9e78a3..a59af7d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/sensors/OWNERS
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/sensors/OWNERS
@@ -1,4 +1,3 @@
 # Bug component: 62965
 bduddie@google.com
-stange@google.com
 arthuri@google.com
\ No newline at end of file
diff --git a/hostsidetests/appbinding/hostside/Android.bp b/hostsidetests/appbinding/hostside/Android.bp
index 76db681..3cde662 100644
--- a/hostsidetests/appbinding/hostside/Android.bp
+++ b/hostsidetests/appbinding/hostside/Android.bp
@@ -32,14 +32,14 @@
         "cts",
         "general-tests",
     ],
-    target_required: [
-        "CtsAppBindingService1",
-        "CtsAppBindingService2",
-        "CtsAppBindingService3",
-        "CtsAppBindingService4",
-        "CtsAppBindingService5",
-        "CtsAppBindingService6",
-        "CtsAppBindingService7",
-        "CtsAppBindingServiceB",
+    device_common_data: [
+        ":CtsAppBindingService1",
+        ":CtsAppBindingService2",
+        ":CtsAppBindingService3",
+        ":CtsAppBindingService4",
+        ":CtsAppBindingService5",
+        ":CtsAppBindingService6",
+        ":CtsAppBindingService7",
+        ":CtsAppBindingServiceB",
     ],
 }
diff --git a/hostsidetests/appcompat/compatchanges/Android.bp b/hostsidetests/appcompat/compatchanges/Android.bp
index 13e8a59..a285a42 100644
--- a/hostsidetests/appcompat/compatchanges/Android.bp
+++ b/hostsidetests/appcompat/compatchanges/Android.bp
@@ -29,6 +29,7 @@
     device_common_data: [
         ":appcompat_preinstall_override_versioncode1_debuggable",
         ":appcompat_preinstall_override_versioncode1_release",
+        ":appcompat_preinstall_override2_versioncode1_release",
         ":appcompat_preinstall_override_versioncode2_debuggable",
         ":appcompat_preinstall_override_versioncode2_release",
         ":CtsHostsideCompatChangeTestsApp",
diff --git a/hostsidetests/appsecurity/Android.bp b/hostsidetests/appsecurity/Android.bp
index c2a2874..542e512 100644
--- a/hostsidetests/appsecurity/Android.bp
+++ b/hostsidetests/appsecurity/Android.bp
@@ -212,6 +212,7 @@
         ":KeyStoreManagerTestGranteeApp",
         ":KeyStoreManagerTestGranterApp",
     ],
+    device_common_java_resources: [":all_apex_certs{.avbpubkey}"],
 }
 
 java_test_host {
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java
index 78e7df4..5a22fb6 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/ApexSignatureVerificationTest.java
@@ -46,6 +46,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URISyntaxException;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Enumeration;
@@ -70,8 +71,7 @@
     private static final String TEST_APEX_SOURCE_DIR_PREFIX = "tests-apex_";
     private static final String APEX_PUB_KEY_NAME = "apex_pubkey";
 
-    private static final Pattern WELL_KNOWN_PUBKEY_PATTERN = Pattern.compile(
-            "^apexsigverify\\/.*.avbpubkey");
+    private static final Pattern WELL_KNOWN_PUBKEY_PATTERN = Pattern.compile(".*.avbpubkey");
 
     private static boolean mHasTestFailure;
 
@@ -267,7 +267,7 @@
         Iterator<String> keyIterator = keyPath.iterator();
         while (keyIterator.hasNext()) {
             final String tmpKeyPath = keyIterator.next();
-            final String keyFileName = tmpKeyPath.substring(tmpKeyPath.lastIndexOf("/"));
+            final String keyFileName = Paths.get(tmpKeyPath).getFileName().toString();
             File outFile;
             try (InputStream in = getClass().getResourceAsStream("/" + tmpKeyPath)) {
                 outFile = File.createTempFile(keyFileName, "", mWellKnownKeyStorePath);
diff --git a/hostsidetests/appsecurity/test-apps/ListeningPortsApp/src/android/appsecurity/cts/listeningports/ListeningPortsTest.java b/hostsidetests/appsecurity/test-apps/ListeningPortsApp/src/android/appsecurity/cts/listeningports/ListeningPortsTest.java
index aa75cc7..e9e9f17 100644
--- a/hostsidetests/appsecurity/test-apps/ListeningPortsApp/src/android/appsecurity/cts/listeningports/ListeningPortsTest.java
+++ b/hostsidetests/appsecurity/test-apps/ListeningPortsApp/src/android/appsecurity/cts/listeningports/ListeningPortsTest.java
@@ -107,6 +107,7 @@
     private static final List<String> USERDEBUG_EXCEPTION_PATTERNS = new ArrayList<>(2);
 
     static {
+        USERDEBUG_EXCEPTION_PATTERNS.add("0.0.0.0:8872");     // Bluetooth snoop logger socket
         USERDEBUG_EXCEPTION_PATTERNS.add("127.0.0.1:50002");  // Diagnostic Monitor Daemon port
         USERDEBUG_EXCEPTION_PATTERNS.add("127.0.0.1:60002");  // vcd port
     }
diff --git a/hostsidetests/compilation/app/Android.bp b/hostsidetests/compilation/app/Android.bp
index 3bd5203..6eff422 100644
--- a/hostsidetests/compilation/app/Android.bp
+++ b/hostsidetests/compilation/app/Android.bp
@@ -27,6 +27,7 @@
         "general-tests",
     ],
     certificate: ":cts-compilation-testkey",
+    uncompress_dex: true,
 }
 
 android_test_helper_app {
diff --git a/hostsidetests/compilation/src/android/compilation/cts/Utils.java b/hostsidetests/compilation/src/android/compilation/cts/Utils.java
index 3774e8d..45eb81a 100644
--- a/hostsidetests/compilation/src/android/compilation/cts/Utils.java
+++ b/hostsidetests/compilation/src/android/compilation/cts/Utils.java
@@ -27,9 +27,11 @@
 
 import com.google.common.io.ByteStreams;
 
+import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.nio.file.Files;
@@ -38,6 +40,7 @@
 import java.util.List;
 import java.util.UUID;
 import java.util.regex.Pattern;
+import java.util.zip.CRC32;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
@@ -263,17 +266,10 @@
     public File createDm(String profileResource, File vdexFile) throws Exception {
         File dmFile = File.createTempFile("test", ".dm");
         dmFile.deleteOnExit();
-        try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(dmFile))) {
-            zip.setLevel(0);
-            zip.putNextEntry(new ZipEntry("primary.prof"));
-            try (InputStream inputStream = getClass().getResourceAsStream(profileResource)) {
-                assertThat(ByteStreams.copy(inputStream, zip)).isGreaterThan(0);
-            }
-            zip.putNextEntry(new ZipEntry("primary.vdex"));
-            try (InputStream inputStream = new FileInputStream(vdexFile)) {
-                assertThat(ByteStreams.copy(inputStream, zip)).isGreaterThan(0);
-            }
-            zip.closeEntry();
+        try (ZipWriter zipWriter = new ZipWriter(dmFile)) {
+            zipWriter.addUncompressedAlignedEntry(
+                    "primary.prof", getClass().getResourceAsStream(profileResource));
+            zipWriter.addUncompressedAlignedEntry("primary.vdex", new FileInputStream(vdexFile));
         }
         return dmFile;
     }
@@ -283,18 +279,9 @@
     public File createSdm(File odexFile, File artFile) throws Exception {
         File sdmFile = File.createTempFile("test", ".sdm");
         sdmFile.deleteOnExit();
-        try (ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(sdmFile))) {
-            zip.setLevel(0);
-            zip.putNextEntry(new ZipEntry("primary.odex"));
-            try (InputStream inputStream = new FileInputStream(odexFile)) {
-                assertThat(ByteStreams.copy(inputStream, zip)).isGreaterThan(0);
-            }
-            zip.closeEntry();
-            zip.putNextEntry(new ZipEntry("primary.art"));
-            try (InputStream inputStream = new FileInputStream(artFile)) {
-                assertThat(ByteStreams.copy(inputStream, zip)).isGreaterThan(0);
-            }
-            zip.closeEntry();
+        try (ZipWriter zipWriter = new ZipWriter(sdmFile)) {
+            zipWriter.addUncompressedAlignedEntry("primary.odex", new FileInputStream(odexFile));
+            zipWriter.addUncompressedAlignedEntry("primary.art", new FileInputStream(artFile));
         }
         signApk(sdmFile);
         return sdmFile;
@@ -306,7 +293,7 @@
         File cert = mTestInfo.getDependencyFile("testkey.x509.pem", false /* targetFirst */);
         assertHostCommandSucceeds("java", "-jar", apksigner.getAbsolutePath(), "sign", "--key",
                 key.getAbsolutePath(), "--cert", cert.getAbsolutePath(), "--min-sdk-version=35",
-                file.getAbsolutePath());
+                "--alignment-preserved", file.getAbsolutePath());
     }
 
     private String getDmPath(String apkPath) throws Exception {
@@ -321,6 +308,80 @@
         return Pattern.compile(String.format("[\\s/](%s)\\s?", Pattern.quote(dexFile)));
     }
 
+    /** A {@link ZipOutputStream} wrapper that helps create uncompressed aligned entries. */
+    public static class ZipWriter implements AutoCloseable {
+        /** The length of the local file header, in bytes, excluding variable length fields. */
+        private static final int LOCAL_FILE_HEADER_EXCL_VER_FIELDS_LEN = 30;
+        /**
+         * The zip entry alignment, in bytes.
+         *
+         * Actually, we don't need to align this much. Only odex needs to align to page size, as
+         * required by the Bionic's dlopen, while other files only need to align to 4 bytes, as
+         * required by ART. We align all to 16KB just for simplicity.
+         */
+        private static final int ALIGNMENT = 16384;
+
+        private final ZipOutputStream mZip;
+        private long mOffset = 0;
+
+        public ZipWriter(File zipFile) throws IOException {
+            mZip = new ZipOutputStream(new FileOutputStream(zipFile));
+        }
+
+        @Override
+        public void close() throws IOException {
+            mZip.close();
+        }
+
+        /** Add an uncompressed aligned entry. */
+        public void addUncompressedAlignedEntry(String name, InputStream stream)
+                throws IOException {
+            mZip.setMethod(ZipOutputStream.STORED);
+            try (InputStream inputStream = new BufferedInputStream(stream)) {
+                inputStream.mark(Integer.MAX_VALUE);
+
+                // We have to calculate CRC32 and the size ourselves because `ZipOutputStream`
+                // doesn't do it for STORED entries.
+                CRC32 crc = new CRC32();
+                long size = 0;
+                byte[] buf = new byte[8192];
+                int n;
+                while ((n = inputStream.read(buf)) != -1) {
+                    crc.update(buf, 0, n);
+                    size += n;
+                }
+
+                inputStream.reset();
+
+                // The zip file structure looks like:
+                // +------------------------------------+---------+---------+
+                // | Entry 1                            | Entry 2 |   ...   |
+                // +-----------------------------+------+---------+---------+
+                // | Local file header           |      |         |         |
+                // +----------+----------+-------+ Data |   ...   |   ...   |
+                // | 30 bytes | Filename | Extra |      |         |         |
+                // +----------+----------+-------+------+---------+---------+
+                // We put null padding as extra, to achieve alignment.
+                mOffset += LOCAL_FILE_HEADER_EXCL_VER_FIELDS_LEN + name.length();
+                int padding =
+                        (mOffset % ALIGNMENT > 0) ? (ALIGNMENT - (int) (mOffset % ALIGNMENT)) : 0;
+                mOffset += padding;
+
+                ZipEntry zipEntry = new ZipEntry(name);
+                zipEntry.setSize(size);
+                zipEntry.setCompressedSize(size);
+                zipEntry.setCrc(crc.getValue());
+                zipEntry.setExtra(new byte[padding]);
+                mZip.putNextEntry(zipEntry);
+
+                assertThat(ByteStreams.copy(inputStream, mZip)).isGreaterThan(0);
+                mOffset += size;
+
+                mZip.closeEntry();
+            }
+        }
+    }
+
     /** Represents the compilation artifacts of an APK. All the files are on host. */
     public record CompilationArtifacts(File odexFile, File vdexFile, File artFile) {}
 }
diff --git a/hostsidetests/edi/src/android/edi/cts/NativeDeviceInfo.java b/hostsidetests/edi/src/android/edi/cts/NativeDeviceInfo.java
index 9bbf0b5..a1cb0d4 100644
--- a/hostsidetests/edi/src/android/edi/cts/NativeDeviceInfo.java
+++ b/hostsidetests/edi/src/android/edi/cts/NativeDeviceInfo.java
@@ -112,5 +112,28 @@
 
         collectMemCG(device, store);
         collectMGLRU(device, store);
+        collectSuspendMechanism(device, store);
+    }
+
+    private void collectSuspendMechanism(ITestDevice device, HostInfoStore store) throws Exception {
+        CommandResult commandResult = device.executeShellV2Command("cat /sys/power/mem_sleep");
+
+        if (commandResult.getExitCode() == 0) {
+            String memSleepOutput = commandResult.getStdout().trim();
+            // Assuming the output format is like "[s2idle] deep".
+            Pattern pattern = Pattern.compile("\\[(.*?)\\]");
+            Matcher matcher = pattern.matcher(memSleepOutput);
+            if (matcher.find()) {
+                String suspendMechanism = matcher.group(1);
+                store.addResult("suspend_mechanism", suspendMechanism);
+            } else {
+                // Handle cases where the output format is unexpected
+                store.addResult("suspend_mechanism", "unknown");
+            }
+        } else if (commandResult.getStderr().contains("No such file")) {
+            store.addResult("suspend_mechanism", "error: No such file");
+        } else if (commandResult.getStderr().contains("Permission denied")) {
+            store.addResult("suspend_mechanism", "error: Permission denied");
+        }
     }
 }
diff --git a/hostsidetests/gwp_asan/OWNERS b/hostsidetests/gwp_asan/OWNERS
index 20e000e..ceb9371 100644
--- a/hostsidetests/gwp_asan/OWNERS
+++ b/hostsidetests/gwp_asan/OWNERS
@@ -1,4 +1,3 @@
 # Bug component: 986449
-eugenis@google.com
 pcc@google.com
 fmayer@google.com
diff --git a/hostsidetests/multidevices/Android.bp b/hostsidetests/multidevices/Android.bp
index 1a69a8e..3c4f444 100644
--- a/hostsidetests/multidevices/Android.bp
+++ b/hostsidetests/multidevices/Android.bp
@@ -20,14 +20,19 @@
     default_applicable_licenses: ["Android-Apache-2.0"],
 }
 
-java_genrule {
-    name: "multidevice-test-apps",
-    srcs: [
+filegroup {
+    name: "multidevice-test-app-list",
+    device_first_srcs: [
         ":NfcEmulatorTestApp",
     ],
+}
+
+java_genrule {
+    name: "multidevice-test-apps",
+    srcs: [":multidevice-test-app-list"],
     tools: ["soong_zip"],
     out: ["multidevice-test-apps.zip"],
-    cmd: "echo $(location :NfcEmulatorTestApp) >$(genDir)/list && " +
+    cmd: "echo $(location :multidevice-test-app-list) >$(genDir)/list && " +
         "$(location soong_zip) -o $(out) -j -P android-cts-verifier/MultiDevice -l $(genDir)/list",
 }
 
diff --git a/hostsidetests/multidevices/nfc/Android.bp b/hostsidetests/multidevices/nfc/Android.bp
deleted file mode 100644
index dff6328..0000000
--- a/hostsidetests/multidevices/nfc/Android.bp
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (C) 2024 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package {
-    default_team: "trendy_team_fwk_nfc",
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-python_defaults {
-    name: "CtsNfcMultiDevicePythonDefaults",
-    libs: [
-        "mobly",
-        "pn532-python",
-        "platform-test-py-annotations",
-    ],
-    test_suites: [
-        // Added this test suite to CTS-V
-        "general-tests",
-    ],
-    version: {
-        py3: {
-            embedded_launcher: true,
-        },
-    },
-}
-
-python_test_host {
-    name: "CtsNfcHceMultiDeviceTestCases",
-    main: "cts_nfc_hce_multi_device_test.py",
-    srcs: ["cts_nfc_hce_multi_device_test.py"],
-    test_config: "AndroidTest.xml",
-    device_common_data: [
-        ":NfcReaderTestApp",
-        ":NfcEmulatorTestApp",
-    ],
-    test_options: {
-        unit_test: false,
-        runner: "mobly",
-    },
-    defaults: ["CtsNfcMultiDevicePythonDefaults"],
-}
-
-// CTS-V specific binary build target that excludes the snippet APKs.
-python_test_host {
-    name: "CtsNfcHceMultiDeviceTestCases-py-ctsv",
-    main: "cts_nfc_hce_multi_device_test.py",
-    srcs: ["cts_nfc_hce_multi_device_test.py"],
-    test_config: "AndroidTest.xml",
-    test_options: {
-        unit_test: false,
-        runner: "mobly",
-    },
-    defaults: ["CtsNfcMultiDevicePythonDefaults"],
-}
diff --git a/hostsidetests/multidevices/nfc/AndroidTest.xml b/hostsidetests/multidevices/nfc/AndroidTest.xml
deleted file mode 100644
index 523b13a..0000000
--- a/hostsidetests/multidevices/nfc/AndroidTest.xml
+++ /dev/null
@@ -1,42 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2024 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT 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 NFC multi device test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="nfc" />
-    <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" />
-
-    <device name="AndroidDevice">
-        <target_preparer class="AndroidMinSdkVersionCheckDecorator">
-            <option name="min_sdk_version" value="35" />
-        </target_preparer>
-        <target_preparer class="AndroidInstallAppsDecorator" />
-    </device>
-    <device name="AndroidDevice">
-        <target_preparer class="AndroidMinSdkVersionCheckDecorator">
-            <option name="min_sdk_version" value="35" />
-        </target_preparer>
-        <target_preparer class="AndroidInstallAppsDecorator" />
-    </device>
-
-    <test class="MoblyAospPackageTest" />
-
-    <option name="mobly_pkg" key="file" value="CtsNfcHceMultiDeviceTestCases" />
-    <option name="build_apk" key="file" value="NfcReaderTestApp.apk" />
-    <option name="build_apk" key="file" value="NfcEmulatorTestApp.apk" />
-</configuration>
diff --git a/hostsidetests/multidevices/nfc/OWNERS b/hostsidetests/multidevices/nfc/OWNERS
deleted file mode 100644
index 35e9713..0000000
--- a/hostsidetests/multidevices/nfc/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 48448
-include platform/packages/apps/Nfc:/OWNERS
diff --git a/hostsidetests/multidevices/nfc/cts_nfc_hce_multi_device_test.py b/hostsidetests/multidevices/nfc/cts_nfc_hce_multi_device_test.py
deleted file mode 100644
index ab286869..0000000
--- a/hostsidetests/multidevices/nfc/cts_nfc_hce_multi_device_test.py
+++ /dev/null
@@ -1,1453 +0,0 @@
-#  Copyright (C) 2024 The Android Open Source Project
-#
-#  Licensed under the Apache License, Version 2.0 (the "License");
-#  you may not use this file except in compliance with the License.
-#  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-#
-#  Licensed under the Apache License, Version 2.0 (the "License");
-#  you may not use this file except in compliance with the License.
-#  You may obtain a copy of the License at
-#
-#       http://www.apache.org/licenses/LICENSE-2.0
-#
-#  Unless required by applicable law or agreed to in writing, software
-#  distributed under the License is distributed on an "AS IS" BASIS,
-#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#  See the License for the specific language governing permissions and
-#  limitations under the License.
-
-# Lint as: python3
-"""CTS Tests that verify NFC HCE features.
-
-These tests require one phone and one PN532 board (or two phones), one acting as
-a card emulator and the other acting as an NFC reader. The devices should be
-placed back to back.
-"""
-
-from http.client import HTTPSConnection
-import json
-import logging
-import ssl
-import sys
-import time
-
-from android.platform.test.annotations import CddTest
-from mobly import asserts
-from mobly import base_test
-from mobly import test_runner
-from mobly import utils
-from mobly.controllers import android_device
-from mobly.controllers import android_device_lib
-from mobly.snippet import errors
-
-
-_LOG = logging.getLogger(__name__)
-logging.basicConfig(level=logging.INFO)
-try:
-    import pn532
-    from pn532.nfcutils import (
-        parse_protocol_params,
-        create_select_apdu,
-        poll_and_transact,
-        poll_and_observe_frames,
-        get_apdus,
-        POLLING_FRAME_ALL_TEST_CASES,
-        POLLING_FRAMES_TYPE_A_SPECIAL,
-        POLLING_FRAMES_TYPE_B_SPECIAL,
-        POLLING_FRAMES_TYPE_F_SPECIAL,
-        POLLING_FRAMES_TYPE_A_LONG,
-        POLLING_FRAMES_TYPE_B_LONG,
-        POLLING_FRAME_ON,
-        POLLING_FRAME_OFF,
-        get_frame_test_stats,
-        TimedWrapper,
-        ns_to_ms,
-        ns_to_us,
-        us_to_ms,
-    )
-except ImportError as e:
-    _LOG.warning(f"Cannot import PN532 library due to {e}")
-
-# Timeout to give the NFC service time to perform async actions such as
-# discover tags.
-_NFC_TIMEOUT_SEC = 10
-_NFC_TECH_A_POLLING_ON = (0x1 #NfcAdapter.FLAG_READER_NFC_A
-                          | 0x10 #NfcAdapter.FLAG_READER_NFC_BARCODE
-                          | 0x80 #NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK
-                          )
-_NFC_TECH_A_POLLING_OFF = (0x10 #NfcAdapter.FLAG_READER_NFC_BARCODE
-                           | 0x80 #NfcAdapter.FLAG_READER_SKIP_NDEF_CHECK
-                           )
-_NFC_TECH_A_LISTEN_ON = 0x1 #NfcAdapter.FLAG_LISTEN_NFC_PASSIVE_A
-_NFC_TECH_F_LISTEN_ON = 0x4 #NfcAdapter.FLAG_LISTEN_NFC_PASSIVE_F
-_NFC_LISTEN_OFF = 0x0 #NfcAdapter.FLAG_LISTEN_DISABLE
-_SERVICE_PACKAGE = "com.android.nfc.service"
-_ACCESS_SERVICE = _SERVICE_PACKAGE + ".AccessService"
-_OFFHOST_SERVICE = _SERVICE_PACKAGE + ".OffHostService"
-_LARGE_NUM_AIDS_SERVICE = _SERVICE_PACKAGE + ".LargeNumAidsService"
-_PAYMENT_SERVICE_1 = _SERVICE_PACKAGE + ".PaymentService1"
-_PAYMENT_SERVICE_2 = _SERVICE_PACKAGE + ".PaymentService2"
-_PAYMENT_SERVICE_DYNAMIC_AIDS = _SERVICE_PACKAGE + ".PaymentServiceDynamicAids"
-_PREFIX_ACCESS_SERVICE = _SERVICE_PACKAGE + ".PrefixAccessService"
-_PREFIX_PAYMENT_SERVICE_1 = _SERVICE_PACKAGE + ".PrefixPaymentService1"
-_PREFIX_TRANSPORT_SERVICE_2 = _SERVICE_PACKAGE + ".PrefixTransportService2"
-_SCREEN_OFF_PAYMENT_SERVICE = _SERVICE_PACKAGE + ".ScreenOffPaymentService"
-_SCREEN_ON_ONLY_OFF_HOST_SERVICE = _SERVICE_PACKAGE + ".ScreenOnOnlyOffHostService"
-_THROUGHPUT_SERVICE = _SERVICE_PACKAGE + ".ThroughputService"
-_TRANSPORT_SERVICE_1 = _SERVICE_PACKAGE + ".TransportService1"
-_TRANSPORT_SERVICE_2 = _SERVICE_PACKAGE + ".TransportService2"
-_POLLING_LOOP_SERVICE_1 = _SERVICE_PACKAGE + ".PollingLoopService"
-_POLLING_LOOP_SERVICE_2 = _SERVICE_PACKAGE + ".PollingLoopService2"
-
-_NUM_POLLING_LOOPS = 50
-_FAILED_TAG_MSG =  "Reader did not detect tag, transaction not attempted."
-_FAILED_TRANSACTION_MSG = "Transaction failed, check device logs for more information."
-
-_FRAME_EVENT_TIMEOUT_SEC = 1
-_POLLING_FRAME_TIMESTAMP_TOLERANCE_MS = 5
-_POLLING_FRAME_TIMESTAMP_EXCEED_COUNT_TOLERANCE_ = 3
-_FAILED_MISSING_POLLING_FRAMES_MSG = "Device did not receive all polling frames"
-_FAILED_TIMESTAMP_TOLERANCE_EXCEEDED_MSG = "Polling frame timestamp tolerance exceeded"
-_FAILED_VENDOR_GAIN_VALUE_DROPPED_ON_POWER_INCREASE = """
-Polling frame vendor specific gain value dropped on power increase
-"""
-_FAILED_FRAME_TYPE_INVALID = "Polling frame type is invalid"
-_FAILED_FRAME_DATA_INVALID = "Polling frame data is invalid"
-
-
-
-class CtsNfcHceMultiDeviceTestCases(base_test.BaseTestClass):
-
-    def _set_up_emulator(self, *args, start_emulator_fun=None, service_list=[],
-                 expected_service=None, is_payment=False, preferred_service=None,
-                 payment_default_service=None):
-        """
-        Sets up emulator device for multidevice tests.
-        :param is_payment: bool
-            Whether test is setting up payment services. If so, this function will register
-            this app as the default wallet.
-        :param start_emulator_fun: fun
-            Custom function to start the emulator activity. If not present,
-            startSimpleEmulatorActivity will be used.
-        :param service_list: list
-            List of services to set up. Only used if a custom function is not called.
-        :param expected_service: String
-            Class name of the service expected to handle the APDUs.
-        :param preferred_service: String
-            Service to set as preferred service, if any.
-        :param payment_default_service: String
-            For payment tests only: the default payment service that is expected to handle APDUs.
-        :param args: arguments for start_emulator_fun, if any
-
-        :return:
-        """
-        role_held_handler = self.emulator.nfc_emulator.asyncWaitForRoleHeld(
-            'RoleHeld')
-        if start_emulator_fun is not None:
-            start_emulator_fun(*args)
-        else:
-            if preferred_service is None:
-                self.emulator.nfc_emulator.startSimpleEmulatorActivity(service_list,
-                                                                       expected_service, is_payment)
-            else:
-                self.emulator.nfc_emulator.startSimpleEmulatorActivityWithPreferredService(
-                    service_list, expected_service, preferred_service, is_payment
-                )
-
-        if is_payment:
-            role_held_handler.waitAndGet('RoleHeld', _NFC_TIMEOUT_SEC)
-            if payment_default_service is None:
-                raise Exception("Must define payment_default_service for payment tests.")
-            self.emulator.nfc_emulator.waitForService(payment_default_service)
-
-    def _set_up_reader_and_assert_transaction(self, start_reader_fun=None, expected_service=None,
-                                              is_offhost=False):
-        """
-        Sets up reader device, and asserts successful APDU transaction
-        :param start_reader_fun: function
-                Function to start reader activity on reader phone if PN532 is not enabled.
-        :param expected_service: string
-                Class name of the service expected to handle the APDUs on the emulator device.
-        :param is_offhost: bool
-                Whether service to handle APDUs is offhost or not.
-        :return:
-        """
-        if self.pn532:
-            if expected_service is None:
-                raise Exception('expected_service must be defined.')
-            command_apdus, response_apdus = get_apdus(self.emulator.nfc_emulator, expected_service)
-            tag_detected, transacted = poll_and_transact(self.pn532, command_apdus, response_apdus)
-            asserts.assert_true(tag_detected, _FAILED_TAG_MSG)
-            asserts.assert_true(transacted, _FAILED_TRANSACTION_MSG)
-        else:
-            handler_snippet = self.reader.nfc_reader if is_offhost else (
-                self.emulator.nfc_emulator)
-
-            test_pass_handler = handler_snippet.asyncWaitForTestPass('ApduSuccess')
-            if start_reader_fun is None:
-                raise Exception('start_reader_fun must be defined.')
-            start_reader_fun()
-            test_pass_handler.waitAndGet('ApduSuccess', _NFC_TIMEOUT_SEC)
-
-    def _is_cuttlefish_device(self, ad: android_device.AndroidDevice) -> bool:
-        product_name = ad.adb.getprop("ro.product.name")
-        return "cf_x86" in product_name
-
-    def _get_casimir_id_for_device(self):
-        host = "localhost"
-        conn = HTTPSConnection(host, 1443, context=ssl._create_unverified_context())
-        path = '/devices'
-        headers = {'Content-type': 'application/json'}
-        conn.request("GET", path, {}, headers)
-        response = conn.getresponse()
-        json_obj = json.loads(response.read())
-        first_device = json_obj[0]
-        return first_device["device_id"]
-
-    def setup_class(self):
-        """
-        Sets up class by registering an emulator device, enabling NFC, and loading snippets.
-
-        If a PN532 serial path is found, it uses this to configure the device. Otherwise, set up a
-        second phone as a reader device.
-        """
-        self.pn532 = None
-
-        # This tracks the error message for a setup failure.
-        # It is set to None only if the entire setup_class runs successfully.
-        self._setup_failure_reason = 'Failed to find Android device(s).'
-
-        # Indicates if the setup failure should block (FAIL) or not block (SKIP) test cases.
-        # Blocking failures indicate that something unexpectedly went wrong during test setup,
-        # and the user should have it fixed.
-        # Non-blocking failures indicate that the device(s) did not meet the test requirements,
-        # and the test does not need to be run.
-        self._setup_failure_should_block_tests = True
-
-        try:
-            devices = self.register_controller(android_device)[:2]
-            if len(devices) == 1:
-                self.emulator = devices[0]
-            else:
-                self.emulator, self.reader = devices
-
-            self._setup_failure_reason = (
-                'Cannot load emulator snippet. Is NfcEmulatorTestApp.apk '
-                'installed on the emulator?'
-            )
-            self.emulator.load_snippet(
-                'nfc_emulator', 'com.android.nfc.emulator'
-            )
-            self.emulator.adb.shell(['svc', 'nfc', 'enable'])
-            self.emulator.debug_tag = 'emulator'
-            if (
-                not self.emulator.nfc_emulator.isNfcSupported() or
-                not self.emulator.nfc_emulator.isNfcHceSupported()
-            ):
-                self._setup_failure_reason = f'NFC is not supported on {self.emulator}'
-                self._setup_failure_should_block_tests = False
-                return
-
-            if (
-                hasattr(self.emulator, 'dimensions')
-                and 'pn532_serial_path' in self.emulator.dimensions
-            ):
-                pn532_serial_path = self.emulator.dimensions["pn532_serial_path"]
-            else:
-                pn532_serial_path = self.user_params.get("pn532_serial_path", "")
-
-            casimir_id = None
-            if self._is_cuttlefish_device(self.emulator):
-                self._setup_failure_reason = 'Failed to set up casimir connection for Cuttlefish device'
-                casimir_id = self._get_casimir_id_for_device()
-
-            if casimir_id is not None and len(casimir_id) > 0:
-                self._setup_failure_reason = 'Failed to connect to casimir'
-                _LOG.info("casimir_id = " + casimir_id)
-                self.pn532 = pn532.Casimir(casimir_id)
-            elif len(pn532_serial_path) > 0:
-                self._setup_failure_reason = 'Failed to connect to PN532 board.'
-                self.pn532 = pn532.PN532(pn532_serial_path)
-                self.pn532.mute()
-            else:
-                self._setup_failure_reason = 'Two devices are not present.'
-                _LOG.info("No value provided for pn532_serial_path. Defaulting to two-device " +
-                          "configuration.")
-                if len(devices) < 2:
-                    return
-                self._setup_failure_reason = (
-                    'Cannot load reader snippet. Is NfcReaderTestApp.apk '
-                    'installed on the reader?'
-                )
-                self.reader.load_snippet('nfc_reader', 'com.android.nfc.reader')
-                self.reader.adb.shell(['svc', 'nfc', 'enable'])
-                self.reader.debug_tag = 'reader'
-                if not self.reader.nfc_reader.isNfcSupported():
-                    self._setup_failure_reason = f'NFC is not supported on {self.reader}'
-                    self._setup_failure_should_block_tests = False
-                    return
-        except Exception as e:
-            _LOG.warning('setup_class failed with error %s', e)
-            return
-        self._setup_failure_reason = None
-
-    def setup_test(self):
-        """
-        Turns emulator/reader screen on and unlocks between tests as some tests will
-        turn the screen off.
-        """
-        if self._setup_failure_should_block_tests:
-            asserts.assert_true(
-                self._setup_failure_reason is None, self._setup_failure_reason
-            )
-        else:
-            asserts.skip_if(
-                self._setup_failure_reason is not None, self._setup_failure_reason
-            )
-
-        self.emulator.nfc_emulator.logInfo("*** TEST START: " + self.current_test_info.name +
-                                           " ***")
-        self.emulator.nfc_emulator.turnScreenOn()
-        self.emulator.nfc_emulator.pressMenu()
-        if not self.pn532:
-            self.reader.nfc_reader.turnScreenOn()
-            self.reader.nfc_reader.pressMenu()
-
-    def on_fail(self, record):
-        if self.user_params.get('take_bug_report_on_fail', False):
-            test_name = record.test_name
-            self.emulator.take_bug_report(
-                test_name=self.emulator.debug_tag + "_" + test_name,
-                destination=self.current_test_info.output_path,
-            )
-            if self.pn532 is None:
-                self.reader.take_bug_report(
-                    test_name=self.reader.debug_tag + "_" + test_name,
-                    destination=self.current_test_info.output_path,
-                )
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_single_non_payment_service(self):
-        """Tests successful APDU exchange between non-payment service and
-        reader.
-
-        Test Steps:
-        1. Start emulator activity and set up non-payment HCE Service.
-        2. Set callback handler on emulator for when a TestPass event is
-        received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies a successful APDU exchange between the emulator and
-        Transport Service after
-        _NFC_TIMEOUT_SEC.
-        """
-        self._set_up_emulator(
-            service_list=[_TRANSPORT_SERVICE_1],
-            expected_service=_TRANSPORT_SERVICE_1
-        )
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_TRANSPORT_SERVICE_1,
-            start_reader_fun=self.reader.nfc_reader.startSingleNonPaymentReaderActivity if not
-            self.pn532 else None
-        )
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2", "9.1/C-0-1"])
-    def test_single_payment_service(self):
-        """Tests successful APDU exchange between payment service and
-        reader.
-
-        Test Steps:
-        1. Set callback handler on emulator for when the instrumentation app is
-        set to default wallet app.
-        2. Start emulator activity and wait for the role to be set.
-        2. Set callback handler on emulator for when a TestPass event is
-        received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies emulator device sets the instrumentation emulator app to the
-        default wallet app.
-        2. Verifies a successful APDU exchange between the emulator and
-        Transport Service after _NFC_TIMEOUT_SEC.
-        """
-        self._set_up_emulator(
-            service_list=[_PAYMENT_SERVICE_1],
-            expected_service=_PAYMENT_SERVICE_1,
-            is_payment=True,
-            payment_default_service=_PAYMENT_SERVICE_1
-        )
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_PAYMENT_SERVICE_1,
-            start_reader_fun=self.reader.nfc_reader.startSinglePaymentReaderActivity if not
-            self.pn532 else None)
-
-    def test_single_payment_service_crashes(self):
-        """Tests successful APDU exchange between payment service and
-        reader.
-
-        Test Steps:
-        1. Set callback handler on emulator for when the instrumentation app is
-        set to default wallet app.
-        2. Start emulator activity and wait for the role to be set.
-        2. Set callback handler on emulator for when a TestPass event is
-        received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies emulator device sets the instrumentation emulator app to the
-        default wallet app.
-        2. Verifies a successful APDU exchange between the emulator and
-        Transport Service after _NFC_TIMEOUT_SEC.
-        """
-        self._set_up_emulator(
-            service_list=[_PAYMENT_SERVICE_1],
-            expected_service=_PAYMENT_SERVICE_1,
-            is_payment=True,
-            payment_default_service=_PAYMENT_SERVICE_1
-        )
-
-        ps = self.emulator.adb.shell(["ps", "|", "grep", "com.android.nfc.emulator.payment"]).decode("utf-8")
-        pid = ps.split()[1]
-        self.emulator.adb.shell(["kill", "-9", pid])
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_PAYMENT_SERVICE_1,
-            start_reader_fun=self.reader.nfc_reader.startSinglePaymentReaderActivity if not
-            self.pn532 else None)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2", "9.1/C-0-1"])
-    def test_dual_payment_service(self):
-        """Tests successful APDU exchange between a payment service and
-        reader when two payment services are set up on the emulator.
-
-        Test Steps:
-        1. Set callback handler on emulator for when the instrumentation app is
-        set to default wallet app.
-        2. Start emulator activity and wait for the role to be set.
-        2. Set callback handler on emulator for when a TestPass event is
-        received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies a successful APDU exchange between the emulator and the
-        payment service.
-        """
-        self._set_up_emulator(
-            service_list=[_PAYMENT_SERVICE_1,_PAYMENT_SERVICE_2],
-            expected_service=_PAYMENT_SERVICE_1,
-            is_payment=True,
-            payment_default_service=_PAYMENT_SERVICE_1
-        )
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_PAYMENT_SERVICE_1,
-            start_reader_fun=self.reader.nfc_reader.startDualPaymentReaderActivity
-            if not self.pn532 else None)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2", "9.1/C-0-1"])
-    def test_foreground_payment_emulator(self):
-        """Tests successful APDU exchange between non-default payment service and
-        reader when the foreground app sets a preference for the non-default
-        service.
-
-        Test Steps:
-        1. Set callback handler on emulator for when the instrumentation app is
-        set to default wallet app.
-        2. Start emulator activity and wait for the role to be set.
-        2. Set callback handler on emulator for when a TestPass event is
-        received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies a successful APDU exchange between the emulator and the
-        preferred service.
-        """
-        self._set_up_emulator(
-            service_list=[_PAYMENT_SERVICE_1, _PAYMENT_SERVICE_2],
-            preferred_service=_PAYMENT_SERVICE_2,
-            expected_service=_PAYMENT_SERVICE_2,
-            is_payment=True,
-            payment_default_service=_PAYMENT_SERVICE_2
-        )
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_PAYMENT_SERVICE_2, start_reader_fun=
-            self.reader.nfc_reader.startForegroundPaymentReaderActivity
-            if not self.pn532 else None)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_dynamic_aid_emulator(self):
-        """Tests successful APDU exchange between payment service and reader
-        when the payment service has registered dynamic AIDs.
-
-        Test Steps:
-        1. Set callback handler on emulator for when the instrumentation app is
-        set to default wallet app.
-        2. Start emulator activity and wait for the role to be set.
-        2. Set callback handler on emulator for when a TestPass event is
-        received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies a successful APDU exchange between the emulator and the
-        payment service with dynamic AIDs.
-        """
-        self._set_up_emulator(
-            start_emulator_fun=self.emulator.nfc_emulator.startDynamicAidEmulatorActivity,
-            payment_default_service=_PAYMENT_SERVICE_DYNAMIC_AIDS
-        )
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_PAYMENT_SERVICE_DYNAMIC_AIDS, start_reader_fun=
-            self.reader.nfc_reader.startDynamicAidReaderActivity if not self.pn532 else
-            None)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2", "9.1/C-0-1"])
-    def test_payment_prefix_emulator(self):
-        """Tests successful APDU exchange between payment service and reader
-        when the payment service has statically registered prefix AIDs.
-
-        Test Steps:
-        1. Set callback handler on emulator for when the instrumentation app is
-        set to default wallet app.
-        2. Start emulator activity and wait for the role to be set.
-        2. Set callback handler on emulator for when a TestPass event is
-        received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies a successful APDU exchange between the emulator and the
-        payment service with prefix AIDs.
-        """
-        self._set_up_emulator(
-            start_emulator_fun=self.emulator.nfc_emulator.startPrefixPaymentEmulatorActivity,
-            payment_default_service=_PREFIX_PAYMENT_SERVICE_1,
-            is_payment=True
-        )
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_PREFIX_PAYMENT_SERVICE_1,
-            start_reader_fun=self.reader.nfc_reader.startPrefixPaymentReaderActivity if not
-            self.pn532 else None
-        )
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2", "9.1/C-0-1"])
-    def test_prefix_payment_emulator_2(self):
-        """Tests successful APDU exchange between payment service and reader
-        when the payment service has statically registered prefix AIDs.
-        Identical to the test above, except PrefixPaymentService2 is set up
-        first in the emulator activity.
-
-        Test Steps:
-        1. Set callback handler on emulator for when the instrumentation app is
-        set to default wallet app.
-        2. Start emulator activity and wait for the role to be set.
-        2. Set callback handler on emulator for when a TestPass event is
-        received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies a successful APDU exchange between the emulator and the
-        payment service with prefix AIDs.
-        """
-        self._set_up_emulator(
-            start_emulator_fun=self.emulator.nfc_emulator.startPrefixPaymentEmulator2Activity,
-            payment_default_service=_PREFIX_PAYMENT_SERVICE_1,
-            is_payment=True
-        )
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_PREFIX_PAYMENT_SERVICE_1,
-            start_reader_fun=self.reader.nfc_reader.startPrefixPaymentReader2Activity if not
-            self.pn532 else None
-        )
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_other_prefix(self):
-        """Tests successful APDU exchange when the emulator dynamically
-        registers prefix AIDs for a non-payment service.
-
-        Test steps:
-        1. Start emulator activity.
-        2. Set callback handler on emulator for when ApduSuccess event is
-        received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies successful APDU sequence exchange.
-
-        """
-        self._set_up_emulator(
-            start_emulator_fun=self.emulator.nfc_emulator.startDualNonPaymentPrefixEmulatorActivity)
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_PREFIX_ACCESS_SERVICE,
-            start_reader_fun=self.reader.nfc_reader.startDualNonPaymentPrefixReaderActivity if not
-            self.pn532 else None
-        )
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_offhost_service(self):
-        """Tests successful APDU exchange between offhost service and reader.
-
-        Test Steps:
-        1. Start emulator activity.
-        2. Set callback handler for when reader TestPass event is received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies a successful APDU exchange inside the reader.
-        We cannot verify the APDUs in the emulator since we don't have access to the secure element.
-        """
-        self._set_up_emulator(
-            False, start_emulator_fun=self.emulator.nfc_emulator.startOffHostEmulatorActivity)
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_OFFHOST_SERVICE,
-            is_offhost=True,
-            start_reader_fun=self.reader.nfc_reader.startOffHostReaderActivity
-            if not self.pn532 else None)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_on_and_offhost_service(self):
-        """Tests successful APDU exchange between when reader selects both an on-host and off-host
-        service.
-
-        Test Steps:
-        1. Start emulator activity.
-        2. Set callback handler for when reader TestPass event is received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies a successful APDU exchange inside the reader.
-        We cannot verify the APDUs in the emulator since we don't have access to the secure element.
-        """
-        self._set_up_emulator(
-            start_emulator_fun=self.emulator.nfc_emulator.startOnAndOffHostEmulatorActivity)
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_TRANSPORT_SERVICE_1,
-            is_offhost=True,
-            start_reader_fun=self.reader.nfc_reader.startOnAndOffHostReaderActivity
-            if not self.pn532 else None)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_dual_non_payment(self):
-        """Tests successful APDU exchange between transport service and reader
-        when two non-payment services are enabled.
-
-        Test Steps:
-        1. Start emulator activity which sets up TransportService2 and
-        AccessService.
-        2. Set callback handler on emulator for when a TestPass event is
-        received.
-        3. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies a successful APDU exchange between the emulator and the
-        transport service.
-        """
-        self._set_up_emulator(
-            service_list=[_TRANSPORT_SERVICE_2, _ACCESS_SERVICE],
-            expected_service=_TRANSPORT_SERVICE_2,
-            is_payment=False
-        )
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service = _TRANSPORT_SERVICE_2,
-            start_reader_fun=self.reader.nfc_reader.startDualNonPaymentReaderActivity if not
-            self.pn532 else None)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_foreground_non_payment(self):
-        """Tests successful APDU exchange between non-payment service and
-          reader when the foreground app sets a preference for the
-          non-default service.
-
-          Test Steps:
-          1. Start emulator activity which sets up TransportService1 and
-          TransportService2
-          2. Set callback handler on emulator for when a TestPass event is
-          received.
-          3. Start reader activity, which should trigger APDU exchange between
-          reader and non-default service.
-
-          Verifies:
-          1. Verifies a successful APDU exchange between the emulator and the
-          transport service.
-          """
-        self._set_up_emulator(
-            service_list=[_TRANSPORT_SERVICE_1, _TRANSPORT_SERVICE_2],
-            preferred_service=_TRANSPORT_SERVICE_2,
-            expected_service=_TRANSPORT_SERVICE_2,
-            is_payment=False
-        )
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_TRANSPORT_SERVICE_2, start_reader_fun=
-            self.reader.nfc_reader.startForegroundNonPaymentReaderActivity
-            if not self.pn532 else None)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_throughput(self):
-        """Tests that APDU sequence exchange occurs with under 60ms per APDU.
-
-         Test Steps:
-         1. Start emulator activity.
-         2. Set callback handler on emulator for when a TestPass event is
-         received.
-         3. Start reader activity, which should trigger APDU exchange between
-         reader and non-default service.
-
-         Verifies:
-         1. Verifies a successful APDU exchange between the emulator and the
-         transport service with the duration averaging under 60 ms per single
-         exchange.
-         """
-        asserts.skip_if("_cf_x86_" in self.emulator.adb.getprop("ro.product.name"),
-                        "Skipping throughput test on Cuttlefish")
-        self.emulator.nfc_emulator.startThroughputEmulatorActivity()
-        test_pass_handler = self.emulator.nfc_emulator.asyncWaitForTestPass(
-            'ApduUnderThreshold')
-        if self.pn532:
-            command_apdus, response_apdus = get_apdus(self.emulator.nfc_emulator,
-                                                      _THROUGHPUT_SERVICE)
-            poll_and_transact(self.pn532, command_apdus, response_apdus)
-        else:
-            self.reader.nfc_reader.startThroughputReaderActivity()
-        test_pass_handler.waitAndGet('ApduUnderThreshold', _NFC_TIMEOUT_SEC)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_tap_50_times(self):
-        """Tests that 50 consecutive APDU exchanges are successful.
-
-        Test Steps:
-         1. Start emulator activity.
-         2. Perform the following sequence 50 times:
-            a. Set callback handler on emulator for when a TestPass event is
-            received.
-            b. Start reader activity.
-            c. Wait for successful APDU exchange.
-            d. Close reader activity.
-
-         Verifies:
-         1. Verifies 50 successful APDU exchanges.
-         """
-        self._set_up_emulator(
-            service_list=[_TRANSPORT_SERVICE_1],
-            expected_service=_TRANSPORT_SERVICE_1
-        )
-
-        if self.pn532:
-            command_apdus, response_apdus = get_apdus(self.emulator.nfc_emulator,
-                                                      _TRANSPORT_SERVICE_1)
-        for i in range(50):
-            if self.pn532:
-                tag_detected, transacted = poll_and_transact(self.pn532, command_apdus,
-                                                             response_apdus)
-                asserts.assert_true(
-                    tag_detected, _FAILED_TAG_MSG
-                )
-                asserts.assert_true(transacted, _FAILED_TRANSACTION_MSG)
-            else:
-                test_pass_handler = self.emulator.nfc_emulator.asyncWaitForTestPass(
-                    'ApduSuccess'
-                )
-                self.reader.nfc_reader.startTapTestReaderActivity()
-                test_pass_handler.waitAndGet('ApduSuccess', _NFC_TIMEOUT_SEC)
-                self.reader.nfc_reader.closeActivity()
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_large_num_aids(self):
-        """Tests that a long APDU sequence (256 commands/responses) is
-        successfully exchanged.
-
-        Test Steps:
-         1. Start emulator activity.
-         2. Set callback handler on emulator for when a TestPass event is
-         received.
-         3. Start reader activity.
-         4. Wait for successful APDU exchange.
-
-         Verifies:
-         1. Verifies successful APDU exchange.
-         """
-        self._set_up_emulator(
-            start_emulator_fun=self.emulator.nfc_emulator.startLargeNumAidsEmulatorActivity
-        )
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_LARGE_NUM_AIDS_SERVICE, start_reader_fun=
-            self.reader.nfc_reader.startLargeNumAidsReaderActivity
-            if not self.pn532 else None)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_screen_off_payment(self):
-        """Tests that APDU exchange occurs when device screen is off.
-
-        Test Steps:
-        1. Set callback handler on emulator for when the instrumentation app is
-        set to default wallet app.
-        2. Start emulator activity and wait for the role to be set.
-        3. Set callback handler for when screen is off.
-        4. Turn emulator screen off and wait for event.
-        5. Set callback handler on emulator for when a TestPass event is
-         received.
-        6. Start reader activity, which should trigger successful APDU exchange.
-        7. Wait for successful APDU exchange.
-
-        Verifies:
-        1. Verifies default wallet app is set.
-        2. Verifies screen is turned off on the emulator.
-        3. Verifies successful APDU exchange with emulator screen off.
-        """
-        self._set_up_emulator(
-            start_emulator_fun=self.emulator.nfc_emulator.startScreenOffPaymentEmulatorActivity,
-            payment_default_service=_SCREEN_OFF_PAYMENT_SERVICE,
-            is_payment=True
-        )
-
-        screen_off_handler = self.emulator.nfc_emulator.asyncWaitForScreenOff(
-            'ScreenOff')
-        self.emulator.nfc_emulator.turnScreenOff()
-        screen_off_handler.waitAndGet('ScreenOff', _NFC_TIMEOUT_SEC)
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_SCREEN_OFF_PAYMENT_SERVICE,
-            start_reader_fun=self.reader.nfc_reader.startScreenOffPaymentReaderActivity if not
-            self.pn532 else None
-        )
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_conflicting_non_payment(self):
-        """ This test registers two non-payment services with conflicting AIDs,
-        selects a service to use, and ensures the selected service exchanges
-        an APDU sequence with the reader.
-
-        Test Steps:
-        1. Start emulator.
-        2. Start reader.
-        3. Select a service on the emulator device from the list of services.
-        4. Disable polling on the reader.
-        5. Set a callback handler on the emulator for a successful APDU
-        exchange.
-        6. Re-enable polling on the reader, which should trigger the APDU
-        exchange with the selected service.
-
-        Verifies:
-        1. Verifies APDU exchange is successful between the reader and the
-        selected service.
-        """
-        self._set_up_emulator(service_list=[_TRANSPORT_SERVICE_1,_TRANSPORT_SERVICE_2],
-                              expected_service=_TRANSPORT_SERVICE_2, is_payment=False)
-        if self.pn532:
-            command_apdus, response_apdus = get_apdus(self.emulator.nfc_emulator, _TRANSPORT_SERVICE_2)
-            poll_and_transact(self.pn532, command_apdus[:1], response_apdus[:1])
-        else:
-            self.reader.nfc_reader.startConflictingNonPaymentReaderActivity()
-        self.emulator.nfc_emulator.selectItem()
-
-        if self.pn532:
-            tag_detected, transacted = poll_and_transact(self.pn532, command_apdus, response_apdus)
-            asserts.assert_true(
-                tag_detected, _FAILED_TAG_MSG
-            )
-            asserts.assert_true(transacted, _FAILED_TRANSACTION_MSG)
-        else:
-            self.reader.nfc_reader.setPollTech(_NFC_TECH_A_POLLING_OFF)
-            test_pass_handler = self.emulator.nfc_emulator.asyncWaitForTestPass(
-                'ApduSuccess'
-            )
-            self.reader.nfc_reader.setPollTech(_NFC_TECH_A_POLLING_ON)
-            test_pass_handler.waitAndGet('ApduSuccess', _NFC_TIMEOUT_SEC)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_conflicting_non_payment_prefix(self):
-        """ This test registers two non-payment services with conflicting
-        prefix AIDs, selects a service to use, and ensures the selected
-        service exchanges an APDU sequence with the reader.
-
-        Test Steps:
-        1. Start emulator.
-        2. Start reader.
-        3. Select a service on the emulator device from the list of services.
-        4. Disable polling on the reader.
-        5. Set a callback handler on the emulator for a successful APDU
-        exchange.
-        6. Re-enable polling on the reader, which should trigger the APDU
-        exchange with the selected service.
-
-        Verifies:
-        1. Verifies APDU exchange is successful between the reader and the
-        selected service.
-        """
-        self._set_up_emulator(
-            start_emulator_fun=
-                self.emulator.nfc_emulator.startConflictingNonPaymentPrefixEmulatorActivity,
-            is_payment=False
-        )
-        if self.pn532:
-            command_apdus, response_apdus = get_apdus(self.emulator.nfc_emulator,
-                                                      _PREFIX_TRANSPORT_SERVICE_2)
-            test_pass_handler = self.emulator.nfc_emulator.asyncWaitForTestPass(
-                'ApduSuccess'
-            )
-            poll_and_transact(self.pn532, command_apdus[:1], response_apdus[:1])
-        else:
-            self.reader.nfc_reader.startConflictingNonPaymentPrefixReaderActivity()
-
-        self.emulator.nfc_emulator.selectItem()
-
-        if self.pn532:
-            tag_detected, transacted = poll_and_transact(self.pn532, command_apdus, response_apdus)
-            asserts.assert_true(tag_detected, _FAILED_TAG_MSG)
-            asserts.assert_true(transacted, _FAILED_TRANSACTION_MSG)
-        else:
-            self.reader.nfc_reader.setPollTech(_NFC_TECH_A_POLLING_OFF)
-            test_pass_handler = self.emulator.nfc_emulator.asyncWaitForTestPass(
-                'ApduSuccess'
-            )
-            self.reader.nfc_reader.setPollTech(_NFC_TECH_A_POLLING_ON)
-
-        test_pass_handler.waitAndGet('ApduSuccess', _NFC_TIMEOUT_SEC)
-
-    #@CddTest(requirements = {"TODO"})
-    def test_event_listener(self):
-        """ This test registers an event listener with the emulator and ensures
-        that the event listener receives callbacks when the field status changes and
-        when an AID goes unrouted.
-
-        Test Steps:
-        1. Start the emulator.
-        2. Start the reader.
-        3. Select an unrouted AID on the emulator.
-        4. Select a routed AID on the emulator.
-
-        Verifies:
-        1. Verifies that the event listener receives callbacks when the field
-        status changes and when an AID goes unrouted.
-        """
-        self._set_up_emulator(
-            start_emulator_fun=self.emulator.nfc_emulator.startEventListenerActivity,
-            is_payment=False
-        )
-
-        if not self.pn532:
-            asserts.skip('PN532 is required for this test.')
-
-        # unrouted AID
-        command_apdus, response_apdus = get_apdus(self.emulator.nfc_emulator,
-                                                    _ACCESS_SERVICE)
-        test_pass_handler = self.emulator.nfc_emulator.asyncWaitForTestPass(
-            'EventListenerSuccess'
-        )
-        tag_detected, transacted = poll_and_transact(self.pn532, command_apdus, response_apdus)
-        asserts.assert_true(tag_detected, _FAILED_TAG_MSG)
-        asserts.assert_false(transacted, _FAILED_TRANSACTION_MSG)
-
-        # routed AID
-        command_apdus, response_apdus = get_apdus(self.emulator.nfc_emulator,
-                                                    _TRANSPORT_SERVICE_1)
-        tag_detected, transacted = poll_and_transact(self.pn532, command_apdus, response_apdus)
-        asserts.assert_true(tag_detected, _FAILED_TAG_MSG)
-        asserts.assert_true(transacted, _FAILED_TRANSACTION_MSG)
-        test_pass_handler.waitAndGet('EventListenerSuccess', _NFC_TIMEOUT_SEC)
-
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_protocol_params(self):
-        """ Tests that the Nfc-A and ISO-DEP protocol parameters are being
-        set correctly.
-
-        Test Steps:
-        1. Start emulator.
-        2. Start callback handler on reader for when a TestPass event is
-        received.
-        3. Start reader.
-        4. Wait for success event to be sent.
-
-        Verifies:
-        1. Verifies Nfc-A and ISO-DEP protocol parameters are set correctly.
-        """
-        success = False
-        self._set_up_emulator(
-            service_list=[],
-            expected_service=""
-        )
-        if self.pn532:
-            for i in range(_NUM_POLLING_LOOPS):
-                tag = self.pn532.poll_a()
-                msg = None
-                if tag is not None:
-                    success, msg = parse_protocol_params(tag.sel_res, tag.ats)
-                    self.pn532.mute()
-                    break
-                self.pn532.mute()
-            asserts.assert_true(success, msg if msg is not None else _FAILED_TAG_MSG)
-        else:
-            test_pass_handler = self.reader.nfc_reader.asyncWaitForTestPass(
-                'TestPass')
-            self.reader.nfc_reader.startProtocolParamsReaderActivity()
-            test_pass_handler.waitAndGet('TestPass', _NFC_TIMEOUT_SEC)
-
-    @CddTest(requirements = ["7.4.4/C-2-2", "7.4.4/C-1-2"])
-    def test_screen_on_only_off_host_service(self):
-        """
-        Test Steps:
-        1. Start emulator and turn screen off.
-        2. Start callback handler on reader for when a TestPass event is
-        received.
-        3. Start reader activity, which should trigger callback handler.
-        4. Ensure expected APDU is received.
-        5. Close reader and turn screen off on the emulator.
-
-        Verifies:
-        1. Verifies correct APDU response when screen is off.
-        2. Verifies correct APDU response between reader and off-host service
-        when screen is on.
-        """
-        #Tests APDU exchange with screen off.
-        self._set_up_emulator(
-            start_emulator_fun=self.emulator.nfc_emulator.startScreenOnOnlyOffHostEmulatorActivity
-        )
-        self.emulator.nfc_emulator.turnScreenOff()
-        screen_off_handler = self.emulator.nfc_emulator.asyncWaitForScreenOff(
-            'ScreenOff')
-        screen_off_handler.waitAndGet('ScreenOff', _NFC_TIMEOUT_SEC)
-        if not self.pn532:
-            self.reader.nfc_reader.closeActivity()
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_SCREEN_ON_ONLY_OFF_HOST_SERVICE,
-            is_offhost=True,
-            start_reader_fun=self.reader.nfc_reader.startScreenOnOnlyOffHostReaderActivity if not
-            self.pn532 else None
-        )
-
-        if self.pn532:
-            self.pn532.mute()
-        else:
-            self.reader.nfc_reader.closeActivity()
-
-        #Tests APDU exchange with screen on.
-        screen_on_handler = self.emulator.nfc_emulator.asyncWaitForScreenOn(
-            'ScreenOn')
-        self.emulator.nfc_emulator.pressMenu()
-        screen_on_handler.waitAndGet('ScreenOn', _NFC_TIMEOUT_SEC)
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_SCREEN_ON_ONLY_OFF_HOST_SERVICE,
-            is_offhost=True,
-            start_reader_fun=self.reader.nfc_reader.startScreenOnOnlyOffHostReaderActivity if
-            not self.pn532 else None
-        )
-
-    def test_single_payment_service_toggle_nfc_off_on(self):
-        """Tests successful APDU exchange between payment service and
-        reader.
-
-        Test Steps:
-        1. Set callback handler on emulator for when the instrumentation app is
-        set to default wallet app.
-        2. Start emulator activity and wait for the role to be set.
-        3. Toggle NFC off and back on the emulator.
-        4. Set callback handler on emulator for when a TestPass event is
-        received.
-        5. Start reader activity, which should trigger APDU exchange between
-        reader and emulator.
-
-        Verifies:
-        1. Verifies emulator device sets the instrumentation emulator app to the
-        default wallet app.
-        2. Verifies a successful APDU exchange between the emulator and
-        Transport Service after _NFC_TIMEOUT_SEC after toggling NFC off and on.
-        """
-        # Wait for instrumentation app to hold onto wallet role before starting
-        # reader
-        self._set_up_emulator(
-            service_list=[_PAYMENT_SERVICE_1],
-            expected_service=_PAYMENT_SERVICE_1,
-            is_payment=True,
-            payment_default_service=_PAYMENT_SERVICE_1
-        )
-
-        self.emulator.nfc_emulator.setNfcState(False)
-        self.emulator.nfc_emulator.setNfcState(True)
-
-        self._set_up_reader_and_assert_transaction(
-            expected_service=_PAYMENT_SERVICE_1,
-            start_reader_fun=self.reader.nfc_reader.startSinglePaymentReaderActivity if not
-            self.pn532 else None)
-
-    def test_polling_frame_timestamp(self):
-        """Tests that PollingFrame object timestamp values are reported correctly
-        and do not deviate from host measurements
-
-        Test Steps:
-        1. Toggle NFC reader field OFF
-        2. Start emulator activity
-        3. Perform a polling loop, wait for field OFF event.
-        4. Collect polling frames. Iterate over matching polling loop frame
-        and device time measurements. Calculate elapsed time for each and verify
-        that the host-device difference does not exceed the delay threshold.
-
-        Verifies:
-        1. Verifies that timestamp values are reported properly
-        for each tested frame type.
-        2. Verifies that the difference between matching host and device
-        timestamps does not exceed _POLLING_FRAME_TIMESTAMP_TOLERANCE_MS.
-        """
-        asserts.skip_if(not self.emulator.nfc_emulator.isObserveModeSupported(),
-            "Skipping polling frame timestamp test, observe mode not supported")
-
-        # 1. Mute the field before starting the emulator
-        # in order to be able to trigger ON event when the test starts
-        self.pn532.mute()
-
-        # 2. Start emuator activity
-        self._set_up_emulator(
-            start_emulator_fun=self.emulator.nfc_emulator.startPollingFrameEmulatorActivity
-        )
-
-        timed_pn532 = TimedWrapper(self.pn532)
-        testcases = [
-            POLLING_FRAME_ON,
-            *POLLING_FRAMES_TYPE_A_SPECIAL,
-            *POLLING_FRAMES_TYPE_A_SPECIAL,
-            *POLLING_FRAMES_TYPE_A_LONG,
-            *POLLING_FRAMES_TYPE_A_LONG,
-            *POLLING_FRAMES_TYPE_B_SPECIAL,
-            *POLLING_FRAMES_TYPE_B_SPECIAL,
-            *POLLING_FRAMES_TYPE_B_LONG,
-            *POLLING_FRAMES_TYPE_B_LONG,
-            *POLLING_FRAMES_TYPE_F_SPECIAL,
-            *POLLING_FRAMES_TYPE_F_SPECIAL,
-            POLLING_FRAME_OFF,
-        ]
-        # 3. Transmit polling frames
-        frames = poll_and_observe_frames(
-            pn532=timed_pn532,
-            emulator=self.emulator.nfc_emulator,
-            testcases=testcases,
-            restore_original_frame_ordering=True
-        )
-        timings = timed_pn532.timings
-
-        # Pre-format data for error if one happens
-        frame_stats = get_frame_test_stats(
-            frames=frames,
-            testcases=testcases,
-            timestamps=[ns_to_us(timestamp) for (_, timestamp) in timings]
-        )
-
-        # Check that there are as many polling loop events as frames sent
-        asserts.assert_equal(
-            len(testcases), len(frames),
-            _FAILED_MISSING_POLLING_FRAMES_MSG,
-            frame_stats
-        )
-
-        # For each event, calculate the amount of time elapsed since the previous one
-        # Subtract the resulting host/device time delta values
-        # Verify that the difference does not exceed the threshold
-        previous_timestamp_device = None
-        first_timestamp_start, first_timestamp_end = timings[0]
-        first_timestamp = (first_timestamp_start + first_timestamp_end) / 2
-        first_timestamp_error = (first_timestamp_end - first_timestamp_start)/ 2
-        first_timestamp_device = frames[0].timestamp
-
-        num_exceeding_threshold = 0
-        for idx, (frame, timing, testcase) in enumerate(zip(frames, timings, testcases)):
-            timestamp_host_start, timestamp_host_end = timing
-            timestamp_host = (timestamp_host_start + timestamp_host_end) / 2
-            timestamp_error = (timestamp_host_end - timestamp_host_start) / 2
-            timestamp_device = frame.timestamp
-
-            _LOG.debug(
-               f"{testcase.data.upper():32}" + \
-               f" ({testcase.configuration.type}" + \
-               f", {'+' if testcase.configuration.crc else '-'}" + \
-               f", {testcase.configuration.bits})" + \
-               f" -> {frame.data.hex().upper():32} ({frame.type})"
-            )
-
-            pre_previous_timestamp_device = previous_timestamp_device
-            previous_timestamp_device = timestamp_device
-
-            # Skip cases when timestamp value wraps
-            # as there's no way to establish the delta
-            # and re-establish the baselines
-            if (timestamp_device - first_timestamp_device) < 0:
-                _LOG.warning(
-                    "Timestamp value wrapped" + \
-                    f" from {pre_previous_timestamp_device}" + \
-                    f" to {previous_timestamp_device} for frame {frame};" + \
-                    " Skipping comparison..."
-                )
-                first_timestamp_device = timestamp_device
-                first_timestamp = timestamp_host
-                first_timestamp_error = timestamp_error
-                continue
-
-            device_host_difference = us_to_ms(timestamp_device - first_timestamp_device) - \
-                ns_to_ms(timestamp_host - first_timestamp)
-            total_error = ns_to_ms(timestamp_error + first_timestamp_error)
-            if abs(device_host_difference) > _POLLING_FRAME_TIMESTAMP_TOLERANCE_MS + total_error:
-                debug_info = {
-                    "index": idx,
-                    "frame_sent": testcase.format_for_error(timestamp=ns_to_us(timestamp_host)),
-                    "frame_received": frame.to_dict(),
-                    "difference": device_host_difference,
-                    "time_device": us_to_ms(timestamp_device - first_timestamp_device),
-                    "time_host": ns_to_ms(timestamp_host - first_timestamp),
-                    "total_error": total_error,
-                }
-                num_exceeding_threshold = num_exceeding_threshold + 1
-                _LOG.warning(f"Polling frame timestamp tolerance exceeded: {debug_info}")
-        asserts.assert_less(num_exceeding_threshold,
-                                  _POLLING_FRAME_TIMESTAMP_EXCEED_COUNT_TOLERANCE_)
-
-    def test_polling_frame_vendor_specific_gain(self):
-        """Tests that PollingFrame object vendorSpecificGain value
-        changes when overall NFC reader output power changes
-
-        Test Steps:
-        1. Toggle NFC reader field OFF
-        2. Start emulator activity
-        3. For each power level (0-100% with 20% step), send polling loop
-        consisting of normally encountered polling frames
-        4. For each result, calculate average vendorSpecificGain per NFC mode
-        compare those values against the previous power step, and assert that
-        they are equal or bigger than the previous one
-
-        Verifies:
-        1. Verifies that vendorSpecificGain value increases or stays the same
-        when PN532 output power increases.
-        """
-        asserts.skip_if(not self.emulator.nfc_emulator.isObserveModeSupported(),
-                    "Skipping polling frame gain test, observe mode not supported")
-
-        self.pn532.mute()
-        emulator = self.emulator.nfc_emulator
-
-        self._set_up_emulator(
-            start_emulator_fun=emulator.startPollingFrameEmulatorActivity
-        )
-
-        # Loop two times so that HostEmulationManager releases all frames
-        testcases = [
-            POLLING_FRAME_ON,
-            *POLLING_FRAMES_TYPE_A_SPECIAL,
-            *POLLING_FRAMES_TYPE_B_SPECIAL,
-            *POLLING_FRAMES_TYPE_F_SPECIAL,
-            POLLING_FRAME_OFF
-        ] * 2
-
-        # 6 steps; 0%, 20%, 40%, 60%, 80%, 100%
-        power_levels = [0, 1, 2, 3, 4, 5]
-        polling_frame_types = ("A", "B", "F")
-
-        results_for_power_level = {}
-
-        for power_level in power_levels:
-            # Warning for 0% might appear,
-            # as it's possible for no events to be produced
-            frames = poll_and_observe_frames(
-                testcases=testcases,
-                pn532=self.pn532,
-                emulator=emulator,
-                # Scale from 0 to 100%
-                power_level = power_level * 20,
-                ignore_field_off_event_timeout=power_level == 0
-            )
-
-            frames_for_type = {
-                type_: [
-                    f.vendor_specific_gain for f in frames if f.type == type_
-                ] for type_ in polling_frame_types
-            }
-            results_for_power_level[power_level] = {
-                # If no frames for type, assume gain is negative -1
-                type_: (sum(frames) / len(frames)) if len(frames) else -1
-                for type_, frames in frames_for_type.items()
-            }
-
-        _LOG.debug(f"Polling frame gain results {results_for_power_level}")
-
-        for power_level in power_levels:
-            # No value to compare to
-            if power_level == 0:
-                continue
-
-            for type_ in polling_frame_types:
-                previous_gain = results_for_power_level[power_level - 1][type_]
-                current_gain = results_for_power_level[power_level][type_]
-                asserts.assert_greater_equal(
-                    current_gain, previous_gain,
-                    _FAILED_VENDOR_GAIN_VALUE_DROPPED_ON_POWER_INCREASE,
-                    {
-                        "type": type_,
-                        "power_level": power_level * 20,
-                        "previous_gain": previous_gain,
-                        "current_gain": current_gain,
-                    }
-                )
-
-    def test_polling_frame_type(self):
-        """Tests that PollingFrame object 'type' value is set correctly
-
-        Test Steps:
-        1. Toggle NFC reader field OFF
-        2. Start emulator activity
-        3. Perform a polling loop, wait for field OFF event.
-        4. Collect polling frames. Iterate over sent and received frame pairs,
-        verify that polling frame type matches.
-
-        Verifies:
-        1. Verifies that PollingFrame.type value is set correctly
-        """
-        asserts.skip_if(not self.emulator.nfc_emulator.isObserveModeSupported(),
-                    "Skipping polling frame type test, observe mode not supported")
-        self.pn532.mute()
-        emulator = self.emulator.nfc_emulator
-
-        self._set_up_emulator(
-            start_emulator_fun=emulator.startPollingFrameEmulatorActivity
-        )
-
-        testcases = POLLING_FRAME_ALL_TEST_CASES
-
-        # 3. Transmit polling frames
-        frames = poll_and_observe_frames(
-            pn532=self.pn532,
-            emulator=self.emulator.nfc_emulator,
-            testcases=testcases,
-            restore_original_frame_ordering=True,
-        )
-
-        # Check that there are as many polling loop events as frames sent
-        asserts.assert_equal(
-            len(testcases), len(frames),
-            _FAILED_MISSING_POLLING_FRAMES_MSG,
-            get_frame_test_stats(frames=frames, testcases=testcases)
-        )
-
-        issues = [
-            {
-                "index": idx,
-                "expected": testcase.success_types,
-                "received": frame.type,
-                "data": frame.data.hex(),
-            } for idx, (testcase, frame) in enumerate(zip(testcases, frames))
-            if frame.type not in testcase.success_types
-        ]
-
-        asserts.assert_equal(len(issues), 0, _FAILED_FRAME_TYPE_INVALID, issues)
-
-    def test_polling_frame_data(self):
-        """Tests that PollingFrame object 'data' value is set correctly
-
-        Test Steps:
-        1. Toggle NFC reader field OFF
-        2. Start emulator activity
-        3. Perform a polling loop, wait for field OFF event.
-        4. Collect polling frames. Iterate over sent and received frame pairs,
-        verify that polling frame type matches.
-
-        Verifies:
-        1. Verifies that PollingFrame.data value is set correctly
-        """
-        asserts.skip_if(not self.emulator.nfc_emulator.isObserveModeSupported(),
-                    "Skipping polling frame data test, observe mode not supported")
-        self.pn532.mute()
-        emulator = self.emulator.nfc_emulator
-
-        self._set_up_emulator(
-            start_emulator_fun=emulator.startPollingFrameEmulatorActivity
-        )
-
-        testcases = POLLING_FRAME_ALL_TEST_CASES
-
-        # 3. Transmit polling frames
-        frames = poll_and_observe_frames(
-            pn532=self.pn532,
-            emulator=self.emulator.nfc_emulator,
-            testcases=testcases,
-            restore_original_frame_ordering=True,
-        )
-
-        # Check that there are as many polling loop events as frames sent
-        asserts.assert_equal(
-            len(testcases), len(frames),
-            _FAILED_MISSING_POLLING_FRAMES_MSG,
-            get_frame_test_stats(frames=frames, testcases=testcases)
-        )
-
-        issues = [
-            {
-                "index": idx,
-                "expected": testcase.expected_data,
-                "received": frame.data.hex()
-            } for idx, (testcase, frame) in enumerate(zip(testcases, frames))
-            if frame.data.hex() not in testcase.expected_data
-        ]
-
-        for testcase, frame in zip(testcases, frames):
-            if frame.data.hex() not in testcase.warning_data:
-                continue
-            _LOG.warning(
-                f"Polling frame data variation '{frame.data.hex()}'" + \
-                f" is accepted but not correct {testcase.success_data}"
-            )
-
-        asserts.assert_equal(len(issues), 0, _FAILED_FRAME_DATA_INVALID, issues)
-
-    def teardown_test(self):
-        if hasattr(self, 'emulator') and hasattr(self.emulator, 'nfc_emulator'):
-            self.emulator.nfc_emulator.closeActivity()
-            self.emulator.nfc_emulator.logInfo(
-                "*** TEST END: " + self.current_test_info.name + " ***")
-        param_list = []
-        if self.pn532:
-            self.pn532.reset_buffers()
-            self.pn532.mute()
-            param_list = [[self.emulator]]
-        elif hasattr(self, 'reader') and hasattr(self.reader, 'nfc_reader'):
-            self.reader.nfc_reader.closeActivity()
-            self.reader.nfc_reader.logInfo(
-                "*** TEST END: " + self.current_test_info.name + " ***")
-            param_list = [[self.emulator], [self.reader]]
-        utils.concurrent_exec(lambda d: d.services.create_output_excerpts_all(
-            self.current_test_info),
-                              param_list=param_list,
-                              raise_on_exception=True)
-
-if __name__ == '__main__':
-    # Take test args
-    if '--' in sys.argv:
-        index = sys.argv.index('--')
-        sys.argv = sys.argv[:1] + sys.argv[index + 1:]
-    test_runner.main()
diff --git a/hostsidetests/os/OWNERS b/hostsidetests/os/OWNERS
index cda6a22..867f59d 100644
--- a/hostsidetests/os/OWNERS
+++ b/hostsidetests/os/OWNERS
@@ -4,4 +4,3 @@
 per-file InattentiveSleepTests.java=qingxun@google.com
 per-file QuiescentBootTests.java=qingxun@google.com
 per-file StaticSharedLibsHostTests.java=patb@google.com
-per-file MemcgV2HostTests.java=tjmercier@google.com
diff --git a/hostsidetests/os/src/android/os/cts/MemcgV2HostTests.java b/hostsidetests/os/src/android/os/cts/MemcgV2HostTests.java
deleted file mode 100644
index f8473cc..0000000
--- a/hostsidetests/os/src/android/os/cts/MemcgV2HostTests.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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 static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-
-import com.android.tradefed.log.LogUtil.CLog;
-import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
-import com.android.tradefed.util.CommandResult;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-
-
-/*
- * These tests exercise kernel UAPIs for memory control groups (memcg) version 2, which Android may
- * use if configured to do so.
- *
- * No Android interfaces are tested here.
- *
- * If the device does not have memcg v2 enabled the tests will be skipped, but they will fail if
- * we cannot determine whether memcg v2 is enabled or not.
- */
-@RunWith(DeviceJUnit4ClassRunner.class)
-public class MemcgV2HostTests extends BaseHostJUnit4Test {
-
-    // For the remote possibility that it has been mounted somewhere other than the default
-    private String getCgroupV2MountPoint() {
-        try {
-            CommandResult commandResult = getDevice().executeShellV2Command("mount | grep cgroup2");
-            if (commandResult.getExitCode() == 0) {
-                String[] tokens = commandResult.getStdout().split("\\s+");
-                return tokens[2];
-            }
-        } catch (Exception ignore) { }
-
-        // Hope the default is correct
-        return "/sys/fs/cgroup";
-    }
-
-    private Boolean isMemcgV2Enabled() {
-        try {
-            CommandResult commandResult = getDevice().executeShellV2Command(
-                    "grep memory /proc/cgroups");
-
-            if (commandResult.getExitCode() == 0) {
-                String[] tokens = commandResult.getStdout().split("\\s+");
-                boolean memcg_enabled = tokens[3].equals("1");
-                if (!memcg_enabled) return false;
-                return tokens[1].equals("0"); // 0 == default hierarchy == v2
-            } else if (commandResult.getExitCode() == 1) { // "memory" not found by grep
-                // We know for sure it's not enabled, either because it is mounted as v1
-                // (cgroups.json override), or because it was intentionally disabled via kernel
-                // command line (cgroup_disable=memory), or because it's not built in to the
-                // kernel (CONFIG_MEMCG is not set).
-                return false;
-            } else { // Problems accessing /proc/cgroups
-                CLog.w("Could not read /proc/cgroups: " + commandResult.getStderr());
-                // We don't really know if it's enabled or not. Try checking the root
-                // cgroup.controllers file directly.
-                String cg_controllers_path = mCgroupV2Root + "/cgroup.controllers";
-
-                commandResult = getDevice().executeShellV2Command(
-                    "grep memory " + cg_controllers_path);
-                if (commandResult.getExitCode() == 0) return true;
-                if (commandResult.getExitCode() == 1) return false;
-
-                CLog.e("Could not determine if memcg v2 is enabled: " + commandResult.getStderr());
-            }
-        } catch (Exception e) {
-            CLog.e(e.toString());
-        }
-        return null;
-    }
-
-    // Record the original subtree state for memcg so we can restore it after the test if necessary
-    private Boolean checkRootSubtreeState() {
-        try {
-            CommandResult commandResult = getDevice().executeShellV2Command(
-                    "grep memory " + mCgroupV2Root + "/cgroup.subtree_control");
-            if (commandResult.getExitCode() == 0) return true;
-            if (commandResult.getExitCode() == 1) return false;
-
-            CLog.e("Could not determine if root memcg subtree control is enabled: "
-                    + commandResult.getStderr());
-        } catch (Exception e) {
-            CLog.e(e.toString());
-        }
-        return null;
-    }
-
-    private String mCgroupV2Root;
-    private Boolean mMemcgV2Enabled;
-    private Boolean mRootSubtreeStateWasEnabled;
-    private String mChildCgroup;
-
-    @Before
-    public void initialize() {
-        mCgroupV2Root = getCgroupV2MountPoint();
-        mMemcgV2Enabled = isMemcgV2Enabled();
-        mRootSubtreeStateWasEnabled = checkRootSubtreeState();
-
-        assertNotNull(mMemcgV2Enabled);
-        assertNotNull(mRootSubtreeStateWasEnabled);
-    }
-
-    @After
-    public void cleanup() {
-        try {
-            if (mChildCgroup != null) getDevice().executeShellV2Command("rmdir " + mChildCgroup);
-
-            if (mRootSubtreeStateWasEnabled != null && !mRootSubtreeStateWasEnabled) {
-                getDevice().executeShellV2Command(
-                        "echo -memory > " + mCgroupV2Root + "/cgroup.subtree_control");
-            }
-        } catch (Exception ignore) { }
-    }
-
-    @Test
-    public void testCanActivateMemcgV2Cgroup() throws Exception {
-        assumeTrue(mMemcgV2Enabled);
-
-        // The root has to have memcg in the subtree control to activate it in children
-        if (!mRootSubtreeStateWasEnabled) {
-            CommandResult commandResult = getDevice().executeShellV2Command(
-                    "echo +memory > " + mCgroupV2Root + "/cgroup.subtree_control");
-            assertTrue("Could not activate memcg under root", commandResult.getExitCode() == 0);
-        }
-
-        // Make a new, temporary, randomly-named v2 cgroup in which we will attempt to activate
-        // memcg
-        CommandResult commandResult = getDevice().executeShellV2Command(
-                "mktemp -d -p " + mCgroupV2Root + " " + this.getClass().getSimpleName()
-                + ".XXXXXXXXXX");
-        assertTrue("Could not make child cgroup", commandResult.getExitCode() == 0);
-
-        mChildCgroup = commandResult.getStdout();
-
-
-        commandResult = getDevice().executeShellV2Command(
-            "grep memory " + mChildCgroup + "/cgroup.controllers");
-        assertTrue("Memcg was not activated in child cgroup", commandResult.getExitCode() == 0);
-
-
-        commandResult = getDevice().executeShellV2Command(
-                "echo +memory > " + mChildCgroup + "/cgroup.subtree_control");
-        assertTrue("Could not activate memcg for child cgroup subtree",
-                commandResult.getExitCode() == 0);
-    }
-
-
-    // Test for fix: mm: memcg: use larger batches for proactive reclaim
-    // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=287d5fedb377ddc232b216b882723305b27ae31a
-    @Test(timeout = 20000)
-    public void testProactiveReclaimDoesntTakeForever() throws Exception {
-        // Not all kernels have memory.reclaim
-        CommandResult commandResult = getDevice().executeShellV2Command(
-                "test -f " + mCgroupV2Root + "/memory.reclaim");
-        assumeTrue(commandResult.getExitCode() == 0);
-
-        // Use the total device memory as the amount to reclaim
-        commandResult = getDevice().executeShellV2Command("free -b | grep ^Mem | awk '{print $2}'");
-        assertTrue("Could not determine total device memory.", commandResult.getExitCode() == 0);
-        String totalMem = commandResult.getStdout();
-
-        getDevice().executeShellV2Command(
-                "echo " + totalMem + " > " + mCgroupV2Root + "/memory.reclaim");
-        // This is a test for completion within the timeout. The command is likely to "fail" with
-        // exit code 1 since we are asking to reclaim all device memory.
-    }
-
-}
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9558/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9558/Android.bp
index 3c89092..6e63d87 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9558/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9558/Android.bp
@@ -31,9 +31,9 @@
         "libnfc-nci",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/include",
     ],
 }
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9584/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9584/Android.bp
index db8bef5..eacd54b 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9584/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9584/Android.bp
@@ -33,11 +33,11 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
-        "system/nfc/src/nfa/include/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9585/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9585/Android.bp
index 38e0a2d..4adfcef 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9585/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9585/Android.bp
@@ -33,11 +33,11 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
-        "system/nfc/src/nfa/include/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2012/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2012/Android.bp
index cca4789..0a7dbd8 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2012/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2012/Android.bp
@@ -29,10 +29,10 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2013/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2013/Android.bp
index 5e1c068..5f61b97 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2013/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2013/Android.bp
@@ -29,10 +29,10 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2014/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2014/Android.bp
index 1310f25..f1eb1cf 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2014/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2014/Android.bp
@@ -28,10 +28,10 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2015/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2015/Android.bp
index 2e72397..a56cc34 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2015/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2015/Android.bp
@@ -32,11 +32,11 @@
         "libnfc-nci",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/include",
-        "system/nfc/src/nfa/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include",
     ],
     cflags: [
         "-DCHECK_OVERFLOW",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2017/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2017/Android.bp
index 84f29fa..1b13d18 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2017/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2017/Android.bp
@@ -31,9 +31,9 @@
         "libnfc-nci",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/include",
     ],
 }
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2019/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2019/Android.bp
index f4e714d..1d50247 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2019/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2019/Android.bp
@@ -32,10 +32,10 @@
         "-DENABLE_SELECTIVE_OVERLOADING",
     ],
     include_dirs: [
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
-        "system/nfc/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2021/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2021/Android.bp
index beef9dd..d149956 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2021/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2021/Android.bp
@@ -32,10 +32,10 @@
         "libnfc-nci",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/include",
     ],
     cflags: [
         "-DCHECK_OVERFLOW",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2022/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2022/Android.bp
index d0f765f..4dfbd62 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2022/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2022/Android.bp
@@ -29,10 +29,10 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2031/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2031/Android.bp
index b129f3f..aa7b981 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2031/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2031/Android.bp
@@ -33,11 +33,11 @@
         "liblog",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/include",
-        "system/nfc/src/nfa/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include",
     ],
     cflags: [
         "-DCHECK_OVERFLOW",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2035/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2035/Android.bp
index 6112f23..0aad2da 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2035/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2035/Android.bp
@@ -32,10 +32,10 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2038/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2038/Android.bp
index 7b17718..983c5c3 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2038/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2038/Android.bp
@@ -34,10 +34,10 @@
         "liblog",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/include",
     ],
     cflags: [
         "-DCHECK_OVERFLOW",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2039/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2039/Android.bp
index 5f8e1f6..99675a3 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2039/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2039/Android.bp
@@ -34,10 +34,10 @@
         "liblog",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/include",
     ],
     cflags: [
         "-DCHECK_OVERFLOW",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2040/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2040/Android.bp
index 3c1c46d..47f5efc 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2040/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2040/Android.bp
@@ -32,10 +32,10 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2099/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2099/Android.bp
index 111aa18..e34cfb4 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2099/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2099/Android.bp
@@ -27,11 +27,11 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
-        "system/nfc/src/nfa/include/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2178/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2178/Android.bp
index 5011c15..3107ab4 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2178/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2178/Android.bp
@@ -29,10 +29,10 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2206/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2206/Android.bp
index d173ec6..9833518 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2206/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2206/Android.bp
@@ -29,11 +29,11 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
-        "system/nfc/src/nfa/include/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2207/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2207/Android.bp
index a1041ff..9b0cf17 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2207/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2207/Android.bp
@@ -29,11 +29,11 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
-        "system/nfc/src/nfa/include/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0006/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0006/Android.bp
index adb7b2b..2ab63a6 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0006/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0006/Android.bp
@@ -33,10 +33,10 @@
         "-DENABLE_SELECTIVE_OVERLOADING",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0037/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0037/Android.bp
index 11b331e..7a19953 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0037/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0037/Android.bp
@@ -33,11 +33,11 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
-        "system/nfc/src/nfa/include/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0038/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0038/Android.bp
index 3fa3d09..0f93613 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0038/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0038/Android.bp
@@ -33,11 +33,11 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
-        "system/nfc/src/nfa/include/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0039/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0039/Android.bp
index d0153e5..bc07b66 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0039/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0039/Android.bp
@@ -33,11 +33,11 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
-        "system/nfc/src/nfa/include/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0072/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0072/Android.bp
index e148603..50b0256 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0072/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0072/Android.bp
@@ -32,9 +32,9 @@
         "liblog",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/include",
     ],
 }
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0073/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0073/Android.bp
index 724f945..1e2f624 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0073/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0073/Android.bp
@@ -28,10 +28,10 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/include",
-        "system/nfc/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0450/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0450/Android.bp
index 7eaa0ae..f891d7d 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0450/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0450/Android.bp
@@ -34,11 +34,11 @@
     multilib: {
         lib64: {
             include_dirs: [
-                "system/nfc/src/nfc/include/",
-                "system/nfc/src/include/",
-                "system/nfc/src/gki/common/",
-                "system/nfc/src/gki/ulinux/",
-                "system/nfc/src/nfa/include/",
+                "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+                "packages/modules/Nfc/libnfc-nci/src/include/",
+                "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+                "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
+                "packages/modules/Nfc/libnfc-nci/src/nfa/include/",
             ],
             shared_libs: [
                 "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0430/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0430/Android.bp
index c3a9fa6..dad00dd 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0430/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0430/Android.bp
@@ -32,10 +32,10 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0473/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0473/Android.bp
index c74f6d6..cbd80b8 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0473/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0473/Android.bp
@@ -31,9 +31,9 @@
         "libnfc-nci",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/include",
     ],
 }
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/Android.bp
index 3eaa90d..b726885 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/Android.bp
@@ -31,12 +31,12 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/fuzzers/rw/",
-        "system/nfc/src/include",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/fuzzers/inc",
+        "packages/modules/Nfc/libnfc-nci/src/fuzzers/rw/",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/fuzzers/inc",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/poc.cpp
index a9d3dff..f262a87 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/poc.cpp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/poc.cpp
@@ -15,8 +15,8 @@
  */
 
 /* Following files are taken as reference to come up with this PoC */
-/* 1. 'system/nfc/src/fuzzers/fuzz_utils.cc'                       */
-/* 2. 'system/nfc/src/fuzzers/rw/main.cc'                          */
+/* 1. 'packages/modules/Nfc/libnfc-nci/src/fuzzers/fuzz_utils.cc'                       */
+/* 2. 'packages/modules/Nfc/libnfc-nci/src/fuzzers/rw/main.cc'                          */
 
 #include <vector>
 #include "../includes/common.h"
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/stubs.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/stubs.cpp
index 2732ebc..758663f 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/stubs.cpp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/stubs.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* 'system/nfc/src/fuzzers/ce/stubs.cc' is used as reference to come up with file */
+/* 'packages/modules/Nfc/libnfc-nci/src/fuzzers/ce/stubs.cc' is used as reference to come up with file */
 
 #include "fuzz_cmn.h"
 
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/t4t.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/t4t.cpp
index 65cb764..9e951c9 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/t4t.cpp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0925/t4t.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* 'system/nfc/src/fuzzers/rw/t4t.cc' is used as reference to come up with file */
+/* 'packages/modules/Nfc/libnfc-nci/src/fuzzers/rw/t4t.cc' is used as reference to come up with file */
 
 #include "fuzz.h"
 
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0956/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0956/Android.bp
index e498b7d9..a66b4e4 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0956/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0956/Android.bp
@@ -35,11 +35,11 @@
         "jni_headers",
     ],
     include_dirs: [
-        "packages/apps/Nfc/nci/jni",
-        "system/nfc/src/nfa/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/include",
-        "system/nfc/src/gki/ulinux",
-        "system/nfc/src/nfc/include",
+        "packages/modules/Nfc/NfcNci/nci/jni",
+        "packages/modules/Nfc/libnfc-nci/src/nfa/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
     ],
 }
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-39675/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-39675/Android.bp
index 68cf00a..f91df3e 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-39675/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-39675/Android.bp
@@ -33,8 +33,8 @@
         "libnfc-nci",
     ],
     include_dirs: [
-        "system/nfc/src/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
     ],
 }
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2022-20127/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2022-20127/Android.bp
index 0624a17..669d10e 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2022-20127/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2022-20127/Android.bp
@@ -33,9 +33,9 @@
         "libnfc-nci",
     ],
     include_dirs: [
-        "system/nfc/src/include/",
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
     ],
 }
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2022-20131/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2022-20131/Android.bp
index b9c7aff..47f707b 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2022-20131/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2022-20131/Android.bp
@@ -29,10 +29,10 @@
     ],
     compile_multilib: "64",
     include_dirs: [
-        "system/nfc/src/nfc/include/",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/common/",
-        "system/nfc/src/gki/ulinux/",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include/",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux/",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2023-21085/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2023-21085/Android.bp
index 08ac323..e9df4e8 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2023-21085/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2023-21085/Android.bp
@@ -31,9 +31,9 @@
         "libnfc-nci",
     ],
     include_dirs: [
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/include/",
-        "system/nfc/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/include/",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
     ],
     cflags: [
         "-DENABLE_SELECTIVE_OVERLOADING",
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2023-21241/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2023-21241/Android.bp
index 6c4cb50..f2ef6a4 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2023-21241/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2023-21241/Android.bp
@@ -29,10 +29,10 @@
     ],
     include_dirs: [
         "cts/hostsidetests/securitybulletin/securityPatch/includes",
-        "system/nfc/src/nfc/include",
-        "system/nfc/src/include",
-        "system/nfc/src/gki/common",
-        "system/nfc/src/gki/ulinux",
+        "packages/modules/Nfc/libnfc-nci/src/nfc/include",
+        "packages/modules/Nfc/libnfc-nci/src/include",
+        "packages/modules/Nfc/libnfc-nci/src/gki/common",
+        "packages/modules/Nfc/libnfc-nci/src/gki/ulinux",
     ],
     shared_libs: [
         "libnfc-nci",
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/memorysafety/OWNERS b/hostsidetests/statsdatom/src/android/cts/statsdatom/memorysafety/OWNERS
index c95d3cf..a49d9ce 100644
--- a/hostsidetests/statsdatom/src/android/cts/statsdatom/memorysafety/OWNERS
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/memorysafety/OWNERS
@@ -1,4 +1,3 @@
 fmayer@google.com
 
-eugenis@google.com
 pcc@google.com
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/perfetto/PerfettoTests.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/perfetto/PerfettoTests.java
index 50a989f..17f1ded 100644
--- a/hostsidetests/statsdatom/src/android/cts/statsdatom/perfetto/PerfettoTests.java
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/perfetto/PerfettoTests.java
@@ -184,6 +184,10 @@
         if (DeviceUtils.hasFeature(getDevice(), DeviceUtils.FEATURE_WATCH)) return;
 
         StatsdConfig.Builder config = ConfigUtils.createConfigBuilder("AID_NOBODY");
+
+        // TODO(lalitm): remove this once CTS is no longer being released for 24Q3.
+        config.addAllowedLogSource("AID_SHELL");
+
         ConfigUtils.addEventMetric(config, AtomsProto.Atom.PERFETTO_TRIGGER_FIELD_NUMBER);
         ConfigUtils.uploadConfig(getDevice(), config);
 
@@ -192,9 +196,14 @@
 
         List<EventMetricData> data = ReportUtils.getEventMetricDataList(getDevice());
         assertThat(data).hasSize(1);
-        assertThat(extractPerfettoTriggerEvents(data))
-                .containsExactly(
-                        PerfettoTrigger.Event.PERFETTO_TRACED_TRIGGER);
+
+        List<PerfettoTrigger.Event> triggerEvents = extractPerfettoTriggerEvents(data);
+        assertThat(triggerEvents).hasSize(1);
+
+        // TODO(lalitm): remove this once CTS is no longer being released for 24Q3.
+        assertThat(triggerEvents).containsAnyOf(
+            PerfettoTrigger.Event.PERFETTO_TRACED_TRIGGER,
+            PerfettoTrigger.Event.PERFETTO_TRIGGER_PERFETTO_TRIGGER);
     }
 
     private ByteString getPerfettoIncidentConfig() {
diff --git a/hostsidetests/tagging/OWNERS b/hostsidetests/tagging/OWNERS
index b7003d6..1e750bd6 100644
--- a/hostsidetests/tagging/OWNERS
+++ b/hostsidetests/tagging/OWNERS
@@ -1,4 +1,3 @@
 # Bug component: 14890
-eugenis@google.com
 pcc@google.com
 fmayer@google.com
diff --git a/tests/app/shared/AndroidManifest.xml b/tests/app/shared/AndroidManifest.xml
index 2eea680..00cdc83 100644
--- a/tests/app/shared/AndroidManifest.xml
+++ b/tests/app/shared/AndroidManifest.xml
@@ -31,5 +31,44 @@
                 <action android:name="android.accessibilityservice.AccessibilityService" />
             </intent-filter>
         </service>
+
+        <!-- The following components are needed for the test to hold the SMS role -->
+        <activity android:name="android.app.stubs.shared.SmsActivity"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.SENDTO" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:scheme="smsto" />
+            </intent-filter>
+        </activity>
+
+        <!-- The following components are needed for the test app to hold the SMS role -->
+
+        <service android:name="android.app.stubs.shared.SmsService"
+            android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.RESPOND_VIA_MESSAGE" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <data android:scheme="smsto" />
+            </intent-filter>
+        </service>
+
+        <receiver android:name="android.app.stubs.shared.SmsReceiver"
+            android:permission="android.permission.BROADCAST_SMS"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.provider.Telephony.SMS_DELIVER" />
+            </intent-filter>
+        </receiver>
+
+        <receiver android:name="android.app.stubs.shared.SmsReceiver2"
+            android:permission="android.permission.BROADCAST_WAP_PUSH"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />
+                <data android:mimeType="application/vnd.wap.mms-message" />
+            </intent-filter>
+        </receiver>
     </application>
 </manifest>
diff --git a/tests/app/shared/src/android/app/stubs/shared/SmsRoleComponents.kt b/tests/app/shared/src/android/app/stubs/shared/SmsRoleComponents.kt
new file mode 100644
index 0000000..58799ca
--- /dev/null
+++ b/tests/app/shared/src/android/app/stubs/shared/SmsRoleComponents.kt
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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.app.stubs.shared
+
+import android.app.Activity
+import android.app.Service
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.os.IBinder
+
+// Stub services, receivers, and activities that let the test app hold the SMS role
+
+class SmsReceiver : BroadcastReceiver() {
+    override fun onReceive(context: Context?, intent: Intent?) { /* stub */ }
+}
+
+class SmsReceiver2 : BroadcastReceiver() {
+    override fun onReceive(context: Context?, intent: Intent?) { /* stub */ }
+}
+
+class SmsService : Service() {
+    override fun onBind(intent: Intent?): IBinder? { return null }
+}
+
+class SmsActivity : Activity()
diff --git a/tests/app/src/android/app/cts/AppTaskTests.java b/tests/app/src/android/app/cts/AppTaskTests.java
index cda04a4..8caed88 100644
--- a/tests/app/src/android/app/cts/AppTaskTests.java
+++ b/tests/app/src/android/app/cts/AppTaskTests.java
@@ -182,7 +182,7 @@
             waitAndAssertCondition(() -> targetResumed.value,
                     "Expected activity brought to front and resumed");
         }
-        assertTrue(appTask.getTaskInfo().isVisible());
+        waitAndAssertCondition(() -> appTask.getTaskInfo().isVisible(), "Waiting for task visible");
         assertEquals(appTask.getTaskInfo().topActivity, firstActivity.getComponentName());
         waitAndAssertCondition(() -> firstActivity.isTopResumed,
                 "First activity is top resumed");
diff --git a/tests/appsearch/AndroidManifest.xml b/tests/appsearch/AndroidManifest.xml
index 8650b1d..4daa0b2 100644
--- a/tests/appsearch/AndroidManifest.xml
+++ b/tests/appsearch/AndroidManifest.xml
@@ -32,19 +32,6 @@
 
     <application android:label="CtsAppSearchTestCases">
         <uses-library android:name="android.test.runner"/>
-
-        <activity android:name="android.app.appsearch.testutil.functions.ActivityCreationSynchronizer"
-                  android:exported="true"/>
-        <service android:name="android.app.appsearch.testutil.functions.TestAppFunctionService"
-                 android:exported="true"
-                 android:process=":appfunctions">
-            <intent-filter>
-                <action android:name="android.app.appsearch.functions.AppFunctionService"/>
-            </intent-filter>
-        </service>
-        <receiver
-            android:name="android.app.appsearch.testutil.functions.TestAppFunctionServiceLifecycleReceiver"
-            android:exported="false"/>
     </application>
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.cts.appsearch"
diff --git a/tests/appsearch/src/com/android/cts/appsearch/functions/AppFunctionManagerCtsTest.java b/tests/appsearch/src/com/android/cts/appsearch/functions/AppFunctionManagerCtsTest.java
deleted file mode 100644
index d6c0496..0000000
--- a/tests/appsearch/src/com/android/cts/appsearch/functions/AppFunctionManagerCtsTest.java
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.app.appsearch.cts.functions;
-
-import static android.app.appsearch.AppSearchResult.RESULT_INTERNAL_ERROR;
-import static android.app.appsearch.AppSearchResult.RESULT_INVALID_ARGUMENT;
-import static android.app.appsearch.AppSearchResult.RESULT_NOT_FOUND;
-import static android.app.appsearch.AppSearchResult.RESULT_SECURITY_ERROR;
-import static android.app.appsearch.AppSearchResult.RESULT_TIMED_OUT;
-import static android.app.appsearch.AppSearchResult.RESULT_UNKNOWN_ERROR;
-import static android.app.appsearch.functions.ExecuteAppFunctionResponse.PROPERTY_RESULT;
-import static android.app.appsearch.testutil.functions.TestAppFunctionServiceLifecycleReceiver.waitForServiceOnCreate;
-import static android.app.appsearch.testutil.functions.TestAppFunctionServiceLifecycleReceiver.waitForServiceOnDestroy;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.app.appsearch.AppSearchManager;
-import android.app.appsearch.AppSearchResult;
-import android.app.appsearch.GenericDocument;
-import android.app.appsearch.functions.AppFunctionManager;
-import android.app.appsearch.functions.ExecuteAppFunctionRequest;
-import android.app.appsearch.functions.ExecuteAppFunctionResponse;
-import android.app.appsearch.testutil.PackageUtil;
-import android.app.appsearch.testutil.functions.ActivityCreationSynchronizer;
-import android.app.appsearch.testutil.functions.TestAppFunctionServiceLifecycleReceiver;
-import android.content.Context;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-import android.platform.test.flag.junit.CheckFlagsRule;
-import android.platform.test.flag.junit.DeviceFlagsValueProvider;
-
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.appsearch.flags.Flags;
-import com.android.bedstead.harrier.BedsteadJUnit4;
-import com.android.bedstead.harrier.DeviceState;
-import com.android.bedstead.enterprise.annotations.EnsureHasWorkProfile;
-import com.android.bedstead.harrier.annotations.Postsubmit;
-import com.android.bedstead.harrier.annotations.RequireRunOnWorkProfile;
-import com.android.bedstead.enterprise.annotations.EnsureHasDeviceOwner;
-import com.android.bedstead.enterprise.annotations.EnsureHasNoDeviceOwner;
-import com.android.compatibility.common.util.ApiTest;
-import com.android.compatibility.common.util.DeviceConfigStateChangerRule;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
-/**
- * CTS for {@link AppFunctionManager}.
- *
- * Implementation notes:
- * We are using Bedstead to create the multi-user environment. To speed up test execution,
- * Bedstead does not clean up the environment unless the test explicitly asks it to.
- * For example, if there is a test setting up a device owner with @EnsureHasDeviceOwner, the
- * latter tests will run with a device owner. To tell Bedstead to remove the device owner,
- * we annotate the test functions with @EnsureHasNoDeviceOwner.
- */
-@RequiresFlagsEnabled(Flags.FLAG_ENABLE_APP_FUNCTIONS)
-@RunWith(BedsteadJUnit4.class)
-public class AppFunctionManagerCtsTest {
-    @ClassRule
-    @Rule
-    public static final DeviceState sDeviceState = new DeviceState();
-
-    @Rule
-    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
-
-    private static final String TARGET_PACKAGE = "com.android.cts.appsearch";
-    private static final String PKG_B = "com.android.cts.appsearch.helper.b";
-    private static final long SHORT_TIMEOUT_SECOND = 1;
-    private static final long LONG_TIMEOUT_SECOND = 5;
-
-    private final Context mContext = ApplicationProvider.getApplicationContext();
-    private AppFunctionManager mAppFunctionManager;
-
-    /** This rule establishes a shorter timeout for testing timeout scenarios. */
-    @Rule
-    public final DeviceConfigStateChangerRule mSetTimeoutRule =
-            new DeviceConfigStateChangerRule(
-                    mContext, "appsearch", "app_function_call_timeout_millis", "1000");
-
-    @Before
-    public void setup() {
-        ActivityCreationSynchronizer.reset();
-        TestAppFunctionServiceLifecycleReceiver.reset();
-        AppSearchManager appSearchManager = mContext.getSystemService(AppSearchManager.class);
-        mAppFunctionManager = appSearchManager.getAppFunctionManager();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    public void executeAppFunction_failed_noSuchMethod() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "invalid").build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isFalse();
-        assertThat(response.getResultCode()).isEqualTo(RESULT_NOT_FOUND);
-        assertServiceDestroyed();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_onlyInvokeCallbackOnce() throws Exception {
-        GenericDocument parameters = new GenericDocument.Builder("", "", "")
-                .setPropertyLong("a", 1)
-                .setPropertyLong("b", 2)
-                .build();
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "add_invokeCallbackTwice")
-                        .setParameters(parameters)
-                        .build();
-        LinkedBlockingQueue<AppSearchResult<ExecuteAppFunctionResponse>> blockingQueue =
-                new LinkedBlockingQueue<>();
-
-        mAppFunctionManager.executeAppFunction(
-                request, mContext.getMainExecutor(), blockingQueue::add);
-
-        AppSearchResult<ExecuteAppFunctionResponse> response =
-                blockingQueue.poll(LONG_TIMEOUT_SECOND, TimeUnit.SECONDS);
-        assertThat(response.isSuccess()).isTrue();
-        assertThat(response.getResultValue().getResult().getPropertyLong(PROPERTY_RESULT))
-                .isEqualTo(3);
-
-        // Each callback can only be invoked once.
-        assertThat(blockingQueue.poll(SHORT_TIMEOUT_SECOND, TimeUnit.SECONDS)).isNull();
-        assertServiceDestroyed();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_success() throws Exception {
-        GenericDocument parameters = new GenericDocument.Builder("", "", "")
-                .setPropertyLong("a", 1)
-                .setPropertyLong("b", 2)
-                .build();
-
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "add")
-                        .setParameters(parameters)
-                        .build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isTrue();
-        assertThat(response.getResultValue().getResult().getPropertyLong(PROPERTY_RESULT))
-                .isEqualTo(3);
-        assertServiceDestroyed();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_otherNonExistingOtherPackage() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder("other.package", "someMethod").build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isFalse();
-        // Apps without the permission can only invoke functions from themselves.
-        assertThat(response.getResultCode()).isEqualTo(AppSearchResult.RESULT_SECURITY_ERROR);
-        assertThat(response.getErrorMessage()).endsWith(
-                "is not allowed to call executeAppFunction");
-        assertServiceWasNotCreated();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_otherExistingTargetPackage() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(PKG_B, "someMethod").build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isFalse();
-        assertThat(response.getResultCode()).isEqualTo(AppSearchResult.RESULT_SECURITY_ERROR);
-        // The error message from this and executeAppFunction_otherNonExistingOther must be kept
-        // in sync. This verifies that a caller cannot tell whether a package is installed or not by
-        // comparing the error messages.
-        assertThat(response.getErrorMessage()).endsWith(
-                "is not allowed to call executeAppFunction");
-        assertServiceWasNotCreated();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_startActivity() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "startActivity").build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isTrue();
-        assertThat(ActivityCreationSynchronizer.waitForActivityCreated(5, TimeUnit.SECONDS))
-                .isTrue();
-        assertServiceDestroyed();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_throwsException() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "throwException").build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isFalse();
-        assertThat(response.getResultCode()).isEqualTo(RESULT_UNKNOWN_ERROR);
-        assertServiceDestroyed();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_onRemoteProcessKilled() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "kill").build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isFalse();
-        assertThat(response.getResultCode()).isEqualTo(RESULT_INTERNAL_ERROR);
-        // The process that the service was just crashed. Validate the service is not created again.
-        TestAppFunctionServiceLifecycleReceiver.reset();
-        assertServiceWasNotCreated();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_timedOut() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "notInvokeCallback").build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isFalse();
-        assertThat(response.getResultCode()).isEqualTo(RESULT_TIMED_OUT);
-        assertServiceDestroyed();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_success_async() throws Exception {
-        GenericDocument parameters = new GenericDocument.Builder<>("", "", "")
-                .setPropertyLong("a", 1)
-                .setPropertyLong("b", 2)
-                .build();
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "addAsync")
-                        .setParameters(parameters)
-                        .build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isTrue();
-        assertThat(response.getResultValue().getResult().getPropertyLong(PROPERTY_RESULT))
-                .isEqualTo(3);
-        assertServiceDestroyed();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_emptyPackage() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder("", "noOp")
-                        .build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isFalse();
-        assertThat(response.getResultCode()).isEqualTo(RESULT_INVALID_ARGUMENT);
-        assertServiceWasNotCreated();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @RequireRunOnWorkProfile
-    @EnsureHasNoDeviceOwner
-    @Postsubmit(reason = "new test")
-    public void executeAppFunction_runInManagedProfile_fail() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "noOp")
-                        .build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isFalse();
-        assertThat(response.getResultCode()).isEqualTo(RESULT_SECURITY_ERROR);
-        assertServiceWasNotCreated();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasWorkProfile
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_hasManagedProfileRunInPersonalProfile_success()
-            throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "noOp")
-                        .build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isTrue();
-        assertServiceDestroyed();
-    }
-
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasDeviceOwner
-    public void executeAppFunction_deviceOwner_fail() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "noOp")
-                        .build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response =
-                executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isFalse();
-        assertThat(response.getResultCode()).isEqualTo(RESULT_SECURITY_ERROR);
-        assertServiceWasNotCreated();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_correctSha256Certificate() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "noOp")
-                        .setSha256Certificate(PackageUtil.getSelfPackageSha256Cert(mContext))
-                        .build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isTrue();
-        assertServiceDestroyed();
-    }
-
-    @ApiTest(apis = {"android.app.appsearch.functions.AppFunctionManager#executeAppFunction"})
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void executeAppFunction_wrongSha256Certificate() throws Exception {
-        ExecuteAppFunctionRequest request =
-                new ExecuteAppFunctionRequest.Builder(TARGET_PACKAGE, "noOp")
-                        .setSha256Certificate(new byte[]{100})
-                        .build();
-
-        AppSearchResult<ExecuteAppFunctionResponse> response = executeAppFunctionAndWait(request);
-
-        assertThat(response.isSuccess()).isFalse();
-        assertThat(response.getResultCode()).isEqualTo(RESULT_NOT_FOUND);
-        assertServiceWasNotCreated();
-    }
-
-    private AppSearchResult<ExecuteAppFunctionResponse> executeAppFunctionAndWait(
-            ExecuteAppFunctionRequest request) throws InterruptedException {
-        LinkedBlockingQueue<AppSearchResult<ExecuteAppFunctionResponse>> blockingQueue =
-                new LinkedBlockingQueue<>();
-        mAppFunctionManager.executeAppFunction(
-                request, mContext.getMainExecutor(), blockingQueue::add);
-        return blockingQueue.poll(LONG_TIMEOUT_SECOND, TimeUnit.SECONDS);
-    }
-
-    /**
-     * Verifies that the service is unbound by asserting the service was destroyed.
-     */
-    private void assertServiceDestroyed() throws InterruptedException {
-        assertThat(waitForServiceOnDestroy(LONG_TIMEOUT_SECOND, TimeUnit.SECONDS)).isTrue();
-    }
-
-    /**
-     * Verifies that the service has never been created.
-     */
-    private void assertServiceWasNotCreated() throws InterruptedException {
-        assertThat(waitForServiceOnCreate(SHORT_TIMEOUT_SECOND, TimeUnit.SECONDS)).isFalse();
-    }
-}
diff --git a/tests/appsearch/src/com/android/cts/appsearch/functions/ExecuteAppFunctionRequestCtsTest.java b/tests/appsearch/src/com/android/cts/appsearch/functions/ExecuteAppFunctionRequestCtsTest.java
deleted file mode 100644
index 2e421b7..0000000
--- a/tests/appsearch/src/com/android/cts/appsearch/functions/ExecuteAppFunctionRequestCtsTest.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.app.appsearch.cts.functions;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.app.appsearch.GenericDocument;
-import android.app.appsearch.functions.ExecuteAppFunctionRequest;
-import android.os.Bundle;
-import android.os.Parcel;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-import android.platform.test.flag.junit.CheckFlagsRule;
-import android.platform.test.flag.junit.DeviceFlagsValueProvider;
-
-import com.android.appsearch.flags.Flags;
-import com.android.compatibility.common.util.ApiTest;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-@RequiresFlagsEnabled(Flags.FLAG_ENABLE_APP_FUNCTIONS)
-public class ExecuteAppFunctionRequestCtsTest {
-    @Rule
-    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
-
-    @ApiTest(apis = {
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest.Builder#Builder",
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest.Builder#setParameter",
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest.Builder#setExtras",
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest"
-                    + ".Builder#setSha256Certificate",
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest.Builder#build",
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest#writeToParcel",
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest#CREATOR",
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest#getTargetPackageName",
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest#getParameters",
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest#getExtras",
-            "android.app.appsearch.functions.ExecuteAppFunctionRequest#getSha256Certificate",
-    })
-    @Test
-    public void build() {
-        Bundle extras = new Bundle();
-        extras.putString("extra", "value");
-        GenericDocument parameters = new GenericDocument.Builder<>("", "", "")
-                .setPropertyLong("a", 42)
-                .build();
-        ExecuteAppFunctionRequest request = new ExecuteAppFunctionRequest.Builder("pkg", "method")
-                .setParameters(parameters)
-                .setSha256Certificate(new byte[] {100})
-                .setExtras(extras)
-                .build();
-
-        ExecuteAppFunctionRequest restored = parcelizeAndDeparcelize(request);
-
-        assertThat(restored.getTargetPackageName()).isEqualTo("pkg");
-        assertThat(restored.getParameters()).isEqualTo(parameters);
-        assertThat(restored.getSha256Certificate()).isEqualTo(new byte[] {100});
-        assertThat(restored.getExtras().size()).isEqualTo(1);
-        assertThat(restored.getExtras().getString("extra")).isEqualTo("value");
-    }
-
-
-    private static ExecuteAppFunctionRequest parcelizeAndDeparcelize(
-            ExecuteAppFunctionRequest original) {
-        Parcel parcel = Parcel.obtain();
-        try {
-            original.writeToParcel(parcel, 0);
-            parcel.setDataPosition(0);
-            return ExecuteAppFunctionRequest.CREATOR.createFromParcel(parcel);
-        } finally {
-            parcel.recycle();
-        }
-    }
-}
diff --git a/tests/appsearch/src/com/android/cts/appsearch/functions/ExecuteAppFunctionResponseCtsTest.java b/tests/appsearch/src/com/android/cts/appsearch/functions/ExecuteAppFunctionResponseCtsTest.java
deleted file mode 100644
index a95d517..0000000
--- a/tests/appsearch/src/com/android/cts/appsearch/functions/ExecuteAppFunctionResponseCtsTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.app.appsearch.cts.functions;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.app.appsearch.GenericDocument;
-import android.app.appsearch.functions.ExecuteAppFunctionResponse;
-import android.os.Bundle;
-import android.os.Parcel;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-import android.platform.test.flag.junit.CheckFlagsRule;
-import android.platform.test.flag.junit.DeviceFlagsValueProvider;
-
-import com.android.appsearch.flags.Flags;
-import com.android.compatibility.common.util.ApiTest;
-
-import org.junit.Rule;
-import org.junit.Test;
-
-@RequiresFlagsEnabled(Flags.FLAG_ENABLE_APP_FUNCTIONS)
-public class ExecuteAppFunctionResponseCtsTest {
-    @Rule
-    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
-
-    @ApiTest(apis = {
-            "android.app.appsearch.functions.ExecuteAppFunctionResponse.Builder#Builder",
-            "android.app.appsearch.functions.ExecuteAppFunctionResponse.Builder#setExtras",
-            "android.app.appsearch.functions.ExecuteAppFunctionResponse.Builder#build",
-            "android.app.appsearch.functions.ExecuteAppFunctionResponse#writeToParcel",
-            "android.app.appsearch.functions.ExecuteAppFunctionResponse#CREATOR",
-            "android.app.appsearch.functions.ExecuteAppFunctionResponse#getResult",
-            "android.app.appsearch.functions.ExecuteAppFunctionResponse#getExtras",
-    })
-    @Test
-    public void build() {
-        Bundle extras = new Bundle();
-        extras.putString("extra", "value");
-        GenericDocument functionResult = new GenericDocument.Builder<>("", "", "")
-                .setPropertyLong(ExecuteAppFunctionResponse.PROPERTY_RESULT, 42)
-                .build();
-        ExecuteAppFunctionResponse response =
-                new ExecuteAppFunctionResponse.Builder()
-                        .setResult(functionResult)
-                        .setExtras(extras)
-                        .build();
-
-        ExecuteAppFunctionResponse restored =
-                parcelizeAndDeparcelize(response);
-
-        assertThat(restored.getResult()).isEqualTo(functionResult);
-        assertThat(restored.getExtras().size()).isEqualTo(1);
-        assertThat(restored.getExtras().getString("extra")).isEqualTo("value");
-    }
-
-    private static ExecuteAppFunctionResponse parcelizeAndDeparcelize(
-            ExecuteAppFunctionResponse original) {
-        Parcel parcel = Parcel.obtain();
-        try {
-            original.writeToParcel(parcel, 0);
-            parcel.setDataPosition(0);
-            return ExecuteAppFunctionResponse.CREATOR.createFromParcel(parcel);
-        } finally {
-            parcel.recycle();
-        }
-    }
-}
diff --git a/tests/appsearch/testutils/src/android/app/appsearch/testutil/functions/ActivityCreationSynchronizer.java b/tests/appsearch/testutils/src/android/app/appsearch/testutil/functions/ActivityCreationSynchronizer.java
deleted file mode 100644
index 9ddf94e..0000000
--- a/tests/appsearch/testutils/src/android/app/appsearch/testutil/functions/ActivityCreationSynchronizer.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.app.appsearch.testutil.functions;
-
-import android.app.Activity;
-import android.os.Bundle;
-
-import androidx.annotation.Nullable;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/** An activity class that enables waiting for its own creation. */
-public class ActivityCreationSynchronizer extends Activity {
-
-    private static volatile CountDownLatch sLatch = new CountDownLatch(1);
-
-    /**
-     * Called within the Activity's onCreate() lifecycle method.
-     * Signals that the Activity has been fully created.
-     */
-    @Override
-    protected void onCreate(@Nullable Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        sLatch.countDown();
-        finish();
-    }
-
-    /**
-     * Resets the latch and enables another wait cycle. Should never call this with
-     * {@link #waitForActivityCreated} in parallel.
-     */
-    public static void reset() {
-        sLatch = new CountDownLatch(1);
-    }
-
-    /**
-     * Blocks the current thread until the Activity is created or the specified timeout elapses.
-     * Should never call this with {@link #reset()} in parallel.
-     *
-     * @param timeout The duration to wait for Activity creation.
-     * @param unit    The unit of time for the timeout value.
-     * @return True if the Activity was created within the timeout, false otherwise.
-     * @throws InterruptedException If the current thread is interrupted while waiting.
-     */
-    public static boolean waitForActivityCreated(long timeout, TimeUnit unit)
-            throws InterruptedException {
-        return sLatch.await(timeout, unit);
-    }
-}
diff --git a/tests/appsearch/testutils/src/android/app/appsearch/testutil/functions/TestAppFunctionService.java b/tests/appsearch/testutils/src/android/app/appsearch/testutil/functions/TestAppFunctionService.java
deleted file mode 100644
index 1ed2b1e..0000000
--- a/tests/appsearch/testutils/src/android/app/appsearch/testutil/functions/TestAppFunctionService.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.app.appsearch.testutil.functions;
-
-import static android.app.appsearch.AppSearchResult.RESULT_NOT_FOUND;
-import static android.app.appsearch.AppSearchResult.newFailedResult;
-import static android.app.appsearch.AppSearchResult.newSuccessfulResult;
-import static android.app.appsearch.functions.ExecuteAppFunctionResponse.PROPERTY_RESULT;
-
-import android.app.appsearch.AppSearchResult;
-import android.app.appsearch.GenericDocument;
-import android.app.appsearch.functions.AppFunctionService;
-import android.app.appsearch.functions.ExecuteAppFunctionRequest;
-import android.app.appsearch.functions.ExecuteAppFunctionResponse;
-import android.content.Intent;
-
-import androidx.annotation.NonNull;
-
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.function.Consumer;
-
-/**
- * An implementation of {@link android.app.appsearch.functions.AppFunctionService} that provides
- * some simple functions for testing purposes.
- */
-public class TestAppFunctionService extends AppFunctionService {
-    private final Executor mExecutor = Executors.newSingleThreadExecutor();
-
-    @Override
-    public void onCreate() {
-        super.onCreate();
-        TestAppFunctionServiceLifecycleReceiver.notifyOnCreateInvoked(this);
-    }
-
-    @Override
-    public void onExecuteFunction(
-            @NonNull ExecuteAppFunctionRequest request,
-            @NonNull Consumer<AppSearchResult<ExecuteAppFunctionResponse>> callback) {
-        switch (request.getFunctionIdentifier()) {
-            case "add": {
-                ExecuteAppFunctionResponse result = add(request);
-                callback.accept(newSuccessfulResult(result));
-                break;
-            }
-            case "add_invokeCallbackTwice": {
-                ExecuteAppFunctionResponse result = add(request);
-                callback.accept(newSuccessfulResult(result));
-                callback.accept(newSuccessfulResult(result));
-                break;
-            }
-            case "startActivity": {
-                ExecuteAppFunctionResponse result = startActivity(request);
-                callback.accept(newSuccessfulResult(result));
-                break;
-            }
-            case "throwException": {
-                throw new RuntimeException();
-            }
-            case "kill": {
-                System.exit(0);
-                break;
-            }
-            case "notInvokeCallback": {
-                break;
-            }
-            case "addAsync": {
-                mExecutor.execute(() -> {
-                    ExecuteAppFunctionResponse result = add(request);
-                    callback.accept(newSuccessfulResult(result));
-                });
-                break;
-            }
-            case "noOp": {
-                callback.accept(
-                        newSuccessfulResult(new ExecuteAppFunctionResponse.Builder().build()));
-                break;
-            }
-            default:
-                callback.accept(newFailedResult(RESULT_NOT_FOUND, "no such method"));
-        }
-    }
-
-    private ExecuteAppFunctionResponse add(ExecuteAppFunctionRequest request) {
-        long a = request.getParameters().getPropertyLong("a");
-        long b = request.getParameters().getPropertyLong("b");
-        GenericDocument result = new GenericDocument.Builder<>("", "", "")
-                .setPropertyLong(PROPERTY_RESULT, a + b)
-                .build();
-        return new ExecuteAppFunctionResponse.Builder().setResult(result).build();
-    }
-
-    private ExecuteAppFunctionResponse startActivity(ExecuteAppFunctionRequest request) {
-        Intent intent = new Intent(this, ActivityCreationSynchronizer.class);
-        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        startActivity(intent);
-
-        return new ExecuteAppFunctionResponse.Builder().build();
-    }
-
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-        TestAppFunctionServiceLifecycleReceiver.notifyOnDestroyInvoked(this);
-    }
-}
diff --git a/tests/appsearch/testutils/src/android/app/appsearch/testutil/functions/TestAppFunctionServiceLifecycleReceiver.java b/tests/appsearch/testutils/src/android/app/appsearch/testutil/functions/TestAppFunctionServiceLifecycleReceiver.java
deleted file mode 100644
index 994eb9b..0000000
--- a/tests/appsearch/testutils/src/android/app/appsearch/testutil/functions/TestAppFunctionServiceLifecycleReceiver.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.app.appsearch.testutil.functions;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Provides utilities to listen to lifecycle events of the {@link TestAppFunctionService}.
- */
-public class TestAppFunctionServiceLifecycleReceiver extends BroadcastReceiver {
-    private static final String ACTION_SERVICE_ON_CREATE = "oncreate";
-    private static final String ACTION_SERVICE_ON_DESTROY = "ondestroy";
-
-    private static volatile CountDownLatch sOnCreateLatch = new CountDownLatch(1);
-    private static volatile CountDownLatch sOnDestroyedLatch = new CountDownLatch(1);
-
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        if (ACTION_SERVICE_ON_CREATE.equals(intent.getAction())) {
-            sOnCreateLatch.countDown();
-        } else if (ACTION_SERVICE_ON_DESTROY.equals(intent.getAction())) {
-            sOnDestroyedLatch.countDown();
-        }
-    }
-
-    /**
-     * Resets the latch and enables another wait cycle. Should never call this method with any
-     * other methods in parallel.
-     */
-    public static void reset() {
-        sOnCreateLatch = new CountDownLatch(1);
-        sOnDestroyedLatch = new CountDownLatch(1);
-    }
-
-    /**
-     * Blocks the current thread until {@link TestAppFunctionService#onDestroy()} is invoked, or the
-     * specified timeout elapses.
-     *
-     * @param timeout The duration to wait for.
-     * @param unit    The unit of time for the timeout value.
-     * @return True if the onDestroy was invoked within the timeout, false otherwise.
-     * @throws InterruptedException If the current thread is interrupted while waiting.
-     */
-    public static boolean waitForServiceOnDestroy(long timeout, TimeUnit unit)
-            throws InterruptedException {
-        return sOnDestroyedLatch.await(timeout, unit);
-    }
-
-    /**
-     * Blocks the current thread until {@link TestAppFunctionService#onCreate()} is invoked, or the
-     * specified timeout elapses.
-     *
-     * @param timeout The duration to wait for.
-     * @param unit    The unit of time for the timeout value.
-     * @return True if the onCreate was invoked within the timeout, false otherwise.
-     * @throws InterruptedException If the current thread is interrupted while waiting.
-     */
-    public static boolean waitForServiceOnCreate(long timeout, TimeUnit unit)
-            throws InterruptedException {
-        return sOnCreateLatch.await(timeout, unit);
-    }
-
-    /** Notifies that {@link TestAppFunctionService} is created. */
-    public static void notifyOnCreateInvoked(Context context) {
-        notifyEvent(context, ACTION_SERVICE_ON_CREATE);
-    }
-
-    /** Notifies that {@link TestAppFunctionService} is destroyed. */
-    public static void notifyOnDestroyInvoked(Context context) {
-        notifyEvent(context, ACTION_SERVICE_ON_DESTROY);
-    }
-
-    private static void notifyEvent(Context context, String action) {
-        Intent intent = new Intent(context, TestAppFunctionServiceLifecycleReceiver.class);
-        intent.setAction(action);
-        intent.setFlags(Intent.FLAG_RECEIVER_FOREGROUND);
-        context.sendBroadcast(intent);
-    }
-}
diff --git a/tests/autofillservice/src/android/autofillservice/cts/LoginWithCustomHighlightActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/LoginWithCustomHighlightActivityTest.java
index 1d64f6f..9e012ca 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/LoginWithCustomHighlightActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/LoginWithCustomHighlightActivityTest.java
@@ -32,6 +32,7 @@
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 
 import java.util.concurrent.TimeoutException;
@@ -62,6 +63,7 @@
         MyDrawable.clearStatus();
     }
 
+    @Ignore("b/382587681") // Reenable in next major release.
     @Test
     public void testAutofillCustomHighlight_singleField_noHighlight() throws Exception {
         testAutofillCustomHighlight(/* singleField= */true);
diff --git a/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java b/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
index dd45ec0..0c60ce2 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
@@ -4252,8 +4252,8 @@
                     containsAeModeLowLightBoost);
 
             float luminanceRangeLower = lowLightBoostLuminanceRange.getLower();
-            assertTrue("Luminance range lower bound is in the range [0.1, 1]",
-                    luminanceRangeLower >= 0.1f && luminanceRangeLower <= 1f);
+            assertTrue("Luminance range lower bound is in the range [0.1, 8.0]",
+                    luminanceRangeLower >= 0.1f && luminanceRangeLower <= 8.0f);
         }
     }
 
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/PreferentialNetworkServiceTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/PreferentialNetworkServiceTest.java
index b8ae005..2a3d9b1 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/PreferentialNetworkServiceTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/PreferentialNetworkServiceTest.java
@@ -17,11 +17,13 @@
 package android.devicepolicy.cts;
 
 import static android.Manifest.permission.ACCESS_NETWORK_STATE;
+import static android.Manifest.permission.MANAGE_TEST_NETWORKS;
 import static android.Manifest.permission.NETWORK_SETTINGS;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_ENTERPRISE;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_INTERNET;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VCN_MANAGED;
+import static android.net.NetworkCapabilities.TRANSPORT_TEST;
 
 import static com.google.common.truth.Truth.assertThat;
 
@@ -86,6 +88,7 @@
             sContext.getSystemService(ConnectivityManager.class);
     private final HandlerThread mHandlerThread = new HandlerThread(TAG + " handler thread");
     private final NetworkCapabilities mEnterpriseNcFilter = new NetworkCapabilities.Builder()
+            .addTransportType(TRANSPORT_TEST)
             .addCapability(NET_CAPABILITY_INTERNET)
             .addCapability(NET_CAPABILITY_NOT_VCN_MANAGED)
             .addCapability(NET_CAPABILITY_ENTERPRISE)
@@ -142,7 +145,7 @@
      * Enable PreferentialNetworkService, verify the provider that provides enterprise slice can
      * see the enterprise slice requests.
      */
-    @EnsureHasPermission({ACCESS_NETWORK_STATE, NETWORK_SETTINGS})
+    @EnsureHasPermission({ACCESS_NETWORK_STATE, NETWORK_SETTINGS, MANAGE_TEST_NETWORKS})
     @PolicyAppliesTest(policy = PreferentialNetworkService.class)
     public void setPreferentialNetworkServiceEnabled_enableService_issueRequest() {
         // Expect a regular default network.
@@ -193,7 +196,7 @@
      * Disable PreferentialNetworkService, verify the provider that provides enterprise slice cannot
      * see the enterprise slice requests.
      */
-    @EnsureHasPermission({ACCESS_NETWORK_STATE, NETWORK_SETTINGS})
+    @EnsureHasPermission({ACCESS_NETWORK_STATE, NETWORK_SETTINGS, MANAGE_TEST_NETWORKS})
     @PolicyAppliesTest(policy = PreferentialNetworkService.class)
     public void setPreferentialNetworkServiceEnabled_disableService_noIssueRequest() {
         // Expect a regular default network.
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/WipeDataTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/WipeDataTest.java
index 0689e52..50f9405 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/WipeDataTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/WipeDataTest.java
@@ -24,25 +24,26 @@
 import static com.google.common.truth.Truth.assertWithMessage;
 
 import static org.junit.Assert.assertThrows;
+import static org.junit.Assert.fail;
 
 import android.app.admin.DevicePolicyManager;
 
+import com.android.bedstead.enterprise.annotations.EnsureHasDeviceOwner;
+import com.android.bedstead.enterprise.annotations.EnsureHasProfileOwner;
+import com.android.bedstead.enterprise.annotations.EnsureHasWorkProfile;
 import com.android.bedstead.harrier.BedsteadJUnit4;
 import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.EnsureHasAdditionalUser;
 import com.android.bedstead.harrier.annotations.EnsureHasNoAdditionalUser;
-import com.android.bedstead.enterprise.annotations.EnsureHasWorkProfile;
 import com.android.bedstead.harrier.annotations.Postsubmit;
 import com.android.bedstead.harrier.annotations.RequireHeadlessSystemUserMode;
 import com.android.bedstead.harrier.annotations.RequireRunOnAdditionalUser;
 import com.android.bedstead.harrier.annotations.RequireRunOnInitialUser;
 import com.android.bedstead.harrier.annotations.RequireRunOnSystemUser;
-import com.android.bedstead.enterprise.annotations.EnsureHasDeviceOwner;
-import com.android.bedstead.enterprise.annotations.EnsureHasProfileOwner;
-import com.android.bedstead.permissions.annotations.EnsureDoesNotHavePermission;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.users.UserReference;
 import com.android.bedstead.nene.utils.Poll;
+import com.android.bedstead.permissions.annotations.EnsureDoesNotHavePermission;
 import com.android.compatibility.common.util.ApiTest;
 
 import org.junit.ClassRule;
@@ -115,10 +116,16 @@
     @EnsureHasAdditionalUser
     @RequireRunOnSystemUser(switchedToUser = ANY)
     @ApiTest(apis = "android.app.admin.DevicePolicyManager#wipeData")
-    public void wipeData_systemUser_throwsSecurityException() {
-        assertThrows("System user should not be removed",
-                SecurityException.class,
-                () -> sDeviceState.dpc().devicePolicyManager().wipeData(/* flags= */ 0));
+    public void wipeData_systemUser_throwsException() {
+        try {
+            sDeviceState.dpc().devicePolicyManager().wipeData(/* flags= */ 0);
+        } catch (RuntimeException e) {
+            assertWithMessage("Should throw either SE or ISE when attempting to wipe system user")
+                    .that(e instanceof SecurityException || e instanceof IllegalStateException)
+                    .isTrue();
+            return;
+        }
+        fail("Should have thrown an exception");
     }
 
     @Postsubmit(reason = "new test")
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingPolicyTests.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingPolicyTests.java
index fea498a..76a09e5 100644
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingPolicyTests.java
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/embedding/ActivityEmbeddingPolicyTests.java
@@ -19,7 +19,6 @@
 import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
 import static android.server.wm.jetpack.second.Components.PORTRAIT_ACTIVITY;
 import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.assumeActivityEmbeddingSupportedDevice;
-import static android.view.Display.DEFAULT_DISPLAY;
 import static android.view.Surface.ROTATION_0;
 import static android.view.Surface.ROTATION_90;
 
@@ -34,7 +33,6 @@
 import android.server.wm.NestedShellPermission;
 import android.server.wm.RotationSession;
 import android.server.wm.WindowManagerState;
-import android.view.Display;
 import android.view.WindowManager;
 
 import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -101,7 +99,7 @@
         assumeTrue(getDisplayConfiguration().orientation == ORIENTATION_LANDSCAPE);
 
         // Launch a fixed-portrait activity
-        startActivityOnDisplay(Display.DEFAULT_DISPLAY, PORTRAIT_ACTIVITY);
+        startActivityOnDisplay(getMainDisplayId(), PORTRAIT_ACTIVITY);
 
         // The display should be remained in landscape.
         assertEquals("The display should be remained in landscape", ORIENTATION_LANDSCAPE,
@@ -110,7 +108,7 @@
 
     private Configuration getDisplayConfiguration() {
         mWmState.computeState();
-        WindowManagerState.DisplayContent display = mWmState.getDisplay(DEFAULT_DISPLAY);
+        WindowManagerState.DisplayContent display = mWmState.getDisplay(getMainDisplayId());
         return display.getFullConfiguration();
     }
 }
diff --git a/tests/framework/base/windowmanager/res/values/dimens.xml b/tests/framework/base/windowmanager/res/values/dimens.xml
index 44953ec1..bd11a84 100644
--- a/tests/framework/base/windowmanager/res/values/dimens.xml
+++ b/tests/framework/base/windowmanager/res/values/dimens.xml
@@ -18,4 +18,7 @@
 <resources>
     <dimen name="test_background_blur_radius">80px</dimen>
     <dimen name="test_blur_behind_radius">40px</dimen>
+
+    <!-- TODO(b/389045836): remove this when rounded corners are reported correctly. -->
+    <dimen name="taskbar_corner_radius">16dp</dimen>
 </resources>
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/animations/BlurTests.java b/tests/framework/base/windowmanager/src/android/server/wm/animations/BlurTests.java
index 0be275e..5620355 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/animations/BlurTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/animations/BlurTests.java
@@ -44,6 +44,7 @@
 import android.server.wm.WindowManagerTestBase;
 import android.server.wm.cts.R;
 import android.server.wm.settings.SettingsSession;
+import android.util.TypedValue;
 import android.view.RoundedCorner;
 import android.view.View;
 import android.view.WindowInsets;
@@ -480,9 +481,13 @@
             return mInsetsToBeIgnored;
         }
 
-        private static int getCornerRadius(WindowInsets insets, int position) {
+        private int getCornerRadius(WindowInsets insets, int position) {
             final RoundedCorner corner = insets.getRoundedCorner(position);
-            return corner != null ? corner.getRadius() : 0;
+
+            // TODO (b/389045836): Make sure that Taskbar's "soft" rounded corners are reported
+            // in insets.getRoundedCorner so that this adjustment won't be necessary any more.
+            return Math.max((corner != null ? corner.getRadius() : 0),
+                getResources().getDimensionPixelSize(R.dimen.taskbar_corner_radius));
         }
     }
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/animations/KeepScreenOnTests.java b/tests/framework/base/windowmanager/src/android/server/wm/animations/KeepScreenOnTests.java
index 374cd76..9621f75 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/animations/KeepScreenOnTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/animations/KeepScreenOnTests.java
@@ -27,6 +27,7 @@
 import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeTrue;
 
+import android.app.DreamManager;
 import android.content.ContentResolver;
 import android.content.Intent;
 import android.content.pm.PackageManager;
@@ -40,6 +41,7 @@
 
 import com.android.compatibility.common.util.ApiTest;
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
+import com.android.compatibility.common.util.SystemUtil;
 
 import org.junit.After;
 import org.junit.Before;
@@ -52,6 +54,8 @@
     private PowerManager mPowerManager;
     private ContentResolver mContentResolver;
     private boolean mIsTv;
+    private DreamManager mDreamManager;
+    private Boolean mDefaultScreensaverEnabled;
 
     @Before
     public void setUp() throws Exception {
@@ -66,11 +70,25 @@
         mPowerManager = mContext.getSystemService(PowerManager.class);
         assumeFalse("Automotive main display is always on - skipping test",
                 mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE));
+        mDreamManager = mContext.getSystemService(DreamManager.class);
+        if (mDreamManager != null && mDreamManager.areDreamsSupported()) {
+            SystemUtil.runWithShellPermissionIdentity(() -> {
+                mDefaultScreensaverEnabled = mDreamManager.isScreensaverEnabled();
+                if (mDefaultScreensaverEnabled) {
+                    mDreamManager.setScreensaverEnabled(false);
+                }
+            });
+        }
     }
 
     @After
     public void tearDown() {
         setScreenOffTimeoutMs(mInitialDisplayTimeout);
+        if (Boolean.TRUE.equals(mDefaultScreensaverEnabled)) {
+            SystemUtil.runWithShellPermissionIdentity(() -> {
+                mDreamManager.setScreensaverEnabled(true);
+            });
+        }
         Settings.Global.putInt(mContentResolver, STAY_ON_WHILE_PLUGGED_IN,
                 mInitialStayOnWhilePluggedInSetting);
         UiDeviceUtils.wakeUpAndUnlock(mContext);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/display/AppConfigurationTests.java b/tests/framework/base/windowmanager/src/android/server/wm/display/AppConfigurationTests.java
index 959cdbb..5b4618c 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/display/AppConfigurationTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/display/AppConfigurationTests.java
@@ -727,10 +727,10 @@
 
         TestActivitySession<ConfigChangeHandlingActivity> activitySession
                 = createManagedTestActivitySession();
-        int baseDisplayId = Display.DEFAULT_DISPLAY;
+        int baseDisplayId = getMainDisplayId();
         activitySession.launchTestActivityOnDisplaySync(
                 ConfigChangeHandlingActivity.class,
-                Display.DEFAULT_DISPLAY,
+                baseDisplayId,
                 WINDOWING_MODE_FULLSCREEN);
         final ConfigChangeHandlingActivity activity = activitySession.getActivity();
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/display/PresentationTest.java b/tests/framework/base/windowmanager/src/android/server/wm/display/PresentationTest.java
index ba375a0..08b7070 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/display/PresentationTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/display/PresentationTest.java
@@ -140,7 +140,7 @@
         mContext.startActivity(intent);
         waitAndAssertTopResumedActivity(
                 Components.PRESENTATION_ACTIVITY,
-                Display.DEFAULT_DISPLAY,
+                getMainDisplayId(),
                 "Launched activity must be on top");
     }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/other/DragDropTest.java b/tests/framework/base/windowmanager/src/android/server/wm/other/DragDropTest.java
index 4a84010..60498c8 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/other/DragDropTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/other/DragDropTest.java
@@ -823,8 +823,11 @@
         v.getLocationOnScreen(viewLoc);
         int scaledX = (int) (viewLoc[0] * mInvCompatScale);
         int scaledY = (int) (viewLoc[1] * mInvCompatScale);
-        for (int x = scaledX; x < scaledX + v.getWidth(); x++) {
-            for (int y = scaledY; y < scaledY + v.getHeight(); y++) {
+        // Don't check past the dimensions of the screenshot.
+        int clippedWidth = Math.min(scaledX + v.getWidth(), screenshot.getWidth());
+        int clippedHeight = Math.min(scaledY + v.getHeight(), screenshot.getHeight());
+        for (int x = scaledX; x < clippedWidth; x++) {
+            for (int y = scaledY; y < clippedHeight; y++) {
                 final Color color = screenshot.getColor(x, y);
                 assertTrue("Should show drag shadow", color.toArgb() == Color.RED);
             }
diff --git a/tests/input/src/android/input/cts/DrawingTabletTest.kt b/tests/input/src/android/input/cts/DrawingTabletTest.kt
index 4ee9696..ca42bc4 100644
--- a/tests/input/src/android/input/cts/DrawingTabletTest.kt
+++ b/tests/input/src/android/input/cts/DrawingTabletTest.kt
@@ -19,6 +19,7 @@
 import android.cts.input.EventVerifier
 import android.graphics.Point
 import android.graphics.PointF
+import android.platform.test.annotations.RequiresFlagsEnabled
 import android.view.InputDevice
 import android.view.MotionEvent
 import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -37,6 +38,7 @@
 import com.android.cts.input.inputeventmatchers.withMotionAction
 import com.android.cts.input.inputeventmatchers.withSource
 import com.android.cts.input.inputeventmatchers.withToolType
+import com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS
 import org.hamcrest.Matchers.allOf
 import org.junit.After
 import org.junit.Assert.assertEquals
@@ -48,6 +50,7 @@
 
 @MediumTest
 @RunWith(AndroidJUnit4::class)
+@RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
 class DrawingTabletTest {
     private lateinit var drawingTablet: UinputTouchDevice
     private lateinit var verifier: EventVerifier
diff --git a/tests/input/src/android/input/cts/GamepadWithAccessibilityTest.kt b/tests/input/src/android/input/cts/GamepadWithAccessibilityTest.kt
index f94e6c1..0acd867 100644
--- a/tests/input/src/android/input/cts/GamepadWithAccessibilityTest.kt
+++ b/tests/input/src/android/input/cts/GamepadWithAccessibilityTest.kt
@@ -18,6 +18,7 @@
 
 import android.accessibilityservice.AccessibilityServiceInfo
 import android.app.Instrumentation
+import android.platform.test.annotations.RequiresFlagsEnabled
 import android.view.KeyCharacterMap.VIRTUAL_KEYBOARD
 import android.view.KeyEvent
 import android.view.accessibility.AccessibilityManager
@@ -27,6 +28,7 @@
 import androidx.test.platform.app.InstrumentationRegistry
 import com.android.compatibility.common.util.PollingCheck
 import com.android.cts.input.UinputGamepad
+import com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS
 import org.junit.After
 import org.junit.Assert.assertEquals
 import org.junit.Assert.assertNotEquals
@@ -65,6 +67,7 @@
  */
 @MediumTest
 @RunWith(AndroidJUnit4::class)
+@RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
 class GamepadWithAccessibilityTest {
     @get:Rule
     val activityRule = ActivityScenarioRule(CaptureEventActivity::class.java)
diff --git a/tests/input/src/android/input/cts/MotionEventIsResampledTest.kt b/tests/input/src/android/input/cts/MotionEventIsResampledTest.kt
index d16d05d..5463be5 100644
--- a/tests/input/src/android/input/cts/MotionEventIsResampledTest.kt
+++ b/tests/input/src/android/input/cts/MotionEventIsResampledTest.kt
@@ -28,6 +28,7 @@
 import com.android.cts.input.VirtualDisplayActivityScenario
 import com.android.cts.input.inputeventmatchers.withMotionAction
 import com.android.hardware.input.Flags
+import com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS
 import org.junit.After
 import org.junit.Assert.assertEquals
 import org.junit.Before
@@ -50,6 +51,7 @@
  */
 @LargeTest
 @RunWith(AndroidJUnit4::class)
+@RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
 class MotionEventIsResampledTest {
     private val instrumentation = InstrumentationRegistry.getInstrumentation()
     private lateinit var touchScreen: UinputTouchScreen
diff --git a/tests/input/src/android/input/cts/PointerIconTest.kt b/tests/input/src/android/input/cts/PointerIconTest.kt
index 6e20652..f177970 100644
--- a/tests/input/src/android/input/cts/PointerIconTest.kt
+++ b/tests/input/src/android/input/cts/PointerIconTest.kt
@@ -23,6 +23,7 @@
 import android.graphics.Color
 import android.hardware.input.VirtualMouse
 import android.os.SystemProperties
+import android.platform.test.annotations.RequiresFlagsEnabled
 import android.view.MotionEvent
 import android.view.PointerIcon
 import android.virtualdevice.cts.common.VirtualDeviceRule
@@ -32,6 +33,7 @@
 import com.android.cts.input.TestPointerDevice
 import com.android.cts.input.VirtualDisplayActivityScenario
 import com.android.cts.input.inputeventmatchers.withMotionAction
+import com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS
 import kotlin.test.assertNotNull
 import org.junit.After
 import org.junit.Assume.assumeTrue
@@ -61,6 +63,7 @@
  */
 @MediumTest
 @RunWith(Parameterized::class)
+@RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
 class PointerIconTest {
     private lateinit var activity: CaptureEventActivity
     private lateinit var verifier: EventVerifier
diff --git a/tests/input/src/android/input/cts/SimultaneousTouchAndStylusTest.kt b/tests/input/src/android/input/cts/SimultaneousTouchAndStylusTest.kt
index f3d271d..d71eaa0 100644
--- a/tests/input/src/android/input/cts/SimultaneousTouchAndStylusTest.kt
+++ b/tests/input/src/android/input/cts/SimultaneousTouchAndStylusTest.kt
@@ -42,6 +42,7 @@
 import com.android.cts.input.inputeventmatchers.withSource
 import com.android.cts.input.inputeventmatchers.withToolType
 import com.android.input.flags.Flags
+import com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS
 import org.hamcrest.Matchers.allOf
 import org.junit.After
 import org.junit.Before
@@ -62,6 +63,7 @@
  */
 @LargeTest
 @RunWith(AndroidJUnit4::class)
+@RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
 class SimultaneousTouchAndStylusTest {
     private val instrumentation = InstrumentationRegistry.getInstrumentation()
     private lateinit var touchScreen: UinputTouchDevice
diff --git a/tests/input/src/android/input/cts/StylusButtonInputEventTest.kt b/tests/input/src/android/input/cts/StylusButtonInputEventTest.kt
index cbe017c..ec97693e 100644
--- a/tests/input/src/android/input/cts/StylusButtonInputEventTest.kt
+++ b/tests/input/src/android/input/cts/StylusButtonInputEventTest.kt
@@ -18,6 +18,7 @@
 
 import android.app.StatusBarManager
 import android.graphics.Point
+import android.platform.test.annotations.RequiresFlagsEnabled
 import android.view.InputDevice.SOURCE_STYLUS
 import android.view.KeyEvent
 import android.view.MotionEvent
@@ -30,6 +31,7 @@
 import com.android.cts.input.UinputBluetoothStylus
 import com.android.cts.input.UinputStylus
 import com.android.cts.input.VirtualDisplayActivityScenario
+import com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS
 import org.junit.After
 import org.junit.Assert.assertEquals
 import org.junit.Before
@@ -45,6 +47,7 @@
  */
 @MediumTest
 @RunWith(AndroidJUnit4::class)
+@RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
 class StylusButtonInputEventTest {
     private companion object {
         // The settings namespace and key for enabling stylus button interactions.
diff --git a/tests/input/src/android/input/cts/TouchScreenTest.kt b/tests/input/src/android/input/cts/TouchScreenTest.kt
index 587b659..7160212 100644
--- a/tests/input/src/android/input/cts/TouchScreenTest.kt
+++ b/tests/input/src/android/input/cts/TouchScreenTest.kt
@@ -19,6 +19,7 @@
 import android.cts.input.EventVerifier
 import android.graphics.Point
 import android.hardware.input.InputManager
+import android.platform.test.annotations.RequiresFlagsEnabled
 import android.view.MotionEvent
 import android.view.MotionEvent.ACTION_MOVE
 import androidx.test.ext.junit.runners.AndroidJUnit4
@@ -38,6 +39,7 @@
 import com.android.cts.input.inputeventmatchers.withFlags
 import com.android.cts.input.inputeventmatchers.withMotionAction
 import com.android.cts.input.inputeventmatchers.withPointerCount
+import com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS
 import org.hamcrest.Description
 import org.hamcrest.Matchers.allOf
 import org.hamcrest.TypeSafeMatcher
@@ -51,6 +53,7 @@
 
 @MediumTest
 @RunWith(AndroidJUnit4::class)
+@RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
 class TouchScreenTest {
     private val instrumentation = InstrumentationRegistry.getInstrumentation()
     private lateinit var touchScreen: UinputTouchDevice
diff --git a/tests/input/src/android/input/cts/VerifyHardwareKeyEventTest.kt b/tests/input/src/android/input/cts/VerifyHardwareKeyEventTest.kt
index 212907b..a4e3604 100644
--- a/tests/input/src/android/input/cts/VerifyHardwareKeyEventTest.kt
+++ b/tests/input/src/android/input/cts/VerifyHardwareKeyEventTest.kt
@@ -17,12 +17,14 @@
 package android.input.cts
 
 import android.hardware.input.InputManager
+import android.platform.test.annotations.RequiresFlagsEnabled
 import androidx.test.ext.junit.rules.ActivityScenarioRule
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.filters.MediumTest
 import androidx.test.platform.app.InstrumentationRegistry
 import com.android.compatibility.common.util.PollingCheck
 import com.android.cts.input.UinputKeyboard
+import com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS
 import org.junit.Assert.assertNotNull
 import org.junit.Before
 import org.junit.Rule
@@ -35,6 +37,7 @@
  */
 @MediumTest
 @RunWith(AndroidJUnit4::class)
+@RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
 class VerifyHardwareKeyEventTest {
 
     companion object {
diff --git a/tests/inputmethod/Android.bp b/tests/inputmethod/Android.bp
index bb14805..6b220a7 100644
--- a/tests/inputmethod/Android.bp
+++ b/tests/inputmethod/Android.bp
@@ -47,6 +47,7 @@
         "cts_window-extensions",
         "statsdprotonano",
         "android.view.inputmethod.flags-aconfig-java",
+        "com.android.input.flags-aconfig-java",
         "com.android.text.flags-aconfig-java",
         "flag-junit",
         "ravenwood-junit",
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/StylusHandwritingTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/StylusHandwritingTest.java
index 720ed84..24d61b1 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/StylusHandwritingTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/StylusHandwritingTest.java
@@ -32,6 +32,7 @@
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEvent;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.notExpectEvent;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.withDescription;
+import static com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS;
 import static com.android.text.flags.Flags.FLAG_HANDWRITING_END_OF_LINE_TAP;
 import static com.android.text.flags.Flags.FLAG_HANDWRITING_TRACK_DISABLED;
 import static com.android.text.flags.Flags.FLAG_HANDWRITING_UNSUPPORTED_MESSAGE;
@@ -1173,6 +1174,7 @@
      * until stylus ACTION_UP.
      */
     @Test
+    @RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
     public void testHandwriting_fingerTouchIsIgnored() throws Exception {
         int displayId = 0;
         String initialUserRotation = null;
@@ -1346,6 +1348,7 @@
      */
     @Test
     @FlakyTest
+    @RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
     public void testOnViewClicked_withStylusTap() throws Exception {
         UinputTouchDevice stylus = null;
         int displayId = 0;
@@ -1400,10 +1403,14 @@
             } else {
                 expectEvent(stream, onStartInputMatcher(toolType, unfocusedMarker), TIMEOUT);
             }
-            expectEvent(
-                    stream,
-                    onUpdateEditorToolTypeMatcher(toolType),
-                    TIMEOUT);
+            if (!Flags.refactorInsetsController()) {
+                // With the flag enabled, we won't call showSoftInput when the
+                // requestedVisibleTypes are not changed.
+                expectEvent(
+                        stream,
+                        onUpdateEditorToolTypeMatcher(toolType),
+                        TIMEOUT);
+            }
         } finally {
             if (stylus != null) {
                 stylus.close();
@@ -1420,6 +1427,7 @@
      */
     @Test
     @FlakyTest
+    @RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
     public void testOnViewClicked_withFingerTap() throws Exception {
         UinputTouchDevice touch = null;
         int displayId = 0;
@@ -1478,6 +1486,7 @@
      */
     @Test
     @FlakyTest
+    @RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
     public void testOnViewClicked_withStylusHandwriting() throws Exception {
         int displayId;
         String initialUserRotation = null;
@@ -1973,6 +1982,7 @@
      * editor ToolType should match stylus.
      */
     @Test
+    @RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
     public void testHandwriting_editorToolTypeOnNewWindow() throws Exception {
         assumeTrue(Flags.useHandwritingListenerForTooltype());
         Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
diff --git a/tests/location/Android.bp b/tests/location/Android.bp
index 1d036c1..d2116c0 100644
--- a/tests/location/Android.bp
+++ b/tests/location/Android.bp
@@ -27,7 +27,6 @@
         "location_privileged/src/**/*.java",
         "common/src/**/*.java",
     ],
-    upstream: true,
     strict_mode: false,
     platform_apis: true,
     java_resource_dirs: ["config"],
diff --git a/tests/media/common/src/android/mediav2/common/cts/CodecAsyncHandler.java b/tests/media/common/src/android/mediav2/common/cts/CodecAsyncHandler.java
index 523fafd..4e16174 100644
--- a/tests/media/common/src/android/mediav2/common/cts/CodecAsyncHandler.java
+++ b/tests/media/common/src/android/mediav2/common/cts/CodecAsyncHandler.java
@@ -20,6 +20,7 @@
 
 import android.media.MediaCodec;
 import android.media.MediaFormat;
+import android.os.PersistableBundle;
 import android.util.Log;
 import android.util.Pair;
 
@@ -46,16 +47,21 @@
     protected final LinkedList<Pair<Integer, MediaCodec.BufferInfo>> mCbInputQueue;
     private final LinkedList<Pair<Integer, MediaCodec.BufferInfo>> mCbOutputQueue;
     private MediaFormat mOutFormat;
-    private boolean mSignalledOutFormatChanged;
+    private boolean mSignalledOutFormatChangedSubSession;
     protected volatile boolean mSignalledError;
     private String mErrorMsg;
+    private int mExpectedMetricsFlushCount;
+    private int mActualMetricsFlushCount;
 
     public CodecAsyncHandler() {
         mCbInputQueue = new LinkedList<>();
         mCbOutputQueue = new LinkedList<>();
+        mOutFormat = null;
         mSignalledError = false;
-        mSignalledOutFormatChanged = false;
+        mSignalledOutFormatChangedSubSession = false;
         mErrorMsg = "";
+        mExpectedMetricsFlushCount = 0;
+        mActualMetricsFlushCount = 0;
     }
 
     public void clearQueues() {
@@ -71,9 +77,11 @@
     public void resetContext() {
         clearQueues();
         mOutFormat = null;
-        mSignalledOutFormatChanged = false;
+        mSignalledOutFormatChangedSubSession = false;
         mErrorMsg = "";
         mSignalledError = false;
+        mExpectedMetricsFlushCount = 0;
+        mActualMetricsFlushCount = 0;
     }
 
     @Override
@@ -130,11 +138,32 @@
     }
 
     @Override
+    public void onMetricsFlushed(@NonNull MediaCodec codec, @NonNull PersistableBundle metrics) {
+        mLock.lock();
+        try {
+            mActualMetricsFlushCount++;
+            mCondition.signalAll();
+        } finally {
+            mLock.unlock();
+        }
+        Log.i(LOG_TAG, "final metrics for the previous subsession: " + metrics);
+    }
+
+    @Override
     public void onOutputFormatChanged(@NonNull MediaCodec codec, @NonNull MediaFormat format) {
         mLock.lock();
         try {
+            if (mOutFormat != null
+                    && mOutFormat.getString(MediaFormat.KEY_MIME).startsWith("video/")) {
+                if (mOutFormat.getInteger(MediaFormat.KEY_WIDTH)
+                                != format.getInteger(MediaFormat.KEY_WIDTH)
+                        || mOutFormat.getInteger(MediaFormat.KEY_HEIGHT)
+                                != format.getInteger(MediaFormat.KEY_HEIGHT)) {
+                    mExpectedMetricsFlushCount++;
+                }
+            }
             mOutFormat = format;
-            mSignalledOutFormatChanged = true;
+            mSignalledOutFormatChangedSubSession = true;
             mCondition.signalAll();
         } finally {
             mLock.unlock();
@@ -155,7 +184,7 @@
         mLock.lock();
         try {
             while (!mSignalledError) {
-                if (mSignalledOutFormatChanged || retry == 0) break;
+                if (mSignalledOutFormatChangedSubSession || retry == 0) break;
                 if (!mCondition.await(CodecTestBase.Q_DEQ_TIMEOUT_US, TimeUnit.MICROSECONDS)) {
                     retry--;
                 }
@@ -164,8 +193,9 @@
             mLock.unlock();
         }
         if (!mSignalledError) {
-            assertTrue("taking too long to receive onOutputFormatChanged callback",
-                    mSignalledOutFormatChanged);
+            assertTrue(
+                    "taking too long to receive onOutputFormatChanged callback",
+                    mSignalledOutFormatChangedSubSession);
         }
     }
 
@@ -247,7 +277,15 @@
     }
 
     public boolean hasOutputFormatChanged() {
-        return mSignalledOutFormatChanged;
+        return mSignalledOutFormatChangedSubSession;
+    }
+
+    public int getExpectedMetricsFlushCount() {
+        return mExpectedMetricsFlushCount;
+    }
+
+    public int getActualMetricsFlushCount() {
+        return mActualMetricsFlushCount;
     }
 
     public MediaFormat getOutputFormat() {
diff --git a/tests/media/common/src/android/mediav2/common/cts/CodecDecoderTestBase.java b/tests/media/common/src/android/mediav2/common/cts/CodecDecoderTestBase.java
index a5f18fa..c2a9f32 100644
--- a/tests/media/common/src/android/mediav2/common/cts/CodecDecoderTestBase.java
+++ b/tests/media/common/src/android/mediav2/common/cts/CodecDecoderTestBase.java
@@ -19,6 +19,7 @@
 import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface;
 import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUV420Flexible;
 import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUVP010;
+import static android.media.codec.Flags.subsessionMetrics;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
@@ -382,6 +383,15 @@
                 fail("Input pts list and Output pts list are not identical ]\n" + mTestConfig
                         + mTestEnv + mOutputBuff.getErrMsg());
             }
+            if (IS_AT_LEAST_B && subsessionMetrics()) {
+                assertEquals(
+                        "expected and received metrics flush counts are not same.\n"
+                                + mTestConfig
+                                + mTestEnv
+                                + mOutputBuff.getErrMsg(),
+                        mAsyncHandle.getExpectedMetricsFlushCount(),
+                        mAsyncHandle.getActualMetricsFlushCount());
+            }
         }
     }
 
diff --git a/tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java b/tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java
index 51f2d5f..bb8f417 100644
--- a/tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java
+++ b/tests/media/common/src/android/mediav2/common/cts/CodecTestBase.java
@@ -167,6 +167,8 @@
     public static final ArrayList<String> HDR_INFO_IN_BITSTREAM_CODECS = new ArrayList<>();
     public static final String HDR_STATIC_INFO =
             "00 d0 84 80 3e c2 33 c4 86 4c 1d b8 0b 13 3d 42 40 a0 0f 32 00 10 27 df 0d";
+    public static final String HDR_STATIC_ALTERNATE_INFO =
+            "00 d0 84 80 3e c2 33 c4 86 4c 1d b8 0b 13 3d 42 40 e8 03 32 00 00 00 00 00";
     public static final String HDR_STATIC_INCORRECT_INFO =
             "00 d0 84 80 3e c2 33 c4 86 10 27 d0 07 13 3d 42 40 a0 0f 32 00 10 27 df 0d";
     public static final String CODEC_PREFIX_KEY = "codec-prefix";
@@ -231,9 +233,13 @@
     static final int[] AV1_HLG_PROFILES = new int[]{AV1ProfileMain10};
     static final int[] APV_HLG_PROFILES = new int[]{APVProfile422_10};
     static final int[] AV1_HDR10_PROFILES = new int[]{AV1ProfileMain10HDR10};
+    static final int[] APV_HDR10_PROFILES = new int[]{APVProfile422_10HDR10};
     static final int[] AV1_HDR10_PLUS_PROFILES = new int[]{AV1ProfileMain10HDR10Plus};
+    static final int[] APV_HDR10_PLUS_PROFILES = new int[]{APVProfile422_10HDR10Plus};
     static final int[] AV1_HDR_PROFILES =
             combine(AV1_HLG_PROFILES, combine(AV1_HDR10_PROFILES, AV1_HDR10_PLUS_PROFILES));
+    static final int[] APV_HDR_PROFILES =
+            combine(APV_HLG_PROFILES, combine(APV_HDR10_PROFILES, APV_HDR10_PLUS_PROFILES));
     static final int[] AV1_PROFILES = combine(AV1_SDR_PROFILES, AV1_HDR_PROFILES);
     static final int[] DOLBY_VISION_HDR_PROFILES = new int[]{DolbyVisionProfileDvavPer,
             DolbyVisionProfileDvavPen, DolbyVisionProfileDvheDer, DolbyVisionProfileDvheDen,
@@ -270,16 +276,34 @@
                     + "0a 00 00 24 08 00 00 28  00 00 50 00 28 c8 00 c9"
                     + "90 02 aa 58 05 ca d0 0c  0a f8 16 83 18 9c 18 00"
                     + "40 78 13 64 d5 7c 2e 2c  c3 59 de 79 6e c3 c2 00";
+    public static final String HDR10_ALTERNATE_INFO_SCENE_A =
+            "b5 00 3c 00 01 04 01 40  00 0c 80 00 00 03 00 00"
+                    + "03 00 00 03 00 00 24 08  00 00 28 00 00 50 03 fc"
+                    + "c8 00 01 90 00 02 58 00  02 d0 00 02 f8 00 03 18"
+                    + "00 00 03 00 40 00 00 24  66 33 53 36 6a 00 99 ac"
+                    + "dc cf 9a 00";
     public static final String HDR10_INFO_SCENE_B =
             "b5 00 3c 00 01 04 00 40  00 0c 80 4e 20 27 10 00"
                     + "0a 00 00 24 08 00 00 28  00 00 50 00 28 c8 00 c9"
                     + "90 02 aa 58 05 ca d0 0c  0a f8 16 83 18 9c 18 00"
                     + "40 78 13 64 d5 7c 2e 2c  c3 59 de 79 6e c3 c2 00";
+    public static final String HDR10_ALTERNATE_INFO_SCENE_B =
+            "b5 00 3c 00 01 04 01 40  00 0c 80 00 00 03 00 00"
+                    + "03 00 00 03 00 00 24 08  00 00 28 00 00 50 90 00"
+                    + "02 58 00 03 fc c8 00 01  02 d0 00 02 f8 00 03 18"
+                    + "00 00 03 00 40 00 00 24  66 33 53 36 6a 00 99 ac"
+                    + "dc cf 9a 00";
     public static final String HDR10_INFO_SCENE_C =
             "b5 00 3c 00 01 04 00 40  00 0c 80 4e 20 27 10 00"
                     + "0e 80 00 24 08 00 00 28  00 00 50 00 28 c8 00 c9"
                     + "90 02 aa 58 05 ca d0 0c  0a f8 16 83 18 9c 18 00"
                     + "40 78 13 64 d5 7c 2e 2c  c3 59 de 79 6e c3 c2 00";
+    public static final String HDR10_ALTERNATE_INFO_SCENE_C =
+            "b5 00 3c 00 01 04 01 40  00 0c 80 00 00 03 00 00"
+                    + "00 24 08 00 00 03 00 00  03 00 28 00 00 50 90 00"
+                    + "02 58 00 03 fc c8 00 01  02 d0 00 02 f8 00 03 18"
+                    + "00 00 03 00 40 00 00 24  66 33 53 36 6a 00 99 ac"
+                    + "dc cf 9a 00";
     public static final String HDR10_INFO_SCENE_D =
             "b5 00 3c 00 01 04 00 40  00 0c 80 4e 20 27 10 00"
                     + "0e 80 00 24 08 00 00 28  00 00 50 00 28 c8 00 c9"
@@ -461,15 +485,18 @@
         PROFILE_HDR10_MAP.put(MediaFormat.MIMETYPE_VIDEO_HEVC, HEVC_HDR10_PROFILES);
         PROFILE_HDR10_MAP.put(MediaFormat.MIMETYPE_VIDEO_VP9, VP9_HDR10_PROFILES);
         PROFILE_HDR10_MAP.put(MediaFormat.MIMETYPE_VIDEO_AV1, AV1_HDR10_PROFILES);
+        PROFILE_HDR10_MAP.put(MediaFormat.MIMETYPE_VIDEO_APV, APV_HDR10_PROFILES);
 
         PROFILE_HDR10_PLUS_MAP.put(MediaFormat.MIMETYPE_VIDEO_HEVC, HEVC_HDR10_PLUS_PROFILES);
         PROFILE_HDR10_PLUS_MAP.put(MediaFormat.MIMETYPE_VIDEO_VP9, VP9_HDR10_PLUS_PROFILES);
         PROFILE_HDR10_PLUS_MAP.put(MediaFormat.MIMETYPE_VIDEO_AV1, AV1_HDR10_PLUS_PROFILES);
+        PROFILE_HDR10_PLUS_MAP.put(MediaFormat.MIMETYPE_VIDEO_APV, APV_HDR10_PLUS_PROFILES);
 
         PROFILE_HDR_MAP.put(MediaFormat.MIMETYPE_VIDEO_AVC, AVC_HDR_PROFILES);
         PROFILE_HDR_MAP.put(MediaFormat.MIMETYPE_VIDEO_HEVC, HEVC_HDR_PROFILES);
         PROFILE_HDR_MAP.put(MediaFormat.MIMETYPE_VIDEO_VP9, VP9_HDR_PROFILES);
         PROFILE_HDR_MAP.put(MediaFormat.MIMETYPE_VIDEO_AV1, AV1_HDR_PROFILES);
+        PROFILE_HDR_MAP.put(MediaFormat.MIMETYPE_VIDEO_APV, APV_HDR_PROFILES);
         PROFILE_HDR_MAP.put(MediaFormat.MIMETYPE_VIDEO_DOLBY_VISION, DOLBY_VISION_HDR_PROFILES);
 
         PROFILE_MAP.put(MediaFormat.MIMETYPE_VIDEO_AVC, AVC_PROFILES);
@@ -480,6 +507,7 @@
         PROFILE_MAP.put(MediaFormat.MIMETYPE_VIDEO_VP8, VP8_PROFILES);
         PROFILE_MAP.put(MediaFormat.MIMETYPE_VIDEO_VP9, VP9_PROFILES);
         PROFILE_MAP.put(MediaFormat.MIMETYPE_VIDEO_AV1, AV1_PROFILES);
+        PROFILE_MAP.put(MediaFormat.MIMETYPE_VIDEO_APV, APV_HDR_PROFILES);
         PROFILE_MAP.put(MediaFormat.MIMETYPE_AUDIO_AAC, AAC_PROFILES);
 
         HDR_INFO_IN_BITSTREAM_CODECS.add(MediaFormat.MIMETYPE_VIDEO_AV1);
diff --git a/tests/media/jni/NativeCodecDecoderTestCommon.cpp b/tests/media/jni/NativeCodecDecoderTestCommon.cpp
index 1efb4cd..6c7fd6f 100644
--- a/tests/media/jni/NativeCodecDecoderTestCommon.cpp
+++ b/tests/media/jni/NativeCodecDecoderTestCommon.cpp
@@ -129,7 +129,7 @@
                 AMediaFormat_getString(currFormat, AMEDIAFORMAT_KEY_MIME, &mediaType);
                 if (mediaType && strcmp(mMediaType, mediaType) == 0) {
                     AMediaExtractor_selectTrack(mExtractor, trackID);
-                    if (!mIsAudio) {
+                    if (!mIsAudio && colorFormat != -1) {
                         AMediaFormat_setInt32(currFormat, AMEDIAFORMAT_KEY_COLOR_FORMAT,
                                               colorFormat);
                     }
@@ -356,7 +356,7 @@
 bool CodecDecoderTest::testSimpleDecode(const char* decoder, const char* testFile,
                                         const char* refFile, int colorFormat, float rmsError,
                                         uLong checksum) {
-    if (!setUpExtractor(testFile, colorFormat)) return false;
+    if (!setUpExtractor(testFile, (mWindow == nullptr) ? colorFormat : -1)) return false;
     mSaveToMem = (mWindow == nullptr);
     auto ref = mRefBuff;
     auto test = mTestBuff;
@@ -390,6 +390,16 @@
             if (!doWork(INT32_MAX)) return false;
             if (!queueEOS()) return false;
             if (!waitForAllOutputs()) return false;
+            if (mWindow != nullptr) {
+                AMediaFormat* outFormat = AMediaCodec_getOutputFormat(mCodec);
+                int outputColorFormat = -1;
+                AMediaFormat_getInt32(outFormat, AMEDIAFORMAT_KEY_COLOR_FORMAT, &outputColorFormat);
+                AMediaFormat_delete(outFormat);
+                RETURN_IF_TRUE(outputColorFormat != COLOR_FormatSurface,
+                               std::string{"In surface mode, components MUST default to the color "
+                                           "format optimized for hardware display \n"}
+                                       .append(test->getErrorMsg()))
+            }
             RETURN_IF_FAIL(AMediaCodec_stop(mCodec), "AMediaCodec_stop failed")
             RETURN_IF_FAIL(AMediaCodec_delete(mCodec), "AMediaCodec_delete failed")
             mCodec = nullptr;
diff --git a/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java b/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java
index 13a11d77..835c8be 100644
--- a/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java
+++ b/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java
@@ -16,11 +16,14 @@
 
 package android.mediav2.cts;
 
+import static android.media.codec.Flags.apvSupport;
+import static android.mediav2.common.cts.CodecTestBase.IS_AT_LEAST_V;
 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_ALL;
 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_OPTIONAL;
-import static android.mediav2.common.cts.CodecTestBase.IS_AT_LEAST_V;
 import static android.mediav2.common.cts.CodecTestBase.VNDK_IS_AT_MOST_U;
 
+import static com.android.media.extractor.flags.Flags.extractorMp4EnableApv;
+
 import android.media.MediaCodec;
 import android.media.MediaCodecInfo;
 import android.media.MediaExtractor;
@@ -174,6 +177,21 @@
                             "cosmat_800x640_24fps_crf22_vp9_10bit.mkv"}, CODEC_OPTIONAL},
             }));
         }
+
+        if (IS_AT_LEAST_B && apvSupport() && extractorMp4EnableApv()) {
+            exhaustiveArgsList.addAll(
+                    Arrays.asList(
+                            new Object[][] {
+                                {
+                                    MediaFormat.MIMETYPE_VIDEO_APV,
+                                    new String[] {
+                                        "pattern_640x480_30fps_16mbps_apv_10bit.mp4",
+                                        "pattern_1280x720_30fps_30mbps_apv_10bit.mp4"
+                                    },
+                                    CODEC_OPTIONAL
+                                },
+                            }));
+        }
         List<Object[]> argsList = prepareParamList(exhaustiveArgsList, isEncoder, needAudio,
                 needVideo, false);
         if (IS_AT_LEAST_V && android.media.codec.Flags.dynamicColorAspects()) {
diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderDetachedSurfaceTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderDetachedSurfaceTest.java
index 0fef676..5ac1bde 100644
--- a/tests/media/src/android/mediav2/cts/CodecDecoderDetachedSurfaceTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecDecoderDetachedSurfaceTest.java
@@ -16,8 +16,11 @@
 
 package android.mediav2.cts;
 
-import static android.media.codec.Flags.FLAG_NULL_OUTPUT_SURFACE;
 import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatYUVP010;
+import static android.media.codec.Flags.FLAG_NULL_OUTPUT_SURFACE;
+import static android.media.codec.Flags.apvSupport;
+
+import static com.android.media.extractor.flags.Flags.extractorMp4EnableApv;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -137,6 +140,16 @@
                     {MediaFormat.MIMETYPE_VIDEO_AV1, "cosmat_520x390_24fps_768kbps_av1_10bit.mkv"},
             }));
         }
+        if (IS_AT_LEAST_B && apvSupport() && extractorMp4EnableApv()) {
+            args.addAll(
+                    Arrays.asList(
+                            new Object[][] {
+                                {
+                                    MediaFormat.MIMETYPE_VIDEO_APV,
+                                    "pattern_640x480_30fps_16mbps_apv_10bit.mp4"
+                                },
+                            }));
+        }
         for (Object[] arg : args) {
             for (int burstLength : BURST_LENGTHS) {
                 Object[] testArgs = new Object[arg.length + 1];
diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderPauseTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderPauseTest.java
index dfa5df9..fab0a93 100644
--- a/tests/media/src/android/mediav2/cts/CodecDecoderPauseTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecDecoderPauseTest.java
@@ -16,8 +16,11 @@
 
 package android.mediav2.cts;
 
+import static android.media.codec.Flags.apvSupport;
 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_ALL;
 
+import static com.android.media.extractor.flags.Flags.extractorMp4EnableApv;
+
 import static org.junit.Assert.fail;
 
 import android.media.MediaCodec;
@@ -65,7 +68,7 @@
         final boolean needAudio = true;
         final boolean needVideo = true;
         // mediaType, test file, SupportClass
-        final List<Object[]> exhaustiveArgsList = Arrays.asList(new Object[][]{
+        final List<Object[]> exhaustiveArgsList = new ArrayList<>(Arrays.asList(new Object[][]{
                 {MediaFormat.MIMETYPE_AUDIO_AAC, "bbb_2ch_48kHz_he_aac.mp4", CODEC_ALL},
                 {MediaFormat.MIMETYPE_VIDEO_AVC, "bbb_cif_avc_delay16.mp4", CODEC_ALL},
                 {MediaFormat.MIMETYPE_VIDEO_H263, "bbb_176x144_128kbps_15fps_h263.3gp", CODEC_ALL},
@@ -78,7 +81,19 @@
                 {MediaFormat.MIMETYPE_VIDEO_VP9, "bbb_cif_768kbps_30fps_vp9.mkv", CODEC_ALL},
                 {MediaFormat.MIMETYPE_VIDEO_AV1, "cosmat_520x390_24fps_768kbps_av1_10bit.mkv",
                         CODEC_ALL},
-        });
+        }));
+        if (IS_AT_LEAST_B && apvSupport() && extractorMp4EnableApv()) {
+            exhaustiveArgsList.addAll(
+                    Arrays.asList(
+                            new Object[][] {
+                                {
+                                    MediaFormat.MIMETYPE_VIDEO_APV,
+                                    "pattern_640x480_30fps_16mbps_apv_10bit.mp4",
+                                    CODEC_ALL
+                                },
+                            }));
+        }
+
         return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, false);
     }
 
diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderReconfigureTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderReconfigureTest.java
index d0f8d34..c9878f2 100644
--- a/tests/media/src/android/mediav2/cts/CodecDecoderReconfigureTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecDecoderReconfigureTest.java
@@ -16,9 +16,12 @@
 
 package android.mediav2.cts;
 
+import static android.media.codec.Flags.apvSupport;
 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_ALL;
 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_OPTIONAL;
 
+import static com.android.media.extractor.flags.Flags.extractorMp4EnableApv;
+
 import static org.junit.Assert.fail;
 
 import android.media.MediaCodec;
@@ -190,6 +193,18 @@
                     CODEC_ALL},
             }));
         }
+        if (IS_AT_LEAST_B && apvSupport() && extractorMp4EnableApv()) {
+            exhaustiveArgsList.addAll(
+                    Arrays.asList(
+                            new Object[][] {
+                                {
+                                    MediaFormat.MIMETYPE_VIDEO_APV,
+                                    "pattern_640x480_30fps_16mbps_apv_10bit.mp4",
+                                    "pattern_1280x720_30fps_30mbps_apv_10bit.mp4",
+                                    CODEC_ALL
+                                },
+                            }));
+        }
         return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, true);
     }
 
diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderSurfaceTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderSurfaceTest.java
index 84e361a..2d892b2 100644
--- a/tests/media/src/android/mediav2/cts/CodecDecoderSurfaceTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecDecoderSurfaceTest.java
@@ -16,9 +16,13 @@
 
 package android.mediav2.cts;
 
+import static android.media.codec.Flags.apvSupport;
+import static android.media.MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface;
 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_ALL;
 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_OPTIONAL;
 
+import static com.android.media.extractor.flags.Flags.extractorMp4EnableApv;
+
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
@@ -182,6 +186,12 @@
                             CODEC_ALL},
             }));
         }
+        if (IS_AT_LEAST_B && apvSupport() && extractorMp4EnableApv()) {
+            exhaustiveArgsList.addAll(Arrays.asList(new Object[][] {
+                    {MediaFormat.MIMETYPE_VIDEO_APV, "pattern_640x480_30fps_16mbps_apv_10bit.mp4",
+                                    CODEC_OPTIONAL},
+            }));
+        }
         return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, true);
     }
 
@@ -191,7 +201,7 @@
      * timestamp list in all runs and this list to be identical to the reference list. The
      * reference list is obtained from the same decoder running in byte buffer mode
      */
-    @CddTest(requirements = {"2.2.2", "2.3.2", "2.5.2"})
+    @CddTest(requirements = {"2.2.2", "2.3.2", "2.5.2", "5.1.7/C-4-1"})
     @ApiTest(apis = {"android.media.MediaCodecInfo.CodecCapabilities#COLOR_FormatSurface"})
     @LargeTest
     @Test(timeout = PER_TEST_TIMEOUT_LARGE_TEST_MS)
@@ -204,6 +214,7 @@
                     Integer.MAX_VALUE);
             OutputManager test = new OutputManager(ref.getSharedErrorLogs());
             MediaFormat format = setUpSource(mTestFile);
+            format.removeKey(MediaFormat.KEY_COLOR_FORMAT);
             mCodec = MediaCodec.createByCodecName(mCodecName);
             mOutputBuff = test;
             mActivity.setScreenParams(getWidth(format), getHeight(format), true);
@@ -220,6 +231,9 @@
                     fail("Decoder output in surface mode does not match with output in bytebuffer "
                             + "mode \n" + mTestConfig + mTestEnv + test.getErrMsg());
                 }
+                int colorFormat = getOutputFormat().getInteger(MediaFormat.KEY_COLOR_FORMAT);
+                assertTrue("In surface mode, components MUST default to the color format"
+                        + " optimized for hardware display", colorFormat == COLOR_FormatSurface);
             }
             mCodec.release();
             mExtractor.release();
@@ -434,7 +448,7 @@
     /**
      * Tests is similar to {@link #testSimpleDecodeToSurface()} but uses ndk api
      */
-    @CddTest(requirements = {"2.2.2", "2.3.2", "2.5.2"})
+    @CddTest(requirements = {"2.2.2", "2.3.2", "2.5.2", "5.1.7/C-4-1"})
     @ApiTest(apis = {"android.media.MediaCodecInfo.CodecCapabilities#COLOR_FormatSurface"})
     @LargeTest
     @Test(timeout = PER_TEST_TIMEOUT_LARGE_TEST_MS)
diff --git a/tests/media/src/android/mediav2/cts/CodecInfoTest.java b/tests/media/src/android/mediav2/cts/CodecInfoTest.java
index 05e854e..2f2e342 100644
--- a/tests/media/src/android/mediav2/cts/CodecInfoTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecInfoTest.java
@@ -234,8 +234,8 @@
      * formats. The test only checks if the decoder/encoder is advertising the required color
      * format. It doesn't verify if it actually supports by decoding/encoding.
      */
-    @CddTest(requirements = {"5.1.7/C-1-2", "5.1.7/C-1-3", "5.1.7/C-4-1", "5.12/C-6-5",
-            "5.12/C-7-1", "5.12/C-7-3"})
+    @CddTest(requirements = {"5.1.7/C-1-2", "5.1.7/C-1-3", "5.12/C-6-5", "5.12/C-7-1",
+            "5.12/C-7-3"})
     @VsrTest(requirements = {"VSR-4.4-011"})
     @Test
     public void testColorFormatSupport() {
diff --git a/tests/media/src/android/mediav2/cts/DecoderColorAspectsTest.java b/tests/media/src/android/mediav2/cts/DecoderColorAspectsTest.java
index d2c68e1..f8c350f 100644
--- a/tests/media/src/android/mediav2/cts/DecoderColorAspectsTest.java
+++ b/tests/media/src/android/mediav2/cts/DecoderColorAspectsTest.java
@@ -16,10 +16,13 @@
 
 package android.mediav2.cts;
 
+import static android.media.codec.Flags.apvSupport;
 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_ALL;
 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_ANY;
 import static android.mediav2.common.cts.CodecTestBase.SupportClass.CODEC_OPTIONAL;
 
+import static com.android.media.extractor.flags.Flags.extractorMp4EnableApv;
+
 import android.media.MediaFormat;
 import android.mediav2.common.cts.CodecDecoderTestBase;
 import android.mediav2.common.cts.CodecTestActivity;
@@ -87,7 +90,7 @@
         final boolean needVideo = true;
 
         // mediatype, testClip, colorRange, colorStandard, colorTransfer, areColorAspectsInStream
-        final List<Object[]> exhaustiveArgsList = Arrays.asList(new Object[][]{
+        final List<Object[]> exhaustiveArgsList =  new ArrayList<>(Arrays.asList(new Object[][]{
                 // h264 clips
                 {MediaFormat.MIMETYPE_VIDEO_AVC, "bbb_qcif_color_bt709_lr_sdr_avc.mp4",
                         MediaFormat.COLOR_RANGE_LIMITED, MediaFormat.COLOR_STANDARD_BT709,
@@ -261,7 +264,24 @@
                 {MediaFormat.MIMETYPE_VIDEO_AV1, "cosmat_352x288_hlg_av1.mkv",
                         MediaFormat.COLOR_RANGE_LIMITED, MediaFormat.COLOR_STANDARD_BT709,
                         MediaFormat.COLOR_TRANSFER_HLG, true, CODEC_OPTIONAL},
-        });
+        }));
+
+        if (IS_AT_LEAST_B && apvSupport() && extractorMp4EnableApv()) {
+            exhaustiveArgsList.addAll(
+                    Arrays.asList(
+                            new Object[][] {
+                                {
+                                    MediaFormat.MIMETYPE_VIDEO_APV,
+                                    "pattern_dynamic_aspect_1280x720_30fps_30mbps_apv_10bit.mp4",
+                                    MediaFormat.COLOR_RANGE_LIMITED,
+                                    MediaFormat.COLOR_STANDARD_BT2020,
+                                    MediaFormat.COLOR_TRANSFER_ST2084,
+                                    false,
+                                    CODEC_OPTIONAL
+                                },
+                            }));
+        }
+
         return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, false);
     }
 
diff --git a/tests/media/src/android/mediav2/cts/DecoderHDRInfoTest.java b/tests/media/src/android/mediav2/cts/DecoderHDRInfoTest.java
index 8e4100e..2c97629 100644
--- a/tests/media/src/android/mediav2/cts/DecoderHDRInfoTest.java
+++ b/tests/media/src/android/mediav2/cts/DecoderHDRInfoTest.java
@@ -16,6 +16,10 @@
 
 package android.mediav2.cts;
 
+import static android.media.codec.Flags.apvSupport;
+
+import static com.android.media.extractor.flags.Flags.extractorMp4EnableApv;
+
 import android.media.MediaFormat;
 import android.mediav2.common.cts.HDRDecoderTestBase;
 import android.os.Build;
@@ -30,6 +34,7 @@
 import org.junit.runners.Parameterized;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
@@ -55,6 +60,7 @@
     public static final HashMap<Long, String> HDR_DYNAMIC_INFO_HEVC = new HashMap<>();
     public static final HashMap<Long, String> HDR_DYNAMIC_INCORRECT_INFO_HEVC = new HashMap<>();
     public static final HashMap<Long, String> HDR_DYNAMIC_INFO_AV1 = new HashMap<>();
+    public static final HashMap<Long, String> HDR_DYNAMIC_INFO_APV = new HashMap<>();
     public static final HashMap<Long, String> HDR_DYNAMIC_INCORRECT_INFO_AV1 = new HashMap<>();
     public static final HashMap<Long, String> HDR_DYNAMIC_INFO_VP9 = new HashMap<>();
 
@@ -79,6 +85,10 @@
         HDR_DYNAMIC_INFO_AV1.put(400000L, HDR10_INFO_SCENE_C);
         HDR_DYNAMIC_INFO_AV1.put(733000L, HDR10_INFO_SCENE_D);
 
+        HDR_DYNAMIC_INFO_APV.put(0L, HDR10_ALTERNATE_INFO_SCENE_A);
+        HDR_DYNAMIC_INFO_APV.put(1333322L, HDR10_ALTERNATE_INFO_SCENE_B);
+        HDR_DYNAMIC_INFO_APV.put(2666644L, HDR10_ALTERNATE_INFO_SCENE_C);
+
         HDR_DYNAMIC_INCORRECT_INFO_AV1.put(0L, HDR10_INCORRECT_INFO_SCENE_A);
         HDR_DYNAMIC_INCORRECT_INFO_AV1.put(133000L, HDR10_INCORRECT_INFO_SCENE_B);
         HDR_DYNAMIC_INCORRECT_INFO_AV1.put(400000L, HDR10_INCORRECT_INFO_SCENE_C);
@@ -106,7 +116,7 @@
         final boolean isEncoder = false;
         final boolean needAudio = false;
         final boolean needVideo = true;
-        final List<Object[]> exhaustiveArgsList = Arrays.asList(new Object[][]{
+        final List<Object[]> exhaustiveArgsList = new ArrayList<>(Arrays.asList(new Object[][]{
                 // codecMediaType, testFile, hdrStaticInfo in stream, hdrStaticInfo in container,
                 // hdrDynamicInfo in stream, hdrDynamicInfo in container
                 {MediaFormat.MIMETYPE_VIDEO_HEVC,
@@ -142,7 +152,17 @@
                 {MediaFormat.MIMETYPE_VIDEO_VP9, "cosmat_352x288_hdr10_only_container_vp9.mkv",
                         null, null, null, HDR_DYNAMIC_INFO_VP9},
 
-        });
+        }));
+        if (IS_AT_LEAST_B && apvSupport() && extractorMp4EnableApv()) {
+            exhaustiveArgsList.addAll(Arrays.asList(new Object[][]{
+                {MediaFormat.MIMETYPE_VIDEO_APV,
+                        "pattern_hdr10plus_1280x720_30fps_30mbps_apv_10bit.mp4",
+                        null, HDR_STATIC_ALTERNATE_INFO, null, null},
+                {MediaFormat.MIMETYPE_VIDEO_APV,
+                        "pattern_hdr10plus_1280x720_30fps_30mbps_apv_10bit.mp4",
+                        null, null, HDR_DYNAMIC_INFO_APV, null}
+            }));
+        }
         return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, false);
     }
 
diff --git a/tests/security/OWNERS b/tests/security/OWNERS
index d94c876..10b5416 100644
--- a/tests/security/OWNERS
+++ b/tests/security/OWNERS
@@ -2,10 +2,11 @@
 #
 # Please CC android-hardware-security on all bugs.
 # EMEA
-eranm@google.com
+cvlasov@google.com
 drysdale@google.com
 
 # US
-swillden@google.com
 jbires@google.com
+kwadhera@google.com
 sethmo@google.com
+swillden@google.com
diff --git a/tests/security/src/android/keystore/cts/Modules.java b/tests/security/src/android/keystore/cts/Modules.java
new file mode 100644
index 0000000..e25c095
--- /dev/null
+++ b/tests/security/src/android/keystore/cts/Modules.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES 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.ASN1Encodable;
+import org.bouncycastle.asn1.ASN1InputStream;
+import org.bouncycastle.asn1.ASN1Set;
+
+import java.io.IOException;
+import java.security.cert.CertificateParsingException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class Modules {
+    // The ASN.1 schema for a module matches that of `AttestationPackageInfo`, so re-use the class.
+    private final List<AttestationPackageInfo> mModules;
+
+    public Modules(byte[] bytes) throws CertificateParsingException {
+        try (ASN1InputStream asn1InputStream = new ASN1InputStream(bytes)) {
+            ASN1Encodable asn1Encodable = asn1InputStream.readObject();
+            if (!(asn1Encodable instanceof ASN1Set)) {
+                throw new CertificateParsingException(
+                        "Expected set for Modules, found " + asn1Encodable.getClass().getName());
+            }
+            ASN1Set set = (ASN1Set) asn1Encodable;
+            mModules = new ArrayList<AttestationPackageInfo>();
+            for (ASN1Encodable e : set) {
+                mModules.add(new AttestationPackageInfo(e));
+            }
+        } catch (IOException e) {
+            throw new CertificateParsingException("Failed to parse SET OF Module", e);
+        }
+    }
+
+    public List<AttestationPackageInfo> getModules() {
+        return mModules;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("Modules:");
+        int noOfModules = mModules.size();
+        int i = 1;
+        for (AttestationPackageInfo module : mModules) {
+            sb.append("\n### Module " + i + "/" + noOfModules + " ###\n");
+            sb.append(module);
+            i += 1;
+        }
+        return sb.toString();
+    }
+}
diff --git a/tests/surfacecontrol/src/android/view/surfacecontrol/cts/AttachedSurfaceControlTest.java b/tests/surfacecontrol/src/android/view/surfacecontrol/cts/AttachedSurfaceControlTest.java
index 99fb649..26c29be 100644
--- a/tests/surfacecontrol/src/android/view/surfacecontrol/cts/AttachedSurfaceControlTest.java
+++ b/tests/surfacecontrol/src/android/view/surfacecontrol/cts/AttachedSurfaceControlTest.java
@@ -59,7 +59,6 @@
 import androidx.test.platform.app.InstrumentationRegistry;
 import androidx.test.rule.ActivityTestRule;
 
-import com.android.compatibility.common.util.SystemUtil;
 import com.android.window.flags.Flags;
 
 import org.junit.After;
@@ -77,8 +76,6 @@
 @SmallTest
 public class AttachedSurfaceControlTest {
     private static final String TAG = "AttachedSurfaceControlTest";
-    private static final String FIXED_TO_USER_ROTATION_COMMAND =
-            "cmd window fixed-to-user-rotation";
     private IgnoreOrientationRequestSession mOrientationSession;
     private WindowManagerStateHelper mWmState;
 
@@ -146,8 +143,8 @@
                 InstrumentationRegistry.getInstrumentation().getContext().getPackageManager();
         boolean supportsRotation = pm.hasSystemFeature(PackageManager.FEATURE_SCREEN_PORTRAIT)
                 && pm.hasSystemFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE);
-        final boolean isFixedToUserRotation =
-                "enabled".equals(SystemUtil.runShellCommand(FIXED_TO_USER_ROTATION_COMMAND).trim());
+        mWmState.computeState();
+        final boolean isFixedToUserRotation = mWmState.isFixedToUserRotation();
         Assume.assumeTrue(supportsRotation && !isFixedToUserRotation);
     }
 
diff --git a/tests/tests/assist/common/src/android/assist/common/Utils.java b/tests/tests/assist/common/src/android/assist/common/Utils.java
index 5cee36d..fe8354e 100755
--- a/tests/tests/assist/common/src/android/assist/common/Utils.java
+++ b/tests/tests/assist/common/src/android/assist/common/Utils.java
@@ -39,10 +39,7 @@
     public static final String BROADCAST_INTENT_START_ASSIST = ACTION_PREFIX + "START_ASSIST";
     public static final String ASSIST_RECEIVER_REGISTERED = ACTION_PREFIX + "ASSIST_READY";
     public static final String ACTION_END_OF_TEST = ACTION_PREFIX + "END_OF_TEST";
-
-    public static final String ACTION_INVALIDATE = "invalidate_action";
-    public static final String GET_CONTENT_VIEW_HEIGHT = ACTION_PREFIX + "GET_CONTENT_VIEW_HEIGHT";
-    public static final String BROADCAST_CONTENT_VIEW_HEIGHT = ACTION_PREFIX + "VIEW_HEIGHT";
+    public static final String BROADCAST_CONTENT_VIEW = ACTION_PREFIX + "CONTENT_VIEW";
     public static final String SCROLL_TEXTVIEW_ACTION = ACTION_PREFIX + "TEXTVIEW_SCROLL";
     public static final String SCROLL_SCROLLVIEW_ACTION = ACTION_PREFIX + "SCROLLVIEW_SCROLL";
     public static final String TEST_ERROR = "Error In Test:";
@@ -64,6 +61,7 @@
 
     /** Lifecycle Test intent constants */
     public static final String LIFECYCLE_PREFIX = ACTION_PREFIX + "lifecycle_";
+
     public static final String LIFECYCLE_HASRESUMED = LIFECYCLE_PREFIX + "hasResumed";
     public static final String LIFECYCLE_HASFOCUS = LIFECYCLE_PREFIX + "hasFocus";
     public static final String LIFECYCLE_LOSTFOCUS = LIFECYCLE_PREFIX + "lostFocus";
@@ -73,28 +71,26 @@
 
     /** Focus Change Test intent constants */
     public static final String GAINED_FOCUS = ACTION_PREFIX + "focus_changed";
+
     public static final String LOST_FOCUS = ACTION_PREFIX + "lost_focus";
 
     public static final String APP_3P_HASRESUMED = ACTION_PREFIX + "app_3p_hasResumed";
     public static final String APP_3P_HASDRAWED = ACTION_PREFIX + "app_3p_hasDrawed";
     public static final String TEST_ACTIVITY_DESTROY = ACTION_PREFIX + "test_activity_destroy";
-    public static final String TEST_ACTIVITY_WEBVIEW_LOADED = ACTION_PREFIX + "test_activity_webview_hasResumed";
+    public static final String TEST_ACTIVITY_WEBVIEW_LOADED =
+            ACTION_PREFIX + "test_activity_webview_hasResumed";
 
     // Notice: timeout belows have to be long because some devices / form factors (like car) are
     // slower.
 
     /** Timeout for getting back assist context */
     public static final int TIMEOUT_MS = 6 * 1_000;
+
     /** Timeout for an activity to resume */
     public static final int ACTIVITY_ONRESUME_TIMEOUT_MS = 12 * 1_000;
 
     public static final String EXTRA_REGISTER_RECEIVER = "register_receiver";
 
-    /** Extras for passing the Assistant's ContentView's dimensions*/
-    public static final String EXTRA_CONTENT_VIEW_HEIGHT = "extra_content_view_height";
-    public static final String EXTRA_CONTENT_VIEW_WIDTH = "extra_content_view_width";
-    public static final String EXTRA_DISPLAY_POINT = "extra_display_point";
-
     /*
      * Extras used to pass RemoteCallback objects responsible for IPC between test, app, and
      * service.
@@ -103,10 +99,12 @@
     public static final String EXTRA_REMOTE_CALLBACK_ACTION = "extra_remote_callback_action";
 
     public static final String EXTRA_REMOTE_CALLBACK_RECEIVING = "extra_remote_callback_receiving";
-    public static final String EXTRA_REMOTE_CALLBACK_RECEIVING_ACTION = "extra_remote_callback_receiving_action";
+    public static final String EXTRA_REMOTE_CALLBACK_RECEIVING_ACTION =
+            "extra_remote_callback_receiving_action";
 
     /** Test name suffixes */
     public static final String ASSIST_STRUCTURE = "ASSIST_STRUCTURE";
+
     public static final String DISABLE_CONTEXT = "DISABLE_CONTEXT";
     public static final String FLAG_SECURE = "FLAG_SECURE";
     public static final String LIFECYCLE = "LIFECYCLE";
@@ -121,43 +119,49 @@
 
     /** Session intent constants */
     public static final String HIDE_SESSION = "android.intent.action.hide_session";
-    public static final String HIDE_SESSION_COMPLETE = "android.intent.action.hide_session_complete";
+
+    public static final String HIDE_SESSION_COMPLETE =
+            "android.intent.action.hide_session_complete";
 
     /** Lifecycle activity intent constants */
     /** Session intent constants */
-    public static final String HIDE_LIFECYCLE_ACTIVITY
-            = "android.intent.action.hide_lifecycle_activity";
+    public static final String HIDE_LIFECYCLE_ACTIVITY =
+            "android.intent.action.hide_lifecycle_activity";
 
     /** Stub html view to load into WebView */
     public static final String WEBVIEW_HTML_URL = "http://dev.null/thou/should?not=pass";
+
     public static final String WEBVIEW_HTML_DOMAIN = "dev.null";
     public static final LocaleList WEBVIEW_LOCALE_LIST = new LocaleList(Locale.ROOT, Locale.US);
     public static final String WEBVIEW_HTML_GREETING = "Hello WebView!";
-    public static final String WEBVIEW_HTML = "<html><body><div><p>" + WEBVIEW_HTML_GREETING
-            + "</p></div></body></html>";
+    public static final String WEBVIEW_HTML =
+            "<html><body><div><p>" + WEBVIEW_HTML_GREETING + "</p></div></body></html>";
 
     /** Extra data to add to assist data and assist content */
     private static Bundle EXTRA_ASSIST_BUNDLE;
+
     private static String STRUCTURED_JSON;
 
     private static String MY_UID_EXTRA = "my_uid";
 
     public static final String getStructuredJSON() throws Exception {
         if (STRUCTURED_JSON == null) {
-            STRUCTURED_JSON = new JSONObject()
-                    .put("@type", "MusicRecording")
-                    .put("@id", "https://example/music/recording")
-                    .put("url", "android-app://com.example/https/music/album")
-                    .put("name", "Album Title")
-                    .put("hello", "hi there")
-                    .put("knownNull", null)
-                    .put("unicode value", "\ud800\udc35")
-                    .put("empty string", "")
-                    .put("LongString",
-                        "lkasdjfalsdkfjalsdjfalskj9i9234jl1w23j4o123j412l3j421l3kj412l3kj1l3k4j32")
-                    .put("\ud800\udc35", "any-value")
-                    .put("key with spaces", "any-value")
-                    .toString();
+            STRUCTURED_JSON =
+                    new JSONObject()
+                            .put("@type", "MusicRecording")
+                            .put("@id", "https://example/music/recording")
+                            .put("url", "android-app://com.example/https/music/album")
+                            .put("name", "Album Title")
+                            .put("hello", "hi there")
+                            .put("knownNull", null)
+                            .put("unicode value", "\ud800\udc35")
+                            .put("empty string", "")
+                            .put(
+                                    "LongString",
+                                    "lkasdjfalsdkfjalsdjfalskj9i9234jl1w23j4o123j412l3j421l3kj412l3kj1l3k4j32")
+                            .put("\ud800\udc35", "any-value")
+                            .put("key with spaces", "any-value")
+                            .toString();
         }
         return STRUCTURED_JSON;
     }
@@ -172,7 +176,6 @@
 
     public static void addExtraAssistDataToBundle(Bundle data) {
         addExtraAssistDataToBundle(data, /* addMyUid= */ true);
-
     }
 
     private static void addExtraAssistDataToBundle(Bundle data, boolean addMyUid) {
@@ -185,9 +188,7 @@
         }
     }
 
-    /**
-     * The test app associated with each test.
-     */
+    /** The test app associated with each test. */
     public static final ComponentName getTestAppComponent(String testCaseType) {
         switch (testCaseType) {
             case ASSIST_STRUCTURE:
@@ -218,21 +219,17 @@
                 return new ComponentName(
                         "android.assist.testapp", "android.assist.testapp.FocusChangeActivity");
             default:
-                return new ComponentName("","");
+                return new ComponentName("", "");
         }
     }
 
-    /**
-     * Sets the proper action used to launch an activity in the testapp package.
-     */
+    /** Sets the proper action used to launch an activity in the testapp package. */
     public static void setTestAppAction(Intent intent, String testCaseName) {
         intent.putExtra(Utils.TESTCASE_TYPE, testCaseName);
         intent.setAction("android.intent.action.TEST_APP_" + testCaseName);
     }
 
-    /**
-     * Returns the amount of time to wait for assist data.
-     */
+    /** Returns the amount of time to wait for assist data. */
     public static final int getAssistDataTimeout(String testCaseType) {
         switch (testCaseType) {
             case SCREENSHOT:
@@ -263,7 +260,7 @@
 
     public static final void addErrorResult(final Bundle testinfo, final String msg) {
         testinfo.getStringArrayList(testinfo.getString(Utils.TESTCASE_TYPE))
-            .add(TEST_ERROR + " " + msg);
+                .add(TEST_ERROR + " " + msg);
     }
 
     public static int getExpectedUid(Bundle extras) {
diff --git a/tests/tests/assist/service/src/android/assist/service/MainInteractionSession.java b/tests/tests/assist/service/src/android/assist/service/MainInteractionSession.java
index e81df71..21fdd7f 100644
--- a/tests/tests/assist/service/src/android/assist/service/MainInteractionSession.java
+++ b/tests/tests/assist/service/src/android/assist/service/MainInteractionSession.java
@@ -16,9 +16,6 @@
 
 package android.assist.service;
 
-import static android.view.WindowInsets.Type.displayCutout;
-import static android.view.WindowInsets.Type.statusBars;
-
 import android.app.assist.AssistContent;
 import android.app.assist.AssistStructure;
 import android.assist.common.Utils;
@@ -35,14 +32,9 @@
 import android.os.RemoteCallback;
 import android.service.voice.VoiceInteractionSession;
 import android.util.Log;
-import android.view.Display;
-import android.view.DisplayCutout;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewTreeObserver;
-import android.view.WindowInsets;
-import android.view.WindowManager;
-import android.view.WindowMetrics;
 
 public class MainInteractionSession extends VoiceInteractionSession {
     static final String TAG = "MainInteractionSession";
@@ -54,8 +46,6 @@
     private boolean hasReceivedScreenshot = false;
     private boolean mScreenshotNeeded = true;
     private int mCurColor;
-    private int mDisplayHeight;
-    private int mDisplayWidth;
     private Rect mDisplayAreaBounds;
     private BroadcastReceiver mReceiver;
     private String mTestName;
@@ -71,22 +61,26 @@
     @Override
     public void onCreate() {
         super.onCreate();
-        mReceiver = new BroadcastReceiver() {
-            @Override
-            public void onReceive(Context context, Intent intent) {
-                String action = intent.getAction();
-                if (action.equals(Utils.HIDE_SESSION)) {
-                    hide();
-                }
+        mReceiver =
+                new BroadcastReceiver() {
+                    @Override
+                    public void onReceive(Context context, Intent intent) {
+                        String action = intent.getAction();
+                        if (action.equals(Utils.HIDE_SESSION)) {
+                            hide();
+                        }
 
-                Bundle bundle = new Bundle();
-                bundle.putString(Utils.EXTRA_REMOTE_CALLBACK_ACTION, Utils.HIDE_SESSION_COMPLETE);
-                mRemoteCallback.sendResult(bundle);
-            }
-        };
+                        Bundle bundle = new Bundle();
+                        bundle.putString(
+                                Utils.EXTRA_REMOTE_CALLBACK_ACTION, Utils.HIDE_SESSION_COMPLETE);
+                        mRemoteCallback.sendResult(bundle);
+                    }
+                };
         IntentFilter filter = new IntentFilter();
         filter.addAction(Utils.HIDE_SESSION);
-        mContext.registerReceiver(mReceiver, filter,
+        mContext.registerReceiver(
+                mReceiver,
+                filter,
                 Context.RECEIVER_VISIBLE_TO_INSTANT_APPS | Context.RECEIVER_EXPORTED);
     }
 
@@ -124,63 +118,25 @@
         mScreenshotNeeded = (showFlags & SHOW_WITH_SCREENSHOT) != 0;
         mTestName = args.getString(Utils.TESTCASE_TYPE, "");
         mCurColor = args.getInt(Utils.SCREENSHOT_COLOR_KEY);
-        mDisplayHeight = args.getInt(Utils.DISPLAY_HEIGHT_KEY);
-        mDisplayWidth = args.getInt(Utils.DISPLAY_WIDTH_KEY);
         mDisplayAreaBounds = args.getParcelable(Utils.DISPLAY_AREA_BOUNDS_KEY);
         mRemoteCallback = args.getParcelable(Utils.EXTRA_REMOTE_CALLBACK);
         super.onShow(args, showFlags);
         if (mContentView == null) return; // Happens when ui is not enabled.
-        mContentView.getViewTreeObserver().addOnPreDrawListener(
-                new ViewTreeObserver.OnPreDrawListener() {
-                @Override
-                public boolean onPreDraw() {
-                    mContentView.getViewTreeObserver().removeOnPreDrawListener(this);
-                    Display d = mContentView.getDisplay();
-                    Point displayPoint = new Point();
-                    // The voice interaction window layer is higher than keyguard, status bar,
-                    // nav bar now. So we should take both status bar, nav bar into consideration.
-                    // The voice interaction hide the nav bar, so the height only need to consider
-                    // status bar. The status bar may contain display cutout but the display cutout
-                    // is device specific, we need to check it.
-                    WindowManager wm = mContext.getSystemService(WindowManager.class);
-                    WindowMetrics windowMetrics = wm.getCurrentWindowMetrics();
-                    Rect bound = windowMetrics.getBounds();
-                    WindowInsets windowInsets = windowMetrics.getWindowInsets();
-                    android.graphics.Insets statusBarInsets =
-                            windowInsets.getInsets(statusBars());
-                    android.graphics.Insets displayCutoutInsets =
-                            windowInsets.getInsets(displayCutout());
-                    android.graphics.Insets min =
-                            android.graphics.Insets.min(statusBarInsets, displayCutoutInsets);
-                    boolean statusBarContainsCutout = !android.graphics.Insets.NONE.equals(min);
-                    Log.d(TAG, "statusBarContainsCutout=" + statusBarContainsCutout);
-                    displayPoint.y = statusBarContainsCutout
-                            ? bound.height() - min.top - min.bottom :
-                            bound.height() - displayCutoutInsets.top - displayCutoutInsets.bottom;
-                    displayPoint.x = statusBarContainsCutout ?
-                            bound.width() - min.left - min.right :
-                            bound.width() - displayCutoutInsets.left - displayCutoutInsets.right;
-                    DisplayCutout dc = d.getCutout();
-                    if (dc != null) {
-                        // Means the device has a cutout area
-                        android.graphics.Insets wi = d.getCutout().getWaterfallInsets();
-
-                        if (wi != android.graphics.Insets.NONE) {
-                            // Waterfall cutout. Considers only the display
-                            // useful area discarding the cutout.
-                            displayPoint.x -= (wi.left + wi.right);
-                        }
-                    }
-                    Bundle bundle = new Bundle();
-                    bundle.putString(Utils.EXTRA_REMOTE_CALLBACK_ACTION,
-                            Utils.BROADCAST_CONTENT_VIEW_HEIGHT);
-                    bundle.putInt(Utils.EXTRA_CONTENT_VIEW_HEIGHT, mContentView.getHeight());
-                    bundle.putInt(Utils.EXTRA_CONTENT_VIEW_WIDTH, mContentView.getWidth());
-                    bundle.putParcelable(Utils.EXTRA_DISPLAY_POINT, displayPoint);
-                    mRemoteCallback.sendResult(bundle);
-                    return true;
-                }
-            });
+        mContentView
+                .getViewTreeObserver()
+                .addOnPreDrawListener(
+                        new ViewTreeObserver.OnPreDrawListener() {
+                            @Override
+                            public boolean onPreDraw() {
+                                mContentView.getViewTreeObserver().removeOnPreDrawListener(this);
+                                Bundle bundle = new Bundle();
+                                bundle.putString(
+                                        Utils.EXTRA_REMOTE_CALLBACK_ACTION,
+                                        Utils.BROADCAST_CONTENT_VIEW);
+                                mRemoteCallback.sendResult(bundle);
+                                return true;
+                            }
+                        });
     }
 
     @Override
@@ -191,12 +147,16 @@
         AssistContent content = state.getAssistContent();
         ComponentName activity = structure == null ? null : structure.getActivityComponent();
         Log.i(TAG, "onHandleAssist()");
-        Log.i(TAG, String.format("Bundle: %s, Activity: %s, Structure: %s, Content: %s",
-                data, activity, structure, content));
+        Log.i(
+                TAG,
+                String.format(
+                        "Bundle: %s, Activity: %s, Structure: %s, Content: %s",
+                        data, activity, structure, content));
 
         // The structure becomes null under following conditions
         // May be null if assist data has been disabled by the user or device policy;
-        // Will be an empty stub if the application has disabled assist by marking its window as secure.
+        // Will be an empty stub if the application has disabled assist by marking its window as
+        // secure.
         // The CTS testcase will fail under the condition(automotive usecases) where
         // there are multiple displays and some of the displays are marked with FLAG_SECURE
 
@@ -205,7 +165,8 @@
             return;
         }
 
-        if (activity != null && Utils.isAutomotive(mContext)
+        if (activity != null
+                && Utils.isAutomotive(mContext)
                 && !activity.getPackageName().startsWith("android.assist")) {
             // TODO: automotive has multiple activities / displays, so the test might fail if it
             // receives one of them (like the cluster activity) instead of what's expecting. This is
@@ -249,8 +210,7 @@
             if (mTestName.equals(Utils.SCREENSHOT)) {
                 boolean screenshotMatches = compareScreenshot(screenshot, mCurColor);
                 Log.i(TAG, "this is a screenshot test. Matches? " + screenshotMatches);
-                mAssistData.putBoolean(
-                    Utils.COMPARE_SCREENSHOT_KEY, screenshotMatches);
+                mAssistData.putBoolean(Utils.COMPARE_SCREENSHOT_KEY, screenshotMatches);
             }
         } else {
             mAssistData.putBoolean(Utils.ASSIST_SCREENSHOT_KEY, false);
@@ -264,13 +224,14 @@
         // factors.
         // The current approach does not handle overridden screen sizes, and there's no clear way
         // to handle that and multiple display areas at the same time.
-//        Point size = new Point(mDisplayWidth, mDisplayHeight);
+        //        Point size = new Point(mDisplayWidth, mDisplayHeight);
 
-//        if (screenshot.getWidth() != size.x || screenshot.getHeight() != size.y) {
-//            Log.i(TAG, "width  or height didn't match: " + size + " vs " + screenshot.getWidth()
-//                    + "," + screenshot.getHeight());
-//            return false;
-//        }
+        //        if (screenshot.getWidth() != size.x || screenshot.getHeight() != size.y) {
+        //            Log.i(TAG, "width  or height didn't match: " + size + " vs " +
+        // screenshot.getWidth()
+        //                    + "," + screenshot.getHeight());
+        //            return false;
+        //        }
         Point size = new Point(screenshot.getWidth(), screenshot.getHeight());
         int[] pixels = new int[size.x * size.y];
         screenshot.getPixels(pixels, 0, size.x, 0, 0, size.x, size.y);
@@ -278,8 +239,13 @@
         // screenshot bitmap contains the screenshot for the entire physical display. A single
         // physical display could have multiple display area with different applications.
         // Let's grab the region of the display area from the original screenshot.
-        Bitmap displayAreaScreenshot = Bitmap.createBitmap(screenshot, mDisplayAreaBounds.left,
-                mDisplayAreaBounds.top, mDisplayAreaBounds.width(), mDisplayAreaBounds.height());
+        Bitmap displayAreaScreenshot =
+                Bitmap.createBitmap(
+                        screenshot,
+                        mDisplayAreaBounds.left,
+                        mDisplayAreaBounds.top,
+                        mDisplayAreaBounds.width(),
+                        mDisplayAreaBounds.height());
         int expectedColor = 0;
         for (int pixel : pixels) {
             // Check for roughly the same because there are rounding errors converting from the
@@ -304,7 +270,8 @@
             Log.i(TAG, "waiting for screenshot before broadcasting results");
         } else {
             Bundle bundle = new Bundle();
-            bundle.putString(Utils.EXTRA_REMOTE_CALLBACK_ACTION, Utils.BROADCAST_ASSIST_DATA_INTENT);
+            bundle.putString(
+                    Utils.EXTRA_REMOTE_CALLBACK_ACTION, Utils.BROADCAST_ASSIST_DATA_INTENT);
             bundle.putBundle(Utils.ON_SHOW_ARGS_KEY, mOnShowArgs);
             bundle.putAll(mAssistData);
             mRemoteCallback.sendResult(bundle);
@@ -320,7 +287,7 @@
         if (f == null) {
             Log.wtf(TAG, "layout inflater was null");
         }
-        mContentView = f.inflate(R.layout.assist_layer,null);
+        mContentView = f.inflate(R.layout.assist_layer, null);
         Log.i(TAG, "onCreateContentView");
         return mContentView;
     }
diff --git a/tests/tests/assist/src/android/assist/cts/AssistantContentViewTest.java b/tests/tests/assist/src/android/assist/cts/AssistantContentViewTest.java
index 2314393..23f9f7d 100644
--- a/tests/tests/assist/src/android/assist/cts/AssistantContentViewTest.java
+++ b/tests/tests/assist/src/android/assist/cts/AssistantContentViewTest.java
@@ -16,18 +16,14 @@
 
 package android.assist.cts;
 
-import static com.google.common.truth.Truth.assertThat;
-
 import static org.junit.Assert.fail;
 
 import android.assist.common.AutoResetLatch;
 import android.assist.common.Utils;
-import android.graphics.Point;
 import android.os.Bundle;
 import android.util.Log;
 
 import org.junit.Test;
-import org.junit.Ignore;
 
 import java.util.concurrent.TimeUnit;
 
@@ -35,7 +31,6 @@
 public class AssistantContentViewTest extends AssistTestBase {
     private static final String TAG = "ContentViewTest";
     private AutoResetLatch mContentViewLatch = new AutoResetLatch(1);
-    private Bundle mBundle;
 
     @Override
     protected void customSetup() throws Exception {
@@ -43,11 +38,6 @@
         startTestActivity(Utils.VERIFY_CONTENT_VIEW);
     }
 
-    @Override
-    protected void customTearDown() throws Exception {
-        mBundle = null;
-    }
-
     private void waitForContentView() throws Exception {
         Log.i(TAG, "waiting for the Assistant's Content View  before continuing");
         if (!mContentViewLatch.await(Utils.TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
@@ -56,32 +46,25 @@
     }
 
     @Test
-    @Ignore("b/349497368")
-    public void testAssistantContentViewDimens() throws Exception {
+    public void testAssistantContentView() throws Exception {
         if (mActivityManager.isLowRamDevice()) {
-          Log.d(TAG, "Not running assist tests on low-RAM device.");
-          return;
+            Log.d(TAG, "Not running assist tests on low-RAM device.");
+            return;
         }
         startTest(Utils.VERIFY_CONTENT_VIEW);
         waitForAssistantToBeReady();
         startSession();
         waitForContentView();
-        int height = mBundle.getInt(Utils.EXTRA_CONTENT_VIEW_HEIGHT, 0);
-        int width = mBundle.getInt(Utils.EXTRA_CONTENT_VIEW_WIDTH, 0);
-        Point displayPoint = mBundle.getParcelable(Utils.EXTRA_DISPLAY_POINT);
-        assertThat(height).isEqualTo(displayPoint.y);
-        assertThat(width).isEqualTo(displayPoint.x);
     }
 
     private class AssistantReceiver extends ActionLatchReceiver {
 
         AssistantReceiver() {
-            super(Utils.BROADCAST_CONTENT_VIEW_HEIGHT, mContentViewLatch);
+            super(Utils.BROADCAST_CONTENT_VIEW, mContentViewLatch);
         }
 
         @Override
         protected void onAction(Bundle bundle, String action) {
-            mBundle = bundle;
             super.onAction(bundle, action);
         }
     }
diff --git a/tests/tests/bionic_app/bionic_app_jni.cpp b/tests/tests/bionic_app/bionic_app_jni.cpp
index e9f7cf6..8aee9e8 100644
--- a/tests/tests/bionic_app/bionic_app_jni.cpp
+++ b/tests/tests/bionic_app/bionic_app_jni.cpp
@@ -26,7 +26,7 @@
   return env->NewStringUTF(__progname);
 }
 
-extern "C" int main(int argc, char* argv[]);
+int main(int argc, char* argv[]);
 
 extern "C" jint Java_com_android_bionic_1app_BionicAppTest_callMainDirect(JNIEnv* env __unused) {
   return main(0, nullptr);
diff --git a/tests/tests/bionic_app/main.cpp b/tests/tests/bionic_app/main.cpp
index d7d7040..3b0c858 100644
--- a/tests/tests/bionic_app/main.cpp
+++ b/tests/tests/bionic_app/main.cpp
@@ -21,6 +21,6 @@
 //
 // This function is in a separate C++ file to try to guard against the -fno-semantic-interposition
 // optimization that Clang enables by default.
-extern "C" int main(int argc __unused, char* argv[] __unused) {
-  return 42;
+int main(int argc __unused, char* argv[] __unused) {
+    return 42;
 }
diff --git a/tests/tests/bluetooth/Android.bp b/tests/tests/bluetooth/Android.bp
index c550729..5f8670a 100644
--- a/tests/tests/bluetooth/Android.bp
+++ b/tests/tests/bluetooth/Android.bp
@@ -44,7 +44,9 @@
         "dts",
         "general-tests",
         "mcts-bluetooth",
+        "mcts-bt",
         "mts-bluetooth",
+        "mts-bt",
     ],
     min_sdk_version: "Tiramisu",
     sdk_version: "module_current",
diff --git a/tests/tests/bluetooth/AndroidTest.xml b/tests/tests/bluetooth/AndroidTest.xml
index aba8e91..a6a84d8 100644
--- a/tests/tests/bluetooth/AndroidTest.xml
+++ b/tests/tests/bluetooth/AndroidTest.xml
@@ -51,7 +51,7 @@
     <!-- Only run Cts Tests in MTS if the Bluetooth Mainline module is installed. -->
     <object type="module_controller"
             class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
-        <option name="mainline-module-package-name" value="com.android.btservices" />
-        <option name="mainline-module-package-name" value="com.google.android.btservices" />
+        <option name="mainline-module-package-name" value="com.android.bt" />
+        <option name="mainline-module-package-name" value="com.google.android.bt" />
     </object>
 </configuration>
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothAdapterTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothAdapterTest.java
index 5fc3509..803415d 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothAdapterTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothAdapterTest.java
@@ -499,7 +499,7 @@
 
         Executor executor = mock(Executor.class);
         BluetoothAdapter.BluetoothConnectionCallback callback =
-                mock(BluetoothAdapter.BluetoothConnectionCallback.class);
+                new BluetoothAdapter.BluetoothConnectionCallback() {};
 
         // placeholder call for coverage
         callback.onDeviceConnected(null);
@@ -527,6 +527,18 @@
                 () -> mAdapter.requestControllerActivityEnergyInfo(executor, null));
     }
 
+    // CTS doesn't run with a compatible remote device.
+    // In order to trigger the callbacks, there is no alternative to a direct call on mock
+    @Test
+    @SuppressWarnings("DirectInvocationOnMock")
+    public void fakeActivityEnergyInfoCallbackCoverage() {
+        BluetoothAdapter.OnBluetoothActivityEnergyInfoCallback callback =
+                mock(BluetoothAdapter.OnBluetoothActivityEnergyInfoCallback.class);
+
+        callback.onBluetoothActivityEnergyInfoAvailable(null);
+        callback.onBluetoothActivityEnergyInfoError(0);
+    }
+
     @Test
     public void clearBluetooth() {
         assumeTrue(mHasBluetooth);
@@ -734,6 +746,16 @@
         }
     }
 
+    // CTS doesn't run with a compatible remote device.
+    // In order to trigger the callbacks, there is no alternative to a direct call on mock
+    @Test
+    @SuppressWarnings("DirectInvocationOnMock")
+    public void fakePreferredAudioProfilesCallbackCoverage() {
+        BluetoothAdapter.PreferredAudioProfilesChangedCallback callback =
+                mock(BluetoothAdapter.PreferredAudioProfilesChangedCallback.class);
+        callback.onPreferredAudioProfilesChanged(null, null, 0);
+    }
+
     @Test
     public void bluetoothQualityReportReadyCallbacks() {
         assumeTrue(mHasBluetooth);
@@ -773,6 +795,16 @@
         }
     }
 
+    // CTS doesn't run with a compatible remote device.
+    // In order to trigger the callbacks, there is no alternative to a direct call on mock
+    @Test
+    @SuppressWarnings("DirectInvocationOnMock")
+    public void fakeQualityReportCallbackCoverage() {
+        BluetoothAdapter.BluetoothQualityReportReadyCallback callback =
+                mock(BluetoothAdapter.BluetoothQualityReportReadyCallback.class);
+        callback.onBluetoothQualityReportReady(null, null, 0);
+    }
+
     @Test
     public void notifyActiveDeviceChangeApplied() {
         assumeTrue(mHasBluetooth);
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCodecsTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCodecsTest.java
index 8442fa5..807b20d 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCodecsTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCodecsTest.java
@@ -16,10 +16,17 @@
 
 package android.bluetooth.cts;
 
+import static android.bluetooth.BluetoothCodecConfig.SOURCE_CODEC_TYPE_AAC;
+import static android.bluetooth.BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID;
+import static android.bluetooth.BluetoothCodecConfig.SOURCE_CODEC_TYPE_LC3;
+import static android.bluetooth.BluetoothCodecConfig.SOURCE_CODEC_TYPE_SBC;
+import static android.bluetooth.BluetoothCodecType.CODEC_ID_AAC;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import android.bluetooth.BluetoothCodecConfig;
 import android.bluetooth.BluetoothCodecStatus;
+import android.bluetooth.BluetoothCodecType;
 
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 import androidx.test.filters.SmallTest;
@@ -348,6 +355,35 @@
         assertThat(bcs_A.isCodecConfigSelectable(selectable_capability2_B)).isFalse();
     }
 
+    @Test
+    public void codecType_createFromType() {
+        BluetoothCodecType c = BluetoothCodecType.createFromType(SOURCE_CODEC_TYPE_AAC);
+        assertThat(c).isNotNull();
+
+        assertThat(BluetoothCodecType.createFromType(SOURCE_CODEC_TYPE_LC3)).isNull();
+        assertThat(BluetoothCodecType.createFromType(SOURCE_CODEC_TYPE_INVALID)).isNull();
+    }
+
+    @Test
+    public void codecType_getCodecId() {
+        BluetoothCodecType c = BluetoothCodecType.createFromType(SOURCE_CODEC_TYPE_AAC);
+        assertThat(c.getCodecId()).isEqualTo(CODEC_ID_AAC);
+    }
+
+    @Test
+    public void codecType_getCodecName() {
+        BluetoothCodecType c = BluetoothCodecType.createFromType(SOURCE_CODEC_TYPE_AAC);
+        assertThat(c.getCodecName()).isEqualTo("AAC");
+    }
+
+    @Test
+    public void codecType_isMandatoryCodec() {
+        BluetoothCodecType cA = BluetoothCodecType.createFromType(SOURCE_CODEC_TYPE_AAC);
+        BluetoothCodecType cB = BluetoothCodecType.createFromType(SOURCE_CODEC_TYPE_SBC);
+        assertThat(cA.isMandatoryCodec()).isFalse();
+        assertThat(cB.isMandatoryCodec()).isTrue();
+    }
+
     private static BluetoothCodecConfig buildBluetoothCodecConfig(
             int sourceCodecType,
             int codecPriority,
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCsipSetCoordinatorTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCsipSetCoordinatorTest.java
index 83d92cb..469cdfa 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCsipSetCoordinatorTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothCsipSetCoordinatorTest.java
@@ -18,6 +18,7 @@
 
 import static android.Manifest.permission.BLUETOOTH_CONNECT;
 import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
+import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
 import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED;
 import static android.content.pm.PackageManager.FEATURE_BLUETOOTH_LE;
 
@@ -36,6 +37,7 @@
 import android.bluetooth.BluetoothStatusCodes;
 import android.bluetooth.BluetoothUuid;
 import android.bluetooth.test_utils.BlockingBluetoothAdapter;
+import android.bluetooth.test_utils.Permissions;
 import android.content.Context;
 import android.sysprop.BluetoothProperties;
 
@@ -54,6 +56,7 @@
 import org.mockito.MockitoAnnotations;
 
 import java.time.Duration;
+import java.util.List;
 import java.util.UUID;
 import java.util.concurrent.Executor;
 
@@ -111,7 +114,7 @@
     @CddTest(requirements = {"7.4.3/C-2-1", "7.4.3/C-3-2"})
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.CSIP_SET_COORDINATOR, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.CSIP_SET_COORDINATOR));
     }
@@ -196,4 +199,19 @@
         assertThat(BlockingBluetoothAdapter.disable(true)).isTrue();
         assertThat(mService.getAllGroupIds(null)).isEmpty();
     }
+
+    @Test
+    public void setGetConnectionPolicy() {
+        Permissions.enforceEachPermissions(
+                () -> mService.getConnectionPolicy(mDevice),
+                List.of(BLUETOOTH_PRIVILEGED, BLUETOOTH_CONNECT));
+        Permissions.enforceEachPermissions(
+                () -> mService.setConnectionPolicy(mDevice, CONNECTION_POLICY_FORBIDDEN),
+                List.of(BLUETOOTH_PRIVILEGED, BLUETOOTH_CONNECT));
+
+        try (var p = Permissions.withPermissions(BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED)) {
+            assertThat(mService.getConnectionPolicy(null)).isEqualTo(CONNECTION_POLICY_FORBIDDEN);
+            assertThat(mService.setConnectionPolicy(mDevice, CONNECTION_POLICY_FORBIDDEN)).isTrue();
+        }
+    }
 }
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothDeviceTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothDeviceTest.java
index 58b2663..e10b479 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothDeviceTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothDeviceTest.java
@@ -25,16 +25,24 @@
 import static android.bluetooth.BluetoothDevice.TRANSPORT_BREDR;
 import static android.bluetooth.BluetoothDevice.TRANSPORT_LE;
 
+import static androidx.test.espresso.intent.matcher.IntentMatchers.hasAction;
+import static androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra;
+
 import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
 
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.junit.Assert.assertThrows;
 import static org.junit.Assume.assumeTrue;
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verify;
 
 import android.app.UiAutomation;
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
+import android.bluetooth.BluetoothDevice.BluetoothAddress;
 import android.bluetooth.BluetoothManager;
 import android.bluetooth.BluetoothProfile;
 import android.bluetooth.BluetoothSinkAudioPolicy;
@@ -44,7 +52,10 @@
 import android.bluetooth.OobData;
 import android.bluetooth.test_utils.Permissions;
 import android.content.AttributionSource;
+import android.content.BroadcastReceiver;
 import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.pm.PackageManager;
 import android.platform.test.annotations.RequiresFlagsEnabled;
 import android.platform.test.flag.junit.CheckFlagsRule;
@@ -55,15 +66,20 @@
 import androidx.test.platform.app.InstrumentationRegistry;
 
 import com.android.bluetooth.flags.Flags;
+import com.android.compatibility.common.util.CddTest;
 
+import org.hamcrest.Matcher;
+import org.hamcrest.core.AllOf;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import org.mockito.hamcrest.MockitoHamcrest;
 
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
+import java.time.Duration;
 import java.util.List;
 import java.util.UUID;
 
@@ -204,6 +220,17 @@
                 () -> mFakeDevice.getIdentityAddressWithType());
     }
 
+    @CddTest(requirements = {"7.4.3/C-2-1"})
+    @Test
+    @RequiresFlagsEnabled(Flags.FLAG_IDENTITY_ADDRESS_TYPE_API)
+    public void testBluetoothAddress() {
+        int addressType = BluetoothDevice.ADDRESS_TYPE_PUBLIC;
+        BluetoothAddress bluetoothAddress = new BluetoothAddress(mFakeDeviceAddress, addressType);
+
+        assertThat(bluetoothAddress.getAddress()).isEqualTo(mFakeDeviceAddress);
+        assertThat(bluetoothAddress.getAddressType()).isEqualTo(addressType);
+    }
+
     @Test
     public void getConnectionHandle() {
         // Skip the test if bluetooth or companion device are not present.
@@ -438,6 +465,8 @@
         // Skip the test if bluetooth or companion device are not present.
         assumeTrue(mHasBluetooth && mHasCompanionDevice);
 
+        assertThat(mFakeDevice.fetchUuidsWithSdp()).isTrue();
+
         // TRANSPORT_AUTO doesn't need BLUETOOTH_PRIVILEGED permission
         assertThat(mFakeDevice.fetchUuidsWithSdp(TRANSPORT_AUTO)).isTrue();
 
@@ -607,6 +636,12 @@
 
     @Test
     public void getPackageNameOfBondingApplication() {
+        IntentFilter filter = new IntentFilter();
+        filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
+        filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY);
+        BroadcastReceiver mockReceiver = mock(BroadcastReceiver.class);
+        mContext.registerReceiver(mockReceiver, filter);
+
         // Skip the test if bluetooth or companion device are not present.
         assumeTrue(mHasBluetooth && mHasCompanionDevice);
 
@@ -624,11 +659,23 @@
         mFakeDevice.createBond();
         assertThat(mFakeDevice.getPackageNameOfBondingApplication())
                 .isEqualTo(mContext.getPackageName());
+        verifyIntentReceived(
+                mockReceiver,
+                Duration.ofSeconds(5),
+                hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
+                hasExtra(BluetoothDevice.EXTRA_DEVICE, mFakeDevice),
+                hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_BONDING));
 
         // Clean up create bond
         // Either cancel the bonding process or remove bond
         mFakeDevice.cancelBondProcess();
         mFakeDevice.removeBond();
+        verifyIntentReceived(
+                mockReceiver,
+                Duration.ofSeconds(5),
+                hasAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED),
+                hasExtra(BluetoothDevice.EXTRA_DEVICE, mFakeDevice),
+                hasExtra(BluetoothDevice.EXTRA_BOND_STATE, BluetoothDevice.BOND_NONE));
     }
 
     @Test
@@ -724,4 +771,10 @@
                     .isEqualTo(BluetoothStatusCodes.ERROR_DEVICE_NOT_BONDED);
         }
     }
+
+    private void verifyIntentReceived(
+            BroadcastReceiver receiver, Duration timeout, Matcher<Intent>... matchers) {
+        verify(receiver, timeout(timeout.toMillis()))
+                .onReceive(any(), MockitoHamcrest.argThat(AllOf.allOf(matchers)));
+    }
 }
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHapClientTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHapClientTest.java
index d7743d1..d903977 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHapClientTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHapClientTest.java
@@ -103,7 +103,7 @@
     @CddTest(requirements = {"7.4.3/C-2-1", "7.4.3/C-3-2"})
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.HAP_CLIENT, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.HAP_CLIENT));
     }
@@ -310,6 +310,21 @@
         TestUtils.adoptPermissionAsShellUid(BLUETOOTH_CONNECT, BLUETOOTH_PRIVILEGED);
     }
 
+    @Test
+    // CTS doesn't run with a compatible remote device.
+    // In order to trigger the callbacks, there is no alternative to a direct call on mock
+    @SuppressWarnings("DirectInvocationOnMock")
+    public void fakeCallbackCoverage() {
+        BluetoothHapClient.Callback mockCallback = mock(BluetoothHapClient.Callback.class);
+
+        mockCallback.onPresetInfoChanged(null, null, 0);
+        mockCallback.onPresetSelected(null, 0, 0);
+        mockCallback.onPresetSelectionFailed(null, 0);
+        mockCallback.onPresetSelectionForGroupFailed(0, 0);
+        mockCallback.onSetPresetNameFailed(null, 0);
+        mockCallback.onSetPresetNameForGroupFailed(0, 0);
+    }
+
     @CddTest(requirements = {"7.4.3/C-2-1", "7.4.3/C-3-2"})
     @Test
     public void getHearingAidType() {
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHciVendorSpecificTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHciVendorSpecificTest.java
index 1d0c13d..2efb435c 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHciVendorSpecificTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHciVendorSpecificTest.java
@@ -101,7 +101,7 @@
                     IllegalArgumentException.class,
                     () ->
                             sAdapter.registerBluetoothHciVendorSpecificCallback(
-                                    Set.of(-1, 0x4f, 0x60, 0xff),
+                                    Set.of(-1, 0x51, 0x60, 0xff),
                                     sContext.getMainExecutor(),
                                     callback));
 
@@ -109,7 +109,7 @@
                     IllegalArgumentException.class,
                     () ->
                             sAdapter.registerBluetoothHciVendorSpecificCallback(
-                                    Set.of(0, 0x50, 0x60, 0xff),
+                                    Set.of(0, 0x52, 0x60, 0xff),
                                     sContext.getMainExecutor(),
                                     callback));
 
@@ -117,7 +117,7 @@
                     IllegalArgumentException.class,
                     () ->
                             sAdapter.registerBluetoothHciVendorSpecificCallback(
-                                    Set.of(0, 0x4f, 0x5f, 0xff),
+                                    Set.of(0, 0x51, 0x5f, 0xff),
                                     sContext.getMainExecutor(),
                                     callback));
 
@@ -125,7 +125,7 @@
                     IllegalArgumentException.class,
                     () ->
                             sAdapter.registerBluetoothHciVendorSpecificCallback(
-                                    Set.of(0, 0x4f, 0x60, 0x100),
+                                    Set.of(0, 0x51, 0x60, 0x100),
                                     sContext.getMainExecutor(),
                                     callback));
         }
@@ -133,13 +133,13 @@
         // Check multiple registration
         try (var p = Permissions.withPermissions(BLUETOOTH_PRIVILEGED)) {
             sAdapter.registerBluetoothHciVendorSpecificCallback(
-                    Set.of(0, 0x4f, 0x60, 0xff), sContext.getMainExecutor(), callback);
+                    Set.of(0, 0x51, 0x60, 0xff), sContext.getMainExecutor(), callback);
 
             assertThrows(
                     IllegalArgumentException.class,
                     () ->
                             sAdapter.registerBluetoothHciVendorSpecificCallback(
-                                    Set.of(0, 0x4f, 0x60, 0xff),
+                                    Set.of(0, 0x51, 0x60, 0xff),
                                     sContext.getMainExecutor(),
                                     mock(
                                             BluetoothAdapter.BluetoothHciVendorSpecificCallback
@@ -308,4 +308,16 @@
             sAdapter.unregisterBluetoothHciVendorSpecificCallback(callback);
         }
     }
+
+    // Android doesn't provide method without side-effect and therefore this is not testable in CTS
+    // In order to trigger the callbacks, there is no alternative to a direct call on mock
+    @Test
+    @SuppressWarnings("DirectInvocationOnMock")
+    public void fakeCallbackCoverage() {
+        BluetoothAdapter.BluetoothHciVendorSpecificCallback callback =
+                mock(BluetoothAdapter.BluetoothHciVendorSpecificCallback.class);
+
+        callback.onCommandStatus(0, 0);
+        callback.onEvent(0, null);
+    }
 }
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetClientTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetClientTest.java
index b0ee4c9..498c5e6 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetClientTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHeadsetClientTest.java
@@ -101,7 +101,7 @@
 
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.HEADSET_CLIENT, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.HEADSET_CLIENT));
     }
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidHostTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidHostTest.java
index acc42c4..81498c4 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidHostTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothHidHostTest.java
@@ -167,7 +167,6 @@
         assertThat(mService.setConnectionPolicy(mDevice, CONNECTION_POLICY_FORBIDDEN)).isFalse();
     }
 
-    @RequiresFlagsEnabled(Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP)
     @Test
     public void getPreferredTransportTest() {
         // Verify throws NullPointerException when null BluetoothDevice is used
@@ -179,7 +178,6 @@
                 .isEqualTo(BluetoothDevice.TRANSPORT_AUTO);
     }
 
-    @RequiresFlagsEnabled(Flags.FLAG_ALLOW_SWITCHING_HID_AND_HOGP)
     @Test
     public void setPreferredTransportTest() {
         // Verify that BLUETOOTH_PRIVILEGED permission is enforced
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeAudioTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeAudioTest.java
index da22f01..95c8b07 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeAudioTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeAudioTest.java
@@ -114,7 +114,7 @@
     @CddTest(requirements = {"7.4.3/C-2-1"})
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.LE_AUDIO, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.LE_AUDIO));
     }
@@ -209,6 +209,20 @@
         mService.unregisterCallback(mCallback);
     }
 
+    @Test
+    // CTS doesn't run with a compatible remote device.
+    // In order to trigger the callbacks, there is no alternative to a direct call on mock
+    @SuppressWarnings("DirectInvocationOnMock")
+    @RequiresFlagsEnabled(Flags.FLAG_LEAUDIO_BROADCAST_API_MANAGE_PRIMARY_GROUP)
+    public void fakeCallbackCoverage() {
+        mCallback.onBroadcastToUnicastFallbackGroupChanged(0);
+        mCallback.onCodecConfigChanged(0, null);
+        mCallback.onGroupNodeAdded(null, 0);
+        mCallback.onGroupNodeRemoved(null, 0);
+        mCallback.onGroupStatusChanged(0, 0);
+        mCallback.onGroupStreamStatusChanged(0, 0);
+    }
+
     @CddTest(requirements = {"7.4.3/C-2-1"})
     @Test
     public void getConnectedGroupLeadDevice() {
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastAssistantTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastAssistantTest.java
index ca9ec12..05ebbf4 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastAssistantTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastAssistantTest.java
@@ -133,7 +133,7 @@
     @CddTest(requirements = {"7.4.3/C-2-1", "7.4.3/C-3-2"})
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.LE_AUDIO_BROADCAST_ASSISTANT));
     }
@@ -302,6 +302,22 @@
         mService.unregisterCallback(mCallback);
     }
 
+    @Test
+    // CTS doesn't run with a compatible remote device.
+    // In order to trigger the callbacks, there is no alternative to a direct call on mock
+    @SuppressWarnings("DirectInvocationOnMock")
+    public void fakeCallbackCoverage() {
+        mCallback.onReceiveStateChanged(null, 0, null);
+        mCallback.onSearchStartFailed(0);
+        mCallback.onSearchStopFailed(0);
+        mCallback.onSearchStopped(0);
+        mCallback.onSourceAdded(null, 0, 0);
+        mCallback.onSourceFound(null);
+        mCallback.onSourceLost(0);
+        mCallback.onSourceModified(null, 0, 0);
+        mCallback.onSourceRemoved(null, 0, 0);
+    }
+
     @CddTest(requirements = {"7.4.3/C-2-1", "7.4.3/C-3-2"})
     @Test
     public void startSearchingForSources() {
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastTest.java
index ae7544b..9dec065 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothLeBroadcastTest.java
@@ -114,7 +114,7 @@
     @CddTest(requirements = {"7.4.3/C-2-1", "7.4.3/C-3-2"})
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.LE_AUDIO_BROADCAST, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.LE_AUDIO_BROADCAST));
     }
@@ -155,6 +155,20 @@
         mService.unregisterCallback(mCallback);
     }
 
+    @Test
+    // CTS doesn't run with a compatible remote device.
+    // In order to trigger the callbacks, there is no alternative to a direct call on mock
+    @SuppressWarnings("DirectInvocationOnMock")
+    public void fakeCallbackCoverage() {
+        mCallback.onBroadcastMetadataChanged(0, null);
+        mCallback.onBroadcastStartFailed(0);
+        mCallback.onBroadcastStopFailed(0);
+        mCallback.onBroadcastUpdateFailed(0, 0);
+        mCallback.onBroadcastUpdated(0, 0);
+        mCallback.onPlaybackStarted(0, 0);
+        mCallback.onPlaybackStopped(0, 0);
+    }
+
     @CddTest(requirements = {"7.4.3/C-2-1", "7.4.3/C-3-2"})
     @Test
     public void registerCallbackNoPermission() {
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapClientTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapClientTest.java
index 1a39942..6070986 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapClientTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapClientTest.java
@@ -112,7 +112,7 @@
 
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.MAP_CLIENT, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.MAP_CLIENT));
     }
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapTest.java
index 2d84957..92af584 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothMapTest.java
@@ -101,7 +101,7 @@
 
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.MAP, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.MAP));
     }
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapClientTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapClientTest.java
index d1dcd39..4c0d38c 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapClientTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothPbapClientTest.java
@@ -96,7 +96,7 @@
 
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.PBAP_CLIENT, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.PBAP_CLIENT));
     }
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSapTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSapTest.java
index 4dd1d73..240132a 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSapTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSapTest.java
@@ -98,7 +98,7 @@
 
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.SAP, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.SAP));
     }
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSocketSettingsTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSocketSettingsTest.java
index d6a8d93c..d2ebba9 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSocketSettingsTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothSocketSettingsTest.java
@@ -132,26 +132,6 @@
         socket.close();
     }
 
-    private void createClientSocketUsingSettings(
-            BluetoothSocketSettings settings, List<String> requiredPermissions) throws IOException {
-        Permissions.enforceEachPermissions(
-                () -> {
-                    try {
-                        mFakeDevice.createUsingSocketSettings(settings);
-                        return true;
-                    } catch (IOException e) {
-                        return false;
-                    }
-                },
-                requiredPermissions);
-        final BluetoothSocket socket;
-        try (var p = Permissions.withPermissions(requiredPermissions.toArray(new String[0]))) {
-            socket = mFakeDevice.createUsingSocketSettings(settings);
-        }
-        assertThat(socket).isNotNull();
-        socket.close();
-    }
-
     private boolean isLeCocSocketOffloadSupported() {
         boolean result;
         try (var p = Permissions.withPermissions(BLUETOOTH_PRIVILEGED)) {
@@ -503,7 +483,7 @@
                         .setRequestedMaximumPacketSize(TEST_MAX_RX_PACKET_SIZE);
 
         BluetoothSocketSettings settings = builder.build();
-        createClientSocketUsingSettings(settings, List.of(BLUETOOTH_PRIVILEGED, BLUETOOTH_CONNECT));
+        createClientSocketUsingSettings(settings);
     }
 
     @RequiresFlagsEnabled(Flags.FLAG_SOCKET_SETTINGS_API)
@@ -523,6 +503,6 @@
                         .setRequestedMaximumPacketSize(TEST_MAX_RX_PACKET_SIZE);
 
         BluetoothSocketSettings settings = builder.build();
-        createClientSocketUsingSettings(settings, List.of(BLUETOOTH_PRIVILEGED, BLUETOOTH_CONNECT));
+        createClientSocketUsingSettings(settings);
     }
 }
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothVolumeControlTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothVolumeControlTest.java
index 155788c..a020dbc 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothVolumeControlTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/BluetoothVolumeControlTest.java
@@ -29,9 +29,11 @@
 import static org.junit.Assert.assertThrows;
 import static org.junit.Assume.assumeTrue;
 import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.timeout;
 import static org.mockito.Mockito.verify;
 
+import android.bluetooth.AudioInputControl;
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothProfile;
@@ -115,7 +117,7 @@
 
     @Test
     public void closeProfileProxy() {
-        mAdapter.closeProfileProxy(BluetoothProfile.VOLUME_CONTROL, mService);
+        mService.close();
         verify(mListener, timeout(PROXY_CONNECTION_TIMEOUT.toMillis()))
                 .onServiceDisconnected(eq(BluetoothProfile.VOLUME_CONTROL));
     }
@@ -154,10 +156,23 @@
     }
 
     @Test
+    // CTS doesn't run with a compatible remote device.
+    // In order to trigger the callbacks, there is no alternative to a direct call on mock
+    @SuppressWarnings("DirectInvocationOnMock")
+    public void fakeCallbackCoverage() {
+        mCallback.onVolumeOffsetChanged(null, 0);
+        mCallback.onVolumeOffsetChanged(null, 0, 0);
+        mCallback.onVolumeOffsetAudioLocationChanged(null, 0, 0);
+        mCallback.onVolumeOffsetAudioDescriptionChanged(null, 0, "foo");
+        mCallback.onDeviceVolumeChanged(null, 0);
+    }
+
+    @Test
     public void setVolumeOffset() {
         mService.setVolumeOffset(mDevice, 0);
 
         enforceConnectAndPrivileged(() -> mService.setVolumeOffset(mDevice, 0));
+        enforceConnectAndPrivileged(() -> mService.setVolumeOffset(mDevice, 0, 0));
     }
 
     @Test
@@ -246,6 +261,40 @@
         }
     }
 
+    // CTS doesn't run with a compatible remote device.
+    // In order to trigger the callbacks, there is no alternative to a direct call on mock
+    @Test
+    @SuppressWarnings("DirectInvocationOnMock")
+    public void fakeAicsCallbackCoverage() {
+        AudioInputControl aics = mock(AudioInputControl.class);
+        aics.registerCallback(null, null);
+        aics.unregisterCallback(null);
+        aics.getAudioInputType();
+        aics.getGainSettingUnit();
+        aics.getGainSettingMin();
+        aics.getGainSettingMax();
+        aics.getDescription();
+        aics.isDescriptionWritable();
+        aics.setDescription(null);
+        aics.getAudioInputStatus();
+        aics.getGainSetting();
+        aics.setGainSetting(0);
+        aics.getGainMode();
+        aics.setGainMode(0);
+        aics.getMute();
+        aics.setMute(0);
+        AudioInputControl.AudioInputCallback aicsCallback =
+                mock(AudioInputControl.AudioInputCallback.class);
+        aicsCallback.onDescriptionChanged(null);
+        aicsCallback.onAudioInputStatusChanged(0);
+        aicsCallback.onGainSettingChanged(0);
+        aicsCallback.onSetGainSettingFailed();
+        aicsCallback.onMuteChanged(0);
+        aicsCallback.onSetMuteFailed();
+        aicsCallback.onGainModeChanged(0);
+        aicsCallback.onSetGainModeFailed();
+    }
+
     private void enforceConnectAndPrivileged(ThrowingRunnable runnable) {
         // Verify throws SecurityException without permission.BLUETOOTH_PRIVILEGED
         TestUtils.adoptPermissionAsShellUid(BLUETOOTH_CONNECT);
diff --git a/tests/tests/bluetooth/src/android/bluetooth/cts/HearingAidProfileTest.java b/tests/tests/bluetooth/src/android/bluetooth/cts/HearingAidProfileTest.java
index d1412f1..4157b8c 100644
--- a/tests/tests/bluetooth/src/android/bluetooth/cts/HearingAidProfileTest.java
+++ b/tests/tests/bluetooth/src/android/bluetooth/cts/HearingAidProfileTest.java
@@ -19,6 +19,7 @@
 import static android.Manifest.permission.BLUETOOTH_CONNECT;
 import static android.Manifest.permission.BLUETOOTH_PRIVILEGED;
 import static android.Manifest.permission.BLUETOOTH_SCAN;
+import static android.bluetooth.BluetoothProfile.CONNECTION_POLICY_FORBIDDEN;
 import static android.bluetooth.BluetoothProfile.STATE_CONNECTED;
 import static android.bluetooth.BluetoothProfile.STATE_CONNECTING;
 import static android.bluetooth.BluetoothProfile.STATE_DISCONNECTED;
@@ -332,4 +333,14 @@
                     .isIn(bondedDeviceList);
         }
     }
+
+    @Test
+    public void setGetConnectionPolicy() {
+        Permissions.enforceEachPermissions(
+                () -> mService.getConnectionPolicy(mDevice),
+                List.of(BLUETOOTH_PRIVILEGED, BLUETOOTH_CONNECT));
+        Permissions.enforceEachPermissions(
+                () -> mService.setConnectionPolicy(mDevice, CONNECTION_POLICY_FORBIDDEN),
+                List.of(BLUETOOTH_PRIVILEGED, BLUETOOTH_CONNECT));
+    }
 }
diff --git a/tests/tests/content/src/android/content/pm/cts/PackageInstallerArchiveTest.java b/tests/tests/content/src/android/content/pm/cts/PackageInstallerArchiveTest.java
index a01e897..dd9b5aa 100644
--- a/tests/tests/content/src/android/content/pm/cts/PackageInstallerArchiveTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/PackageInstallerArchiveTest.java
@@ -995,7 +995,7 @@
         mContext.startActivity(createTestActivityIntent(),
                 options.toBundle());
         mUiDevice.wait(Until.hasObject(By.clazz(PACKAGE_NAME, ACTIVITY_NAME)),
-                TimeUnit.SECONDS.toMillis(5));
+                TimeUnit.SECONDS.toMillis(10));
     }
 
     private Intent createTestActivityIntent() {
diff --git a/tests/tests/deviceconfig/src/android/deviceconfig/cts/AconfigApiTest.java b/tests/tests/deviceconfig/src/android/deviceconfig/cts/AconfigApiTest.java
index d0a5926e..58c891e 100644
--- a/tests/tests/deviceconfig/src/android/deviceconfig/cts/AconfigApiTest.java
+++ b/tests/tests/deviceconfig/src/android/deviceconfig/cts/AconfigApiTest.java
@@ -21,6 +21,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.assertTrue;
 
 import android.os.Build;
@@ -47,7 +48,7 @@
     @Test
     @RequiresFlagsEnabled({Flags.FLAG_NEW_STORAGE_PUBLIC_API, FLAG_ENABLE_ONLY_NEW_STORAGE})
     public void testStorageReaderEnableInstance() {
-        if (Build.VERSION.SDK_INT <= 35) {
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
             return;
         }
         AconfigPackage reader = AconfigPackage.load("android.provider.flags");
@@ -58,7 +59,7 @@
     @Test
     @RequiresFlagsEnabled({Flags.FLAG_NEW_STORAGE_PUBLIC_API, FLAG_ENABLE_ONLY_NEW_STORAGE})
     public void testStorageReaderDisableInstance() {
-        if (Build.VERSION.SDK_INT <= 35) {
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
             return;
         }
         AconfigPackage reader = AconfigPackage.load("android.provider.flags");
@@ -69,14 +70,16 @@
     @Test
     @RequiresFlagsEnabled({Flags.FLAG_NEW_STORAGE_PUBLIC_API, FLAG_ENABLE_ONLY_NEW_STORAGE})
     public void testAconfigPackageLoadWithError() {
-        // load fake package
-        if (Build.VERSION.SDK_INT <= 35) {
+        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.VANILLA_ICE_CREAM) {
             return;
         }
-        AconfigPackage p = AconfigPackage.load("fake_package");
-        assertNotNull(p);
-        assertFalse(p.getBooleanFlagValue("fake_flag", false));
-        assertTrue(p.getBooleanFlagValue("fake_flag", true));
+
+        // load fake package
+        AconfigStorageReadException e =
+                assertThrows(
+                        AconfigStorageReadException.class,
+                        () -> AconfigPackage.load("fake_package"));
+        assertEquals(AconfigStorageReadException.ERROR_PACKAGE_NOT_FOUND, e.getErrorCode());
     }
 
     @Test
diff --git a/tests/tests/deviceconfig/src/android/deviceconfig/cts/DeviceConfigApiTests.java b/tests/tests/deviceconfig/src/android/deviceconfig/cts/DeviceConfigApiTests.java
index 8133f83..602bb12 100644
--- a/tests/tests/deviceconfig/src/android/deviceconfig/cts/DeviceConfigApiTests.java
+++ b/tests/tests/deviceconfig/src/android/deviceconfig/cts/DeviceConfigApiTests.java
@@ -160,10 +160,6 @@
                     + sContext.getUserId();
             return;
         }
-
-        InstrumentationRegistry.getInstrumentation().getUiAutomation().adoptShellPermissionIdentity(
-                WRITE_DEVICE_CONFIG_PERMISSION, READ_DEVICE_CONFIG_PERMISSION,
-                MONITOR_DEVICE_CONFIG_ACCESS);
     }
 
     @Before
@@ -173,6 +169,14 @@
 
     @Before
     public void setUpSyncDisabledMode() {
+        // Adoption of the shell permission identity is required before each test since the
+        // CheckFlagRule will drop the shell permission identity.
+        InstrumentationRegistry.getInstrumentation()
+                .getUiAutomation()
+                .adoptShellPermissionIdentity(
+                        WRITE_DEVICE_CONFIG_PERMISSION,
+                        READ_DEVICE_CONFIG_PERMISSION,
+                        MONITOR_DEVICE_CONFIG_ACCESS);
         mInitialSyncDisabledMode = DeviceConfig.getSyncDisabledMode();
         DeviceConfig.setSyncDisabledMode(SYNC_DISABLED_MODE_NONE);
     }
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputHidTestCase.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputHidTestCase.java
index 8b93a1f..b048801 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/InputHidTestCase.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/InputHidTestCase.java
@@ -18,6 +18,8 @@
 
 import static android.hardware.lights.LightsRequest.Builder;
 
+import static com.android.input.flags.Flags.FLAG_DEVICE_ASSOCIATIONS;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.junit.Assert.assertEquals;
@@ -41,6 +43,7 @@
 import android.os.VibrationEffect;
 import android.os.Vibrator;
 import android.os.Vibrator.OnVibratorStateChangedListener;
+import android.platform.test.annotations.RequiresFlagsEnabled;
 import android.util.Log;
 import android.view.InputDevice;
 import android.view.KeyEvent;
@@ -67,6 +70,7 @@
 import java.util.Map;
 import java.util.Objects;
 
+@RequiresFlagsEnabled(FLAG_DEVICE_ASSOCIATIONS)
 public abstract class InputHidTestCase extends InputTestCase {
 
     private static final String TAG = "InputHidTestCase";
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualDpadTest.kt b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualDpadTest.kt
index 6313a85..50fa759 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualDpadTest.kt
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualDpadTest.kt
@@ -88,20 +88,6 @@
     }
 
     @Test
-    fun sendKeyEvent_withoutCreateVirtualDevicePermission_throwsException() {
-        mRule.runWithoutPermissions {
-            assertThrows(SecurityException::class.java) {
-                mVirtualDpad.sendKeyEvent(
-                    VirtualKeyEvent.Builder()
-                        .setKeyCode(KeyEvent.KEYCODE_DPAD_UP)
-                        .setAction(VirtualKeyEvent.ACTION_DOWN)
-                        .build()
-                )
-            }
-        }
-    }
-
-    @Test
     fun rejectsUnsupportedKeyCodes() {
         assertThrows(IllegalArgumentException::class.java) {
             mVirtualDpad.sendKeyEvent(
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualKeyboardTest.kt b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualKeyboardTest.kt
index 20490d5..dcb2a34 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualKeyboardTest.kt
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualKeyboardTest.kt
@@ -68,20 +68,6 @@
     }
 
     @Test
-    fun sendKeyEvent_withoutCreateVirtualDevicePermission_throwsException() {
-        mRule.runWithoutPermissions {
-            assertThrows(SecurityException::class.java) {
-                mVirtualKeyboard.sendKeyEvent(
-                    VirtualKeyEvent.Builder()
-                        .setKeyCode(KeyEvent.KEYCODE_DPAD_UP)
-                        .setAction(VirtualKeyEvent.ACTION_DOWN)
-                        .build()
-                )
-            }
-        }
-    }
-
-    @Test
     fun rejectsUnsupportedKeyCodes() {
         assertThrows(IllegalArgumentException::class.java) {
             mVirtualKeyboard.sendKeyEvent(
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualMouseTest.kt b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualMouseTest.kt
index 8471575..5aa0839 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualMouseTest.kt
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualMouseTest.kt
@@ -31,7 +31,6 @@
 import junitparams.JUnitParamsRunner
 import junitparams.Parameters
 import org.junit.Assert.assertEquals
-import org.junit.Assert.assertThrows
 import org.junit.Rule
 import org.junit.Test
 import org.junit.runner.RunWith
@@ -207,52 +206,6 @@
     }
 
     @Test
-    fun sendButtonEvent_withoutCreateVirtualDevicePermission_throwsException() {
-        mRule.runWithoutPermissions {
-            assertThrows(SecurityException::class.java) {
-                mVirtualMouse.sendButtonEvent(
-                    VirtualMouseButtonEvent.Builder()
-                        .setAction(VirtualMouseButtonEvent.ACTION_BUTTON_PRESS)
-                        .setButtonCode(VirtualMouseButtonEvent.BUTTON_PRIMARY)
-                        .build()
-                )
-            }
-        }
-    }
-
-    @Test
-    fun sendRelativeEvent_withoutCreateVirtualDevicePermission_throwsException() {
-        val relativeChangeX = 25f
-        val relativeChangeY = 35f
-        mRule.runWithoutPermissions {
-            assertThrows(SecurityException::class.java) {
-                mVirtualMouse.sendRelativeEvent(
-                    VirtualMouseRelativeEvent.Builder()
-                        .setRelativeY(relativeChangeY)
-                        .setRelativeX(relativeChangeX)
-                        .build()
-                )
-            }
-        }
-    }
-
-    @Test
-    fun sendScrollEvent_withoutCreateVirtualDevicePermission_throwsException() {
-        val moveX = 0f
-        val moveY = 1f
-        mRule.runWithoutPermissions {
-            assertThrows(SecurityException::class.java) {
-                mVirtualMouse.sendScrollEvent(
-                    VirtualMouseScrollEvent.Builder()
-                        .setYAxisMovement(moveY)
-                        .setXAxisMovement(moveX)
-                        .build()
-                )
-            }
-        }
-    }
-
-    @Test
     fun testStartingCursorPosition() {
         // The virtual display is 100x100px, running from [0,99]. Half of this is 49.5, and
         // we assume the pointer for a new display begins at the center.
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualNavigationTouchpadTest.kt b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualNavigationTouchpadTest.kt
index 44aaa0b..d30bab1 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualNavigationTouchpadTest.kt
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualNavigationTouchpadTest.kt
@@ -28,7 +28,6 @@
 import android.view.MotionEvent
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.filters.FlakyTest
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -84,17 +83,6 @@
     }
 
     @Test
-    fun sendTouchEvent_withoutCreateVirtualDevicePermission_throwsException() {
-        val x = 30f
-        val y = 30f
-        mRule.runWithoutPermissions {
-            assertThrows(SecurityException::class.java) {
-                sendVirtualNavigationTouchEvent(x, y, VirtualTouchEvent.ACTION_DOWN)
-            }
-        }
-    }
-
-    @Test
     fun sendTap_motionEventNotConsumed_getsConvertedToDpadCenter() {
         setConsumeGenericMotionEvents(false)
 
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualStylusTest.kt b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualStylusTest.kt
index c0a8309..5bf8c72 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualStylusTest.kt
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualStylusTest.kt
@@ -28,7 +28,6 @@
 import androidx.test.filters.SmallTest
 import junitparams.JUnitParamsRunner
 import junitparams.Parameters
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -369,25 +368,6 @@
         assertNoMoreEvents()
     }
 
-    @Test
-    fun sendTouchEvent_withoutCreateVirtualDevicePermission_throwsException() {
-        val x = 50
-        val y = 50
-        mRule.runWithoutPermissions {
-            assertThrows(SecurityException::class.java) {
-                mVirtualStylus.sendMotionEvent(
-                    VirtualStylusMotionEvent.Builder()
-                        .setAction(VirtualStylusMotionEvent.ACTION_DOWN)
-                        .setX(x)
-                        .setY(y)
-                        .setPressure(255)
-                        .setToolType(VirtualStylusMotionEvent.TOOL_TYPE_STYLUS)
-                        .build()
-                )
-            }
-        }
-    }
-
     private fun verifyStylusTouchWithTilt(
         tiltXDegrees: Int,
         tiltYDegrees: Int,
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualTouchscreenTest.kt b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualTouchscreenTest.kt
index ba873c6..c94a71d 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualTouchscreenTest.kt
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/VirtualTouchscreenTest.kt
@@ -24,7 +24,6 @@
 import android.view.MotionEvent
 import androidx.test.ext.junit.runners.AndroidJUnit4
 import androidx.test.filters.SmallTest
-import org.junit.Assert.assertThrows
 import org.junit.Test
 import org.junit.runner.RunWith
 
@@ -148,28 +147,6 @@
         )
     }
 
-    @Test
-    fun sendTouchEvent_withoutCreateVirtualDevicePermission_throwsException() {
-        val inputSize = 1f
-        val x = 50f
-        val y = 50f
-        mRule.runWithoutPermissions {
-            assertThrows(SecurityException::class.java) {
-                mVirtualTouchscreen.sendTouchEvent(
-                    VirtualTouchEvent.Builder()
-                        .setAction(VirtualTouchEvent.ACTION_DOWN)
-                        .setPointerId(1)
-                        .setX(x)
-                        .setY(y)
-                        .setPressure(255f)
-                        .setMajorAxisSize(inputSize)
-                        .setToolType(VirtualTouchEvent.TOOL_TYPE_FINGER)
-                        .build()
-                )
-            }
-        }
-    }
-
     private fun sendHoverEvent(action: Int, x: Float, y: Float) {
         mVirtualTouchscreen.sendTouchEvent(
             VirtualTouchEvent.Builder()
diff --git a/tests/tests/keystore/OWNERS b/tests/tests/keystore/OWNERS
index 4d92596..14d6f4b 100644
--- a/tests/tests/keystore/OWNERS
+++ b/tests/tests/keystore/OWNERS
@@ -5,7 +5,9 @@
 # Bugs for failures that affect many/all devices should be assigned to android-hardware-security@
 #
 # Please CC android-hardware-security on all bugs.
-swillden@google.com
-jbires@google.com
-eranm@google.com
+cvlasov@google.com
 drysdale@google.com
+jbires@google.com
+kwadhera@google.com
+sethmo@google.com
+swillden@google.com
diff --git a/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java b/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
index 27903f1..54b8253 100644
--- a/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
@@ -78,6 +78,8 @@
 import android.security.keystore.DeviceIdAttestationException;
 import android.security.keystore.KeyGenParameterSpec;
 import android.security.keystore.KeyProperties;
+import android.security.keystore.KeyStoreManager;
+import android.security.keystore2.Flags;
 import android.util.ArraySet;
 import android.util.Log;
 
@@ -102,6 +104,7 @@
 import java.security.InvalidKeyException;
 import java.security.KeyPairGenerator;
 import java.security.KeyStore;
+import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchProviderException;
 import java.security.ProviderException;
@@ -1617,8 +1620,11 @@
                                 .or(is(100)).or(is(200)).or(is(300)).or(is(400)));
 
                 checkRootOfTrust(attestation, false /* requireLocked */);
-                assertThat("TEE enforced OS version and system OS version must be same.",
-                        teeEnforced.getOsVersion(), is(systemOsVersion));
+                checkModuleHash(attestation);
+                assertThat(
+                        "TEE enforced OS version and system OS version must be same.",
+                        teeEnforced.getOsVersion(),
+                        is(systemOsVersion));
                 checkSystemPatchLevel(teeEnforced.getOsPatchLevel(), systemPatchLevel);
                 break;
 
@@ -1631,8 +1637,11 @@
                                 .or(is(100)).or(is(200)).or(is(300)).or(is(400)));
 
                 checkRootOfTrust(attestation, false /* requireLocked */);
-                assertThat("StrongBox enforced OS version and system OS version must be same.",
-                        teeEnforced.getOsVersion(), is(systemOsVersion));
+                checkModuleHash(attestation);
+                assertThat(
+                        "StrongBox enforced OS version and system OS version must be same.",
+                        teeEnforced.getOsVersion(),
+                        is(systemOsVersion));
                 checkSystemPatchLevel(teeEnforced.getOsPatchLevel(), systemPatchLevel);
                 break;
 
@@ -1694,29 +1703,58 @@
         assertEquals(32, verifiedBootHash.length);
         checkEntropy(verifiedBootHash, "rootOfTrust.verifiedBootHash" /* dataName */);
 
-        StringBuilder hexVerifiedBootHash = new StringBuilder(verifiedBootHash.length * 2);
-        for (byte b : verifiedBootHash) {
-            hexVerifiedBootHash.append(String.format("%02x", b));
-        }
         String bootVbMetaDigest = SystemProperties.get("ro.boot.vbmeta.digest", "");
         assertEquals(
                 "VerifiedBootHash field of RootOfTrust section does not match with"
                         + "system property ro.boot.vbmeta.digest",
-                bootVbMetaDigest, hexVerifiedBootHash.toString());
+                bootVbMetaDigest,
+                HexEncoding.encode(verifiedBootHash));
+    }
+
+    private void checkVerifiedBootKey(byte[] verifiedBootKey, boolean isLocked) {
+        assertNotNull(verifiedBootKey);
+        if (isLocked) {
+            checkEntropy(verifiedBootKey, "rootOfTrust.verifiedBootKey" /* dataName */);
+        }
+
+        String unexpectedLengthMessagePrefix =
+                "rootOfTrust.verifiedBootKey has an unexpected length: " + verifiedBootKey.length;
+
+        if (TestUtils.getVendorApiLevel() >= 36) {
+            assertEquals(
+                    unexpectedLengthMessagePrefix + " (expected 32)", 32, verifiedBootKey.length);
+            if (isLocked) {
+                String systemProperty =
+                        SystemProperties.get("ro.boot.vbmeta.public_key_digest", "");
+                assertEquals(
+                        "rootOfTrust.verifiedBootKey does not match the"
+                                + "ro.boot.vbmeta.public_key_digest system property",
+                        systemProperty,
+                        HexEncoding.encode(verifiedBootKey));
+            } else {
+                byte[] emptyVerifiedBootKey = new byte[32];
+                assertArrayEquals(
+                        "Bootloader is unlocked, so rootOfTrust.verifiedBootKey should contain 32 "
+                                + " bytes of zeroes",
+                        emptyVerifiedBootKey,
+                        verifiedBootKey);
+            }
+        } else {
+            assertTrue(
+                    unexpectedLengthMessagePrefix + " (expected >= 32)",
+                    verifiedBootKey.length >= 32);
+        }
     }
 
     private void checkRootOfTrust(Attestation attestation, boolean requireLocked) {
         RootOfTrust rootOfTrust = attestation.getRootOfTrust();
         assertNotNull(rootOfTrust);
-        assertNotNull(rootOfTrust.getVerifiedBootKey());
-        assertTrue("Verified boot key is only " + rootOfTrust.getVerifiedBootKey().length +
-                " bytes long", rootOfTrust.getVerifiedBootKey().length >= 32);
+
         if (requireLocked) {
             final String unlockedDeviceMessage = "The device's bootloader must be locked. This may "
                     + "not be the default for pre-production devices.";
             assertTrue(unlockedDeviceMessage, rootOfTrust.isDeviceLocked());
-            checkEntropy(rootOfTrust.getVerifiedBootKey(),
-                    "rootOfTrust.verifiedBootKey" /* dataName */);
+            checkVerifiedBootKey(rootOfTrust.getVerifiedBootKey(), true /* isLocked */);
             assertEquals(KM_VERIFIED_BOOT_VERIFIED, rootOfTrust.getVerifiedBootState());
 
             if (PropertyUtil.getFirstApiLevel() >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
@@ -1742,6 +1780,52 @@
                     && !rootOfTrust.isDeviceLocked();
             assertTrue("Unexpected combination of device locked state and Verified Boot "
                     + "state.", isLocked || isUnlocked);
+            checkVerifiedBootKey(rootOfTrust.getVerifiedBootKey(), isLocked);
+        }
+    }
+
+    private void checkModuleHash(Attestation attestation) {
+        if (attestation.getKeymasterVersion() < Attestation.KM_VERSION_KEYMINT_4) {
+            // Module hash will only be populated if the underlying device is KeyMint v4 or later.
+            return;
+        }
+        if (!Flags.attestModules()) {
+            // Module hash will only be populated if the flag is on.
+            return;
+        }
+
+        // The KeyMint device should have populated a module hash value in the software-enforced
+        // list.
+        byte[] moduleHash = attestation.softwareEnforced.getModuleHash();
+        assertTrue(moduleHash != null);
+        assertTrue(moduleHash.length > 0);
+
+        // The value in the attestation should match the hash of what Keystore reports as the module
+        // hash input data.
+        byte[] inputData;
+        try {
+            KeyStoreManager manager = KeyStoreManager.getInstance();
+            inputData = manager.getSupplementaryAttestationInfo(KeyStoreManager.MODULE_HASH);
+        } catch (KeyStoreException e) {
+            fail("Could not retrieve expected module hash value: " + e);
+            return;
+        }
+        byte[] expectedHash;
+        try {
+            MessageDigest digest = MessageDigest.getInstance("SHA-256");
+            expectedHash = digest.digest(inputData);
+        } catch (NoSuchAlgorithmException e) {
+            fail("No SHA-256 available: " + e);
+            return;
+        }
+        assertEquals(HexEncoding.encode(expectedHash), HexEncoding.encode(moduleHash));
+
+        // The `inputData` should also parse as a DER encoding of the schema described in
+        // KeyCreationResult.aidl in the KeyMint HAL definition.
+        try {
+            Modules unusedModules = new Modules(inputData);
+        } catch (CertificateParsingException e) {
+            fail("failed to parse module data: " + e);
         }
     }
 
diff --git a/tests/tests/keystore/src/android/keystore/cts/KeyGeneratorTest.java b/tests/tests/keystore/src/android/keystore/cts/KeyGeneratorTest.java
index 1a9bf07..ff12c14 100644
--- a/tests/tests/keystore/src/android/keystore/cts/KeyGeneratorTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/KeyGeneratorTest.java
@@ -19,7 +19,7 @@
 import static android.keystore.cts.util.TestUtils.KmType;
 import static android.keystore.cts.util.TestUtils.assumeKmSupport;
 import static android.keystore.cts.util.TestUtils.isStrongboxKeyMint;
-import static android.keystore.cts.util.TestUtils.checkDeviceCompatibility;
+import static android.keystore.cts.util.TestUtils.assumeLockScreenSupport;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -748,7 +748,7 @@
     @TestCaseName(value = "{method}_{0}_{1}")
     public void testGenerateAuthBoundKey_Lskf(KmType kmType, String algorithm)
             throws Exception {
-        checkDeviceCompatibility();
+        assumeLockScreenSupport();
         assumeKmSupport(kmType);
         try (var dl = new DeviceLockSession(InstrumentationRegistry.getInstrumentation())) {
             KeyGenerator keyGenerator = getKeyGenerator(algorithm);
@@ -768,7 +768,7 @@
     @TestCaseName(value = "{method}_{0}_{1}")
     public void testGenerateAuthBoundKey_LskfOrStrongBiometric(KmType kmType, String algorithm)
             throws Exception {
-        checkDeviceCompatibility();
+        assumeLockScreenSupport();
         assumeKmSupport(kmType);
         try (var dl = new DeviceLockSession(InstrumentationRegistry.getInstrumentation())) {
             KeyGenerator keyGenerator = getKeyGenerator(algorithm);
diff --git a/tests/tests/keystore/src/android/keystore/cts/KeyPairGeneratorTest.java b/tests/tests/keystore/src/android/keystore/cts/KeyPairGeneratorTest.java
index 9dafc17..50ae864 100644
--- a/tests/tests/keystore/src/android/keystore/cts/KeyPairGeneratorTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/KeyPairGeneratorTest.java
@@ -19,7 +19,7 @@
 import static android.keystore.cts.util.TestUtils.KmType;
 import static android.keystore.cts.util.TestUtils.assumeKmSupport;
 import static android.keystore.cts.util.TestUtils.isStrongboxKeyMint;
-import static android.keystore.cts.util.TestUtils.checkDeviceCompatibility;
+import static android.keystore.cts.util.TestUtils.assumeLockScreenSupport;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -459,7 +459,7 @@
     @Parameters(method = "kmTypes_x_algorithms")
     @TestCaseName(value = "{method}_{0}_{1}")
     public void testGenerateAuthBoundKey_Lskf(KmType kmType, String algorithm) throws Exception {
-        checkDeviceCompatibility();
+        assumeLockScreenSupport();
         assumeKmSupport(kmType);
         try (var dl = new DeviceLockSession(InstrumentationRegistry.getInstrumentation())) {
             KeyPairGenerator generator = getGenerator(algorithm);
@@ -479,7 +479,7 @@
     @TestCaseName(value = "{method}_{0}_{1}")
     public void testGenerateAuthBoundKey_LskfOrStrongBiometric(KmType kmType, String algorithm)
             throws Exception {
-        checkDeviceCompatibility();
+        assumeLockScreenSupport();
         assumeKmSupport(kmType);
         try (var dl = new DeviceLockSession(InstrumentationRegistry.getInstrumentation())) {
             KeyPairGenerator generator = getGenerator(algorithm);
diff --git a/tests/tests/keystore/src/android/keystore/cts/util/TestUtils.java b/tests/tests/keystore/src/android/keystore/cts/util/TestUtils.java
index f27ad42..dfca598 100644
--- a/tests/tests/keystore/src/android/keystore/cts/util/TestUtils.java
+++ b/tests/tests/keystore/src/android/keystore/cts/util/TestUtils.java
@@ -129,11 +129,11 @@
         }
     }
 
-    static public void checkDeviceCompatibility() {
-      PackageManager packageManager =
+    static public void assumeLockScreenSupport() {
+        PackageManager packageManager =
                 InstrumentationRegistry.getInstrumentation().getTargetContext().getPackageManager();
-        assumeFalse("Skipping test as DUT does not support this operation",
-                packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK));
+        assumeTrue("Only test when DUT supports lock screen",
+                packageManager.hasSystemFeature(PackageManager.FEATURE_SECURE_LOCK_SCREEN));
     }
 
     static public boolean isStrongboxKeyMint(KmType kmType) {
diff --git a/tests/tests/media/README.md b/tests/tests/media/README.md
index 1f2829d..54f0bac 100644
--- a/tests/tests/media/README.md
+++ b/tests/tests/media/README.md
@@ -1,10 +1,9 @@
 ## Media CTS Tests
-The tests are organized into following testcases
+The tests are organized into following test cases
 
 | TestCase                         | Description                                                               |
 |----------------------------------|---------------------------------------------------------------------------|
 | CtsMediaAudioTestCases           | Audio related tests                                                       |
-| CtsMediaBetterTogetherTestCases  | BetterTogether related test cases (MediaSession/MediaRouter/MediaBrowser) |
 | CtsMediaCodecTestCases           | MediaCodec related tests, for combinations decode/encode                  |
 | CtsMediaDecoderTestCases         | MediaCodec related tests, for decoding                                    |
 | CtsMediaEncoderTestCases         | MediaCodec related tests, for encoding                                    |
@@ -16,9 +15,10 @@
 | CtsMediaProjectionSDK33TestCases | MediaProjection related tests, detecting consent re-use on SDK 33         |
 | CtsMediaProjectionSDK34TestCases | MediaProjection related tests, detecting consent re-use on SDK 34         |
 | CtsMediaRecorderTestCases        | MediaRecorder related tests                                               |
+| CtsMediaRouterTestCases          | MediaRouter related tests                                                 |
+| CtsMediaSessionTestCases         | MediaSession / MediaBrowser related tests                                 |
 | CtsMediaMiscTestCases            | All other media tests                                                     |
 
-
 ## Test files used in the tests
 The test files used by the test suite are available on Google cloud
 and these are downloaded automatically while running tests.
diff --git a/tests/tests/media/audio/src/android/media/audio/cts/LoopbackPassthroughTest.java b/tests/tests/media/audio/src/android/media/audio/cts/LoopbackPassthroughTest.java
index 2650b93..ae427b4 100644
--- a/tests/tests/media/audio/src/android/media/audio/cts/LoopbackPassthroughTest.java
+++ b/tests/tests/media/audio/src/android/media/audio/cts/LoopbackPassthroughTest.java
@@ -35,15 +35,21 @@
 import android.media.audiopolicy.AudioMixingRule;
 import android.media.audiopolicy.AudioPolicy;
 import android.os.Looper;
+import android.platform.test.flag.junit.CheckFlagsRule;
+import android.platform.test.flag.junit.DeviceFlagsValueProvider;
 import android.util.Log;
 
 import androidx.test.platform.app.InstrumentationRegistry;
 import androidx.test.runner.AndroidJUnit4;
 
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.RequireNotAutomotive;
 import com.android.compatibility.common.util.CddTest;
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -65,6 +71,13 @@
     private int mBytesToRead;
     private float mBitrateInBytesPerSecond;
 
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    @Rule
+    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
+
     @Before
     public void setUp() {
         mContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
@@ -91,6 +104,7 @@
 
     @CddTest(requirement="5.4.3/C-1-1")
     @Test
+    @RequireNotAutomotive(reason = "Auto uses its own policy for routing")
     public void testPcmLoopback() {
         if (!supportsLoopback()) {
             return;
@@ -115,6 +129,7 @@
 
     @CddTest(requirement="5.4.3/C-1-1")
     @Test
+    @RequireNotAutomotive(reason = "Auto uses its own policy for routing")
     public void testEac3JocLoopback() {
         if (!supportsLoopback()) {
             return;
diff --git a/tests/tests/media/audio/src/android/media/audio/cts/NonDefaultDeviceForStrategyTest.java b/tests/tests/media/audio/src/android/media/audio/cts/NonDefaultDeviceForStrategyTest.java
index 3b959cb..b1be032 100644
--- a/tests/tests/media/audio/src/android/media/audio/cts/NonDefaultDeviceForStrategyTest.java
+++ b/tests/tests/media/audio/src/android/media/audio/cts/NonDefaultDeviceForStrategyTest.java
@@ -30,14 +30,20 @@
 import android.media.AudioManager;
 import android.media.audiopolicy.AudioProductStrategy;
 import android.platform.test.annotations.AppModeSdkSandbox;
+import android.platform.test.flag.junit.CheckFlagsRule;
+import android.platform.test.flag.junit.DeviceFlagsValueProvider;
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.runner.AndroidJUnit4;
 
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.RequireNotAutomotive;
 import com.android.compatibility.common.util.NonMainlineTest;
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -71,6 +77,13 @@
     private AudioProductStrategy mStrategyForMedia;
     private AudioProductStrategy mStrategyForPhone;
 
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    @Rule
+    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
+
     /** Test setup */
     @Before
     public void setUp() throws Exception {
@@ -192,6 +205,7 @@
     }
 
     @Test
+    @RequireNotAutomotive(reason = "Auto uses its own policy for routing")
     public void testSetNonDefaultDeviceRouting() throws Exception {
         List<AudioDeviceInfo> availableDevices = mAudioManager.getAvailableCommunicationDevices();
         availableDevices.removeIf(
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/ResourceReleaser.java b/tests/tests/media/common/src/android/media/cts/ResourceReleaser.java
similarity index 97%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/ResourceReleaser.java
rename to tests/tests/media/common/src/android/media/cts/ResourceReleaser.java
index 1a251cc..c8b4788 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/ResourceReleaser.java
+++ b/tests/tests/media/common/src/android/media/cts/ResourceReleaser.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.cts;
 
 import static com.google.common.truth.Truth.assertWithMessage;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/SimpleMediaBrowserService.java b/tests/tests/media/common/src/android/media/cts/SimpleMediaBrowserService.java
similarity index 97%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/SimpleMediaBrowserService.java
rename to tests/tests/media/common/src/android/media/cts/SimpleMediaBrowserService.java
index a94b86a..6bf1f86 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/SimpleMediaBrowserService.java
+++ b/tests/tests/media/common/src/android/media/cts/SimpleMediaBrowserService.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.cts;
 
 import android.media.browse.MediaBrowser.MediaItem;
 import android.os.Bundle;
diff --git a/tests/tests/media/extractor/src/android/media/extractor/cts/MediaExtractorTest.java b/tests/tests/media/extractor/src/android/media/extractor/cts/MediaExtractorTest.java
index 9a5cc4b..a9a79c1 100644
--- a/tests/tests/media/extractor/src/android/media/extractor/cts/MediaExtractorTest.java
+++ b/tests/tests/media/extractor/src/android/media/extractor/cts/MediaExtractorTest.java
@@ -153,6 +153,12 @@
 
         MediaFormat trackFormat = mExtractor.getTrackFormat(0);
 
+        int profile = trackFormat.getInteger(MediaFormat.KEY_PROFILE);
+        assertEquals(MediaCodecInfo.CodecProfileLevel.APVProfile422_10, profile);
+
+        int level = trackFormat.getInteger(MediaFormat.KEY_LEVEL);
+        assertEquals(MediaCodecInfo.CodecProfileLevel.APVLevel2Band0, level);
+
         final String mimeType = trackFormat.getString(MediaFormat.KEY_MIME);
         assertEquals("video/apv", mimeType);
     }
diff --git a/tests/tests/media/player/src/android/media/player/cts/MediaPlayerFlakyNetworkTest.java b/tests/tests/media/player/src/android/media/player/cts/MediaPlayerFlakyNetworkTest.java
index 930d4cb..ce3fdd5 100644
--- a/tests/tests/media/player/src/android/media/player/cts/MediaPlayerFlakyNetworkTest.java
+++ b/tests/tests/media/player/src/android/media/player/cts/MediaPlayerFlakyNetworkTest.java
@@ -22,6 +22,7 @@
 import android.media.MediaPlayer;
 import android.media.cts.MediaPlayerTestBase;
 import android.media.cts.TestUtils.Monitor;
+import android.os.SystemProperties;
 import android.platform.test.annotations.AppModeFull;
 import android.webkit.cts.CtsTestServer;
 
@@ -67,6 +68,10 @@
         "video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz.3gp"
     };
 
+    // limiting the ro.hw_timeout_multiplier to 6 to accommodate slower devices
+    private static final int HW_TIMEOUT_MULTIPLIER =
+            Math.min(6, SystemProperties.getInt("ro.hw_timeout_multiplier", 1));
+
     // Allow operations to block for 3500ms before assuming they will ANR.
     // We don't allow the full 5s because cpu load, etc, reduces the budget.
     private static final int ANR_TIMEOUT_MILLIS = 3500;
@@ -222,8 +227,10 @@
         };
         releaseThread.start();
         releaseThreadRunning.waitForSignal();
-        releaseThread.join(ANR_TIMEOUT_MILLIS);
-        assertFalse("release took longer than " + ANR_TIMEOUT_MILLIS, releaseThread.isAlive());
+        releaseThread.join(ANR_TIMEOUT_MILLIS * HW_TIMEOUT_MULTIPLIER);
+        assertFalse(
+                "release took longer than " + ANR_TIMEOUT_MILLIS + " " + HW_TIMEOUT_MULTIPLIER,
+                releaseThread.isAlive());
     }
 
     private void createMediaPlayer() throws Throwable {
diff --git a/tests/tests/media/bettertogether/Android.bp b/tests/tests/media/router/Android.bp
similarity index 79%
copy from tests/tests/media/bettertogether/Android.bp
copy to tests/tests/media/router/Android.bp
index 247ac3b..ea86252 100644
--- a/tests/tests/media/bettertogether/Android.bp
+++ b/tests/tests/media/router/Android.bp
@@ -15,11 +15,11 @@
 package {
     // See: http://go/android-license-faq
     default_applicable_licenses: ["Android-Apache-2.0"],
-    default_team: "trendy_team_android_media_solutions_playback",
+    default_team: "trendy_team_android_media_better_together",
 }
 
 java_defaults {
-    name: "MediaBetterTogetherTestCases_defaults",
+    name: "MediaRouterTestCases_defaults",
     defaults: ["cts_defaults"],
     static_libs: [
         "androidx.test.ext.truth",
@@ -27,7 +27,7 @@
         "cts-media-common",
         "flag-junit",
         "truth",
-        "Harrier",
+        "bedstead-enterprise",
     ],
     resource_dirs: ["res"],
     aaptflags: [
@@ -35,9 +35,8 @@
     ],
     srcs: [
         "src/**/*.java",
-        "aidl/**/*.aidl",
     ],
-    // This test uses private APIs
+    // TODO(b/387499846): This test uses private APIs. Replace with sdk_version.
     platform_apis: true,
     host_required: ["cts-dynamic-config"],
     min_sdk_version: "29",
@@ -45,8 +44,8 @@
 }
 
 android_test {
-    name: "CtsMediaBetterTogetherTestCases",
-    defaults: ["MediaBetterTogetherTestCases_defaults"],
+    name: "CtsMediaRouterTestCases",
+    defaults: ["MediaRouterTestCases_defaults"],
     test_config: "AndroidTest.xml",
     // Tag this module as a cts test artifact
     test_suites: [
@@ -56,8 +55,8 @@
 }
 
 android_test {
-    name: "MctsMediaBetterTogetherTestCases",
-    defaults: ["MediaBetterTogetherTestCases_defaults"],
+    name: "MctsMediaRouterTestCases",
+    defaults: ["MediaRouterTestCases_defaults"],
     test_config: "AndroidTest-mcts.xml",
     // Tag this module as a cts test artifact
     test_suites: [
diff --git a/tests/tests/media/bettertogether/AndroidManifest.xml b/tests/tests/media/router/AndroidManifest.xml
similarity index 63%
copy from tests/tests/media/bettertogether/AndroidManifest.xml
copy to tests/tests/media/router/AndroidManifest.xml
index c32a9db..81d8324 100644
--- a/tests/tests/media/bettertogether/AndroidManifest.xml
+++ b/tests/tests/media/router/AndroidManifest.xml
@@ -15,7 +15,7 @@
 -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-     package="android.media.bettertogether.cts"
+     package="android.media.router.cts"
      android:targetSandboxVersion="2">
 
     <uses-sdk android:minSdkVersion="29"
@@ -42,6 +42,7 @@
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
+    <uses-permission android:name="android.permission.MODIFY_AUDIO_ROUTING"/>
 
     <uses-permission android:name="android.permission.VIBRATE"/>
 
@@ -49,53 +50,33 @@
          android:requestLegacyExternalStorage="true"
          android:largeHeap="true">
 
-        <activity android:name="android.media.bettertogether.cts.MediaSessionTestActivity"
-             android:label="MediaSessionTestActivity"
-             android:screenOrientation="nosensor"
-             android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
-             android:exported="true">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
-                <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"/>
-            </intent-filter>
-        </activity>
-        <activity android:name="android.media.bettertogether.cts.MediaRouter2TestActivity"/>
-        <service android:name="android.media.bettertogether.cts.StubMediaBrowserService"
-             android:exported="true">
-            <intent-filter>
-                <action android:name="android.media.browse.MediaBrowserService"/>
-            </intent-filter>
-        </service>
-        <service android:name="android.media.bettertogether.cts.SimpleMediaBrowserService"
+        <activity android:name="android.media.router.cts.MediaRouter2TestActivity"/>
+        <service android:name="android.media.cts.SimpleMediaBrowserService"
             android:exported="false">
             <intent-filter>
                 <action android:name="android.media.browse.MediaBrowserService"/>
             </intent-filter>
         </service>
-        <service android:name="android.media.bettertogether.cts.StubMediaSession2Service"
-             android:permission="android.media.bettertogether.cts"
-             android:exported="true">
-            <intent-filter>
-                <action android:name="android.media.MediaSession2Service"/>
-            </intent-filter>
-        </service>
         <service android:name=".StubMediaRoute2ProviderService"
              android:exported="true">
             <intent-filter>
                 <action android:name="android.media.MediaRoute2ProviderService"/>
             </intent-filter>
         </service>
-        <service android:name="android.media.bettertogether.cts.MediaButtonReceiverService"
-             android:exported="true"/>
-        <service android:name=".MediaBrowserServiceTestService"
-             android:process=":mediaBrowserServiceTestService"/>
-        <service android:name=".MediaSessionTestService"
-             android:process=":mediaSessionTestService"/>
-        <receiver android:name="android.media.bettertogether.cts.MediaButtonBroadcastReceiver"/>
+        <service android:name=".SystemMediaRoutingProviderService"
+                android:exported="false"
+                android:enabled="false">
+            <!-- We only enable this service once we've adopted shell permission identity for
+            MODIFY_AUDIO_ROUTING during runtime, which is necessary for system media routing. -->
+            <intent-filter>
+                <action android:name="android.media.MediaRoute2ProviderService"/>
+                <category android:name="android.media.MediaRoute2ProviderService.SYSTEM_MEDIA"/>
+            </intent-filter>
+        </service>
     </application>
 
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-         android:targetPackage="android.media.bettertogether.cts"
+         android:targetPackage="android.media.router.cts"
          android:label="CTS tests of android.media">
     </instrumentation>
 
diff --git a/tests/tests/media/bettertogether/AndroidTest-mcts.xml b/tests/tests/media/router/AndroidTest-mcts.xml
similarity index 95%
rename from tests/tests/media/bettertogether/AndroidTest-mcts.xml
rename to tests/tests/media/router/AndroidTest-mcts.xml
index 8c7c440..dbf934b 100644
--- a/tests/tests/media/bettertogether/AndroidTest-mcts.xml
+++ b/tests/tests/media/router/AndroidTest-mcts.xml
@@ -35,10 +35,10 @@
     </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="MctsMediaBetterTogetherTestCases.apk" />
+        <option name="test-file-name" value="MctsMediaRouterTestCases.apk" />
     </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.media.bettertogether.cts" />
+        <option name="package" value="android.media.router.cts" />
         <!-- setup can be expensive so limit the number of shards -->
         <option name="ajur-max-shard" value="5" />
         <!-- test-timeout unit is ms, value = 30 min -->
diff --git a/tests/tests/media/bettertogether/AndroidTest.xml b/tests/tests/media/router/AndroidTest.xml
similarity index 95%
rename from tests/tests/media/bettertogether/AndroidTest.xml
rename to tests/tests/media/router/AndroidTest.xml
index a6cd991..c87d9f1 100644
--- a/tests/tests/media/bettertogether/AndroidTest.xml
+++ b/tests/tests/media/router/AndroidTest.xml
@@ -34,10 +34,10 @@
     </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="CtsMediaBetterTogetherTestCases.apk" />
+        <option name="test-file-name" value="CtsMediaRouterTestCases.apk" />
     </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.media.bettertogether.cts" />
+        <option name="package" value="android.media.router.cts" />
         <!-- setup can be expensive so limit the number of shards -->
         <option name="ajur-max-shard" value="5" />
         <!-- test-timeout unit is ms, value = 30 min -->
diff --git a/tests/tests/media/router/OWNERS b/tests/tests/media/router/OWNERS
new file mode 100644
index 0000000..e8adcc4
--- /dev/null
+++ b/tests/tests/media/router/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 137631
+include platform/frameworks/av:/media/janitors/better_together_OWNERS
\ No newline at end of file
diff --git a/tests/tests/media/bettertogether/res/drawable/single_face.jpg b/tests/tests/media/router/res/drawable/single_face.jpg
similarity index 100%
rename from tests/tests/media/bettertogether/res/drawable/single_face.jpg
rename to tests/tests/media/router/res/drawable/single_face.jpg
Binary files differ
diff --git a/tests/tests/media/bettertogether/res/values/strings.xml b/tests/tests/media/router/res/values/strings.xml
similarity index 100%
rename from tests/tests/media/bettertogether/res/values/strings.xml
rename to tests/tests/media/router/res/values/strings.xml
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRoute2InfoTest.java b/tests/tests/media/router/src/android/media/router/cts/MediaRoute2InfoTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRoute2InfoTest.java
rename to tests/tests/media/router/src/android/media/router/cts/MediaRoute2InfoTest.java
index f46f4cb..4c2d4ab 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRoute2InfoTest.java
+++ b/tests/tests/media/router/src/android/media/router/cts/MediaRoute2InfoTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.router.cts;
 
 import static androidx.test.ext.truth.os.BundleSubject.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRoute2ProviderServiceTest.java b/tests/tests/media/router/src/android/media/router/cts/MediaRoute2ProviderServiceTest.java
similarity index 97%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRoute2ProviderServiceTest.java
rename to tests/tests/media/router/src/android/media/router/cts/MediaRoute2ProviderServiceTest.java
index cdd0289..2ffeea2 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRoute2ProviderServiceTest.java
+++ b/tests/tests/media/router/src/android/media/router/cts/MediaRoute2ProviderServiceTest.java
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.router.cts;
 
-import static android.media.bettertogether.cts.MediaRouter2Test.releaseControllers;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.FEATURE_SAMPLE;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.FEATURE_SPECIAL;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID1;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID2;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID4_TO_SELECT_AND_DESELECT;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID5_TO_TRANSFER_TO;
+import static android.media.router.cts.MediaRouter2Test.releaseControllers;
+import static android.media.router.cts.StubMediaRoute2ProviderService.FEATURE_SAMPLE;
+import static android.media.router.cts.StubMediaRoute2ProviderService.FEATURE_SPECIAL;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID1;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID2;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID4_TO_SELECT_AND_DESELECT;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID5_TO_TRANSFER_TO;
 
 import static androidx.test.ext.truth.os.BundleSubject.assertThat;
 
@@ -40,7 +40,7 @@
 import android.media.MediaRouter2.TransferCallback;
 import android.media.RouteDiscoveryPreference;
 import android.media.RoutingSessionInfo;
-import android.media.bettertogether.cts.StubMediaRoute2ProviderService.Proxy;
+import android.media.router.cts.StubMediaRoute2ProviderService.Proxy;
 import android.os.Bundle;
 import android.platform.test.annotations.AppModeFull;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRouter2Test.java b/tests/tests/media/router/src/android/media/router/cts/MediaRouter2Test.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRouter2Test.java
rename to tests/tests/media/router/src/android/media/router/cts/MediaRouter2Test.java
index 72c0a00..c0f8d01 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRouter2Test.java
+++ b/tests/tests/media/router/src/android/media/router/cts/MediaRouter2Test.java
@@ -14,25 +14,25 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.router.cts;
 
 import static android.content.Context.AUDIO_SERVICE;
 import static android.content.Intent.ACTION_CLOSE_SYSTEM_DIALOGS;
 import static android.content.Intent.FLAG_RECEIVER_FOREGROUND;
 import static android.media.MediaRoute2Info.FEATURE_LIVE_AUDIO;
 import static android.media.MediaRoute2Info.PLAYBACK_VOLUME_VARIABLE;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.FEATURES_SPECIAL;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.FEATURE_SAMPLE;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.FEATURE_SPECIAL;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.FEATURE_SPECIAL_ROUTE_IDS;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID1;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID2;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID3_SESSION_CREATION_FAILED;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID4_TO_SELECT_AND_DESELECT;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID5_TO_TRANSFER_TO;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID7_STATIC_GROUP;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID8_SYSTEM_TYPE;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.STATIC_GROUP_SELECTED_ROUTES_IDS;
+import static android.media.router.cts.StubMediaRoute2ProviderService.FEATURES_SPECIAL;
+import static android.media.router.cts.StubMediaRoute2ProviderService.FEATURE_SAMPLE;
+import static android.media.router.cts.StubMediaRoute2ProviderService.FEATURE_SPECIAL;
+import static android.media.router.cts.StubMediaRoute2ProviderService.FEATURE_SPECIAL_ROUTE_IDS;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID1;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID2;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID3_SESSION_CREATION_FAILED;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID4_TO_SELECT_AND_DESELECT;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID5_TO_TRANSFER_TO;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID7_STATIC_GROUP;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID8_SYSTEM_TYPE;
+import static android.media.router.cts.StubMediaRoute2ProviderService.STATIC_GROUP_SELECTED_ROUTES_IDS;
 
 import static androidx.test.ext.truth.os.BundleSubject.assertThat;
 
@@ -64,6 +64,8 @@
 import android.media.RouteListingPreference;
 import android.media.RoutingSessionInfo;
 import android.media.VolumeProvider;
+import android.media.cts.ResourceReleaser;
+import android.media.cts.SimpleMediaBrowserService;
 import android.media.session.MediaSession;
 import android.media.session.MediaSessionManager;
 import android.media.session.PlaybackState;
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRouter2TestActivity.java b/tests/tests/media/router/src/android/media/router/cts/MediaRouter2TestActivity.java
similarity index 97%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRouter2TestActivity.java
rename to tests/tests/media/router/src/android/media/router/cts/MediaRouter2TestActivity.java
index 91f37bf..88eddab 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRouter2TestActivity.java
+++ b/tests/tests/media/router/src/android/media/router/cts/MediaRouter2TestActivity.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.router.cts;
 
 import android.app.Activity;
 import android.content.Context;
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRouterTest.java b/tests/tests/media/router/src/android/media/router/cts/MediaRouterTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRouterTest.java
rename to tests/tests/media/router/src/android/media/router/cts/MediaRouterTest.java
index 5b311c7..8292adf 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaRouterTest.java
+++ b/tests/tests/media/router/src/android/media/router/cts/MediaRouterTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.router.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RouteDiscoveryPreferenceTest.java b/tests/tests/media/router/src/android/media/router/cts/RouteDiscoveryPreferenceTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RouteDiscoveryPreferenceTest.java
rename to tests/tests/media/router/src/android/media/router/cts/RouteDiscoveryPreferenceTest.java
index 6f3c02d5c..5149419 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RouteDiscoveryPreferenceTest.java
+++ b/tests/tests/media/router/src/android/media/router/cts/RouteDiscoveryPreferenceTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.router.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RoutingSessionInfoTest.java b/tests/tests/media/router/src/android/media/router/cts/RoutingSessionInfoTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RoutingSessionInfoTest.java
rename to tests/tests/media/router/src/android/media/router/cts/RoutingSessionInfoTest.java
index 7d84dc9..0925ffa 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RoutingSessionInfoTest.java
+++ b/tests/tests/media/router/src/android/media/router/cts/RoutingSessionInfoTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.router.cts;
 
 import static android.media.MediaRoute2Info.PLAYBACK_VOLUME_FIXED;
 import static android.media.MediaRoute2Info.PLAYBACK_VOLUME_VARIABLE;
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/StubMediaRoute2ProviderService.java b/tests/tests/media/router/src/android/media/router/cts/StubMediaRoute2ProviderService.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/StubMediaRoute2ProviderService.java
rename to tests/tests/media/router/src/android/media/router/cts/StubMediaRoute2ProviderService.java
index 11b1997..ae2a1fd 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/StubMediaRoute2ProviderService.java
+++ b/tests/tests/media/router/src/android/media/router/cts/StubMediaRoute2ProviderService.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.router.cts;
 
 import static android.media.MediaRoute2Info.FEATURE_LIVE_AUDIO;
 import static android.media.MediaRoute2Info.PLAYBACK_VOLUME_FIXED;
@@ -79,8 +79,8 @@
     public static final String ROUTE_ID_VARIABLE_VOLUME = "route_variable_volume";
     public static final String ROUTE_NAME_VARIABLE_VOLUME = "Variable Volume Route";
 
-    public static final String FEATURE_SAMPLE = "android.media.bettertogether.cts.FEATURE_SAMPLE";
-    public static final String FEATURE_SPECIAL = "android.media.bettertogether.cts.FEATURE_SPECIAL";
+    public static final String FEATURE_SAMPLE = "android.media.router.cts.FEATURE_SAMPLE";
+    public static final String FEATURE_SPECIAL = "android.media.router.cts.FEATURE_SPECIAL";
 
     public static final List<String> FEATURES_ALL = new ArrayList();
     public static final List<String> FEATURES_SPECIAL = new ArrayList();
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/SystemMediaRouter2Test.java b/tests/tests/media/router/src/android/media/router/cts/SystemMediaRouter2Test.java
similarity index 97%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/SystemMediaRouter2Test.java
rename to tests/tests/media/router/src/android/media/router/cts/SystemMediaRouter2Test.java
index bfb7eef..8cd1e71 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/SystemMediaRouter2Test.java
+++ b/tests/tests/media/router/src/android/media/router/cts/SystemMediaRouter2Test.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.router.cts;
 
 import static android.content.Context.AUDIO_SERVICE;
 import static android.content.Intent.ACTION_CLOSE_SYSTEM_DIALOGS;
@@ -22,18 +22,18 @@
 import static android.media.MediaRoute2Info.FEATURE_LIVE_AUDIO;
 import static android.media.MediaRoute2Info.PLAYBACK_VOLUME_VARIABLE;
 import static android.media.MediaRoute2ProviderService.REASON_REJECTED;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.FEATURE_SAMPLE;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.FEATURE_SPECIAL;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID1;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID2;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID3_SESSION_CREATION_FAILED;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID4_TO_SELECT_AND_DESELECT;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID5_TO_TRANSFER_TO;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID6_REJECT_SET_VOLUME;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID7_STATIC_GROUP;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_ID_VARIABLE_VOLUME;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.ROUTE_NAME2;
-import static android.media.bettertogether.cts.StubMediaRoute2ProviderService.STATIC_GROUP_SELECTED_ROUTES_IDS;
+import static android.media.router.cts.StubMediaRoute2ProviderService.FEATURE_SAMPLE;
+import static android.media.router.cts.StubMediaRoute2ProviderService.FEATURE_SPECIAL;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID1;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID2;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID3_SESSION_CREATION_FAILED;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID4_TO_SELECT_AND_DESELECT;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID5_TO_TRANSFER_TO;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID6_REJECT_SET_VOLUME;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID7_STATIC_GROUP;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_ID_VARIABLE_VOLUME;
+import static android.media.router.cts.StubMediaRoute2ProviderService.ROUTE_NAME2;
+import static android.media.router.cts.StubMediaRoute2ProviderService.STATIC_GROUP_SELECTED_ROUTES_IDS;
 
 import static com.android.media.flags.Flags.FLAG_ENABLE_BUILT_IN_SPEAKER_ROUTE_SUITABILITY_STATUSES;
 
@@ -58,6 +58,7 @@
 import android.media.RouteDiscoveryPreference;
 import android.media.RouteListingPreference;
 import android.media.RoutingSessionInfo;
+import android.media.cts.ResourceReleaser;
 import android.os.UserHandle;
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.RequiresFlagsEnabled;
diff --git a/tests/tests/media/bettertogether/Android.bp b/tests/tests/media/session/Android.bp
similarity index 82%
rename from tests/tests/media/bettertogether/Android.bp
rename to tests/tests/media/session/Android.bp
index 247ac3b..4d040e3 100644
--- a/tests/tests/media/bettertogether/Android.bp
+++ b/tests/tests/media/session/Android.bp
@@ -15,11 +15,12 @@
 package {
     // See: http://go/android-license-faq
     default_applicable_licenses: ["Android-Apache-2.0"],
+    // TODO(b/349106078): replace with correct team
     default_team: "trendy_team_android_media_solutions_playback",
 }
 
 java_defaults {
-    name: "MediaBetterTogetherTestCases_defaults",
+    name: "MediaSessionTestCases_defaults",
     defaults: ["cts_defaults"],
     static_libs: [
         "androidx.test.ext.truth",
@@ -29,7 +30,6 @@
         "truth",
         "Harrier",
     ],
-    resource_dirs: ["res"],
     aaptflags: [
         "--auto-add-overlay",
     ],
@@ -37,7 +37,7 @@
         "src/**/*.java",
         "aidl/**/*.aidl",
     ],
-    // This test uses private APIs
+    // TODO(b/387500109): This test uses private APIs. Replace with sdk_version.
     platform_apis: true,
     host_required: ["cts-dynamic-config"],
     min_sdk_version: "29",
@@ -45,8 +45,8 @@
 }
 
 android_test {
-    name: "CtsMediaBetterTogetherTestCases",
-    defaults: ["MediaBetterTogetherTestCases_defaults"],
+    name: "CtsMediaSessionTestCases",
+    defaults: ["MediaSessionTestCases_defaults"],
     test_config: "AndroidTest.xml",
     // Tag this module as a cts test artifact
     test_suites: [
@@ -56,8 +56,8 @@
 }
 
 android_test {
-    name: "MctsMediaBetterTogetherTestCases",
-    defaults: ["MediaBetterTogetherTestCases_defaults"],
+    name: "MctsMediaSessionTestCases",
+    defaults: ["MediaSessionTestCases_defaults"],
     test_config: "AndroidTest-mcts.xml",
     // Tag this module as a cts test artifact
     test_suites: [
diff --git a/tests/tests/media/bettertogether/AndroidManifest.xml b/tests/tests/media/session/AndroidManifest.xml
similarity index 78%
rename from tests/tests/media/bettertogether/AndroidManifest.xml
rename to tests/tests/media/session/AndroidManifest.xml
index c32a9db..d24a52a 100644
--- a/tests/tests/media/bettertogether/AndroidManifest.xml
+++ b/tests/tests/media/session/AndroidManifest.xml
@@ -15,7 +15,7 @@
 -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-     package="android.media.bettertogether.cts"
+     package="android.media.session.cts"
      android:targetSandboxVersion="2">
 
     <uses-sdk android:minSdkVersion="29"
@@ -49,7 +49,7 @@
          android:requestLegacyExternalStorage="true"
          android:largeHeap="true">
 
-        <activity android:name="android.media.bettertogether.cts.MediaSessionTestActivity"
+        <activity android:name="android.media.session.cts.MediaSessionTestActivity"
              android:label="MediaSessionTestActivity"
              android:screenOrientation="nosensor"
              android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
@@ -59,43 +59,36 @@
                 <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"/>
             </intent-filter>
         </activity>
-        <activity android:name="android.media.bettertogether.cts.MediaRouter2TestActivity"/>
-        <service android:name="android.media.bettertogether.cts.StubMediaBrowserService"
+        <service android:name="android.media.session.cts.StubMediaBrowserService"
              android:exported="true">
             <intent-filter>
                 <action android:name="android.media.browse.MediaBrowserService"/>
             </intent-filter>
         </service>
-        <service android:name="android.media.bettertogether.cts.SimpleMediaBrowserService"
+        <service android:name="android.media.cts.SimpleMediaBrowserService"
             android:exported="false">
             <intent-filter>
                 <action android:name="android.media.browse.MediaBrowserService"/>
             </intent-filter>
         </service>
-        <service android:name="android.media.bettertogether.cts.StubMediaSession2Service"
-             android:permission="android.media.bettertogether.cts"
+        <service android:name="android.media.session.cts.StubMediaSession2Service"
+             android:permission="android.media.session.cts"
              android:exported="true">
             <intent-filter>
                 <action android:name="android.media.MediaSession2Service"/>
             </intent-filter>
         </service>
-        <service android:name=".StubMediaRoute2ProviderService"
-             android:exported="true">
-            <intent-filter>
-                <action android:name="android.media.MediaRoute2ProviderService"/>
-            </intent-filter>
-        </service>
-        <service android:name="android.media.bettertogether.cts.MediaButtonReceiverService"
+        <service android:name="android.media.session.cts.MediaButtonReceiverService"
              android:exported="true"/>
         <service android:name=".MediaBrowserServiceTestService"
              android:process=":mediaBrowserServiceTestService"/>
         <service android:name=".MediaSessionTestService"
              android:process=":mediaSessionTestService"/>
-        <receiver android:name="android.media.bettertogether.cts.MediaButtonBroadcastReceiver"/>
+        <receiver android:name="android.media.session.cts.MediaButtonBroadcastReceiver"/>
     </application>
 
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-         android:targetPackage="android.media.bettertogether.cts"
+         android:targetPackage="android.media.session.cts"
          android:label="CTS tests of android.media">
     </instrumentation>
 
diff --git a/tests/tests/media/bettertogether/AndroidTest-mcts.xml b/tests/tests/media/session/AndroidTest-mcts.xml
similarity index 93%
copy from tests/tests/media/bettertogether/AndroidTest-mcts.xml
copy to tests/tests/media/session/AndroidTest-mcts.xml
index 8c7c440..554c973 100644
--- a/tests/tests/media/bettertogether/AndroidTest-mcts.xml
+++ b/tests/tests/media/session/AndroidTest-mcts.xml
@@ -35,10 +35,10 @@
     </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="MctsMediaBetterTogetherTestCases.apk" />
+        <option name="test-file-name" value="MctsMediaSessionTestCases.apk" />
     </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.media.bettertogether.cts" />
+        <option name="package" value="android.media.session.cts" />
         <!-- setup can be expensive so limit the number of shards -->
         <option name="ajur-max-shard" value="5" />
         <!-- test-timeout unit is ms, value = 30 min -->
@@ -47,7 +47,7 @@
         <option name="hidden-api-checks" value="false" />
         <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. -->
         <option name="isolated-storage" value="false" />
-        <option name="exclude-annotation" value="com.android.bedstead.harrier.annotations.RequireRunOnWorkProfile" />
+        <option name="exclude-annotation" value="com.android.bedstead.enterprise.annotations.RequireRunOnWorkProfile" />
         <!-- Handle the CTS/MCTS differentiation -->
         <option name="exclude-annotation" value="com.android.compatibility.common.util.FrameworkSpecificTest" />
         <option name="instrumentation-arg" key="media-testing-mode" value="mcts" />
diff --git a/tests/tests/media/bettertogether/AndroidTest.xml b/tests/tests/media/session/AndroidTest.xml
similarity index 93%
copy from tests/tests/media/bettertogether/AndroidTest.xml
copy to tests/tests/media/session/AndroidTest.xml
index a6cd991..061a03f 100644
--- a/tests/tests/media/bettertogether/AndroidTest.xml
+++ b/tests/tests/media/session/AndroidTest.xml
@@ -34,10 +34,10 @@
     </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="CtsMediaBetterTogetherTestCases.apk" />
+        <option name="test-file-name" value="CtsMediaSessionTestCases.apk" />
     </target_preparer>
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.media.bettertogether.cts" />
+        <option name="package" value="android.media.session.cts" />
         <!-- setup can be expensive so limit the number of shards -->
         <option name="ajur-max-shard" value="5" />
         <!-- test-timeout unit is ms, value = 30 min -->
@@ -46,7 +46,7 @@
         <option name="hidden-api-checks" value="false" />
         <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. -->
         <option name="isolated-storage" value="false" />
-        <option name="exclude-annotation" value="com.android.bedstead.harrier.annotations.RequireRunOnWorkProfile" />
+        <option name="exclude-annotation" value="com.android.bedstead.enterprise.annotations.RequireRunOnWorkProfile" />
         <!-- Handle the CTS/MCTS differentiation -->
         <option name="exclude-annotation" value="com.android.compatibility.common.util.ModuleSpecificTest" />
         <option name="instrumentation-arg" key="media-testing-mode" value="cts" />
diff --git a/tests/tests/media/bettertogether/OWNERS b/tests/tests/media/session/OWNERS
similarity index 84%
rename from tests/tests/media/bettertogether/OWNERS
rename to tests/tests/media/session/OWNERS
index f95948f..ebe2838 100644
--- a/tests/tests/media/bettertogether/OWNERS
+++ b/tests/tests/media/session/OWNERS
@@ -1,3 +1,3 @@
-# Bug component: 137631
+# Bug component: 1611131
 # go/android-fwk-media-solutions for info on areas of ownership.
 include platform/frameworks/av:/media/janitors/media_solutions_OWNERS
\ No newline at end of file
diff --git a/tests/tests/media/bettertogether/aidl/android/media/bettertogether/cts/IRemoteService.aidl b/tests/tests/media/session/aidl/android/media/session/cts/IRemoteService.aidl
similarity index 94%
rename from tests/tests/media/bettertogether/aidl/android/media/bettertogether/cts/IRemoteService.aidl
rename to tests/tests/media/session/aidl/android/media/session/cts/IRemoteService.aidl
index 543cd11..14a123d 100644
--- a/tests/tests/media/bettertogether/aidl/android/media/bettertogether/cts/IRemoteService.aidl
+++ b/tests/tests/media/session/aidl/android/media/session/cts/IRemoteService.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import android.os.Bundle;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/HandlerExecutor.java b/tests/tests/media/session/src/android/media/session/cts/HandlerExecutor.java
similarity index 96%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/HandlerExecutor.java
rename to tests/tests/media/session/src/android/media/session/cts/HandlerExecutor.java
index a56cb0e..e808ffe 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/HandlerExecutor.java
+++ b/tests/tests/media/session/src/android/media/session/cts/HandlerExecutor.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import android.annotation.NonNull;
 import android.os.Handler;
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaActivityTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaActivityTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaActivityTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaActivityTest.java
index f194fef..4f8c332 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaActivityTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaActivityTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaBrowserServiceTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaBrowserServiceTest.java
similarity index 95%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaBrowserServiceTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaBrowserServiceTest.java
index 2868f97..c60a388 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaBrowserServiceTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaBrowserServiceTest.java
@@ -13,15 +13,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
-import static android.media.bettertogether.cts.MediaBrowserServiceTestService.KEY_PARENT_MEDIA_ID;
-import static android.media.bettertogether.cts.MediaBrowserServiceTestService.KEY_SERVICE_COMPONENT_NAME;
-import static android.media.bettertogether.cts.MediaBrowserServiceTestService.TEST_SERIES_OF_NOTIFY_CHILDREN_CHANGED;
-import static android.media.bettertogether.cts.MediaSessionTestService.KEY_EXPECTED_TOTAL_NUMBER_OF_ITEMS;
-import static android.media.bettertogether.cts.MediaSessionTestService.STEP_CHECK;
-import static android.media.bettertogether.cts.MediaSessionTestService.STEP_CLEAN_UP;
-import static android.media.bettertogether.cts.MediaSessionTestService.STEP_SET_UP;
+import static android.media.session.cts.MediaBrowserServiceTestService.KEY_PARENT_MEDIA_ID;
+import static android.media.session.cts.MediaBrowserServiceTestService.KEY_SERVICE_COMPONENT_NAME;
+import static android.media.session.cts.MediaBrowserServiceTestService.TEST_SERIES_OF_NOTIFY_CHILDREN_CHANGED;
+import static android.media.session.cts.MediaSessionTestService.KEY_EXPECTED_TOTAL_NUMBER_OF_ITEMS;
+import static android.media.session.cts.MediaSessionTestService.STEP_CHECK;
+import static android.media.session.cts.MediaSessionTestService.STEP_CLEAN_UP;
+import static android.media.session.cts.MediaSessionTestService.STEP_SET_UP;
 import static android.media.browse.MediaBrowser.MediaItem.FLAG_PLAYABLE;
 import static android.media.cts.Utils.compareRemoteUserInfo;
 
@@ -38,6 +38,8 @@
 import android.media.MediaDescription;
 import android.media.browse.MediaBrowser;
 import android.media.browse.MediaBrowser.MediaItem;
+import android.media.cts.ResourceReleaser;
+import android.media.cts.SimpleMediaBrowserService;
 import android.media.session.MediaController;
 import android.media.session.MediaSession;
 import android.media.session.MediaSessionManager.RemoteUserInfo;
@@ -87,8 +89,8 @@
     private static final long TIME_OUT_MS = 3000L;
     private static final long WAIT_TIME_FOR_NO_RESPONSE_MS = 500L;
     private static final ComponentName TEST_BROWSER_SERVICE = new ComponentName(
-            "android.media.bettertogether.cts",
-            "android.media.bettertogether.cts.StubMediaBrowserService");
+            "android.media.session.cts",
+            "android.media.session.cts.StubMediaBrowserService");
 
     private final TestCountDownLatch mOnChildrenLoadedLatch = new TestCountDownLatch();
     private final TestCountDownLatch mOnChildrenLoadedWithOptionsLatch = new TestCountDownLatch();
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaBrowserServiceTestService.java b/tests/tests/media/session/src/android/media/session/cts/MediaBrowserServiceTestService.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaBrowserServiceTestService.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaBrowserServiceTestService.java
index 6805f06..9dd3193 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaBrowserServiceTestService.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaBrowserServiceTestService.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaBrowserTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaBrowserTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaBrowserTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaBrowserTest.java
index 51e32b1..032035d 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaBrowserTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaBrowserTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
@@ -66,8 +66,8 @@
      */
     private static final long SLEEP_MS = 100L;
     private static final ComponentName TEST_BROWSER_SERVICE = new ComponentName(
-            "android.media.bettertogether.cts",
-            "android.media.bettertogether.cts.StubMediaBrowserService");
+            "android.media.session.cts",
+            "android.media.session.cts.StubMediaBrowserService");
     private static final ComponentName TEST_INVALID_BROWSER_SERVICE = new ComponentName(
             "invalid.package", "invalid.ServiceClassName");
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaButtonBroadcastReceiver.java b/tests/tests/media/session/src/android/media/session/cts/MediaButtonBroadcastReceiver.java
similarity index 96%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaButtonBroadcastReceiver.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaButtonBroadcastReceiver.java
index c2bd992..2c07d41 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaButtonBroadcastReceiver.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaButtonBroadcastReceiver.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static org.junit.Assert.assertEquals;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaButtonReceiverService.java b/tests/tests/media/session/src/android/media/session/cts/MediaButtonReceiverService.java
similarity index 97%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaButtonReceiverService.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaButtonReceiverService.java
index 7bd9e5a..8308cd2 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaButtonReceiverService.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaButtonReceiverService.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static org.junit.Assert.assertEquals;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaCommunicationManagerTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaCommunicationManagerTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaCommunicationManagerTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaCommunicationManagerTest.java
index d8b1c79..8035e9e 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaCommunicationManagerTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaCommunicationManagerTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static android.Manifest.permission.MEDIA_CONTENT_CONTROL;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaController2Test.java b/tests/tests/media/session/src/android/media/session/cts/MediaController2Test.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaController2Test.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaController2Test.java
index 8e2171b..2d86440 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaController2Test.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaController2Test.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static androidx.test.ext.truth.os.BundleSubject.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaControllerTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaControllerTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaControllerTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaControllerTest.java
index c69b487..6d1f136 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaControllerTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaControllerTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static android.media.cts.Utils.compareRemoteUserInfo;
 import static android.media.session.PlaybackState.STATE_PLAYING;
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaItemTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaItemTest.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaItemTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaItemTest.java
index ffbe33a..01b4ca8 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaItemTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaItemTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaMetadataTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaMetadataTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaMetadataTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaMetadataTest.java
index 5a06931..16e1fdc 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaMetadataTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaMetadataTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSession2ServiceTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaSession2ServiceTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSession2ServiceTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaSession2ServiceTest.java
index 55c436c..fdd5827 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSession2ServiceTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaSession2ServiceTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSession2Test.java b/tests/tests/media/session/src/android/media/session/cts/MediaSession2Test.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSession2Test.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaSession2Test.java
index 446d3f2..cdf43fa 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSession2Test.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaSession2Test.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static androidx.test.ext.truth.os.BundleSubject.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionManagerTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaSessionManagerTest.java
similarity index 99%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionManagerTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaSessionManagerTest.java
index 40a3bf2..3d2e351 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionManagerTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaSessionManagerTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
@@ -31,6 +31,7 @@
 import android.media.MediaSession2;
 import android.media.Session2CommandGroup;
 import android.media.Session2Token;
+import android.media.cts.ResourceReleaser;
 import android.media.cts.Utils;
 import android.media.session.MediaController;
 import android.media.session.MediaSession;
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionManagerUiThreadTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaSessionManagerUiThreadTest.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionManagerUiThreadTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaSessionManagerUiThreadTest.java
index 44f96244..9f534fd 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionManagerUiThreadTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaSessionManagerUiThreadTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static org.junit.Assert.assertThrows;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionTest.java b/tests/tests/media/session/src/android/media/session/cts/MediaSessionTest.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionTest.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaSessionTest.java
index 3fb5cb8..2a73420 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaSessionTest.java
@@ -13,18 +13,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static android.media.AudioAttributes.USAGE_GAME;
 import static android.media.AudioAttributes.USAGE_MEDIA;
-import static android.media.bettertogether.cts.MediaSessionTestService.KEY_EXPECTED_QUEUE_SIZE;
-import static android.media.bettertogether.cts.MediaSessionTestService.KEY_EXPECTED_TOTAL_NUMBER_OF_ITEMS;
-import static android.media.bettertogether.cts.MediaSessionTestService.KEY_SESSION_TOKEN;
-import static android.media.bettertogether.cts.MediaSessionTestService.STEP_CHECK;
-import static android.media.bettertogether.cts.MediaSessionTestService.STEP_CLEAN_UP;
-import static android.media.bettertogether.cts.MediaSessionTestService.STEP_SET_UP;
-import static android.media.bettertogether.cts.MediaSessionTestService.TEST_SERIES_OF_SET_QUEUE;
-import static android.media.bettertogether.cts.MediaSessionTestService.TEST_SET_QUEUE;
+import static android.media.session.cts.MediaSessionTestService.KEY_EXPECTED_QUEUE_SIZE;
+import static android.media.session.cts.MediaSessionTestService.KEY_EXPECTED_TOTAL_NUMBER_OF_ITEMS;
+import static android.media.session.cts.MediaSessionTestService.KEY_SESSION_TOKEN;
+import static android.media.session.cts.MediaSessionTestService.STEP_CHECK;
+import static android.media.session.cts.MediaSessionTestService.STEP_CLEAN_UP;
+import static android.media.session.cts.MediaSessionTestService.STEP_SET_UP;
+import static android.media.session.cts.MediaSessionTestService.TEST_SERIES_OF_SET_QUEUE;
+import static android.media.session.cts.MediaSessionTestService.TEST_SET_QUEUE;
 import static android.media.cts.Utils.compareRemoteUserInfo;
 import static android.os.UserManager.USER_TYPE_PROFILE_CLONE;
 
@@ -558,7 +558,7 @@
     @UserTest({UserType.INITIAL_USER, UserType.WORK_PROFILE})
     public void testSetMediaButtonReceiver_implicitIntent() throws Exception {
         // Note: No such broadcast receiver exists.
-        Intent intent = new Intent("android.media.bettertogether.cts.ACTION_MEDIA_TEST");
+        Intent intent = new Intent("android.media.session.cts.ACTION_MEDIA_TEST");
         PendingIntent pi = PendingIntent.getBroadcast(mContext, 0, intent,
                 PendingIntent.FLAG_MUTABLE_UNAUDITED);
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionTestActivity.java b/tests/tests/media/session/src/android/media/session/cts/MediaSessionTestActivity.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionTestActivity.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaSessionTestActivity.java
index 07e07a4..449ba775 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionTestActivity.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaSessionTestActivity.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import android.app.Activity;
 import android.app.KeyguardManager;
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionTestService.java b/tests/tests/media/session/src/android/media/session/cts/MediaSessionTestService.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionTestService.java
rename to tests/tests/media/session/src/android/media/session/cts/MediaSessionTestService.java
index 1b7b4dd..4029e9e 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/MediaSessionTestService.java
+++ b/tests/tests/media/session/src/android/media/session/cts/MediaSessionTestService.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RemoteControllerTest.java b/tests/tests/media/session/src/android/media/session/cts/RemoteControllerTest.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RemoteControllerTest.java
rename to tests/tests/media/session/src/android/media/session/cts/RemoteControllerTest.java
index 6995fb3..c9c556f 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RemoteControllerTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/RemoteControllerTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RemoteService.java b/tests/tests/media/session/src/android/media/session/cts/RemoteService.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RemoteService.java
rename to tests/tests/media/session/src/android/media/session/cts/RemoteService.java
index c21d813..b1b585a 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/RemoteService.java
+++ b/tests/tests/media/session/src/android/media/session/cts/RemoteService.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static org.junit.Assert.assertTrue;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/Session2CommandGroupTest.java b/tests/tests/media/session/src/android/media/session/cts/Session2CommandGroupTest.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/Session2CommandGroupTest.java
rename to tests/tests/media/session/src/android/media/session/cts/Session2CommandGroupTest.java
index 611fd30..caca20c 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/Session2CommandGroupTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/Session2CommandGroupTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/Session2CommandTest.java b/tests/tests/media/session/src/android/media/session/cts/Session2CommandTest.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/Session2CommandTest.java
rename to tests/tests/media/session/src/android/media/session/cts/Session2CommandTest.java
index 0953ce3..b3bf8b6 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/Session2CommandTest.java
+++ b/tests/tests/media/session/src/android/media/session/cts/Session2CommandTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/StubMediaBrowserService.java b/tests/tests/media/session/src/android/media/session/cts/StubMediaBrowserService.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/StubMediaBrowserService.java
rename to tests/tests/media/session/src/android/media/session/cts/StubMediaBrowserService.java
index 7a55319..6662b22 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/StubMediaBrowserService.java
+++ b/tests/tests/media/session/src/android/media/session/cts/StubMediaBrowserService.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import static com.google.common.truth.Truth.assertThat;
 
diff --git a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/StubMediaSession2Service.java b/tests/tests/media/session/src/android/media/session/cts/StubMediaSession2Service.java
similarity index 98%
rename from tests/tests/media/bettertogether/src/android/media/bettertogether/cts/StubMediaSession2Service.java
rename to tests/tests/media/session/src/android/media/session/cts/StubMediaSession2Service.java
index 33d36cd..862d988 100644
--- a/tests/tests/media/bettertogether/src/android/media/bettertogether/cts/StubMediaSession2Service.java
+++ b/tests/tests/media/session/src/android/media/session/cts/StubMediaSession2Service.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.media.bettertogether.cts;
+package android.media.session.cts;
 
 import android.media.MediaSession2;
 import android.media.MediaSession2.ControllerInfo;
diff --git a/tests/tests/mediaediting/src/android/media/mediaediting/cts/TranscodeQualityTest.java b/tests/tests/mediaediting/src/android/media/mediaediting/cts/TranscodeQualityTest.java
index bfcdff1..ed02416 100644
--- a/tests/tests/mediaediting/src/android/media/mediaediting/cts/TranscodeQualityTest.java
+++ b/tests/tests/mediaediting/src/android/media/mediaediting/cts/TranscodeQualityTest.java
@@ -27,7 +27,6 @@
 import androidx.media3.common.MimeTypes;
 import androidx.media3.effect.DefaultVideoFrameProcessor;
 import androidx.media3.transformer.EditedMediaItem;
-import androidx.media3.transformer.TransformationRequest;
 import androidx.media3.transformer.Transformer;
 import androidx.test.core.app.ApplicationProvider;
 
@@ -147,18 +146,14 @@
             .setExperimentalAdjustSurfaceTextureTransformationMatrix(true)
             .build();
     return new Transformer.Builder(context)
-        .setTransformationRequest(
-            new TransformationRequest.Builder().setVideoMimeType(toMediaType).build())
+        .setVideoMimeType(toMediaType)
         .setEncoderFactory(new AndroidTestUtil.ForceEncodeEncoderFactory(context))
         .setVideoFrameProcessorFactory(videoFrameProcessorFactory)
         .build();
   }
 
   public static Transformer createTransformer(Context context, String toMediaType) {
-    return (new Transformer.Builder(context)
-        .setTransformationRequest(
-            new TransformationRequest.Builder().setVideoMimeType(toMediaType).build())
-        .build());
+    return new Transformer.Builder(context).setVideoMimeType(toMediaType).build();
   }
 
   @ApiTest(apis = {"android.media.MediaCodec#configure",
diff --git a/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformHdrToSdrToneMapTest.java b/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformHdrToSdrToneMapTest.java
index bbe7943..895edb4 100644
--- a/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformHdrToSdrToneMapTest.java
+++ b/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformHdrToSdrToneMapTest.java
@@ -35,6 +35,8 @@
 import androidx.media3.common.ColorInfo;
 import androidx.media3.common.MediaItem;
 import androidx.media3.common.MimeTypes;
+import androidx.media3.transformer.EditedMediaItem;
+import androidx.media3.transformer.EditedMediaItemSequence;
 import androidx.media3.transformer.ExportException;
 import androidx.media3.transformer.TransformationRequest;
 import androidx.media3.transformer.Composition;
@@ -123,15 +125,11 @@
 
   private static Transformer createTransformer(Context context) {
     return new Transformer.Builder(context)
-        .setTransformationRequest(
-            new TransformationRequest.Builder()
-                .setHdrMode(Composition.HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC)
-                .build())
         .addListener(
             new Transformer.Listener() {
               @Override
               public void onFallbackApplied(
-                  @NonNull MediaItem inputMediaItem,
+                  @NonNull Composition composition,
                   @NonNull TransformationRequest originalTransformationRequest,
                   @NonNull TransformationRequest fallbackTransformationRequest) {
                 // Tone mapping flag shouldn't change in fallback when tone mapping is requested.
@@ -161,11 +159,19 @@
             .build()));
 
     Transformer transformer = createTransformer(context);
+    Composition composition =
+        new Composition.Builder(
+                new EditedMediaItemSequence.Builder(
+                        new EditedMediaItem.Builder(
+                                MediaItem.fromUri(Uri.parse(MEDIA_DIR + testFile))).build())
+                            .build())
+            .setHdrMode(Composition.HDR_MODE_TONE_MAP_HDR_TO_SDR_USING_MEDIACODEC)
+            .build();
     ExportTestResult transformationTestResult;
     try {
       transformationTestResult = new TransformerAndroidTestRunner.Builder(context, transformer)
           .build()
-          .run(testId, MediaItem.fromUri(Uri.parse(MEDIA_DIR + testFile)));
+          .run(testId, composition);
     } catch (ExportException exception) {
       if (exception.getCause() != null
           && (Objects.equals(
diff --git a/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformVideoAspectRatio.java b/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformVideoAspectRatio.java
index abbdacb..2139ee8 100644
--- a/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformVideoAspectRatio.java
+++ b/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformVideoAspectRatio.java
@@ -29,7 +29,6 @@
 import androidx.media3.effect.Presentation;
 import androidx.media3.transformer.EditedMediaItem;
 import androidx.media3.transformer.Effects;
-import androidx.media3.transformer.TransformationRequest;
 import androidx.media3.transformer.Transformer;
 import androidx.test.core.app.ApplicationProvider;
 
@@ -186,8 +185,7 @@
   }
 
   private static Transformer createTransformer(Context context, String toMediaType) {
-    return new Transformer.Builder(context).setTransformationRequest(
-        new TransformationRequest.Builder().setVideoMimeType(toMediaType).build()).build();
+    return new Transformer.Builder(context).setVideoMimeType(toMediaType).build();
   }
 
   @Test
diff --git a/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformerAndroidTestRunner.java b/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformerAndroidTestRunner.java
index 36cf2f0..8b16071 100644
--- a/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformerAndroidTestRunner.java
+++ b/tests/tests/mediaediting/src/android/media/mediaediting/cts/TransformerAndroidTestRunner.java
@@ -346,7 +346,7 @@
 
                   @Override
                   public void onFallbackApplied(
-                      MediaItem inputMediaItem,
+                      Composition composition,
                       TransformationRequest originalTransformationRequest,
                       TransformationRequest fallbackTransformationRequest) {
                     // Note: As TransformationRequest only reports the output height but not the
diff --git a/tests/tests/mediaediting/src/android/media/mediaediting/cts/VideoResolutionTest.java b/tests/tests/mediaediting/src/android/media/mediaediting/cts/VideoResolutionTest.java
index adfab47..8962ebf 100644
--- a/tests/tests/mediaediting/src/android/media/mediaediting/cts/VideoResolutionTest.java
+++ b/tests/tests/mediaediting/src/android/media/mediaediting/cts/VideoResolutionTest.java
@@ -29,7 +29,6 @@
 import androidx.media3.effect.Presentation;
 import androidx.media3.transformer.EditedMediaItem;
 import androidx.media3.transformer.Effects;
-import androidx.media3.transformer.TransformationRequest;
 import androidx.media3.transformer.Transformer;
 import androidx.test.core.app.ApplicationProvider;
 
@@ -235,10 +234,7 @@
   }
 
   private static Transformer createTransformer(Context context, String toMediaType) {
-    return (new Transformer.Builder(context)
-        .setTransformationRequest(
-            new TransformationRequest.Builder().setVideoMimeType(toMediaType).build())
-        .build());
+    return new Transformer.Builder(context).setVideoMimeType(toMediaType).build();
   }
 
   @ApiTest(apis = {"android.media.MediaCodec#configure",
diff --git a/tests/tests/mimemap/Android.bp b/tests/tests/mimemap/Android.bp
index 571d6e5..706ed7c 100644
--- a/tests/tests/mimemap/Android.bp
+++ b/tests/tests/mimemap/Android.bp
@@ -29,6 +29,7 @@
     static_libs: [
         "ctstestrunner-axt",
         "mimemap-testing",
+        "mimemap-testing-alt",
     ],
     test_suites: [
         "cts",
diff --git a/tests/tests/mimemap/src/android/content/type/cts/MimeMapTest.java b/tests/tests/mimemap/src/android/content/type/cts/MimeMapTest.java
index 602af79..49331ec 100644
--- a/tests/tests/mimemap/src/android/content/type/cts/MimeMapTest.java
+++ b/tests/tests/mimemap/src/android/content/type/cts/MimeMapTest.java
@@ -23,8 +23,6 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import android.content.type.cts.StockAndroidMimeMapFactory;
-
 import libcore.content.type.MimeMap;
 
 import org.junit.Before;
@@ -44,6 +42,9 @@
     /** Stock Android's default MimeMap. */
     private MimeMap stockAndroidMimeMap;
 
+    /** Stock Android's default MimeMap. */
+    private MimeMap stockAndroidAltMimeMap;
+
     /** The platform's actual default MimeMap. */
     private MimeMap mimeMap;
 
@@ -54,6 +55,9 @@
         // The resources are placed into the testres/ path by the "mimemap-testing-res.jar" genrule.
         stockAndroidMimeMap = StockAndroidMimeMapFactory.create(
                 s -> MimeMapTest.class.getResourceAsStream("/testres/" + s));
+        stockAndroidAltMimeMap =
+                StockAndroidAltMimeMapFactory.create(
+                        s -> MimeMapTest.class.getResourceAsStream("/testres-alt/" + s));
     }
 
     @Test
@@ -254,27 +258,39 @@
     }
 
     @Test public void containsAllStockAndroidMappings_mimeToExt() {
+        assertTrue(
+                mimeToExtAsExpected(stockAndroidMimeMap, mimeMap)
+                        || mimeToExtAsExpected(stockAndroidAltMimeMap, mimeMap));
+    }
+
+    private static boolean mimeToExtAsExpected(MimeMap stockMimeMap, MimeMap actualMimeMap) {
         // The minimum expected mimeType -> extension mappings that should be present.
         TreeMap<String, String> expected = new TreeMap<>();
         // The extensions that these mimeTypes are actually mapped to.
         TreeMap<String, String> actual = new TreeMap<>();
-        for (String mimeType : stockAndroidMimeMap.mimeTypes()) {
-            expected.put(mimeType, stockAndroidMimeMap.guessExtensionFromMimeType(mimeType));
-            actual.put(mimeType, mimeMap.guessExtensionFromMimeType(mimeType));
+        for (String mimeType : stockMimeMap.mimeTypes()) {
+            expected.put(mimeType, stockMimeMap.guessExtensionFromMimeType(mimeType));
+            actual.put(mimeType, actualMimeMap.guessExtensionFromMimeType(mimeType));
         }
-        assertEquals(expected, actual);
+        return expected.equals(actual);
     }
 
     @Test public void containsAllExpectedMappings_extToMime() {
+        assertTrue(
+                extToMimeAsExpected(stockAndroidMimeMap, mimeMap)
+                        || extToMimeAsExpected(stockAndroidAltMimeMap, mimeMap));
+    }
+
+    private static boolean extToMimeAsExpected(MimeMap stockMimeMap, MimeMap actualMimeMap) {
         // The minimum expected extension -> mimeType mappings that should be present.
         TreeMap<String, String> expected = new TreeMap<>();
         // The mimeTypes that these extensions are actually mapped to.
         TreeMap<String, String> actual = new TreeMap<>();
-        for (String extension : stockAndroidMimeMap.extensions()) {
-            expected.put(extension, stockAndroidMimeMap.guessMimeTypeFromExtension(extension));
-            actual.put(extension, mimeMap.guessMimeTypeFromExtension(extension));
+        for (String extension : stockMimeMap.extensions()) {
+            expected.put(extension, stockMimeMap.guessMimeTypeFromExtension(extension));
+            actual.put(extension, actualMimeMap.guessMimeTypeFromExtension(extension));
         }
-        assertEquals(expected, actual);
+        return expected.equals(actual);
     }
 
     /**
diff --git a/tests/tests/nfc/Android.bp b/tests/tests/nfc/Android.bp
deleted file mode 100644
index 3133470..0000000
--- a/tests/tests/nfc/Android.bp
+++ /dev/null
@@ -1,90 +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 {
-    default_team: "trendy_team_fwk_nfc",
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-android_test {
-    name: "CtsNfcTestCases",
-    defaults: ["cts_defaults"],
-    platform_apis: true,
-    static_libs: [
-        "android.nfc.flags-aconfig-java",
-        "android.permission.flags-aconfig-java",
-        "com.android.nfc.flags-aconfig-java",
-        "ctstestrunner-axt",
-        "compatibility-device-util-axt",
-        "flag-junit",
-        "platform-test-annotations",
-        "testables",
-        "testng",
-        "androidx.appcompat_appcompat",
-        "CtsAppTestStubsShared",
-    ],
-    srcs: [
-        "src/android/nfc/cts/*.java",
-        "src/android/nfc/tech/cts/*.java",
-    ],
-    sdk_version: "core_current",
-    libs: [
-        "framework-nfc.impl",
-        "framework",
-        "framework-res",
-        "android.test.runner.stubs",
-        "android.test.base.stubs",
-        "unsupportedappusage",
-    ],
-    data: [
-        ":WalletRoleHolderApp",
-        ":ForegroundNfcApp",
-        ":NonPaymentNfcApp",
-    ],
-    instrumentation_for: "CtsAppTestStubs",
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-        "mts-nfc",
-        "mcts-nfc",
-    ],
-    min_sdk_version: "current",
-}
-
-android_test {
-    name: "CtsNfcInteractiveTestCases",
-    defaults: ["cts_defaults"],
-    static_libs: [
-        "ActivityContext",
-        "Interactive",
-        "ctstestrunner-axt",
-        "com.google.android.material_material",
-        "androidx.appcompat_appcompat",
-    ],
-    srcs: [
-        "src/android/nfc/cts/interactive/*.java",
-        "src/android/nfc/tech/cts/interactive/*.java",
-    ],
-    libs: [
-        "android.test.runner.stubs.system",
-        "android.test.base.stubs.system",
-        "framework-nfc.impl",
-    ],
-    test_suites: [
-        "cts-interactive",
-        "general-tests",
-    ],
-    test_config: "InteractiveAndroidTest.xml",
-}
diff --git a/tests/tests/nfc/AndroidManifest.xml b/tests/tests/nfc/AndroidManifest.xml
deleted file mode 100644
index 0a082ca..0000000
--- a/tests/tests/nfc/AndroidManifest.xml
+++ /dev/null
@@ -1,94 +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.nfc.cts"
-          android:targetSandboxVersion="2">
-
-    <uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
-    <uses-permission android:name="android.permission.NFC" />
-    <uses-permission android:name="android.permission.NFC_PREFERRED_PAYMENT_INFO" />
-    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
-    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
-
-    <queries>
-        <package android:name="com.android.test.foregroundnfc" />
-        <package android:name="com.android.test.walletroleholder" />
-    </queries>
-
-    <application android:testOnly="true">
-        <uses-library android:name="android.test.runner"/>
-
-        <service android:name=".CtsMyHostApduService" android:exported="true"
-                 android:permission="android.permission.BIND_NFC_SERVICE">
-            <intent-filter>
-                <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
-            </intent-filter>
-            <meta-data android:name="android.nfc.cardemulation.host_apdu_service"
-                       android:resource="@xml/payment_aid_list"/>
-        </service>
-        <service android:name=".CustomHostApduService" android:exported="true"
-                 android:permission="android.permission.BIND_NFC_SERVICE">
-            <intent-filter>
-                <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
-            </intent-filter>
-            <meta-data android:name="android.nfc.cardemulation.host_apdu_service"
-                       android:resource="@xml/custom_aid_list"/>
-        </service>
-        <service android:name=".BackgroundHostApduService" android:exported="true"
-                 android:permission="android.permission.BIND_NFC_SERVICE">
-            <intent-filter>
-                <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
-            </intent-filter>
-            <meta-data android:name="android.nfc.cardemulation.host_apdu_service"
-                       android:resource="@xml/background_aid_list"/>
-        </service>
-        <service android:name=".CtsMyOffHostApduService" android:exported="true" android:permission="android.permission.BIND_NFC_SERVICE">
-            <intent-filter>
-                <action android:name="android.nfc.cardemulation.action.OFF_HOST_APDU_SERVICE"/>
-            </intent-filter>
-            <meta-data android:name="android.nfc.cardemulation.off_host_apdu_service" android:resource="@xml/offhost_apdu_service"/>
-        </service>
-        <service android:name=".CtsMyOffHostDefaultToObserveApduService" android:exported="true" android:permission="android.permission.BIND_NFC_SERVICE">
-            <intent-filter>
-                <action android:name="android.nfc.cardemulation.action.OFF_HOST_APDU_SERVICE"/>
-            </intent-filter>
-            <meta-data android:name="android.nfc.cardemulation.off_host_apdu_service" android:resource="@xml/offhost_apdu_service_default_to_observe"/>
-        </service>
-        <activity android:name="android.nfc.cts.NfcFCardEmulationActivity"
-             android:exported="false">
-        </activity>
-        <receiver android:name=".PollingLoopBroadcastReceiver"
-            android:enabled="true"
-            android:exported="true">
-            <intent-filter>
-                <action android:name="com.cts.PollingLoopFired" />
-                <action android:name="com.cts.ObserveModeChanged" />
-                <action android:name="com.cts.PreferredServiceChanged" />
-            </intent-filter>
-        </receiver>
-        <activity android:name="android.nfc.cts.interactive.TagVerifierActivity"
-                  android:theme="@style/Theme.AppCompat.Light"
-        android:exported="true"/>
-    </application>
-
-    <!-- This is a self-instrumenting test package. -->
-    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-                     android:label="CTS tests for Nfc CardEmulation API"
-                     android:targetPackage="android.nfc.cts">
-    </instrumentation>
-
-</manifest>
diff --git a/tests/tests/nfc/AndroidTest.xml b/tests/tests/nfc/AndroidTest.xml
deleted file mode 100644
index 2151cec..0000000
--- a/tests/tests/nfc/AndroidTest.xml
+++ /dev/null
@@ -1,41 +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.
--->
-<configuration description="Config for CTS Nfc test cases">
-    <option name="test-suite-tag" value="cts"/>
-    <option name="config-descriptor:metadata" key="component" value="systems"/>
-    <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="config-descriptor:metadata" key="parameter" value="secondary_user_on_secondary_display" />
-    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
-    <option name="config-descriptor:metadata" key="mainline-param" value="com.google.android.nfcservices.apex" />
-    <option name="not-shardable" value="true" />
-    <option name="install-arg" value="-t" />
-    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
-        <option name="cleanup-apks" value="true"/>
-        <option name="test-file-name" value="CtsNfcTestCases.apk"/>
-        <option name="test-file-name" value="WalletRoleHolderApp.apk"/>
-        <option name="test-file-name" value="ForegroundNfcApp.apk"/>
-        <option name="test-file-name" value="NonPaymentNfcApp.apk"/>
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
-        <option name="package" value="android.nfc.cts"/>
-        <option name="runtime-hint" value="10m10s"/>
-    </test>
-    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
-        <option name="mainline-module-package-name" value="com.google.android.nfcservices" />
-    </object>
-</configuration>
diff --git a/tests/tests/nfc/ForegroundNfcApp/Android.bp b/tests/tests/nfc/ForegroundNfcApp/Android.bp
deleted file mode 100644
index 21aed7f..0000000
--- a/tests/tests/nfc/ForegroundNfcApp/Android.bp
+++ /dev/null
@@ -1,31 +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 {
-    default_team: "trendy_team_fwk_nfc",
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-android_test_helper_app {
-    name: "ForegroundNfcApp",
-    defaults: ["cts_support_defaults"],
-    srcs: ["**/*.java"],
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-        "sts",
-    ],
-    sdk_version: "current",
-}
diff --git a/tests/tests/nfc/ForegroundNfcApp/AndroidManifest.xml b/tests/tests/nfc/ForegroundNfcApp/AndroidManifest.xml
deleted file mode 100644
index 98b90cd..0000000
--- a/tests/tests/nfc/ForegroundNfcApp/AndroidManifest.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2024 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT 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.test.foregroundnfc">
-
-    <uses-permission android:name="android.permission.NFC" />
-    <application android:label="Foreground NFC App">
-        <service android:name="com.android.test.foregroundnfc.ForegroundApduService"
-            android:exported="true"
-            android:permission="android.permission.BIND_NFC_SERVICE">
-            <intent-filter>
-                <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
-            </intent-filter>
-            <meta-data android:name="android.nfc.cardemulation.host_apdu_service"
-                android:resource="@xml/payment_aid_list"/>
-        </service>
-        <service android:name="com.android.test.foregroundnfc.AssociatedApduService"
-            android:exported="true"
-            android:permission="android.permission.BIND_NFC_SERVICE">
-            <intent-filter>
-                <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
-            </intent-filter>
-            <meta-data android:name="android.nfc.cardemulation.host_apdu_service"
-                android:resource="@xml/payment_aid_list2"/>
-        </service>
-    </application>
-
-</manifest>
diff --git a/tests/tests/nfc/ForegroundNfcApp/res/layout/activity.xml b/tests/tests/nfc/ForegroundNfcApp/res/layout/activity.xml
deleted file mode 100644
index 6b9c95d..0000000
--- a/tests/tests/nfc/ForegroundNfcApp/res/layout/activity.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2024 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT 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"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical"
-    >
-
-    <TextView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="25dp"
-        android:textAppearance="?android:attr/textAppearanceLarge"
-        android:text="Setting nfc service..."
-        />
-
-</LinearLayout>
\ No newline at end of file
diff --git a/tests/tests/nfc/ForegroundNfcApp/res/values/strings.xml b/tests/tests/nfc/ForegroundNfcApp/res/values/strings.xml
deleted file mode 100644
index cdada8b..0000000
--- a/tests/tests/nfc/ForegroundNfcApp/res/values/strings.xml
+++ /dev/null
@@ -1,18 +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.
--->
-<resources>
-    <string name="ForegroundCtsPaymentService">Foreground CTS Nfc Test Service</string>
-</resources>
diff --git a/tests/tests/nfc/ForegroundNfcApp/res/xml/payment_aid_list.xml b/tests/tests/nfc/ForegroundNfcApp/res/xml/payment_aid_list.xml
deleted file mode 100644
index 876bc3b..0000000
--- a/tests/tests/nfc/ForegroundNfcApp/res/xml/payment_aid_list.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
-    android:description="@string/ForegroundCtsPaymentService">
-    <aid-group android:description="@string/ForegroundCtsPaymentService" android:category="payment">
-        <aid-filter android:name="A000000004101011"/>
-        <aid-filter android:name="A000000004101012"/>
-        <aid-filter android:name="A000000004101013"/>
-    </aid-group>
-</host-apdu-service>
diff --git a/tests/tests/nfc/ForegroundNfcApp/res/xml/payment_aid_list2.xml b/tests/tests/nfc/ForegroundNfcApp/res/xml/payment_aid_list2.xml
deleted file mode 100644
index 130d2ee..0000000
--- a/tests/tests/nfc/ForegroundNfcApp/res/xml/payment_aid_list2.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
-    android:description="@string/ForegroundCtsPaymentService"
-    android:wantsRoleHolderPriority="true">
-    <aid-group android:description="@string/ForegroundCtsPaymentService" android:category="payment">
-        <aid-filter android:name="A000000005101011"/>
-        <aid-filter android:name="A000000005101012"/>
-        <aid-filter android:name="A000000005101013"/>
-    </aid-group>
-</host-apdu-service>
diff --git a/tests/tests/nfc/ForegroundNfcApp/src/com/android/test/foregroundnfc/AssociatedApduService.java b/tests/tests/nfc/ForegroundNfcApp/src/com/android/test/foregroundnfc/AssociatedApduService.java
deleted file mode 100644
index 97f1a59..0000000
--- a/tests/tests/nfc/ForegroundNfcApp/src/com/android/test/foregroundnfc/AssociatedApduService.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.test.foregroundnfc;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.nfc.cardemulation.HostApduService;
-import android.nfc.cardemulation.PollingFrame;
-import android.os.Bundle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class AssociatedApduService extends HostApduService {
-
-    @Override
-    public void processPollingFrames(List<PollingFrame> frames) {
-        ArrayList<PollingFrame> framesArrayList = new ArrayList<>(frames);
-        final Intent intent = new Intent();
-        intent.setAction("com.cts.PollingLoopFired");
-        intent.putExtra("class_name", this.getClass().getName());
-        intent.putParcelableArrayListExtra("frames", framesArrayList);
-        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
-        intent.setComponent(
-                new ComponentName("android.nfc.cts",
-                        "android.nfc.cts.PollingLoopBroadcastReceiver"));
-        sendBroadcast(intent);
-    }
-
-    @Override
-    public byte[] processCommandApdu(byte[] commandApdu, Bundle extras) {
-        return new byte[0];
-    }
-
-    @Override
-    public void onDeactivated(int reason) {
-        return;
-    }
-}
diff --git a/tests/tests/nfc/ForegroundNfcApp/src/com/android/test/foregroundnfc/ForegroundApduService.java b/tests/tests/nfc/ForegroundNfcApp/src/com/android/test/foregroundnfc/ForegroundApduService.java
deleted file mode 100644
index 2928ef9..0000000
--- a/tests/tests/nfc/ForegroundNfcApp/src/com/android/test/foregroundnfc/ForegroundApduService.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.test.foregroundnfc;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.nfc.cardemulation.HostApduService;
-import android.nfc.cardemulation.PollingFrame;
-import android.os.Bundle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class ForegroundApduService extends HostApduService {
-
-    @Override
-    public void processPollingFrames(List<PollingFrame> frames) {
-        ArrayList<PollingFrame> framesArrayList = new ArrayList<>(frames);
-        final Intent intent = new Intent();
-        intent.setAction("com.cts.PollingLoopFired");
-        intent.putExtra("class_name", this.getClass().getName());
-        intent.putParcelableArrayListExtra("frames", framesArrayList);
-        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
-        intent.setComponent(
-                new ComponentName("android.nfc.cts",
-                        "android.nfc.cts.PollingLoopBroadcastReceiver"));
-        sendBroadcast(intent);
-    }
-
-    @Override
-    public byte[] processCommandApdu(byte[] commandApdu, Bundle extras) {
-        return new byte[0];
-    }
-
-    @Override
-    public void onDeactivated(int reason) {
-        return;
-    }
-}
diff --git a/tests/tests/nfc/InteractiveAndroidTest.xml b/tests/tests/nfc/InteractiveAndroidTest.xml
deleted file mode 100644
index 03c49d6..0000000
--- a/tests/tests/nfc/InteractiveAndroidTest.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2024 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT 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 Interactive CTS NFC test cases">
-    <option name="test-suite-tag" value="cts-interactive" />
-
-    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
-        <option name="cleanup-apks" value="true" />
-        <option name="install-arg" value="-t" />
-        <option name="test-file-name" value="CtsNfcInteractiveTestCases.apk" />
-    </target_preparer>
-    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
-        <option name="package" value="android.nfc.cts" />
-        <option name="include-annotation" value="com.android.interactive.annotations.Interactive" />
-    </test>
-</configuration>
\ No newline at end of file
diff --git a/tests/tests/nfc/NonPaymentNfcApp/Android.bp b/tests/tests/nfc/NonPaymentNfcApp/Android.bp
deleted file mode 100644
index da0cf11..0000000
--- a/tests/tests/nfc/NonPaymentNfcApp/Android.bp
+++ /dev/null
@@ -1,31 +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 {
-    default_team: "trendy_team_fwk_nfc",
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-android_test_helper_app {
-    name: "NonPaymentNfcApp",
-    defaults: ["cts_support_defaults"],
-    srcs: ["**/*.java"],
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-        "sts",
-    ],
-    sdk_version: "current",
-}
diff --git a/tests/tests/nfc/NonPaymentNfcApp/AndroidManifest.xml b/tests/tests/nfc/NonPaymentNfcApp/AndroidManifest.xml
deleted file mode 100644
index c1a8e89..0000000
--- a/tests/tests/nfc/NonPaymentNfcApp/AndroidManifest.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2024 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT 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.test.nonpaymentnfc">
-
-    <uses-permission android:name="android.permission.NFC" />
-    <application android:label="Non Payment NFC App">
-        <service android:name="com.android.test.nonpaymentnfc.NonPaymentApduService"
-            android:exported="true"
-            android:permission="android.permission.BIND_NFC_SERVICE">
-            <intent-filter>
-                <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
-            </intent-filter>
-            <meta-data android:name="android.nfc.cardemulation.host_apdu_service"
-                android:resource="@xml/non_payment_aid_list"/>
-        </service>
-
-        <service
-            android:name=".NonPaymentQuickAccessWalletService"
-            android:label="Non Payment QAW"
-            android:exported="true"
-            android:permission="android.permission.BIND_QUICK_ACCESS_WALLET_SERVICE">
-            <intent-filter>
-                <action android:name="android.service.quickaccesswallet.QuickAccessWalletService" />
-                <category android:name="android.intent.category.DEFAULT"/>
-            </intent-filter>
-            <meta-data android:name="android.quickaccesswallet"
-                android:resource="@xml/quickaccesswallet_configuration" />;
-        </service>
-
-        <activity android:name="QuickAccessWalletActivity">
-        </activity>
-    </application>
-
-</manifest>
diff --git a/tests/tests/nfc/NonPaymentNfcApp/res/values/strings.xml b/tests/tests/nfc/NonPaymentNfcApp/res/values/strings.xml
deleted file mode 100644
index 4d66525..0000000
--- a/tests/tests/nfc/NonPaymentNfcApp/res/values/strings.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2024 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT 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>
-    <string name="NonPaymentApduService">Non Payment Aid CTS Nfc Test Service</string>
-</resources>
diff --git a/tests/tests/nfc/NonPaymentNfcApp/res/xml/non_payment_aid_list.xml b/tests/tests/nfc/NonPaymentNfcApp/res/xml/non_payment_aid_list.xml
deleted file mode 100644
index 12a1e7b..0000000
--- a/tests/tests/nfc/NonPaymentNfcApp/res/xml/non_payment_aid_list.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
-    android:description="@string/NonPaymentApduService">
-    <aid-group android:description="@string/NonPaymentApduService" android:category="other">
-        <aid-filter android:name="F053414950454D"/>
-    </aid-group>
-    <polling-loop-filter android:name="5cadc10f"/>
-</host-apdu-service>
diff --git a/tests/tests/nfc/NonPaymentNfcApp/res/xml/quickaccesswallet_configuration.xml b/tests/tests/nfc/NonPaymentNfcApp/res/xml/quickaccesswallet_configuration.xml
deleted file mode 100644
index 90ef6d4..0000000
--- a/tests/tests/nfc/NonPaymentNfcApp/res/xml/quickaccesswallet_configuration.xml
+++ /dev/null
@@ -1,19 +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.
-  -->
-
-<quickaccesswallet-service
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:targetActivity="com.android.test.nonpaymentnfc.QuickAccessWalletActivity"/>
\ No newline at end of file
diff --git a/tests/tests/nfc/NonPaymentNfcApp/src/QuickAccessWalletActivity.java b/tests/tests/nfc/NonPaymentNfcApp/src/QuickAccessWalletActivity.java
deleted file mode 100644
index b59ecba..0000000
--- a/tests/tests/nfc/NonPaymentNfcApp/src/QuickAccessWalletActivity.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT 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 android.app.Activity;
-
-public class QuickAccessWalletActivity extends Activity {
-}
diff --git a/tests/tests/nfc/NonPaymentNfcApp/src/com/android/test/nonpaymentnfc/NonPaymentApduService.java b/tests/tests/nfc/NonPaymentNfcApp/src/com/android/test/nonpaymentnfc/NonPaymentApduService.java
deleted file mode 100644
index fe937ec..0000000
--- a/tests/tests/nfc/NonPaymentNfcApp/src/com/android/test/nonpaymentnfc/NonPaymentApduService.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.test.nonpaymentnfc;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.nfc.cardemulation.HostApduService;
-import android.nfc.cardemulation.PollingFrame;
-import android.os.Bundle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class NonPaymentApduService extends HostApduService {
-
-    @Override
-    public void processPollingFrames(List<PollingFrame> frames) {
-        ArrayList<PollingFrame> framesArrayList = new ArrayList<>(frames);
-        final Intent intent = new Intent();
-        intent.setAction("com.cts.PollingLoopFired");
-        intent.putExtra("class_name", this.getClass().getName());
-        intent.putParcelableArrayListExtra("frames", framesArrayList);
-        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
-        intent.setComponent(
-                new ComponentName("android.nfc.cts",
-                        "android.nfc.cts.PollingLoopBroadcastReceiver"));
-        sendBroadcast(intent);
-    }
-
-    @Override
-    public byte[] processCommandApdu(byte[] commandApdu, Bundle extras) {
-        return new byte[0];
-    }
-
-    @Override
-    public void onDeactivated(int reason) {
-        return;
-    }
-}
diff --git a/tests/tests/nfc/NonPaymentNfcApp/src/com/android/test/nonpaymentnfc/NonPaymentQuickAccessWalletService.java b/tests/tests/nfc/NonPaymentNfcApp/src/com/android/test/nonpaymentnfc/NonPaymentQuickAccessWalletService.java
deleted file mode 100644
index 96879ab..0000000
--- a/tests/tests/nfc/NonPaymentNfcApp/src/com/android/test/nonpaymentnfc/NonPaymentQuickAccessWalletService.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.test.nonpaymentnfc;
-
-import android.service.quickaccesswallet.GetWalletCardsCallback;
-import android.service.quickaccesswallet.GetWalletCardsRequest;
-import android.service.quickaccesswallet.QuickAccessWalletService;
-import android.service.quickaccesswallet.SelectWalletCardRequest;
-
-public class NonPaymentQuickAccessWalletService extends QuickAccessWalletService {
-    @Override
-    public void onWalletCardsRequested(GetWalletCardsRequest request,
-            GetWalletCardsCallback callback) {
-
-    }
-
-    @Override
-    public void onWalletCardSelected(SelectWalletCardRequest request) {
-
-    }
-
-    @Override
-    public void onWalletDismissed() {
-
-    }
-}
diff --git a/tests/tests/nfc/OWNERS b/tests/tests/nfc/OWNERS
deleted file mode 100644
index 35e9713..0000000
--- a/tests/tests/nfc/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 48448
-include platform/packages/apps/Nfc:/OWNERS
diff --git a/tests/tests/nfc/WalletRoleHolderApp/Android.bp b/tests/tests/nfc/WalletRoleHolderApp/Android.bp
deleted file mode 100644
index 31aa3ba..0000000
--- a/tests/tests/nfc/WalletRoleHolderApp/Android.bp
+++ /dev/null
@@ -1,31 +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 {
-    default_team: "trendy_team_fwk_nfc",
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-android_test_helper_app {
-    name: "WalletRoleHolderApp",
-    defaults: ["cts_support_defaults"],
-    srcs: ["**/*.java"],
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-        "sts",
-    ],
-    sdk_version: "current",
-}
diff --git a/tests/tests/nfc/WalletRoleHolderApp/AndroidManifest.xml b/tests/tests/nfc/WalletRoleHolderApp/AndroidManifest.xml
deleted file mode 100644
index 8d72606..0000000
--- a/tests/tests/nfc/WalletRoleHolderApp/AndroidManifest.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2024 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT 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.test.walletroleholder">
-
-    <uses-permission android:name="android.permission.NFC" />
-    <application android:label="Wallet Role Holder App">>
-        <service android:name="com.android.test.walletroleholder.WalletRoleHolderApduService"
-            android:exported="true"
-            android:permission="android.permission.BIND_NFC_SERVICE">
-            <intent-filter>
-                <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
-            </intent-filter>
-            <meta-data android:name="android.nfc.cardemulation.host_apdu_service"
-                android:resource="@xml/payment_aid_list"/>
-        </service>
-        <service android:name="com.android.test.walletroleholder.XWalletRoleHolderApduService"
-            android:exported="true"
-            android:permission="android.permission.BIND_NFC_SERVICE">
-            <intent-filter>
-                <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
-            </intent-filter>
-            <meta-data android:name="android.nfc.cardemulation.host_apdu_service"
-                android:resource="@xml/xpayment_aid_list"/>
-        </service>
-        <activity android:name="com.android.test.walletroleholder.WalletRoleHolderForegroundActivity"
-            android:exported="true">
-        </activity>
-        <receiver android:name=".WalletRoleBroadcastReceiver"
-            android:enabled="true"
-            android:exported="true">
-            <intent-filter>
-                <action android:name="com.cts.RegisterEventListener" />
-                <action android:name="com.cts.UnregisterEventListener" />
-            </intent-filter>
-        </receiver>
-
-        <property android:name="android.nfc.cardemulation.PROPERTY_ALLOW_SHARED_ROLE_PRIORITY"
-            android:value="true"/>
-    </application>
-
-</manifest>
diff --git a/tests/tests/nfc/WalletRoleHolderApp/res/values/strings.xml b/tests/tests/nfc/WalletRoleHolderApp/res/values/strings.xml
deleted file mode 100644
index 79a96c4..0000000
--- a/tests/tests/nfc/WalletRoleHolderApp/res/values/strings.xml
+++ /dev/null
@@ -1,19 +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.
--->
-<resources>
-    <string name="WalletRoleCtsPaymentService">Wallet Role CTS Nfc Test Service</string>
-    <string name="XWalletRoleCtsPaymentService">XWallet Role CTS Nfc Test Service</string>
-</resources>
diff --git a/tests/tests/nfc/WalletRoleHolderApp/res/xml/payment_aid_list.xml b/tests/tests/nfc/WalletRoleHolderApp/res/xml/payment_aid_list.xml
deleted file mode 100644
index 3829e54..0000000
--- a/tests/tests/nfc/WalletRoleHolderApp/res/xml/payment_aid_list.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
-    android:description="@string/WalletRoleCtsPaymentService">
-    <aid-group android:description="@string/WalletRoleCtsPaymentService" android:category="payment">
-        <aid-filter android:name="A000000004101011"/>
-        <aid-filter android:name="A000000004101012"/>
-        <aid-filter android:name="A000000004101013"/>
-        <aid-filter android:name="A000000004101018"/>
-    </aid-group>
-    <polling-loop-filter android:name="5cadc10f"/>
-</host-apdu-service>
diff --git a/tests/tests/nfc/WalletRoleHolderApp/res/xml/xpayment_aid_list.xml b/tests/tests/nfc/WalletRoleHolderApp/res/xml/xpayment_aid_list.xml
deleted file mode 100644
index 8784617..0000000
--- a/tests/tests/nfc/WalletRoleHolderApp/res/xml/xpayment_aid_list.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<!--
-  ~ Copyright (C) 2024 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~ See the License for the specific language governing permissions and
-  ~ limitations under the License.
-  -->
-
-<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
-    android:description="@string/XWalletRoleCtsPaymentService">
-    <aid-group android:description="@string/XWalletRoleCtsPaymentService" android:category="payment">
-        <aid-filter android:name="A000000004101011"/>
-        <aid-filter android:name="A000000004101012"/>
-        <aid-filter android:name="A000000004101013"/>
-        <aid-filter android:name="A000000004101018"/>
-    </aid-group>
-</host-apdu-service>
diff --git a/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/WalletRoleBroadcastReceiver.java b/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/WalletRoleBroadcastReceiver.java
deleted file mode 100644
index ff1c1d3..0000000
--- a/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/WalletRoleBroadcastReceiver.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.test.walletroleholder;
-
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.nfc.NfcAdapter;
-import android.nfc.cardemulation.CardEmulation;
-
-public class WalletRoleBroadcastReceiver extends BroadcastReceiver
-        implements CardEmulation.NfcEventCallback {
-    Context mContext;
-
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        mContext = context;
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(context);
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        String action = intent.getAction();
-        switch (action) {
-            case "com.cts.RegisterEventListener":
-                cardEmulation.registerNfcEventCallback(context.getMainExecutor(), this);
-                break;
-            case "com.cts.UnregisterEventListener":
-                cardEmulation.unregisterNfcEventCallback(this);
-                break;
-        }
-    }
-
-    @Override
-    public void onObserveModeStateChanged(boolean isEnabled) {
-        final Intent intent = new Intent();
-        intent.setAction("com.cts.ObserveModeChanged");
-        intent.putExtra("class_name", this.getClass().getPackageName());
-        intent.putExtra("enabled", isEnabled);
-        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
-        intent.setComponent(
-                new ComponentName(
-                        "android.nfc.cts", "android.nfc.cts.PollingLoopBroadcastReceiver"));
-        mContext.sendBroadcast(intent);
-    }
-
-    @Override
-    public void onPreferredServiceChanged(boolean isPreferred) {
-        final Intent intent = new Intent();
-        intent.setAction("com.cts.PreferredServiceChanged");
-        intent.putExtra("class_name", this.getClass().getPackageName());
-        intent.putExtra("preferred", isPreferred);
-        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
-        intent.setComponent(
-                new ComponentName(
-                        "android.nfc.cts", "android.nfc.cts.PollingLoopBroadcastReceiver"));
-        mContext.sendBroadcast(intent);
-    }
-}
diff --git a/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/WalletRoleHolderApduService.java b/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/WalletRoleHolderApduService.java
deleted file mode 100644
index c8006fa..0000000
--- a/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/WalletRoleHolderApduService.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.test.walletroleholder;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.nfc.cardemulation.HostApduService;
-import android.nfc.cardemulation.PollingFrame;
-import android.os.Bundle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class WalletRoleHolderApduService extends HostApduService {
-    @Override
-    public void onDeactivated(int reason) {
-        return;
-    }
-
-    @Override
-    public void processPollingFrames(List<PollingFrame> frames) {
-        ArrayList<PollingFrame> framesArrayList = new ArrayList<>(frames);
-        final Intent intent = new Intent();
-        intent.setAction("com.cts.PollingLoopFired");
-        intent.putExtra("class_name", this.getClass().getName());
-        intent.putParcelableArrayListExtra("frames", framesArrayList);
-        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
-        intent.setComponent(
-                new ComponentName(
-                        "android.nfc.cts", "android.nfc.cts.PollingLoopBroadcastReceiver"));
-        sendBroadcast(intent);
-    }
-
-    @Override
-    public byte[] processCommandApdu(byte[] commandApdu, Bundle extras) {
-        return new byte[0];
-    }
-}
diff --git a/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/WalletRoleHolderForegroundActivity.java b/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/WalletRoleHolderForegroundActivity.java
deleted file mode 100644
index 68908c5..0000000
--- a/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/WalletRoleHolderForegroundActivity.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.test.walletroleholder;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.os.Handler;
-
-public class WalletRoleHolderForegroundActivity extends Activity {
-
-    private Handler mMainHandler;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        mMainHandler = new Handler(getMainLooper());
-        mMainHandler.postDelayed(this::finish, 6000);
-    }
-}
diff --git a/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/XWalletRoleHolderApduService.java b/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/XWalletRoleHolderApduService.java
deleted file mode 100644
index 6198524..0000000
--- a/tests/tests/nfc/WalletRoleHolderApp/src/com/android/test/walletroleholder/XWalletRoleHolderApduService.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.test.walletroleholder;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.nfc.cardemulation.HostApduService;
-import android.nfc.cardemulation.PollingFrame;
-import android.os.Bundle;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class XWalletRoleHolderApduService extends HostApduService {
-
-    @Override
-    public void processPollingFrames(List<PollingFrame> frames) {
-        ArrayList<PollingFrame> framesArrayList = new ArrayList<>(frames);
-        final Intent intent = new Intent();
-        intent.setAction("com.cts.PollingLoopFired");
-        intent.putExtra("class_name", this.getClass().getName());
-        intent.putParcelableArrayListExtra("frames", framesArrayList);
-        intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
-        intent.setComponent(
-                new ComponentName("android.nfc.cts",
-                        "android.nfc.cts.PollingLoopBroadcastReceiver"));
-        sendBroadcast(intent);
-    }
-
-    @Override
-    public byte[] processCommandApdu(byte[] commandApdu, Bundle extras) {
-        return new byte[0];
-    }
-
-    @Override
-    public void onDeactivated(int reason) {
-        return;
-    }
-}
diff --git a/tests/tests/nfc/res/layout/activity_main.xml b/tests/tests/nfc/res/layout/activity_main.xml
deleted file mode 100644
index 9f95508..0000000
--- a/tests/tests/nfc/res/layout/activity_main.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ Copyright (C) 2024 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT 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:app="http://schemas.android.com/apk/res-auto"
-    android:id="@+id/activity_main"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
->
-</LinearLayout>
diff --git a/tests/tests/nfc/res/values/config.xml b/tests/tests/nfc/res/values/config.xml
deleted file mode 100644
index ff6965b..0000000
--- a/tests/tests/nfc/res/values/config.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
-  ~ Copyright (C) 2022 The Android Open Source Project
-  ~
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
-  ~ you may not use this file except in compliance with the License.
-  ~ You may obtain a copy of the License at
-  ~
-  ~      http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~ Unless required by applicable law or agreed to in writing, software
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
-  ~ WITHOUT 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>
-    <!-- NFC Antenna Location API -->
-    <integer name="device_width">111</integer>
-    <integer name="device_height">112</integer>
-    <bool name="device_foldable">true</bool>
-    <integer-array name="antenna_x">12</integer-array>
-    <integer-array name="antenna_y">13</integer-array>
-</resources>
\ No newline at end of file
diff --git a/tests/tests/nfc/res/values/strings.xml b/tests/tests/nfc/res/values/strings.xml
deleted file mode 100644
index 3bd3402..0000000
--- a/tests/tests/nfc/res/values/strings.xml
+++ /dev/null
@@ -1,29 +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.
--->
-<resources>
-    <string name="CtsPaymentService">CTS Nfc Test Service</string>
-    <string name="CtsOffHostPaymentService">CTS Nfc Off Host Test Service</string>
-    <string name="CtsOffHostDefaultToObservePaymentService">CTS Nfc Off Host Default to Observe Test Service</string>
-    <string name="CtsCustomPaymentService">CTS Nfc Custom Test Service</string>
-    <string name="CtsBackgroundPaymentService">CTS Nfc Background Test Service</string>
-    <string name="nfc_scan_tag">Place device on a writable NDEF tag</string>
-    <string name="nfc_scan_tag_again">Place tag on device again to verify that contents match</string>
-    <string name="nfc_wrong_tag_title">Wrong type of tag scanned</string>
-    <string name="nfc_writing_tag_error">Error writing NFC tag</string>
-    <string name="nfc_reading_tag_error">Error reading NFC tag</string>
-    <string name="nfc_successful_write">Successful write. Moved to verify</string>
-    <string name="nfc_ndef_content">Id: %1$s\nMime: %2$s\nPayload: %3$s</string>
-</resources>
diff --git a/tests/tests/nfc/res/xml/background_aid_list.xml b/tests/tests/nfc/res/xml/background_aid_list.xml
deleted file mode 100644
index 63f0271..0000000
--- a/tests/tests/nfc/res/xml/background_aid_list.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
-    android:description="@string/CtsBackgroundPaymentService"
-    android:shouldDefaultToObserveMode="true">
-    <aid-group android:description="@string/CtsBackgroundPaymentService" android:category="payment">
-        <aid-filter android:name="A000000004101018"/>
-        <aid-filter android:name="A000000004101019"/>
-    </aid-group>
-    <polling-loop-filter android:name="9464965c"/>
-    <polling-loop-filter android:name="b652c8f0"/>
-    <polling-loop-filter android:name="70dca719"/>
-</host-apdu-service>
diff --git a/tests/tests/nfc/res/xml/custom_aid_list.xml b/tests/tests/nfc/res/xml/custom_aid_list.xml
deleted file mode 100644
index accc93f..0000000
--- a/tests/tests/nfc/res/xml/custom_aid_list.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
-    android:description="@string/CtsCustomPaymentService">
-    <aid-group android:description="@string/CtsCustomPaymentService" android:category="payment">
-        <aid-filter android:name="A000000004101018"/>
-    </aid-group>
-    <polling-loop-filter android:name="9464965c"/>
-    <polling-loop-filter android:name="b652c8f0"/>
-    <polling-loop-filter android:name="70dca719"/>
-    <polling-loop-filter android:name="261c0050"/>
-    <polling-loop-filter android:name="7f71156b" android:autoTransact="true"/>"
-    <polling-loop-filter android:name="b0343a5e" android:autoTransact="true"/>
-    <polling-loop-pattern-filter android:name="ae24db68.*"/>
-</host-apdu-service>
diff --git a/tests/tests/nfc/res/xml/offhost_apdu_service.xml b/tests/tests/nfc/res/xml/offhost_apdu_service.xml
deleted file mode 100644
index 5516f3e..0000000
--- a/tests/tests/nfc/res/xml/offhost_apdu_service.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<offhost-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
-       android:description="@string/CtsOffHostPaymentService">
-    <aid-group android:description="@string/CtsOffHostPaymentService" android:category="payment">
-        <aid-filter android:name="A000000004101014"/>
-    </aid-group>
- </offhost-apdu-service>
\ No newline at end of file
diff --git a/tests/tests/nfc/res/xml/offhost_apdu_service_default_to_observe.xml b/tests/tests/nfc/res/xml/offhost_apdu_service_default_to_observe.xml
deleted file mode 100644
index 28b2aa9..0000000
--- a/tests/tests/nfc/res/xml/offhost_apdu_service_default_to_observe.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<offhost-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
-       android:description="@string/CtsOffHostDefaultToObservePaymentService"
-       android:shouldDefaultToObserveMode="true">
-    <aid-group android:description="@string/CtsOffHostDefaultToObservePaymentService" android:category="payment">
-        <aid-filter android:name="A000000004101025"/>
-    </aid-group>
-</offhost-apdu-service>
diff --git a/tests/tests/nfc/res/xml/payment_aid_list.xml b/tests/tests/nfc/res/xml/payment_aid_list.xml
deleted file mode 100644
index ebc7f9c..0000000
--- a/tests/tests/nfc/res/xml/payment_aid_list.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
-    android:description="@string/CtsPaymentService">
-    <aid-group android:description="@string/CtsPaymentService" android:category="payment">
-        <aid-filter android:name="A000000004101011"/>
-        <aid-filter android:name="A000000004101012"/>
-        <aid-filter android:name="A000000004101013"/>
-    </aid-group>
-    <polling-loop-filter android:name="b652c8f0"/>
-</host-apdu-service>
diff --git a/tests/tests/nfc/src/android/nfc/cts/AidGroupTest.java b/tests/tests/nfc/src/android/nfc/cts/AidGroupTest.java
deleted file mode 100644
index b8b3031..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/AidGroupTest.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import static android.nfc.cardemulation.CardEmulation.CATEGORY_PAYMENT;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeTrue;
-
-import android.content.pm.PackageManager;
-import android.nfc.Flags;
-import android.nfc.cardemulation.AidGroup;
-import android.os.Parcel;
-import android.os.RemoteException;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-import android.platform.test.flag.junit.CheckFlagsRule;
-import android.platform.test.flag.junit.DeviceFlagsValueProvider;
-import android.util.Xml;
-import android.util.proto.ProtoOutputStream;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.MockitoAnnotations;
-import org.xmlpull.v1.XmlPullParser;
-import org.xmlpull.v1.XmlSerializer;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
-import java.util.ArrayList;
-import java.util.List;
-
-@RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_MAINLINE)
-@RunWith(AndroidJUnit4.class)
-public class AidGroupTest {
-    private static final String AID_1 = "00000000000000";
-    private static final String AID_2 = "00000000000001";
-    private static final String DESCRIPTION = "Description";
-
-    @Rule
-    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
-
-    private final List<String> mAids = new ArrayList<>();
-
-    private boolean supportsHardware() {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        return pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION);
-    }
-
-    @Before
-    public void setUp() throws NoSuchFieldException, RemoteException {
-        MockitoAnnotations.initMocks(this);
-        assumeTrue(supportsHardware());
-
-        mAids.add(AID_1);
-        mAids.add(AID_2);
-    }
-
-    @Test
-    public void test_Constructor() {
-        AidGroup aidGroup = new AidGroup(mAids, CATEGORY_PAYMENT);
-
-        assertEquals(aidGroup.getAids(), mAids);
-        assertEquals(aidGroup.getCategory(), CATEGORY_PAYMENT);
-
-    }
-
-    @Test
-    public void test_ReadWriteParcel() {
-        AidGroup aidGroup = new AidGroup(mAids, CATEGORY_PAYMENT);
-        Parcel p = Parcel.obtain();
-        aidGroup.writeToParcel(p, 0);
-        p.setDataPosition(0);
-
-        AidGroup newAidGroup = AidGroup.CREATOR.createFromParcel(p);
-
-        assertEquals(aidGroup.getAids(), newAidGroup.getAids());
-        assertEquals(aidGroup.getCategory(), newAidGroup.getCategory());
-    }
-
-    @Test
-    public void test_ReadWriteXml() throws Exception {
-        AidGroup aidGroup = new AidGroup(mAids, CATEGORY_PAYMENT);
-
-        XmlSerializer serializer = Xml.newSerializer();
-        ByteArrayOutputStream out = new ByteArrayOutputStream();
-        serializer.setOutput(out, StandardCharsets.UTF_8.name());
-        aidGroup.writeAsXml(serializer);
-        serializer.flush();
-
-        final XmlPullParser parser = Xml.newPullParser();
-        final InputStream in = new ByteArrayInputStream(out.toByteArray());
-        parser.setInput(in, StandardCharsets.UTF_8.name());
-        AidGroup newAidGroup = AidGroup.createFromXml(parser);
-
-        assertEquals(aidGroup.getAids(), newAidGroup.getAids());
-        assertEquals(aidGroup.getCategory(), newAidGroup.getCategory());
-    }
-
-    @Test
-    public void test_Dump() throws Exception {
-        AidGroup aidGroup = new AidGroup(mAids, CATEGORY_PAYMENT);
-        ProtoOutputStream po = new ProtoOutputStream();
-        aidGroup.dump(po);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/ApduServiceInfoTest.java b/tests/tests/nfc/src/android/nfc/cts/ApduServiceInfoTest.java
deleted file mode 100644
index 9f3b1b3..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/ApduServiceInfoTest.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import static android.nfc.cardemulation.CardEmulation.CATEGORY_OTHER;
-import static android.nfc.cardemulation.CardEmulation.CATEGORY_PAYMENT;
-
-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.Assume.assumeTrue;
-
-import android.content.ComponentName;
-import android.content.Intent;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.pm.ServiceInfo;
-import android.nfc.Flags;
-import android.nfc.cardemulation.AidGroup;
-import android.nfc.cardemulation.ApduServiceInfo;
-import android.nfc.cardemulation.CardEmulation;
-import android.nfc.cardemulation.HostApduService;
-import android.os.Parcel;
-import android.os.ParcelFileDescriptor;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-import android.platform.test.flag.junit.CheckFlagsRule;
-import android.platform.test.flag.junit.DeviceFlagsValueProvider;
-import android.util.proto.ProtoOutputStream;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.MockitoAnnotations;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.regex.Pattern;
-
-@RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_MAINLINE)
-@RunWith(AndroidJUnit4.class)
-public class ApduServiceInfoTest {
-    private static final String AID_1 = "00000000000000";
-    private static final String AID_2 = "00000000000001";
-    private static final String SERVICE_PACKAGE_NAME = "com.nfc.test";
-    private static final String SERVICE_NAME = "hce_service";
-
-    @Rule
-    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
-
-    private final ArrayList<AidGroup> mDynamicAidGroups = new ArrayList<>();
-    private final ResolveInfo mResolveInfo = new ResolveInfo();
-
-    private boolean supportsHardware() {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        return pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION);
-    }
-
-    @Before
-    public void setUp() throws NoSuchFieldException, RemoteException {
-        MockitoAnnotations.initMocks(this);
-        assumeTrue(supportsHardware());
-
-        ArrayList<String> aids = new ArrayList<String>();
-        aids.add(AID_1);
-        aids.add(AID_2);
-        AidGroup aidGroup = new AidGroup(aids, CardEmulation.CATEGORY_PAYMENT);
-        mDynamicAidGroups.add(aidGroup);
-
-        ServiceInfo serviceInfo = new ServiceInfo();
-        serviceInfo.packageName = SERVICE_PACKAGE_NAME;
-        serviceInfo.name = SERVICE_NAME;
-        serviceInfo.applicationInfo = new ApplicationInfo();
-        mResolveInfo.serviceInfo = serviceInfo;
-    }
-
-    @Test
-    public void test_Constructor() {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false, "",
-                new ArrayList<>(), mDynamicAidGroups, false, 0, 0, "", "", "");
-
-        assertEquals(apduServiceInfo.getComponent(),
-                new ComponentName(SERVICE_PACKAGE_NAME, SERVICE_NAME));
-        assertEquals(apduServiceInfo.getOffHostSecureElement(), "");
-        assertEquals(apduServiceInfo.getAids(), mDynamicAidGroups.get(0).getAids());
-        assertTrue(apduServiceInfo.getPrefixAids().isEmpty());
-        assertTrue(apduServiceInfo.getSubsetAids().isEmpty());
-        assertEquals(apduServiceInfo.getDynamicAidGroupForCategory(CATEGORY_PAYMENT).getAids(),
-                mDynamicAidGroups.get(0).getAids());
-        assertFalse(apduServiceInfo.removeDynamicAidGroupForCategory(CATEGORY_OTHER));
-        assertEquals(apduServiceInfo.getAidGroups().get(0).getAids(),
-                mDynamicAidGroups.get(0).getAids());
-        assertEquals(apduServiceInfo.getCategoryForAid(AID_1), CATEGORY_PAYMENT);
-        assertTrue(apduServiceInfo.hasCategory(CATEGORY_PAYMENT));
-        assertFalse(apduServiceInfo.isOnHost());
-        assertFalse(apduServiceInfo.requiresUnlock());
-        assertFalse(apduServiceInfo.requiresScreenOn());
-        assertEquals(apduServiceInfo.getDescription(), "");
-        assertEquals(apduServiceInfo.getUid(), 0);
-        assertEquals(apduServiceInfo.getSettingsActivityName(), "");
-    }
-
-    private ResolveInfo findServiceResolveInfo(ComponentName componentName) {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        List<ResolveInfo> resolvedServices = pm.queryIntentServicesAsUser(
-                new Intent(HostApduService.SERVICE_INTERFACE),
-                PackageManager.ResolveInfoFlags.of(PackageManager.GET_META_DATA),
-                UserHandle.SYSTEM);
-        for (ResolveInfo resolvedService : resolvedServices) {
-            if (resolvedService.getComponentInfo().getComponentName().equals(componentName)) {
-                return resolvedService;
-            }
-        }
-        return null;
-    }
-
-    private ResolveInfo findForegroundServiceResolveInfo() {
-        return findServiceResolveInfo(WalletRoleTestUtils.getForegroundService());
-    }
-
-    @Test
-    public void test_Constructor_ParseManifest_ForegroundService() throws Exception {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        ResolveInfo resolvedService = findForegroundServiceResolveInfo();
-        assertNotNull(resolvedService);
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(pm, resolvedService, true);
-
-        assertEquals(apduServiceInfo.getComponent(), WalletRoleTestUtils.getForegroundService());
-        assertNull(apduServiceInfo.getOffHostSecureElement());
-        ArrayList<String> aids = new ArrayList<String>();
-        aids.add("A000000004101011");
-        aids.add("A000000004101012");
-        aids.add("A000000004101013");
-        AidGroup expectedAidGroup = new AidGroup(aids, CardEmulation.CATEGORY_PAYMENT);
-        assertEquals(apduServiceInfo.getAids(), aids);
-        AidGroup actualAidGroup = apduServiceInfo.getAidGroups().get(0);
-        assertEquals(expectedAidGroup.getCategory(), actualAidGroup.getCategory());
-        assertEquals(expectedAidGroup.getAids(), actualAidGroup.getAids());
-        assertEquals(apduServiceInfo.getCategoryForAid("A000000004101011"), CATEGORY_PAYMENT);
-        assertTrue(apduServiceInfo.hasCategory(CATEGORY_PAYMENT));
-        assertTrue(apduServiceInfo.isOnHost());
-        assertFalse(apduServiceInfo.requiresUnlock());
-        assertTrue(apduServiceInfo.requiresScreenOn());
-        assertEquals(apduServiceInfo.getDescription(), "Foreground CTS Nfc Test Service");
-    }
-
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_ASSOCIATED_ROLE_SERVICES)
-    @Test
-    public void test_Constructor_ParseManifest_AssociatedApduService() throws Exception {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        ResolveInfo resolvedService = findServiceResolveInfo(
-                WalletRoleTestUtils.getAssociatedService());
-        assertNotNull(resolvedService);
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(pm, resolvedService, true);
-        assertTrue(apduServiceInfo.wantsRoleHolderPriority());
-    }
-
-    @Test
-    public void test_ReadWriteParcel() {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false, "",
-                new ArrayList<>(), mDynamicAidGroups, false, 0, 0, "", "", "");
-        Parcel p = Parcel.obtain();
-        apduServiceInfo.writeToParcel(p, 0);
-        p.setDataPosition(0);
-
-        ApduServiceInfo newApduServiceInfo = ApduServiceInfo.CREATOR.createFromParcel(p);
-        assertEquals(apduServiceInfo.getComponent(), newApduServiceInfo.getComponent());
-        assertEquals(apduServiceInfo.getOffHostSecureElement(),
-                newApduServiceInfo.getOffHostSecureElement());
-        assertEquals(apduServiceInfo.getAids(), newApduServiceInfo.getAids());
-        assertEquals(apduServiceInfo.getPrefixAids(), newApduServiceInfo.getPrefixAids());
-        assertEquals(apduServiceInfo.getSubsetAids(), newApduServiceInfo.getSubsetAids());
-        assertEquals(apduServiceInfo.getDynamicAidGroupForCategory(CATEGORY_PAYMENT).getAids(),
-                newApduServiceInfo.getDynamicAidGroupForCategory(CATEGORY_PAYMENT).getAids());
-        assertFalse(newApduServiceInfo.removeDynamicAidGroupForCategory(CATEGORY_OTHER));
-        assertEquals(apduServiceInfo.getAidGroups().get(0).getAids(),
-                newApduServiceInfo.getAidGroups().get(0).getAids());
-        assertEquals(apduServiceInfo.getCategoryForAid(AID_1),
-                newApduServiceInfo.getCategoryForAid(AID_1));
-        assertEquals(apduServiceInfo.hasCategory(CATEGORY_PAYMENT),
-                newApduServiceInfo.hasCategory(CATEGORY_PAYMENT));
-        assertEquals(apduServiceInfo.isOnHost(), newApduServiceInfo.isOnHost());
-        assertEquals(apduServiceInfo.requiresUnlock(), newApduServiceInfo.requiresUnlock());
-        assertEquals(apduServiceInfo.requiresScreenOn(), newApduServiceInfo.requiresScreenOn());
-        assertEquals(apduServiceInfo.getDescription(), newApduServiceInfo.getDescription());
-        assertEquals(apduServiceInfo.getUid(), newApduServiceInfo.getUid());
-        assertEquals(apduServiceInfo.getSettingsActivityName(),
-                newApduServiceInfo.getSettingsActivityName());
-    }
-
-    @Test
-    public void test_Equals() throws Exception {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false, "",
-                new ArrayList<>(), mDynamicAidGroups, false, 0, 0, "", "", "");
-        ApduServiceInfo newApduServiceInfo = new ApduServiceInfo(mResolveInfo, false, "",
-                new ArrayList<>(), mDynamicAidGroups, false, 0, 0, "", "", "");
-
-        assertEquals(apduServiceInfo, newApduServiceInfo);
-    }
-
-    @Test
-    public void test_Dump() throws Exception {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false, "",
-                new ArrayList<>(), mDynamicAidGroups, false, 0, 0, "", "", "");
-        ParcelFileDescriptor pfd = new ParcelFileDescriptor(Parcel.obtain().readFileDescriptor());
-        PrintWriter pw = new PrintWriter(new ByteArrayOutputStream());
-        apduServiceInfo.dump(pfd, pw, new String[0]);
-    }
-
-    @Test
-    public void test_DumpDebug() throws Exception {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false, "",
-                new ArrayList<>(), mDynamicAidGroups, false, 0, 0, "", "", "");
-        ProtoOutputStream po = new ProtoOutputStream();
-        apduServiceInfo.dumpDebug(po);
-    }
-
-    @Test
-    public void test_SetDynamicAidGroup() throws Exception {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false, "",
-                new ArrayList<>(), mDynamicAidGroups, false, 0, 0, "", "", "");
-
-        assertFalse(apduServiceInfo.hasCategory(CATEGORY_OTHER));
-
-        ArrayList<String> aids = new ArrayList<String>();
-        aids.add(AID_1);
-        aids.add(AID_2);
-        AidGroup aidGroup = new AidGroup(aids, CATEGORY_OTHER);
-        apduServiceInfo.setDynamicAidGroup(aidGroup);
-        assertTrue(apduServiceInfo.hasCategory(CATEGORY_OTHER));
-    }
-
-    @Test
-    public void test_SetResetOffHostSecureElement() throws Exception {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false, "",
-                new ArrayList<>(), mDynamicAidGroups, false, 0, 0, "", "", "");
-
-        assertEquals(apduServiceInfo.getOffHostSecureElement(), "");
-
-        apduServiceInfo.setOffHostSecureElement("SIM");
-        assertEquals(apduServiceInfo.getOffHostSecureElement(), "SIM");
-
-        apduServiceInfo.resetOffHostSecureElement();
-        assertEquals(apduServiceInfo.getOffHostSecureElement(), "");
-    }
-
-    @Test
-    public void test_LoadLabel() throws Exception {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false, "",
-                new ArrayList<>(), mDynamicAidGroups, false, 0, 0, "", "", "");
-
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        assertEquals(apduServiceInfo.loadLabel(pm), SERVICE_NAME);
-        assertNull(apduServiceInfo.loadAppLabel(pm));
-        assertNotNull(apduServiceInfo.loadIcon(pm));
-        assertNull(apduServiceInfo.loadBanner(pm));
-    }
-
-    @Test
-    public void test_SetOtherServiceStateSelected() throws Exception {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false, "",
-                new ArrayList<>(), mDynamicAidGroups, false, 0, 0, "", "", "");
-
-        assertFalse(apduServiceInfo.isCategoryOtherServiceEnabled());
-
-        apduServiceInfo.setCategoryOtherServiceEnabled(true);
-        assertTrue(apduServiceInfo.isCategoryOtherServiceEnabled());
-    }
-
-    @Test
-    public void test_offHostService_addPollingLoopFilter() {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false,
-                "", new ArrayList<>(), mDynamicAidGroups, false,
-                0, 0, "", "", "");
-        String plFilter1 = "plFilter1";
-        String plFilter2 = "plFilter2";
-
-        apduServiceInfo.addPollingLoopFilter(plFilter1, true);
-        apduServiceInfo.addPollingLoopFilter(plFilter2, false);
-
-        List<String> addedFilters = apduServiceInfo.getPollingLoopFilters();
-        assertTrue(addedFilters.contains(plFilter1));
-        assertEquals(1, addedFilters.size());
-    }
-
-    @Test
-    public void test_onHostService_addPollingLoopFilter() {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, true,
-                "", new ArrayList<>(), mDynamicAidGroups, false,
-                0, 0, "", "", "");
-        String plFilter1 = "plFilter1";
-        String plFilter2 = "plFilter2";
-
-        apduServiceInfo.addPollingLoopFilter(plFilter1, true);
-        apduServiceInfo.addPollingLoopFilter(plFilter2, false);
-
-        List<String> addedFilters = apduServiceInfo.getPollingLoopFilters();
-        assertTrue(addedFilters.contains(plFilter1));
-        assertTrue(addedFilters.contains(plFilter2));
-        assertEquals(2, addedFilters.size());
-    }
-
-    @Test
-    public void test_offHostService_addPollingLoopFilter_sameFilterTwice() {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false,
-                "", new ArrayList<>(), mDynamicAidGroups, false,
-                0, 0, "", "", "");
-        String plFilter1 = "plFilter1";
-        String plFilter2 = "plFilter2";
-
-        apduServiceInfo.addPollingLoopFilter(plFilter1, true);
-        apduServiceInfo.addPollingLoopFilter(plFilter1, true);
-        apduServiceInfo.addPollingLoopFilter(plFilter2, false);
-
-        List<String> addedFilters = apduServiceInfo.getPollingLoopFilters();
-        assertTrue(addedFilters.contains(plFilter1));
-        assertEquals(1, addedFilters.size());
-    }
-
-    @Test
-    public void test_offHostService_addPollingLoopPatternFilter() {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false,
-                "", new ArrayList<>(), mDynamicAidGroups, false,
-                0, 0, "", "", "");
-        String plFilter1 = "plFilter1";
-        String plFilter2 = "plFilter2";
-
-        apduServiceInfo.addPollingLoopPatternFilter(plFilter1, true);
-        apduServiceInfo.addPollingLoopPatternFilter(plFilter2, false);
-
-        List<String> addedFilters = apduServiceInfo.getPollingLoopPatternFilters().stream().map(
-                Pattern::pattern).toList();
-        assertTrue(addedFilters.contains(plFilter1));
-        assertEquals(1, addedFilters.size());
-    }
-
-    @Test
-    public void test_onHostService_addPollingLoopPatternFilter() {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, true,
-                "", new ArrayList<>(), mDynamicAidGroups, false,
-                0, 0, "", "", "");
-        String plFilter1 = "plFilter1";
-        String plFilter2 = "plFilter2";
-
-        apduServiceInfo.addPollingLoopPatternFilter(plFilter1, true);
-        apduServiceInfo.addPollingLoopPatternFilter(plFilter2, false);
-
-        List<String> addedFilters = apduServiceInfo.getPollingLoopPatternFilters().stream().map(
-                Pattern::pattern).toList();
-        assertTrue(addedFilters.contains(plFilter1));
-        assertTrue(addedFilters.contains(plFilter2));
-        assertEquals(2, addedFilters.size());
-    }
-
-    @Test
-    public void test_offHostService_addPollingLoopPatternFilter_sameFilterTwice() {
-        ApduServiceInfo apduServiceInfo = new ApduServiceInfo(mResolveInfo, false,
-                "", new ArrayList<>(), mDynamicAidGroups, false,
-                0, 0, "", "", "");
-        String plFilter1 = "plFilter1";
-        String plFilter2 = "plFilter2";
-
-        apduServiceInfo.addPollingLoopPatternFilter(plFilter1, true);
-        apduServiceInfo.addPollingLoopPatternFilter(plFilter1, true);
-        apduServiceInfo.addPollingLoopPatternFilter(plFilter2, false);
-
-        List<String> addedFilters = apduServiceInfo.getPollingLoopPatternFilters().stream().map(
-                Pattern::pattern).toList();
-        assertTrue(addedFilters.contains(plFilter1));
-        assertEquals(1, addedFilters.size());
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/BackgroundHostApduService.java b/tests/tests/nfc/src/android/nfc/cts/BackgroundHostApduService.java
deleted file mode 100644
index cf6719a..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/BackgroundHostApduService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import android.nfc.cardemulation.PollingFrame;
-
-import java.util.List;
-
-public class BackgroundHostApduService extends CtsMyHostApduService {
-
-    @Override
-    public void processPollingFrames(List<PollingFrame> frames) {
-        if (CardEmulationTest.sCurrentPollLoopReceiver != null) {
-            CardEmulationTest.sCurrentPollLoopReceiver.notifyPollingLoop(this.getClass().getName(),
-                    frames);
-        }
-    }
-
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/CardEmulationTest.java b/tests/tests/nfc/src/android/nfc/cts/CardEmulationTest.java
deleted file mode 100644
index 884ea5a..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/CardEmulationTest.java
+++ /dev/null
@@ -1,2559 +0,0 @@
-package android.nfc.cts;
-
-import static android.nfc.cardemulation.CardEmulation.SET_SERVICE_ENABLED_STATUS_OK;
-import static android.nfc.cts.WalletRoleTestUtils.CTS_PACKAGE_NAME;
-import static android.nfc.cts.WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME;
-import static android.nfc.cts.WalletRoleTestUtils.WALLET_HOLDER_SERVICE_DESC;
-import static android.nfc.cts.WalletRoleTestUtils.getWalletRoleHolderService;
-import static android.nfc.cts.WalletRoleTestUtils.runWithRole;
-import static android.nfc.cts.WalletRoleTestUtils.runWithRoleNone;
-
-import static com.android.compatibility.common.util.PropertyUtil.getVsrApiLevel;
-import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
-
-import static org.junit.Assume.assumeFalse;
-import static org.junit.Assume.assumeTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyBoolean;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.when;
-
-import android.annotation.NonNull;
-import android.app.Activity;
-import android.app.Instrumentation;
-import android.app.KeyguardManager;
-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.content.pm.ResolveInfo;
-import android.database.ContentObserver;
-import android.net.Uri;
-import android.nfc.Flags;
-import android.nfc.INfcCardEmulation;
-import android.nfc.NfcAdapter;
-import android.nfc.cardemulation.AidGroup;
-import android.nfc.cardemulation.ApduServiceInfo;
-import android.nfc.cardemulation.CardEmulation;
-import android.nfc.cardemulation.PollingFrame;
-import android.nfc.cardemulation.PollingFrame.PollingFrameType;
-import android.os.Build;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.os.Looper;
-import android.os.PowerManager;
-import android.os.RemoteException;
-import android.os.UserManager;
-import android.platform.test.annotations.RequiresFlagsDisabled;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-import android.platform.test.flag.junit.CheckFlagsRule;
-import android.platform.test.flag.junit.DeviceFlagsValueProvider;
-import android.provider.Settings;
-import android.testing.PollingCheck;
-import android.view.KeyEvent;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.compatibility.common.util.CommonTestUtils;
-import com.android.compatibility.common.util.SystemUtil;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.internal.util.reflection.FieldReader;
-import org.mockito.internal.util.reflection.FieldSetter;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HexFormat;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-@RunWith(JUnit4.class)
-public class CardEmulationTest {
-    private NfcAdapter mAdapter;
-
-    private static final ComponentName mService =
-        new ComponentName("android.nfc.cts", "android.nfc.cts.CtsMyHostApduService");
-
-    private Context mContext;
-    private INfcCardEmulation mOldService;
-    @Mock private INfcCardEmulation mEmulation;
-
-    @Rule
-    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
-
-    private boolean supportsHardware() {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        return pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION);
-    }
-
-    private boolean supportsHardwareForEse() {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        return pm.hasSystemFeature(PackageManager.FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE);
-    }
-
-    @Before
-    public void setUp() throws NoSuchFieldException, RemoteException {
-        MockitoAnnotations.initMocks(this);
-        assumeTrue("Device must support NFC HCE", supportsHardware());
-        mContext = InstrumentationRegistry.getContext();
-        mAdapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertNotNull(mAdapter);
-        assumeTrue(NfcUtils.enableNfc(mAdapter, mContext));
-
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        FieldReader serviceField = new FieldReader(instance,
-                instance.getClass().getDeclaredField("sService"));
-        mOldService = (INfcCardEmulation) serviceField.read();
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        if (!supportsHardware()) return;
-        restoreOriginalService();
-        sCurrentPollLoopReceiver = null;
-    }
-
-    private void restoreOriginalService() throws NoSuchFieldException {
-        if (mAdapter != null) {
-            CardEmulation instance = CardEmulation.getInstance(mAdapter);
-            FieldSetter.setField(instance,
-                    instance.getClass().getDeclaredField("sService"), mOldService);
-        }
-    }
-
-    private void setMockService() throws NoSuchFieldException {
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        FieldSetter.setField(instance, instance.getClass().getDeclaredField("sService"),
-                mEmulation);
-    }
-
-    @Test
-    public void getNonNullInstance() {
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        Assert.assertNotNull(instance);
-    }
-
-    @Test
-    public void testIsDefaultServiceForCategory() throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        when(mEmulation.isDefaultServiceForCategory(anyInt(), any(ComponentName.class),
-            anyString())).thenReturn(true);
-        boolean result = instance.isDefaultServiceForCategory(mService,
-            CardEmulation.CATEGORY_PAYMENT);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testIsDefaultServiceForAid() throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        String aid = "00000000000000";
-        when(mEmulation.isDefaultServiceForAid(anyInt(), any(ComponentName.class), anyString()))
-            .thenReturn(true);
-        boolean result = instance.isDefaultServiceForAid(mService, aid);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testCategoryAllowsForegroundPreferenceWithCategoryPayment() {
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        boolean result
-            = instance.categoryAllowsForegroundPreference(CardEmulation.CATEGORY_PAYMENT);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testCategoryAllowsForegroundPrefenceWithCategoryOther() {
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        boolean result
-            = instance.categoryAllowsForegroundPreference(CardEmulation.CATEGORY_OTHER);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testGetSelectionModeForCategoryWithCategoryPaymentAndPaymentRegistered()
-        throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        when(mEmulation.isDefaultPaymentRegistered()).thenReturn(true);
-        int result = instance.getSelectionModeForCategory(CardEmulation.CATEGORY_PAYMENT);
-        Assert.assertEquals(CardEmulation.SELECTION_MODE_PREFER_DEFAULT, result);
-    }
-
-    @Test
-    public void testGetSelectionModeForCategoryWithCategoryPaymentAndWithoutPaymentRegistered()
-        throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        when(mEmulation.isDefaultPaymentRegistered()).thenReturn(false);
-        int result = instance.getSelectionModeForCategory(CardEmulation.CATEGORY_PAYMENT);
-        Assert.assertEquals(CardEmulation.SELECTION_MODE_ALWAYS_ASK, result);
-    }
-
-    @Test
-    public void testGetSelectionModeForCategoryWithCategoryOther() {
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        int result = instance.getSelectionModeForCategory(CardEmulation.CATEGORY_OTHER);
-        Assert.assertEquals(CardEmulation.SELECTION_MODE_ASK_IF_CONFLICT, result);
-    }
-
-    @Test
-    public void testRegisterAidsForService() throws NoSuchFieldException, RemoteException {
-        ArrayList<String> aids = new ArrayList<String>();
-        aids.add("00000000000000");
-        CardEmulation cardEmulation = createMockedInstance();
-        when(mEmulation.registerAidGroupForService(anyInt(), any(ComponentName.class), any()))
-                .thenReturn(true);
-        Assert.assertTrue(cardEmulation.registerAidsForService(mService,
-                CardEmulation.CATEGORY_PAYMENT, aids));
-    }
-
-    @Test
-    public void testUnsetOffHostForService() throws NoSuchFieldException, RemoteException {
-        assumeTrue("Device must support eSE off-host HCE", supportsHardwareForEse());
-        CardEmulation instance = createMockedInstance();
-        when(mEmulation.unsetOffHostForService(anyInt(), any(ComponentName.class)))
-            .thenReturn(true);
-        boolean result = instance.unsetOffHostForService(mService);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testSetOffHostForService() throws NoSuchFieldException, RemoteException {
-        assumeTrue("Device must support eSE off-host HCE", supportsHardwareForEse());
-        CardEmulation instance = createMockedInstance();
-        String offHostSecureElement = "eSE";
-        when(mEmulation.setOffHostForService(anyInt(), any(ComponentName.class), anyString()))
-            .thenReturn(true);
-        boolean result = instance.setOffHostForService(mService, offHostSecureElement);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testGetAidsForService() throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        ArrayList<String> aids = new ArrayList<String>();
-        aids.add("00000000000000");
-        AidGroup aidGroup = new AidGroup(aids, CardEmulation.CATEGORY_PAYMENT);
-        when(mEmulation.getAidGroupForService(anyInt(), any(ComponentName.class), anyString()))
-            .thenReturn(aidGroup);
-        List<String> result = instance.getAidsForService(mService, CardEmulation.CATEGORY_PAYMENT);
-        Assert.assertEquals(aids, result);
-    }
-
-    @Test
-    public void testRemoveAidsForService() throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        when(mEmulation.removeAidGroupForService(anyInt(), any(ComponentName.class), anyString()))
-            .thenReturn(true);
-        boolean result = instance.removeAidsForService(mService, CardEmulation.CATEGORY_PAYMENT);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testSetPreferredService() throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        Activity activity = createAndResumeActivity();
-        when(mEmulation.setPreferredService(any(ComponentName.class))).thenReturn(true);
-        boolean result = instance.setPreferredService(activity, mService);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testUnsetPreferredService() throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        Activity activity = createAndResumeActivity();
-        when(mEmulation.unsetPreferredService()).thenReturn(true);
-        boolean result = instance.unsetPreferredService(activity);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testSupportsAidPrefixRegistration() throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        when(mEmulation.supportsAidPrefixRegistration()).thenReturn(true);
-        boolean result = instance.supportsAidPrefixRegistration();
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testGetAidsForPreferredPaymentService() throws NoSuchFieldException,
-        RemoteException {
-        CardEmulation instance = createMockedInstance();
-        ArrayList<AidGroup> dynamicAidGroups = new ArrayList<AidGroup>();
-        ArrayList<String> aids = new ArrayList<String>();
-        aids.add("00000000000000");
-        AidGroup aidGroup = new AidGroup(aids, CardEmulation.CATEGORY_PAYMENT);
-        dynamicAidGroups.add(aidGroup);
-        ApduServiceInfo serviceInfo = new ApduServiceInfo(new ResolveInfo(), false, "",
-            new ArrayList<AidGroup>(), dynamicAidGroups, false, 0, 0, "", "", "");
-        when(mEmulation.getPreferredPaymentService(anyInt())).thenReturn(serviceInfo);
-        List<String> result = instance.getAidsForPreferredPaymentService();
-        Assert.assertEquals(aids, result);
-    }
-
-    @Test
-    public void testGetRouteDestinationForPreferredPaymentServiceWithOnHost()
-        throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        ApduServiceInfo serviceInfo = new ApduServiceInfo(new ResolveInfo(), /* onHost = */ true,
-            "", new ArrayList<AidGroup>(), new ArrayList<AidGroup>(), false, 0, 0, "", "", "");
-        when(mEmulation.getPreferredPaymentService(anyInt())).thenReturn(serviceInfo);
-        String result = instance.getRouteDestinationForPreferredPaymentService();
-        Assert.assertEquals("Host", result);
-    }
-
-    @Test
-    public void testGetRouteDestinationForPreferredPaymentServiceWithOffHostAndNoSecureElement()
-        throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        ApduServiceInfo serviceInfo = new ApduServiceInfo(new ResolveInfo(), /* onHost = */ false,
-            "", new ArrayList<AidGroup>(), new ArrayList<AidGroup>(), false, 0, 0, "",
-            /* offHost = */ null, "");
-        when(mEmulation.getPreferredPaymentService(anyInt())).thenReturn(serviceInfo);
-        String result = instance.getRouteDestinationForPreferredPaymentService();
-        Assert.assertEquals("OffHost", result);
-    }
-
-    @Test
-    public void testGetRouteDestinationForPreferredPaymentServiceWithOffHostAndSecureElement()
-        throws NoSuchFieldException, RemoteException {
-        assumeTrue("Device must support eSE off-host HCE", supportsHardwareForEse());
-        CardEmulation instance = createMockedInstance();
-        String offHostSecureElement = "OffHost Secure Element";
-        ApduServiceInfo serviceInfo = new ApduServiceInfo(new ResolveInfo(), /* onHost = */ false,
-            "", new ArrayList<AidGroup>(), new ArrayList<AidGroup>(), false, 0, 0, "",
-            /* offHost = */ offHostSecureElement, "");
-        when(mEmulation.getPreferredPaymentService(anyInt())).thenReturn(serviceInfo);
-        String result = instance.getRouteDestinationForPreferredPaymentService();
-        Assert.assertEquals(offHostSecureElement, result);
-    }
-
-    @Test
-    public void testGetDescriptionForPreferredPaymentService() throws NoSuchFieldException,
-        RemoteException {
-        CardEmulation instance = createMockedInstance();
-        String description = "Preferred Payment Service Description";
-        ApduServiceInfo serviceInfo = new ApduServiceInfo(new ResolveInfo(), false,
-            /* description */ description, new ArrayList<AidGroup>(), new ArrayList<AidGroup>(),
-            false, 0, 0, "", "", "");
-        when(mEmulation.getPreferredPaymentService(anyInt())).thenReturn(serviceInfo);
-        CharSequence result = instance.getDescriptionForPreferredPaymentService();
-        Assert.assertEquals(description, result);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_MAINLINE)
-    public void testGetServices() throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        String description = "Preferred Payment Service Description";
-        ApduServiceInfo serviceInfo = new ApduServiceInfo(new ResolveInfo(), false,
-                /* description */ description, new ArrayList<AidGroup>(), new ArrayList<AidGroup>(),
-                false, 0, 0, "", "", "");
-        List<ApduServiceInfo> services = List.of(serviceInfo);
-        when(mEmulation.getServices(anyInt(), anyString())).thenReturn(services);
-        Assert.assertEquals(instance.getServices(CardEmulation.CATEGORY_PAYMENT, 0), services);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testGetPreferredPaymentService() {
-        final String expectedPaymentService = "foo.bar/foo.bar.baz.Service";
-        Settings.Secure.putString(ApplicationProvider.getApplicationContext().getContentResolver(),
-                Settings.Secure.NFC_PAYMENT_DEFAULT_COMPONENT, expectedPaymentService);
-
-        ComponentName paymentService = CardEmulation.getPreferredPaymentService(
-                ApplicationProvider.getApplicationContext());
-
-        Assert.assertEquals(paymentService,
-                ComponentName.unflattenFromString(expectedPaymentService));
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testTypeAPollingLoopToDefault() {
-        assumeVsrApiGreaterThanUdc();
-        ComponentName originalDefault = null;
-        mAdapter.notifyHceDeactivated();
-        try {
-            originalDefault = setDefaultPaymentService(CustomHostApduService.class);
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(6);
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-            ensurePreferredService(CustomHostApduService.class);
-            notifyPollingLoopAndWait(new ArrayList<PollingFrame>(frames),
-                    CustomHostApduService.class.getName());
-        } finally {
-            setDefaultPaymentService(originalDefault);
-            mAdapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testTypeAPollingLoopToWalletHolder() {
-        assumeVsrApiGreaterThanUdc();
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME,
-                () -> {
-                    NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-                    adapter.notifyHceDeactivated();
-                    ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(6);
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-                    ensurePreferredService(WalletRoleTestUtils.WALLET_HOLDER_SERVICE_DESC);
-                    notifyPollingLoopAndWait(new ArrayList<PollingFrame>(frames),
-                            WalletRoleTestUtils.getWalletRoleHolderService().getClassName());
-                    adapter.notifyHceDeactivated();
-                });
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testCustomFrameToCustomInTwoFullLoops() {
-        assumeVsrApiGreaterThanUdc();
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME,
-                () -> {
-                    NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-                    adapter.notifyHceDeactivated();
-                    CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-                    ComponentName customServiceName = new ComponentName(mContext,
-                            CustomHostApduService.class);
-                    String testName = new Object() {
-                    }.getClass().getEnclosingMethod().getName();
-                    String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-                    Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(
-                            customServiceName,
-                            annotationStringHex, false));
-                    ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(6);
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-                    frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                            HexFormat.of().parseHex(annotationStringHex)));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-                    frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                            HexFormat.of().parseHex(annotationStringHex)));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-                    ensurePreferredService(WalletRoleTestUtils.WALLET_HOLDER_SERVICE_DESC);
-                    // Only the frames matching the filter should be delivered.
-                    notifyPollingLoopAndWait(new ArrayList<PollingFrame>(
-                                    Arrays.asList(frames.get(2), frames.get(6))),
-                            CustomHostApduService.class.getName());
-                    adapter.notifyHceDeactivated();
-                });
-    }
-
-    class EventPollLoopReceiver extends PollLoopReceiver implements CardEmulation.NfcEventCallback {
-        static final int OBSERVE_MODE = 1;
-        static final int PREFERRED_SERVICE = 2;
-        static final int AID_CONFLICT_OCCURRED = 3;
-        static final int AID_NOT_ROUTED = 4;
-        static final int NFC_STATE_CHANGED = 5;
-        static final int REMOTE_FIELD_CHANGED = 6;
-        static final int INTERNAL_ERROR_REPORTED = 7;
-        CountDownLatch mLatch = null;
-
-        Context mContext;
-
-        class EventLogEntry {
-            String mServicePackageName;
-            int mEventType;
-            Object mState;
-
-            EventLogEntry(String servicePackageName, int eventType, Object state) {
-                mServicePackageName = servicePackageName;
-                mEventType = eventType;
-                mState = state;
-            }
-        }
-
-        EventPollLoopReceiver(Context context) {
-          this(context, true);
-        }
-
-        EventPollLoopReceiver(Context context, boolean shouldBroadcastToRemoteEventListener) {
-            super(new ArrayList<>(), null);
-            mContext = context;
-            ExecutorService pool = Executors.newFixedThreadPool(2);
-            NfcAdapter adapter = NfcAdapter.getDefaultAdapter(context);
-            CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-            cardEmulation.registerNfcEventCallback(pool, this);
-
-            if (shouldBroadcastToRemoteEventListener) {
-                broadcastToRemoteEventListener();
-            }
-        }
-
-        private void broadcastToRemoteEventListener() {
-            CountDownLatch latch = new CountDownLatch(1);
-
-            final Intent intent = new Intent();
-            intent.setAction("com.cts.RegisterEventListener");
-            intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
-            intent.setComponent(
-                    new ComponentName("com.android.test.walletroleholder",
-                            "com.android.test.walletroleholder.WalletRoleBroadcastReceiver"));
-
-            HandlerThread handlerThread = new HandlerThread("broadcast_receiving_thread");
-            handlerThread.start();
-            Looper looper = handlerThread.getLooper();
-            Handler handler = new Handler(looper);
-            mContext.sendOrderedBroadcast(intent, null,
-                    new BroadcastReceiver() {
-                        @Override
-                        public void onReceive(Context context, Intent intent) {
-                            latch.countDown();
-                        }
-                    },
-                    handler, Activity.RESULT_OK, null, null);
-            try {
-                if (!latch.await(5, TimeUnit.SECONDS)) {
-                    Assert.fail("Did not receive the expected broadcast within the elapsed time");
-                }
-            } catch (InterruptedException ie) {
-            }
-            handlerThread.quit();
-        }
-
-        void cleanup() {
-            NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-            CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-            cardEmulation.unregisterNfcEventCallback(this);
-            final Intent intent = new Intent();
-            intent.setAction("com.cts.UnregisterEventListener");
-            intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
-            intent.setComponent(
-                    new ComponentName("com.android.test.walletroleholder",
-                            "com.android.test.walletroleholder.WalletRoleBroadcastReceiver"));
-            mContext.sendBroadcast(intent);
-        }
-
-        ArrayList<EventLogEntry> mEvents = new ArrayList<EventLogEntry>();
-
-        @Override
-        public void onObserveModeStateChanged(boolean isEnabled) {
-            onObserveModeStateChanged(mContext.getPackageName(), isEnabled);
-        }
-
-        @Override
-        public void onPreferredServiceChanged(boolean isPreferred) {
-            onPreferredServiceChanged(mContext.getPackageName(), isPreferred);
-        }
-
-        @Override
-        public void onObserveModeStateChanged(String pkgName, boolean isEnabled) {
-            synchronized (this) {
-                mEvents.add(new EventLogEntry(pkgName, OBSERVE_MODE, isEnabled));
-                if (mLatch != null) {
-                    mLatch.countDown();
-                }
-            }
-        }
-
-        @Override
-        public void onPreferredServiceChanged(String pkgName, boolean isPreferred) {
-            synchronized (this) {
-                mEvents.add(new EventLogEntry(pkgName, PREFERRED_SERVICE, isPreferred));
-                if (mLatch != null) {
-                    mLatch.countDown();
-                }
-            }
-        }
-
-        public void onListenersRegistered() {
-            if (mLatch != null) {
-                mLatch.countDown();
-            }
-        }
-
-        void setNumEventsToWaitFor(int numEvents) {
-            synchronized (this) {
-                mLatch = new CountDownLatch(numEvents);
-            }
-        }
-
-        void waitForEvents() {
-            try {
-                if (!mLatch.await(5, TimeUnit.SECONDS)) {
-                    Assert.fail("Did not receive all events within the elapsed time");
-                }
-            } catch (InterruptedException ie) {
-            }
-        }
-
-        @Override
-        public void onAidConflictOccurred(@NonNull String aid) {
-            synchronized (this) {
-                mEvents.add(new EventLogEntry(mContext.getPackageName(), AID_CONFLICT_OCCURRED,
-                        aid));
-                if (mLatch != null) {
-                    mLatch.countDown();
-                }
-            }
-        }
-
-        @Override
-        public void onAidNotRouted(@NonNull String aid) {
-            synchronized (this) {
-                mEvents.add(new EventLogEntry(mContext.getPackageName(), AID_NOT_ROUTED, aid));
-                if (mLatch != null) {
-                    mLatch.countDown();
-                }
-            }
-        }
-
-        @Override
-        public void onNfcStateChanged(int state) {
-            synchronized (this) {
-                mEvents.add(new EventLogEntry(mContext.getPackageName(), NFC_STATE_CHANGED, state));
-                if (mLatch != null) {
-                    mLatch.countDown();
-                }
-            }
-        }
-
-        @Override
-        public void onRemoteFieldChanged(boolean isDetected) {
-            synchronized (this) {
-                mEvents.add(
-                        new EventLogEntry(
-                                mContext.getPackageName(), REMOTE_FIELD_CHANGED, isDetected));
-                if (mLatch != null) {
-                    mLatch.countDown();
-                }
-            }
-        }
-
-        @Override
-        public void onInternalErrorReported(@CardEmulation.NfcInternalErrorType int errorType) {
-            synchronized (this) {
-                mEvents.add(
-                        new EventLogEntry(
-                                mContext.getPackageName(), INTERNAL_ERROR_REPORTED, errorType));
-                if (mLatch != null) {
-                    mLatch.countDown();
-                }
-            }
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled({
-        android.nfc.Flags.FLAG_NFC_OBSERVE_MODE,
-        android.nfc.Flags.FLAG_NFC_EVENT_LISTENER
-    })
-    public void testEventListener() throws InterruptedException {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        EventPollLoopReceiver eventPollLoopReceiver = new EventPollLoopReceiver(mContext);
-        sCurrentPollLoopReceiver = eventPollLoopReceiver;
-        Activity activity = createAndResumeActivity();
-        try {
-            Assert.assertTrue(
-                    cardEmulation.setPreferredService(
-                            activity, new ComponentName(mContext, CustomHostApduService.class)));
-            ensurePreferredService(CustomHostApduService.class);
-            eventPollLoopReceiver.setNumEventsToWaitFor(1);
-            Assert.assertTrue(
-                    cardEmulation.setPreferredService(
-                            activity, new ComponentName(mContext, CtsMyHostApduService.class)));
-            eventPollLoopReceiver.waitForEvents();
-            ensurePreferredService(CtsMyHostApduService.class);
-
-            EventPollLoopReceiver.EventLogEntry event = eventPollLoopReceiver.mEvents.getLast();
-            Assert.assertEquals(
-                    CtsMyHostApduService.class.getPackageName(), event.mServicePackageName);
-            Assert.assertEquals(EventPollLoopReceiver.PREFERRED_SERVICE, event.mEventType);
-            Assert.assertTrue((boolean)event.mState);
-
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-            eventPollLoopReceiver.setNumEventsToWaitFor(1);
-
-            Assert.assertTrue(adapter.setObserveModeEnabled(true));
-            eventPollLoopReceiver.waitForEvents();
-            event = eventPollLoopReceiver.mEvents.getLast();
-            Assert.assertEquals(
-                    CtsMyHostApduService.class.getPackageName(), event.mServicePackageName);
-            Assert.assertEquals(EventPollLoopReceiver.OBSERVE_MODE, event.mEventType);
-            Assert.assertTrue((boolean)event.mState);
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            eventPollLoopReceiver.setNumEventsToWaitFor(1);
-
-            Assert.assertTrue(adapter.setObserveModeEnabled(false));
-            eventPollLoopReceiver.waitForEvents();
-            event = eventPollLoopReceiver.mEvents.getLast();
-            Assert.assertEquals(
-                    CtsMyHostApduService.class.getPackageName(), event.mServicePackageName);
-            Assert.assertEquals(EventPollLoopReceiver.OBSERVE_MODE, event.mEventType);
-            Assert.assertFalse((boolean)event.mState);
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-            eventPollLoopReceiver.setNumEventsToWaitFor(1);
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            eventPollLoopReceiver.waitForEvents();
-            event = eventPollLoopReceiver.mEvents.getLast();
-            Assert.assertEquals(
-                    CtsMyHostApduService.class.getPackageName(), event.mServicePackageName);
-            Assert.assertEquals(EventPollLoopReceiver.PREFERRED_SERVICE, event.mEventType);
-            Assert.assertFalse((boolean)event.mState);
-        } finally {
-            cardEmulation.unsetPreferredService(activity);
-            activity.finish();
-            sCurrentPollLoopReceiver = null;
-            adapter.notifyHceDeactivated();
-            eventPollLoopReceiver.cleanup();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled({
-        android.nfc.Flags.FLAG_NFC_OBSERVE_MODE,
-        android.nfc.Flags.FLAG_NFC_EVENT_LISTENER,
-        android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED
-    })
-    public void testEventListener_WalletHolderToForegroundAndBack() throws InterruptedException {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        EventPollLoopReceiver eventPollLoopReceiver = new EventPollLoopReceiver(mContext);
-        sCurrentPollLoopReceiver = eventPollLoopReceiver;
-
-        final int startingEvents = eventPollLoopReceiver.mEvents.size();
-        eventPollLoopReceiver.setNumEventsToWaitFor(1);
-
-        WalletRoleTestUtils.runWithRole(
-                mContext,
-                WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME,
-                () -> {
-                    eventPollLoopReceiver.waitForEvents();
-                    Assert.assertTrue(
-                            "Didn't receive any events",
-                            startingEvents < eventPollLoopReceiver.mEvents.size());
-                    int numEvents = eventPollLoopReceiver.mEvents.size();
-
-                    Activity activity = createAndResumeActivity();
-
-                    eventPollLoopReceiver.setNumEventsToWaitFor(2);
-                    Assert.assertTrue(
-                            cardEmulation.setPreferredService(
-                                    activity,
-                                    new ComponentName(mContext, CtsMyHostApduService.class)));
-
-                    try {
-                        eventPollLoopReceiver.waitForEvents();
-                        Assert.assertTrue(
-                                "Didn't receive two events",
-                                numEvents + 1 < eventPollLoopReceiver.mEvents.size());
-                        EventPollLoopReceiver.EventLogEntry event1 =
-                                eventPollLoopReceiver.mEvents.get(numEvents);
-                        EventPollLoopReceiver.EventLogEntry event2 =
-                                eventPollLoopReceiver.mEvents.get(numEvents + 1);
-                        EventPollLoopReceiver.EventLogEntry gainedEvent =
-                                (boolean)event1.mState ? event1 : event2;
-                        EventPollLoopReceiver.EventLogEntry lostEvent =
-                                (boolean)event1.mState ? event2 : event1;
-
-                        Assert.assertEquals(
-                                WALLET_HOLDER_PACKAGE_NAME,
-                                lostEvent.mServicePackageName);
-                        Assert.assertEquals(
-                                EventPollLoopReceiver.PREFERRED_SERVICE, lostEvent.mEventType);
-                        Assert.assertFalse((boolean)lostEvent.mState);
-
-                        Assert.assertEquals(
-                                CtsMyHostApduService.class.getPackageName(),
-                                gainedEvent.mServicePackageName);
-                        Assert.assertEquals(
-                                EventPollLoopReceiver.PREFERRED_SERVICE, gainedEvent.mEventType);
-                        Assert.assertTrue((boolean)gainedEvent.mState);
-
-                        Assert.assertFalse(adapter.isObserveModeEnabled());
-                        eventPollLoopReceiver.setNumEventsToWaitFor(1);
-                        Assert.assertTrue(adapter.setObserveModeEnabled(true));
-                        eventPollLoopReceiver.waitForEvents();
-                        EventPollLoopReceiver.EventLogEntry event =
-                                eventPollLoopReceiver.mEvents.getLast();
-                        Assert.assertEquals(
-                                CtsMyHostApduService.class.getPackageName(),
-                                event.mServicePackageName);
-                        Assert.assertEquals(EventPollLoopReceiver.OBSERVE_MODE, event.mEventType);
-                        Assert.assertTrue((boolean)event.mState);
-                        Assert.assertTrue(adapter.isObserveModeEnabled());
-
-                        eventPollLoopReceiver.setNumEventsToWaitFor(1);
-                        Assert.assertTrue(adapter.setObserveModeEnabled(false));
-                        eventPollLoopReceiver.waitForEvents();
-                        event = eventPollLoopReceiver.mEvents.getLast();
-                        Assert.assertEquals(
-                                CtsMyHostApduService.class.getPackageName(),
-                                event.mServicePackageName);
-                        Assert.assertEquals(EventPollLoopReceiver.OBSERVE_MODE, event.mEventType);
-                        Assert.assertFalse((boolean)event.mState);
-                        Assert.assertFalse(adapter.isObserveModeEnabled());
-                        numEvents = eventPollLoopReceiver.mEvents.size();
-                        eventPollLoopReceiver.setNumEventsToWaitFor(2);
-                        Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-                        eventPollLoopReceiver.waitForEvents();
-                        event1 = eventPollLoopReceiver.mEvents.get(numEvents);
-                        event2 = eventPollLoopReceiver.mEvents.get(numEvents + 1);
-                        gainedEvent = (boolean)event1.mState ? event1 : event2;
-                        lostEvent = (boolean)event1.mState ? event2 : event1;
-
-                        Assert.assertEquals(
-                                CtsMyHostApduService.class.getPackageName(),
-                                lostEvent.mServicePackageName);
-                        Assert.assertEquals(
-                                EventPollLoopReceiver.PREFERRED_SERVICE, lostEvent.mEventType);
-                        Assert.assertFalse((boolean)lostEvent.mState);
-
-                        Assert.assertEquals(
-                                WALLET_HOLDER_PACKAGE_NAME,
-                                gainedEvent.mServicePackageName);
-                        Assert.assertEquals(
-                                EventPollLoopReceiver.PREFERRED_SERVICE, gainedEvent.mEventType);
-                        Assert.assertTrue((boolean)gainedEvent.mState);
-
-                    } finally {
-                        if (activity != null) {
-                            cardEmulation.unsetPreferredService(activity);
-                            activity.finish();
-                        }
-                        sCurrentPollLoopReceiver = null;
-                        adapter.notifyHceDeactivated();
-                    }
-                });
-    }
-
-    private void runAndWaitForNfcAdapterStateChange(Runnable runnable, int desiredState)
-            throws InterruptedException {
-        CountDownLatch latch = new CountDownLatch(1);
-        mContext.registerReceiver(
-                new BroadcastReceiver() {
-                    public void onReceive(Context context, Intent intent) {
-                        if (intent.getIntExtra(NfcAdapter.EXTRA_ADAPTER_STATE, -1)
-                                == desiredState) {
-                            latch.countDown();
-                        }
-                    }
-                },
-                new IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED));
-        runnable.run();
-        latch.await(10, TimeUnit.SECONDS);
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_EVENT_LISTENER})
-    public void testEventListener_stateChange() throws InterruptedException {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        EventPollLoopReceiver eventPollLoopReceiver = new EventPollLoopReceiver(mContext, false);
-        sCurrentPollLoopReceiver = eventPollLoopReceiver;
-        Activity activity = createAndResumeActivity();
-        try {
-            eventPollLoopReceiver.setNumEventsToWaitFor(2);
-
-            runAndWaitForNfcAdapterStateChange(
-                    () -> {
-                        Assert.assertTrue(adapter.disable());
-                    },
-                    NfcAdapter.STATE_OFF);
-
-            eventPollLoopReceiver.waitForEvents();
-            Assert.assertFalse(adapter.isEnabled());
-            EventPollLoopReceiver.EventLogEntry event = eventPollLoopReceiver.mEvents.getLast();
-            Assert.assertEquals(EventPollLoopReceiver.NFC_STATE_CHANGED, event.mEventType);
-            Assert.assertEquals(NfcAdapter.STATE_OFF, event.mState);
-
-            eventPollLoopReceiver.setNumEventsToWaitFor(2);
-
-            runAndWaitForNfcAdapterStateChange(
-                    () -> {
-                        Assert.assertTrue(adapter.enable());
-                    },
-                    NfcAdapter.STATE_ON);
-
-            eventPollLoopReceiver.waitForEvents();
-            Assert.assertTrue(adapter.isEnabled());
-            event = eventPollLoopReceiver.mEvents.getLast();
-            Assert.assertEquals(EventPollLoopReceiver.NFC_STATE_CHANGED, event.mEventType);
-            Assert.assertEquals(NfcAdapter.STATE_ON, event.mState);
-        } finally {
-            adapter.enable();
-            activity.finish();
-            sCurrentPollLoopReceiver = null;
-            adapter.notifyHceDeactivated();
-            eventPollLoopReceiver.cleanup();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testTypeAPollingLoopToForeground() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                    new ComponentName(mContext,
-                            CtsMyHostApduService.class)));
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(6);
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-            ensurePreferredService(CtsMyHostApduService.class);
-            notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OBSERVE_MODE)
-    public void testSetShouldDefaultToObserveModeShouldDefaultToObserveModeDynamic()
-            throws InterruptedException {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            ComponentName backgroundService =
-                    new ComponentName(mContext, BackgroundHostApduService.class);
-            Assert.assertTrue(
-                    cardEmulation.setShouldDefaultToObserveModeForService(
-                            backgroundService, false));
-
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, backgroundService));
-            ensurePreferredService(BackgroundHostApduService.class);
-
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-            Assert.assertTrue(
-                    cardEmulation.setShouldDefaultToObserveModeForService(backgroundService, true));
-            // Observe mode is set asynchronously, so just wait a bit to let it happen.
-            try {
-                CommonTestUtils.waitUntil(
-                        "Observe mode hasn't been set", 1, () -> adapter.isObserveModeEnabled());
-            } catch (InterruptedException|AssertionError e) {
-            }
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OBSERVE_MODE)
-    public void testSetShouldDefaultToObserveModeFalseShouldNotDefaultToObserveMode()
-            throws InterruptedException {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            ComponentName ctsService = new ComponentName(mContext, CtsMyHostApduService.class);
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, ctsService));
-            ensurePreferredService(CtsMyHostApduService.class);
-
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OBSERVE_MODE)
-    public void testSetShouldDefaultToObserveModeShouldDefaultToObserveMode()
-            throws InterruptedException {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            ComponentName backgroundService =
-                    new ComponentName(mContext, BackgroundHostApduService.class);
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, backgroundService));
-            ensurePreferredService(BackgroundHostApduService.class);
-
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OBSERVE_MODE)
-    public void testSetShouldDefaultToObserveModeFalseShouldNotDefaultToObserveModeOffHost()
-            throws InterruptedException {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            ComponentName ctsService = new ComponentName(mContext, CtsMyOffHostApduService.class);
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, ctsService));
-            ensurePreferredService(CtsMyOffHostApduService.class);
-
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OBSERVE_MODE)
-    public void testSetShouldDefaultToObserveModeShouldDefaultToObserveModeOffHost()
-            throws InterruptedException {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            ComponentName offhostService =
-                    new ComponentName(mContext, CtsMyOffHostDefaultToObserveApduService.class);
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, offhostService));
-            ensurePreferredService(CtsMyOffHostDefaultToObserveApduService.class);
-
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testTypeAOneLoopPollingLoopToForeground() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                    new ComponentName(mContext,
-                            CtsMyHostApduService.class)));
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(4);
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_B));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-            ensurePreferredService(CtsMyHostApduService.class);
-            sCurrentPollLoopReceiver = new PollLoopReceiver(new ArrayList<PollingFrame>(0), null);
-            for (PollingFrame frame : frames) {
-                adapter.notifyPollingLoop(frame);
-            }
-            synchronized (sCurrentPollLoopReceiver) {
-                try {
-                    sCurrentPollLoopReceiver.wait(5000);
-                } catch (InterruptedException ie) {
-                    Assert.assertNull(ie);
-                }
-            }
-            sCurrentPollLoopReceiver.test();
-        } finally {
-            sCurrentPollLoopReceiver = null;
-            cardEmulation.unsetPreferredService(activity);
-            activity.finish();
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testTypeABNoOffPollingLoopToDefault() {
-        assumeVsrApiGreaterThanUdc();
-        ComponentName originalDefault = null;
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        try {
-            originalDefault = setDefaultPaymentService(CustomHostApduService.class);
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(7);
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_B));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_B));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-            frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_B));
-            ensurePreferredService(CustomHostApduService.class);
-            notifyPollingLoopAndWait(new ArrayList<PollingFrame>(frames),
-                    CustomHostApduService.class.getName());
-        } finally {
-            setDefaultPaymentService(originalDefault);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testTypeAPollingLoopToForegroundWithWalletHolder() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME,
-                () -> {
-                    Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                            new ComponentName(mContext,
-                                    CtsMyHostApduService.class)));
-                    ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(6);
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_ON));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_A));
-                    frames.add(createFrame(PollingFrame.POLLING_LOOP_TYPE_OFF));
-                    ensurePreferredService(CtsMyHostApduService.class);
-                    notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-                    Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-                    activity.finish();
-                    adapter.notifyHceDeactivated();
-                });
-    }
-
-    void ensurePreferredService(Class serviceClass) {
-        ensurePreferredService(serviceClass, mContext);
-    }
-
-    static int getResIdForServiceClass(Class serviceClass) {
-        if (CtsMyHostApduService.class.equals(serviceClass)) {
-            return R.string.CtsPaymentService;
-        } else if (CustomHostApduService.class.equals(serviceClass)) {
-            return R.string.CtsCustomPaymentService;
-        } else if (BackgroundHostApduService.class.equals(serviceClass)) {
-            return R.string.CtsBackgroundPaymentService;
-        } else if (CtsMyOffHostApduService.class.equals(serviceClass)) {
-            return R.string.CtsOffHostPaymentService;
-        } else if (CtsMyOffHostDefaultToObserveApduService.class.equals(serviceClass)) {
-            return R.string.CtsOffHostDefaultToObservePaymentService;
-        } else {
-            throw new IllegalArgumentException("no mapping from class to description string");
-        }
-    }
-
-    static void ensurePreferredService(Class serviceClass, Context context) {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(context);
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        int resId = getResIdForServiceClass(serviceClass);
-        final String desc = context.getResources().getString(resId);
-        DefaultPaymentProviderTestUtils.ensurePreferredService(desc, context);
-    }
-
-    void ensurePreferredService(String serviceDesc) {
-        DefaultPaymentProviderTestUtils.ensurePreferredService(serviceDesc, mContext);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testTwoCustomPollingLoopToPreferredCustomAndBackgroundDynamic() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        Activity activity = createAndResumeActivity();
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                    new ComponentName(mContext, CustomHostApduService.class)));
-
-            ensurePreferredService(CustomHostApduService.class);
-            Assert.assertTrue(adapter.setObserveModeEnabled(true));
-
-            ComponentName backgroundServiceName = new ComponentName(mContext,
-                    BackgroundHostApduService.class);
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex1 =
-                    HexFormat.of().toHexDigits((testName + "background").hashCode());
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(
-                    backgroundServiceName, annotationStringHex1, false));
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(2);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex1)));
-
-            ComponentName customServiceName = new ComponentName(mContext,
-                    CustomHostApduService.class);
-
-            String annotationStringHex2 =
-                    HexFormat.of().toHexDigits((testName + "custom").hashCode());
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(
-                    customServiceName, annotationStringHex2, false));
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex2)));
-
-            sCurrentPollLoopReceiver = new PollLoopReceiver(frames, null);
-            for (PollingFrame frame : frames) {
-                adapter.notifyPollingLoop(frame);
-            }
-            synchronized (sCurrentPollLoopReceiver) {
-                try {
-                    sCurrentPollLoopReceiver.wait(5000);
-                } catch (InterruptedException ie) {
-                    Assert.assertNull(ie);
-                }
-            }
-            Assert.assertEquals(frames.size(), sCurrentPollLoopReceiver.mReceivedFrames.size());
-            Assert.assertEquals(2, sCurrentPollLoopReceiver.mReceivedServiceNames.size());
-        } finally {
-            cardEmulation.unsetPreferredService(activity);
-            activity.finish();
-            sCurrentPollLoopReceiver = null;
-            adapter.notifyHceDeactivated();
-        }
-    }
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testTwoCustomPollingLoopToCustomAndBackgroundDynamic() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        Activity activity = createAndResumeActivity();
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                    new ComponentName(mContext, CtsMyHostApduService.class)));
-
-            ensurePreferredService(CtsMyHostApduService.class);
-            Assert.assertTrue(adapter.setObserveModeEnabled(true));
-
-            ComponentName backgroundServiceName = new ComponentName(mContext,
-                    BackgroundHostApduService.class);
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex1 =
-                    HexFormat.of().toHexDigits((testName + "background").hashCode());
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(
-                    backgroundServiceName, annotationStringHex1, false));
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(2);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex1)));
-
-            ComponentName customServiceName = new ComponentName(mContext,
-                    CustomHostApduService.class);
-
-            String annotationStringHex2 =
-                    HexFormat.of().toHexDigits((testName + "custom").hashCode());
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(
-                    customServiceName, annotationStringHex2, false));
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex2)));
-
-            sCurrentPollLoopReceiver = new PollLoopReceiver(frames, null);
-            for (PollingFrame frame : frames) {
-                adapter.notifyPollingLoop(frame);
-            }
-            synchronized (sCurrentPollLoopReceiver) {
-                try {
-                    sCurrentPollLoopReceiver.wait(5000);
-                } catch (InterruptedException ie) {
-                    Assert.assertNull(ie);
-                }
-            }
-            Assert.assertEquals(frames.size(),
-                    sCurrentPollLoopReceiver.mReceivedFrames.size());
-            Assert.assertEquals(2, sCurrentPollLoopReceiver.mReceivedServiceNames.size());
-            sCurrentPollLoopReceiver = null;
-        } finally {
-            cardEmulation.unsetPreferredService(activity);
-            activity.finish();
-            sCurrentPollLoopReceiver = null;
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testCustomPollingLoopToCustomDynamic() {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        assumeVsrApiGreaterThanUdc();
-        adapter.notifyHceDeactivated();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        ComponentName customServiceName = new ComponentName(mContext, CustomHostApduService.class);
-        String testName = new Object() {
-        }.getClass().getEnclosingMethod().getName();
-        String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-        Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(customServiceName,
-                annotationStringHex, false));
-        ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-        frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                HexFormat.of().parseHex(annotationStringHex)));
-        notifyPollingLoopAndWait(frames, CustomHostApduService.class.getName());
-        adapter.notifyHceDeactivated();
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testCustomPollingLoopToCustomDynamicAndRemove() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        Activity activity = createAndResumeActivity();
-        ComponentName ctsServiceName = new ComponentName(mContext,
-                CtsMyHostApduService.class);
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, ctsServiceName));
-            ensurePreferredService(CtsMyHostApduService.class);
-            ComponentName customServiceName =
-                    new ComponentName(mContext, CustomHostApduService.class);
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(customServiceName,
-                    annotationStringHex, false));
-
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            notifyPollingLoopAndWait(frames, CustomHostApduService.class.getName());
-            adapter.notifyHceDeactivated();
-
-            Assert.assertTrue(cardEmulation.removePollingLoopFilterForService(customServiceName,
-                    annotationStringHex));
-
-            notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testCustomPollingLoopToCustomWithPrefixDynamic() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        ComponentName customServiceName = new ComponentName(mContext, CustomHostApduService.class);
-        String testName = new Object() {
-        }.getClass().getEnclosingMethod().getName();
-        String annotationStringHexPrefix = HexFormat.of().toHexDigits(testName.hashCode());
-        String annotationStringHex = annotationStringHexPrefix + "123456789ABCDF";
-        String annotationStringHexPattern = annotationStringHexPrefix + ".*";
-        Assert.assertTrue(cardEmulation.registerPollingLoopPatternFilterForService(
-                customServiceName, annotationStringHexPattern, false));
-        ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-        frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                HexFormat.of().parseHex(annotationStringHex)));
-        notifyPollingLoopAndWait(frames, CustomHostApduService.class.getName());
-        Assert.assertTrue(cardEmulation.removePollingLoopPatternFilterForService(customServiceName,
-                annotationStringHexPrefix));
-        adapter.notifyHceDeactivated();
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testCustomPollingLoopToCustomWithPrefix() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        String testName = new Object() {
-        }.getClass().getEnclosingMethod().getName();
-        String annotationStringHexPrefix = HexFormat.of().toHexDigits(testName.hashCode());
-        String annotationStringHex = annotationStringHexPrefix + "123456789ABCDF";
-
-        ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-        frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                HexFormat.of().parseHex(annotationStringHex)));
-        notifyPollingLoopAndWait(frames, CustomHostApduService.class.getName());
-
-        adapter.notifyHceDeactivated();
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testThreeWayConflictPollingLoopToForegroundDynamic() {
-        assumeVsrApiGreaterThanUdc();
-        ComponentName originalDefault = null;
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            originalDefault = setDefaultPaymentService(CustomHostApduService.class);
-            ComponentName ctsMyServiceName = new ComponentName(mContext,
-                    CtsMyHostApduService.class);
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, ctsMyServiceName));
-            ComponentName customServiceName = new ComponentName(mContext,
-                    CustomHostApduService.class);
-            ComponentName backgroundServiceName = new ComponentName(mContext,
-                    BackgroundHostApduService.class);
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(customServiceName,
-                    annotationStringHex, false));
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(
-                    backgroundServiceName, annotationStringHex, false));
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(ctsMyServiceName,
-                    annotationStringHex, false));
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            ensurePreferredService(CtsMyHostApduService.class);
-            notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            setDefaultPaymentService(originalDefault);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testBackgroundForegroundConflictPollingLoopToForegroundDynamic() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        Activity activity = createAndResumeActivity();
-        ComponentName ctsServiceName = new ComponentName(mContext,
-                CtsMyHostApduService.class);
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, ctsServiceName));
-            ComponentName backgroundServiceName = new ComponentName(mContext,
-                    BackgroundHostApduService.class);
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(ctsServiceName,
-                    annotationStringHex, false));
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(
-                    backgroundServiceName, annotationStringHex, false));
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            ensurePreferredService(CtsMyHostApduService.class);
-            notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testBackgroundPaymentConflictPollingLoopToPaymentDynamic() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        ComponentName originalDefault = null;
-        try {
-            ComponentName customServiceName = new ComponentName(mContext,
-                    CustomHostApduService.class);
-            originalDefault = setDefaultPaymentService(customServiceName);
-            CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-
-            Assert.assertTrue(cardEmulation.isDefaultServiceForCategory(customServiceName,
-                    CardEmulation.CATEGORY_PAYMENT));
-            ComponentName backgroundServiceName = new ComponentName(mContext,
-                    BackgroundHostApduService.class);
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(customServiceName,
-                    annotationStringHex, false));
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(
-                    backgroundServiceName, annotationStringHex, false));
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            ensurePreferredService(CustomHostApduService.class);
-            notifyPollingLoopAndWait(frames, CustomHostApduService.class.getName());
-        } finally {
-            setDefaultPaymentService(originalDefault);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testCustomPollingLoopToCustom() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        String testName = new Object() {
-        }.getClass().getEnclosingMethod().getName();
-        String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-        ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-        frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                HexFormat.of().parseHex(annotationStringHex)));
-        notifyPollingLoopAndWait(frames, CustomHostApduService.class.getName());
-        adapter.notifyHceDeactivated();
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testThreeWayConflictPollingLoopToForeground() {
-        assumeVsrApiGreaterThanUdc();
-        ComponentName originalDefault = null;
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            originalDefault = setDefaultPaymentService(CustomHostApduService.class);
-            Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                    new ComponentName(mContext, CtsMyHostApduService.class)));
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            ensurePreferredService(CtsMyHostApduService.class);
-            notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            setDefaultPaymentService(originalDefault);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testThreeWayConflictPollingLoopToForegroundWithWalletHolder() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME,
-                () -> {
-                    Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                            new ComponentName(mContext, CtsMyHostApduService.class)));
-                    String testName = new Object() {
-                    }.getClass().getEnclosingMethod().getName();
-                    String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-                    ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-                    frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                            HexFormat.of().parseHex(annotationStringHex)));
-                    ensurePreferredService(CtsMyHostApduService.class);
-                    notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-                    Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-                    activity.finish();
-                    adapter.notifyHceDeactivated();
-                });
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    public void testBackgroundForegroundConflictPollingLoopToForeground() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        Activity activity = createAndResumeActivity();
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                    new ComponentName(mContext, CtsMyHostApduService.class)));
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            ensurePreferredService(CtsMyHostApduService.class);
-            notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-        } finally {
-            Assert.assertTrue(cardEmulation.unsetPreferredService(activity));
-            activity.finish();
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testBackgroundPaymentConflictPollingLoopToPayment() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        adapter.notifyHceDeactivated();
-        ComponentName originalDefault = null;
-        try {
-            originalDefault = setDefaultPaymentService(CustomHostApduService.class);
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            ensurePreferredService(CustomHostApduService.class);
-            notifyPollingLoopAndWait(frames, CustomHostApduService.class.getName());
-        } finally {
-            setDefaultPaymentService(originalDefault);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            Flags.FLAG_NFC_OBSERVE_MODE,
-            android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testBackgroundWalletConflictPollingLoopToWallet_walletRoleEnabled() {
-        assumeVsrApiGreaterThanUdc();
-        runWithRole(mContext, WALLET_HOLDER_PACKAGE_NAME, () -> {
-            NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-            adapter.notifyHceDeactivated();
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            ensurePreferredService(WALLET_HOLDER_SERVICE_DESC);
-            notifyPollingLoopAndWait(frames, getWalletRoleHolderService().getClassName());
-            adapter.notifyHceDeactivated();
-        });
-    }
-
-    @Test
-    @RequiresFlagsEnabled({com.android.nfc.flags.Flags.FLAG_AUTO_DISABLE_OBSERVE_MODE,
-                           android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-                           Flags.FLAG_NFC_OBSERVE_MODE,
-                           android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testAutoDisableObserveMode() throws Exception {
-        assumeVsrApiGreaterThanUdc();
-        runWithRole(mContext, CTS_PACKAGE_NAME, () -> {
-            NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-            Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-            assumeObserveModeSupported(adapter);
-            adapter.notifyHceDeactivated();
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-            try {
-                ensurePreferredService(CtsMyHostApduService.class);
-                Assert.assertTrue(adapter.setObserveModeEnabled(true));
-                Assert.assertTrue(adapter.isObserveModeEnabled());
-                List<PollingFrame> receivedFrames =
-                        notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-                Assert.assertFalse(receivedFrames.get(0).getTriggeredAutoTransact());
-                PollingCheck.check("Observe mode not disabled", 4000,
-                        () -> !adapter.isObserveModeEnabled());
-                adapter.notifyHceDeactivated();
-            } catch (Exception ex) {
-                throw new RuntimeException(ex);
-            } finally {
-                adapter.setObserveModeEnabled(false);
-            }
-        });
-    }
-
-    @Test
-    @RequiresFlagsEnabled({com.android.nfc.flags.Flags.FLAG_AUTO_DISABLE_OBSERVE_MODE,
-                           android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-                           Flags.FLAG_NFC_OBSERVE_MODE})
-    public void testDontAutoDisableObserveModeInForeground() throws Exception {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        String testName = new Object() {
-        }.getClass().getEnclosingMethod().getName();
-        String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-        ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-        frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                HexFormat.of().parseHex(annotationStringHex)));
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        final Activity activity = createAndResumeActivity();
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                new ComponentName(mContext, CtsMyHostApduService.class)));
-            ensurePreferredService(CtsMyHostApduService.class);
-            Assert.assertTrue(adapter.setObserveModeEnabled(true));
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            List<PollingFrame> receivedFrames =
-                    notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-            Assert.assertFalse(receivedFrames.get(0).getTriggeredAutoTransact());
-            Thread.currentThread().sleep(4000);
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            adapter.notifyHceDeactivated();
-        } catch (Exception ex) {
-            throw new RuntimeException(ex);
-        } finally {
-            adapter.setObserveModeEnabled(false);
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled({com.android.nfc.flags.Flags.FLAG_AUTO_DISABLE_OBSERVE_MODE,
-                           android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-                           Flags.FLAG_NFC_OBSERVE_MODE})
-    public void testDontAutoDisableObserveModeInForegroundTwoServices() throws Exception {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        String testName = new Object() {
-        }.getClass().getEnclosingMethod().getName();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        String annotationStringHex1 = "5cadc10f";
-        ArrayList<PollingFrame> frames1 = new ArrayList<PollingFrame>(1);
-        frames1.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                HexFormat.of().parseHex(annotationStringHex1)));
-        ComponentName walletServiceName = WalletRoleTestUtils.getWalletRoleHolderService();
-        String annotationStringHex2 = HexFormat.of().toHexDigits((testName).hashCode());
-        ComponentName ctsComponentName = new ComponentName(mContext, CtsMyHostApduService.class);
-        Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(ctsComponentName,
-                        annotationStringHex2, false));
-        ArrayList<PollingFrame> frames2 = new ArrayList<PollingFrame>(1);
-        frames2.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                        HexFormat.of().parseHex(annotationStringHex2)));
-        final Activity activity = createAndResumeActivity();
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, ctsComponentName));
-            ensurePreferredService(CtsMyHostApduService.class);
-            Assert.assertTrue(adapter.setObserveModeEnabled(true));
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            List<PollingFrame> receivedFrames =
-                    notifyPollingLoopAndWait(frames1,
-                    WalletRoleTestUtils.getWalletRoleHolderService().getClassName());
-            Assert.assertFalse(receivedFrames.get(0).getTriggeredAutoTransact());
-            receivedFrames =
-                    notifyPollingLoopAndWait(frames2, CtsMyHostApduService.class.getName());
-            Assert.assertFalse(receivedFrames.get(0).getTriggeredAutoTransact());
-            Thread.currentThread().sleep(5000);
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            adapter.notifyHceDeactivated();
-        } catch (Exception ex) {
-            throw new RuntimeException(ex);
-        } finally {
-            adapter.setObserveModeEnabled(false);
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            Flags.FLAG_NFC_OBSERVE_MODE})
-    public void testAutoTransact() throws Exception {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        final Activity activity = createAndResumeActivity();
-        String testName = new Object() {
-        }.getClass().getEnclosingMethod().getName();
-        String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-        ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-        frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                HexFormat.of().parseHex(annotationStringHex)));
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                    new ComponentName(mContext, CtsMyHostApduService.class)));
-            ensurePreferredService(CtsMyHostApduService.class);
-            Assert.assertTrue(adapter.setObserveModeEnabled(true));
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            List<PollingFrame> receivedFrames =
-                    notifyPollingLoopAndWait(frames, CustomHostApduService.class.getName());
-            Assert.assertTrue(receivedFrames.get(0).getTriggeredAutoTransact());
-            PollingCheck.check("Observe mode not disabled", 200,
-                    () -> !adapter.isObserveModeEnabled());
-            adapter.notifyHceDeactivated();
-            PollingCheck.check("Observe mode not enabled", 3000, adapter::isObserveModeEnabled);
-        } finally {
-            adapter.setObserveModeEnabled(false);
-            cardEmulation.unsetPreferredService(activity);
-            activity.finish();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            Flags.FLAG_NFC_OBSERVE_MODE,
-            android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testAutoTransact_walletRoleEnabled() throws Exception {
-        assumeVsrApiGreaterThanUdc();
-        restoreOriginalService();
-        runWithRole(mContext, CTS_PACKAGE_NAME, () -> {
-            NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-            Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-            assumeObserveModeSupported(adapter);
-            adapter.notifyHceDeactivated();
-            createAndResumeActivity();
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            Assert.assertTrue(adapter.setObserveModeEnabled(true));
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            List<PollingFrame> receivedFrames =
-                    notifyPollingLoopAndWait(frames, CustomHostApduService.class.getName());
-            Assert.assertTrue(receivedFrames.get(0).getTriggeredAutoTransact());
-            try {
-                PollingCheck.check("Observe mode not disabled", 200,
-                        () -> !adapter.isObserveModeEnabled());
-                adapter.notifyHceDeactivated();
-                PollingCheck.check("Observe mode not enabled", 3000, adapter::isObserveModeEnabled);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            } finally {
-                adapter.setObserveModeEnabled(false);
-            }
-        });
-        setMockService();
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            Flags.FLAG_NFC_OBSERVE_MODE})
-    public void testAutoTransactDynamic() throws Exception {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        final Activity activity = createAndResumeActivity();
-        String testName = new Object() {
-        }.getClass().getEnclosingMethod().getName();
-        String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        ComponentName customServiceName = new ComponentName(mContext, CustomHostApduService.class);
-        Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(customServiceName,
-                annotationStringHex, true));
-        ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-        frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                HexFormat.of().parseHex(annotationStringHex)));
-        ComponentName ctsComponentName = new ComponentName(mContext, CtsMyHostApduService.class);
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, ctsComponentName));
-            ensurePreferredService(CtsMyHostApduService.class);
-            Assert.assertTrue(adapter.setObserveModeEnabled(true));
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            List<PollingFrame> receivedFrames =
-                    notifyPollingLoopAndWait(frames, CustomHostApduService.class.getName());
-            Assert.assertTrue(receivedFrames.get(0).getTriggeredAutoTransact());
-            PollingCheck.check("Observe mode not disabled", 200,
-                    () -> !adapter.isObserveModeEnabled());
-            adapter.notifyHceDeactivated();
-            PollingCheck.check("Observe mode not enabled", 3000, adapter::isObserveModeEnabled);
-        } finally {
-            adapter.setObserveModeEnabled(false);
-            cardEmulation.unsetPreferredService(activity);
-            activity.finish();
-        }
-    }
-
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            Flags.FLAG_NFC_OBSERVE_MODE})
-    public void testOffHostAutoTransactDynamic() throws Exception {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-        assumeObserveModeSupported(adapter);
-        adapter.notifyHceDeactivated();
-        final Activity activity = createAndResumeActivity();
-        String testName = new Object() {
-        }.getClass().getEnclosingMethod().getName();
-        String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        ComponentName offhostServiceName = new ComponentName(mContext,
-                CtsMyOffHostApduService.class);
-        Assert.assertFalse(cardEmulation.registerPollingLoopFilterForService(offhostServiceName,
-                "1234567890", false));
-        Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(offhostServiceName,
-                annotationStringHex, true));
-        PollingFrame frame = createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                HexFormat.of().parseHex(annotationStringHex));
-        ComponentName ctsComponentName = new ComponentName(mContext, CtsMyHostApduService.class);
-        try {
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, ctsComponentName));
-            ensurePreferredService(CtsMyHostApduService.class);
-            Assert.assertTrue(adapter.setObserveModeEnabled(true));
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            adapter.notifyPollingLoop(frame);
-            PollingCheck.check("Observe mode not disabled", 200,
-                    () -> !adapter.isObserveModeEnabled());
-            adapter.notifyHceDeactivated();
-            PollingCheck.check("Observe mode not enabled", 3000, adapter::isObserveModeEnabled);
-        } finally {
-            adapter.setObserveModeEnabled(false);
-            cardEmulation.unsetPreferredService(activity);
-            activity.finish();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            Flags.FLAG_NFC_OBSERVE_MODE,
-            android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testDisallowNonDefaultSetObserveMode() throws NoSuchFieldException {
-        restoreOriginalService();
-        runWithRole(mContext,  WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME, () -> {
-            NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-            Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-            assumeObserveModeSupported(adapter);
-            adapter.notifyHceDeactivated();
-            Assert.assertFalse(adapter.setObserveModeEnabled(true));
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-        });
-        setMockService();
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP,
-            Flags.FLAG_NFC_OBSERVE_MODE,
-            android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testAutoTransactDynamic_walletRoleEnabled() throws Exception {
-        assumeVsrApiGreaterThanUdc();
-        restoreOriginalService();
-        runWithRole(mContext, CTS_PACKAGE_NAME, () -> {
-            NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-            assumeObserveModeSupported(adapter);
-            Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-            adapter.notifyHceDeactivated();
-            createAndResumeActivity();
-            String testName = new Object() {
-            }.getClass().getEnclosingMethod().getName();
-            String annotationStringHex = HexFormat.of().toHexDigits(testName.hashCode());
-            CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-            ComponentName customServiceName = new ComponentName(mContext,
-                    CtsMyHostApduService.class);
-            Assert.assertTrue(cardEmulation.registerPollingLoopFilterForService(customServiceName,
-                    annotationStringHex, true));
-            ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>(1);
-            frames.add(createFrameWithData(PollingFrame.POLLING_LOOP_TYPE_UNKNOWN,
-                    HexFormat.of().parseHex(annotationStringHex)));
-            Assert.assertTrue(adapter.setObserveModeEnabled(true));
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            List<PollingFrame> receivedFrames =
-                    notifyPollingLoopAndWait(frames, CtsMyHostApduService.class.getName());
-            Assert.assertTrue(receivedFrames.get(0).getTriggeredAutoTransact());
-            try {
-                PollingCheck.check("Observe mode not disabled", 200,
-                        () -> !adapter.isObserveModeEnabled());
-                adapter.notifyHceDeactivated();
-                PollingCheck.check("Observe mode not enabled", 3000, adapter::isObserveModeEnabled);
-            } catch (Exception e) {
-                throw new RuntimeException(e);
-            } finally {
-                adapter.setObserveModeEnabled(false);
-            }
-        });
-        setMockService();
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP})
-    public void testInvalidPollingLoopFilter() {
-        assumeVsrApiGreaterThanUdc();
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        ComponentName customServiceName = new ComponentName(mContext, CustomHostApduService.class);
-        Assert.assertThrows(IllegalArgumentException.class,
-                () -> cardEmulation.registerPollingLoopFilterForService(customServiceName,
-                        "", false));
-        Assert.assertThrows(IllegalArgumentException.class,
-                () ->cardEmulation.registerPollingLoopFilterForService(customServiceName,
-                    "????", false));
-        Assert.assertThrows(IllegalArgumentException.class,
-                () ->cardEmulation.registerPollingLoopFilterForService(customServiceName,
-                    "123", false));
-
-    }
-
-    static void ensureUnlocked() {
-        final Context context = InstrumentationRegistry.getInstrumentation().getContext();
-        final UserManager userManager = context.getSystemService(UserManager.class);
-        assumeFalse(userManager.isHeadlessSystemUserMode());
-        final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
-        final PowerManager pm = context.getSystemService(PowerManager.class);
-        final KeyguardManager km = context.getSystemService(KeyguardManager.class);
-        try {
-            if (pm != null && !pm.isInteractive()) {
-                runShellCommand("input keyevent KEYCODE_WAKEUP");
-                CommonTestUtils.waitUntil("Device does not wake up after 5 seconds", 5,
-                        () -> pm != null && pm.isInteractive());
-            }
-            if (km != null && km.isKeyguardLocked()) {
-                CommonTestUtils.waitUntil("Device does not unlock after 30 seconds", 30,
-                        () -> {
-                        SystemUtil.runWithShellPermissionIdentity(
-                                () -> instrumentation.sendKeyDownUpSync(
-                                        (KeyEvent.KEYCODE_MENU)));
-                        return km != null && !km.isKeyguardLocked();
-                    }
-                );
-            }
-        } catch (InterruptedException|AssertionError e) {
-        }
-    }
-
-    private PollingFrame createFrame(@PollingFrameType int type) {
-        if (type == PollingFrame.POLLING_LOOP_TYPE_ON
-                || type == PollingFrame.POLLING_LOOP_TYPE_OFF) {
-            return new PollingFrame(type,
-                    new byte[] { ((type == PollingFrame.POLLING_LOOP_TYPE_ON)
-                            ? (byte) 0x01 : (byte) 0x00) }, 8, 0,
-                    false);
-        }
-        return new PollingFrame(type, null, 8, 0, false);
-    }
-
-    private PollingFrame createFrameWithData(@PollingFrameType int type, byte[] data) {
-        return new PollingFrame(type, data, 8, (long) Integer.MAX_VALUE + 1L, false);
-    }
-
-    private ComponentName setDefaultPaymentService(Class serviceClass) {
-        ComponentName componentName = setDefaultPaymentService(
-                new ComponentName(mContext, serviceClass));
-        return componentName;
-    }
-
-    ComponentName setDefaultPaymentService(ComponentName serviceName) {
-        return DefaultPaymentProviderTestUtils.setDefaultPaymentService(serviceName, mContext);
-    }
-
-    static final class SettingsObserver extends ContentObserver {
-        boolean mSeenChange = false;
-
-        SettingsObserver(Handler handler) {
-            super(handler);
-        }
-        @Override
-        public void onChange(boolean selfChange, Uri uri) {
-            mSeenChange = true;
-            synchronized (this) {
-                this.notify();
-            }
-        }
-    }
-
-    static PollLoopReceiver sCurrentPollLoopReceiver = null;
-
-    static class PollLoopReceiver  {
-        int mFrameIndex = 0;
-        ArrayList<PollingFrame> mFrames;
-        String mServiceName;
-        ArrayList<PollingFrame> mReceivedFrames;
-        String mReceivedServiceName;
-        ArrayList<String> mReceivedServiceNames;
-        PollLoopReceiver(ArrayList<PollingFrame> frames, String serviceName) {
-            mFrames = frames;
-            mServiceName = serviceName;
-            mReceivedFrames = new ArrayList<PollingFrame>();
-            mReceivedServiceNames = new ArrayList<String>();
-        }
-
-        void notifyPollingLoop(String className, List<PollingFrame> receivedFrames) {
-            if (receivedFrames == null || receivedFrames.isEmpty()) {
-                return;
-            }
-            mReceivedFrames.addAll(receivedFrames);
-            mReceivedServiceName = className;
-            mReceivedServiceNames.add(className);
-            if (mReceivedFrames.size() < mFrames.size()) {
-                return;
-            }
-            synchronized (this) {
-                this.notify();
-            }
-        }
-
-        void test() {
-            if (mReceivedFrames.size() > mFrames.size()) {
-                Assert.fail("received more frames than sent");
-            } else if (mReceivedFrames.size() < mFrames.size()) {
-                Assert.fail("received fewer frames than sent");
-            }
-            for (PollingFrame receivedFrame : mReceivedFrames) {
-                Assert.assertEquals(mFrames.get(mFrameIndex).getType(), receivedFrame.getType());
-                Assert.assertEquals(mFrames.get(mFrameIndex).getVendorSpecificGain(),
-                        receivedFrame.getVendorSpecificGain());
-                Assert.assertEquals(mFrames.get(mFrameIndex).getTimestamp(),
-                        receivedFrame.getTimestamp());
-                Assert.assertArrayEquals(mFrames.get(mFrameIndex).getData(),
-                        receivedFrame.getData());
-                mFrameIndex++;
-            }
-            if (mServiceName != null) {
-                Assert.assertEquals(mServiceName, mReceivedServiceName);
-            }
-        }
-        public void onObserveModeStateChanged(String className, boolean isEnabled) {
-        }
-
-        public void onPreferredServiceChanged(String className, boolean isPreferred) {
-        }
-        public void onListenersRegistered() {
-        }
-    }
-
-    private List<PollingFrame> notifyPollingLoopAndWait(ArrayList<PollingFrame> frames,
-            String serviceName) {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        sCurrentPollLoopReceiver = new PollLoopReceiver(frames, serviceName);
-        for (PollingFrame frame : frames) {
-            adapter.notifyPollingLoop(frame);
-        }
-        synchronized (sCurrentPollLoopReceiver) {
-            try {
-                sCurrentPollLoopReceiver.wait(10000);
-            } catch (InterruptedException ie) {
-                Assert.assertNull(ie);
-            }
-        }
-        sCurrentPollLoopReceiver.test();
-        Assert.assertEquals(frames.size(), sCurrentPollLoopReceiver.mFrameIndex);
-        List<PollingFrame> receivedFrames =  sCurrentPollLoopReceiver.mReceivedFrames;
-        sCurrentPollLoopReceiver = null;
-        return receivedFrames;
-    }
-
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    @Test
-    public void testAidResolutionWithRoleHolder_anotherAppHoldsForeground()
-            throws NoSuchFieldException {
-        restoreOriginalService();
-        Activity activity = createAndResumeActivity();
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        instance.setPreferredService(activity, WalletRoleTestUtils.getForegroundService());
-        runWithRole(mContext, WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME, ()-> {
-            /*
-            * Aid Mapping:
-            * Wallet Holder App: Service 1:     PAYMENT_AID_1, PAYMENT_AID_2
-            * Wallet Holder App: Service 2:     PAYMENT_AID_1, PAYMENT_AID_2
-            * Foreground App :   Only Service:  PAYMENT_AID_1
-            * Non Payment App:   Only Service:  NON_PAYMENT_AID_1
-            *
-            * Scenario:
-            * Wallet Role Holder is WalletRoleHolderApp
-            * Foreground app: ForegroundApp
-            *
-            * Expected Outcome:
-            * Both wallet role holder and the foreground app holds PAYMENT_AID_1.
-            * So the foreground app is expected to get the routing for PAYMENT_AID_1.
-            *
-            * The foreground app does not have NON_PAYMENT_AID_1. Neither does the role holder.
-            * So an app in the background (Non Payment App) gets the routing.
-            **/
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getForegroundService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getForegroundService(),
-                    WalletRoleTestUtils.NON_PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getNonPaymentService(),
-                    WalletRoleTestUtils.NON_PAYMENT_AID_1));
-            Assert.assertTrue(instance.unsetPreferredService(activity));
-            activity.finish();
-        });
-        setMockService();
-    }
-
-    @RequiresFlagsEnabled({android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED,
-            android.nfc.Flags.FLAG_NFC_ASSOCIATED_ROLE_SERVICES})
-    @Test
-    public void testAidResolutionWithRoleHolder_associatedService()
-            throws NoSuchFieldException {
-        restoreOriginalService();
-        runWithRole(mContext, WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME, ()-> {
-            /*
-             * Aid Mapping:
-             * Wallet Holder App: Service 1:     PAYMENT_AID_1, PAYMENT_AID_2
-             * Wallet Holder App: Service 2:     PAYMENT_AID_1, PAYMENT_AID_2
-             * Foreground App :   Associated Service:  PAYMENT_AID_3
-             *
-             * Scenario:
-             * Wallet Role Holder is WalletRoleHolderApp
-             * Associated app: ForegroundApp
-             *
-             * Expected Outcome:
-             * Associated Service should be the default service for the PAYMENT_AID_3.
-             * The Wallet Holder app should still be default for PAYMENT_AID_1 and
-             * PAYMENT_AID_2.
-             **/
-            CardEmulation instance = CardEmulation.getInstance(mAdapter);
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_2));
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getAssociatedService(),
-                    WalletRoleTestUtils.PAYMENT_AID_3));
-        });
-        setMockService();
-    }
-
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    @RequiresFlagsDisabled(android.nfc.Flags.FLAG_NFC_ASSOCIATED_ROLE_SERVICES)
-    @Test
-    public void testAidResolutionWithRoleHolder_noAssociatedService()
-            throws NoSuchFieldException {
-        restoreOriginalService();
-        runWithRole(mContext, WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME, ()-> {
-            /*
-             * Aid Mapping:
-             * Wallet Holder App: Service 1:     PAYMENT_AID_1, PAYMENT_AID_2
-             * Wallet Holder App: Service 2:     PAYMENT_AID_1, PAYMENT_AID_2
-             * Foreground App :   Associated Service:  PAYMENT_AID_3
-             *
-             * Scenario:
-             * Wallet Role Holder is WalletRoleHolderApp
-             * Associated app: ForegroundApp
-             *
-             * Expected Outcome:
-             * Associated Service should NOT be the default service for the PAYMENT_AID_3, since
-             * it's registered in the payment category, it is not in the foreground, and it is
-             * not the role holder.
-             *
-             * The Wallet Holder app should still be default for PAYMENT_AID_1 and
-             * PAYMENT_AID_2.
-             **/
-            CardEmulation instance = CardEmulation.getInstance(mAdapter);
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_2));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getAssociatedService(),
-                    WalletRoleTestUtils.PAYMENT_AID_3));
-        });
-        setMockService();
-    }
-
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    @Test
-    public void testAidResolutionWithRoleHolder() throws NoSuchFieldException {
-        restoreOriginalService();
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        runWithRole(mContext, WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME, ()-> {
-            /*
-             * Aid Mapping:
-             * Wallet Holder App: Service 1:     PAYMENT_AID_1, PAYMENT_AID_2
-             * Wallet Holder App: Service 2:     PAYMENT_AID_1, PAYMENT_AID_2
-             * Foreground App :   Only Service:  PAYMENT_AID_1
-             * Non Payment App:   Only Service:  NON_PAYMENT_AID_1
-             *
-             * Scenario:
-             * Wallet Role Holder is WalletRoleHolderApp
-             * Foreground app: None
-             *
-             * Expected Outcome:
-             * Wallet role holder and a background app holds PAYMENT_AID_1.
-             * So the Wallet role holder app is expected to get the routing for PAYMENT_AID_1.
-             * The wallet role holder has two services holding PAYMENT_AID_1. Therefore the one
-             * that has the priority based on alphabetical sorting of their names gets the routing
-             * WalletRoleHolderService vs XWAlletRoleHolderService. WalletRoleHolderService gets it.
-             *
-             * Only the Wallet Role Holder holds PAYMENT_AID_2.
-             * So the wallet role holder app gets the routing for PAYMENT_AID_2.
-             *
-             * A background app that is not the wallet role holder has the NON_PAYMENT_AID_1.
-             * So that app gets the routing for NON_PAYMENT_AID_1.
-             **/
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_2));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderXService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderXService(),
-                    WalletRoleTestUtils.PAYMENT_AID_2));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getForegroundService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.NON_PAYMENT_AID_1));
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getNonPaymentService(),
-                    WalletRoleTestUtils.NON_PAYMENT_AID_1));
-        });
-        setMockService();
-    }
-
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    @Test
-    public void testAidResolutionWithRoleHolderSetToNone() throws NoSuchFieldException {
-        restoreOriginalService();
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        runWithRoleNone(mContext, ()-> {
-            /*
-             * Aid Mapping:
-             * Wallet Holder App: Service 1:     PAYMENT_AID_1, PAYMENT_AID_2
-             * Wallet Holder App: Service 2:     PAYMENT_AID_1, PAYMENT_AID_2
-             * Foreground App :   Only Service:  PAYMENT_AID_1
-             * Non Payment App:   Only Service:  NON_PAYMENT_AID_1
-             *
-             * Scenario:
-             * Wallet Role Holder is Set to None
-             *
-             * Expected Outcome:
-             * Wallet role holder does not exist therefore routing is handled on the basis of
-             * supported AIDs and overlapping services.
-             *
-             * Non Payment App is the only map holding the NON_PAYMENT_AID_1 and will be set
-             * as the default service for that AID.
-             *
-             *  The rest of the apps will always need to disambig and will not be set as defaults.
-             *
-             **/
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_2));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderXService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderXService(),
-                    WalletRoleTestUtils.PAYMENT_AID_2));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getForegroundService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.NON_PAYMENT_AID_1));
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getNonPaymentService(),
-                    WalletRoleTestUtils.NON_PAYMENT_AID_1));
-        });
-    }
-
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    @Test
-    public void testAidResolutionWithRoleHolder_holderDoesNotSupportAid_overLappingAids()
-            throws NoSuchFieldException {
-        restoreOriginalService();
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        runWithRole(mContext, WalletRoleTestUtils.NON_PAYMENT_NFC_PACKAGE_NAME, ()-> {
-            /*
-             * Aid Mapping:
-             * Wallet Holder App: Service 1:     PAYMENT_AID_1, PAYMENT_AID_2
-             * Wallet Holder App: Service 2:     PAYMENT_AID_1, PAYMENT_AID_2
-             * Foreground App :   Only Service:  PAYMENT_AID_1
-             * Non Payment App:   Only Service:  NON_PAYMENT_AID_1
-             *
-             * Scenario:
-             * Wallet Role Holder is Non Payment App
-             * Foreground app: None
-             *
-             * Expected Outcome:
-             * Wallet role holder holds NON_PAYMENT_AID_1
-             * So wallet role holders gets the routing for NON_PAYMENT_AID_1.
-             * The non wallet apps have overlapping aids and therefore no default services exist
-             * for those AIDs.
-             *
-             **/
-            Assert.assertTrue(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getNonPaymentService(),
-                    WalletRoleTestUtils.NON_PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_2));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderXService(),
-                    WalletRoleTestUtils.PAYMENT_AID_2));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getWalletRoleHolderService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getForegroundService(),
-                    WalletRoleTestUtils.PAYMENT_AID_1));
-            Assert.assertFalse(instance.isDefaultServiceForAid(
-                    WalletRoleTestUtils.getForegroundService(),
-                    WalletRoleTestUtils.PAYMENT_AID_2));
-        });
-        setMockService();
-    }
-
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OVERRIDE_RECOVER_ROUTING_TABLE)
-    @Test
-    public void testOverrideRoutingTable() {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-        final Activity activity = createAndResumeActivity();
-        CardEmulation instance = CardEmulation.getInstance(adapter);
-        Assert.assertThrows(SecurityException.class,
-                () -> instance.overrideRoutingTable(activity,
-                        CardEmulation.PROTOCOL_AND_TECHNOLOGY_ROUTE_DH,
-                        CardEmulation.PROTOCOL_AND_TECHNOLOGY_ROUTE_UNSET));
-        instance.setPreferredService(activity,
-                new ComponentName(mContext, CtsMyHostApduService.class));
-        instance.overrideRoutingTable(activity,
-                CardEmulation.PROTOCOL_AND_TECHNOLOGY_ROUTE_DH,
-                CardEmulation.PROTOCOL_AND_TECHNOLOGY_ROUTE_UNSET);
-    }
-
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OVERRIDE_RECOVER_ROUTING_TABLE)
-    @Test
-    public void testRecoverRoutingTable() {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-        final Activity activity = createAndResumeActivity();
-        CardEmulation instance = CardEmulation.getInstance(adapter);
-        instance.recoverRoutingTable(activity);
-    }
-
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_SET_SERVICE_ENABLED_FOR_CATEGORY_OTHER)
-    @Test
-    public void testSetServiceEnabledForCategoryOther()
-            throws NoSuchFieldException, RemoteException {
-        CardEmulation instance = createMockedInstance();
-        when(mEmulation.setServiceEnabledForCategoryOther(
-                anyInt(), any(ComponentName.class), anyBoolean()))
-                .thenReturn(SET_SERVICE_ENABLED_STATUS_OK);
-        int result = instance.setServiceEnabledForCategoryOther(mService, true);
-        Assert.assertEquals(SET_SERVICE_ENABLED_STATUS_OK, result);
-    }
-
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_CARD_EMULATION_EUICC)
-    @Test
-    public void testIsEuiccSupported() {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-        CardEmulation instance = CardEmulation.getInstance(adapter);
-        instance.isEuiccSupported();
-    }
-
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_CARD_EMULATION_EUICC)
-    @Test
-    public void testGetSetDefaultNfcSubscriptionId() {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-        CardEmulation instance = CardEmulation.getInstance(adapter);
-        instance.setDefaultNfcSubscriptionId(0); // This may not be set on all OEM devices.
-        instance.getDefaultNfcSubscriptionId(); // This may not be set on all OEM devices.
-    }
-
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_APDU_SERVICE_INFO_CONSTRUCTOR)
-    @Test
-    public void testApduServiceInfoConstructor() {
-        ResolveInfo ndefNfceeAppInfo = new ResolveInfo();
-        List<String> ndefNfceeAid = new ArrayList<String>();
-        AidGroup ndefNfceeAidGroup = new AidGroup(ndefNfceeAid, "other");
-        ArrayList<AidGroup> ndefNfceeAidStaticGroups = new ArrayList<>();
-        ndefNfceeAidStaticGroups.add(ndefNfceeAidGroup);
-        ArrayList<AidGroup> ndefNfceeAidDynamicGroups = new ArrayList<>();
-        ApduServiceInfo apduServiceINfo =
-                new ApduServiceInfo(
-                        ndefNfceeAppInfo,
-                        false,
-                        "test service",
-                        ndefNfceeAidStaticGroups,
-                        ndefNfceeAidDynamicGroups,
-                        false,
-                        0,
-                        0,
-                        "test service",
-                        "test",
-                        "test");
-    }
-
-    private void assumeObserveModeSupported(@NonNull NfcAdapter adapter) {
-        assumeTrue("Observe mode must be supported", adapter.isObserveModeSupported());
-    }
-
-    private void assumeVsrApiGreaterThanUdc() {
-        assumeTrue("Device VSR API level must be greater than UDC",
-            getVsrApiLevel() > Build.VERSION_CODES.UPSIDE_DOWN_CAKE);
-    }
-
-    private Activity createAndResumeActivity() {
-        ensureUnlocked();
-        Intent intent
-            = new Intent(ApplicationProvider.getApplicationContext(),
-                NfcFCardEmulationActivity.class);
-        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        Activity activity = InstrumentationRegistry.getInstrumentation().startActivitySync(intent);
-        InstrumentationRegistry.getInstrumentation().callActivityOnResume(activity);
-        return activity;
-    }
-
-    private CardEmulation createMockedInstance() throws NoSuchFieldException {
-        CardEmulation instance = CardEmulation.getInstance(mAdapter);
-        FieldSetter.setField(
-                instance, instance.getClass().getDeclaredField("sService"), mEmulation);
-        return instance;
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/CtsMyHostApduService.java b/tests/tests/nfc/src/android/nfc/cts/CtsMyHostApduService.java
deleted file mode 100644
index 4380d14..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/CtsMyHostApduService.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package android.nfc.cts;
-
-
-import android.nfc.cardemulation.*;
-import android.os.Bundle;
-
-import java.util.List;
-
-public class CtsMyHostApduService extends HostApduService {
-    static final String POLLING_LOOP_RECEIVED_ACTION = "CTS_NFC_POLLING_LOOP";
-    static final String SERVICE_NAME_EXTRA = "CTS_NFC_SERVICE_NAME_EXTRA";
-    static final String POLLING_FRAMES_EXTRA = "CTS_NFC_POLLING_FRAMES_EXTRA";
-
-
-    public void ctsNotifyUnhandled() {
-      return;
-    }
-
-    @Override
-    public byte[] processCommandApdu(byte[] apdu, Bundle extras) {
-        return new byte[0];
-    }
-
-    @Override
-    public void onDeactivated(int reason) {
-        return;
-    }
-
-    @Override
-    public void processPollingFrames(List<PollingFrame> frames) {
-        if (CardEmulationTest.sCurrentPollLoopReceiver != null) {
-            CardEmulationTest.sCurrentPollLoopReceiver.notifyPollingLoop(this.getClass().getName(),
-                    frames);
-        }
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/CtsMyHostNfcFService.java b/tests/tests/nfc/src/android/nfc/cts/CtsMyHostNfcFService.java
deleted file mode 100644
index 32095ff..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/CtsMyHostNfcFService.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package android.nfc.cts;
-
-import android.nfc.cardemulation.*;
-import android.os.Bundle;
-
-public class CtsMyHostNfcFService extends HostNfcFService {
-    @Override
-    public byte[] processNfcFPacket(byte[] commandPacket, Bundle extras) {
-        return new byte[0];
-    }
-
-    @Override
-    public void onDeactivated(int reason) {
-        return;
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/CtsMyOffHostApduService.java b/tests/tests/nfc/src/android/nfc/cts/CtsMyOffHostApduService.java
deleted file mode 100644
index 3388f1b..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/CtsMyOffHostApduService.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package android.nfc.cts;
-
-import android.content.Intent;
-import android.nfc.cardemulation.*;
-import android.os.IBinder;
-
-public class CtsMyOffHostApduService extends OffHostApduService {
-    @Override
-    public IBinder onBind(Intent intent) {
-        return null;
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/CtsMyOffHostDefaultToObserveApduService.java b/tests/tests/nfc/src/android/nfc/cts/CtsMyOffHostDefaultToObserveApduService.java
deleted file mode 100644
index ab36f4e..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/CtsMyOffHostDefaultToObserveApduService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import android.content.Intent;
-import android.nfc.cardemulation.OffHostApduService;
-import android.os.IBinder;
-
-public class CtsMyOffHostDefaultToObserveApduService extends OffHostApduService {
-    @Override
-    public IBinder onBind(Intent intent) {
-        return null;
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/CustomHostApduService.java b/tests/tests/nfc/src/android/nfc/cts/CustomHostApduService.java
deleted file mode 100644
index 5014221..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/CustomHostApduService.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import android.nfc.cardemulation.PollingFrame;
-
-import java.util.List;
-
-public class CustomHostApduService extends CtsMyHostApduService {
-
-    @Override
-    public void processPollingFrames(List<PollingFrame> frames) {
-        if (CardEmulationTest.sCurrentPollLoopReceiver != null) {
-            CardEmulationTest.sCurrentPollLoopReceiver.notifyPollingLoop(this.getClass().getName(),
-                    frames);
-        }
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/DefaultPaymentProviderTestUtils.java b/tests/tests/nfc/src/android/nfc/cts/DefaultPaymentProviderTestUtils.java
deleted file mode 100644
index 8771bf2..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/DefaultPaymentProviderTestUtils.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.nfc.Constants;
-import android.nfc.NfcAdapter;
-import android.nfc.cardemulation.CardEmulation;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.UserHandle;
-import android.provider.Settings;
-
-import com.android.compatibility.common.util.CommonTestUtils;
-
-import org.junit.Assert;
-
-public final class DefaultPaymentProviderTestUtils {
-
-    static final ComponentName CTS_MY_HOSTAPDU_SERVICE =
-            new ComponentName("android.nfc.cts", "android.nfc.cts.CtsMyHostApduService");
-
-    static final String CTS_MY_HOSTAPDU_SERVICE_DESC = "CTS Nfc Test Service";
-
-    private DefaultPaymentProviderTestUtils() {}
-
-    static ComponentName setDefaultPaymentService(Class serviceClass, Context context) {
-        ComponentName componentName = setDefaultPaymentService(
-                new ComponentName(context, serviceClass), context);
-        return componentName;
-    }
-
-    static ComponentName setDefaultPaymentSetting(ComponentName serviceName, Context context) {
-        ComponentName originalValue = CardEmulation.getPreferredPaymentService(context);
-        Settings.Secure.putString(context.getContentResolver(),
-                Constants.SETTINGS_SECURE_NFC_PAYMENT_DEFAULT_COMPONENT,
-                serviceName == null ? null
-                        : serviceName.flattenToString());
-        return originalValue;
-    }
-
-    static ComponentName setDefaultPaymentService(ComponentName serviceName, Context context) {
-        try {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity();
-
-            NfcAdapter adapter = NfcAdapter.getDefaultAdapter(context);
-            CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-            CardEmulationTest.SettingsObserver settingsObserver =
-                    new CardEmulationTest.SettingsObserver(new Handler(Looper.getMainLooper()));
-            context.getContentResolver().registerContentObserverAsUser(
-                    Settings.Secure.getUriFor(
-                            Constants.SETTINGS_SECURE_NFC_PAYMENT_DEFAULT_COMPONENT),
-                    true, settingsObserver, UserHandle.ALL);
-            ComponentName originalValue = setDefaultPaymentSetting(serviceName, context);
-            int count = 0;
-            while (!settingsObserver.mSeenChange
-                    && !cardEmulation.isDefaultServiceForCategory(serviceName,
-                    CardEmulation.CATEGORY_PAYMENT) && count < 10) {
-                synchronized (settingsObserver) {
-                    try {
-                        settingsObserver.wait(200);
-                    } catch (InterruptedException ie) {
-                    }
-                    count++;
-                }
-            }
-            Assert.assertTrue(count < 10);
-            Assert.assertTrue(serviceName == null
-                    ? null == CardEmulation.getPreferredPaymentService(context)
-                    : serviceName.equals(cardEmulation.getPreferredPaymentService(context)));
-            return originalValue;
-        } finally {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().dropShellPermissionIdentity();
-        }
-    }
-
-    static void ensurePreferredService(String serviceDesc, Context context) {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(context);
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            CommonTestUtils.waitUntil("Default service hasn't updated", 6,
-                    () -> serviceDesc.equals(
-                            cardEmulation.getDescriptionForPreferredPaymentService()));
-        } catch (InterruptedException|AssertionError e) { }
-    }
-
-    static void runWithDefaultPaymentService(Context context,
-            ComponentName service, String description,
-            Runnable runnable) {
-        ComponentName originalValue = setDefaultPaymentService(service, context);
-        if (service != null) {
-            ensurePreferredService(description, context);
-        }
-        runnable.run();
-        if (originalValue != null) {
-            setDefaultPaymentService(originalValue, context);
-        }
-    }
-
-    static void runWithDefaultPaymentSetting(Context context, ComponentName service,
-            Runnable runnable) {
-        ComponentName originalValue = setDefaultPaymentSetting(service, context);
-        runnable.run();
-        if (originalValue != null) {
-            setDefaultPaymentSetting(originalValue, context);
-        }
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/HostApduServiceTest.java b/tests/tests/nfc/src/android/nfc/cts/HostApduServiceTest.java
deleted file mode 100644
index ead3399..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/HostApduServiceTest.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package android.nfc.cts;
-
-import android.content.Intent;
-import android.nfc.cardemulation.PollingFrame;
-import android.os.Bundle;
-import android.os.Looper;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import java.util.ArrayList;
-
-
-@RunWith(JUnit4.class)
-public class HostApduServiceTest {
-  private CtsMyHostApduService service;
-
-  @Before
-  public void setUp() {
-    if (Looper.myLooper() == null) {
-      Looper.prepare();
-    }
-    service = new CtsMyHostApduService();
-  }
-
-  @Test
-  public void testOnBind() {
-    Intent serviceIntent
-          = new Intent(CtsMyHostApduService.SERVICE_INTERFACE);
-    Assert.assertNotNull(service.onBind(serviceIntent));
-  }
-
-  @Test
-  public void testSendResponseApdu() {
-    try {
-      byte[] responseApdu = new byte[0];
-      service.sendResponseApdu(responseApdu);
-    } catch (Exception e) {
-      throw new IllegalStateException("Unexpected Exception: " + e);
-    }
-  }
-
-  @Test
-  public void testNotifyUnhandled() {
-    try {
-      service.ctsNotifyUnhandled();
-    } catch (Exception e) {
-      throw new IllegalStateException("Unexpected Exception: " + e);
-    }
-  }
-
-    @Test
-  @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_READ_POLLING_LOOP)
-  public void testProcessPollingFrame() {
-        ArrayList<PollingFrame> frames = new ArrayList<PollingFrame>();
-        PollingFrame frame =
-                new PollingFrame(PollingFrame.POLLING_LOOP_TYPE_A, new byte[0], 0, 0, false);
-        frames.add(frame);
-        service.processPollingFrames(frames);
-    }
-
-  @Test
-  public void testProcessCommandApdu() {
-    byte[] result = service.processCommandApdu(new byte[0], new Bundle());
-    Assert.assertNotNull(result);
-    Assert.assertTrue(result.length == 0);
-  }
-
-  @Test
-  public void testOnDeactivated() {
-    try {
-      service.onDeactivated(CtsMyHostApduService.DEACTIVATION_LINK_LOSS);
-      service.onDeactivated(CtsMyHostApduService.DEACTIVATION_DESELECTED);
-    } catch (Exception e) {
-      throw new IllegalStateException("Unexpected Exception: " + e);
-    }
-  }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/HostNfcFServiceTest.java b/tests/tests/nfc/src/android/nfc/cts/HostNfcFServiceTest.java
deleted file mode 100644
index cf41790..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/HostNfcFServiceTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package android.nfc.cts;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Looper;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class HostNfcFServiceTest {
-    private CtsMyHostNfcFService service;
-
-    @Before
-    public void setUp() {
-        if (Looper.myLooper() == null) {
-            Looper.prepare();
-        }
-        service = new CtsMyHostNfcFService();
-    }
-
-    @Test
-    public void testOnBind() {
-        Intent serviceIntent
-            = new Intent(CtsMyHostNfcFService.SERVICE_INTERFACE);
-        Assert.assertNotNull(service.onBind(serviceIntent));
-    }
-
-    @Test
-    public void testSendResponsePacket() {
-        try {
-            byte[] responsePacket = new byte[0];
-            service.sendResponsePacket(responsePacket);
-        } catch (Exception e) {
-            throw new IllegalStateException("Unexpected Exception: " + e);
-        }
-    }
-
-    @Test
-    public void testProcessNfcFPacket() {
-        byte[] result = service.processNfcFPacket(new byte[0], new Bundle());
-        Assert.assertNotNull(result);
-        Assert.assertTrue(result.length == 0);
-    }
-
-    @Test
-    public void testOnDeactivated() {
-        try {
-            service.onDeactivated(CtsMyHostNfcFService.DEACTIVATION_LINK_LOSS);
-        } catch (Exception e) {
-            throw new IllegalStateException("Unexpected Exception: " + e);
-        }
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcAdapterTest.java b/tests/tests/nfc/src/android/nfc/cts/NfcAdapterTest.java
deleted file mode 100644
index 216ebff..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/NfcAdapterTest.java
+++ /dev/null
@@ -1,1090 +0,0 @@
-package android.nfc.cts;
-
-import static android.Manifest.permission.NFC_SET_CONTROLLER_ALWAYS_ON;
-import static android.nfc.cardemulation.CardEmulation.PROTOCOL_AND_TECHNOLOGY_ROUTE_ESE;
-import static android.nfc.cardemulation.CardEmulation.PROTOCOL_AND_TECHNOLOGY_ROUTE_UNSET;
-
-import static com.android.compatibility.common.util.PropertyUtil.getVsrApiLevel;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.anyBoolean;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.app.Activity;
-import android.app.PendingIntent;
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.ContextWrapper;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.nfc.AvailableNfcAntenna;
-import android.nfc.Flags;
-import android.nfc.INfcAdapter;
-import android.nfc.NdefMessage;
-import android.nfc.NfcAdapter;
-import android.nfc.NfcAntennaInfo;
-import android.nfc.NfcOemExtension;
-import android.nfc.NfcRoutingTableEntry;
-import android.nfc.OemLogItems;
-import android.nfc.T4tNdefNfcee;
-import android.nfc.T4tNdefNfceeCcFileInfo;
-import android.nfc.Tag;
-import android.nfc.TechListParcel;
-import android.nfc.cardemulation.ApduServiceInfo;
-import android.nfc.cardemulation.CardEmulation;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.UserHandle;
-import android.platform.test.annotations.RequiresFlagsDisabled;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-import android.platform.test.flag.junit.CheckFlagsRule;
-import android.platform.test.flag.junit.DeviceFlagsValueProvider;
-
-import androidx.annotation.NonNull;
-import androidx.test.InstrumentationRegistry;
-import androidx.test.core.app.ApplicationProvider;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.internal.util.reflection.FieldReader;
-import org.mockito.internal.util.reflection.FieldSetter;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-import java.util.function.Consumer;
-
-@RunWith(JUnit4.class)
-public class NfcAdapterTest {
-
-    private static final long MAX_POLLING_PAUSE_TIMEOUT = 40000;
-    @Mock private INfcAdapter mService;
-    @Mock private DevicePolicyManager mDevicePolicyManager;
-    private INfcAdapter mSavedService;
-    private Context mContext;
-    @Rule
-    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
-
-    private boolean supportsHardware() {
-        final PackageManager pm = mContext.getPackageManager();
-        return pm.hasSystemFeature(PackageManager.FEATURE_NFC);
-    }
-
-    @Before
-    public void setUp() throws NoSuchFieldException {
-        MockitoAnnotations.initMocks(this);
-        mContext = spy(new ContextWrapper(InstrumentationRegistry.getContext()));
-        assumeTrue(supportsHardware());
-        // Backup the original service. It is being overridden
-        // when creating a mocked adapter.
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assume.assumeNotNull(adapter);
-        Assume.assumeTrue(NfcUtils.enableNfc(adapter, mContext));
-        mSavedService = (INfcAdapter) (
-            new FieldReader(adapter, adapter.getClass().getDeclaredField("sService")).read());
-    }
-
-    @After
-    public void tearDown() throws NoSuchFieldException {
-        if (!supportsHardware()) return;
-        // Restore the original service.
-        if (!supportsHardware()) {
-            return;
-        }
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        if (adapter != null) {
-            FieldSetter.setField(adapter,
-                    adapter.getClass().getDeclaredField("sService"), mSavedService);
-        }
-    }
-
-    @Test
-    public void testGetDefaultAdapter() {
-        NfcAdapter adapter = getDefaultAdapter();
-        Assert.assertNotNull(adapter);
-    }
-
-    @Test
-    public void testAddNfcUnlockHandler() {
-            NfcAdapter adapter = getDefaultAdapter();
-            adapter.addNfcUnlockHandler(new CtsNfcUnlockHandler(), new String[]{"IsoDep"});
-    }
-
-    @Test
-    public void testDisableWithNoParams() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = getDefaultAdapter();
-        Assert.assertTrue(NfcUtils.disableNfc(adapter, mContext));
-    }
-
-    @Test
-    public void testDisableWithParam() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = getDefaultAdapter();
-        Assert.assertTrue(NfcUtils.disableNfc(adapter, mContext, true));
-    }
-
-    @Test
-    public void testDisableForegroundDispatch() {
-            NfcAdapter adapter = getDefaultAdapter();
-            Activity activity = createAndResumeActivity();
-            adapter.disableForegroundDispatch(activity);
-    }
-
-    @Test
-    public void testDisableReaderMode() {
-            NfcAdapter adapter = getDefaultAdapter();
-            Activity activity = createAndResumeActivity();
-            adapter.disableReaderMode(activity);
-    }
-
-    @Test
-    public void testEnable() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = getDefaultAdapter();
-        Assert.assertTrue(NfcUtils.disableNfc(adapter, mContext, true));
-        Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-    }
-
-    @Test
-    public void testEnableForegroundDispatch() throws RemoteException {
-            NfcAdapter adapter = getDefaultAdapter();
-            Activity activity = createAndResumeActivity();
-            Intent intent = new Intent(ApplicationProvider.getApplicationContext(),
-                NfcFCardEmulationActivity.class);
-            PendingIntent pendingIntent
-                = PendingIntent.getActivity(ApplicationProvider.getApplicationContext(),
-                    0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE);
-            String[][] techLists = new String[][]{new String[]{}};
-            doNothing().when(mService).setForegroundDispatch(any(PendingIntent.class),
-                any(IntentFilter[].class), any(TechListParcel.class));
-            adapter.enableForegroundDispatch(activity, pendingIntent, null, techLists);
-    }
-
-    @Test
-    public void testEnableReaderMode() {
-            NfcAdapter adapter = getDefaultAdapter();
-            Activity activity = createAndResumeActivity();
-            adapter.enableReaderMode(activity, new CtsReaderCallback(),
-                NfcAdapter.FLAG_READER_NFC_A, new Bundle());
-    }
-
-    @Test
-    public void testEnableReaderOption() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = getDefaultAdapter();
-        adapter.enableReaderOption(true);
-    }
-
-    @Test
-    public void testEnableSecureNfc() throws RemoteException {
-        NfcAdapter adapter = createMockedInstance();
-        when(mService.setNfcSecure(anyBoolean())).thenReturn(true);
-        boolean result = adapter.enableSecureNfc(true);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testGetNfcAntennaInfo() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = createMockedInstance();
-        NfcAntennaInfo info = new NfcAntennaInfo(0, 0, false,
-            new ArrayList<AvailableNfcAntenna>());
-        when(mService.getNfcAntennaInfo()).thenReturn(info);
-        NfcAntennaInfo result = adapter.getNfcAntennaInfo();
-        Assert.assertEquals(info, result);
-        resetMockedInstance();
-    }
-
-    @Test
-    public void testIgnore() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = createMockedInstance();
-        Tag tag = new Tag(new byte[]{0x00}, new int[]{}, new Bundle[]{}, 0, 0L, null);
-        when(mService.ignore(anyInt(), anyInt(), eq(null))).thenReturn(true);
-        boolean result = adapter.ignore(tag, 0, null, null);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testIsControllerAlwaysOn() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = createMockedInstance();
-        when(mService.isControllerAlwaysOn()).thenReturn(true);
-        boolean result = adapter.isControllerAlwaysOn();
-        Assert.assertTrue(result);
-        resetMockedInstance();
-    }
-
-    @Test
-    public void testIsControllerAlwaysOnSupported() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = createMockedInstance();
-        when(mService.isControllerAlwaysOnSupported()).thenReturn(true);
-        boolean result = adapter.isControllerAlwaysOnSupported();
-        Assert.assertTrue(result);
-        resetMockedInstance();
-    }
-
-    @Test
-    public void testIsEnabled() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = createMockedInstance();
-        when(mService.getState()).thenReturn(NfcAdapter.STATE_ON);
-        boolean result = adapter.isEnabled();
-        Assert.assertTrue(result);
-        resetMockedInstance();
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_READER_OPTION)
-    public void testIsReaderOptionEnabled() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = getDefaultAdapter();
-        boolean result = adapter.isReaderOptionEnabled();
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_READER_OPTION)
-    public void testIsReaderOptionSupported() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = createMockedInstance();
-        when(mService.isReaderOptionSupported()).thenReturn(true);
-        boolean result = adapter.isReaderOptionSupported();
-        Assert.assertTrue(result);
-        resetMockedInstance();
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_MAINLINE)
-    public void testAdapterState() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = createMockedInstance();
-        when(mService.getState()).thenReturn(NfcAdapter.STATE_ON);
-        Assert.assertEquals(adapter.getAdapterState(), NfcAdapter.STATE_ON);
-        resetMockedInstance();
-    }
-
-    @Test
-    public void testIsSecureNfcEnabled() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = createMockedInstance();
-        when(mService.isNfcSecureEnabled()).thenReturn(true);
-        boolean result = adapter.isSecureNfcEnabled();
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testIsSecureNfcSupported() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = createMockedInstance();
-        when(mService.deviceSupportsNfcSecure()).thenReturn(true);
-        boolean result = adapter.isSecureNfcSupported();
-        Assert.assertTrue(result);
-        resetMockedInstance();
-    }
-
-    @Test
-    public void testRemoveNfcUnlockHandler() {
-        NfcAdapter adapter = getDefaultAdapter();
-        boolean result = adapter.removeNfcUnlockHandler(new CtsNfcUnlockHandler());
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_SET_DISCOVERY_TECH)
-    public void testResetDiscoveryTechnology() {
-        NfcAdapter adapter = getDefaultAdapter();
-        Activity activity = createAndResumeActivity();
-        adapter.setDiscoveryTechnology(activity, NfcAdapter.FLAG_READER_KEEP,
-                NfcAdapter.FLAG_LISTEN_KEEP);
-        adapter.resetDiscoveryTechnology(activity);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_SET_DISCOVERY_TECH)
-    public void testSetDiscoveryTechnology() {
-        NfcAdapter adapter = getDefaultAdapter();
-        Activity activity = createAndResumeActivity();
-        adapter.setDiscoveryTechnology(activity,
-                NfcAdapter.FLAG_READER_NFC_A | NfcAdapter.FLAG_READER_NFC_B
-                | NfcAdapter.FLAG_READER_NFC_F,
-                NfcAdapter.FLAG_LISTEN_NFC_PASSIVE_A | NfcAdapter.FLAG_LISTEN_NFC_PASSIVE_B
-                | NfcAdapter.FLAG_LISTEN_NFC_PASSIVE_F);
-        adapter.resetDiscoveryTechnology(activity);
-        adapter.setDiscoveryTechnology(activity, NfcAdapter.FLAG_READER_DISABLE,
-                NfcAdapter.FLAG_LISTEN_KEEP);
-        adapter.resetDiscoveryTechnology(activity);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_SET_DEFAULT_DISC_TECH)
-    public void testSetDefaultDiscoveryTechnology() {
-        NfcAdapter adapter = getDefaultAdapter();
-        Activity activity = createAndResumeActivity();
-        adapter.setDiscoveryTechnology(activity,
-                NfcAdapter.FLAG_READER_KEEP,
-                NfcAdapter.FLAG_LISTEN_NFC_PASSIVE_B
-                | NfcAdapter.FLAG_SET_DEFAULT_TECH);
-        adapter.setDiscoveryTechnology(activity, NfcAdapter.FLAG_READER_KEEP,
-                NfcAdapter.FLAG_LISTEN_KEEP | NfcAdapter.FLAG_SET_DEFAULT_TECH | 0xff);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_MAINLINE)
-    public void testSetReaderMode() {
-        NfcAdapter adapter = getDefaultAdapter();
-        // Verify the API does not crash or throw any exceptions.
-        adapter.setReaderModePollingEnabled(true);
-        adapter.setReaderModePollingEnabled(false);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_OBSERVE_MODE)
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testAllowTransaction() {
-        ComponentName originalDefault = null;
-        NfcAdapter adapter = getDefaultAdapter();
-        adapter.notifyHceDeactivated();
-        try {
-            originalDefault = setDefaultPaymentService(CtsMyHostApduService.class);
-            CardEmulationTest.ensurePreferredService(CtsMyHostApduService.class, mContext);
-            assumeTrue(adapter.isObserveModeSupported());
-            boolean result = adapter.setObserveModeEnabled(false);
-            Assert.assertTrue(result);
-        } finally {
-            setDefaultPaymentService(originalDefault);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_OBSERVE_MODE)
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testDisallowTransaction() {
-        ComponentName originalDefault = null;
-        NfcAdapter adapter = getDefaultAdapter();
-        adapter.notifyHceDeactivated();
-        try {
-            originalDefault = setDefaultPaymentService(CtsMyHostApduService.class);
-
-            assumeTrue(adapter.isObserveModeSupported());
-            boolean result = adapter.setObserveModeEnabled(true);
-            Assert.assertTrue(result);
-        } finally {
-            setDefaultPaymentService(originalDefault);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_OBSERVE_MODE)
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testDefaultObserveModePaymentDynamic() {
-        ComponentName originalDefault = null;
-        NfcAdapter adapter = getDefaultAdapter();
-        adapter.notifyHceDeactivated();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            cardEmulation.setShouldDefaultToObserveModeForService(new ComponentName(mContext,
-                    CustomHostApduService.class), true);
-            originalDefault = setDefaultPaymentService(CustomHostApduService.class);
-            CardEmulationTest.ensurePreferredService(CustomHostApduService.class, mContext);
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            setDefaultPaymentService(CtsMyHostApduService.class);
-            CardEmulationTest.ensurePreferredService(CtsMyHostApduService.class, mContext);
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-        } finally {
-            cardEmulation.setShouldDefaultToObserveModeForService(new ComponentName(mContext,
-                    CustomHostApduService.class), false);
-            setDefaultPaymentService(originalDefault);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_OBSERVE_MODE)
-    public void testDefaultObserveModeForegroundDynamic() {
-        NfcAdapter adapter = getDefaultAdapter();
-        adapter.notifyHceDeactivated();
-        assumeTrue(adapter.isObserveModeSupported());
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        try {
-            Activity activity = createAndResumeActivity();
-            cardEmulation.setShouldDefaultToObserveModeForService(new ComponentName(mContext,
-                    CustomHostApduService.class), true);
-            cardEmulation.setShouldDefaultToObserveModeForService(new ComponentName(mContext,
-                    CtsMyHostApduService.class), false);
-            Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                    new ComponentName(mContext, CustomHostApduService.class)));
-            CardEmulationTest.ensurePreferredService(CustomHostApduService.class, mContext);
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                    new ComponentName(mContext, CtsMyHostApduService.class)));
-            CardEmulationTest.ensurePreferredService(CtsMyHostApduService.class, mContext);
-            adapter.notifyHceDeactivated();
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-        } finally {
-            cardEmulation.setShouldDefaultToObserveModeForService(new ComponentName(mContext,
-                    CustomHostApduService.class), false);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_OBSERVE_MODE)
-    public void testDefaultObserveModeOnlyWithServiceChange() {
-        NfcAdapter adapter = getDefaultAdapter();
-        adapter.notifyHceDeactivated();
-        assumeTrue(adapter.isObserveModeSupported());
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        cardEmulation.setShouldDefaultToObserveModeForService(new ComponentName(mContext,
-                CtsMyHostApduService.class), true);
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.CTS_PACKAGE_NAME, () -> {
-            CardEmulationTest.ensurePreferredService(CtsMyHostApduService.class, mContext);
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            Assert.assertTrue(adapter.setObserveModeEnabled(false));
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-            try {
-                Activity activity = createAndResumeActivity();
-                Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                        new ComponentName(mContext, CtsMyHostApduService.class)));
-                CardEmulationTest.ensurePreferredService(CtsMyHostApduService.class, mContext);
-                Assert.assertFalse(adapter.isObserveModeEnabled());
-                Assert.assertTrue(adapter.setObserveModeEnabled(true));
-                Assert.assertTrue(adapter.isObserveModeEnabled());
-                Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                        new ComponentName(mContext, CustomHostApduService.class)));
-                CardEmulationTest.ensurePreferredService(CustomHostApduService.class, mContext);
-                Assert.assertFalse(adapter.isObserveModeEnabled());
-            } finally {
-                cardEmulation.setShouldDefaultToObserveModeForService(new ComponentName(mContext,
-                        CustomHostApduService.class), false);
-                cardEmulation.setShouldDefaultToObserveModeForService(new ComponentName(mContext,
-                        CtsMyHostApduService.class), false);
-                adapter.notifyHceDeactivated();
-            }
-        });
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_OBSERVE_MODE)
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testDefaultObserveModePayment() {
-        ComponentName originalDefault = null;
-        NfcAdapter adapter = getDefaultAdapter();
-        adapter.notifyHceDeactivated();
-        try {
-            originalDefault = setDefaultPaymentService(BackgroundHostApduService.class);
-            CardEmulationTest.ensurePreferredService(BackgroundHostApduService.class, mContext);
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            setDefaultPaymentService(CtsMyHostApduService.class);
-            CardEmulationTest.ensurePreferredService(CtsMyHostApduService.class, mContext);
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-        } finally {
-            setDefaultPaymentService(originalDefault);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(android.nfc.Flags.FLAG_NFC_OBSERVE_MODE)
-    public void testDefaultObserveModeForeground() {
-        NfcAdapter adapter = getDefaultAdapter();
-        CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        cardEmulation.setShouldDefaultToObserveModeForService(
-            new ComponentName(mContext, CtsMyHostApduService.class), false);
-        Activity activity = createAndResumeActivity();
-        adapter.notifyHceDeactivated();
-        assumeTrue(adapter.isObserveModeSupported());
-        Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                new ComponentName(mContext, BackgroundHostApduService.class)));
-        CardEmulationTest.ensurePreferredService(BackgroundHostApduService.class, mContext);
-        Assert.assertTrue(adapter.isObserveModeEnabled());
-        Assert.assertTrue(cardEmulation.setPreferredService(activity,
-                new ComponentName(mContext, CtsMyHostApduService.class)));
-        CardEmulationTest.ensurePreferredService(CtsMyHostApduService.class, mContext);
-        Assert.assertFalse(adapter.isObserveModeEnabled());
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_OBSERVE_MODE,
-            android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testAllowTransaction_walletRoleEnabled() {
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.CTS_PACKAGE_NAME, () -> {
-            NfcAdapter adapter = getDefaultAdapter();
-            adapter.notifyHceDeactivated();
-            assumeTrue(adapter.isObserveModeSupported());
-            adapter.setObserveModeEnabled(false);
-            Assert.assertFalse(adapter.isObserveModeEnabled());
-            adapter.notifyHceDeactivated();
-        });
-    }
-
-    @Test
-    @RequiresFlagsEnabled({android.nfc.Flags.FLAG_NFC_OBSERVE_MODE,
-            android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED})
-    public void testDisallowTransaction_walletRoleEnabled() {
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.CTS_PACKAGE_NAME, () -> {
-            NfcAdapter adapter = getDefaultAdapter();
-            adapter.notifyHceDeactivated();
-            assumeTrue(adapter.isObserveModeSupported());
-            adapter.setObserveModeEnabled(true);
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            adapter.notifyHceDeactivated();
-        });
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_CHARGING)
-    public void testEnableNfcCharging() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = getDefaultAdapter();
-        boolean result = adapter.setWlcEnabled(true);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_CHARGING)
-    public void testIsNfcChargingEnabled() throws NoSuchFieldException, RemoteException {
-        NfcAdapter adapter = getDefaultAdapter();
-        boolean result = adapter.isWlcEnabled();
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_VENDOR_CMD)
-    public void testSendVendorCmd() throws InterruptedException, RemoteException {
-        assumeTrue(getVsrApiLevel() > Build.VERSION_CODES.UPSIDE_DOWN_CAKE);
-        CountDownLatch rspCountDownLatch = new CountDownLatch(1);
-        CountDownLatch ntfCountDownLatch = new CountDownLatch(1);
-        NfcAdapter nfcAdapter = getDefaultAdapter();
-        Assert.assertNotNull(nfcAdapter);
-        NfcVendorNciCallback cb =
-                new NfcVendorNciCallback(rspCountDownLatch, ntfCountDownLatch);
-        try {
-            nfcAdapter.registerNfcVendorNciCallback(
-                    Executors.newSingleThreadExecutor(), cb);
-
-            // Android GET_CAPS command
-            int gid = 0xF;
-            int oid = 0xC;
-            byte[] payload = new byte[1];
-            payload[0] = 0;
-            nfcAdapter.sendVendorNciMessage(NfcAdapter.MESSAGE_TYPE_COMMAND, gid, oid, payload);
-
-            // Wait for response.
-            assertThat(rspCountDownLatch.await(1, TimeUnit.SECONDS)).isTrue();
-            assertThat(cb.gid).isEqualTo(gid);
-            assertThat(cb.oid).isEqualTo(oid);
-            assertThat(cb.payload).isNotEmpty();
-        } finally {
-            nfcAdapter.unregisterNfcVendorNciCallback(cb);
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_STATE_CHANGE)
-    public void testEnableByDeviceOwner() throws NoSuchFieldException, RemoteException {
-        denyPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS);
-        when(mDevicePolicyManager.getDeviceOwnerUser())
-                .thenReturn(new UserHandle(UserHandle.getCallingUserId()));
-        when(mDevicePolicyManager.getDeviceOwnerComponentOnAnyUser())
-                .thenReturn(ComponentName.createRelative("com.android.nfc", ".AdapterTest"));
-        when(mContext.getSystemService(DevicePolicyManager.class))
-                .thenReturn(mDevicePolicyManager);
-        NfcAdapter adapter = getDefaultAdapter();
-        boolean result = adapter.enable();
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_STATE_CHANGE)
-    public void testDisableByDeviceOwner() throws NoSuchFieldException, RemoteException {
-        denyPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS);
-        when(mDevicePolicyManager.getDeviceOwnerUser())
-                .thenReturn(new UserHandle(UserHandle.getCallingUserId()));
-        when(mDevicePolicyManager.getDeviceOwnerComponentOnAnyUser())
-                .thenReturn(ComponentName.createRelative("com.android.nfc", ".AdapterTest"));
-        when(mContext.getSystemService(DevicePolicyManager.class))
-                .thenReturn(mDevicePolicyManager);
-        NfcAdapter adapter = getDefaultAdapter();
-        boolean result = adapter.disable();
-        Assert.assertTrue(result);
-        result = adapter.enable();
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OBSERVE_MODE)
-    public void testShouldDefaultToObserveModeAfterNfcOffOn() throws InterruptedException {
-        NfcAdapter adapter = getDefaultAdapter();
-        adapter.notifyHceDeactivated();
-        assumeTrue(adapter.isObserveModeSupported());
-        adapter.notifyHceDeactivated();
-        Activity activity = createAndResumeActivity();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        ComponentName ctsService = new ComponentName(mContext, CtsMyHostApduService.class);
-
-        try {
-            Assert.assertTrue(cardEmulation.setShouldDefaultToObserveModeForService(ctsService,
-                    true));
-
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, ctsService));
-            CardEmulationTest.ensurePreferredService(CtsMyHostApduService.class, mContext);
-
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-            Assert.assertTrue(NfcUtils.disableNfc(adapter, mContext));
-            Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-        } finally {
-            cardEmulation.setShouldDefaultToObserveModeForService(ctsService,
-                    false);
-            cardEmulation.unsetPreferredService(activity);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OBSERVE_MODE)
-    public void testShouldDefaultToObserveModeWithNfcOff() throws InterruptedException {
-        NfcAdapter adapter = getDefaultAdapter();
-        adapter.notifyHceDeactivated();
-        assumeTrue(adapter.isObserveModeSupported());
-        Activity activity = createAndResumeActivity();
-        final CardEmulation cardEmulation = CardEmulation.getInstance(adapter);
-        ComponentName ctsService = new ComponentName(mContext, CtsMyHostApduService.class);
-        try {
-            Assert.assertTrue(NfcUtils.disableNfc(adapter, mContext));
-            Assert.assertTrue(cardEmulation.setShouldDefaultToObserveModeForService(ctsService,
-                    true));
-
-            Assert.assertTrue(cardEmulation.setPreferredService(activity, ctsService));
-            CardEmulationTest.ensurePreferredService(CtsMyHostApduService.class, mContext);
-
-            Assert.assertTrue(NfcUtils.enableNfc(adapter, mContext));
-            Assert.assertTrue(adapter.isObserveModeEnabled());
-        } finally {
-            cardEmulation.setShouldDefaultToObserveModeForService(ctsService,
-                    false);
-            cardEmulation.unsetPreferredService(activity);
-            adapter.notifyHceDeactivated();
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OEM_EXTENSION)
-    public void testOemExtension() throws InterruptedException {
-        CountDownLatch tagDetectedCountDownLatch = new CountDownLatch(3);
-        NfcAdapter nfcAdapter = getDefaultAdapter();
-        Assert.assertNotNull(nfcAdapter);
-        NfcOemExtension nfcOemExtension = nfcAdapter.getNfcOemExtension();
-        Assert.assertNotNull(nfcOemExtension);
-        NfcOemExtensionCallback cb =
-                new NfcOemExtensionCallback(tagDetectedCountDownLatch);
-        try {
-            nfcOemExtension.registerCallback(
-                    Executors.newSingleThreadExecutor(), cb);
-            tagDetectedCountDownLatch.await();
-
-            // TODO: Fix these tests as we add more functionality to this API surface.
-            nfcOemExtension.clearPreference();
-            nfcOemExtension.synchronizeScreenState();
-            Map<String, Integer> nfceeMap = nfcOemExtension.getActiveNfceeList();
-            for (var nfcee : nfceeMap.entrySet()) {
-                assertThat(nfcee.getKey()).isNotEmpty();
-            }
-            nfcOemExtension.hasUserEnabledNfc();
-            nfcOemExtension.isTagPresent();
-            nfcOemExtension.pausePolling(1000);
-            nfcOemExtension.resumePolling();
-            nfcOemExtension.getRoutingStatus();
-            nfcOemExtension.setAutoChangeEnabled(true);
-            assertThat(nfcOemExtension.isAutoChangeEnabled()).isTrue();
-            T4tNdefNfcee ndefNfcee = nfcOemExtension.getT4tNdefNfcee();
-            assertThat(ndefNfcee).isNotNull();
-            if (ndefNfcee.isSupported()) {
-                byte[] ndefData = new byte[] { 0x01, 0x02, 0x03, 0x04, 0x05 };
-                assertThat(ndefNfcee.writeData(5, ndefData))
-                               .isEqualTo(T4tNdefNfcee.WRITE_DATA_SUCCESS);
-                assertThat(ndefNfcee.readData(5)).isEqualTo(ndefData);
-                assertThat(ndefNfcee.isOperationOngoing()).isEqualTo(false);
-                T4tNdefNfceeCcFileInfo ccFileInfo = ndefNfcee.readCcfile();
-                assertThat(ccFileInfo).isNotNull();
-                assertThat(ccFileInfo.getCcFileLength()).isGreaterThan(0);
-                assertThat(ccFileInfo.getVersion()).isGreaterThan(0);
-                assertThat(ccFileInfo.getFileId()).isGreaterThan(5);
-                assertThat(ccFileInfo.getMaxSize()).isGreaterThan(0);
-                assertThat(ccFileInfo.isReadAllowed()).isEqualTo(true);
-                assertThat(ccFileInfo.isWriteAllowed()).isEqualTo(true);
-                assertThat(ndefNfcee.clearData()).isEqualTo(T4tNdefNfcee.CLEAR_DATA_SUCCESS);
-            }
-            if (Flags.nfcOverrideRecoverRoutingTable()) {
-                nfcOemExtension.overwriteRoutingTable(PROTOCOL_AND_TECHNOLOGY_ROUTE_ESE,
-                        PROTOCOL_AND_TECHNOLOGY_ROUTE_UNSET, PROTOCOL_AND_TECHNOLOGY_ROUTE_UNSET,
-                        PROTOCOL_AND_TECHNOLOGY_ROUTE_UNSET);
-            }
-            List<NfcRoutingTableEntry> entries = nfcOemExtension.getRoutingTable();
-            assertThat(entries).isNotNull();
-            entries.getFirst().getType();
-            entries.getFirst().getRouteType();
-            nfcOemExtension.forceRoutingTableCommit();
-            assertEquals(MAX_POLLING_PAUSE_TIMEOUT,
-                    nfcOemExtension.getMaxPausePollingTimeoutMills());
-        } finally {
-            nfcOemExtension.unregisterCallback(cb);
-        }
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OEM_EXTENSION)
-    public void testOemExtensionMaybeTriggerFirmwareUpdate()
-            throws InterruptedException, RemoteException {
-        NfcAdapter nfcAdapter = createMockedInstance();
-        Assert.assertNotNull(nfcAdapter);
-        NfcOemExtension nfcOemExtension = nfcAdapter.getNfcOemExtension();
-        Assert.assertNotNull(nfcOemExtension);
-        nfcOemExtension.maybeTriggerFirmwareUpdate();
-        verify(mService).checkFirmware();
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OEM_EXTENSION)
-    public void testOemExtensionTriggerInitialization()
-            throws InterruptedException, RemoteException {
-        NfcAdapter nfcAdapter = createMockedInstance();
-        Assert.assertNotNull(nfcAdapter);
-        NfcOemExtension nfcOemExtension = nfcAdapter.getNfcOemExtension();
-        Assert.assertNotNull(nfcOemExtension);
-        nfcOemExtension.triggerInitialization();
-        verify(mService).triggerInitialization();
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_OEM_EXTENSION)
-    public void testOemExtensionSetControllerAlwaysOn() throws InterruptedException {
-        NfcAdapter nfcAdapter = getDefaultAdapter();
-        Assert.assertNotNull(nfcAdapter);
-        NfcOemExtension nfcOemExtension = nfcAdapter.getNfcOemExtension();
-        Assert.assertNotNull(nfcOemExtension);
-        androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                .getUiAutomation().adoptShellPermissionIdentity(NFC_SET_CONTROLLER_ALWAYS_ON);
-        assumeTrue(nfcAdapter.isControllerAlwaysOnSupported());
-        NfcControllerAlwaysOnListener cb = null;
-        CountDownLatch countDownLatch;
-        try {
-            countDownLatch = new CountDownLatch(1);
-            cb = new NfcControllerAlwaysOnListener(countDownLatch);
-            nfcAdapter.registerControllerAlwaysOnListener(
-                    Executors.newSingleThreadExecutor(), cb);
-            nfcOemExtension.setControllerAlwaysOnMode(NfcOemExtension.ENABLE_TRANSPARENT);
-            assertTrue(countDownLatch.await(1, TimeUnit.SECONDS));
-            nfcAdapter.unregisterControllerAlwaysOnListener(cb);
-
-            countDownLatch = new CountDownLatch(1);
-            cb = new NfcControllerAlwaysOnListener(countDownLatch);
-            nfcAdapter.registerControllerAlwaysOnListener(
-                    Executors.newSingleThreadExecutor(), cb);
-            nfcOemExtension.setControllerAlwaysOnMode(NfcOemExtension.DISABLE);
-            assertTrue(countDownLatch.await(1, TimeUnit.SECONDS));
-            nfcAdapter.unregisterControllerAlwaysOnListener(cb);
-        } finally {
-            if (cb != null) nfcAdapter.unregisterControllerAlwaysOnListener(cb);
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().dropShellPermissionIdentity();
-        }
-    }
-
-    private class NfcControllerAlwaysOnListener implements NfcAdapter.ControllerAlwaysOnListener {
-        private final CountDownLatch mCountDownLatch;
-
-        NfcControllerAlwaysOnListener(CountDownLatch countDownLatch) {
-            mCountDownLatch = countDownLatch;
-        }
-
-        @Override
-        public void onControllerAlwaysOnChanged(boolean isEnabled) {
-            mCountDownLatch.countDown();
-        }
-    }
-
-    private class NfcOemExtensionCallback implements NfcOemExtension.Callback {
-        private final CountDownLatch mTagDetectedCountDownLatch;
-
-        NfcOemExtensionCallback(CountDownLatch countDownLatch) {
-            mTagDetectedCountDownLatch = countDownLatch;
-        }
-
-        @Override
-        public void onTagConnected(boolean connected) {
-            mTagDetectedCountDownLatch.countDown();
-        }
-
-        @Override
-        public void onStateUpdated(int state) {
-        }
-
-        @Override
-        public void onApplyRouting(@NonNull Consumer<Boolean> isSkipped) {
-        }
-
-        @Override
-        public void onNdefRead(@NonNull Consumer<Boolean> isSkipped) {
-        }
-
-        @Override
-        public void onEnableRequested(@NonNull Consumer<Boolean> isAllowed) {
-        }
-
-        @Override
-        public void onDisableRequested(@NonNull Consumer<Boolean> isAllowed) {
-        }
-
-        @Override
-        public void onBootStarted() {
-        }
-
-        @Override
-        public void onEnableStarted() {
-        }
-
-        @Override
-        public void onDisableStarted() {
-        }
-
-        @Override
-        public void onBootFinished(int status) {
-        }
-
-        @Override
-        public void onEnableFinished(int status) {
-        }
-
-        @Override
-        public void onDisableFinished(int status) {
-        }
-
-        @Override
-        public void onTagDispatch(@NonNull Consumer<Boolean> isSkipped) {
-        }
-
-        @Override
-        public void onRoutingChanged(@NonNull Consumer<Boolean> isSkipped) {
-        }
-
-        @Override
-        public void onHceEventReceived(int action) {
-        }
-
-        @Override
-        public void onReaderOptionChanged(boolean enabled) {
-        }
-
-        public void onCardEmulationActivated(boolean isActivated) {
-            mTagDetectedCountDownLatch.countDown();
-        }
-
-        @Override
-        public void onRfFieldActivated(boolean isActivated) {
-            mTagDetectedCountDownLatch.countDown();
-        }
-
-        @Override
-        public void onRfDiscoveryStarted(boolean isDiscoveryStarted) {
-            mTagDetectedCountDownLatch.countDown();
-        }
-
-        @Override
-        public void onEeListenActivated(boolean isActivated) {
-            mTagDetectedCountDownLatch.countDown();
-        }
-
-        @Override
-        public void onEeUpdated() {
-        }
-
-        @Override
-        public void onGetOemAppSearchIntent(@NonNull List<String> packages,
-                                            @NonNull Consumer<Intent> intentConsumer) {
-        }
-
-        @Override
-        public void onNdefMessage(@NonNull Tag tag, @NonNull NdefMessage message,
-                                  @NonNull Consumer<Boolean> hasOemExecutableContent) {
-        }
-
-        @Override
-        public void onLaunchHceAppChooserActivity(@NonNull String selectedAid,
-                                                  @NonNull List<ApduServiceInfo> services,
-                                                  @NonNull ComponentName failedComponent,
-                                                  @NonNull String category) {
-        }
-
-        @Override
-        public void onLaunchHceTapAgainDialog(@NonNull ApduServiceInfo service,
-                                              @NonNull String category) {
-        }
-
-        @Override
-        public void onRoutingTableFull() {
-        }
-
-        @Override
-        public void onLogEventNotified(@NonNull OemLogItems item) {
-        }
-
-        @Override
-        public void onExtractOemPackages(@NonNull NdefMessage message,
-                @NonNull Consumer<List<String>> packageConsumer) {
-        }
-    }
-
-    private class NfcVendorNciCallback implements NfcAdapter.NfcVendorNciCallback {
-        private final CountDownLatch mRspCountDownLatch;
-        private final CountDownLatch mNtfCountDownLatch;
-
-        public int gid;
-        public int oid;
-        public byte[] payload;
-
-        NfcVendorNciCallback(CountDownLatch rspCountDownLatch, CountDownLatch ntfCountDownLatch) {
-            mRspCountDownLatch = rspCountDownLatch;
-            mNtfCountDownLatch = ntfCountDownLatch;
-        }
-
-        @Override
-        public void onVendorNciResponse(int gid, int oid, byte[] payload) {
-            this.gid = gid;
-            this.oid = oid;
-            this.payload = payload;
-            mRspCountDownLatch.countDown();
-        }
-
-        @Override
-        public void onVendorNciNotification(int gid, int oid, byte[] payload) {
-            this.gid = gid;
-            this.oid = oid;
-            this.payload = payload;
-            mNtfCountDownLatch.countDown();
-        }
-    }
-
-    private class CtsReaderCallback implements NfcAdapter.ReaderCallback {
-        @Override
-        public void onTagDiscovered(Tag tag) {}
-    }
-
-    private class CtsNfcUnlockHandler implements NfcAdapter.NfcUnlockHandler {
-        @Override
-        public boolean onUnlockAttempted(Tag tag) {
-            return true;
-        }
-    }
-
-    private Activity createAndResumeActivity() {
-        CardEmulationTest.ensureUnlocked();
-        Intent intent = new Intent(ApplicationProvider.getApplicationContext(),
-            NfcFCardEmulationActivity.class);
-        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        Activity activity = InstrumentationRegistry.getInstrumentation().startActivitySync(intent);
-        InstrumentationRegistry.getInstrumentation().callActivityOnResume(activity);
-        return activity;
-    }
-
-    private NfcAdapter getDefaultAdapter() {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        try {
-            FieldSetter.setField(adapter, adapter.getClass().getDeclaredField("sService"),
-                    mSavedService);
-        } catch (NoSuchFieldException nsfe) {
-            throw new RuntimeException(nsfe);
-        }
-        return adapter;
-    }
-
-    private NfcAdapter createMockedInstance() {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        try {
-            FieldSetter.setField(adapter, adapter.getClass().getDeclaredField("sService"),
-                    mService);
-        } catch (NoSuchFieldException nsfe)  {
-            throw new RuntimeException(nsfe);
-        }
-        return adapter;
-    }
-
-    private void resetMockedInstance() {
-        NfcAdapter adapter = NfcAdapter.getDefaultAdapter(mContext);
-        try {
-            FieldSetter.setField(adapter, adapter.getClass().getDeclaredField("sService"),
-                    mSavedService);
-        } catch (NoSuchFieldException nsfe) {
-            throw new RuntimeException(nsfe);
-        }
-    }
-
-    private ComponentName setDefaultPaymentService(Class serviceClass) {
-        ComponentName componentName = setDefaultPaymentService(
-                new ComponentName(mContext, serviceClass));
-        if (componentName == null) {
-            return null;
-        }
-        return componentName;
-    }
-
-    private ComponentName setDefaultPaymentService(ComponentName serviceName) {
-        if (serviceName == null) {
-            return null;
-        }
-        return DefaultPaymentProviderTestUtils.setDefaultPaymentService(serviceName, mContext);
-    }
-
-    private void denyPermission(String permission) {
-        when(mContext.checkCallingOrSelfPermission(permission))
-                .thenReturn(PackageManager.PERMISSION_DENIED);
-        doThrow(new SecurityException()).when(mContext)
-                .enforceCallingOrSelfPermission(eq(permission), anyString());
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_CHECK_TAG_INTENT_PREFERENCE)
-    public void testIsTagIntentAllowed() throws NoSuchFieldException, RemoteException {
-        when(mService.isTagIntentAllowed(anyString(), anyInt())).thenReturn(true);
-        NfcAdapter adapter = createMockedInstance();
-        boolean result = adapter.isTagIntentAllowed();
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_CHECK_TAG_INTENT_PREFERENCE)
-    public void testIsTagIntentAppPreferenceSupported() throws NoSuchFieldException,
-             RemoteException {
-        when(mService.isTagIntentAppPreferenceSupported()).thenReturn(true);
-        NfcAdapter adapter = createMockedInstance();
-        boolean result = adapter.isTagIntentAppPreferenceSupported();
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    @RequiresFlagsEnabled(Flags.FLAG_NFC_CHECK_TAG_INTENT_PREFERENCE)
-    public void testIsTagIntentAllowedWhenNotSupported() throws NoSuchFieldException,
-             RemoteException {
-        when(mService.isTagIntentAppPreferenceSupported()).thenReturn(false);
-        NfcAdapter adapter = createMockedInstance();
-        boolean result = adapter.isTagIntentAllowed();
-        Assert.assertTrue(result);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcAntennaLocationApiTest.java b/tests/tests/nfc/src/android/nfc/cts/NfcAntennaLocationApiTest.java
deleted file mode 100644
index 2a0403e..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/NfcAntennaLocationApiTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assume.assumeTrue;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.nfc.AvailableNfcAntenna;
-import android.nfc.NfcAdapter;
-import android.nfc.NfcAntennaInfo;
-
-import androidx.test.InstrumentationRegistry;
-
-import java.util.ArrayList;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class NfcAntennaLocationApiTest {
-
-    private static final int ANTENNA_X = 12;
-    private static final int ANTENNA_Y = 13;
-
-    private boolean supportsHardware() {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        return pm.hasSystemFeature(PackageManager.FEATURE_NFC);
-    }
-
-    private NfcAdapter mAdapter;
-    private Context mContext;
-
-    @Before
-    public void setUp() throws Exception {
-        assumeTrue(supportsHardware());
-        mContext = InstrumentationRegistry.getContext();
-        mAdapter = NfcAdapter.getDefaultAdapter(mContext);
-        assertNotNull(mAdapter);
-    }
-
-    @After
-    public void tearDown() throws Exception {
-    }
-
-    /** Tests getNfcAntennaInfo API */
-    @Test
-    public void testGetNfcAntennaInfo() {
-        NfcAntennaInfo nfcAntennaInfo = mAdapter.getNfcAntennaInfo();
-
-        assertNotNull(nfcAntennaInfo);
-
-        AvailableNfcAntenna availableNfcAntenna = new AvailableNfcAntenna(ANTENNA_X, ANTENNA_Y);
-
-        assertEquals("Wrong nfc antenna X axis",
-                availableNfcAntenna.getLocationX(), ANTENNA_X);
-        assertEquals("Wrong nfc antenna Y axis",
-                availableNfcAntenna.getLocationY(), ANTENNA_Y);
-    }
-
-    @Test
-    public void testNfcAntennaInfoConstructor() {
-        int deviceWidth = 0;
-        int deviceHeight = 0;
-        boolean deviceFoldable = false;
-        NfcAntennaInfo nfcAntennaInfo = new NfcAntennaInfo(deviceWidth, deviceHeight,
-            deviceFoldable, new ArrayList<AvailableNfcAntenna>());
-
-        assertEquals("Device widths do not match", deviceWidth,
-                nfcAntennaInfo.getDeviceWidth());
-        assertEquals("Device heights do not match", deviceHeight,
-                nfcAntennaInfo.getDeviceHeight());
-        assertEquals("Device foldable do not match", deviceFoldable,
-                nfcAntennaInfo.isDeviceFoldable());
-        assertEquals("Wrong number of available antennas", 0,
-                nfcAntennaInfo.getAvailableNfcAntennas().size());
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcFCardEmulationActivity.java b/tests/tests/nfc/src/android/nfc/cts/NfcFCardEmulationActivity.java
deleted file mode 100644
index ff9c115..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/NfcFCardEmulationActivity.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package android.nfc.cts;
-
-import android.app.Activity;
-
-public class NfcFCardEmulationActivity extends Activity {
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcFCardEmulationTest.java b/tests/tests/nfc/src/android/nfc/cts/NfcFCardEmulationTest.java
deleted file mode 100644
index d981fa5e..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/NfcFCardEmulationTest.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package android.nfc.cts;
-
-import static org.junit.Assume.assumeTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.when;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import android.nfc.INfcFCardEmulation;
-import android.nfc.NfcAdapter;
-import android.nfc.cardemulation.*;
-import android.os.RemoteException;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.core.app.ApplicationProvider;
-
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.mockito.internal.util.reflection.FieldReader;
-import org.mockito.internal.util.reflection.FieldSetter;
-
-@RunWith(JUnit4.class)
-public class NfcFCardEmulationTest {
-    private NfcAdapter mAdapter;
-    private static final ComponentName mService =
-        new ComponentName("android.nfc.cts", "android.nfc.cts.CtsMyHostApduService");
-
-    private INfcFCardEmulation mOldService;
-    @Mock private INfcFCardEmulation mockEmulation;
-
-    private boolean supportsHardware() {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        return pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION_NFCF);
-    }
-
-    @Before
-    public void setUp() throws NoSuchFieldException, RemoteException {
-        MockitoAnnotations.initMocks(this);
-        assumeTrue(supportsHardware());
-        Context mContext = InstrumentationRegistry.getContext();
-        mAdapter = NfcAdapter.getDefaultAdapter(mContext);
-        Assert.assertNotNull(mAdapter);
-
-        NfcFCardEmulation instance = NfcFCardEmulation.getInstance(mAdapter);
-        FieldReader serviceField = new FieldReader(instance,
-                instance.getClass().getDeclaredField("sService"));
-        mOldService = (INfcFCardEmulation) serviceField.read();
-    }
-
-    @After
-    public void tearDown() throws Exception {
-        if (!supportsHardware()) return;
-        NfcFCardEmulation instance = NfcFCardEmulation.getInstance(mAdapter);
-        FieldSetter.setField(instance,
-                instance.getClass().getDeclaredField("sService"), mOldService);
-    }
-
-    @Test
-    public void getNonNullInstance() {
-        NfcFCardEmulation instance = NfcFCardEmulation.getInstance(mAdapter);
-        Assert.assertNotNull(instance);
-    }
-
-    @Test
-    public void testGetSystemCodeForService() throws NoSuchFieldException, RemoteException {
-        NfcFCardEmulation instance = createMockedInstance();
-        String code = "System Code";
-        when(mockEmulation.getSystemCodeForService(anyInt(),any(ComponentName.class)))
-            .thenReturn(code);
-        String result = instance.getSystemCodeForService(mService);
-        Assert.assertEquals(result, code);
-    }
-
-    @Test
-    public void testRegisterCodeForService() throws NoSuchFieldException, RemoteException {
-        NfcFCardEmulation instance = createMockedInstance();
-        String code = "4000";
-        when(mockEmulation.registerSystemCodeForService(anyInt(), any(ComponentName.class), anyString()))
-            .thenReturn(true);
-        boolean result = instance.registerSystemCodeForService(mService, code);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testUnregisterSystemCodeForService() throws NoSuchFieldException, RemoteException {
-        NfcFCardEmulation instance = createMockedInstance();
-        when(mockEmulation.removeSystemCodeForService(anyInt(), any(ComponentName.class)))
-            .thenReturn(true);
-        boolean result = instance.unregisterSystemCodeForService(mService);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testGetNfcid2ForService() throws NoSuchFieldException, RemoteException {
-        NfcFCardEmulation instance = createMockedInstance();
-        String testNfcid2 = "02FE000000000000";
-        when(mockEmulation.getNfcid2ForService(anyInt(), any(ComponentName.class)))
-            .thenReturn(testNfcid2);
-        String result = instance.getNfcid2ForService(mService);
-        Assert.assertEquals(result, testNfcid2);
-    }
-
-    @Test
-    public void testSetNfcid2ForService() throws NoSuchFieldException, RemoteException {
-        NfcFCardEmulation instance = createMockedInstance();
-        String testNfcid2 = "02FE000000000000";
-        when(mockEmulation.setNfcid2ForService(anyInt(), any(ComponentName.class), anyString()))
-            .thenReturn(true);
-        boolean result = instance.setNfcid2ForService(mService, testNfcid2);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testEnableService() throws NoSuchFieldException, RemoteException {
-        NfcFCardEmulation instance = createMockedInstance();
-        Activity activity = createAndResumeActivity();
-        when(mockEmulation.enableNfcFForegroundService(any(ComponentName.class))).thenReturn(true);
-        boolean result = instance.enableService(activity, mService);
-        Assert.assertTrue(result);
-    }
-
-    @Test
-    public void testDisableService() throws NoSuchFieldException, RemoteException {
-        NfcFCardEmulation instance = createMockedInstance();
-        Activity activity = createAndResumeActivity();
-        when(mockEmulation.disableNfcFForegroundService()).thenReturn(true);
-        boolean result = instance.disableService(activity);
-        Assert.assertTrue(result);
-    }
-
-    private Activity createAndResumeActivity() {
-        Intent intent
-            = new Intent(ApplicationProvider.getApplicationContext(),
-                NfcFCardEmulationActivity.class);
-        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        Activity activity = InstrumentationRegistry.getInstrumentation().startActivitySync(intent);
-        InstrumentationRegistry.getInstrumentation().callActivityOnResume(activity);
-        return activity;
-    }
-
-    private NfcFCardEmulation createMockedInstance() throws NoSuchFieldException {
-        NfcFCardEmulation instance = NfcFCardEmulation.getInstance(mAdapter);
-        FieldSetter.setField(instance, instance.getClass().getDeclaredField("sService"), mockEmulation);
-        return instance;
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcFServiceInfoTest.java b/tests/tests/nfc/src/android/nfc/cts/NfcFServiceInfoTest.java
deleted file mode 100644
index 0b5a928..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/NfcFServiceInfoTest.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import android.content.ComponentName;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.content.pm.ServiceInfo;
-import android.nfc.Flags;
-import android.nfc.cardemulation.AidGroup;
-import android.nfc.cardemulation.CardEmulation;
-import android.nfc.cardemulation.NfcFServiceInfo;
-import android.os.Parcel;
-import android.os.ParcelFileDescriptor;
-import android.os.RemoteException;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-import android.platform.test.flag.junit.CheckFlagsRule;
-import android.platform.test.flag.junit.DeviceFlagsValueProvider;
-import android.util.proto.ProtoOutputStream;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.MockitoAnnotations;
-import org.xmlpull.v1.XmlPullParserException;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-
-@RequiresFlagsEnabled(Flags.FLAG_ENABLE_NFC_MAINLINE)
-@RunWith(AndroidJUnit4.class)
-public class NfcFServiceInfoTest {
-    private static final String AID_1 = "00000000000000";
-    private static final String AID_2 = "00000000000001";
-    private static final String SERVICE_PACKAGE_NAME = "com.nfc.test";
-    private static final String SERVICE_NAME = "hce_service";
-
-    @Rule
-    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
-
-    private final ArrayList<AidGroup> mDynamicAidGroups = new ArrayList<>();
-    private final ResolveInfo mResolveInfo = new ResolveInfo();
-
-    private boolean supportsHardware() {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        return pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION);
-    }
-
-    @Before
-    public void setUp() throws NoSuchFieldException, RemoteException {
-        MockitoAnnotations.initMocks(this);
-        assumeTrue(supportsHardware());
-
-        ArrayList<String> aids = new ArrayList<String>();
-        aids.add(AID_1);
-        aids.add(AID_2);
-        AidGroup aidGroup = new AidGroup(aids, CardEmulation.CATEGORY_PAYMENT);
-        mDynamicAidGroups.add(aidGroup);
-
-        ServiceInfo serviceInfo = new ServiceInfo();
-        serviceInfo.packageName = SERVICE_PACKAGE_NAME;
-        serviceInfo.name = SERVICE_NAME;
-        serviceInfo.applicationInfo = new ApplicationInfo();
-        mResolveInfo.serviceInfo = serviceInfo;
-    }
-
-    @Test
-    public void test_ConstructorWithXml() {
-        try {
-            NfcFServiceInfo nfcFServiceInfo = new NfcFServiceInfo(
-                    InstrumentationRegistry.getContext().getPackageManager(), mResolveInfo);
-            fail();
-        } catch (XmlPullParserException | IOException e) {
-            // pass
-        }
-    }
-
-    @Test
-    public void test_Constructor() throws Exception {
-        NfcFServiceInfo nfcFServiceInfo = new NfcFServiceInfo(
-                mResolveInfo, "", "", "", "", "", 0, "");
-
-        assertEquals(nfcFServiceInfo.getComponent(),
-                new ComponentName(SERVICE_PACKAGE_NAME, SERVICE_NAME));
-        assertEquals(nfcFServiceInfo.getSystemCode(), "");
-        assertEquals(nfcFServiceInfo.getNfcid2(), "");
-        assertEquals(nfcFServiceInfo.getDescription(), "");
-        assertEquals(nfcFServiceInfo.getUid(), 0);
-        assertEquals(nfcFServiceInfo.getT3tPmm(), "");
-    }
-
-    @Test
-    public void test_ReadWriteParcel() {
-        NfcFServiceInfo nfcFServiceInfo = new NfcFServiceInfo(
-                mResolveInfo, "", "", "", "", "", 0, "");
-        Parcel p = Parcel.obtain();
-        nfcFServiceInfo.writeToParcel(p, 0);
-        p.setDataPosition(0);
-
-        NfcFServiceInfo newNfcFServiceInfo = NfcFServiceInfo.CREATOR.createFromParcel(p);
-        assertEquals(newNfcFServiceInfo.getComponent(),
-                new ComponentName(SERVICE_PACKAGE_NAME, SERVICE_NAME));
-        assertEquals(newNfcFServiceInfo.getSystemCode(), "");
-        assertEquals(newNfcFServiceInfo.getNfcid2(), "");
-        assertEquals(newNfcFServiceInfo.getDescription(), "");
-        assertEquals(newNfcFServiceInfo.getUid(), 0);
-        assertEquals(newNfcFServiceInfo.getT3tPmm(), "");
-    }
-
-    @Test
-    public void test_Equals() throws Exception {
-        NfcFServiceInfo nfcFServiceInfo = new NfcFServiceInfo(
-                mResolveInfo, "", "", "", "", "", 0, "");
-        NfcFServiceInfo newNfcFServiceInfo = new NfcFServiceInfo(
-                mResolveInfo, "", "", "", "", "", 0, "");
-
-        assertEquals(nfcFServiceInfo, newNfcFServiceInfo);
-    }
-
-    @Test
-    public void test_Dump() throws Exception {
-        NfcFServiceInfo nfcFServiceInfo = new NfcFServiceInfo(
-                mResolveInfo, "", "", "", "", "", 0, "");
-        ParcelFileDescriptor pfd = new ParcelFileDescriptor(Parcel.obtain().readFileDescriptor());
-        PrintWriter pw = new PrintWriter(new ByteArrayOutputStream());
-        nfcFServiceInfo.dump(pfd, pw, new String[0]);
-    }
-
-    @Test
-    public void test_DumpDebug() throws Exception {
-        NfcFServiceInfo nfcFServiceInfo = new NfcFServiceInfo(
-                mResolveInfo, "", "", "", "", "", 0, "");
-        ProtoOutputStream po = new ProtoOutputStream();
-        nfcFServiceInfo.dumpDebug(po);
-    }
-
-    @Test
-    public void test_SetDynamicSystemCode() throws Exception {
-        NfcFServiceInfo nfcFServiceInfo = new NfcFServiceInfo(
-                mResolveInfo, "", "", "", "", "", 0, "");
-
-        assertEquals(nfcFServiceInfo.getSystemCode(), "");
-
-        nfcFServiceInfo.setDynamicSystemCode("test");
-        assertEquals(nfcFServiceInfo.getSystemCode(), "test");
-    }
-
-    @Test
-    public void test_SetNfcId2() throws Exception {
-        NfcFServiceInfo nfcFServiceInfo = new NfcFServiceInfo(
-                mResolveInfo, "", "", "", "", "", 0, "");
-
-        assertEquals(nfcFServiceInfo.getNfcid2(), "");
-
-        nfcFServiceInfo.setDynamicNfcid2("test");
-        assertEquals(nfcFServiceInfo.getNfcid2(), "test");
-    }
-
-    @Test
-    public void test_LoadLabel() throws Exception {
-        NfcFServiceInfo nfcFServiceInfo = new NfcFServiceInfo(
-                mResolveInfo, "", "", "", "", "", 0, "");
-
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        assertEquals(nfcFServiceInfo.loadLabel(pm), SERVICE_NAME);
-        assertNotNull(nfcFServiceInfo.loadIcon(pm));
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcFrameworkInitializerTest.java b/tests/tests/nfc/src/android/nfc/cts/NfcFrameworkInitializerTest.java
deleted file mode 100644
index 482ea29..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/NfcFrameworkInitializerTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2023 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.nfc.NfcFrameworkInitializer;
-import android.nfc.NfcServiceManager;
-import android.test.AndroidTestCase;
-
-public class NfcFrameworkInitializerTest extends AndroidTestCase {
-
-    /**
-     * NfcFrameworkInitializer.registerServiceWrappers() should only be called by
-     * SystemServiceRegistry during boot up when Nfc is first initialized. Calling this API at
-     * any other time should throw an exception.
-     */
-    public void test_RegisterServiceWrappers_failsWhenCalledOutsideOfSystemServiceRegistry() {
-        assertThrows(IllegalStateException.class,
-                () -> NfcFrameworkInitializer.registerServiceWrappers());
-    }
-
-    public void test_SetNfcServiceManager() {
-        assertThrows(IllegalStateException.class,
-                () -> NfcFrameworkInitializer.setNfcServiceManager(
-                    new NfcServiceManager()));
-    }
-
-    // org.junit.Assume.assertThrows is not available until JUnit 4.13
-    private static void assertThrows(Class<? extends Exception> exceptionClass, Runnable r) {
-        try {
-            r.run();
-            fail("Expected " + exceptionClass + " to be thrown.");
-        } catch (Exception exception) {
-            assertThat(exception).isInstanceOf(exceptionClass);
-        }
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java b/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java
deleted file mode 100644
index 863d141..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java
+++ /dev/null
@@ -1,289 +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.nfc.cts;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeTrue;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.nfc.NfcAdapter;
-import android.nfc.cardemulation.CardEmulation;
-import android.platform.test.annotations.RequiresFlagsDisabled;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-import android.platform.test.flag.junit.CheckFlagsRule;
-import android.platform.test.flag.junit.DeviceFlagsValueProvider;
-import android.util.Log;
-
-import androidx.test.InstrumentationRegistry;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-public class NfcPreferredPaymentTest {
-    private final static String mTag = "Nfc";
-
-    private final static String mRouteDestination = "Host";
-    private final static String mDescription = "CTS Nfc Test Service";
-    private final static String NFC_PAYMENT_DEFAULT_COMPONENT = "nfc_payment_default_component";
-    private final static List<String> mAids = Arrays.asList("A000000004101011",
-                                                            "A000000004101012",
-                                                            "A000000004101013");
-    private static final ComponentName CtsNfcTestService =
-            new ComponentName("android.nfc.cts", "android.nfc.cts.CtsMyHostApduService");
-
-    @Rule
-    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
-
-    private NfcAdapter mAdapter;
-    private CardEmulation mCardEmulation;
-    private Context mContext;
-
-    private boolean supportsHardware() {
-        final PackageManager pm = InstrumentationRegistry.getContext().getPackageManager();
-        boolean existAnyReqFeature =
-                pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION)
-                || pm.hasSystemFeature(PackageManager.FEATURE_NFC_HOST_CARD_EMULATION_NFCF)
-                || pm.hasSystemFeature(PackageManager.FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE)
-                || pm.hasSystemFeature(PackageManager.FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC);
-        return existAnyReqFeature;
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        assumeTrue(supportsHardware());
-        mContext = InstrumentationRegistry.getContext();
-        mAdapter = NfcAdapter.getDefaultAdapter(mContext);
-        assertNotNull(mAdapter);
-        mCardEmulation = CardEmulation.getInstance(mAdapter);
-    }
-
-    @After
-    public void tearDown() throws Exception {}
-
-    /** Tests getAidsForPreferredPaymentService API */
-    @Test
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testAidsForPreferredPaymentService() {
-        DefaultPaymentProviderTestUtils.runWithDefaultPaymentService(mContext, CtsNfcTestService,
-                mDescription, () -> {
-                    try {
-                        List<String> aids = mCardEmulation.getAidsForPreferredPaymentService();
-                        for (String aid :aids) {
-                            Log.i(mTag, "AidsForPreferredPaymentService: " + aid);
-                        }
-
-                        assertTrue("Retrieve incorrect preferred payment aid list",
-                                mAids.equals(aids));
-                    } catch (Exception e) {
-                        fail("Unexpected Exception " + e);
-                    }
-                });
-    }
-
-    /** Tests getRouteDestinationForPreferredPaymentService API */
-    @Test
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testRouteDestinationForPreferredPaymentService() {
-        DefaultPaymentProviderTestUtils.runWithDefaultPaymentService(mContext, CtsNfcTestService,
-                mDescription, () -> {
-                    try {
-                        String routeDestination =
-                                mCardEmulation.getRouteDestinationForPreferredPaymentService();
-                        Log.i(mTag,
-                                "RouteDestinationForPreferredPaymentService: "
-                                        + routeDestination);
-
-                        assertTrue("Retrieve incorrect preferred payment route destination",
-                                routeDestination.equals(mRouteDestination));
-                    } catch (Exception e) {
-                        fail("Unexpected Exception " + e);
-                    }
-                });
-    }
-
-    /** Tests getDescriptionForPreferredPaymentService API */
-    @Test
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testDescriptionForPreferredPaymentService() {
-        DefaultPaymentProviderTestUtils.runWithDefaultPaymentService(mContext, CtsNfcTestService,
-                mDescription, () -> {
-                    try {
-                        CharSequence description =
-                                mCardEmulation.getDescriptionForPreferredPaymentService();
-                        Log.i(mTag,
-                                "DescriptionForPreferredPaymentService: "
-                                        + description.toString());
-
-                        assertTrue("Retrieve incorrect preferred payment description",
-                                description.toString().equals(mDescription.toString()));
-                    } catch (Exception e) {
-                        fail("Unexpected Exception " + e);
-                    }
-                });
-    }
-
-    /** Tests getSelectionModeForCategory API
-     *  CardEmulation.CATEGORY_PAYMENT */
-    @Test
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testGetSelectionModeForCategoryPayment() {
-        DefaultPaymentProviderTestUtils.runWithDefaultPaymentService(mContext, CtsNfcTestService,
-                mDescription, () -> {
-                    try {
-                        int mode = mCardEmulation.getSelectionModeForCategory(
-                                CardEmulation.CATEGORY_PAYMENT);
-                        Log.i(mTag, "getSelectionModeForCategory for Payment: " + mode);
-
-                        assertTrue("Retrieve incorrect SelectionMode for Payment",
-                                CardEmulation.SELECTION_MODE_PREFER_DEFAULT == mode);
-                    } catch (Exception e) {
-                        fail("Unexpected Exception " + e);
-                    }
-                });
-    }
-
-    /** Tests getSelectionModeForCategory API
-     *  CardEmulation.CATEGORY_OTHER */
-
-    @Test
-    @RequiresFlagsDisabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testGetSelectionModeForCategoryOther() {
-        DefaultPaymentProviderTestUtils.runWithDefaultPaymentService(mContext, CtsNfcTestService,
-                mDescription, () -> {
-                    try {
-                        int mode = mCardEmulation.getSelectionModeForCategory(
-                                CardEmulation.CATEGORY_OTHER);
-                        Log.i(mTag, "getSelectionModeForCategory for Other: " + mode);
-
-                        assertTrue("Retrieve incorrect SelectionMode for Other",
-                                CardEmulation.SELECTION_MODE_ASK_IF_CONFLICT == mode);
-                    } catch (Exception e) {
-                        fail("Unexpected Exception " + e);
-                    }
-                });
-    }
-
-    /** Tests getAidsForPreferredPaymentService API */
-    @Test
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testAidsForPreferredPaymentService_walletRoleEnabled() {
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.WALLET_HOLDER_PACKAGE_NAME,
-                () -> {
-                    try {
-                        List<String> aids = mCardEmulation.getAidsForPreferredPaymentService();
-                        for (String aid :aids) {
-                            Log.i(mTag, "AidsForPreferredPaymentService: " + aid);
-                        }
-
-                        assertTrue("Retrieve incorrect preferred payment aid list",
-                                WalletRoleTestUtils.WALLET_HOLDER_AIDS.equals(aids));
-                    } catch (Exception e) {
-                        fail("Unexpected Exception " + e);
-                    }
-                });
-
-    }
-
-    /** Tests getRouteDestinationForPreferredPaymentService API */
-    @Test
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testRouteDestinationForPreferredPaymentService_walletRoleEnabled() {
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.CTS_PACKAGE_NAME,
-                () -> {
-                    try {
-                        String routeDestination =
-                                mCardEmulation.getRouteDestinationForPreferredPaymentService();
-                        Log.i(mTag, "RouteDestinationForPreferredPaymentService: "
-                                + routeDestination);
-
-                        assertTrue("Retrieve incorrect preferred payment route destination",
-                                routeDestination.equals(mRouteDestination));
-                    } catch (Exception e) {
-                        fail("Unexpected Exception " + e);
-                    }
-                });
-    }
-
-    /** Tests getDescriptionForPreferredPaymentService API */
-    @Test
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testDescriptionForPreferredPaymentService_walletRoleEnabled() {
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.CTS_PACKAGE_NAME,
-                () -> {
-                    try {
-                        CharSequence description =
-                                mCardEmulation.getDescriptionForPreferredPaymentService();
-                        Log.i(mTag, "DescriptionForPreferredPaymentService: "
-                                + description.toString());
-
-                        assertTrue("Retrieve incorrect preferred payment description",
-                                description.toString().equals(mDescription.toString()));
-                    } catch (Exception e) {
-                        fail("Unexpected Exception " + e);
-                    }
-                });
-    }
-
-    /** Tests getSelectionModeForCategory API
-     *  CardEmulation.CATEGORY_PAYMENT */
-    @Test
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    public void testGetSelectionModeForCategoryPayment_walletRoleEnabled() {
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.CTS_PACKAGE_NAME,
-                () -> {
-                    try {
-                        int mode = mCardEmulation
-                                .getSelectionModeForCategory(CardEmulation.CATEGORY_PAYMENT);
-                        Log.i(mTag, "getSelectionModeForCategory for Payment: " + mode);
-
-                        assertTrue("Retrieve incorrect SelectionMode for Payment",
-                                CardEmulation.SELECTION_MODE_PREFER_DEFAULT == mode);
-                    } catch (Exception e) {
-                        fail("Unexpected Exception " + e);
-                    }
-                });
-    }
-
-    /** Tests getSelectionModeForCategory API
-     *  CardEmulation.CATEGORY_OTHER */
-    @RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-    @Test
-    public void testGetSelectionModeForCategoryOther_walletRoleEnabled() {
-        WalletRoleTestUtils.runWithRole(mContext, WalletRoleTestUtils.CTS_PACKAGE_NAME,
-                () -> {
-                    try {
-                        int mode = mCardEmulation
-                                .getSelectionModeForCategory(CardEmulation.CATEGORY_OTHER);
-                        Log.i(mTag, "getSelectionModeForCategory for Other: " + mode);
-
-                        assertTrue("Retrieve incorrect SelectionMode for Other",
-                                CardEmulation.SELECTION_MODE_ASK_IF_CONFLICT == mode);
-                    } catch (Exception e) {
-                        fail("Unexpected Exception " + e);
-                    }
-                });
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcServiceManagerTest.java b/tests/tests/nfc/src/android/nfc/cts/NfcServiceManagerTest.java
deleted file mode 100644
index 6920a61..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/NfcServiceManagerTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import static org.junit.Assert.assertThrows;
-
-import android.content.pm.PackageManager;
-import android.nfc.NfcServiceManager;
-import android.nfc.NfcServiceManager.ServiceNotFoundException;
-import android.nfc.NfcServiceManager.ServiceRegisterer;
-import android.os.IBinder;
-import android.os.ServiceManager;
-import android.test.AndroidTestCase;
-
-public class NfcServiceManagerTest extends AndroidTestCase {
-
-    private boolean mHasNfc;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        mHasNfc = getContext().getPackageManager().hasSystemFeature(
-                PackageManager.FEATURE_NFC);
-    }
-
-    public void test_ServiceRegisterer() {
-        if (!mHasNfc) {
-            return;
-        }
-        NfcServiceManager serviceManager = new NfcServiceManager();
-        ServiceRegisterer serviceRegisterer =
-                serviceManager.getNfcManagerServiceRegisterer();
-
-        assertThrows(SecurityException.class, () ->
-                serviceRegisterer.register(serviceRegisterer.get()));
-
-        IBinder nfcServiceBinder = serviceRegisterer.get();
-        assertNotNull(nfcServiceBinder);
-
-        nfcServiceBinder = serviceRegisterer.tryGet();
-        assertNotNull(nfcServiceBinder);
-
-        try {
-            nfcServiceBinder = serviceRegisterer.getOrThrow();
-            assertNotNull(nfcServiceBinder);
-        } catch (ServiceNotFoundException exception) {
-            fail("ServiceNotFoundException should not be thrown");
-        }
-    }
-
-    public void test_ServiceNotFoundException() {
-        ServiceManager.ServiceNotFoundException baseException =
-                new ServiceManager.ServiceNotFoundException("");
-        String exceptionDescription = "description test";
-        String baseExceptionDescription = baseException.getMessage();
-        ServiceNotFoundException newException =
-                new ServiceNotFoundException(exceptionDescription);
-        assertEquals(baseExceptionDescription + exceptionDescription, newException.getMessage());
-        try {
-            throw newException;
-        } catch (ServiceNotFoundException exception) {
-            assertEquals(baseExceptionDescription + exceptionDescription, exception.getMessage());
-        }
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcUtils.java b/tests/tests/nfc/src/android/nfc/cts/NfcUtils.java
deleted file mode 100644
index f99b012..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/NfcUtils.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
-
-import android.annotation.Nullable;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.nfc.NfcAdapter;
-import android.os.Handler;
-import android.os.HandlerThread;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-public final class NfcUtils {
-    private NfcUtils() {}
-
-    static boolean enableNfc(NfcAdapter nfcAdapter, Context context) {
-        try {
-            if (nfcAdapter.isEnabled()) {
-                return true;
-            }
-            CountDownLatch countDownLatch = new CountDownLatch(1);
-            AtomicInteger state = new AtomicInteger(NfcAdapter.STATE_OFF);
-            BroadcastReceiver nfcChangeListener = new BroadcastReceiver() {
-                @Override
-                public void onReceive(Context context, Intent intent) {
-                    int s = intent.getIntExtra(NfcAdapter.EXTRA_ADAPTER_STATE,
-                            NfcAdapter.STATE_OFF);
-                    if (s == NfcAdapter.STATE_TURNING_ON) {
-                        return;
-                    }
-                    context.unregisterReceiver(this);
-                    state.set(s);
-                    countDownLatch.countDown();
-                }
-            };
-            HandlerThread handlerThread = new HandlerThread("nfc_cts_listener");
-            handlerThread.start();
-            Handler handler = new Handler(handlerThread.getLooper());
-            IntentFilter intentFilter = new IntentFilter();
-            intentFilter.addAction(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED);
-            context.registerReceiver(nfcChangeListener, intentFilter, null,
-                    handler);
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(WRITE_SECURE_SETTINGS);
-            if (!nfcAdapter.enable()) {
-                return false;
-            }
-            countDownLatch.await(2000, TimeUnit.MILLISECONDS);
-            return state.get() == NfcAdapter.STATE_ON;
-        } catch (Exception e) {
-            e.printStackTrace();
-            return false;
-        } finally {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().dropShellPermissionIdentity();
-        }
-    }
-
-    static boolean disableNfc(NfcAdapter nfcAdapter, Context context) {
-        return disableNfc(nfcAdapter, context, null);
-    }
-
-    static boolean disableNfc(NfcAdapter nfcAdapter, Context context, @Nullable Boolean persist) {
-        try {
-            if (!nfcAdapter.isEnabled()) {
-                return true;
-            }
-            CountDownLatch countDownLatch = new CountDownLatch(1);
-            AtomicInteger state = new AtomicInteger(NfcAdapter.STATE_ON);
-            BroadcastReceiver nfcChangeListener = new BroadcastReceiver() {
-                @Override
-                public void onReceive(Context context, Intent intent) {
-                    int s =  intent.getIntExtra(NfcAdapter.EXTRA_ADAPTER_STATE,
-                            NfcAdapter.STATE_ON);
-                    if (s == NfcAdapter.STATE_TURNING_OFF) {
-                        return;
-                    }
-                    context.unregisterReceiver(this);
-                    state.set(s);
-                    countDownLatch.countDown();
-                }
-            };
-            HandlerThread handlerThread = new HandlerThread("nfc_cts_listener");
-            handlerThread.start();
-            Handler handler = new Handler(handlerThread.getLooper());
-            IntentFilter intentFilter = new IntentFilter();
-            intentFilter.addAction(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED);
-            context.registerReceiver(nfcChangeListener, intentFilter, null,
-                    handler);
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(WRITE_SECURE_SETTINGS);
-            boolean result = false;
-            if (persist != null) {
-                result = nfcAdapter.disable(persist);
-            } else {
-                result = nfcAdapter.disable();
-            }
-            if (!result) return false;
-            countDownLatch.await(2000, TimeUnit.MILLISECONDS);
-            return state.get() == NfcAdapter.STATE_OFF;
-        } catch (Exception e) {
-            return false;
-        } finally {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().dropShellPermissionIdentity();
-        }
-    }
-
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/OffHostApduServiceTest.java b/tests/tests/nfc/src/android/nfc/cts/OffHostApduServiceTest.java
deleted file mode 100644
index b3b45cb..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/OffHostApduServiceTest.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package android.nfc.cts;
-
-import android.content.Intent;
-import android.os.Looper;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class OffHostApduServiceTest {
-    private CtsMyOffHostApduService service;
-
-    @Before
-    public void setUp() {
-        if (Looper.myLooper() == null) {
-            Looper.prepare();
-        }
-        service = new CtsMyOffHostApduService();
-    }
-
-    @Test
-    public void testOnBind() {
-        Intent serviceIntent
-            = new Intent(CtsMyOffHostApduService.SERVICE_INTERFACE);
-        Assert.assertNull(service.onBind(serviceIntent));
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/PollingLoopBroadcastReceiver.java b/tests/tests/nfc/src/android/nfc/cts/PollingLoopBroadcastReceiver.java
deleted file mode 100644
index 5934063..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/PollingLoopBroadcastReceiver.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.nfc.cardemulation.PollingFrame;
-
-import java.util.List;
-
-public class PollingLoopBroadcastReceiver extends BroadcastReceiver {
-
-    private static final String CLASS_NAME_KEY = "class_name";
-    private static final String FRAMES_KEY = "frames";
-    private static final String POLLING_LOOP_FIRED = "com.cts.PollingLoopFired";
-    private static final String OBSERVE_MODE_CHANGED = "com.cts.ObserveModeChanged";
-    private static final String PREFERRED_SERVISE_CHANGED = "com.cts.PreferredServiceChanged";
-
-    @Override
-    public void onReceive(Context context, Intent intent) {
-        if (CardEmulationTest.sCurrentPollLoopReceiver != null) {
-            String className = intent.getStringExtra(CLASS_NAME_KEY);
-            switch (intent.getAction()) {
-                case POLLING_LOOP_FIRED:
-                    List<PollingFrame> frames = intent.getParcelableArrayListExtra(FRAMES_KEY,
-                            PollingFrame.class);
-                    CardEmulationTest.sCurrentPollLoopReceiver.notifyPollingLoop(className, frames);
-                    break;
-                case OBSERVE_MODE_CHANGED:
-                    if (intent.hasExtra("enabled")) {
-                        boolean  isEnabled = intent.getBooleanExtra("enabled", false);
-                        CardEmulationTest.sCurrentPollLoopReceiver.onObserveModeStateChanged(
-                                className, isEnabled);
-                    }
-                    break;
-                case PREFERRED_SERVISE_CHANGED:
-                    if (intent.hasExtra("preferred")) {
-                        boolean  isPreferred = intent.getBooleanExtra("preferred", false);
-                        CardEmulationTest.sCurrentPollLoopReceiver.onPreferredServiceChanged(
-                                className,  isPreferred);
-                    }
-                    break;
-            }
-        }
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/TagLostExceptionTest.java b/tests/tests/nfc/src/android/nfc/cts/TagLostExceptionTest.java
deleted file mode 100644
index d78fa12..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/TagLostExceptionTest.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package android.nfc.cts;
-
-import android.nfc.TagLostException;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class TagLostExceptionTest {
-
-  @Test
-  public void testTagLostException() {
-    try {
-      throw new TagLostException();
-    } catch (TagLostException e) {
-      Assert.assertTrue(e.getMessage() == null);
-    }
-    String s = new String("testTagLostException");
-    try {
-      throw new TagLostException(s);
-    } catch (TagLostException e) {
-      Assert.assertTrue(e.getMessage().equals(s));
-    }
-  }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/WalletRoleTest.java b/tests/tests/nfc/src/android/nfc/cts/WalletRoleTest.java
deleted file mode 100644
index b285bf6..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/WalletRoleTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import static android.nfc.cts.DefaultPaymentProviderTestUtils.CTS_MY_HOSTAPDU_SERVICE;
-import static android.nfc.cts.DefaultPaymentProviderTestUtils.runWithDefaultPaymentSetting;
-import static android.nfc.cts.WalletRoleTestUtils.CTS_PACKAGE_NAME;
-import static android.nfc.cts.WalletRoleTestUtils.canAssignRoleToPackage;
-import static android.nfc.cts.WalletRoleTestUtils.clearRoleHolders;
-import static android.nfc.cts.WalletRoleTestUtils.getDefaultWalletRoleHolder;
-import static android.nfc.cts.WalletRoleTestUtils.getOverLayDefaultHolder;
-
-import android.content.Context;
-import android.content.pm.PackageManager;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-import android.platform.test.flag.junit.CheckFlagsRule;
-import android.platform.test.flag.junit.DeviceFlagsValueProvider;
-
-import androidx.test.InstrumentationRegistry;
-
-
-import org.junit.Assume;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-import org.testng.Assert;
-
-@RunWith(JUnit4.class)
-@RequiresFlagsEnabled(android.permission.flags.Flags.FLAG_WALLET_ROLE_ENABLED)
-public class WalletRoleTest {
-
-    @Rule
-    public final CheckFlagsRule mCheckFlagsRule = DeviceFlagsValueProvider.createCheckFlagsRule();
-
-    Context mContext;
-
-    @Before
-    public void setUp() {
-        mContext = InstrumentationRegistry.getContext();
-        Assume.assumeTrue(supportsHardware());
-    }
-
-    private boolean supportsHardware() {
-        final PackageManager pm = mContext.getPackageManager();
-        return pm.hasSystemFeature(PackageManager.FEATURE_NFC);
-    }
-
-    @Test
-    public void testMigrationFromOverlay() {
-        String overlayConfig = getOverLayDefaultHolder(mContext);
-        Assume.assumeNotNull(overlayConfig);
-        Assume.assumeTrue(canAssignRoleToPackage(mContext, overlayConfig));
-        runWithDefaultPaymentSetting(mContext,
-                null,
-                () -> {
-                    clearRoleHolders(mContext);
-                    String currentHolder = getDefaultWalletRoleHolder(mContext);
-
-                    Assert.assertEquals(currentHolder, overlayConfig);
-                });
-    }
-
-    @Test
-    public void testMigrationFromDefaultPaymentProvider() {
-        runWithDefaultPaymentSetting(mContext,
-                CTS_MY_HOSTAPDU_SERVICE,
-                () -> {
-                    clearRoleHolders(mContext);
-                    String currentHolder = getDefaultWalletRoleHolder(mContext);
-
-                    Assert.assertEquals(currentHolder, CTS_PACKAGE_NAME);
-                });
-    }
-
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/WalletRoleTestUtils.java b/tests/tests/nfc/src/android/nfc/cts/WalletRoleTestUtils.java
deleted file mode 100644
index 9fcc790..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/WalletRoleTestUtils.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts;
-
-import static android.Manifest.permission.MANAGE_DEFAULT_APPLICATIONS;
-import static android.Manifest.permission.MANAGE_ROLE_HOLDERS;
-import static android.Manifest.permission.OBSERVE_ROLE_HOLDERS;
-
-import static org.junit.Assume.assumeFalse;
-
-import android.app.role.OnRoleHoldersChangedListener;
-import android.app.role.RoleManager;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.res.Resources;
-import android.os.UserManager;
-import android.text.TextUtils;
-
-import com.google.common.util.concurrent.MoreExecutors;
-
-import org.junit.Assert;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicReference;
-
-
-public final class WalletRoleTestUtils {
-
-    private WalletRoleTestUtils() {}
-
-    static final String CTS_PACKAGE_NAME = "android.nfc.cts";
-    static final String WALLET_HOLDER_PACKAGE_NAME = "com.android.test.walletroleholder";
-    static final String WALLET_HOLDER_SERVICE_DESC = "Wallet Role CTS Nfc Test Service";
-    static final String NFC_FOREGROUND_PACKAGE_NAME = "com.android.test.foregroundnfc";
-    static final String NON_PAYMENT_NFC_PACKAGE_NAME = "com.android.test.nonpaymentnfc";
-    static final String PAYMENT_AID_1 = "A000000004101012";
-    static final String PAYMENT_AID_2 = "A000000004101018";
-    static final String PAYMENT_AID_3 = "A000000005101011";
-    static final String NON_PAYMENT_AID_1 = "F053414950454D";
-
-    private static final String WALLET_OVERLAY_CONFIG = "config_defaultWallet";
-    private static final String CERTIFICATE_SEPARATOR = ":";
-
-    static final List<String> WALLET_HOLDER_AIDS = Arrays.asList("A000000004101011",
-            "A000000004101012",
-            "A000000004101013",
-            "A000000004101018");
-
-    static ComponentName getWalletRoleHolderService() {
-        return new ComponentName(WALLET_HOLDER_PACKAGE_NAME,
-                "com.android.test.walletroleholder.WalletRoleHolderApduService");
-    }
-
-    static ComponentName getWalletRoleHolderXService() {
-        return new ComponentName(WALLET_HOLDER_PACKAGE_NAME,
-                "com.android.test.walletroleholder.XWalletRoleHolderApduService");
-    }
-
-    static ComponentName getForegroundService() {
-        return new ComponentName(NFC_FOREGROUND_PACKAGE_NAME,
-                "com.android.test.foregroundnfc.ForegroundApduService");
-    }
-
-    static ComponentName getAssociatedService() {
-        return new ComponentName(NFC_FOREGROUND_PACKAGE_NAME,
-                "com.android.test.foregroundnfc.AssociatedApduService");
-    }
-
-    static ComponentName getNonPaymentService() {
-        return new ComponentName(NON_PAYMENT_NFC_PACKAGE_NAME,
-                "com.android.test.nonpaymentnfc.NonPaymentApduService");
-    }
-
-    static ComponentName getWalletRoleHolderActivity() {
-        return new ComponentName(WALLET_HOLDER_PACKAGE_NAME,
-                "com.android.test.walletroleholder.WalletRoleHolderForegroundActivity");
-    }
-
-    static boolean setDefaultWalletRoleHolder(Context context, String packageName) {
-        RoleManager roleManager = context.getSystemService(RoleManager.class);
-        CountDownLatch countDownLatch = new CountDownLatch(1);
-        AtomicReference<Boolean> result = new AtomicReference<>(false);
-        try {
-            roleManager.setDefaultApplication(RoleManager.ROLE_WALLET,
-                    packageName, 0,
-                    MoreExecutors.directExecutor(), aBoolean -> {
-                        result.set(aBoolean);
-                        countDownLatch.countDown();
-                    });
-            countDownLatch.await(3000, TimeUnit.MILLISECONDS);
-        } catch (InterruptedException e) {
-            return false;
-        }
-        return result.get();
-    }
-
-    static boolean removeRoleHolder(Context context, String currentHolder) {
-        RoleManager roleManager = context.getSystemService(RoleManager.class);
-        CountDownLatch countDownLatch = new CountDownLatch(1);
-        AtomicReference<Boolean> result = new AtomicReference<>(false);
-        try {
-            roleManager.removeRoleHolderAsUser(RoleManager.ROLE_WALLET, currentHolder, 0,
-                    context.getUser(), MoreExecutors.directExecutor(), aBoolean -> {
-                        result.set(aBoolean);
-                        countDownLatch.countDown();
-                    });
-            countDownLatch.await(3000, TimeUnit.MILLISECONDS);
-        } catch (InterruptedException e) {
-            return false;
-        }
-        return result.get();
-    }
-
-    static boolean setDefaultWalletRoleHolder(Context context) {
-        return setDefaultWalletRoleHolder(context, "android.nfc.cts");
-    }
-
-    static String getDefaultWalletRoleHolder(Context context) {
-        try {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(MANAGE_DEFAULT_APPLICATIONS);
-            RoleManager roleManager = context.getSystemService(RoleManager.class);
-            return roleManager.getDefaultApplication(RoleManager.ROLE_WALLET);
-        } finally {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().dropShellPermissionIdentity();
-        }
-    }
-
-    static void runWithRole(Context context, String roleHolder, Runnable runnable) {
-        final UserManager userManager = context.getSystemService(UserManager.class);
-        assumeFalse(userManager.isHeadlessSystemUserMode());
-        try {
-            runWithRoleNone(context, () -> {}); //Remove the role holder first to trigger callbacks
-            RoleManager roleManager = context.getSystemService(RoleManager.class);
-            CountDownLatch countDownLatch = new CountDownLatch(1);
-            OnRoleHoldersChangedListener onRoleHoldersChangedListener = (roleName, user) -> {
-                if (roleName.equals(RoleManager.ROLE_WALLET)) {
-                    try {
-                        // Wait a second to make sure all other callbacks are also fired on
-                        // their respective executors.
-                        Thread.sleep(1000);
-                    } catch (InterruptedException e) {
-                        throw new RuntimeException(e);
-                    }
-                    countDownLatch.countDown();
-                }
-            };
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(OBSERVE_ROLE_HOLDERS);
-            roleManager.addOnRoleHoldersChangedListenerAsUser(context.getMainExecutor(),
-                    onRoleHoldersChangedListener, context.getUser());
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(MANAGE_DEFAULT_APPLICATIONS);
-            Assert.assertTrue(setDefaultWalletRoleHolder(context, roleHolder));
-            countDownLatch.await(4000, TimeUnit.MILLISECONDS);
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(OBSERVE_ROLE_HOLDERS);
-            roleManager.removeOnRoleHoldersChangedListenerAsUser(onRoleHoldersChangedListener,
-                    context.getUser());
-            runnable.run();
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
-        } finally {
-            runWithRoleNone(context, () -> {}); //Remove the role holder first to trigger callbacks
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().dropShellPermissionIdentity();
-        }
-    }
-
-    static boolean canAssignRoleToPackage(Context context, String packageName) {
-        String previousHolder = getDefaultWalletRoleHolder(context);
-        try {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(MANAGE_DEFAULT_APPLICATIONS);
-            boolean canSet = setDefaultWalletRoleHolder(context, packageName);
-            if (canSet && previousHolder != null) {
-                setDefaultWalletRoleHolder(context, previousHolder);
-            }
-            return canSet;
-        } finally {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().dropShellPermissionIdentity();
-        }
-    }
-
-    static void runWithRoleNone(Context context, Runnable runnable) {
-        try {
-            String currentHolder = getDefaultWalletRoleHolder(context);
-            RoleManager roleManager = context.getSystemService(RoleManager.class);
-            CountDownLatch countDownLatch = new CountDownLatch(1);
-            OnRoleHoldersChangedListener onRoleHoldersChangedListener = (roleName, user) -> {
-                if (roleName.equals(RoleManager.ROLE_WALLET)) {
-                    try {
-                        // Wait a second to make sure all other callbacks are also fired on
-                        // their respective executors.
-                        Thread.sleep(1000);
-                    } catch (InterruptedException e) {
-                        throw new RuntimeException(e);
-                    }
-                    countDownLatch.countDown();
-                }
-            };
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(OBSERVE_ROLE_HOLDERS);
-            roleManager.addOnRoleHoldersChangedListenerAsUser(context.getMainExecutor(),
-                    onRoleHoldersChangedListener, context.getUser());
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(MANAGE_ROLE_HOLDERS);
-            if (currentHolder != null) {
-                roleManager.setRoleFallbackEnabled(RoleManager.ROLE_WALLET, false);
-                Assert.assertTrue(removeRoleHolder(context, currentHolder));
-                countDownLatch.await(4000, TimeUnit.MILLISECONDS);
-                roleManager.setRoleFallbackEnabled(RoleManager.ROLE_WALLET, true);
-            }
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(OBSERVE_ROLE_HOLDERS);
-            roleManager.removeOnRoleHoldersChangedListenerAsUser(onRoleHoldersChangedListener,
-                    context.getUser());
-            runnable.run();
-        } catch (InterruptedException e) {
-            throw new RuntimeException(e);
-        } finally {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().dropShellPermissionIdentity();
-        }
-    }
-
-    static void clearRoleHolders(Context context) {
-        try {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().adoptShellPermissionIdentity(MANAGE_ROLE_HOLDERS);
-            RoleManager roleManager = context.getSystemService(RoleManager.class);
-            CountDownLatch countDownLatch = new CountDownLatch(1);
-            AtomicReference<Boolean> result = new AtomicReference<>(false);
-            roleManager.clearRoleHoldersAsUser(RoleManager.ROLE_WALLET, 0,
-                    context.getUser(), MoreExecutors.directExecutor(), aBoolean -> {
-                        try {
-                            // Wait a second to make sure all other callbacks are also fired on
-                            // their respective executors.
-                            Thread.sleep(1000);
-                        } catch (InterruptedException e) {
-                            throw new RuntimeException(e);
-                        }
-                        result.set(aBoolean);
-                        countDownLatch.countDown();
-                    });
-            countDownLatch.await(4000, TimeUnit.MILLISECONDS);
-        } catch (Exception e) {
-            throw new RuntimeException(e);
-        } finally {
-            androidx.test.platform.app.InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation().dropShellPermissionIdentity();
-        }
-    }
-
-    static String getOverLayDefaultHolder(Context context) {
-        Resources resources = context.getResources();
-        int resourceId = resources.getIdentifier(WALLET_OVERLAY_CONFIG,
-                "string", "android");
-        if (resourceId == 0) {
-            return null;
-        }
-        String defaultHolders;
-        try {
-            defaultHolders = resources.getString(resourceId);
-        } catch (Resources.NotFoundException e) {
-            return null;
-        }
-        if (TextUtils.isEmpty(defaultHolders)) {
-            return null;
-        }
-        int certificateSeparatorIndex = defaultHolders.indexOf(CERTIFICATE_SEPARATOR);
-        if (certificateSeparatorIndex != -1) {
-            return defaultHolders.substring(0, certificateSeparatorIndex);
-        } else {
-            return defaultHolders;
-        }
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/interactive/TagVerifierActivity.java b/tests/tests/nfc/src/android/nfc/cts/interactive/TagVerifierActivity.java
deleted file mode 100644
index 28fe146..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/interactive/TagVerifierActivity.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts.interactive;
-
-import android.app.PendingIntent;
-import android.content.Intent;
-import android.nfc.NfcAdapter;
-import android.nfc.NfcManager;
-import android.nfc.Tag;
-import android.nfc.cts.R;
-import android.nfc.tech.cts.interactive.NdefTagTester;
-import android.nfc.tech.cts.interactive.TagTester;
-import android.nfc.tech.cts.interactive.TagVerifier;
-import android.nfc.tech.cts.interactive.TagVerifier.Result;
-import android.os.AsyncTask;
-import android.os.Bundle;
-import android.util.Log;
-import android.widget.LinearLayout;
-
-import androidx.appcompat.app.AppCompatActivity;
-
-import com.google.android.material.snackbar.Snackbar;
-
-/**
- * Activity used by CTS-Interactive test to verify Tag
- */
-public class TagVerifierActivity extends AppCompatActivity {
-
-    private static final String TAG = "TagVerifierActivity";
-    public static boolean sWriteComplete = false;
-    public static boolean sVerifyComplete = false;
-    public static Result sResult = null;
-    private static Tag sTag;
-
-    private TagTester mTagTester;
-    private TagVerifier mTagVerifier;
-    private LinearLayout mRootView;
-    private NfcAdapter mNfcAdapter;
-    private PendingIntent mPendingIntent;
-
-    public static Result getResult() {
-        return sResult;
-    }
-
-    public static boolean getWriteComplete() {
-        return sWriteComplete;
-    }
-
-    public static boolean getVerifyComplete() {
-        return sVerifyComplete;
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        mTagTester = new NdefTagTester(this);
-        NfcManager nfcManager = getSystemService(NfcManager.class);
-        mNfcAdapter = nfcManager.getDefaultAdapter();
-        mPendingIntent = PendingIntent.getActivity(this, 0,
-                new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP),
-                PendingIntent.FLAG_MUTABLE_UNAUDITED);
-        setContentView(R.layout.activity_main);
-        mRootView = findViewById(R.id.activity_main);
-
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        if (!mNfcAdapter.isEnabled()) {
-            Log.e(TAG, "NFC is not enabled");
-
-        }
-        mNfcAdapter.enableForegroundDispatch(this, mPendingIntent, null, null);
-    }
-
-    @Override
-    protected void onPause() {
-        super.onPause();
-        mNfcAdapter.disableForegroundDispatch(this);
-    }
-
-    @Override
-    protected void onNewIntent(Intent intent) {
-        super.onNewIntent(intent);
-        Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
-        if (tag != null) {
-            sTag = tag;
-            if (!sWriteComplete) {
-                handleWriteStep(tag);
-            } else if (!sVerifyComplete) {
-                handleVerifyStep();
-            }
-        }
-    }
-
-    private void handleWriteStep(Tag tag) {
-        if (mTagTester.isTestableTag(tag)) {
-            new WriteTagTask().execute(sTag);
-        } else {
-            Snackbar.make(mRootView, getResources().getString(R.string.nfc_wrong_tag_title),
-                    Snackbar.LENGTH_SHORT).show();
-        }
-    }
-
-    private void handleVerifyStep() {
-        new VerifyTagTask().execute(sTag);
-    }
-
-    class WriteTagTask extends AsyncTask<Tag, Void, TagVerifier> {
-
-        @Override
-        protected void onPreExecute() {
-            super.onPreExecute();
-        }
-
-        @Override
-        protected TagVerifier doInBackground(Tag... tags) {
-            try {
-                return mTagTester.writeTag(tags[0]);
-            } catch (Exception e) {
-                Log.e(TAG, "Error writing NFC tag...", e);
-                return null;
-            }
-        }
-
-        @Override
-        protected void onPostExecute(TagVerifier tagVerifier) {
-            mTagVerifier = tagVerifier;
-            int stringResId;
-            if (tagVerifier != null) {
-                sWriteComplete = true;
-                stringResId = R.string.nfc_successful_write;
-            } else {
-                stringResId = R.string.nfc_writing_tag_error;
-            }
-            Snackbar.make(mRootView, getResources().getString(stringResId),
-                    Snackbar.LENGTH_SHORT).show();
-        }
-    }
-
-    class VerifyTagTask extends AsyncTask<Tag, Void, Result> {
-
-        @Override
-        protected void onPreExecute() {
-            super.onPreExecute();
-        }
-
-        @Override
-        protected Result doInBackground(Tag... tags) {
-            try {
-                return mTagVerifier.verifyTag(tags[0]);
-            } catch (Exception e) {
-                Log.e(TAG, "Error verifying NFC tag...", e);
-                return null;
-            }
-        }
-
-        @Override
-        protected void onPostExecute(Result result) {
-            super.onPostExecute(result);
-            TagVerifierActivity.sResult = result;
-            sVerifyComplete = true;
-            if (sResult != null) {
-                mTagVerifier = null;
-            } else {
-                Snackbar.make(mRootView, getResources().getString(R.string.nfc_reading_tag_error),
-                        Snackbar.LENGTH_SHORT).show();
-            }
-        }
-    }
-
-}
diff --git a/tests/tests/nfc/src/android/nfc/cts/interactive/TagVerifierTest.java b/tests/tests/nfc/src/android/nfc/cts/interactive/TagVerifierTest.java
deleted file mode 100644
index f72f25f..0000000
--- a/tests/tests/nfc/src/android/nfc/cts/interactive/TagVerifierTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.cts.interactive;
-
-import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
-import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.app.Activity;
-import android.app.Instrumentation;
-import android.content.Context;
-import android.content.Intent;
-import android.nfc.cts.R;
-
-import androidx.test.platform.app.InstrumentationRegistry;
-
-import com.android.bedstead.harrier.BedsteadJUnit4;
-import com.android.bedstead.harrier.DeviceState;
-import com.android.bedstead.nene.TestApis;
-import com.android.interactive.Step;
-import com.android.interactive.annotations.Interactive;
-import com.android.interactive.annotations.NotFullyAutomated;
-import com.android.interactive.steps.ActAndWaitStep;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Reading and writing NFC tags. Asks user to write data to tag. Asks user to scan tag to verify
- * data was properly written and read back. Manual steps = scan tag. Scan tag again
- */
-@RunWith(BedsteadJUnit4.class)
-public class TagVerifierTest {
-
-    @ClassRule
-    @Rule
-    public static final DeviceState sDeviceState = new DeviceState();
-    private static final Context sContext = TestApis.context().instrumentedContext();
-    private static final Instrumentation sInstrumentation =
-            InstrumentationRegistry.getInstrumentation();
-
-
-    @Before
-    public void setUp() {
-        Intent intent = new Intent().setPackage(sContext.getPackageName())
-                .setClassName(sContext.getPackageName(), TagVerifierActivity.class.getName())
-                .setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
-
-        Activity activity = sInstrumentation.startActivitySync(intent);
-        sInstrumentation.runOnMainSync(
-                () -> sInstrumentation.callActivityOnResume(activity));
-    }
-
-    @Test
-    @Interactive
-    @NotFullyAutomated(reason = "User must place tag against phone")
-    public void verifyTag() throws Exception {
-        Step.execute(WriteTagStep.class);
-        Step.execute(VerifyTagStep.class);
-        assertThat(TagVerifierActivity.getResult()).isNotNull();
-        assertThat(TagVerifierActivity.getResult().isMatch()).isTrue();
-    }
-
-
-    @NotFullyAutomated(reason = "Requires user to place tag")
-    public static final class WriteTagStep extends ActAndWaitStep {
-        public WriteTagStep() {
-            super(sContext.getResources().getString(R.string.nfc_scan_tag),
-                    TagVerifierActivity::getWriteComplete);
-        }
-
-    }
-
-    @NotFullyAutomated(reason = "Requires user to place tag")
-    public static final class VerifyTagStep extends ActAndWaitStep {
-        public VerifyTagStep() {
-            super(sContext.getResources().getString(R.string.nfc_scan_tag_again),
-                    TagVerifierActivity::getVerifyComplete);
-        }
-    }
-
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/IsoDepTest.java b/tests/tests/nfc/src/android/nfc/tech/cts/IsoDepTest.java
deleted file mode 100644
index ed14ad6..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/IsoDepTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts;
-
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyBoolean;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-import android.nfc.ErrorCodes;
-import android.nfc.INfcTag;
-import android.nfc.Tag;
-import android.nfc.TransceiveResult;
-import android.nfc.tech.IsoDep;
-import android.nfc.tech.TagTechnology;
-import android.os.Bundle;
-import android.os.RemoteException;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.IOException;
-
-public class IsoDepTest {
-    @Mock private INfcTag mINfcTag;
-    @Captor private ArgumentCaptor<byte[]> mTransceiveCaptor;
-
-    @Before
-    public void setUp() throws IOException {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    @Test
-    public void createNullInstance() {
-        Tag tag = new Tag(new byte[]{0x00}, new int[]{}, new Bundle[]{}, 0, 0L, null);
-        IsoDep id = IsoDep.get(tag);
-        Assert.assertNull(id);
-    }
-
-    @Test
-    public void createNonNullInstance() {
-        IsoDep id = createIsoDepInstance();
-        Assert.assertNotNull(id);
-    }
-
-    @Test
-    public void testGetTag() {
-        Bundle extras = new Bundle();
-        extras.putByteArray(IsoDep.EXTRA_HI_LAYER_RESP, new byte[]{0x00});
-        extras.putByteArray(IsoDep.EXTRA_HIST_BYTES, new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{0x00}, new int[]{TagTechnology.ISO_DEP},
-            new Bundle[]{extras}, 0, 0L, mINfcTag);
-        IsoDep id = IsoDep.get(tag);
-        Assert.assertEquals(tag, id.getTag());
-    }
-
-    @Test
-    public void testIsConnected_isConnected() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.isPresent(anyInt())).thenReturn(true);
-        Assert.assertTrue(id.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_isNotConnected() throws RemoteException, IOException {
-        IsoDep id = createIsoDepInstance();
-        when(mINfcTag.isPresent(anyInt())).thenReturn(false);
-        Assert.assertFalse(id.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_serviceDead() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.isPresent(anyInt())).thenThrow(new RemoteException());
-        Assert.assertFalse(id.isConnected());
-    }
-
-    @Test
-    public void testReconnect_success() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        id.reconnect();
-        verify(mINfcTag, times(1)).reconnect(anyInt());
-    }
-
-    @Test
-    public void testReconnect_notConnected() throws RemoteException, IOException {
-        IsoDep id = createIsoDepInstance();
-        Assert.assertThrows(IllegalStateException.class, () -> id.reconnect());
-    }
-
-    @Test
-    public void testReconnect_error() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.reconnect(anyInt())).thenReturn(ErrorCodes.ERROR_IO);
-        Assert.assertThrows(IOException.class, () -> id.reconnect());
-    }
-
-    @Test
-    public void testReconnect_serviceDead() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.reconnect(anyInt())).thenThrow(new RemoteException());
-        Assert.assertThrows(IOException.class, () -> id.reconnect());
-    }
-
-    @Test
-    public void testClose() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        id.close();
-        Assert.assertFalse(id.isConnected());
-    }
-
-    @Test
-    public void testSetTimeout_success() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.setTimeout(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        id.setTimeout(250);
-        ArgumentCaptor<Integer> timeout = ArgumentCaptor.forClass(Integer.class);
-        verify(mINfcTag, times(1)).setTimeout(anyInt(), timeout.capture());
-        Assert.assertEquals((int) timeout.getValue(), 250);
-    }
-
-    @Test
-    public void testSetTimeout_invalid() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.setTimeout(anyInt(), anyInt())).thenReturn(ErrorCodes.ERROR_INVALID_PARAM);
-        Assert.assertThrows(IllegalArgumentException.class, () -> id.setTimeout(250));
-    }
-
-    @Test
-    public void testGetTimeout() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.getTimeout(anyInt())).thenReturn(250);
-        Assert.assertEquals((int) id.getTimeout(), 250);
-    }
-
-    @Test
-    public void testGetTimeout_serviceDead() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.getTimeout(anyInt())).thenThrow(new RemoteException());
-        Assert.assertEquals((int) id.getTimeout(), 0);
-    }
-
-    @Test
-    public void testGetHistoricalBytes() {
-        IsoDep id = createIsoDepInstance();
-        Assert.assertArrayEquals(id.getHistoricalBytes(), new byte[]{0x00});
-    }
-
-    @Test
-    public void testGetHiLayerResponse() {
-        IsoDep id = createIsoDepInstance();
-        Assert.assertArrayEquals(id.getHiLayerResponse(), new byte[]{0x00});
-    }
-
-    @Test
-    public void testTransceive() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-            new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0xF}));
-        byte[] transceivedBytes = new byte[]{0xA, 0xB, 0xC, 0xD};
-        Assert.assertArrayEquals(new byte[]{0xF}, id.transceive(transceivedBytes));
-        verify(mINfcTag, times(1)).transceive(anyInt(), mTransceiveCaptor.capture(), anyBoolean());
-        Assert.assertArrayEquals(transceivedBytes, mTransceiveCaptor.getValue());
-    }
-
-    @Test
-    public void testGetMaxTransceiveLength() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.getMaxTransceiveLength(TagTechnology.ISO_DEP)).thenReturn(16);
-        Assert.assertTrue(id.getMaxTransceiveLength() == 16);
-    }
-
-    @Test
-    public void testIsExtendedLengthApduSupported() throws RemoteException, IOException {
-        IsoDep id = createConnectedIsoDepInstance();
-        when(mINfcTag.getExtendedLengthApdusSupported()).thenReturn(true);
-        Assert.assertTrue(id.isExtendedLengthApduSupported());
-    }
-
-    public IsoDep createConnectedIsoDepInstance() throws RemoteException, IOException {
-        IsoDep id = createIsoDepInstance();
-        when(mINfcTag.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mINfcTag.connect(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        id.connect();
-        return id;
-    }
-
-    public IsoDep createIsoDepInstance() {
-        Bundle extras = new Bundle();
-        extras.putByteArray(IsoDep.EXTRA_HI_LAYER_RESP, new byte[]{0x00});
-        extras.putByteArray(IsoDep.EXTRA_HIST_BYTES, new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{0x00}, new int[]{TagTechnology.ISO_DEP},
-            new Bundle[]{extras}, 0, 0L, mINfcTag);
-        return IsoDep.get(tag);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/MifareClassicTest.java b/tests/tests/nfc/src/android/nfc/tech/cts/MifareClassicTest.java
deleted file mode 100644
index 3f6b3ad..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/MifareClassicTest.java
+++ /dev/null
@@ -1,564 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts;
-
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyBoolean;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertThrows;
-
-import android.nfc.ErrorCodes;
-import android.nfc.INfcTag;
-import android.nfc.Tag;
-import android.nfc.TransceiveResult;
-import android.nfc.tech.MifareClassic;
-import android.nfc.tech.TagTechnology;
-import android.os.Bundle;
-import android.os.RemoteException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.IOException;
-
-public class MifareClassicTest {
-
-    @Mock
-    private INfcTag mNfcTagMock;
-    @Captor
-    private ArgumentCaptor<byte[]> mTransceiveDataCaptor;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    @Test
-    public void testGet_isMifareClassic() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x01);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertTrue("Expected to not be <null>", classic != null);
-    }
-
-    @Test
-    public void testGet_tagNotMifareClassic() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_A}, new Bundle[]{}, 0, 0L,
-                null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertTrue("Expected: <null> ", classic == null);
-    }
-
-    @Test
-    public void testGetType_classic() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x01);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(MifareClassic.TYPE_CLASSIC, classic.getType());
-    }
-
-    @Test
-    public void testGetType_plus() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x10);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(MifareClassic.TYPE_PLUS, classic.getType());
-    }
-
-    @Test
-    public void testGetType_pro() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0xB8);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(classic.getType(), MifareClassic.TYPE_PRO);
-    }
-
-    @Test
-    public void testGetSize_1K() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x08);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(MifareClassic.SIZE_1K, classic.getSize());
-    }
-
-    @Test
-    public void testGetSize_mini() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x09);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(MifareClassic.SIZE_MINI, classic.getSize());
-    }
-
-    @Test
-    public void testGetSize_2K() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x10);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(MifareClassic.SIZE_2K, classic.getSize());
-    }
-
-    @Test
-    public void testGetSize_4K() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x11);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(MifareClassic.SIZE_4K, classic.getSize());
-    }
-
-    @Test
-    public void testGetSectorCount_1K() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x01);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(16, classic.getSectorCount());
-    }
-
-    @Test
-    public void testGetSectorCount_2K() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x10);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(32, classic.getSectorCount());
-    }
-
-    @Test
-    public void testGetSectorCount_4K() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x11);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(40, classic.getSectorCount());
-    }
-
-    @Test
-    public void testGetSectorCount_mini() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x09);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, null);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(5, classic.getSectorCount());
-    }
-
-    @Test
-    public void testGetBlockCount() {
-        MifareClassic classic = createMifareClassic1K();
-
-        assertEquals(64, classic.getBlockCount());
-    }
-
-    @Test
-    public void testGetBlockCountInSector() {
-        MifareClassic classic = createMifareClassic1K();
-
-        assertEquals(4, classic.getBlockCountInSector(0));
-        assertEquals(16, classic.getBlockCountInSector(32));
-    }
-
-    @Test
-    public void testBlockToSector() {
-        MifareClassic classic = createMifareClassic1K();
-
-        assertEquals(1, classic.blockToSector(4));
-        assertEquals(33, classic.blockToSector(144));
-    }
-
-    @Test
-    public void testSectorToBlock() {
-        MifareClassic classic = createMifareClassic1K();
-
-        assertEquals(4, classic.sectorToBlock(1));
-        assertEquals(144, classic.sectorToBlock(33));
-    }
-
-    @Test
-    public void testAuthenticateSectorWithKeyA() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        byte[] key = new byte[]{0xA, 0xB, 0xC, 0xD, 0xE, 0xF};
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{}));
-
-        assertTrue(classic.authenticateSectorWithKeyA(0, key));
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(
-                new byte[]{0x60, 0x00, 0x01, 0x02, 0x03, 0x04, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF},
-                mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testAuthenticateSectorWithKeyB() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        byte[] key = new byte[]{0xA, 0xB, 0xC, 0xD, 0xE, 0xF};
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{}));
-
-        assertTrue(classic.authenticateSectorWithKeyB(0, key));
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(
-                new byte[]{0x61, 0x00, 0x01, 0x02, 0x03, 0x04, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF},
-                mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testAuthenticateSectorWithKeyB_nullTransceive()
-            throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        byte[] key = new byte[]{0xA, 0xB, 0xC, 0xD, 0xE, 0xF};
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, null));
-
-        assertEquals(false, classic.authenticateSectorWithKeyB(0, key));
-    }
-
-    @Test
-    public void testAuthenticateSectorWithKeyB_ioException() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        byte[] key = new byte[]{0xA, 0xB, 0xC, 0xD, 0xE, 0xF};
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(null);
-
-        assertEquals(false, classic.authenticateSectorWithKeyB(0, key));
-    }
-
-    @Test
-    public void testReadBlock() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0xA}));
-        byte[] result = classic.readBlock(0);
-
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(new byte[]{0xA}, classic.readBlock(0));
-        assertArrayEquals(new byte[]{0x30, 0x00}, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testWriteBlock() throws RemoteException, IOException {
-        byte[] block = new byte[]{0xA, 0xB, 0xC, 0xD, 0xA, 0xB, 0xC, 0xD, 0xA, 0xB, 0xC, 0xD, 0xA,
-                0xB, 0xC, 0xD};
-        MifareClassic classic = createConnectedMifareClassic();
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{}));
-
-        classic.writeBlock(0, block);
-
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(
-                new byte[]{(byte) 0xA0, 0x0, 0xA, 0xB, 0xC, 0xD, 0xA, 0xB, 0xC, 0xD, 0xA, 0xB, 0xC,
-                        0xD, 0xA, 0xB, 0xC, 0xD}, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testWriteBlock_incorrectSize() throws RemoteException, IOException {
-        byte[] block = new byte[]{0xA, 0xB, 0xC, 0xD};
-        MifareClassic classic = createConnectedMifareClassic();
-
-        assertThrows(() -> classic.writeBlock(0, block));
-    }
-
-    @Test
-    public void testIncrement() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0x0}));
-        classic.increment(4, 0x01010101);
-
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(new byte[]{(byte) 0xC1, 0x04, 0x01, 0x01, 0x01, 0x01},
-                mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testDecrement() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0x0}));
-        classic.decrement(4, 0x01010101);
-
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(new byte[]{(byte) 0xC0, 0x04, 0x01, 0x01, 0x01, 0x01},
-                mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testTransfer() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0x0}));
-        classic.transfer(0);
-
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(new byte[]{(byte) 0xB0, 0x00}, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testRestore() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0x0}));
-        classic.restore(0);
-
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(new byte[]{(byte) 0xC2, 0x00}, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testTransceive() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0xF}));
-        byte[] transceivedBytes = new byte[]{0xA, 0xB, 0xC, 0xD};
-
-        assertArrayEquals(new byte[]{0xF}, classic.transceive(transceivedBytes));
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(transceivedBytes, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testGetMaxTransceiveLength() throws RemoteException, IOException {
-        MifareClassic classic = createMifareClassic1K();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.getMaxTransceiveLength(TagTechnology.MIFARE_CLASSIC)).thenReturn(16);
-
-        assertEquals(16, classic.getMaxTransceiveLength());
-    }
-
-    @Test
-    public void testSetTimeout() throws RemoteException, IOException {
-        MifareClassic classic = createMifareClassic1K();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.setTimeout(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        classic.setTimeout(250);
-
-        ArgumentCaptor<Integer> timeout = ArgumentCaptor.forClass(Integer.class);
-        verify(mNfcTagMock, times(1)).setTimeout(anyInt(), timeout.capture());
-        assertTrue(250 == timeout.getValue());
-    }
-
-    @Test
-    public void testSetTimeout_invalidTimeout() throws RemoteException, IOException {
-        MifareClassic classic = createMifareClassic1K();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.setTimeout(anyInt(), anyInt())).thenReturn(ErrorCodes.ERROR_INVALID_PARAM);
-        assertThrows(() -> classic.setTimeout(250));
-    }
-
-    @Test
-    public void testGetTimeout() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        when(mNfcTagMock.getTimeout(anyInt())).thenReturn(250);
-        assertEquals(250, classic.getTimeout());
-    }
-
-    @Test
-    public void testGetTimeout_serviceDead() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-
-        when(mNfcTagMock.getTimeout(anyInt())).thenThrow(new RemoteException());
-        assertEquals(0, classic.getTimeout());
-    }
-
-    @Test
-    public void testGetTag() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x01);
-        extras.putByteArray("atqa", new byte[]{0x02});
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, mNfcTagMock);
-        MifareClassic classic = MifareClassic.get(tag);
-
-        assertEquals(tag, classic.getTag());
-    }
-
-    @Test
-    public void testIsConnected_isConnected() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(true, classic.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_notConnected() throws RemoteException, IOException {
-        MifareClassic classic = createMifareClassic1K();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertEquals(false, classic.isConnected());
-    }
-
-
-    @Test
-    public void testIsConnected_serviceDead() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-        when(mNfcTagMock.isPresent(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, classic.isConnected());
-    }
-
-    @Test
-    public void testReconnect() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        classic.reconnect();
-        verify(mNfcTagMock, times(1)).reconnect(anyInt());
-    }
-
-    @Test
-    public void testReconnect_notConnected() throws RemoteException, IOException {
-        MifareClassic classic = createMifareClassic1K();
-
-        assertThrows(() -> classic.reconnect());
-    }
-
-    @Test
-    public void testReconnect_failReconnect() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.ERROR_CONNECT);
-
-        assertThrows(() -> classic.reconnect());
-    }
-
-    @Test
-    public void testReconnect_remoteException() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-        when(mNfcTagMock.reconnect(anyInt())).thenThrow(new RemoteException());
-
-        assertThrows(() -> classic.reconnect());
-    }
-
-    @Test
-    public void testClose() throws RemoteException, IOException {
-        MifareClassic classic = createConnectedMifareClassic();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-        classic.close();
-
-        assertEquals(false, classic.isConnected());
-    }
-
-    private MifareClassic createConnectedMifareClassic() throws RemoteException, IOException {
-        MifareClassic classic = createMifareClassic1K();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.connect(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        classic.connect();
-
-        return classic;
-    }
-
-    private MifareClassic createMifareClassic1K() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x01);
-        extras.putByteArray("atqa", new byte[]{0x00});
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04},
-                new int[]{TagTechnology.MIFARE_CLASSIC, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, mNfcTagMock);
-
-        return MifareClassic.get(tag);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/MifareUltralightTest.java b/tests/tests/nfc/src/android/nfc/tech/cts/MifareUltralightTest.java
deleted file mode 100644
index f4045d9..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/MifareUltralightTest.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts;
-
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyBoolean;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertThrows;
-
-import android.nfc.ErrorCodes;
-import android.nfc.INfcTag;
-import android.nfc.Tag;
-import android.nfc.TransceiveResult;
-import android.nfc.tech.MifareUltralight;
-import android.nfc.tech.TagTechnology;
-import android.os.Bundle;
-import android.os.RemoteException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.IOException;
-
-public class MifareUltralightTest {
-
-    @Mock
-    private INfcTag mNfcTagMock;
-    @Captor
-    private ArgumentCaptor<byte[]> mTransceiveDataCaptor;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    @Test
-    public void testGet_isUltralight() {
-        MifareUltralight ultralight = createMifareUltralight();
-
-        assertTrue("Expected to not be <null>", ultralight != null);
-    }
-
-    @Test
-    public void testGet_notUltralight() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_A}, new Bundle[]{}, 0, 0L,
-                null);
-        MifareUltralight ultralight = MifareUltralight.get(tag);
-
-        assertTrue("Expected: <null> ", ultralight == null);
-    }
-
-    @Test
-    public void testGetType_ultralight() {
-        MifareUltralight ultralight = createMifareUltralight();
-
-        assertEquals(MifareUltralight.TYPE_ULTRALIGHT, ultralight.getType());
-    }
-
-    @Test
-    public void testGetType_ultralightC() {
-        Bundle nfcAExtras = new Bundle();
-        nfcAExtras.putShort("sak", (short) 0x00);
-        nfcAExtras.putByteArray("atqa", new byte[]{0x00});
-        Bundle ultralightExtras = new Bundle();
-        ultralightExtras.putBoolean("isulc", true);
-        Tag tag = new Tag(new byte[]{0x04},
-                new int[]{TagTechnology.MIFARE_ULTRALIGHT, TagTechnology.NFC_A},
-                new Bundle[]{ultralightExtras, nfcAExtras}, 0, 0L, null);
-        MifareUltralight ultralight = MifareUltralight.get(tag);
-
-        assertEquals(MifareUltralight.TYPE_ULTRALIGHT_C, ultralight.getType());
-    }
-
-    @Test
-    public void testReadPages() throws RemoteException, IOException {
-        byte[] pages = new byte[]{0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x02,
-                0x03, 0x00, 0x01, 0x02, 0x03};
-        MifareUltralight ultralight = createConnectedMifareUltralight();
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, pages));
-
-        assertEquals(pages, ultralight.readPages(0));
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(new byte[]{0x30, 0x0}, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testReadPages_invalidIndex() throws RemoteException, IOException {
-        MifareUltralight ultralight = createMifareUltralight();
-
-        assertThrows(() -> ultralight.readPages(-1));
-    }
-
-    @Test
-    public void testWritePage() throws RemoteException, IOException {
-        byte[] page = new byte[]{0xA, 0xB, 0xC, 0xD};
-        MifareUltralight ultralight = createConnectedMifareUltralight();
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{}));
-
-        ultralight.writePage(0, page);
-
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(new byte[]{(byte) 0xA2, 0x0, 0xA, 0xB, 0xC, 0xD},
-                mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testWritePage_invalidIndex() throws RemoteException, IOException {
-        MifareUltralight ultralight = createMifareUltralight();
-
-        assertThrows(() -> ultralight.writePage(-1, new byte[]{0xA, 0xB, 0xC, 0xD}));
-    }
-
-    @Test
-    public void testTransceieve() throws RemoteException, IOException {
-        byte[] data = new byte[]{0xA, 0xB, 0xC, 0xD};
-        byte[] response = new byte[]{0x1, 0x2, 0x3, 0x4};
-        MifareUltralight ultralight = createConnectedMifareUltralight();
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, response));
-
-        assertArrayEquals(response, ultralight.transceive(data));
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(data, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testGetMaxTransceiveLength() throws RemoteException, IOException {
-        MifareUltralight ultralight = createMifareUltralight();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.getMaxTransceiveLength(TagTechnology.MIFARE_ULTRALIGHT)).thenReturn(16);
-
-        assertEquals(16, ultralight.getMaxTransceiveLength());
-    }
-
-    @Test
-    public void testSetTimeout() throws RemoteException, IOException {
-        MifareUltralight ultralight = createMifareUltralight();
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.setTimeout(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        ultralight.setTimeout(250);
-
-        ArgumentCaptor<Integer> timeout = ArgumentCaptor.forClass(Integer.class);
-        verify(mNfcTagMock, times(1)).setTimeout(anyInt(), timeout.capture());
-        assertTrue(250 == timeout.getValue());
-    }
-
-    @Test
-    public void testSetTimeout_invalidTimeout() throws RemoteException, IOException {
-        MifareUltralight ultralight = createMifareUltralight();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.setTimeout(anyInt(), anyInt())).thenReturn(ErrorCodes.ERROR_INVALID_PARAM);
-        assertThrows(() -> ultralight.setTimeout(250));
-    }
-
-    @Test
-    public void testGetTimeout() throws RemoteException, IOException {
-        MifareUltralight ultralight = createMifareUltralight();
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.getTimeout(anyInt())).thenReturn(250);
-
-        assertEquals(250, ultralight.getTimeout());
-    }
-
-    @Test
-    public void testGetTimeout_serviceDead() throws RemoteException, IOException {
-        MifareUltralight ultralight = createConnectedMifareUltralight();
-
-        when(mNfcTagMock.getTimeout(anyInt())).thenThrow(new RemoteException());
-        assertEquals(0, ultralight.getTimeout());
-    }
-
-
-    @Test
-    public void testGetTag() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", (short) 0x01);
-        extras.putByteArray("atqa", new byte[]{0x02});
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04},
-                new int[]{TagTechnology.MIFARE_ULTRALIGHT, TagTechnology.NFC_A},
-                new Bundle[]{null, extras}, 0, 0L, mNfcTagMock);
-        MifareUltralight ultralight = MifareUltralight.get(tag);
-
-        assertEquals(tag, ultralight.getTag());
-    }
-
-    @Test
-    public void testIsConnected_isConnected() throws RemoteException, IOException {
-        MifareUltralight ultralight = createConnectedMifareUltralight();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(true, ultralight.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_notConnected() throws RemoteException, IOException {
-        MifareUltralight ultralight = createMifareUltralight();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertEquals(false, ultralight.isConnected());
-    }
-
-
-    @Test
-    public void testIsConnected_serviceDead() throws RemoteException, IOException {
-        MifareUltralight ultralight = createConnectedMifareUltralight();
-        when(mNfcTagMock.isPresent(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, ultralight.isConnected());
-    }
-
-    @Test
-    public void testReconnect() throws RemoteException, IOException {
-        MifareUltralight ultralight = createConnectedMifareUltralight();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        ultralight.reconnect();
-        verify(mNfcTagMock, times(1)).reconnect(anyInt());
-    }
-
-    @Test
-    public void testReconnect_notConnected() throws RemoteException, IOException {
-        MifareUltralight ultralight = createMifareUltralight();
-
-        assertThrows(() -> ultralight.reconnect());
-    }
-
-    @Test
-    public void testReconnect_failReconnect() throws RemoteException, IOException {
-        MifareUltralight ultralight = createConnectedMifareUltralight();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.ERROR_CONNECT);
-
-        assertThrows(() -> ultralight.reconnect());
-    }
-
-    @Test
-    public void testReconnect_remoteException() throws RemoteException, IOException {
-        MifareUltralight ultralight = createConnectedMifareUltralight();
-        when(mNfcTagMock.reconnect(anyInt())).thenThrow(new RemoteException());
-
-        assertThrows(() -> ultralight.reconnect());
-    }
-
-    @Test
-    public void testClose() throws RemoteException, IOException {
-        MifareUltralight ultralight = createConnectedMifareUltralight();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-        ultralight.close();
-
-        assertEquals(false, ultralight.isConnected());
-    }
-
-    private MifareUltralight createConnectedMifareUltralight() throws RemoteException, IOException {
-        MifareUltralight ultralight = createMifareUltralight();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.connect(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        ultralight.connect();
-
-        return ultralight;
-    }
-
-    private MifareUltralight createMifareUltralight() {
-        Bundle nfcAExtras = new Bundle();
-        nfcAExtras.putShort("sak", (short) 0x00);
-        nfcAExtras.putByteArray("atqa", new byte[]{0x00});
-        Bundle ultralightExtras = new Bundle();
-        ultralightExtras.putBoolean("isulc", false);
-        Tag tag = new Tag(new byte[]{0x04},
-                new int[]{TagTechnology.MIFARE_ULTRALIGHT, TagTechnology.NFC_A},
-                new Bundle[]{ultralightExtras, nfcAExtras}, 0, 0L, mNfcTagMock);
-
-        return MifareUltralight.get(tag);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/NdefFormatableTest.java b/tests/tests/nfc/src/android/nfc/tech/cts/NdefFormatableTest.java
deleted file mode 100644
index e1662b2..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/NdefFormatableTest.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts;
-
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertThrows;
-
-import android.nfc.ErrorCodes;
-import android.nfc.INfcTag;
-import android.nfc.NdefMessage;
-import android.nfc.NdefRecord;
-import android.nfc.Tag;
-import android.nfc.tech.NdefFormatable;
-import android.nfc.tech.TagTechnology;
-import android.os.Bundle;
-import android.os.RemoteException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.IOException;
-
-public class NdefFormatableTest {
-
-    private static final int NDEF_MAX_LENGTH = 128;
-
-    @Mock
-    private INfcTag mNfcTagMock;
-    @Captor
-    private ArgumentCaptor<NdefMessage> mNdefMessageCaptor;
-    private NdefMessage mNdefMessage;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-        NdefRecord ndefRecord = NdefRecord.createTextRecord("en", "text");
-        mNdefMessage = new NdefMessage(ndefRecord);
-    }
-
-    @Test
-    public void testGet_isNdefFormatable() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NDEF_FORMATABLE}, new Bundle[]{}, 0,
-                0L, mNfcTagMock);
-        NdefFormatable ndefFormatable = NdefFormatable.get(tag);
-
-        assertTrue("Expected to not be <null>", ndefFormatable != null);
-    }
-
-    @Test
-    public void testGet_notNdefFormatable() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NDEF}, new Bundle[]{}, 0, 0L,
-                mNfcTagMock);
-        NdefFormatable ndefFormatable = NdefFormatable.get(tag);
-
-        assertTrue("Expected: <null> ", ndefFormatable == null);
-    }
-
-    @Test
-    public void testFormat() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-
-        ndefFormatable.format(mNdefMessage);
-
-        verify(mNfcTagMock, times(1)).ndefWrite(anyInt(), mNdefMessageCaptor.capture());
-        assertEquals(mNdefMessage, mNdefMessageCaptor.getValue());
-    }
-
-    @Test
-    public void testFormatReadOnly() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.ndefMakeReadOnly(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        ndefFormatable.formatReadOnly(mNdefMessage);
-
-        verify(mNfcTagMock, times(1)).ndefWrite(anyInt(), mNdefMessageCaptor.capture());
-        assertEquals(mNdefMessage, mNdefMessageCaptor.getValue());
-    }
-
-    @Test
-    public void testFormatReadOnly_formatNdefIOError() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.ERROR_IO);
-
-        assertThrows(() -> ndefFormatable.formatReadOnly(mNdefMessage));
-    }
-
-    @Test
-    public void testFormatReadOnly_formatNdefFormatError() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.ERROR_INVALID_PARAM);
-
-        assertThrows(() -> ndefFormatable.formatReadOnly(mNdefMessage));
-    }
-
-    @Test
-    public void testFormatReadOnly_formatNdefUnknownError() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(1);
-
-        assertThrows(() -> ndefFormatable.formatReadOnly(mNdefMessage));
-    }
-
-    @Test
-    public void testFormatReadOnly_notNdef() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(false);
-
-        assertThrows(() -> ndefFormatable.formatReadOnly(mNdefMessage));
-    }
-
-    @Test
-    public void testFormatReadOnly_ndefWriteIOError() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(ErrorCodes.ERROR_IO);
-
-        assertThrows(() -> ndefFormatable.formatReadOnly(mNdefMessage));
-    }
-
-    @Test
-    public void testFormatReadOnly_ndefWriteFormatError() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(ErrorCodes.ERROR_INVALID_PARAM);
-
-        assertThrows(() -> ndefFormatable.formatReadOnly(mNdefMessage));
-    }
-
-    @Test
-    public void testFormatReadOnly_ndefWriteUnknownError() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(1);
-
-        assertThrows(() -> ndefFormatable.formatReadOnly(mNdefMessage));
-    }
-
-    @Test
-    public void testFormatReadOnly_makeReadonlyIOError() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.ndefMakeReadOnly(anyInt())).thenReturn(ErrorCodes.ERROR_IO);
-
-        assertThrows(() -> ndefFormatable.formatReadOnly(mNdefMessage));
-    }
-
-    @Test
-    public void testFormatReadOnly_makeReadonlyFormatError() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.ndefMakeReadOnly(anyInt())).thenReturn(ErrorCodes.ERROR_INVALID_PARAM);
-
-        assertThrows(() -> ndefFormatable.formatReadOnly(mNdefMessage));
-    }
-
-    @Test
-    public void testFormatReadOnly_makeReadonlyUnknownError() throws Exception {
-        NdefFormatable ndefFormatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.formatNdef(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.ndefMakeReadOnly(anyInt())).thenReturn(1);
-
-        assertThrows(() -> ndefFormatable.formatReadOnly(mNdefMessage));
-    }
-
-    @Test
-    public void testGetTag() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NDEF_FORMATABLE}, new Bundle[]{}, 0,
-                0L, mNfcTagMock);
-        NdefFormatable formatable = NdefFormatable.get(tag);
-
-        assertEquals(tag, formatable.getTag());
-    }
-
-    @Test
-    public void testIsConnected_isConnected() throws RemoteException, IOException {
-        NdefFormatable formatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(true, formatable.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_notConnected() throws RemoteException, IOException {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NDEF_FORMATABLE}, new Bundle[]{}, 0,
-                0L, mNfcTagMock);
-        NdefFormatable formatable = NdefFormatable.get(tag);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertEquals(false, formatable.isConnected());
-    }
-
-
-    @Test
-    public void testIsConnected_serviceDead() throws RemoteException, IOException {
-        NdefFormatable formatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.isPresent(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, formatable.isConnected());
-    }
-
-    @Test
-    public void testReconnect() throws RemoteException, IOException {
-        NdefFormatable formatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        formatable.reconnect();
-        verify(mNfcTagMock, times(1)).reconnect(anyInt());
-    }
-
-    @Test
-    public void testReconnect_notConnected() throws RemoteException, IOException {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NDEF_FORMATABLE}, new Bundle[]{}, 0,
-                0L, mNfcTagMock);
-        NdefFormatable formatable = NdefFormatable.get(tag);
-
-        assertThrows(() -> formatable.reconnect());
-    }
-
-    @Test
-    public void testReconnect_failReconnect() throws RemoteException, IOException {
-        NdefFormatable formatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.ERROR_CONNECT);
-
-        assertThrows(() -> formatable.reconnect());
-    }
-
-    @Test
-    public void testReconnect_remoteException() throws RemoteException, IOException {
-        NdefFormatable formatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.reconnect(anyInt())).thenThrow(new RemoteException());
-
-        assertThrows(() -> formatable.reconnect());
-    }
-
-    @Test
-    public void testClose() throws RemoteException, IOException {
-        NdefFormatable formatable = createConnectedNdefFormatable();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-        formatable.close();
-
-        assertEquals(false, formatable.isConnected());
-    }
-
-
-    private NdefFormatable createConnectedNdefFormatable() throws IOException, RemoteException {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NDEF_FORMATABLE}, new Bundle[]{}, 0,
-                0L, mNfcTagMock);
-        NdefFormatable ndefFormatable = NdefFormatable.get(tag);
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.connect(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        ndefFormatable.connect();
-
-        return ndefFormatable;
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/NdefTest.java b/tests/tests/nfc/src/android/nfc/tech/cts/NdefTest.java
deleted file mode 100644
index ab13f32..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/NdefTest.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts;
-
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertThrows;
-
-import android.nfc.ErrorCodes;
-import android.nfc.INfcTag;
-import android.nfc.NdefMessage;
-import android.nfc.NdefRecord;
-import android.nfc.Tag;
-import android.nfc.tech.Ndef;
-import android.nfc.tech.TagTechnology;
-import android.os.Bundle;
-import android.os.RemoteException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.IOException;
-
-public class NdefTest {
-
-    private static final int NDEF_MAX_LENGTH = 128;
-
-    @Mock
-    private INfcTag mNfcTagMock;
-    @Captor
-    private ArgumentCaptor<NdefMessage> mNdefMessageCaptor;
-    private NdefMessage mNdefMessage;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-        NdefRecord ndefRecord = NdefRecord.createTextRecord("en", "text");
-        mNdefMessage = new NdefMessage(ndefRecord);
-    }
-
-    @Test
-    public void testGet_isNdef() {
-        Ndef ndef = createNdef(1);
-
-        assertTrue("Expected to not be <null>", ndef != null);
-    }
-
-    @Test
-    public void testGet_notNdef() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_A}, new Bundle[]{}, 0, 0L,
-                null);
-        Ndef ndef = Ndef.get(tag);
-
-        assertTrue("Expected: <null> ", ndef == null);
-    }
-
-    @Test
-    public void testGetCachedNdefMessage() {
-        Ndef ndef = createNdef(1);
-
-        assertEquals(mNdefMessage, ndef.getCachedNdefMessage());
-    }
-
-    @Test
-    public void testGetType_type1() {
-        Ndef ndef = createNdef(1);
-
-        assertEquals(Ndef.NFC_FORUM_TYPE_1, ndef.getType());
-    }
-
-    @Test
-    public void testGetType_type2() {
-        Ndef ndef = createNdef(2);
-
-        assertEquals(Ndef.NFC_FORUM_TYPE_2, ndef.getType());
-    }
-
-    @Test
-    public void testGetType_type3() {
-        Ndef ndef = createNdef(3);
-
-        assertEquals(Ndef.NFC_FORUM_TYPE_3, ndef.getType());
-    }
-
-    @Test
-    public void testGetType_type4() {
-        Ndef ndef = createNdef(4);
-
-        assertEquals(Ndef.NFC_FORUM_TYPE_4, ndef.getType());
-    }
-
-    @Test
-    public void testGetType_mifareClassic() {
-        Ndef ndef = createNdef(101);
-
-        assertEquals(Ndef.MIFARE_CLASSIC, ndef.getType());
-    }
-
-    @Test
-    public void testGetType_iCodeSLI() {
-        Ndef ndef = createNdef(102);
-
-        assertEquals(Ndef.ICODE_SLI, ndef.getType());
-    }
-
-    @Test
-    public void testGetType_unknown() {
-        Ndef ndef = createNdef(-1);
-
-        assertEquals(Ndef.UNKNOWN, ndef.getType());
-    }
-
-    @Test
-    public void testGetMaxLength() {
-        Ndef ndef = createNdef(1);
-
-        assertEquals(NDEF_MAX_LENGTH, ndef.getMaxSize());
-    }
-
-    @Test
-    public void testIsWritable() {
-        Ndef ndef = createNdef(1);
-
-        assertEquals(true, ndef.isWritable());
-    }
-
-    @Test
-    public void testGetNdefMessage() throws Exception {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefRead(anyInt())).thenReturn(mNdefMessage);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(mNdefMessage, ndef.getNdefMessage());
-    }
-
-    @Test
-    public void testGetNdefMessage_noTagService() throws Exception {
-        Ndef ndef = createNdefNoTagService();
-
-        assertThrows(() -> ndef.getNdefMessage());
-    }
-
-    @Test
-    public void testGetNdefMessage_notNdef() throws Exception {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(null, ndef.getNdefMessage());
-    }
-
-    @Test
-    public void testGetNdefMessage_notNdefNotPresent() throws Exception {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertThrows(() -> ndef.getNdefMessage());
-    }
-
-    @Test
-    public void testGetNdefMessage_noTagOnRead() throws Exception {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefRead(anyInt())).thenReturn(null);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertThrows(() -> ndef.getNdefMessage());
-    }
-
-    @Test
-    public void testWriteNdefMessage() throws Exception {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(ErrorCodes.SUCCESS);
-
-        ndef.writeNdefMessage(mNdefMessage);
-
-        verify(mNfcTagMock, times(1)).ndefWrite(anyInt(), mNdefMessageCaptor.capture());
-        assertEquals(mNdefMessage, mNdefMessageCaptor.getValue());
-    }
-
-    @Test
-    public void testWriteNdefMessage_noTagService() throws Exception {
-        Ndef ndef = createNdefNoTagService();
-
-        assertThrows(() -> ndef.writeNdefMessage(mNdefMessage));
-    }
-
-    @Test
-    public void testWriteNdefMessage_notNdef() throws Exception {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(false);
-
-        assertThrows(() -> ndef.writeNdefMessage(mNdefMessage));
-    }
-
-    @Test
-    public void testWriteNdefMessage_ioError() throws Exception {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(ErrorCodes.ERROR_IO);
-
-        assertThrows(() -> ndef.writeNdefMessage(mNdefMessage));
-    }
-
-    @Test
-    public void testWriteNdefMessage_formatError() throws Exception {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(ErrorCodes.ERROR_INVALID_PARAM);
-
-        assertThrows(() -> ndef.writeNdefMessage(mNdefMessage));
-    }
-
-    @Test
-    public void testWriteNdefMessage_unknownError() throws Exception {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefWrite(anyInt(), any())).thenReturn(1);
-
-        assertThrows(() -> ndef.writeNdefMessage(mNdefMessage));
-    }
-
-    @Test
-    public void testCanMakeReadOnly() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.canMakeReadOnly(anyInt())).thenReturn(true);
-
-        assertEquals(true, ndef.canMakeReadOnly());
-    }
-
-    @Test
-    public void testCanMakeReadOnly_noTagService() throws RemoteException, IOException {
-        Ndef ndef = createNdefNoTagService();
-
-        assertEquals(false, ndef.canMakeReadOnly());
-    }
-
-    @Test
-    public void testCanMakeReadOnly_serviceDead() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.canMakeReadOnly(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, ndef.canMakeReadOnly());
-    }
-
-    @Test
-    public void testMakeReadOnly() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefMakeReadOnly(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        assertEquals(true, ndef.makeReadOnly());
-    }
-
-    @Test
-    public void testMakeReadOnly_noTagService() throws RemoteException, IOException {
-        Ndef ndef = createNdefNoTagService();
-
-        assertEquals(false, ndef.makeReadOnly());
-    }
-
-    @Test
-    public void testMakeReadOnly_notNdef() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(false);
-
-        assertThrows(() -> ndef.makeReadOnly());
-    }
-
-    @Test
-    public void testMakeReadOnly_serviceDead() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefMakeReadOnly(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, ndef.makeReadOnly());
-    }
-
-    @Test
-    public void testMakeReadOnly_ioError() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefMakeReadOnly(anyInt())).thenReturn(ErrorCodes.ERROR_IO);
-
-        assertThrows(() -> ndef.makeReadOnly());
-    }
-
-    @Test
-    public void testMakeReadOnly_formatError() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefMakeReadOnly(anyInt())).thenReturn(ErrorCodes.ERROR_INVALID_PARAM);
-
-        assertEquals(false, ndef.makeReadOnly());
-    }
-
-    @Test
-    public void testMakeReadOnly_unknownError() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isNdef(anyInt())).thenReturn(true);
-        when(mNfcTagMock.ndefMakeReadOnly(anyInt())).thenReturn(1);
-
-        assertThrows(() -> ndef.makeReadOnly());
-    }
-
-    @Test
-    public void testGetTag() {
-        Bundle extras = new Bundle();
-        extras.putInt(Ndef.EXTRA_NDEF_MAXLENGTH, NDEF_MAX_LENGTH);
-        extras.putInt(Ndef.EXTRA_NDEF_CARDSTATE, 2);
-        extras.putParcelable(Ndef.EXTRA_NDEF_MSG, mNdefMessage);
-        extras.putInt(Ndef.EXTRA_NDEF_TYPE, 1);
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04}, new int[]{TagTechnology.NDEF},
-                new Bundle[]{extras}, 0, 0L, mNfcTagMock);
-        Ndef ndef = Ndef.get(tag);
-
-        assertEquals(tag, ndef.getTag());
-    }
-
-    @Test
-    public void testIsConnected_isConnected() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(true, ndef.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_notConnected() throws RemoteException, IOException {
-        Ndef ndef = createNdef(1);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertEquals(false, ndef.isConnected());
-    }
-
-
-    @Test
-    public void testIsConnected_serviceDead() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.isPresent(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, ndef.isConnected());
-    }
-
-    @Test
-    public void testReconnect() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        ndef.reconnect();
-        verify(mNfcTagMock, times(1)).reconnect(anyInt());
-    }
-
-    @Test
-    public void testReconnect_notConnected() throws RemoteException, IOException {
-        Ndef ndef = createNdef(1);
-
-        assertThrows(() -> ndef.reconnect());
-    }
-
-    @Test
-    public void testReconnect_failReconnect() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.ERROR_CONNECT);
-
-        assertThrows(() -> ndef.reconnect());
-    }
-
-    @Test
-    public void testReconnect_remoteException() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.reconnect(anyInt())).thenThrow(new RemoteException());
-
-        assertThrows(() -> ndef.reconnect());
-    }
-
-    @Test
-    public void testClose() throws RemoteException, IOException {
-        Ndef ndef = createConnectedNdef();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-        ndef.close();
-
-        assertEquals(false, ndef.isConnected());
-    }
-
-    private Ndef createConnectedNdef() throws RemoteException, IOException {
-        Ndef ndef = createNdef(1);
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.connect(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        ndef.connect();
-
-        return ndef;
-    }
-
-    private Ndef createNdef(int type) {
-        Bundle extras = new Bundle();
-        extras.putInt(Ndef.EXTRA_NDEF_MAXLENGTH, NDEF_MAX_LENGTH);
-        extras.putInt(Ndef.EXTRA_NDEF_CARDSTATE, 2);
-        extras.putParcelable(Ndef.EXTRA_NDEF_MSG, mNdefMessage);
-        extras.putInt(Ndef.EXTRA_NDEF_TYPE, type);
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04}, new int[]{TagTechnology.NDEF},
-                new Bundle[]{extras}, 0, 0L, mNfcTagMock);
-
-        return Ndef.get(tag);
-    }
-
-    private Ndef createNdefNoTagService() {
-        Bundle extras = new Bundle();
-        extras.putInt(Ndef.EXTRA_NDEF_MAXLENGTH, NDEF_MAX_LENGTH);
-        extras.putInt(Ndef.EXTRA_NDEF_CARDSTATE, 2);
-        extras.putParcelable(Ndef.EXTRA_NDEF_MSG, mNdefMessage);
-        extras.putInt(Ndef.EXTRA_NDEF_TYPE, 1);
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04}, new int[]{TagTechnology.NDEF},
-                new Bundle[]{extras}, 0, 0L, null);
-        tag.setConnectedTechnology(TagTechnology.NDEF);
-        return Ndef.get(tag);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/NfcATest.java b/tests/tests/nfc/src/android/nfc/tech/cts/NfcATest.java
deleted file mode 100644
index 32b68c3..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/NfcATest.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts;
-
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyBoolean;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertThrows;
-
-import android.nfc.ErrorCodes;
-import android.nfc.INfcTag;
-import android.nfc.Tag;
-import android.nfc.TransceiveResult;
-import android.nfc.tech.NfcA;
-import android.nfc.tech.TagTechnology;
-import android.os.Bundle;
-import android.os.RemoteException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.IOException;
-
-public class NfcATest {
-
-    private static final short SAK = (short) 0x01;
-    private static final byte[] ATQA = new byte[]{0x11};
-
-    @Mock
-    private INfcTag mNfcTagMock;
-    @Captor
-    private ArgumentCaptor<byte[]> mTransceiveDataCaptor;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    @Test
-    public void testGet_isNfcA() {
-        NfcA nfcA = createNfcA();
-
-        assertTrue("Expected to not be <null>", nfcA != null);
-    }
-
-    @Test
-    public void testGet_tagNotNfcA() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_B}, new Bundle[]{}, 0, 0L,
-                null);
-        NfcA nfcA = NfcA.get(tag);
-
-        assertTrue("Expected: <null> ", nfcA == null);
-    }
-
-    @Test
-    public void testGetAtqa() {
-        NfcA nfcA = createNfcA();
-
-        assertEquals(ATQA, nfcA.getAtqa());
-    }
-
-    @Test
-    public void testGetSak() {
-        NfcA nfcA = createNfcA();
-
-        assertEquals(SAK, nfcA.getSak());
-    }
-
-    @Test
-    public void testTransceive() throws RemoteException, IOException {
-        NfcA nfcA = createConnectedNfcA();
-
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0xF}));
-        byte[] transceivedBytes = new byte[]{0xA, 0xB, 0xC, 0xD};
-
-        assertArrayEquals(new byte[]{0xF}, nfcA.transceive(transceivedBytes));
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(transceivedBytes, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testGetMaxTransceiveLength() throws RemoteException, IOException {
-        NfcA nfcA = createNfcA();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.getMaxTransceiveLength(TagTechnology.NFC_A)).thenReturn(16);
-
-        assertEquals(16, nfcA.getMaxTransceiveLength());
-    }
-
-    @Test
-    public void testSetTimeout() throws RemoteException, IOException {
-        NfcA nfcA = createNfcA();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.setTimeout(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        nfcA.setTimeout(250);
-
-        ArgumentCaptor<Integer> timeout = ArgumentCaptor.forClass(Integer.class);
-        verify(mNfcTagMock, times(1)).setTimeout(anyInt(), timeout.capture());
-        assertTrue(250 == timeout.getValue());
-    }
-
-    @Test
-    public void testSetTimeout_invalidTimeout() throws RemoteException, IOException {
-        NfcA nfcA = createNfcA();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.setTimeout(anyInt(), anyInt())).thenReturn(ErrorCodes.ERROR_INVALID_PARAM);
-        assertThrows(() -> nfcA.setTimeout(-1));
-    }
-
-    @Test
-    public void testGetTimeout() throws RemoteException, IOException {
-        NfcA nfcA = createConnectedNfcA();
-
-        when(mNfcTagMock.getTimeout(anyInt())).thenReturn(250);
-        assertEquals(250, nfcA.getTimeout());
-    }
-
-    @Test
-    public void testGetTimeout_serviceDead() throws RemoteException, IOException {
-        NfcA nfcA = createConnectedNfcA();
-
-        when(mNfcTagMock.getTimeout(anyInt())).thenThrow(new RemoteException());
-        assertEquals(0, nfcA.getTimeout());
-    }
-
-    @Test
-    public void testGetTag() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", SAK);
-        extras.putByteArray("atqa", ATQA);
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04}, new int[]{TagTechnology.NFC_A},
-                new Bundle[]{extras}, 0, 0L, mNfcTagMock);
-
-        NfcA nfcA = NfcA.get(tag);
-
-        assertEquals(tag, nfcA.getTag());
-    }
-
-    @Test
-    public void testIsConnected_isConnected() throws RemoteException, IOException {
-        NfcA nfcA = createConnectedNfcA();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(true, nfcA.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_notConnected() throws RemoteException, IOException {
-        NfcA nfcA = createNfcA();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertEquals(false, nfcA.isConnected());
-    }
-
-
-    @Test
-    public void testIsConnected_serviceDead() throws RemoteException, IOException {
-        NfcA nfcA = createConnectedNfcA();
-        when(mNfcTagMock.isPresent(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, nfcA.isConnected());
-    }
-
-    @Test
-    public void testReconnect() throws RemoteException, IOException {
-        NfcA nfcA = createConnectedNfcA();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        nfcA.reconnect();
-        verify(mNfcTagMock, times(1)).reconnect(anyInt());
-    }
-
-    @Test
-    public void testReconnect_notConnected() throws RemoteException, IOException {
-        NfcA nfcA = createNfcA();
-
-        assertThrows(() -> nfcA.reconnect());
-    }
-
-    @Test
-    public void testReconnect_failReconnect() throws RemoteException, IOException {
-        NfcA nfcA = createConnectedNfcA();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.ERROR_CONNECT);
-
-        assertThrows(() -> nfcA.reconnect());
-    }
-
-    @Test
-    public void testReconnect_remoteException() throws RemoteException, IOException {
-        NfcA nfcA = createConnectedNfcA();
-        when(mNfcTagMock.reconnect(anyInt())).thenThrow(new RemoteException());
-
-        assertThrows(() -> nfcA.reconnect());
-    }
-
-    @Test
-    public void testClose() throws RemoteException, IOException {
-        NfcA nfcA = createConnectedNfcA();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-        nfcA.close();
-
-        assertEquals(false, nfcA.isConnected());
-    }
-
-    private NfcA createConnectedNfcA() throws RemoteException, IOException {
-        NfcA nfcA = createNfcA();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.connect(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        nfcA.connect();
-
-        return nfcA;
-    }
-
-    private NfcA createNfcA() {
-        Bundle extras = new Bundle();
-        extras.putShort("sak", SAK);
-        extras.putByteArray("atqa", ATQA);
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04}, new int[]{TagTechnology.NFC_A},
-                new Bundle[]{extras}, 0, 0L, mNfcTagMock);
-
-        return NfcA.get(tag);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/NfcBTest.java b/tests/tests/nfc/src/android/nfc/tech/cts/NfcBTest.java
deleted file mode 100644
index 7f0308c..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/NfcBTest.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts;
-
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyBoolean;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertThrows;
-
-import android.nfc.ErrorCodes;
-import android.nfc.INfcTag;
-import android.nfc.Tag;
-import android.nfc.TransceiveResult;
-import android.nfc.tech.NfcB;
-import android.nfc.tech.TagTechnology;
-import android.os.Bundle;
-import android.os.RemoteException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.IOException;
-
-public class NfcBTest {
-
-    private static final byte[] APP_DATA = new byte[]{0xA};
-    private static final byte[] PROTOCOL_INFO = new byte[]{0xB};
-
-    @Mock
-    private INfcTag mNfcTagMock;
-    @Captor
-    private ArgumentCaptor<byte[]> mTransceiveDataCaptor;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    @Test
-    public void testGet_isNfcB() {
-        NfcB nfcB = createNfcB();
-
-        assertTrue("Expected to not be <null>", nfcB != null);
-    }
-
-    @Test
-    public void testGet_notNfcB() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_A}, new Bundle[]{}, 0, 0L,
-                null);
-        NfcB nfcB = NfcB.get(tag);
-
-        assertTrue("Expected: <null> ", nfcB == null);
-    }
-
-    @Test
-    public void testGetApplicationData() {
-        NfcB nfcB = createNfcB();
-
-        assertEquals(APP_DATA, nfcB.getApplicationData());
-    }
-
-    @Test
-    public void testGetProtocolInfo() {
-        NfcB nfcB = createNfcB();
-
-        assertEquals(PROTOCOL_INFO, nfcB.getProtocolInfo());
-    }
-
-    @Test
-
-    public void testTransceive() throws RemoteException, IOException {
-        NfcB nfcB = createConnectedNfcB();
-
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0xF}));
-        byte[] transceivedBytes = new byte[]{0xA, 0xB, 0xC, 0xD};
-
-        assertArrayEquals(new byte[]{0xF}, nfcB.transceive(transceivedBytes));
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(transceivedBytes, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testGetMaxTransceieveLength() throws RemoteException, IOException {
-        NfcB nfcB = createNfcB();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.getMaxTransceiveLength(TagTechnology.NFC_B)).thenReturn(16);
-
-        assertEquals(16, nfcB.getMaxTransceiveLength());
-    }
-
-
-    @Test
-    public void testGetTag() {
-        Bundle extras = new Bundle();
-        extras.putByteArray("appdata", APP_DATA);
-        extras.putByteArray("protinfo", PROTOCOL_INFO);
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_B}, new Bundle[]{extras}, 0, 0L,
-                null);
-
-        NfcB nfcB = NfcB.get(tag);
-
-        assertEquals(tag, nfcB.getTag());
-    }
-
-    @Test
-    public void testIsConnected_isConnected() throws RemoteException, IOException {
-        NfcB nfcB = createConnectedNfcB();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(true, nfcB.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_notConnected() throws RemoteException, IOException {
-        NfcB nfcB = createNfcB();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertEquals(false, nfcB.isConnected());
-    }
-
-
-    @Test
-    public void testIsConnected_serviceDead() throws RemoteException, IOException {
-        NfcB nfcB = createConnectedNfcB();
-        when(mNfcTagMock.isPresent(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, nfcB.isConnected());
-    }
-
-    @Test
-    public void testReconnect() throws RemoteException, IOException {
-        NfcB nfcB = createConnectedNfcB();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        nfcB.reconnect();
-        verify(mNfcTagMock, times(1)).reconnect(anyInt());
-    }
-
-    @Test
-    public void testReconnect_notConnected() throws RemoteException, IOException {
-        NfcB nfcB = createNfcB();
-
-        assertThrows(() -> nfcB.reconnect());
-    }
-
-    @Test
-    public void testReconnect_failReconnect() throws RemoteException, IOException {
-        NfcB nfcB = createConnectedNfcB();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.ERROR_CONNECT);
-
-        assertThrows(() -> nfcB.reconnect());
-    }
-
-    @Test
-    public void testReconnect_remoteException() throws RemoteException, IOException {
-        NfcB nfcB = createConnectedNfcB();
-        when(mNfcTagMock.reconnect(anyInt())).thenThrow(new RemoteException());
-
-        assertThrows(() -> nfcB.reconnect());
-    }
-
-    @Test
-    public void testClose() throws RemoteException, IOException {
-        NfcB nfcB = createConnectedNfcB();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-        nfcB.close();
-
-        assertEquals(false, nfcB.isConnected());
-    }
-
-
-    private NfcB createConnectedNfcB() throws RemoteException, IOException {
-        NfcB nfcB = createNfcB();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.connect(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        nfcB.connect();
-
-        return nfcB;
-    }
-
-    private NfcB createNfcB() {
-        Bundle extras = new Bundle();
-        extras.putByteArray("appdata", APP_DATA);
-        extras.putByteArray("protinfo", PROTOCOL_INFO);
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_B}, new Bundle[]{extras}, 0, 0L,
-                mNfcTagMock);
-
-        return NfcB.get(tag);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/NfcBarcodeTest.java b/tests/tests/nfc/src/android/nfc/tech/cts/NfcBarcodeTest.java
deleted file mode 100644
index 6f30241..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/NfcBarcodeTest.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts;
-
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertThrows;
-
-import android.nfc.ErrorCodes;
-import android.nfc.INfcTag;
-import android.nfc.Tag;
-import android.nfc.tech.NfcBarcode;
-import android.nfc.tech.TagTechnology;
-import android.os.Bundle;
-import android.os.RemoteException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.IOException;
-
-public class NfcBarcodeTest {
-
-    private static final byte[] ID = new byte[]{0x01, 0x02, 0x03, 0x04};
-
-    @Mock
-    private INfcTag mNfcTagMock;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    @Test
-    public void testGet_isNfcBarcode() {
-        NfcBarcode nfcBarcode = createNfcBarcode();
-
-        assertTrue("Expected to not be <null>", nfcBarcode != null);
-    }
-
-    @Test
-    public void testGet_tagNotNfcBarcode() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_B}, new Bundle[]{}, 0, 0L,
-                null);
-        NfcBarcode nfcBarcode = NfcBarcode.get(tag);
-
-        assertTrue("Expected: <null> ", nfcBarcode == null);
-    }
-
-    @Test
-    public void testGet_nullTechExtras() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_BARCODE}, new Bundle[]{null}, 0,
-                0L, null);
-
-        assertThrows(() -> NfcBarcode.get(tag));
-    }
-
-    @Test
-    public void testGetType() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createNfcBarcode();
-
-        assertEquals(1, nfcBarcode.getType());
-    }
-
-    @Test
-    public void testGetBarcode_kovio() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createNfcBarcode();
-
-        assertEquals(ID, nfcBarcode.getBarcode());
-    }
-
-    @Test
-    public void testGetBarcode_unknown() throws RemoteException, IOException {
-        Bundle extras = new Bundle();
-        extras.putInt("barcodetype", 0);
-        Tag tag = new Tag(ID, new int[]{TagTechnology.NFC_BARCODE}, new Bundle[]{extras}, 0, 0L,
-                mNfcTagMock);
-        NfcBarcode nfcBarcode = NfcBarcode.get(tag);
-
-        assertEquals(null, nfcBarcode.getBarcode());
-    }
-
-    @Test
-    public void testGetTag() {
-        Bundle extras = new Bundle();
-        extras.putInt("barcodetype", 1);
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04}, new int[]{TagTechnology.NFC_BARCODE},
-                new Bundle[]{extras}, 0, 0L, mNfcTagMock);
-        NfcBarcode nfcBarcode = NfcBarcode.get(tag);
-
-        assertEquals(tag, nfcBarcode.getTag());
-    }
-
-    @Test
-    public void testIsConnected_isConnected() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createConnectedNfcBarcode();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(true, nfcBarcode.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_notConnected() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createNfcBarcode();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertEquals(false, nfcBarcode.isConnected());
-    }
-
-
-    @Test
-    public void testIsConnected_serviceDead() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createConnectedNfcBarcode();
-        when(mNfcTagMock.isPresent(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, nfcBarcode.isConnected());
-    }
-
-    @Test
-    public void testReconnect() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createConnectedNfcBarcode();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        nfcBarcode.reconnect();
-        verify(mNfcTagMock, times(1)).reconnect(anyInt());
-    }
-
-    @Test
-    public void testReconnect_notConnected() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createNfcBarcode();
-
-        assertThrows(() -> nfcBarcode.reconnect());
-    }
-
-    @Test
-    public void testReconnect_failReconnect() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createConnectedNfcBarcode();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.ERROR_CONNECT);
-
-        assertThrows(() -> nfcBarcode.reconnect());
-    }
-
-    @Test
-    public void testReconnect_remoteException() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createConnectedNfcBarcode();
-        when(mNfcTagMock.reconnect(anyInt())).thenThrow(new RemoteException());
-
-        assertThrows(() -> nfcBarcode.reconnect());
-    }
-
-    @Test
-    public void testClose() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createConnectedNfcBarcode();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-        nfcBarcode.close();
-
-        assertEquals(false, nfcBarcode.isConnected());
-    }
-
-    private NfcBarcode createConnectedNfcBarcode() throws RemoteException, IOException {
-        NfcBarcode nfcBarcode = createNfcBarcode();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.connect(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        nfcBarcode.connect();
-
-        return nfcBarcode;
-    }
-
-    private NfcBarcode createNfcBarcode() {
-        Bundle extras = new Bundle();
-        extras.putInt("barcodetype", 1);
-        Tag tag = new Tag(ID, new int[]{TagTechnology.NFC_BARCODE}, new Bundle[]{extras}, 0, 0L,
-                mNfcTagMock);
-
-        return NfcBarcode.get(tag);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/NfcFTest.java b/tests/tests/nfc/src/android/nfc/tech/cts/NfcFTest.java
deleted file mode 100644
index 380bbb0..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/NfcFTest.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts;
-
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyBoolean;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertThrows;
-
-import android.nfc.ErrorCodes;
-import android.nfc.INfcTag;
-import android.nfc.Tag;
-import android.nfc.TransceiveResult;
-import android.nfc.tech.NfcF;
-import android.nfc.tech.TagTechnology;
-import android.os.Bundle;
-import android.os.RemoteException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.IOException;
-
-public class NfcFTest {
-
-    private static final byte[] SYSTEM_CODE = new byte[]{0xA};
-    private static final byte[] MANUFACTURER = new byte[]{0xB};
-    @Mock
-    private INfcTag mNfcTagMock;
-    @Captor
-    private ArgumentCaptor<byte[]> mTransceiveDataCaptor;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    @Test
-    public void testGet_isNfcF() {
-        NfcF nfcF = createNfcF();
-
-        assertTrue("Expected to not be <null>", nfcF != null);
-    }
-
-    @Test
-    public void testGet_tagNotNfcF() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_B}, new Bundle[]{}, 0, 0L,
-                null);
-        NfcF nfcF = NfcF.get(tag);
-
-        assertTrue("Expected: <null> ", nfcF == null);
-    }
-
-    @Test
-    public void testGetSystemCode() {
-        NfcF nfcF = createNfcF();
-
-        assertEquals(SYSTEM_CODE, nfcF.getSystemCode());
-    }
-
-    @Test
-    public void testGetManufacturer() {
-        NfcF nfcF = createNfcF();
-
-        assertEquals(MANUFACTURER, nfcF.getManufacturer());
-    }
-
-    @Test
-    public void testTransceive() throws RemoteException, IOException {
-        NfcF nfcF = createConnectedNfcF();
-
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0xF}));
-        byte[] transceivedBytes = new byte[]{0xA, 0xB, 0xC, 0xD};
-
-        assertArrayEquals(new byte[]{0xF}, nfcF.transceive(transceivedBytes));
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(transceivedBytes, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testGetMaxTransceiveLength() throws RemoteException, IOException {
-        NfcF nfcF = createNfcF();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.getMaxTransceiveLength(TagTechnology.NFC_F)).thenReturn(16);
-
-        assertEquals(16, nfcF.getMaxTransceiveLength());
-    }
-
-    @Test
-    public void testSetTimeout() throws RemoteException, IOException {
-        NfcF nfcF = createNfcF();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.setTimeout(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        nfcF.setTimeout(250);
-
-        ArgumentCaptor<Integer> timeout = ArgumentCaptor.forClass(Integer.class);
-        verify(mNfcTagMock, times(1)).setTimeout(anyInt(), timeout.capture());
-        assertTrue(250 == timeout.getValue());
-    }
-
-    @Test
-    public void testSetTimeout_invalidTimeout() throws RemoteException, IOException {
-        NfcF nfcF = createNfcF();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.setTimeout(anyInt(), anyInt())).thenReturn(ErrorCodes.ERROR_INVALID_PARAM);
-        assertThrows(() -> nfcF.setTimeout(-1));
-    }
-
-    @Test
-    public void testGetTimeout() throws RemoteException, IOException {
-        NfcF nfcF = createConnectedNfcF();
-
-        when(mNfcTagMock.getTimeout(anyInt())).thenReturn(250);
-        assertEquals(250, nfcF.getTimeout());
-    }
-
-    @Test
-    public void testGetTimeout_serviceDead() throws RemoteException, IOException {
-        NfcF nfcF = createConnectedNfcF();
-
-        when(mNfcTagMock.getTimeout(anyInt())).thenThrow(new RemoteException());
-        assertEquals(0, nfcF.getTimeout());
-    }
-
-    @Test
-    public void testGetTag() {
-        Bundle extras = new Bundle();
-        extras.putByteArray("systemcode", SYSTEM_CODE);
-        extras.putByteArray("pmm", MANUFACTURER);
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_F}, new Bundle[]{extras}, 0, 0L,
-                mNfcTagMock);
-
-        NfcF nfcF = NfcF.get(tag);
-
-        assertEquals(tag, nfcF.getTag());
-    }
-
-    @Test
-    public void testIsConnected_isConnected() throws RemoteException, IOException {
-        NfcF nfcF = createConnectedNfcF();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(true, nfcF.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_notConnected() throws RemoteException, IOException {
-        NfcF nfcF = createNfcF();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertEquals(false, nfcF.isConnected());
-    }
-
-
-    @Test
-    public void testIsConnected_serviceDead() throws RemoteException, IOException {
-        NfcF nfcF = createConnectedNfcF();
-        when(mNfcTagMock.isPresent(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, nfcF.isConnected());
-    }
-
-    @Test
-    public void testReconnect() throws RemoteException, IOException {
-        NfcF nfcF = createConnectedNfcF();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        nfcF.reconnect();
-        verify(mNfcTagMock, times(1)).reconnect(anyInt());
-    }
-
-    @Test
-    public void testReconnect_notConnected() throws RemoteException, IOException {
-        NfcF nfcF = createNfcF();
-
-        assertThrows(() -> nfcF.reconnect());
-    }
-
-    @Test
-    public void testReconnect_failReconnect() throws RemoteException, IOException {
-        NfcF nfcF = createConnectedNfcF();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.ERROR_CONNECT);
-
-        assertThrows(() -> nfcF.reconnect());
-    }
-
-    @Test
-    public void testReconnect_remoteException() throws RemoteException, IOException {
-        NfcF nfcF = createConnectedNfcF();
-        when(mNfcTagMock.reconnect(anyInt())).thenThrow(new RemoteException());
-
-        assertThrows(() -> nfcF.reconnect());
-    }
-
-    @Test
-    public void testClose() throws RemoteException, IOException {
-        NfcF nfcF = createConnectedNfcF();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-        nfcF.close();
-
-        assertEquals(false, nfcF.isConnected());
-    }
-
-    private NfcF createConnectedNfcF() throws RemoteException, IOException {
-        NfcF nfcF = createNfcF();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.connect(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        nfcF.connect();
-
-        return nfcF;
-    }
-
-    private NfcF createNfcF() {
-        Bundle extras = new Bundle();
-        extras.putByteArray("systemcode", SYSTEM_CODE);
-        extras.putByteArray("pmm", MANUFACTURER);
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_F}, new Bundle[]{extras}, 0, 0L,
-                mNfcTagMock);
-
-        return NfcF.get(tag);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/NfcVTest.java b/tests/tests/nfc/src/android/nfc/tech/cts/NfcVTest.java
deleted file mode 100644
index fb20201..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/NfcVTest.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * Copyright (C) 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts;
-
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.anyBoolean;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertThrows;
-
-import android.nfc.ErrorCodes;
-import android.nfc.INfcTag;
-import android.nfc.Tag;
-import android.nfc.TransceiveResult;
-import android.nfc.tech.NfcV;
-import android.nfc.tech.TagTechnology;
-import android.os.Bundle;
-import android.os.RemoteException;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-import org.mockito.Captor;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-import java.io.IOException;
-
-public class NfcVTest {
-
-    private static final byte RESPONSE_FLAGS = 0xA;
-    private static final byte DSF_ID = 0xB;
-
-    @Mock
-    private INfcTag mNfcTagMock;
-    @Captor
-    private ArgumentCaptor<byte[]> mTransceiveDataCaptor;
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-    }
-
-    @Test
-    public void testGet_isNfcV() {
-        NfcV nfcV = createNfcV();
-
-        assertTrue("Expected to not be <null>", nfcV != null);
-    }
-
-    @Test
-    public void testGet_tagNotNfcV() {
-        Tag tag = new Tag(new byte[]{}, new int[]{TagTechnology.NFC_B}, new Bundle[]{}, 0, 0L,
-                null);
-        NfcV nfcV = NfcV.get(tag);
-
-        assertTrue("Expected: <null> ", nfcV == null);
-    }
-
-    @Test
-    public void testGetResponseFlags() {
-        NfcV nfcV = createNfcV();
-
-        assertEquals(RESPONSE_FLAGS, nfcV.getResponseFlags());
-    }
-
-    @Test
-    public void testGetDsfId() {
-        NfcV nfcV = createNfcV();
-
-        assertEquals(DSF_ID, nfcV.getDsfId());
-    }
-
-    @Test
-    public void testTransceive() throws RemoteException, IOException {
-        NfcV nfcV = createConnectedNfcV();
-
-        when(mNfcTagMock.transceive(anyInt(), any(), anyBoolean())).thenReturn(
-                new TransceiveResult(TransceiveResult.RESULT_SUCCESS, new byte[]{0xF}));
-        byte[] transceivedBytes = new byte[]{0xA, 0xB, 0xC, 0xD};
-
-        assertArrayEquals(new byte[]{0xF}, nfcV.transceive(transceivedBytes));
-        verify(mNfcTagMock, times(1)).transceive(anyInt(), mTransceiveDataCaptor.capture(),
-                anyBoolean());
-        assertArrayEquals(transceivedBytes, mTransceiveDataCaptor.getValue());
-    }
-
-    @Test
-    public void testGetMaxTransceiveLength() throws RemoteException, IOException {
-        NfcV nfcV = createNfcV();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.getMaxTransceiveLength(TagTechnology.NFC_V)).thenReturn(16);
-
-        assertEquals(16, nfcV.getMaxTransceiveLength());
-    }
-
-    @Test
-    public void testGetTag() {
-        Bundle extras = new Bundle();
-        extras.putByte("respflag", RESPONSE_FLAGS);
-        extras.putByte("dsfid", DSF_ID);
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04},
-                new int[]{TagTechnology.NFC_V},
-                new Bundle[]{extras}, 0, 0L, mNfcTagMock);
-
-        NfcV nfcV = NfcV.get(tag);
-
-        assertEquals(tag, nfcV.getTag());
-    }
-
-    @Test
-    public void testIsConnected_isConnected() throws RemoteException, IOException {
-        NfcV nfcV = createConnectedNfcV();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-
-        assertEquals(true, nfcV.isConnected());
-    }
-
-    @Test
-    public void testIsConnected_notConnected() throws RemoteException, IOException {
-        NfcV nfcV = createNfcV();
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(false);
-
-        assertEquals(false, nfcV.isConnected());
-    }
-
-
-    @Test
-    public void testIsConnected_serviceDead() throws RemoteException, IOException {
-        NfcV nfcV = createConnectedNfcV();
-        when(mNfcTagMock.isPresent(anyInt())).thenThrow(new RemoteException());
-
-        assertEquals(false, nfcV.isConnected());
-    }
-
-    @Test
-    public void testReconnect() throws RemoteException, IOException {
-        NfcV nfcV = createConnectedNfcV();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-
-        nfcV.reconnect();
-        verify(mNfcTagMock, times(1)).reconnect(anyInt());
-    }
-
-    @Test
-    public void testReconnect_notConnected() throws RemoteException, IOException {
-        NfcV nfcV = createNfcV();
-
-        assertThrows(() -> nfcV.reconnect());
-    }
-
-    @Test
-    public void testReconnect_failReconnect() throws RemoteException, IOException {
-        NfcV nfcV = createConnectedNfcV();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.ERROR_CONNECT);
-
-        assertThrows(() -> nfcV.reconnect());
-    }
-
-    @Test
-    public void testReconnect_remoteException() throws RemoteException, IOException {
-        NfcV nfcV = createConnectedNfcV();
-        when(mNfcTagMock.reconnect(anyInt())).thenThrow(new RemoteException());
-
-        assertThrows(() -> nfcV.reconnect());
-    }
-
-    @Test
-    public void testClose() throws RemoteException, IOException {
-        NfcV nfcV = createConnectedNfcV();
-        when(mNfcTagMock.reconnect(anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        when(mNfcTagMock.isPresent(anyInt())).thenReturn(true);
-        nfcV.close();
-
-        assertEquals(false, nfcV.isConnected());
-    }
-
-    private NfcV createConnectedNfcV() throws RemoteException, IOException {
-        NfcV nfcV = createNfcV();
-
-        when(mNfcTagMock.isTagUpToDate(anyLong())).thenReturn(true);
-        when(mNfcTagMock.connect(anyInt(), anyInt())).thenReturn(ErrorCodes.SUCCESS);
-        nfcV.connect();
-
-        return nfcV;
-    }
-
-    private NfcV createNfcV() {
-        Bundle extras = new Bundle();
-        extras.putByte("respflags", RESPONSE_FLAGS);
-        extras.putByte("dsfid", DSF_ID);
-        Tag tag = new Tag(new byte[]{0x01, 0x02, 0x03, 0x04},
-                new int[]{TagTechnology.NFC_V},
-                new Bundle[]{extras}, 0, 0L, mNfcTagMock);
-
-        return NfcV.get(tag);
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/interactive/NdefTagTester.java b/tests/tests/nfc/src/android/nfc/tech/cts/interactive/NdefTagTester.java
deleted file mode 100644
index 81ca836..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/interactive/NdefTagTester.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts.interactive;
-
-import android.content.Context;
-import android.nfc.FormatException;
-import android.nfc.NdefMessage;
-import android.nfc.NdefRecord;
-import android.nfc.Tag;
-import android.nfc.cts.R;
-import android.nfc.tech.Ndef;
-import android.util.Log;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-import java.util.Random;
-
-/**
- * {@link TagTester} for NDEF tags. It writes a semi-random NDEF tag with a random id but
- * constant mime type and payload.
- */
-public class NdefTagTester implements TagTester {
-
-    private static final String TAG = NdefTagTester.class.getSimpleName();
-
-    private static final String MIME_TYPE = "application/com.android.nfc.cts.interactive";
-
-    private static final String PAYLOAD = "CTS Verifier NDEF Tag";
-
-    private final Context mContext;
-
-
-    public NdefTagTester(Context context) {
-        this.mContext = context;
-    }
-
-    @Override
-    public boolean isTestableTag(Tag tag) {
-        if (tag != null) {
-            for (String tech : tag.getTechList()) {
-                if (tech.equals(Ndef.class.getName())) {
-                    Ndef ndef = Ndef.get(tag);
-                    return ndef != null && ndef.isWritable();
-                }
-            }
-        }
-        return false;
-    }
-
-    @Override
-    public TagVerifier writeTag(Tag tag) throws IOException, FormatException {
-        Random random = new Random();
-        NdefRecord mimeRecord = createRandomMimeRecord(random);
-        NdefRecord[] expectedRecords = new NdefRecord[]{mimeRecord};
-
-        final NdefMessage expectedMessage = new NdefMessage(expectedRecords);
-        writeMessage(tag, expectedMessage);
-
-        final String expectedContent = mContext.getString(R.string.nfc_ndef_content,
-                NfcUtils.displayByteArray(mimeRecord.getId()), MIME_TYPE, PAYLOAD);
-
-        return new TagVerifier() {
-            @Override
-            public Result verifyTag(Tag tag) throws IOException, FormatException {
-                String actualContent;
-                NdefMessage message = readMessage(tag);
-                NdefRecord[] records = message.getRecords();
-
-                if (records.length > 0) {
-                    NdefRecord record = records[0];
-                    actualContent = mContext.getString(R.string.nfc_ndef_content,
-                            NfcUtils.displayByteArray(record.getId()),
-                            new String(record.getType(), StandardCharsets.US_ASCII),
-                            new String(record.getPayload(), StandardCharsets.US_ASCII));
-                } else {
-                    actualContent = null;
-                }
-
-                return new Result(expectedContent, actualContent,
-                        NfcUtils.areMessagesEqual(message, expectedMessage));
-            }
-        };
-    }
-
-    private NdefRecord createRandomMimeRecord(Random random) {
-        byte[] mimeBytes = MIME_TYPE.getBytes(StandardCharsets.US_ASCII);
-        byte[] id = new byte[4];
-        random.nextBytes(id);
-        byte[] payload = PAYLOAD.getBytes(StandardCharsets.US_ASCII);
-        return new NdefRecord(NdefRecord.TNF_MIME_MEDIA, mimeBytes, id, payload);
-    }
-
-    private void writeMessage(Tag tag, NdefMessage message) throws IOException, FormatException {
-        Ndef ndef = null;
-        try {
-            ndef = Ndef.get(tag);
-            ndef.connect();
-            ndef.writeNdefMessage(message);
-        } finally {
-            if (ndef != null) {
-                try {
-                    ndef.close();
-                } catch (IOException e) {
-                    Log.e(TAG, "IOException while closing NDEF...", e);
-                }
-            }
-        }
-    }
-
-    private NdefMessage readMessage(Tag tag) throws IOException, FormatException {
-        Ndef ndef = null;
-        try {
-            ndef = Ndef.get(tag);
-            if (ndef != null) {
-                ndef.connect();
-                return ndef.getNdefMessage();
-            }
-        } finally {
-            if (ndef != null) {
-                try {
-                    ndef.close();
-                } catch (IOException e) {
-                    Log.e(TAG, "Error closing Ndef...", e);
-                }
-            }
-        }
-        return null;
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/interactive/NfcUtils.java b/tests/tests/nfc/src/android/nfc/tech/cts/interactive/NfcUtils.java
deleted file mode 100644
index 3c0709c..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/interactive/NfcUtils.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts.interactive;
-
-import android.nfc.NdefMessage;
-import android.nfc.NdefRecord;
-
-import java.util.Arrays;
-
-/**
- * Class with utility methods for testing equality of messages and displaying byte payloads
- */
-public class NfcUtils {
-
-    /**
-     * Checks if contents of two NdefMessages are equal
-     * @param message - first message
-     * @param otherMessage - second message
-     * @return - if first message is equal to second message
-     */
-    public static boolean areMessagesEqual(NdefMessage message, NdefMessage otherMessage) {
-        return message != null && otherMessage != null
-                && areRecordArraysEqual(message.getRecords(), otherMessage.getRecords());
-    }
-
-    private static boolean areRecordArraysEqual(NdefRecord[] records, NdefRecord[] otherRecords) {
-        if (records.length == otherRecords.length) {
-            for (int i = 0; i < records.length; i++) {
-                if (!areRecordsEqual(records[i], otherRecords[i])) {
-                    return false;
-                }
-            }
-            return true;
-        } else {
-            return false;
-        }
-    }
-
-    private static boolean areRecordsEqual(NdefRecord record, NdefRecord otherRecord) {
-        return Arrays.equals(record.toByteArray(), otherRecord.toByteArray());
-    }
-
-    static CharSequence displayByteArray(byte[] bytes) {
-        StringBuilder builder = new StringBuilder().append("[");
-        for (int i = 0; i < bytes.length; i++) {
-            builder.append(Byte.toString(bytes[i]));
-            if (i + 1 < bytes.length) {
-                builder.append(", ");
-            }
-        }
-        return builder.append("]");
-    }
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/interactive/TagTester.java b/tests/tests/nfc/src/android/nfc/tech/cts/interactive/TagTester.java
deleted file mode 100644
index 0e0f441..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/interactive/TagTester.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts.interactive;
-
-import android.nfc.Tag;
-
-/** Tag tester that writes data to the tag and returns a way to confirm a successful write. */
-public interface TagTester {
-
-    /** @return true if the tag is testable by this {@link TagTester} */
-    boolean isTestableTag(Tag tag);
-
-    /** Writes some data to the tag and returns a {@link TagVerifier} to confirm it. */
-    TagVerifier writeTag(Tag tag) throws Exception;
-}
diff --git a/tests/tests/nfc/src/android/nfc/tech/cts/interactive/TagVerifier.java b/tests/tests/nfc/src/android/nfc/tech/cts/interactive/TagVerifier.java
deleted file mode 100644
index 6563abe..0000000
--- a/tests/tests/nfc/src/android/nfc/tech/cts/interactive/TagVerifier.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (C) 2024 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES 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.nfc.tech.cts.interactive;
-
-
-import android.nfc.FormatException;
-import android.nfc.Tag;
-
-import java.io.IOException;
-
-/** Tag verifier for checking that the {@link Tag} has some expected value. */
-public interface TagVerifier {
-
-    /** @return true if the tag has the expected value */
-    Result verifyTag(Tag tag) throws FormatException, IOException;
-
-    /** Class with info necessary to show the user what was written and read from a tag. */
-    class Result {
-
-        private final CharSequence mExpectedContent;
-
-        private final CharSequence mActualContent;
-
-        private final boolean mIsMatch;
-
-        public Result(CharSequence expectedContent, CharSequence actualContent, boolean isMatch) {
-            this.mExpectedContent = expectedContent;
-            this.mActualContent = actualContent;
-            this.mIsMatch = isMatch;
-        }
-
-        /** @return {@link CharSequence} representation of the data written to the tag */
-        public CharSequence getExpectedContent() {
-            return mExpectedContent;
-        }
-
-        /** @return {@link CharSequence} representation of the data read back from the tag */
-        public CharSequence getActualContent() {
-            return mActualContent;
-        }
-
-        /** @return whether or not the expected content matched the actual content of the tag */
-        public boolean isMatch() {
-            return mIsMatch;
-        }
-    }
-}
diff --git a/tests/tests/notification/src/android/app/notification/current/cts/SensitiveNotificationRedactionTest.kt b/tests/tests/notification/src/android/app/notification/current/cts/SensitiveNotificationRedactionTest.kt
index 4d996be..c4ffb32 100644
--- a/tests/tests/notification/src/android/app/notification/current/cts/SensitiveNotificationRedactionTest.kt
+++ b/tests/tests/notification/src/android/app/notification/current/cts/SensitiveNotificationRedactionTest.kt
@@ -31,6 +31,7 @@
 import android.app.NotificationManager
 import android.app.PendingIntent
 import android.app.Person
+import android.app.role.RoleManager
 import android.app.stubs.R
 import android.app.stubs.shared.NotificationHelper.SEARCH_TYPE
 import android.companion.CompanionDeviceManager
@@ -46,6 +47,7 @@
 import android.platform.test.annotations.RequiresFlagsDisabled
 import android.platform.test.annotations.RequiresFlagsEnabled
 import android.platform.test.flag.junit.DeviceFlagsValueProvider
+import android.provider.Telephony
 import android.service.notification.Adjustment
 import android.service.notification.Adjustment.KEY_IMPORTANCE
 import android.service.notification.Adjustment.KEY_RANKING_SCORE
@@ -54,14 +56,18 @@
 import android.service.notification.StatusBarNotification
 import androidx.test.runner.AndroidJUnit4
 import com.android.compatibility.common.util.CddTest
+import com.android.compatibility.common.util.SystemUtil.callWithShellPermissionIdentity
 import com.android.compatibility.common.util.SystemUtil.runShellCommand
 import com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity
 import com.android.compatibility.common.util.UserHelper
 import com.google.common.truth.Truth.assertWithMessage
+import java.util.concurrent.CountDownLatch
+import java.util.concurrent.Executors
 import org.junit.Assert
 import org.junit.Assert.assertEquals
 import org.junit.Assert.assertTrue
 import org.junit.Assume.assumeFalse
+import org.junit.Assume.assumeNotNull
 import org.junit.Before
 import org.junit.Rule
 import org.junit.Test
@@ -460,43 +466,62 @@
         waitForNotification(tag = "start")
 
         val shouldRedact = mutableListOf(
-            "123G5",
-            "123456F8",
-            "123Ä·4",
-            "123Ŀ4",
+            "your code is 123G5",
+            "your code is 123456F8",
+            "your code is 123Ä·4",
+            "your code is 123Ŀ4",
             "1-1-01 is the date of your code T3425",
             "your code 54-234-3 was sent on 1-1-01",
-            "34-58-30",
-            "12-1-3089",
-            "G-3d523",
-            "G-FD-745",
+            "your code is 34-58-30",
+            "your code is 12-1-3089",
+            "your code is G-3d523",
+            "your code is G-FD-745",
             "your code is:G-345821",
             "your code is (G-345821",
             "your code is \nG-345821",
             "you code is G-345821.",
-            "you code is (G-345821)",
-            "c'est g4zy75",
-            "2109",
-            "3035",
-            "1899")
+            "you code is (G-345821)")
         var notifNum = 0
         val notRedactedFailures = StringBuilder("")
-        for (otp in shouldRedact) {
-            val tag = "$groupKey #$notifNum"
-            sendNotification(text = otp, title = "", subtext = "", tag = tag)
-            val sbn = waitForNotification(tag = tag)
-            val text = sbn.notification.extras.getCharSequence(EXTRA_TEXT)!!.toString()
-            if (text.contains(otp)) {
-                notRedactedFailures.append("otp \"$otp\" is in notification text \"$text\"\n")
-            }
-            notifNum += 1
+        val existingSmsApp = callWithShellPermissionIdentity {
+            Telephony.Sms.getDefaultSmsPackage(mContext)
         }
+        assumeNotNull(existingSmsApp)
+        setSmsApp(mContext.packageName)
+        try {
+            // Newly enabled NAS can sometimes take a short while to start properly responding
+            for (i in 0..20) {
+                val basicOtp = "your one time code is 3434"
+                val tag = groupKey
+                sendNotification(text = basicOtp, title = "", subtext = "", tag = tag)
+                val sbn = waitForNotification(tag = tag)
+                val text = sbn.notification.extras.getCharSequence(EXTRA_TEXT)!!.toString()
+                if (!text.contains(basicOtp)) {
+                    // Detector is up and running
+                    break
+                }
+                Thread.sleep(100)
+            }
 
-        if (notRedactedFailures.toString() != "") {
-            Assert.fail(
-                "The following codes were not redacted, but should have been:" +
-                        "\n$notRedactedFailures"
-            )
+            for (otp in shouldRedact) {
+                val tag = "$groupKey #$notifNum"
+                sendNotification(text = otp, title = "", subtext = "", tag = tag)
+                val sbn = waitForNotification(tag = tag)
+                val text = sbn.notification.extras.getCharSequence(EXTRA_TEXT)!!.toString()
+                if (text.contains(otp)) {
+                    notRedactedFailures.append("otp \"$otp\" is in notification text \"$text\"\n")
+                }
+                notifNum += 1
+            }
+
+            if (notRedactedFailures.toString() != "") {
+                Assert.fail(
+                    "The following codes were not redacted, but should have been:" +
+                            "\n$notRedactedFailures"
+                )
+            }
+        } finally {
+            setSmsApp(existingSmsApp)
         }
     }
 
@@ -518,44 +543,82 @@
 
         val shouldNotRedact =
             mutableListOf(
-                "123G",
-                "123",
-                "12 345",
-                "123T56789",
-                "TEFHXES",
-                "01-01-2001",
-                "1-1-2001",
-                "1-1-01",
-                "6--7893",
-                "------",
+                "your code is 123G.",
+                "your code is 123",
+                "your code is 12 345",
+                "your code is 123T56789",
+                "your code is TEFHXES",
+                "your code is 01-01-2001",
+                "your code is 1-1-2001",
+                "your code is 1-1-01",
+                "your code is 6--7893",
+                "your code is ------",
                 "your code isG-345821",
                 "your code is G-345821for real",
-                "GVRXY 2",
-                "2009",
-                "1945",
+                "your code is GVRXY 2",
             )
         var notifNum = 0
         val redactedFailures = StringBuilder("")
-        for (notOtp in shouldNotRedact) {
-            val tag = "$groupKey #$notifNum"
-            sendNotification(text = notOtp, title = "", subtext = "", tag = tag)
-            val sbn = waitForNotification(tag = tag)
-            val text = sbn.notification.extras.getCharSequence(EXTRA_TEXT)!!.toString()
-            if (!text.contains(notOtp)) {
-                redactedFailures.append(
-                    "non-otp message \"$notOtp\" is not in notification text " +
-                        "\"$text\"\n"
+        val existingSmsApp = callWithShellPermissionIdentity {
+            Telephony.Sms.getDefaultSmsPackage(mContext)
+        }
+        assumeNotNull(existingSmsApp)
+        setSmsApp(mContext.packageName)
+        try {
+            // Newly enabled NAS can sometimes take a short while to start properly responding
+            for (i in 0..20) {
+                val basicOtp = "your one time code is 3434"
+                val tag = groupKey
+                sendNotification(text = basicOtp, title = "", subtext = "", tag = tag)
+                val sbn = waitForNotification(tag = tag)
+                val text = sbn.notification.extras.getCharSequence(EXTRA_TEXT)!!.toString()
+                if (!text.contains(basicOtp)) {
+                    // Detector is up and running
+                    break
+                }
+                Thread.sleep(100)
+            }
+
+            for (notOtp in shouldNotRedact) {
+                val tag = "$groupKey #$notifNum"
+                sendNotification(text = notOtp, title = "", subtext = "", tag = tag)
+                val sbn = waitForNotification(tag = tag)
+                val text = sbn.notification.extras.getCharSequence(EXTRA_TEXT)!!.toString()
+                if (!text.contains(notOtp)) {
+                    redactedFailures.append(
+                        "non-otp message \"$notOtp\" is not in notification text " +
+                                "\"$text\"\n"
+                    )
+                }
+                notifNum += 1
+            }
+
+            if (redactedFailures.toString() != "") {
+                Assert.fail(
+                    "The following codes were redacted, but should not have been:" +
+                            "\n$redactedFailures"
                 )
             }
-            notifNum += 1
+        } finally {
+            setSmsApp(existingSmsApp)
         }
+    }
 
-        if (redactedFailures.toString() != "") {
-            Assert.fail(
-                "The following codes were redacted, but should not have been:" +
-                        "\n$redactedFailures"
-            )
+    private fun setSmsApp(packageName: String) {
+        val latch = CountDownLatch(1)
+        runWithShellPermissionIdentity {
+            mRoleManager.addRoleHolderAsUser(
+                RoleManager.ROLE_SMS,
+                packageName,
+                0,
+                Process.myUserHandle(),
+                Executors.newSingleThreadExecutor()
+            ) { success ->
+                assertTrue("Failed to set sms role holder", success)
+                latch.countDown()
+            }
         }
+        latch.await()
     }
 
     private fun assertNotificationNotRedacted() {
diff --git a/tests/tests/os/AndroidManifest.xml b/tests/tests/os/AndroidManifest.xml
index 6fe9380..a5f52cc 100644
--- a/tests/tests/os/AndroidManifest.xml
+++ b/tests/tests/os/AndroidManifest.xml
@@ -202,4 +202,8 @@
          android:label="CTS tests of android.os">
     </instrumentation>
 
+    <queries>
+         <package android:name="com.android.modulemetadata" />
+         <package android:name="com.android.webview" />
+    </queries>
 </manifest>
diff --git a/tests/tests/os/OWNERS b/tests/tests/os/OWNERS
index 9c31e6c..830ec92 100644
--- a/tests/tests/os/OWNERS
+++ b/tests/tests/os/OWNERS
@@ -12,6 +12,8 @@
 per-file *WorkDurationTest* = file:/platform/frameworks/base:/ADPF_OWNERS
 per-file *HeadroomTest* = file:/platform/frameworks/base:/ADPF_OWNERS
 
+per-file *minijail* = file:/platform/external/minijail:/OWNERS
+
 # Bug component: 25692
 include platform/frameworks/base:/OWNERS
 include platform/frameworks/base:/core/java/android/os/OWNERS
diff --git a/tests/tests/os/assets/minijail/isolated-common-not-i386.policy b/tests/tests/os/assets/minijail/isolated-common-not-x86.policy
similarity index 90%
rename from tests/tests/os/assets/minijail/isolated-common-not-i386.policy
rename to tests/tests/os/assets/minijail/isolated-common-not-x86.policy
index a1c1753..f5b6b7d 100644
--- a/tests/tests/os/assets/minijail/isolated-common-not-i386.policy
+++ b/tests/tests/os/assets/minijail/isolated-common-not-x86.policy
@@ -1,8 +1,8 @@
 # Minijail Seccomp Policy for isolated_app processes on all architectures
-# except I386.
+# except x86.
 # This policy is appended to the architecture-specific policy.
 
-# These are system calls in their own right for everything but i386,
+# These are system calls in their own right for everything but x86,
 # which uses https://man7.org/linux/man-pages/man2/socketcall.2.html.
 accept4: return EPERM
 accept: return EPERM
@@ -22,7 +22,7 @@
 # socketpair: domain==AF_UNIX
 socketpair: arg0 == 1
 
-# Similarly, these are syscalls in their own right for everything but i386,
+# Similarly, these are syscalls in their own right for everything but x86,
 # which uses https://man7.org/linux/man-pages/man2/ipc.2.html.
 msgctl: return EPERM
 msgget: return EPERM
diff --git a/tests/tests/os/assets/minijail/isolated-i386.policy b/tests/tests/os/assets/minijail/isolated-x86.policy
similarity index 100%
rename from tests/tests/os/assets/minijail/isolated-i386.policy
rename to tests/tests/os/assets/minijail/isolated-x86.policy
diff --git a/tests/tests/os/src/android/os/cts/BinderIntegrationTest.java b/tests/tests/os/src/android/os/cts/BinderIntegrationTest.java
index df86981..10c34f4 100644
--- a/tests/tests/os/src/android/os/cts/BinderIntegrationTest.java
+++ b/tests/tests/os/src/android/os/cts/BinderIntegrationTest.java
@@ -16,8 +16,6 @@
 
 package android.os.cts;
 
-import static android.os.Flags.FLAG_BINDER_FROZEN_STATE_CHANGE_CALLBACK;
-
 import android.app.ActivityManager;
 import android.content.ComponentName;
 import android.content.Context;
@@ -31,19 +29,11 @@
 import android.os.RemoteException;
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.AppModeSdkSandbox;
-import android.platform.test.annotations.RequiresFlagsEnabled;
-
-import androidx.test.InstrumentationRegistry;
-import androidx.test.uiautomator.UiDevice;
 
 import com.android.compatibility.common.util.ApiTest;
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.Executor;
-import java.util.concurrent.LinkedBlockingQueue;
-import java.util.concurrent.TimeUnit;
 
 @AppModeSdkSandbox(reason = "Allow test in the SDK sandbox (does not prevent other modes).")
 public class BinderIntegrationTest extends ActivityTestsBase {
@@ -55,7 +45,6 @@
     private static final int STATE_REBIND = 4;
     private static final int STATE_UNBIND_ONLY = 5;
     private static final int DELAY_MSEC = 5000;
-    private static final int CALLBACK_WAIT_TIMEOUT_SECS = 5;
     private MockBinder mBinder;
     private Binder mStartReceiver;
     private int mStartState;
@@ -398,143 +387,6 @@
         assertEquals("Incorrect token received on binder death", token, mWhichBinderDied);
     }
 
-    /**
-     * Tests whether onFrozenStateChanged is called
-     */
-    @RequiresFlagsEnabled(FLAG_BINDER_FROZEN_STATE_CHANGE_CALLBACK)
-    @ApiTest(apis = {"android.os.IBinder#addFrozenStateChangeCallback"})
-    public void testOnFrozenStateChangedCalled() throws Exception {
-        if (!android.os.Flags.binderFrozenStateChangeCallback()) {
-            return;
-        }
-        final FrozenTestHelper helper = new FrozenTestHelper();
-        helper.setup();
-        ensureUnfrozenCallback(helper.mResults);
-        freezeProcess();
-        ensureFrozenCallback(helper.mResults);
-        unfreezeProcess();
-        ensureUnfrozenCallback(helper.mResults);
-    }
-
-    /**
-     * Tests that onFrozenStateChanged is not called after callback is removed
-     */
-    @RequiresFlagsEnabled(FLAG_BINDER_FROZEN_STATE_CHANGE_CALLBACK)
-    @ApiTest(apis = {
-        "android.os.IBinder#addFrozenStateChangeCallback",
-        "android.os.IBinder#removeFrozenStateChangeCallback"
-    })
-    public void testOnFrozenStateChangedNotCalledAfterCallbackRemoved() throws Exception {
-        if (!android.os.Flags.binderFrozenStateChangeCallback()) {
-            return;
-        }
-        final FrozenTestHelper helper = new FrozenTestHelper();
-        helper.setup();
-        ensureUnfrozenCallback(helper.mResults);
-        helper.removeCallback();
-        freezeProcess();
-        unfreezeProcess();
-        assertEquals("No more callbacks should be invoked.", 0, helper.mResults.size());
-    }
-
-    /**
-     * Tests that onFrozenStateChanged is not called after callback is removed
-     */
-    @RequiresFlagsEnabled(FLAG_BINDER_FROZEN_STATE_CHANGE_CALLBACK)
-    @ApiTest(apis = {
-        "android.os.IBinder#addFrozenStateChangeCallback",
-        "android.os.IBinder#removeFrozenStateChangeCallback"
-    })
-    public void testOnFrozenStateChangedUsingExecutor() throws Exception {
-        if (!android.os.Flags.binderFrozenStateChangeCallback()) {
-            return;
-        }
-        final FrozenTestHelper helper = new FrozenTestHelper();
-        CompletableFuture<Runnable> future = new CompletableFuture<>();
-        Executor capturingExecutor = r -> future.complete(r);
-        helper.setup(capturingExecutor);
-        Runnable capturedRunnable = future.get(CALLBACK_WAIT_TIMEOUT_SECS, TimeUnit.SECONDS);
-        helper.removeCallback();
-        assertNotNull(capturedRunnable);
-        assertEquals(0, helper.mResults.size());
-        capturedRunnable.run();
-        assertEquals(1, helper.mResults.size());
-    }
-
-    class FrozenTestHelper {
-        IBinder mBinder;
-        IBinder.FrozenStateChangeCallback mCallback;
-        IEmptyService mService;
-        public LinkedBlockingQueue<Boolean> mResults;
-
-        void setup() throws RemoteException {
-            setup(getContext().getMainExecutor());
-        }
-
-        void setup(Executor executor) throws RemoteException {
-            final ConditionVariable connected = new ConditionVariable();
-            mService = null;
-
-            ServiceConnection serviceConnection = new ServiceConnection() {
-                public void onServiceConnected(ComponentName className,
-                        IBinder binder) {
-                    mService = IEmptyService.Stub.asInterface(binder);
-                    connected.open();
-                }
-                public void onServiceDisconnected(ComponentName className) {
-                    mService = null;
-                }
-            };
-            // Connect to EmptyService in another process
-            final Intent remoteIntent = new Intent(IEmptyService.class.getName());
-            remoteIntent.setPackage(getContext().getPackageName());
-            getContext().bindService(remoteIntent, serviceConnection, Context.BIND_AUTO_CREATE);
-            if (!connected.block(DELAY_MSEC)) {
-                fail("Couldn't connect to EmptyService");
-            }
-            try {
-                mBinder = mService.getToken();
-            } catch (RemoteException re) {
-                fail("Couldn't get binder: " + re);
-            }
-            mResults = new LinkedBlockingQueue<>();
-            mCallback = (IBinder who, int state) ->
-                    mResults.offer(state == IBinder.FrozenStateChangeCallback.STATE_FROZEN);
-            mBinder.addFrozenStateChangeCallback(executor, mCallback);
-            if (mCallback == null) {
-                fail("Unable to add a callback");
-            }
-            getContext().unbindService(serviceConnection);
-        }
-
-        public void removeCallback() {
-            mBinder.removeFrozenStateChangeCallback(mCallback);
-        }
-    }
-
-    private void ensureFrozenCallback(LinkedBlockingQueue<Boolean> queue)
-            throws InterruptedException {
-        assertEquals(Boolean.TRUE, queue.poll(CALLBACK_WAIT_TIMEOUT_SECS, TimeUnit.SECONDS));
-    }
-
-    private void ensureUnfrozenCallback(LinkedBlockingQueue<Boolean> queue)
-            throws InterruptedException {
-        assertEquals(Boolean.FALSE, queue.poll(CALLBACK_WAIT_TIMEOUT_SECS, TimeUnit.SECONDS));
-    }
-
-    private String executeShellCommand(String cmd) throws Exception {
-        return UiDevice.getInstance(
-                InstrumentationRegistry.getInstrumentation()).executeShellCommand(cmd);
-    }
-
-    private void freezeProcess() throws Exception {
-        executeShellCommand("am freeze android.os.cts:remote");
-    }
-
-    private void unfreezeProcess() throws Exception {
-        executeShellCommand("am unfreeze android.os.cts:remote");
-    }
-
     private static class MockIInterface implements IInterface {
         public IBinder asBinder() {
             return new Binder();
diff --git a/tests/tests/os/src/android/os/cts/OWNERS b/tests/tests/os/src/android/os/cts/OWNERS
index 8f1f588..796e43a 100644
--- a/tests/tests/os/src/android/os/cts/OWNERS
+++ b/tests/tests/os/src/android/os/cts/OWNERS
@@ -3,3 +3,4 @@
 per-file IpcDataCache*.java = file:platform/frameworks/base:/PERFORMANCE_OWNERS
 per-file RemoteCallbackListTest.java = shayba@google.com
 per-file BinderFrozenTest.java = yutingtseng@google.com, shayba@google.com
+per-file SeccompTest.java = file:/platform/external/minijail:/OWNERS
diff --git a/tests/tests/os/src/android/os/cts/RemoteCallbackListTest.java b/tests/tests/os/src/android/os/cts/RemoteCallbackListTest.java
index 1307b7e..cb26e92 100644
--- a/tests/tests/os/src/android/os/cts/RemoteCallbackListTest.java
+++ b/tests/tests/os/src/android/os/cts/RemoteCallbackListTest.java
@@ -49,14 +49,16 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.concurrent.Executor;
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 @RunWith(AndroidJUnit4.class)
 @AppModeSdkSandbox(reason = "Allow test in the SDK sandbox (does not prevent other modes).")
 public class RemoteCallbackListTest {
     private static final String SERVICE_ACTION = "android.app.REMOTESERVICE";
-    private static final int CALLBACK_WAIT_TIMEOUT_SECS = 5;
+    private static final int CALLBACK_WAIT_TIMEOUT_SECS = 1;
 
     // Lock object
     private final Sync mSync = new Sync();
@@ -195,7 +197,7 @@
         // called when this flush() method returns.
         ConditionVariable cv = new ConditionVariable();
         rc.broadcast((service) -> cv.open());
-        assertTrue(cv.block(1000));  // wait for 1 second
+        assertTrue(cv.block(CALLBACK_WAIT_TIMEOUT_SECS * 1000));
     }
 
     private <T> void assertEmpty(LinkedBlockingQueue<T> queue) {
@@ -211,12 +213,29 @@
 
     @Test
     @RequiresFlagsEnabled(Flags.FLAG_BINDER_FROZEN_STATE_CHANGE_CALLBACK)
+    public void testGetExecutor() throws Exception {
+        Executor executor =
+                new Executor() {
+                    @Override
+                    public void execute(Runnable r) {}
+                };
+        RemoteCallbackList<IInterface> rc =
+                new RemoteCallbackList.Builder<IInterface>(
+                                RemoteCallbackList.FROZEN_CALLEE_POLICY_DROP)
+                        .setExecutor(executor)
+                        .build();
+        assertEquals(executor, rc.getExecutor());
+    }
+
+    @Test
+    @RequiresFlagsEnabled(Flags.FLAG_BINDER_FROZEN_STATE_CHANGE_CALLBACK)
     public void testDropCallbacksWhenFrozen() throws Exception {
         RemoteCallbackList<IInterface> rc = new RemoteCallbackList.Builder<IInterface>(
                 RemoteCallbackList.FROZEN_CALLEE_POLICY_DROP)
                 .setExecutor(Runnable::run).build();
         rc.register(mSecondaryService);
         freezeProcess();
+        waitUntilCallbackHalts(rc, CALLBACK_WAIT_TIMEOUT_SECS * 1000);
         rc.broadcast((service) -> fail("this should not have been invoked"));
         unfreezeProcess();
         flush(rc);
@@ -236,10 +255,12 @@
         invokedCallbacks.clear();
 
         freezeProcess();
+        waitUntilCallbackHalts(rc, CALLBACK_WAIT_TIMEOUT_SECS * 1000);
         rc.broadcast((service) -> invokedCallbacks.add(service));
         assertEmpty(invokedCallbacks);
 
         unfreezeProcess();
+        flush(rc);
         assertEquals(mSecondaryService,
                 invokedCallbacks.poll(CALLBACK_WAIT_TIMEOUT_SECS, TimeUnit.SECONDS));
         flushAndAssertEmpty(rc, invokedCallbacks);
@@ -254,12 +275,14 @@
                 .setExecutor(Runnable::run).build();
         rc.register(mSecondaryService);
         freezeProcess();
+        waitUntilCallbackHalts(rc, CALLBACK_WAIT_TIMEOUT_SECS * 1000);
         LinkedBlockingQueue<String> invocationRecords = new LinkedBlockingQueue<>();
         rc.broadcast((service) -> invocationRecords.add("first invocation"));
         rc.broadcast((service) -> invocationRecords.add("second invocation"));
         rc.broadcast((service) -> invocationRecords.add("last invocation"));
         assertEmpty(invocationRecords);
         unfreezeProcess();
+        flush(rc);
         assertEquals("last invocation",
                 invocationRecords.poll(CALLBACK_WAIT_TIMEOUT_SECS, TimeUnit.SECONDS));
         flushAndAssertEmpty(rc, invocationRecords);
@@ -273,6 +296,7 @@
                 RemoteCallbackList.FROZEN_CALLEE_POLICY_ENQUEUE_ALL).build();
         rc.register(mSecondaryService);
         freezeProcess();
+        waitUntilCallbackHalts(rc, CALLBACK_WAIT_TIMEOUT_SECS * 1000);
         LinkedBlockingQueue<IInterface> invokedCallbacks = new LinkedBlockingQueue<>();
         rc.broadcast((service) -> invokedCallbacks.add(service));
         assertEmpty(invokedCallbacks);
@@ -288,12 +312,14 @@
                 RemoteCallbackList.FROZEN_CALLEE_POLICY_ENQUEUE_ALL).setMaxQueueSize(3).build();
         rc.register(mSecondaryService);
         freezeProcess();
+        waitUntilCallbackHalts(rc, CALLBACK_WAIT_TIMEOUT_SECS * 1000);
         LinkedBlockingQueue<String> invocationRecords = new LinkedBlockingQueue<>();
         rc.broadcast((service) -> fail("this should not have been invoked"));
         rc.broadcast((service) -> invocationRecords.add("2nd invocation"));
         rc.broadcast((service) -> invocationRecords.add("3rd invocation"));
         rc.broadcast((service) -> invocationRecords.add("4th invocation"));
         unfreezeProcess();
+        flush(rc);
         assertEquals("2nd invocation",
                 invocationRecords.poll(CALLBACK_WAIT_TIMEOUT_SECS, TimeUnit.SECONDS));
         assertEquals("3rd invocation",
@@ -323,13 +349,53 @@
         assertEquals(service, invocationRecords.poll(CALLBACK_WAIT_TIMEOUT_SECS, TimeUnit.SECONDS));
     }
 
+    private <T extends IInterface> void waitUntilCallbackHalts(
+            RemoteCallbackList<T> rc, long timeoutMillis)
+            throws InterruptedException, TimeoutException {
+        long startTime = System.currentTimeMillis();
+        while (System.currentTimeMillis() - startTime < timeoutMillis) {
+            int[] i = new int[] {0};
+            rc.broadcast(
+                    (service) -> {
+                        i[0] = 1;
+                    });
+            if (i[0] == 0) {
+                return;
+            }
+            Thread.yield();
+        }
+        throw new TimeoutException("Timeout waiting for callbacks to halt");
+    }
+
     private void freezeProcess() throws Exception {
+        ConditionVariable cv = new ConditionVariable();
+        mSecondaryService
+                .asBinder()
+                .addFrozenStateChangeCallback(
+                        Runnable::run,
+                        (who, state) -> {
+                            if (state == IBinder.FrozenStateChangeCallback.STATE_FROZEN) {
+                                cv.open();
+                            }
+                        });
         UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
                 .executeShellCommand("am freeze android.os.cts:remote");
+        assertTrue(cv.block(CALLBACK_WAIT_TIMEOUT_SECS * 1000));
     }
 
     private void unfreezeProcess() throws Exception {
+        ConditionVariable cv = new ConditionVariable();
+        mSecondaryService
+                .asBinder()
+                .addFrozenStateChangeCallback(
+                        Runnable::run,
+                        (who, state) -> {
+                            if (state == IBinder.FrozenStateChangeCallback.STATE_UNFROZEN) {
+                                cv.open();
+                            }
+                        });
         UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
                 .executeShellCommand("am unfreeze android.os.cts:remote");
+        assertTrue(cv.block(CALLBACK_WAIT_TIMEOUT_SECS * 1000));
     }
 }
diff --git a/tests/tests/os/src/android/os/cts/SeccompTest.java b/tests/tests/os/src/android/os/cts/SeccompTest.java
index 1fe1995..b8a17a7 100644
--- a/tests/tests/os/src/android/os/cts/SeccompTest.java
+++ b/tests/tests/os/src/android/os/cts/SeccompTest.java
@@ -394,7 +394,7 @@
             final AssetFileDescriptor[] policyFiles = {
                 assets.openFd("minijail/isolated-" + arch + ".policy"),
                 assets.openFd("minijail/isolated-common.policy"),
-                arch.equals("i386") ? null : assets.openFd("minijail/isolated-common-not-i386.policy"),
+                arch.equals("x86") ? null : assets.openFd("minijail/isolated-common-not-x86.policy"),
             };
 
             // Convert our PID to ASCII byte string.
diff --git a/tests/tests/os/src/android/os/cts/SecurityStateManagerTest.java b/tests/tests/os/src/android/os/cts/SecurityStateManagerTest.java
index 25098ae..bad34e7 100644
--- a/tests/tests/os/src/android/os/cts/SecurityStateManagerTest.java
+++ b/tests/tests/os/src/android/os/cts/SecurityStateManagerTest.java
@@ -28,6 +28,7 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.res.Resources;
+import android.os.Binder;
 import android.os.Build;
 import android.os.Bundle;
 import android.os.Flags;
@@ -38,9 +39,12 @@
 import android.platform.test.annotations.RequiresFlagsEnabled;
 import android.platform.test.flag.junit.CheckFlagsRule;
 import android.platform.test.flag.junit.DeviceFlagsValueProvider;
+import android.util.Log;
 import android.webkit.WebViewUpdateService;
 
-import androidx.test.platform.app.InstrumentationRegistry;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.permissions.PermissionContext;
+
 import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Before;
@@ -58,6 +62,7 @@
 @RequiresFlagsEnabled(Flags.FLAG_SECURITY_STATE_SERVICE)
 public class SecurityStateManagerTest {
 
+    private static final String TAG = "SecurityStateManagerTest";
     private Context mContext;
     private Resources mResources;
     private PackageManager mPackageManager;
@@ -69,8 +74,6 @@
 
     @Before
     public void setUp() {
-        InstrumentationRegistry.getInstrumentation().getUiAutomation()
-                .adoptShellPermissionIdentity(Manifest.permission.INTERACT_ACROSS_USERS_FULL);
         mContext = getApplicationContext();
         mResources = mContext.getResources();
         mPackageManager = mContext.getPackageManager();
@@ -79,29 +82,31 @@
 
     @Test
     public void testGetGlobalSecurityState() throws Exception {
-        Pattern pattern = Pattern.compile("(\\d+\\.\\d+\\.\\d+)(.*)");
-        Matcher matcher = pattern.matcher(VintfRuntimeInfo.getKernelVersion());
-        String kernelVersion = "";
-        if (matcher.matches()) {
-            kernelVersion = matcher.group(1);
-        }
-        String defaultModuleMetadata = mContext.getString(
-                mResources.getIdentifier("config_defaultModuleMetadataProvider",
-                        "string", "android"));
-        List<String> webViewPackages = Arrays.stream(WebViewUpdateService.getAllWebViewPackages())
-                .map(info -> info.packageName).toList();
-        List<String> securityStatePackages = Arrays.stream(mContext.getResources().getStringArray(
-                mResources.getIdentifier("config_securityStatePackages",
-                        "array", "android"))).toList();
-        Bundle bundle = mSecurityStateManager.getGlobalSecurityState();
+        try (PermissionContext permissionContext = TestApis.permissions().withPermission(Manifest.permission.INTERACT_ACROSS_USERS_FULL)) {
+            Pattern pattern = Pattern.compile("(\\d+\\.\\d+\\.\\d+)(.*)");
+            Matcher matcher = pattern.matcher(VintfRuntimeInfo.getKernelVersion());
+            String kernelVersion = "";
+            if (matcher.matches()) {
+                kernelVersion = matcher.group(1);
+            }
+            String defaultModuleMetadata = mContext.getString(
+                    mResources.getIdentifier("config_defaultModuleMetadataProvider",
+                            "string", "android"));
+            List<String> webViewPackages = Arrays.stream(WebViewUpdateService.getAllWebViewPackages())
+                    .map(info -> info.packageName).toList();
+            List<String> securityStatePackages = Arrays.stream(mContext.getResources().getStringArray(
+                    mResources.getIdentifier("config_securityStatePackages",
+                            "array", "android"))).toList();
+            Bundle bundle = mSecurityStateManager.getGlobalSecurityState();
 
-        assertEquals(bundle.getString(KEY_SYSTEM_SPL), Build.VERSION.SECURITY_PATCH);
-        assertEquals(bundle.getString(KEY_VENDOR_SPL),
-                SystemProperties.get("ro.vendor.build.security_patch", ""));
-        assertEquals(bundle.getString(KEY_KERNEL_VERSION), kernelVersion);
-        packageVersionNameCheck(bundle, defaultModuleMetadata);
-        webViewPackages.forEach(p -> packageVersionNameCheck(bundle, p));
-        securityStatePackages.forEach(p -> packageVersionNameCheck(bundle, p));
+            assertEquals(bundle.getString(KEY_SYSTEM_SPL), Build.VERSION.SECURITY_PATCH);
+            assertEquals(bundle.getString(KEY_VENDOR_SPL),
+                    SystemProperties.get("ro.vendor.build.security_patch", ""));
+            assertEquals(bundle.getString(KEY_KERNEL_VERSION), kernelVersion);
+            packageVersionNameCheck(bundle, defaultModuleMetadata);
+            webViewPackages.forEach(p -> packageVersionNameCheck(bundle, p));
+            securityStatePackages.forEach(p -> packageVersionNameCheck(bundle, p));
+        }
     }
 
     private void packageVersionNameCheck(Bundle bundle, String packageName) {
@@ -109,8 +114,8 @@
             try {
                 assertEquals(bundle.getString(packageName),
                         mPackageManager.getPackageInfo(packageName, 0 /* flags */).versionName);
-            } catch (PackageManager.NameNotFoundException ignored) {
-                assertEquals(bundle.getString(packageName), "");
+            } catch (PackageManager.NameNotFoundException e) {
+                Log.w(TAG, "Error getting package info for " + packageName + ": " + e);
             }
         }
     }
diff --git a/tests/tests/security/Android.bp b/tests/tests/security/Android.bp
index 343cd51..a8ac8e5 100644
--- a/tests/tests/security/Android.bp
+++ b/tests/tests/security/Android.bp
@@ -101,6 +101,7 @@
         ":CertBlocklistTestApp",
         ":UpdatedDynamicPermissionTestAttackerApp",
     ],
+    assets: [":all_apex_certs{.der}"],
 }
 
 android_test_helper_app {
diff --git a/tests/tests/security/AndroidTest.xml b/tests/tests/security/AndroidTest.xml
index 27d7233..a1e3bf8 100644
--- a/tests/tests/security/AndroidTest.xml
+++ b/tests/tests/security/AndroidTest.xml
@@ -20,6 +20,7 @@
     <!-- CtsDeviceInfo target API is 23; instant app requires target API >= 26. -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="secondary_user_on_secondary_display" />
     <option name="config-descriptor:metadata" key="parameter" value="run_on_sdk_sandbox" />
 
     <target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
@@ -37,8 +38,9 @@
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.CrashReporter" />
 
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
+        <option name="test-user-token" value="%TEST_USER%"/>
         <option name="run-command"
-            value="appops set android.security.cts REQUEST_INSTALL_PACKAGES allow" />
+            value="appops set --user %TEST_USER% android.security.cts REQUEST_INSTALL_PACKAGES allow" />
         <option name="teardown-command"
             value="appops reset android.security.cts" />
     </target_preparer>
diff --git a/tests/tests/security/src/android/security/cts/BasePermissionUiTest.kt b/tests/tests/security/src/android/security/cts/BasePermissionUiTest.kt
index 053339a..e7e03b5 100644
--- a/tests/tests/security/src/android/security/cts/BasePermissionUiTest.kt
+++ b/tests/tests/security/src/android/security/cts/BasePermissionUiTest.kt
@@ -37,6 +37,7 @@
 import androidx.test.rule.ActivityTestRule
 import com.android.compatibility.common.util.SystemUtil
 import com.android.compatibility.common.util.UiAutomatorUtils
+import com.android.compatibility.common.util.UserHelper
 import com.android.modules.utils.build.SdkLevel
 import com.android.sts.common.util.StsExtraBusinessLogicTestCase
 import java.util.concurrent.CompletableFuture
@@ -53,11 +54,15 @@
     protected val packageManager = mContext.packageManager
     protected val uiAutomation: UiAutomation = mInstrumentation.uiAutomation
     protected val uiDevice: UiDevice = UiDevice.getInstance(mInstrumentation)
+    protected val uiDevice2: androidx.test.uiautomator.UiDevice =
+        androidx.test.uiautomator.UiDevice.getInstance(mInstrumentation)
 
     protected val isAutomotive = packageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)
     protected val isTv = packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)
     protected val isWatch = packageManager.hasSystemFeature(PackageManager.FEATURE_WATCH)
 
+    protected val userHelper = UserHelper(mInstrumentation.context)
+
     companion object {
         const val SPLIT_PERMISSION_APK_PATH =
             "/data/local/tmp/cts/security/SplitBluetoothPermissionTestApp.apk"
@@ -305,7 +310,17 @@
 
     protected fun clickPermissionRequestDenyButton() {
         if (isAutomotive || isWatch || isTv) {
-            click(By.text(getPermissionControllerString(DENY_BUTTON_TEXT)))
+            if (isAutomotive && userHelper.isVisibleBackgroundUser()) {
+                // Visible background users are background users that have access to UI on assigned
+                // displays on devices that have config_multiuserVisibleBackgroundUsers enabled.
+                // The main use case is the passenger in Automotive's multi display configuration.
+                // TODO(b/382327037): Avoid specifying the display ID for each UiSelector.
+                uiDevice2.findObject(androidx.test.uiautomator.By.text(
+                    getPermissionControllerString(DENY_BUTTON_TEXT))
+                        .displayId(userHelper.mainDisplayId))!!.click()
+            } else {
+                click(By.text(getPermissionControllerString(DENY_BUTTON_TEXT)))
+            }
         } else {
             click(By.res(DENY_BUTTON))
         }
@@ -313,7 +328,14 @@
 
     protected fun clickPermissionRequestAllowButton(timeoutMillis: Long = 20000) {
         if (isAutomotive) {
-            click(By.text(getPermissionControllerString(ALLOW_BUTTON_TEXT)), timeoutMillis)
+            if (userHelper.isVisibleBackgroundUser()) {
+                // TODO(b/382327037): Avoid specifying the display ID for each UiSelector.
+                uiDevice2.findObject(androidx.test.uiautomator.By.text(
+                    getPermissionControllerString(ALLOW_BUTTON_TEXT))
+                        .displayId(userHelper.mainDisplayId))!!.click()
+            } else {
+                click(By.text(getPermissionControllerString(ALLOW_BUTTON_TEXT)), timeoutMillis)
+            }
         } else {
             click(By.res(ALLOW_BUTTON), timeoutMillis)
         }
diff --git a/tests/tests/security/src/android/security/cts/FlagSlipperyTest.kt b/tests/tests/security/src/android/security/cts/FlagSlipperyTest.kt
index 0046d6d..16b5128 100644
--- a/tests/tests/security/src/android/security/cts/FlagSlipperyTest.kt
+++ b/tests/tests/security/src/android/security/cts/FlagSlipperyTest.kt
@@ -16,11 +16,13 @@
 
 package android.security.cts
 
+import android.app.Activity
 import android.app.ActivityOptions
 import android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN
 import android.graphics.Rect
 import android.os.SystemClock
 import android.platform.test.annotations.AsbSecurityTest
+import android.view.Display
 import android.view.Gravity
 import android.view.InputDevice
 import android.view.MotionEvent
@@ -80,6 +82,14 @@
     override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {}
 }
 
+private fun <T : Activity> getDisplay(scenario: ActivityScenario<T>): Display {
+    var display: Display? = null
+    scenario.onActivity {
+        display = it.display
+    }
+    return display!!
+}
+
 @MediumTest
 @RunWith(AndroidJUnit4::class)
 /**
@@ -139,8 +149,8 @@
     @Before
     fun setup() {
         scenario = rule.getScenario()
-        windowManager = getInstrumentation().getTargetContext().getSystemService<WindowManager>(
-                WindowManager::class.java)!!
+        val display = getDisplay(scenario)
+        val displayContext = getInstrumentation().getTargetContext().createDisplayContext(display)
         setDimensionsToQuarterScreen()
 
         waitForWindowFocusOnBottomActivity()
diff --git a/tests/tests/security/src/android/security/cts/MotionEventTest.java b/tests/tests/security/src/android/security/cts/MotionEventTest.java
index 670d232..d8f25b5 100644
--- a/tests/tests/security/src/android/security/cts/MotionEventTest.java
+++ b/tests/tests/security/src/android/security/cts/MotionEventTest.java
@@ -39,6 +39,7 @@
 import androidx.test.platform.app.InstrumentationRegistry;
 import androidx.test.rule.ActivityTestRule;
 
+import com.android.compatibility.common.util.UserHelper;
 import com.android.compatibility.common.util.WidgetTestUtils;
 import com.android.compatibility.common.util.WindowUtil;
 
@@ -61,6 +62,7 @@
     private static final String TAG = "MotionEventTest";
     private Activity mActivity;
     private Instrumentation mInstrumentation;
+    private UserHelper mUserHelper;
 
     @Rule
     public ActivityTestRule<MotionEventTestActivity> mActivityRule =
@@ -71,6 +73,7 @@
         mInstrumentation = InstrumentationRegistry.getInstrumentation();
         mActivity = mActivityRule.getActivity();
         WindowUtil.waitForFocus(mActivity);
+        mUserHelper = new UserHelper();
     }
 
     /**
@@ -197,6 +200,7 @@
         final UiAutomation automation = mInstrumentation.getUiAutomation();
         final long eventTime = SystemClock.uptimeMillis();
         MotionEvent event = MotionEvent.obtain(downTime, eventTime, action, x, y, 0);
+        event.setDisplayId(mUserHelper.getMainDisplayId());
         event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
         automation.injectInputEvent(event, true);
         event.recycle();
diff --git a/tests/tests/security/src/android/security/cts/PackageSignatureTest.java b/tests/tests/security/src/android/security/cts/PackageSignatureTest.java
index ca043ef..4d930ac 100644
--- a/tests/tests/security/src/android/security/cts/PackageSignatureTest.java
+++ b/tests/tests/security/src/android/security/cts/PackageSignatureTest.java
@@ -20,6 +20,7 @@
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
 import android.content.pm.Signature;
+import android.content.res.AssetManager;
 import android.content.res.Resources.NotFoundException;
 import android.platform.test.annotations.RestrictedBuildTest;
 import android.test.AndroidTestCase;
@@ -27,6 +28,7 @@
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -185,6 +187,17 @@
         wellKnownSignatures.add(getSignature(R.raw.sig_test_cert_4));
         wellKnownSignatures.add(getSignature(R.raw.sig_testcert));
         wellKnownSignatures.add(getSignature(R.raw.sig_unit_test));
+
+        // Get additional certs from assets directory.
+        // This contains certs of all the apexes in the tree in which this CTS apk was built.
+        AssetManager assetManager = getContext().getAssets();
+        for (String file : assetManager.list("")) {
+            Signature sig = getSignatureFromAssetFile(assetManager, file);
+            if (sig != null) {
+                wellKnownSignatures.add(sig);
+            }
+        }
+
         return wellKnownSignatures;
     }
 
@@ -270,6 +283,15 @@
         }
     }
 
+    private Signature getSignatureFromAssetFile(AssetManager assetManager, String fileName)
+            throws NotFoundException, IOException {
+        try (InputStream input = assetManager.open(fileName); ) {
+            return new Signature(input.readAllBytes());
+        } catch (FileNotFoundException e) {
+            return null;
+        }
+    }
+
     /**
      * Writes a package's signature to a file on the device's external storage.
      * This method was used to generate the well known signatures used by
diff --git a/tests/tests/settings/OWNERS b/tests/tests/settings/OWNERS
index 5070d62..c7eddf37 100644
--- a/tests/tests/settings/OWNERS
+++ b/tests/tests/settings/OWNERS
@@ -1,6 +1,3 @@
 # Bug component: 27091
 # Bug component: 812130 = per-file AutoPrivacySettingsTest.java
-cechkahn@google.com
-chiujason@google.com
-edgarwang@google.com
-sunnyshao@google.com
\ No newline at end of file
+include platform/packages/apps/Settings:/OWNERS
\ No newline at end of file
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
index a37a8b4..ce15a84 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
@@ -73,6 +73,8 @@
             new ShortCodeTest("ae", "6211", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("ae", "6253", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("ae", "6568", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("ae", "999", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("ae", "998", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
 
             new ShortCodeTest("am", "112", expectedReturnCode("112")),
             new ShortCodeTest("am", "101", SMS_CATEGORY_FREE_SHORT_CODE),
@@ -141,6 +143,9 @@
             new ShortCodeTest("bg", "1916", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("bg", "1935", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("bg", "18423", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("bg", "162055", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("bg", "162054", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("bg", "1620551", SMS_CATEGORY_NOT_SHORT_CODE),
 
             new ShortCodeTest("br", "265262", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("br", "2654", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -169,6 +174,10 @@
             new ShortCodeTest("ca", "88188", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("ca", "24470", SMS_CATEGORY_FREE_SHORT_CODE),
 
+            new ShortCodeTest("cd", "444123", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("cd", "444124", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("cd", "4441234", SMS_CATEGORY_NOT_SHORT_CODE),
+
             new ShortCodeTest("ch", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("ch", "123", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("ch", "234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -179,6 +188,10 @@
             new ShortCodeTest("ch", "234567", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("ch", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("cl", "484857", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("cl", "4849", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("cl", "4848", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("cn", "120", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("cn", "1062503000", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("cn", "1065123456", SMS_CATEGORY_FREE_SHORT_CODE),
@@ -187,6 +200,7 @@
             new ShortCodeTest("co", "4912891", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("co", "491272", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("co", "491289", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("co", "890119", SMS_CATEGORY_FREE_SHORT_CODE),
 
             new ShortCodeTest("cr", "4664537", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("cr", "466458", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -221,6 +235,7 @@
             new ShortCodeTest("de", "55655", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("de", "66766", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("de", "66777", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("de", "70997", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("de", "77677", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("de", "80888", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("de", "1232286", SMS_CATEGORY_PREMIUM_SHORT_CODE),
@@ -237,6 +252,10 @@
             new ShortCodeTest("do", "912892", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("do", "912", SMS_CATEGORY_FREE_SHORT_CODE),
 
+            new ShortCodeTest("dz", "63071", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("dz", "63073", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("dz", "630711", SMS_CATEGORY_NOT_SHORT_CODE),
+
             new ShortCodeTest("ec", "4664534", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("ec", "466499", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("ec", "466453", SMS_CATEGORY_FREE_SHORT_CODE),
@@ -255,7 +274,9 @@
 
             new ShortCodeTest("eg", "10020", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("eg", "10021", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
-            new ShortCodeTest("eg", "100211", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("eg", "100158", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("eg", "100023", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("eg", "1000214", SMS_CATEGORY_NOT_SHORT_CODE),
 
             new ShortCodeTest("es", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("es", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
@@ -264,6 +285,10 @@
             new ShortCodeTest("es", "995399", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("es", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("et", "8527", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("et", "8526",SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("et", "852612", SMS_CATEGORY_NOT_SHORT_CODE),
+
             new ShortCodeTest("fi", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("fi", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("fi", "12345", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -281,6 +306,7 @@
             new ShortCodeTest("fr", "81185", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("fr", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("fr", "33033", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("fr", "21727", SMS_CATEGORY_FREE_SHORT_CODE),
 
             new ShortCodeTest("gb", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("gb", "999", SMS_CATEGORY_NOT_SHORT_CODE),
@@ -366,7 +392,6 @@
             new ShortCodeTest("ir", "300086178", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("ir", "30008790",SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("ir", "700792", SMS_CATEGORY_FREE_SHORT_CODE),
-            new ShortCodeTest("ir", "700791", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("ir", "100016", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("ir", "30008360", SMS_CATEGORY_FREE_SHORT_CODE),
 
@@ -392,6 +417,11 @@
             new ShortCodeTest("jo", "990661", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("jo", "99006", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("jo", "99066", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("jo", "99390", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("jp", "00050320", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("jp", "00050329",SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("jp", "0000503291", SMS_CATEGORY_NOT_SHORT_CODE),
 
             new ShortCodeTest("kg", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("kg", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -423,6 +453,10 @@
             new ShortCodeTest("id", "99265", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("id", "77413", SMS_CATEGORY_FREE_SHORT_CODE),
 
+            new ShortCodeTest("ls", "320121", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ls", "32013", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ls", "32012", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("lt", "112", expectedReturnCode("112")),
             new ShortCodeTest("lt", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("lt", "123", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -452,6 +486,10 @@
             new ShortCodeTest("ma", "53899", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("ma", "53819", SMS_CATEGORY_FREE_SHORT_CODE),
 
+            new ShortCodeTest("ml", "36098", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("ml", "36099",SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ml", "360991", SMS_CATEGORY_NOT_SHORT_CODE),
+
             new ShortCodeTest("mn", "4444478", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("mn", "44445", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("mn", "44444", SMS_CATEGORY_FREE_SHORT_CODE),
@@ -475,6 +513,7 @@
             new ShortCodeTest("mw", "4279", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("mw", "4276", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("mw", "4305", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("mw", "4326", SMS_CATEGORY_FREE_SHORT_CODE),
 
             new ShortCodeTest("my", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("my", "1234", SMS_CATEGORY_NOT_SHORT_CODE),
@@ -623,16 +662,21 @@
             new ShortCodeTest("tj", "4449", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("tj", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
 
-            new ShortCodeTest("tn", "857992", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("tl", "46645", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("tl", "46646", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("tl", "466478", SMS_CATEGORY_NOT_SHORT_CODE),
+
             new ShortCodeTest("tn", "85765", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("tn", "85799", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("tn", "7720246", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("tn", "772023", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("tn", "772024", SMS_CATEGORY_FREE_SHORT_CODE),
 
             new ShortCodeTest("tz", "150467", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("tz", "15049", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("tz", "15046", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("tz", "152347", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("tz", "15239", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
-            new ShortCodeTest("tz", "15234", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("tz", "15324", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("tz", "15610", SMS_CATEGORY_FREE_SHORT_CODE),
 
@@ -645,7 +689,6 @@
 
             new ShortCodeTest("ug", "800999", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("ug", "8099", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
-            new ShortCodeTest("ug", "8000", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("ug", "8009", SMS_CATEGORY_FREE_SHORT_CODE),
 
             new ShortCodeTest("us", "911", SMS_CATEGORY_NOT_SHORT_CODE),
@@ -669,11 +712,12 @@
             new ShortCodeTest("uy", "191238", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("uy", "191289", SMS_CATEGORY_FREE_SHORT_CODE),
 
-            new ShortCodeTest("vn", "8079", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("vn", "90002", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("vn", "1189892", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("vn", "118998", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("vn", "118989", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("vn", "46645", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("vn", "46634", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
 
             new ShortCodeTest("ve", "5383526", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("ve", "538358", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
diff --git a/tests/tests/telephony/current/src/android/telephony/euicc/cts/EuiccManagerTest.java b/tests/tests/telephony/current/src/android/telephony/euicc/cts/EuiccManagerTest.java
index f82f98d..b6f0650 100644
--- a/tests/tests/telephony/current/src/android/telephony/euicc/cts/EuiccManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/euicc/cts/EuiccManagerTest.java
@@ -719,6 +719,8 @@
         assertThrows(SecurityException.class, () -> getContext().startActivity(testActionIntent));
     }
 
+    // Skip tests using the TestEuiccUiComponent on 25Q1 due to flag failures
+    @Ignore
     @Test
     public void testEuiccProvisionAction() {
         // Only test it when EuiccManager is enabled.
@@ -751,6 +753,8 @@
         assertEquals(ACTION_PROVISION_EMBEDDED_SUBSCRIPTION, mCallbackReceiver.getResultData());
     }
 
+    // Skip tests using the TestEuiccUiComponent on 25Q1 due to flag failures
+    @Ignore
     @Test
     public void testEuiccManageAction() {
         // Only test it when EuiccManager is enabled.
@@ -783,6 +787,8 @@
         assertEquals(ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS, mCallbackReceiver.getResultData());
     }
 
+    // Skip tests using the TestEuiccUiComponent on 25Q1 due to flag failures
+    @Ignore
     @Test
     public void testEuiccTransferAction() {
         // Only test it when EuiccManager is enabled.
@@ -815,6 +821,8 @@
         assertEquals(ACTION_TRANSFER_EMBEDDED_SUBSCRIPTIONS, mCallbackReceiver.getResultData());
     }
 
+    // Skip tests using the TestEuiccUiComponent on 25Q1 due to flag failures
+    @Ignore
     @Test
     public void testEuiccConvertAction() {
         // Only test it when EuiccManager is enabled.
diff --git a/tests/tests/util/src/android/util/cts/ArrayMapTest.java b/tests/tests/util/src/android/util/cts/ArrayMapTest.java
index bb0c8b5..9a5566b 100644
--- a/tests/tests/util/src/android/util/cts/ArrayMapTest.java
+++ b/tests/tests/util/src/android/util/cts/ArrayMapTest.java
@@ -483,7 +483,8 @@
     /**
      * Test creating a malformed array map with duplicated keys and that we will catch this
      * when unparcelling.
-     */
+     *
+     * TODO: remove use of private APIs, see b/384599385
     @Test
     public void testDuplicateKeys() throws NoSuchMethodException,
             InvocationTargetException, IllegalAccessException, NoSuchFieldException {
@@ -517,6 +518,7 @@
         dump(map1, map2);
         fail(msg);
     }
+    */
 
     private static void checkEntrySetToArray(ArrayMap<?, ?> testMap) {
         try {
diff --git a/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java b/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
index 81630ff..da6ae98 100644
--- a/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
+++ b/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
@@ -110,7 +110,7 @@
 public class VcnManagerTest extends VcnTestBase {
     private static final String TAG = VcnManagerTest.class.getSimpleName();
 
-    private static final int TIMEOUT_MS = 500;
+    private static final int CALLBACK_TIMEOUT_MS = 5000;
     private static final long SAFEMODE_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(35);
 
     private static final int ACTIVE_SUB_ID_TIMEOUT_SECONDS = 60;
@@ -263,7 +263,7 @@
         }
 
         public void awaitOnPolicyChanged() throws Exception {
-            mFutureOnPolicyChanged.get(TIMEOUT_MS, TimeUnit.MILLISECONDS);
+            mFutureOnPolicyChanged.get(CALLBACK_TIMEOUT_MS, TimeUnit.MILLISECONDS);
         }
     }
 
@@ -523,14 +523,16 @@
         }
 
         public int awaitOnStatusChanged() throws Exception {
-            final Integer status = mOnStatusChangedHistory.poll(TIMEOUT_MS, TimeUnit.MILLISECONDS);
+            final Integer status =
+                    mOnStatusChangedHistory.poll(CALLBACK_TIMEOUT_MS, TimeUnit.MILLISECONDS);
 
             // Null means timeout
             return status == null ? VCN_STATUS_CODE_AWAIT_TIMEOUT : status;
         }
 
         public GatewayConnectionError awaitOnGatewayConnectionError() throws Exception {
-            return mOnGatewayConnectionErrorHistory.poll(TIMEOUT_MS, TimeUnit.MILLISECONDS);
+            return mOnGatewayConnectionErrorHistory.poll(
+                    CALLBACK_TIMEOUT_MS, TimeUnit.MILLISECONDS);
         }
     }
 
diff --git a/tests/tests/virtualdevice/audio/src/android/virtualdevice/cts/audio/VirtualAudioPermissionTest.java b/tests/tests/virtualdevice/audio/src/android/virtualdevice/cts/audio/VirtualAudioPermissionTest.java
index 6f0d72c..3fc5f96 100644
--- a/tests/tests/virtualdevice/audio/src/android/virtualdevice/cts/audio/VirtualAudioPermissionTest.java
+++ b/tests/tests/virtualdevice/audio/src/android/virtualdevice/cts/audio/VirtualAudioPermissionTest.java
@@ -47,6 +47,7 @@
 import android.media.audiopolicy.AudioMix;
 import android.media.audiopolicy.AudioMixingRule;
 import android.media.audiopolicy.AudioPolicy;
+import android.os.SystemClock;
 import android.os.UserHandle;
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.RequiresFlagsEnabled;
@@ -76,6 +77,7 @@
 @AppModeFull(reason = "VirtualDeviceManager cannot be accessed by instant apps")
 public class VirtualAudioPermissionTest {
 
+    private static final int AUDIO_PERMISSIONS_PROPAGATION_TIME_MS = 80;
 
     @Rule
     public VirtualDeviceRule mVirtualDeviceRule = VirtualDeviceRule.withAdditionalPermissions(
@@ -201,6 +203,10 @@
         PermissionActivity permissionActivity = launchPermissionActivity(Display.DEFAULT_DISPLAY);
         setupAudioPolicy(permissionActivity.getAttributionSource().getUid());
 
+        // TODO: b/383048413 - use PermissionUpdateBarrierRule
+        // Account for the intentional delay until the audio permissions are propagated
+        SystemClock.sleep(AUDIO_PERMISSIONS_PROPAGATION_TIME_MS);
+
         assertThat(permissionActivity.checkSelfPermission(RECORD_AUDIO))
                 .isEqualTo(PackageManager.PERMISSION_GRANTED);
         permissionActivity = launchPermissionActivity(mVirtualDisplayId);
diff --git a/tests/tests/virtualdevice/audio/src/android/virtualdevice/cts/audio/VirtualAudioTest.java b/tests/tests/virtualdevice/audio/src/android/virtualdevice/cts/audio/VirtualAudioTest.java
index aefa2ea..f86b402 100644
--- a/tests/tests/virtualdevice/audio/src/android/virtualdevice/cts/audio/VirtualAudioTest.java
+++ b/tests/tests/virtualdevice/audio/src/android/virtualdevice/cts/audio/VirtualAudioTest.java
@@ -58,6 +58,7 @@
 import android.media.audiopolicy.AudioMix;
 import android.media.audiopolicy.AudioMixingRule;
 import android.media.audiopolicy.AudioPolicy;
+import android.os.SystemClock;
 import android.os.UserHandle;
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.RequiresFlagsDisabled;
@@ -89,6 +90,7 @@
     public static final int FREQUENCY = 264;
     public static final int SAMPLE_RATE = 44100;
     private static final Duration TIMEOUT = Duration.ofMillis(5000);
+    private static final int AUDIO_PERMISSIONS_PROPAGATION_TIME_MS = 80;
 
     private static final AudioFormat CAPTURE_FORMAT = new AudioFormat.Builder()
             .setSampleRate(SAMPLE_RATE)
@@ -128,6 +130,10 @@
         mVirtualAudioDevice = mVirtualDevice.createVirtualAudioDevice(
                 mVirtualDisplay, Runnable::run, mAudioConfigurationChangeCallback);
         grantRecordAudioPermission(mVirtualDevice.getDeviceId());
+
+        // TODO: b/383048413 - use PermissionUpdateBarrierRule
+        // Account for the intentional delay until the audio permissions are propagated
+        SystemClock.sleep(AUDIO_PERMISSIONS_PROPAGATION_TIME_MS);
     }
 
 
diff --git a/tests/tests/widget/res/layout/listview_layout.xml b/tests/tests/widget/res/layout/listview_layout.xml
index e7ec8a3..4bfb788 100644
--- a/tests/tests/widget/res/layout/listview_layout.xml
+++ b/tests/tests/widget/res/layout/listview_layout.xml
@@ -66,7 +66,8 @@
         <ListView
             android:id="@+id/listview_stretch"
             android:layout_width="90px"
-            android:layout_height="90px"/>
+            android:layout_height="90px"
+            android:layout_gravity="center"/>
 
     </FrameLayout>
 
diff --git a/tests/tests/widget/src/android/widget/cts/ListViewTest.java b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
index c8a12ba..efe13e4 100644
--- a/tests/tests/widget/src/android/widget/cts/ListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
@@ -1611,7 +1611,14 @@
             mListViewStretch.setDividerHeight(0);
         });
         // Give it an opportunity to finish layout.
-        mActivityRule.runOnUiThread(() -> {});
+        CountDownLatch latch = new CountDownLatch(1);
+        mActivityRule.runOnUiThread(() -> {
+            mListViewStretch.getViewTreeObserver().addOnPreDrawListener(() -> {
+                latch.countDown();
+                return true;
+            });
+        });
+        assertTrue(latch.await(1, TimeUnit.SECONDS));
     }
 
     private static class StableArrayAdapter<T> extends ArrayAdapter<T> {
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
index bcff62f..aef8792 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
@@ -528,11 +528,6 @@
             mRemoteViews.setOnClickFillInIntent(i + 1, intents[i]);
         }
         applyNightModeThenApplyAndTest(false /* nightMode */, () -> {});
-        verifyBitmap(width, height, (bitmap) -> verifyColorsOnFourCorners(Color.WHITE, bitmap));
-
-        // Switch to night mode
-        applyNightModeThenReapplyAndTest(true /* nightMode */, () -> {});
-        verifyBitmap(width, height, (bitmap) -> verifyColorsOnFourCorners(Color.BLACK, bitmap));
 
         // Verify clicks
         mActivityRule.runOnUiThread(() -> {
diff --git a/tools/cts-api-coverage/src/com/android/cts/apimap/FileUtils.java b/tools/cts-api-coverage/src/com/android/cts/apimap/FileUtils.java
index db2f218..14c4930 100644
--- a/tools/cts-api-coverage/src/com/android/cts/apimap/FileUtils.java
+++ b/tools/cts-api-coverage/src/com/android/cts/apimap/FileUtils.java
@@ -42,14 +42,14 @@
         } else if (inputFile.endsWith(".apk")) {
             // Search for the corresponding jar file for the given apk file. This only works for apk
             // packages installed under out/soong/.intermediate. For example, if the apk file path
-            // is out/soong/.intermediate/.../Module/xxx/android_common/Module.apk, then search for
+            // is out/soong/.intermediate/.../Module/android_common/Module.apk, then search for
             // the jar file under
-            // out/soong/.intermediate/.../Module/xxx/android_common/withres(combines, javac)/.
+            // out/soong/.intermediate/.../Module/android_common/withres(combines, javac)/.
             String[] arrOsStr = inputFile.split("/");
-            if (arrOsStr.length < 4) {
+            if (arrOsStr.length < 3) {
                 return null;
             }
-            String moduleName = arrOsStr[arrOsStr.length - 4];
+            String moduleName = arrOsStr[arrOsStr.length - 3];
             // Search for the jar file under withres, combined and javac directories in order.
             for (String jarDir : JAR_DIRS) {
                 Path jarFile = Paths.get(String.format(
@@ -74,7 +74,7 @@
         List<String> lines = Files.readAllLines(filePath);
         List<Path> jarFiles = new ArrayList<>();
         for (String line : lines) {
-            for (String file : line.split(" ")) {
+            for (String file : line.split("\\s+")) {
                 Path jarFile = getJarFile(file);
                 if (jarFile == null) {
                     continue;
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
old mode 100755
new mode 100644
index e876ba4..b72ddb3
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -385,4 +385,10 @@
 
     <!-- b/382231688 -->
     <option name="compatibility:exclude-filter" value="CtsVirtualDevicesCameraCtsTestCases" />
+
+    <!-- b/381409777-->
+    <option name="compatibility:exclude-filter" value="CtsHealthConnectHostTestCases android.healthconnect.cts.dailyjob.DailyDeleteAccessLogTest#testAccessLogsAreDeleted" />
+
+    <!-- b/378989105 -->
+    <option name="compatibility:exclude-filter" value="CtsSliceTestCases" />
 </configuration>
diff --git a/tools/cts-tradefed/res/config/cts-mumd-passenger.xml b/tools/cts-tradefed/res/config/cts-mumd-passenger.xml
index 7cc4cbc..71046d2 100644
--- a/tools/cts-tradefed/res/config/cts-mumd-passenger.xml
+++ b/tools/cts-tradefed/res/config/cts-mumd-passenger.xml
@@ -202,10 +202,12 @@
     <option name="compatibility:include-filter" value="CtsNetSecPolicyUsesCleartextTrafficFalseTestCases" />
     <option name="compatibility:include-filter" value="CtsNetSecPolicyUsesCleartextTrafficTrueTestCases" />
     <option name="compatibility:include-filter" value="CtsNetSecPolicyUsesCleartextTrafficUnspecifiedTestCases" />
+    <option name="compatibility:include-filter" value="CtsNetTestCases" />
     <option name="compatibility:include-filter" value="CtsNetTestCasesInternetPermission" />
     <option name="compatibility:include-filter" value="CtsNetTestCasesLegacyApi22" />
     <option name="compatibility:include-filter" value="CtsNetTestCasesLegacyPermission22" />
     <option name="compatibility:include-filter" value="CtsNetTestCasesMaxTargetSdk33" />
+    <option name="compatibility:include-filter" value="CtsNetTestCasesUpdateStatsPermission" />
     <option name="compatibility:include-filter" value="CtsNfcTestCases" />
     <option name="compatibility:include-filter" value="CtsNNAPIJavaTestCases" />
     <option name="compatibility:include-filter" value="CtsNNAPITestCases" />
diff --git a/tools/cts-tradefed/res/config/cts-platinum-prod-normal.xml b/tools/cts-tradefed/res/config/cts-platinum-prod-normal.xml
index 0e0a6b4..727cff7 100644
--- a/tools/cts-tradefed/res/config/cts-platinum-prod-normal.xml
+++ b/tools/cts-tradefed/res/config/cts-platinum-prod-normal.xml
@@ -1907,19 +1907,6 @@
     <option name="compatibility:include-filter" value="CtsMediaAudioTestCases android.media.audio.cts.RingtoneTest#testPlaybackProperties"/>
     <option name="compatibility:include-filter" value="CtsMediaAudioTestCases android.media.audio.cts.RingtoneTest#testRingtone"/>
     <option name="compatibility:include-filter" value="CtsMediaAudioTestCases android.media.audio.cts.VolumeShaperTest#testPlayerFreezeDuringPauseStop"/>
-    <!-- CtsMediaBetterTogetherTestCases -->
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaActivityTest#testVolumeKey_whileSessionAlive"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaRouter2Test#testGetRoutes[PRIMARY_USER]"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaRouter2Test#testRoutingControllerSelectAndDeselectRoute"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaRouter2Test#testShowSystemOutputSwitcherReturnsTrue"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaRouter2Test#testVolumeHandlingWhenVolumeFixed"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionManagerTest#testSetOnVolumeKeyLongPressListener"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionTest#testCallbackOnMediaButtonEvent"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionTest#testSetMediaButtonBroadcastReceiver_broadcastReceiver"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionTest#testSetMediaButtonReceiver_broadcastReceiver"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionTest#testSetMediaButtonReceiver_service"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.SystemMediaRouter2Test#testRoutingControllerRelease"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.SystemMediaRouter2Test#testRoutingControllerSelectAndDeselectRoute"/>
     <!-- CtsMediaDecoderTestCases -->
     <option name="compatibility:include-filter" value="CtsMediaDecoderTestCases android.media.decoder.cts.DecodeOnlyTest#testNonTunneledTrickPlayAvc"/>
     <option name="compatibility:include-filter" value="CtsMediaDecoderTestCases android.media.decoder.cts.DecodeOnlyTest#testNonTunneledTrickPlayHevc"/>
@@ -2190,6 +2177,20 @@
     <!-- CtsMediaRecorderTestCases -->
     <option name="compatibility:include-filter" value="CtsMediaRecorderTestCases android.media.recorder.cts.MediaRecorderTest#testGetActiveMicrophones"/>
     <option name="compatibility:include-filter" value="CtsMediaRecorderTestCases android.media.recorder.cts.MediaRecorderTest#testRecorderMPEG2TS"/>
+    <!-- CtsMediaRouterTestCases -->
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.MediaRouter2Test#testGetRoutes[PRIMARY_USER]"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.MediaRouter2Test#testRoutingControllerSelectAndDeselectRoute"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.MediaRouter2Test#testShowSystemOutputSwitcherReturnsTrue"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.MediaRouter2Test#testVolumeHandlingWhenVolumeFixed"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.SystemMediaRouter2Test#testRoutingControllerRelease"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.SystemMediaRouter2Test#testRoutingControllerSelectAndDeselectRoute"/>
+    <!-- CtsMediaSessionTestCases -->
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaActivityTest#testVolumeKey_whileSessionAlive"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionManagerTest#testSetOnVolumeKeyLongPressListener"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionTest#testCallbackOnMediaButtonEvent"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionTest#testSetMediaButtonBroadcastReceiver_broadcastReceiver"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionTest#testSetMediaButtonReceiver_broadcastReceiver"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionTest#testSetMediaButtonReceiver_service"/>
     <!-- CtsMediaStressTestCases -->
     <option name="compatibility:include-filter" value="CtsMediaStressTestCases android.mediastress.cts.MediaRecorderStressTest#testStressCamera"/>
     <!-- CtsMediaV2TestCases -->
diff --git a/tools/cts-tradefed/res/config/cts-platinum-staging-normal.xml b/tools/cts-tradefed/res/config/cts-platinum-staging-normal.xml
index 5780801..1a6002f 100644
--- a/tools/cts-tradefed/res/config/cts-platinum-staging-normal.xml
+++ b/tools/cts-tradefed/res/config/cts-platinum-staging-normal.xml
@@ -2221,21 +2221,6 @@
     <option name="compatibility:include-filter" value="CtsMediaAudioTestCases android.media.audio.cts.RingtoneTest#testPlaybackProperties"/>
     <option name="compatibility:include-filter" value="CtsMediaAudioTestCases android.media.audio.cts.RingtoneTest#testRingtone"/>
     <option name="compatibility:include-filter" value="CtsMediaAudioTestCases android.media.audio.cts.VolumeShaperTest#testPlayerFreezeDuringPauseStop"/>
-    <!-- CtsMediaBetterTogetherTestCases -->
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaActivityTest#testVolumeKey_whileSessionAlive"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaRouter2Test#testGetRoutes[PRIMARY_USER]"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaRouter2Test#testGetRoutes[WORK_PROFILE]"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaRouter2Test#testRoutingControllerSelectAndDeselectRoute"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaRouter2Test#testShowSystemOutputSwitcherReturnsTrue"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaRouter2Test#testVolumeHandlingWhenVolumeFixed"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionManagerTest#testOnMediaKeyEventDispatchedListener"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionManagerTest#testSetOnVolumeKeyLongPressListener"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionTest#testCallbackOnMediaButtonEvent"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionTest#testSetMediaButtonBroadcastReceiver_broadcastReceiver"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionTest#testSetMediaButtonReceiver_broadcastReceiver"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.MediaSessionTest#testSetMediaButtonReceiver_service"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.SystemMediaRouter2Test#testRoutingControllerRelease"/>
-    <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases android.media.bettertogether.cts.SystemMediaRouter2Test#testRoutingControllerSelectAndDeselectRoute"/>
     <!-- CtsMediaCUJSmallTest -->
     <option name="compatibility:include-filter" value="CtsMediaCUJSmallTest android.media.cujsmalltest.cts.CtsMediaShortFormPlaybackTest#testVideoPlayback[2_Hevc_480p_5sec_OrientationTest]"/>
     <option name="compatibility:include-filter" value="CtsMediaCUJSmallTest android.media.cujsmalltest.cts.CtsMediaShortFormPlaybackTest#testVideoPlayback[4_Avc_360x640_5sec_OrientationTest]"/>
@@ -2525,6 +2510,22 @@
     <option name="compatibility:include-filter" value="CtsMediaRecorderTestCases android.media.recorder.cts.MediaRecorderTest#testGetSurfaceApi"/>
     <option name="compatibility:include-filter" value="CtsMediaRecorderTestCases android.media.recorder.cts.MediaRecorderTest#testRecorderMPEG2TS"/>
     <option name="compatibility:include-filter" value="CtsMediaRecorderTestCases android.media.recorder.cts.MediaRecorderTest#testRecorderVideo"/>
+    <!-- CtsMediaRouterTestCases -->
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.MediaRouter2Test#testGetRoutes[PRIMARY_USER]"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.MediaRouter2Test#testGetRoutes[WORK_PROFILE]"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.MediaRouter2Test#testRoutingControllerSelectAndDeselectRoute"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.MediaRouter2Test#testShowSystemOutputSwitcherReturnsTrue"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.MediaRouter2Test#testVolumeHandlingWhenVolumeFixed"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.SystemMediaRouter2Test#testRoutingControllerRelease"/>
+    <option name="compatibility:include-filter" value="CtsMediaRouterTestCases android.media.router.cts.SystemMediaRouter2Test#testRoutingControllerSelectAndDeselectRoute"/>
+    <!-- CtsMediaSessionTestCases -->
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaActivityTest#testVolumeKey_whileSessionAlive"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionManagerTest#testOnMediaKeyEventDispatchedListener"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionManagerTest#testSetOnVolumeKeyLongPressListener"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionTest#testCallbackOnMediaButtonEvent"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionTest#testSetMediaButtonBroadcastReceiver_broadcastReceiver"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionTest#testSetMediaButtonReceiver_broadcastReceiver"/>
+    <option name="compatibility:include-filter" value="CtsMediaSessionTestCases android.media.session.cts.MediaSessionTest#testSetMediaButtonReceiver_service"/>
     <!-- CtsMediaStressTestCases -->
     <option name="compatibility:include-filter" value="CtsMediaStressTestCases android.mediastress.cts.MediaRecorderStressTest#testStressCamera"/>
     <option name="compatibility:include-filter" value="CtsMediaStressTestCases android.mediastress.cts.Vp8R480x360ShortPlayerTest#testPlay07"/>
diff --git a/tools/cts-tradefed/res/config/cts-system-physical.xml b/tools/cts-tradefed/res/config/cts-system-physical.xml
index cb7ee05..59f6050 100644
--- a/tools/cts-tradefed/res/config/cts-system-physical.xml
+++ b/tools/cts-tradefed/res/config/cts-system-physical.xml
@@ -67,7 +67,8 @@
   <option name="compatibility:include-filter" value="CtsHardwareTestCases"/>
   <option name="compatibility:include-filter" value="CtsGpuToolsHostTestCases"/>
   <option name="compatibility:include-filter" value="CtsNativeMediaAAudioTestCases"/>
-  <option name="compatibility:include-filter" value="CtsMediaBetterTogetherTestCases"/>
+  <option name="compatibility:include-filter" value="CtsMediaRouterTestCases"/>
+  <option name="compatibility:include-filter" value="CtsMediaSessionTestCases"/>
   <option name="compatibility:include-filter" value="CtsSignedConfigHostTestCases"/>
   <option name="compatibility:include-filter" value="CtsEdiHostTestCases"/>
   <option name="compatibility:include-filter" value="CtsRenderscriptTestCases"/>
diff --git a/tools/cts-tradefed/res/config/cts-system-virtual.xml b/tools/cts-tradefed/res/config/cts-system-virtual.xml
index df360a9..e97b665 100644
--- a/tools/cts-tradefed/res/config/cts-system-virtual.xml
+++ b/tools/cts-tradefed/res/config/cts-system-virtual.xml
@@ -1212,6 +1212,15 @@
   <option name="compatibility:exclude-filter" value="CtsOsTestCases android.os.cts.PowerManagerTest#testPowerManager_setDynamicPowerSavings"/>
   <option name="compatibility:exclude-filter" value="CtsOsTestCases android.os.cts.PowerManagerTest#testPowerManager_batteryDischargePrediction"/>
   <option name="compatibility:exclude-filter" value="CtsUtilTestCases android.util.cts.ArrayMapTest#testDuplicateKeys"/>
+  <option name="compatibility:exclude-filter" value="CtsLocationPrivilegedTestCases android.location.cts.privileged.GnssAssistanceProviderBaseTest#testRequest"/>
+  <option name="compatibility:exclude-filter" value="CtsPermissionUiTestCases android.permissionui.cts.LocationAccuracyTest#testPermissionUpgradeFlow	"/>
+  <option name="compatibility:exclude-filter" value="CtsPermissionUiTestCases android.permissionui.cts.LocationAccuracyTest#testCoarseRequestAndGrant"/>
+  <option name="compatibility:exclude-filter" value="CtsInputMethodTestCases android.view.inputmethod.cts.ImeInsetsControllerTest#testChangeSizeWhileControlling	"/>
+  <option name="compatibility:exclude-filter" value="CtsPermissionUiTestCases android.permissionui.cts.PermissionRationalePermissionGrantDialogTest#requestLocationPerm_clicksPermissionRationale_startsPermissionRationaleActivity"/>
+  <option name="compatibility:exclude-filter" value="CtsWidgetTestCases android.widget.cts.RemoteViewsTest#testApplyWithDrawInstructions"/>
+  <option name="compatibility:exclude-filter" value="CtsAttributionSourceTestCases android.attributionsource.cts.RenouncedPermissionsTest#testCannotRequestRenouncePermissions"/>
+  <option name="compatibility:exclude-filter" value="CtsDevicePolicyTestCases android.devicepolicy.cts.PreferentialNetworkServiceTest#setPreferentialNetworkServiceEnabled_disableService_noIssueRequest[IncludeRunOnSystemDeviceOwnerUser]"/>
+  <option name="compatibility:exclude-filter" value="CtsInputMethodTestCases android.view.inputmethod.cts.ImeInsetsControllerTest#testChangeSizeWhileControlling"/>
   //Args with regular expressions
   <option name="compatibility:exclude-filter" value="CtsSecurityHostTestCases android.security.cts.SELinuxNeverallowRulesTest#testNeverallowRules.*"/>
   <option name="compatibility:module-arg" value="CtsDeqpTestCases:exclude-filter:dEQP-EGL.*" />
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
index 2cc5d29..d3a62f3 100644
--- 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
@@ -64,20 +64,21 @@
         EXCEPTION_LIST.add("android.systemui.cts");
         // TODO(b/331566031): Remove exception when the test owner
         // split the CTS and MCTS into different modules.
+        EXCEPTION_LIST.add("android.mediastress.cts");
         EXCEPTION_LIST.add("android.mediav2.cts");
-        EXCEPTION_LIST.add("android.media.bettertogether.cts");
         EXCEPTION_LIST.add("android.media.codec.cts");
         EXCEPTION_LIST.add("android.media.decoder.cts");
         EXCEPTION_LIST.add("android.media.drmframework.cts");
         EXCEPTION_LIST.add("android.media.encoder.cts");
         EXCEPTION_LIST.add("android.media.extractor.cts");
+        EXCEPTION_LIST.add("android.media.mediaparser.cts");
+        EXCEPTION_LIST.add("android.media.mediatranscoding.cts");
         EXCEPTION_LIST.add("android.media.misc.cts");
         EXCEPTION_LIST.add("android.media.muxer.cts");
         EXCEPTION_LIST.add("android.media.player.cts");
         EXCEPTION_LIST.add("android.media.recorder.cts");
-        EXCEPTION_LIST.add("android.media.mediaparser.cts");
-        EXCEPTION_LIST.add("android.mediastress.cts");
-        EXCEPTION_LIST.add("android.media.mediatranscoding.cts");
+        EXCEPTION_LIST.add("android.media.router.cts");
+        EXCEPTION_LIST.add("android.media.session.cts");
         EXCEPTION_LIST.add("android.view.textclassifier.cts");
         EXCEPTION_LIST.add("android.appsecurity.cts");
     }
diff --git a/tools/lint/checks/src/main/java/com/android/cts/lint/PackageNameDetector.kt b/tools/lint/checks/src/main/java/com/android/cts/lint/PackageNameDetector.kt
index 50dd150..7ac3487 100644
--- a/tools/lint/checks/src/main/java/com/android/cts/lint/PackageNameDetector.kt
+++ b/tools/lint/checks/src/main/java/com/android/cts/lint/PackageNameDetector.kt
@@ -34,8 +34,8 @@
 
     override fun visitElement(context: XmlContext, element: Element) {
         val packageNode = element.getAttributeNode("package")
-        val packageName = packageNode.value
-        if (!PACKAGE_NAME_REGEX.matches(packageName)) {
+        val packageName = packageNode?.value
+        if (packageName != null && !PACKAGE_NAME_REGEX.matches(packageName)) {
             val location = context.getValueLocation(packageNode)
             val incident =
                 Incident(context, ISSUE)
diff --git a/tools/lint/checks/src/test/java/com/android/cts/lint/PackageNameDetectorTest.kt b/tools/lint/checks/src/test/java/com/android/cts/lint/PackageNameDetectorTest.kt
index 599bfea..514583e 100644
--- a/tools/lint/checks/src/test/java/com/android/cts/lint/PackageNameDetectorTest.kt
+++ b/tools/lint/checks/src/test/java/com/android/cts/lint/PackageNameDetectorTest.kt
@@ -88,4 +88,22 @@
             .run()
             .expectClean()
     }
+
+    @Test
+    fun testPackageNameIsMissing() {
+        lint()
+            .files(
+                xml(
+                        "AndroidManifest.xml",
+                        """
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+</manifest>
+"""
+                    )
+                    .indented()
+            )
+            .allowMissingSdk()
+            .run()
+            .expectClean()
+    }
 }