Merge "Ignore failing HDMI CEC CTS test"
diff --git a/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java b/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java
index 596630b..86b80b5 100644
--- a/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java
+++ b/hostsidetests/angle/src/android/angle/cts/CtsAngleRulesFileTest.java
@@ -52,7 +52,7 @@
         byte[] rulesFileBytes =
                 ByteStreams.toByteArray(getClass().getResourceAsStream("/" + hostFilename));
 
-        Assert.assertTrue("Loaded empty rules file", rulesFileBytes.length > 0); // sanity check
+        Assert.assertTrue("Loaded empty rules file", rulesFileBytes.length > 0); // validity check
         mRulesFile = File.createTempFile("rulesFile", "tempRules.json");
         Files.write(rulesFileBytes, mRulesFile);
 
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTest.java
index 5c74172..8be8289 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/DocumentsTest.java
@@ -24,9 +24,9 @@
  */
 public class DocumentsTest extends DocumentsTestCase {
     private static final String PROVIDER_PKG = "com.android.cts.documentprovider";
-    private static final String DUMMYIME_PKG = "com.android.cts.dummyime";
+    private static final String STUBIME_PKG = "com.android.cts.stubime";
     private static final String PROVIDER_APK = "CtsDocumentProvider.apk";
-    private static final String DUMMYIME_APK = "CtsDummyIme.apk";
+    private static final String STUBIME_APK = "CtsStubIme.apk";
 
     @Override
     protected void setUp() throws Exception {
@@ -35,7 +35,7 @@
         getDevice().uninstallPackage(PROVIDER_PKG);
         CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(mCtsBuild);
         assertNull(getDevice().installPackage(buildHelper.getTestFile(PROVIDER_APK), false));
-        assertNull(getDevice().installPackage(buildHelper.getTestFile(DUMMYIME_APK), false));
+        assertNull(getDevice().installPackage(buildHelper.getTestFile(STUBIME_APK), false));
     }
 
     @Override
@@ -43,7 +43,7 @@
         super.tearDown();
 
         getDevice().uninstallPackage(PROVIDER_PKG);
-        getDevice().uninstallPackage(DUMMYIME_PKG);
+        getDevice().uninstallPackage(STUBIME_PKG);
     }
 
     public void testOpenSimple() throws Exception {
diff --git a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml
index 09bac4c..c756b4e 100644
--- a/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/EphemeralTestApp/UserAppTest/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <application
         android:label="@string/app_name" >
         <uses-library android:name="android.test.runner" />
-    <!-- Dummy activity just to allow this to load in another user -->
+    <!-- Stub activity just to allow this to load in another user -->
     <activity
         android:name=".DirectBoot"
         android:directBootAware="true" />
diff --git a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/AndroidManifest.xml
index ad1300f..9797cea 100644
--- a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/AndroidManifest.xml
@@ -20,7 +20,7 @@
     <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27" />
 
     <application android:useEmbeddedDex="true">
-        <activity android:name=".DummyActivity"/>
+        <activity android:name=".EmptyActivity"/>
     </application>
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/AndroidManifest_use_extracted_dex.xml b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/AndroidManifest_use_extracted_dex.xml
index 73c15a3..b324974 100644
--- a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/AndroidManifest_use_extracted_dex.xml
+++ b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/AndroidManifest_use_extracted_dex.xml
@@ -20,7 +20,7 @@
     <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27" />
 
     <application android:useEmbeddedDex="false">
-        <activity android:name=".DummyActivity"/>
+        <activity android:name=".EmptyActivity"/>
     </application>
 
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/feature_split/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/feature_split/AndroidManifest.xml
index 3ab0452..1987238 100644
--- a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/feature_split/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/feature_split/AndroidManifest.xml
@@ -20,6 +20,6 @@
     android:isFeatureSplit="true"
     split="feature_x">
     <application>
-        <activity android:name=".feature_x.DummyActivity"/>
+        <activity android:name=".feature_x.EmptyActivity"/>
     </application>
 </manifest>
diff --git a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/feature_split/src/com/android/cts/useembeddeddex/feature_x/DummyActivity.java b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/feature_split/src/com/android/cts/useembeddeddex/feature_x/EmptyActivity.java
similarity index 88%
rename from hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/feature_split/src/com/android/cts/useembeddeddex/feature_x/DummyActivity.java
rename to hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/feature_split/src/com/android/cts/useembeddeddex/feature_x/EmptyActivity.java
index 6cd8004..adcfc24 100644
--- a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/feature_split/src/com/android/cts/useembeddeddex/feature_x/DummyActivity.java
+++ b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/feature_split/src/com/android/cts/useembeddeddex/feature_x/EmptyActivity.java
@@ -18,5 +18,5 @@
 
 import android.app.Activity;
 
-/** Dummy class just to generate some dex */
-public class DummyActivity extends Activity {}
+/** Empty class just to generate some dex */
+public class EmptyActivity extends Activity {}
diff --git a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/src/com/android/cts/useembeddeddex/DummyActivity.java b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/src/com/android/cts/useembeddeddex/EmptyActivity.java
similarity index 88%
rename from hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/src/com/android/cts/useembeddeddex/DummyActivity.java
rename to hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/src/com/android/cts/useembeddeddex/EmptyActivity.java
index 974c541..c25f89a 100644
--- a/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/src/com/android/cts/useembeddeddex/DummyActivity.java
+++ b/hostsidetests/appsecurity/test-apps/UseEmbeddedDexApp/src/com/android/cts/useembeddeddex/EmptyActivity.java
@@ -18,5 +18,5 @@
 
 import android.app.Activity;
 
-/** Dummy class just to generate some dex */
-public class DummyActivity extends Activity {}
+/** Empty class just to generate some dex */
+public class EmptyActivity extends Activity {}
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
index ef90c8d..6e327f2 100755
--- a/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionApp23/src/com/android/cts/usepermission/BasePermissionsTest.java
@@ -402,7 +402,8 @@
         String s = mPermissionControllerResources.getString(mPermissionControllerResources
                 .getIdentifier(res, "string", "com.android.permissioncontroller"));
         waitForIdle();
-        getUiDevice().wait(Until.findObject(By.text(s)),
+        getUiDevice().wait(Until.findObject(By.text(
+                Pattern.compile(Pattern.quote(s), Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE))),
                 GLOBAL_TIMEOUT_MILLIS).click();
     }
 
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permDef/res/values/strings.xml b/hostsidetests/appsecurity/test-apps/keysets/permDef/res/values/strings.xml
index 4e5e870..c1282d2 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/permDef/res/values/strings.xml
+++ b/hostsidetests/appsecurity/test-apps/keysets/permDef/res/values/strings.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-<!-- Just need this dummy file to have something to build. -->
+<!-- Just need this stub file to have something to build. -->
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
   <string name="keysets_perm_desc">keysets_perm_description</string>
   <string name="keysets_perm_label">keysets_perm_label</string>
diff --git a/hostsidetests/appsecurity/test-apps/keysets/permUse/res/values/strings.xml b/hostsidetests/appsecurity/test-apps/keysets/permUse/res/values/strings.xml
index 4e5e870..c1282d2 100644
--- a/hostsidetests/appsecurity/test-apps/keysets/permUse/res/values/strings.xml
+++ b/hostsidetests/appsecurity/test-apps/keysets/permUse/res/values/strings.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 
-<!-- Just need this dummy file to have something to build. -->
+<!-- Just need this stub file to have something to build. -->
 <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
   <string name="keysets_perm_desc">keysets_perm_description</string>
   <string name="keysets_perm_label">keysets_perm_label</string>
diff --git a/hostsidetests/appsecurity/test-apps/dummyime/Android.bp b/hostsidetests/appsecurity/test-apps/stubime/Android.bp
similarity index 97%
rename from hostsidetests/appsecurity/test-apps/dummyime/Android.bp
rename to hostsidetests/appsecurity/test-apps/stubime/Android.bp
index bb1407f..55ceee6 100644
--- a/hostsidetests/appsecurity/test-apps/dummyime/Android.bp
+++ b/hostsidetests/appsecurity/test-apps/stubime/Android.bp
@@ -15,7 +15,7 @@
 //
 
 android_test_helper_app {
-    name: "CtsDummyIme",
+    name: "CtsStubIme",
     defaults: ["cts_support_defaults"],
     sdk_version: "test_current",
     srcs: ["src/**/*.java"],
diff --git a/hostsidetests/appsecurity/test-apps/dummyime/AndroidManifest.xml b/hostsidetests/appsecurity/test-apps/stubime/AndroidManifest.xml
similarity index 88%
rename from hostsidetests/appsecurity/test-apps/dummyime/AndroidManifest.xml
rename to hostsidetests/appsecurity/test-apps/stubime/AndroidManifest.xml
index ea88b38..22c442c 100644
--- a/hostsidetests/appsecurity/test-apps/dummyime/AndroidManifest.xml
+++ b/hostsidetests/appsecurity/test-apps/stubime/AndroidManifest.xml
@@ -17,9 +17,9 @@
 -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-        package="com.android.cts.dummyime">
-    <application android:label="Dummy IME">
-        <service android:name=".CtsDummyIme"
+        package="com.android.cts.stubime">
+    <application android:label="Stub IME">
+        <service android:name=".CtsStubIme"
                 android:permission="android.permission.BIND_INPUT_METHOD">
             <intent-filter>
                 <action android:name="android.view.InputMethod" />
diff --git a/hostsidetests/appsecurity/test-apps/dummyime/res/xml/method.xml b/hostsidetests/appsecurity/test-apps/stubime/res/xml/method.xml
similarity index 100%
rename from hostsidetests/appsecurity/test-apps/dummyime/res/xml/method.xml
rename to hostsidetests/appsecurity/test-apps/stubime/res/xml/method.xml
diff --git a/hostsidetests/appsecurity/test-apps/dummyime/src/com/android/cts/dummyime/CtsDummyIme.java b/hostsidetests/appsecurity/test-apps/stubime/src/com/android/cts/stubime/CtsStubIme.java
similarity index 85%
rename from hostsidetests/appsecurity/test-apps/dummyime/src/com/android/cts/dummyime/CtsDummyIme.java
rename to hostsidetests/appsecurity/test-apps/stubime/src/com/android/cts/stubime/CtsStubIme.java
index a3d3457..5b28d69 100644
--- a/hostsidetests/appsecurity/test-apps/dummyime/src/com/android/cts/dummyime/CtsDummyIme.java
+++ b/hostsidetests/appsecurity/test-apps/stubime/src/com/android/cts/stubime/CtsStubIme.java
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package com.android.cts.dummyime;
+package com.android.cts.stubime;
 
 import android.inputmethodservice.InputMethodService;
 
 /**
- * Dummy IME implementation that basically does nothing
+ * Stub IME implementation that basically does nothing
  */
-public class CtsDummyIme extends InputMethodService {
+public class CtsStubIme extends InputMethodService {
 
     @Override
     public boolean onEvaluateFullscreenMode() {
diff --git a/hostsidetests/compilation/src/android/compilation/cts/AdbRootDependentCompilationTest.java b/hostsidetests/compilation/src/android/compilation/cts/AdbRootDependentCompilationTest.java
index a28c7b4..f442d86 100644
--- a/hostsidetests/compilation/src/android/compilation/cts/AdbRootDependentCompilationTest.java
+++ b/hostsidetests/compilation/src/android/compilation/cts/AdbRootDependentCompilationTest.java
@@ -105,7 +105,7 @@
         // real profile.
         byte[] profileBytes = ByteStreams.toByteArray(
                 getClass().getResourceAsStream("/primary.prof.txt"));
-        assertTrue("empty profile", profileBytes.length > 0); // sanity check
+        assertTrue("empty profile", profileBytes.length > 0); // validity check
         textProfileFile = File.createTempFile("compilationtest", "prof.txt");
         Files.write(profileBytes, textProfileFile);
 
@@ -217,7 +217,7 @@
         executeCompile("-m", "speed-profile", "-f");
         String odexFilePath = getOdexFilePath();
         byte[] initialOdexFileContents = readFileOnClient(odexFilePath);
-        assertTrue("empty odex file", initialOdexFileContents.length > 0); // sanity check
+        assertTrue("empty odex file", initialOdexFileContents.length > 0); // validity check
 
         for (ProfileLocation profileLocation : profileLocations) {
             writeProfile(profileLocation);
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecSystemAudioModeTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecSystemAudioModeTest.java
index 0138a9a..ac21a0f 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecSystemAudioModeTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/audio/HdmiCecSystemAudioModeTest.java
@@ -226,14 +226,16 @@
     public void cect_11_2_15_1_SystemAudioModeRequestAsFollower() throws Exception {
         hdmiCecClient.sendCecMessage(LogicalAddress.TV, AUDIO_DEVICE,
                 CecOperand.SYSTEM_AUDIO_MODE_REQUEST,
-                CecMessage.formatParams(HdmiCecConstants.TV_PHYSICAL_ADDRESS));
+                CecMessage.formatParams(HdmiCecConstants.TV_PHYSICAL_ADDRESS,
+                    HdmiCecConstants.PHYSICAL_ADDRESS_LENGTH));
         String message = hdmiCecClient.checkExpectedOutput(CecOperand.SET_SYSTEM_AUDIO_MODE);
         assertThat(CecMessage.getParams(message)).isEqualTo(ON);
 
         /* Repeat test for device 0x3 (TUNER_1) */
         hdmiCecClient.sendCecMessage(LogicalAddress.TUNER_1, AUDIO_DEVICE,
                 CecOperand.SYSTEM_AUDIO_MODE_REQUEST,
-                CecMessage.formatParams(HdmiCecConstants.TV_PHYSICAL_ADDRESS));
+                CecMessage.formatParams(HdmiCecConstants.TV_PHYSICAL_ADDRESS,
+                    HdmiCecConstants.PHYSICAL_ADDRESS_LENGTH));
         message = hdmiCecClient.checkExpectedOutput(CecOperand.SET_SYSTEM_AUDIO_MODE);
         assertThat(CecMessage.getParams(message)).isEqualTo(ON);
     }
@@ -347,7 +349,8 @@
         unmuteDevice();
         hdmiCecClient.sendCecMessage(LogicalAddress.TV, AUDIO_DEVICE,
                 CecOperand.SYSTEM_AUDIO_MODE_REQUEST,
-                CecMessage.formatParams(HdmiCecConstants.TV_PHYSICAL_ADDRESS));
+                CecMessage.formatParams(HdmiCecConstants.TV_PHYSICAL_ADDRESS,
+                    HdmiCecConstants.PHYSICAL_ADDRESS_LENGTH));
         hdmiCecClient.sendUserControlPressAndRelease(LogicalAddress.TV, AUDIO_DEVICE,
                 HdmiCecConstants.CEC_CONTROL_MUTE, false);
         assertWithMessage("Device is not muted").that(isDeviceMuted()).isTrue();
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractAppIdleTestCase.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractAppIdleTestCase.java
index d06ab13..2926336 100644
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractAppIdleTestCase.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractAppIdleTestCase.java
@@ -67,7 +67,7 @@
         setAppIdle(true);
         launchComponentAndAssertNetworkAccess(TYPE_COMPONENT_ACTIVTIY);
         finishActivity();
-        assertAppIdle(false); // Sanity check - not idle anymore, since activity was launched...
+        assertAppIdle(false); // verify - not idle anymore, since activity was launched...
         assertBackgroundNetworkAccess(true);
         setAppIdle(true);
         assertBackgroundNetworkAccess(false);
@@ -86,24 +86,24 @@
         assertBackgroundNetworkAccess(false);
 
         addPowerSaveModeWhitelist(TEST_APP2_PKG);
-        assertAppIdle(false); // Sanity check - not idle anymore, since whitelisted
+        assertAppIdle(false); // verify - not idle anymore, since whitelisted
         assertBackgroundNetworkAccess(true);
 
         removePowerSaveModeWhitelist(TEST_APP2_PKG);
-        assertAppIdle(true); // Sanity check - idle again, once whitelisted was removed
+        assertAppIdle(true); // verify - idle again, once whitelisted was removed
         assertBackgroundNetworkAccess(false);
 
         addPowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        assertAppIdle(false); // Sanity check - not idle anymore, since whitelisted
+        assertAppIdle(false); // verify - not idle anymore, since whitelisted
         assertBackgroundNetworkAccess(true);
 
         removePowerSaveModeExceptIdleWhitelist(TEST_APP2_PKG);
-        assertAppIdle(true); // Sanity check - idle again, once whitelisted was removed
+        assertAppIdle(true); // verify - idle again, once whitelisted was removed
         assertBackgroundNetworkAccess(false);
 
         assertsForegroundAlwaysHasNetworkAccess();
 
-        // Sanity check - no whitelist, no access!
+        // verify - no whitelist, no access!
         setAppIdle(true);
         assertBackgroundNetworkAccess(false);
     }
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java
index 3efc6d0..e6f0c30 100644
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/AbstractRestrictBackgroundNetworkTestCase.java
@@ -240,12 +240,12 @@
     }
 
     protected void assertBackgroundNetworkAccess(boolean expectAllowed) throws Exception {
-        assertBackgroundState(); // Sanity check.
+        assertBackgroundState();
         assertNetworkAccess(expectAllowed /* expectAvailable */, false /* needScreenOn */);
     }
 
     protected void assertForegroundNetworkAccess() throws Exception {
-        assertForegroundState(); // Sanity check.
+        assertForegroundState();
         // We verified that app is in foreground state but if the screen turns-off while
         // verifying for network access, the app will go into background state (in case app's
         // foreground status was due to top activity). So, turn the screen on when verifying
@@ -254,7 +254,7 @@
     }
 
     protected void assertForegroundServiceNetworkAccess() throws Exception {
-        assertForegroundServiceState(); // Sanity check.
+        assertForegroundServiceState();
         assertNetworkAccess(true /* expectAvailable */, false /* needScreenOn */);
     }
 
@@ -385,7 +385,7 @@
         }
         // Network status format is described on MyBroadcastReceiver.checkNetworkStatus()
         final String[] parts = resultData.split(NETWORK_STATUS_SEPARATOR);
-        assertEquals("Wrong network status: " + resultData, 5, parts.length); // Sanity check
+        assertEquals("Wrong network status: " + resultData, 5, parts.length);
         final State state = parts[0].equals("null") ? null : State.valueOf(parts[0]);
         final DetailedState detailedState = parts[1].equals("null")
                 ? null : DetailedState.valueOf(parts[1]);
@@ -558,7 +558,7 @@
         // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
         // need to use netpolicy for whitelisting
         executeShellCommand("dumpsys deviceidle whitelist +" + packageName);
-        assertPowerSaveModeWhitelist(packageName, true); // Sanity check
+        assertPowerSaveModeWhitelist(packageName, true);
     }
 
     protected void removePowerSaveModeWhitelist(String packageName) throws Exception {
@@ -566,7 +566,7 @@
         // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
         // need to use netpolicy for whitelisting
         executeShellCommand("dumpsys deviceidle whitelist -" + packageName);
-        assertPowerSaveModeWhitelist(packageName, false); // Sanity check
+        assertPowerSaveModeWhitelist(packageName, false);
     }
 
     protected void assertPowerSaveModeExceptIdleWhitelist(String packageName, boolean expected)
@@ -582,7 +582,7 @@
         // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
         // need to use netpolicy for whitelisting
         executeShellCommand("dumpsys deviceidle except-idle-whitelist +" + packageName);
-        assertPowerSaveModeExceptIdleWhitelist(packageName, true); // Sanity check
+        assertPowerSaveModeExceptIdleWhitelist(packageName, true);
     }
 
     protected void removePowerSaveModeExceptIdleWhitelist(String packageName) throws Exception {
@@ -591,7 +591,7 @@
         // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
         // need to use netpolicy for whitelisting
         executeShellCommand("dumpsys deviceidle except-idle-whitelist reset");
-        assertPowerSaveModeExceptIdleWhitelist(packageName, false); // Sanity check
+        assertPowerSaveModeExceptIdleWhitelist(packageName, false);
     }
 
     protected void turnBatteryOn() throws Exception {
@@ -646,7 +646,7 @@
     }
 
     protected void setDozeMode(boolean enabled) throws Exception {
-        // Sanity check, since tests should check beforehand....
+        // Check doze mode is supported.
         assertTrue("Device does not support Doze Mode", isDozeModeSupported());
 
         Log.i(TAG, "Setting Doze Mode to " + enabled);
@@ -659,7 +659,6 @@
             turnBatteryOff();
             executeShellCommand("dumpsys deviceidle unforce");
         }
-        // Sanity check.
         assertDozeMode(enabled);
     }
 
@@ -670,7 +669,7 @@
     protected void setAppIdle(boolean enabled) throws Exception {
         Log.i(TAG, "Setting app idle to " + enabled);
         executeSilentShellCommand("am set-inactive " + TEST_APP2_PKG + " " + enabled );
-        assertAppIdle(enabled); // Sanity check
+        assertAppIdle(enabled);
     }
 
     protected void assertAppIdle(boolean enabled) throws Exception {
diff --git a/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java b/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
index aa2c914..604a0b6 100644
--- a/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
+++ b/hostsidetests/net/app/src/com/android/cts/net/hostside/DataSaverModeTest.java
@@ -67,7 +67,7 @@
     public void testGetRestrictBackgroundStatus_disabled() throws Exception {
         assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_DISABLED);
 
-        // Sanity check: make sure status is always disabled, never whitelisted
+        // Verify status is always disabled, never whitelisted
         addRestrictBackgroundWhitelist(mUid);
         assertRestrictBackgroundChangedReceived(0);
         assertDataSaverStatusOnBackground(RESTRICT_BACKGROUND_STATUS_DISABLED);
diff --git a/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java b/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
index 4598c393..ac28c7a 100644
--- a/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
+++ b/hostsidetests/net/src/com/android/cts/net/HostsideRestrictBackgroundNetworkTests.java
@@ -367,7 +367,7 @@
         // TODO: currently the power-save mode is behaving like idle, but once it changes, we'll
         // need to use netpolicy for whitelisting
         runCommand("dumpsys deviceidle whitelist +" + packageName);
-        assertPowerSaveModeWhitelist(packageName, true); // Sanity check
+        assertPowerSaveModeWhitelist(packageName, true);
     }
 
     protected boolean isDozeModeEnabled() throws Exception {
diff --git a/suite/audio_quality/test_description/processing/check_spectrum.py b/suite/audio_quality/test_description/processing/check_spectrum.py
index 598da96..3d10e34 100644
--- a/suite/audio_quality/test_description/processing/check_spectrum.py
+++ b/suite/audio_quality/test_description/processing/check_spectrum.py
@@ -82,7 +82,7 @@
     output = []
     outputData = []
     outputTypes = []
-    # basic sanity check
+    # basic validate
     inputError = False
     if (inputTypes[0] != TYPE_MONO) and (inputTypes[0] != TYPE_STEREO):
         inputError = True
diff --git a/suite/audio_quality/test_description/processing/check_spectrum_playback.py b/suite/audio_quality/test_description/processing/check_spectrum_playback.py
index 54cf91f..caef332 100644
--- a/suite/audio_quality/test_description/processing/check_spectrum_playback.py
+++ b/suite/audio_quality/test_description/processing/check_spectrum_playback.py
@@ -70,7 +70,7 @@
     output = []
     outputData = []
     outputTypes = []
-    # basic sanity check
+    # basic validate
     inputError = False
     if (inputTypes[0] != TYPE_MONO):
         inputError = True
diff --git a/suite/audio_quality/test_description/processing/gen_random.py b/suite/audio_quality/test_description/processing/gen_random.py
index 305526a..5548242 100644
--- a/suite/audio_quality/test_description/processing/gen_random.py
+++ b/suite/audio_quality/test_description/processing/gen_random.py
@@ -63,7 +63,7 @@
     output = []
     outputData = []
     outputTypes = []
-    # basic sanity check
+    # basic validate
     inputError = False
     if (inputTypes[0] != TYPE_I64):
         inputError = True
diff --git a/suite/audio_quality/test_description/processing/playback_sample.py b/suite/audio_quality/test_description/processing/playback_sample.py
index 79e8d53..d9c462a 100644
--- a/suite/audio_quality/test_description/processing/playback_sample.py
+++ b/suite/audio_quality/test_description/processing/playback_sample.py
@@ -26,7 +26,7 @@
     output = []
     outputData = []
     outputTypes = []
-    # basic sanity check
+    # basic validate
     inputError = False
     if (inputTypes[0] != TYPE_MONO):
         inputError = True
diff --git a/suite/audio_quality/test_description/processing/playback_thd.py b/suite/audio_quality/test_description/processing/playback_thd.py
index 7242ef8..af490bc 100644
--- a/suite/audio_quality/test_description/processing/playback_thd.py
+++ b/suite/audio_quality/test_description/processing/playback_thd.py
@@ -30,7 +30,7 @@
     output = []
     outputData = []
     outputTypes = []
-    # basic sanity check
+    # basic validate
     inputError = False
     if (inputTypes[0] != TYPE_MONO):
         inputError = True
diff --git a/suite/audio_quality/test_description/processing/recording_thd.py b/suite/audio_quality/test_description/processing/recording_thd.py
index 46d82b5..c0251b5 100644
--- a/suite/audio_quality/test_description/processing/recording_thd.py
+++ b/suite/audio_quality/test_description/processing/recording_thd.py
@@ -37,7 +37,7 @@
     output = []
     outputData = []
     outputTypes = []
-    # basic sanity check
+    # basic validate
     inputError = False
     if (inputTypes[0] != TYPE_MONO):
         inputError = True
diff --git a/tests/JobScheduler/JobTestApp/src/android/jobscheduler/cts/jobtestapp/TestActivity.java b/tests/JobScheduler/JobTestApp/src/android/jobscheduler/cts/jobtestapp/TestActivity.java
index 0368f05..1bb500da 100644
--- a/tests/JobScheduler/JobTestApp/src/android/jobscheduler/cts/jobtestapp/TestActivity.java
+++ b/tests/JobScheduler/JobTestApp/src/android/jobscheduler/cts/jobtestapp/TestActivity.java
@@ -27,7 +27,7 @@
 import android.util.Log;
 
 /**
- * Just a dummy activity to keep the test app process in the foreground state when desired.
+ * Just a no-op activity to keep the test app process in the foreground state when desired.
  */
 public class TestActivity extends Activity {
     private static final String TAG = TestActivity.class.getSimpleName();
diff --git a/tests/JobSchedulerSharedUid/JobSharedUidTestApp/src/android/jobscheduler/cts/jobtestapp/TestActivity.java b/tests/JobSchedulerSharedUid/JobSharedUidTestApp/src/android/jobscheduler/cts/jobtestapp/TestActivity.java
index 77107c2..595f6a6 100644
--- a/tests/JobSchedulerSharedUid/JobSharedUidTestApp/src/android/jobscheduler/cts/jobtestapp/TestActivity.java
+++ b/tests/JobSchedulerSharedUid/JobSharedUidTestApp/src/android/jobscheduler/cts/jobtestapp/TestActivity.java
@@ -27,7 +27,7 @@
 import android.util.Log;
 
 /**
- * Just a dummy activity to keep the test app process in the foreground state when desired.
+ * Just a no-op activity to keep the test app process in the foreground state when desired.
  */
 public class TestActivity extends Activity {
     private static final String TAG = TestActivity.class.getSimpleName();
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
index 8d9890d..9530c2d 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/BaseInputConnectionTest.java
@@ -117,7 +117,7 @@
         assertNotNull(text);
         assertEquals(0, text.length());
 
-        // Test commitText, not dummy mode
+        // Test commitText, not default fake mode
         CharSequence str = "TestCommit ";
         Editable inputText = Editable.Factory.getInstance().newEditable(str);
         connection.commitText(inputText, inputText.length());
@@ -160,7 +160,7 @@
         Editable inputText = Editable.Factory.getInstance().newEditable(str);
         connection.commitText(inputText, inputText.length());
         final Editable text = connection.getEditable();
-        // Test finishComposingText, not dummy mode
+        // Test finishComposingText, not default fake mode
         BaseInputConnection.setComposingSpans(text);
         assertTrue(BaseInputConnection.getComposingSpanStart(text) > -1);
         assertTrue(BaseInputConnection.getComposingSpanEnd(text) > -1);
diff --git a/tests/libcore/runner/Android.bp b/tests/libcore/runner/Android.bp
index 183187c2..563ea1e 100644
--- a/tests/libcore/runner/Android.bp
+++ b/tests/libcore/runner/Android.bp
@@ -28,6 +28,6 @@
         "cts",
         "vts10",
         "general-tests",
-	"mts",
+        "mts",
     ],
 }
diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderExtTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderExtTest.java
index 51a83ef..0f7fe55 100644
--- a/tests/media/src/android/mediav2/cts/CodecDecoderExtTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecDecoderExtTest.java
@@ -49,6 +49,9 @@
 
     @Parameterized.Parameters(name = "{index}({0})")
     public static Collection<Object[]> input() {
+        final boolean isEncoder = false;
+        final boolean needAudio = false;
+        final boolean needVideo = true;
         final List<Object[]> exhaustiveArgsList = Arrays.asList(new Object[][]{
                 {MediaFormat.MIMETYPE_VIDEO_VP9,
                         //show and no-show frames are sent as separate inputs
@@ -66,19 +69,7 @@
                         //show and no-show frames are sent as one input
                         "bbb_512x288_30fps_1mbps_mpeg2_interlaced_nob_2fields.mp4"},
         });
-
-        Set<String> list = new HashSet<>();
-        if (isHandheld() || isTv() || isAutomotive()) {
-            // sec 2.2.2, 2.3.2, 2.5.2
-            list.add(MediaFormat.MIMETYPE_VIDEO_VP9);
-        }
-        if (isTv()) {
-            // sec 2.3.2
-            list.add(MediaFormat.MIMETYPE_VIDEO_MPEG2);
-        }
-        ArrayList<String> cddRequiredMimeList = new ArrayList<>(list);
-
-        return prepareParamList(cddRequiredMimeList, exhaustiveArgsList, false);
+        return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, false);
     }
 
     /**
diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderSurfaceTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderSurfaceTest.java
index 096b5c1..c0aeaf4 100644
--- a/tests/media/src/android/mediav2/cts/CodecDecoderSurfaceTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecDecoderSurfaceTest.java
@@ -38,9 +38,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -128,25 +126,9 @@
 
     @Parameterized.Parameters(name = "{index}({0})")
     public static Collection<Object[]> input() {
-        Set<String> list = new HashSet<>();
-        if (isHandheld() || isTv() || isAutomotive()) {
-            // sec 2.2.2, 2.3.2, 2.5.2
-            list.add(MediaFormat.MIMETYPE_VIDEO_AVC);
-            list.add(MediaFormat.MIMETYPE_VIDEO_MPEG4);
-            list.add(MediaFormat.MIMETYPE_VIDEO_H263);
-            list.add(MediaFormat.MIMETYPE_VIDEO_VP8);
-            list.add(MediaFormat.MIMETYPE_VIDEO_VP9);
-        }
-        if (isHandheld()) {
-            // sec 2.2.2
-            list.add(MediaFormat.MIMETYPE_VIDEO_HEVC);
-        }
-        if (isTv()) {
-            // sec 2.3.2
-            list.add(MediaFormat.MIMETYPE_VIDEO_HEVC);
-            list.add(MediaFormat.MIMETYPE_VIDEO_MPEG2);
-        }
-        ArrayList<String> cddRequiredMimeList = new ArrayList<>(list);
+        final boolean isEncoder = false;
+        final boolean needAudio = false;
+        final boolean needVideo = true;
         final List<Object[]> exhaustiveArgsList = Arrays.asList(new Object[][]{
                 {MediaFormat.MIMETYPE_VIDEO_MPEG2, "bbb_340x280_768kbps_30fps_mpeg2.mp4",
                         "bbb_520x390_1mbps_30fps_mpeg2.mp4"},
@@ -180,7 +162,7 @@
                 {MediaFormat.MIMETYPE_VIDEO_AV1, "bbb_340x280_768kbps_30fps_av1.mp4",
                         "bbb_520x390_1mbps_30fps_av1.mp4"},
         });
-        return prepareParamList(cddRequiredMimeList, exhaustiveArgsList, false);
+        return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, true);
     }
 
     /**
diff --git a/tests/media/src/android/mediav2/cts/CodecDecoderTest.java b/tests/media/src/android/mediav2/cts/CodecDecoderTest.java
index 30ddd29..81216ec 100644
--- a/tests/media/src/android/mediav2/cts/CodecDecoderTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecDecoderTest.java
@@ -41,9 +41,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -125,37 +123,9 @@
 
     @Parameterized.Parameters(name = "{index}({0})")
     public static Collection<Object[]> input() {
-        Set<String> list = new HashSet<>();
-        if (hasAudioOutput()) {
-            // sec 5.1.2
-            list.add(MediaFormat.MIMETYPE_AUDIO_AAC);
-            list.add(MediaFormat.MIMETYPE_AUDIO_FLAC);
-            list.add(MediaFormat.MIMETYPE_AUDIO_MPEG);
-            list.add(MediaFormat.MIMETYPE_AUDIO_VORBIS);
-            list.add(MediaFormat.MIMETYPE_AUDIO_RAW);
-            list.add(MediaFormat.MIMETYPE_AUDIO_OPUS);
-        }
-        if (isHandheld() || isTv() || isAutomotive()) {
-            // sec 2.2.2, 2.3.2, 2.5.2
-            list.add(MediaFormat.MIMETYPE_AUDIO_AAC);
-            list.add(MediaFormat.MIMETYPE_VIDEO_AVC);
-            list.add(MediaFormat.MIMETYPE_VIDEO_MPEG4);
-            list.add(MediaFormat.MIMETYPE_VIDEO_H263);
-            list.add(MediaFormat.MIMETYPE_VIDEO_VP8);
-            list.add(MediaFormat.MIMETYPE_VIDEO_VP9);
-        }
-        if (isHandheld()) {
-            // sec 2.2.2
-            list.add(MediaFormat.MIMETYPE_AUDIO_AMR_NB);
-            list.add(MediaFormat.MIMETYPE_AUDIO_AMR_WB);
-            list.add(MediaFormat.MIMETYPE_VIDEO_HEVC);
-        }
-        if (isTv()) {
-            // sec 2.3.2
-            list.add(MediaFormat.MIMETYPE_VIDEO_HEVC);
-            list.add(MediaFormat.MIMETYPE_VIDEO_MPEG2);
-        }
-        ArrayList<String> cddRequiredMimeList = new ArrayList<>(list);
+        final boolean isEncoder = false;
+        final boolean needAudio = true;
+        final boolean needVideo = true;
         final List<Object[]> exhaustiveArgsList = Arrays.asList(new Object[][]{
                 {MediaFormat.MIMETYPE_AUDIO_MPEG, "bbb_1ch_8kHz_lame_cbr.mp3",
                         "bbb_1ch_8kHz_s16le.raw", "bbb_2ch_44kHz_lame_vbr.mp3",
@@ -220,7 +190,7 @@
                 {MediaFormat.MIMETYPE_VIDEO_AV1, "bbb_340x280_768kbps_30fps_av1.mp4", null,
                         "bbb_520x390_1mbps_30fps_av1.mp4", -1.0f},
         });
-        return prepareParamList(cddRequiredMimeList, exhaustiveArgsList, false);
+        return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, true);
     }
 
     /**
diff --git a/tests/media/src/android/mediav2/cts/CodecEncoderSurfaceTest.java b/tests/media/src/android/mediav2/cts/CodecEncoderSurfaceTest.java
index f2501c0..7a9fde1 100644
--- a/tests/media/src/android/mediav2/cts/CodecEncoderSurfaceTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecEncoderSurfaceTest.java
@@ -22,7 +22,6 @@
 import android.media.MediaExtractor;
 import android.media.MediaFormat;
 import android.media.MediaMuxer;
-import android.os.Build;
 import android.util.Log;
 import android.util.Pair;
 import android.view.Surface;
@@ -38,9 +37,9 @@
 import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
-import java.util.Map;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -99,13 +98,10 @@
 
     @Parameterized.Parameters(name = "{index}({0})")
     public static Collection<Object[]> input() {
-        ArrayList<String> cddRequiredMimeList = new ArrayList<>();
-        if (CodecTestBase.isHandheld() || CodecTestBase.isTv() || CodecTestBase.isAutomotive()) {
-            // sec 2.2.2, 2.3.2, 2.5.2
-            cddRequiredMimeList.add(MediaFormat.MIMETYPE_VIDEO_AVC);
-            cddRequiredMimeList.add(MediaFormat.MIMETYPE_VIDEO_VP8);
-        }
-        final Object[][] exhaustiveArgsList = new Object[][]{
+        final boolean isEncoder = true;
+        final boolean needAudio = false;
+        final boolean needVideo = true;
+        final List<Object[]> exhaustiveArgsList = Arrays.asList(new Object[][]{
                 // Video - CodecMime, test file, bit rate, frame rate
                 {MediaFormat.MIMETYPE_VIDEO_H263, "bbb_176x144_128kbps_15fps_h263.3gp", 128000, 15},
                 {MediaFormat.MIMETYPE_VIDEO_MPEG4, "bbb_128x96_64kbps_12fps_mpeg4.mp4", 64000, 12},
@@ -114,60 +110,9 @@
                 {MediaFormat.MIMETYPE_VIDEO_VP8, "bbb_cif_768kbps_30fps_avc.mp4", 512000, 30},
                 {MediaFormat.MIMETYPE_VIDEO_VP9, "bbb_cif_768kbps_30fps_avc.mp4", 512000, 30},
                 {MediaFormat.MIMETYPE_VIDEO_AV1, "bbb_cif_768kbps_30fps_avc.mp4", 512000, 30},
-        };
-        ArrayList<String> mimes = new ArrayList<>();
-        if (CodecTestBase.codecSelKeys.contains(CodecTestBase.CODEC_SEL_VALUE)) {
-            MediaCodecList codecList = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
-            MediaCodecInfo[] codecInfos = codecList.getCodecInfos();
-            for (MediaCodecInfo codecInfo : codecInfos) {
-                if (!codecInfo.isEncoder()) continue;
-                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && codecInfo.isAlias()) continue;
-                String[] types = codecInfo.getSupportedTypes();
-                for (String type : types) {
-                    if (!mimes.contains(type) && type.startsWith("video/")) {
-                        mimes.add(type);
-                    }
-                }
-            }
-            // TODO(b/154423708): add checks for video o/p port and display length >= 2.5"
-            /* sec 5.2: device implementations include an embedded screen display with the diagonal
-            length of at least 2.5inches or include a video output port or declare the support of a
-            camera */
-            if (CodecTestBase.hasCamera() && !mimes.contains(MediaFormat.MIMETYPE_VIDEO_AVC) &&
-                    !mimes.contains(MediaFormat.MIMETYPE_VIDEO_VP8)) {
-                fail("device must support at least one of VP8 or AVC video encoders");
-            }
-            for (String mime : cddRequiredMimeList) {
-                if (!mimes.contains(mime)) {
-                    fail("no codec found for mime " + mime + " as required by cdd");
-                }
-            }
-        } else {
-            for (Map.Entry<String, String> entry : CodecTestBase.codecSelKeyMimeMap.entrySet()) {
-                String key = entry.getKey();
-                String value = entry.getValue();
-                if (CodecTestBase.codecSelKeys.contains(key) && !mimes.contains(value)) {
-                    mimes.add(value);
-                }
-            }
-        }
-        final List<Object[]> argsList = new ArrayList<>();
-        for (String mime : mimes) {
-            boolean miss = true;
-            for (Object[] arg : exhaustiveArgsList) {
-                if (mime.equals(arg[0])) {
-                    argsList.add(arg);
-                    miss = false;
-                }
-            }
-            if (miss) {
-                if (cddRequiredMimeList.contains(mime)) {
-                    fail("no test vectors for required mimetype " + mime);
-                }
-                Log.w(LOG_TAG, "no test vectors available for optional mime type " + mime);
-            }
-        }
-        return argsList;
+        });
+        return CodecTestBase.prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo,
+                true);
     }
 
     private boolean hasSeenError() {
diff --git a/tests/media/src/android/mediav2/cts/CodecEncoderTest.java b/tests/media/src/android/mediav2/cts/CodecEncoderTest.java
index 2d9da22..38eea01 100644
--- a/tests/media/src/android/mediav2/cts/CodecEncoderTest.java
+++ b/tests/media/src/android/mediav2/cts/CodecEncoderTest.java
@@ -35,9 +35,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -159,26 +157,9 @@
 
     @Parameterized.Parameters(name = "{index}({0})")
     public static Collection<Object[]> input() {
-        Set<String> list = new HashSet<>();
-        if (hasMicrophone()) {
-            // sec 5.1.1
-            // TODO(b/154423550)
-            // list.add(MediaFormat.MIMETYPE_AUDIO_RAW);
-            list.add(MediaFormat.MIMETYPE_AUDIO_FLAC);
-            list.add(MediaFormat.MIMETYPE_AUDIO_OPUS);
-        }
-        if (isHandheld() || isTv() || isAutomotive()) {
-            // sec 2.2.2, 2.3.2, 2.5.2
-            list.add(MediaFormat.MIMETYPE_AUDIO_AAC);
-            list.add(MediaFormat.MIMETYPE_VIDEO_AVC);
-            list.add(MediaFormat.MIMETYPE_VIDEO_VP8);
-        }
-        if (isHandheld()) {
-            // sec 2.2.2
-            list.add(MediaFormat.MIMETYPE_AUDIO_AMR_NB);
-            list.add(MediaFormat.MIMETYPE_AUDIO_AMR_WB);
-        }
-        ArrayList<String> cddRequiredMimeList = new ArrayList<>(list);
+        final boolean isEncoder = true;
+        final boolean needAudio = true;
+        final boolean needVideo = true;
         final List<Object[]> exhaustiveArgsList = Arrays.asList(new Object[][]{
                 // Audio - CodecMime, arrays of bit-rates, sample rates, channel counts
                 {MediaFormat.MIMETYPE_AUDIO_AAC, new int[]{64000, 128000}, new int[]{8000, 11025,
@@ -208,7 +189,7 @@
                 {MediaFormat.MIMETYPE_VIDEO_AV1, new int[]{256000, 512000}, new int[]{176, 352,
                         352, 480}, new int[]{144, 240, 288, 360}},
         });
-        return prepareParamList(cddRequiredMimeList, exhaustiveArgsList, true);
+        return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, true);
     }
 
     private void setUpParams(int limit) {
diff --git a/tests/media/src/android/mediav2/cts/CodecTestBase.java b/tests/media/src/android/mediav2/cts/CodecTestBase.java
index a47ede1..ec214eb 100644
--- a/tests/media/src/android/mediav2/cts/CodecTestBase.java
+++ b/tests/media/src/android/mediav2/cts/CodecTestBase.java
@@ -44,9 +44,11 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -533,8 +535,78 @@
                 !isAutomotive();
     }
 
-    static List<Object[]> prepareParamList(ArrayList<String> cddRequiredMimeList,
-            List<Object[]> exhaustiveArgsList, boolean isEncoder) {
+    static ArrayList<String> prepareRequiredArgsList(boolean isEncoder, boolean needAudio,
+            boolean needVideo) {
+        Set<String> list = new HashSet<>();
+        if (!isEncoder) {
+            if (hasAudioOutput() && needAudio) {
+                // sec 5.1.2
+                list.add(MediaFormat.MIMETYPE_AUDIO_AAC);
+                list.add(MediaFormat.MIMETYPE_AUDIO_FLAC);
+                list.add(MediaFormat.MIMETYPE_AUDIO_MPEG);
+                list.add(MediaFormat.MIMETYPE_AUDIO_VORBIS);
+                list.add(MediaFormat.MIMETYPE_AUDIO_RAW);
+                list.add(MediaFormat.MIMETYPE_AUDIO_OPUS);
+            }
+            if (isHandheld() || isTv() || isAutomotive()) {
+                // sec 2.2.2, 2.3.2, 2.5.2
+                if (needAudio) {
+                    list.add(MediaFormat.MIMETYPE_AUDIO_AAC);
+                }
+                if (needVideo) {
+                    list.add(MediaFormat.MIMETYPE_VIDEO_AVC);
+                    list.add(MediaFormat.MIMETYPE_VIDEO_MPEG4);
+                    list.add(MediaFormat.MIMETYPE_VIDEO_H263);
+                    list.add(MediaFormat.MIMETYPE_VIDEO_VP8);
+                    list.add(MediaFormat.MIMETYPE_VIDEO_VP9);
+                }
+            }
+            if (isHandheld()) {
+                // sec 2.2.2
+                if (needAudio) {
+                    list.add(MediaFormat.MIMETYPE_AUDIO_AMR_NB);
+                    list.add(MediaFormat.MIMETYPE_AUDIO_AMR_WB);
+                }
+                if (needVideo) {
+                    list.add(MediaFormat.MIMETYPE_VIDEO_HEVC);
+                }
+            }
+            if (isTv() && needVideo) {
+                // sec 2.3.2
+                list.add(MediaFormat.MIMETYPE_VIDEO_HEVC);
+                list.add(MediaFormat.MIMETYPE_VIDEO_MPEG2);
+            }
+        } else {
+            if (hasMicrophone() && needAudio) {
+                // sec 5.1.1
+                // TODO(b/154423550)
+                // list.add(MediaFormat.MIMETYPE_AUDIO_RAW);
+                list.add(MediaFormat.MIMETYPE_AUDIO_FLAC);
+                list.add(MediaFormat.MIMETYPE_AUDIO_OPUS);
+            }
+            if (isHandheld() || isTv() || isAutomotive()) {
+                // sec 2.2.2, 2.3.2, 2.5.2
+                if (needAudio) {
+                    list.add(MediaFormat.MIMETYPE_AUDIO_AAC);
+                }
+                if (needVideo) {
+                    list.add(MediaFormat.MIMETYPE_VIDEO_AVC);
+                    list.add(MediaFormat.MIMETYPE_VIDEO_VP8);
+                }
+            }
+            if (isHandheld() && needAudio) {
+                // sec 2.2.2
+                list.add(MediaFormat.MIMETYPE_AUDIO_AMR_NB);
+                list.add(MediaFormat.MIMETYPE_AUDIO_AMR_WB);
+            }
+        }
+        return new ArrayList<>(list);
+    }
+
+    static List<Object[]> prepareParamList(List<Object[]> exhaustiveArgsList, boolean isEncoder,
+            boolean needAudio, boolean needVideo, boolean mustTestRequiredArgsList) {
+        ArrayList<String> cddRequiredMimeList =
+                prepareRequiredArgsList(isEncoder, needAudio, needVideo);
         ArrayList<String> mimes = new ArrayList<>();
         if (codecSelKeys.contains(CODEC_SEL_VALUE)) {
             MediaCodecList codecList = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
@@ -544,6 +616,8 @@
                 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && codecInfo.isAlias()) continue;
                 String[] types = codecInfo.getSupportedTypes();
                 for (String type : types) {
+                    if (!needAudio && type.startsWith("audio/")) continue;
+                    if (!needVideo && type.startsWith("video/")) continue;
                     if (!mimes.contains(type)) {
                         mimes.add(type);
                     }
@@ -553,7 +627,8 @@
             /* sec 5.2: device implementations include an embedded screen display with the
             diagonal length of at least 2.5inches or include a video output port or declare the
             support of a camera */
-            if (isEncoder && hasCamera() && !mimes.contains(MediaFormat.MIMETYPE_VIDEO_AVC) &&
+            if (isEncoder && hasCamera() && needVideo &&
+                    !mimes.contains(MediaFormat.MIMETYPE_VIDEO_AVC) &&
                     !mimes.contains(MediaFormat.MIMETYPE_VIDEO_VP8)) {
                 fail("device must support at least one of VP8 or AVC video encoders");
             }
@@ -578,7 +653,7 @@
                     miss = false;
                 }
             }
-            if (miss) {
+            if (miss && mustTestRequiredArgsList) {
                 if (cddRequiredMimeList.contains(mime)) {
                     fail("no test vectors for required mimetype " + mime);
                 }
diff --git a/tests/media/src/android/mediav2/cts/EncoderColorAspectsTest.java b/tests/media/src/android/mediav2/cts/EncoderColorAspectsTest.java
index 4185d7c..dabb07e 100644
--- a/tests/media/src/android/mediav2/cts/EncoderColorAspectsTest.java
+++ b/tests/media/src/android/mediav2/cts/EncoderColorAspectsTest.java
@@ -108,34 +108,27 @@
 
     @Parameterized.Parameters(name = "{index}({0}{3}{4}{5})")
     public static Collection<Object[]> input() {
-        ArrayList<String> testMimeList = new ArrayList<>();
-        testMimeList.add(MediaFormat.MIMETYPE_VIDEO_AVC);
-        testMimeList.add(MediaFormat.MIMETYPE_VIDEO_HEVC);
-        testMimeList.add(MediaFormat.MIMETYPE_VIDEO_VP8);
-        testMimeList.add(MediaFormat.MIMETYPE_VIDEO_VP9);
-        ArrayList<String> mimes = new ArrayList<>();
-        if (CodecTestBase.codecSelKeys.contains(CodecTestBase.CODEC_SEL_VALUE)) {
-            MediaCodecList codecList = new MediaCodecList(MediaCodecList.REGULAR_CODECS);
-            MediaCodecInfo[] codecInfos = codecList.getCodecInfos();
-            for (MediaCodecInfo codecInfo : codecInfos) {
-                if (!codecInfo.isEncoder()) continue;
-                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && codecInfo.isAlias()) continue;
-                String[] types = codecInfo.getSupportedTypes();
-                for (String type : types) {
-                    if (testMimeList.contains(type) && !mimes.contains(type)) {
-                        mimes.add(type);
-                    }
-                }
-            }
-        }
-        int[] ranges =
-                {-1, UNSPECIFIED, MediaFormat.COLOR_RANGE_FULL, MediaFormat.COLOR_RANGE_LIMITED};
-        int[] standards =
-                {-1, UNSPECIFIED, MediaFormat.COLOR_STANDARD_BT709,
-                        MediaFormat.COLOR_STANDARD_BT601_PAL,
-                        MediaFormat.COLOR_STANDARD_BT601_NTSC, MediaFormat.COLOR_STANDARD_BT2020};
-        int[] transfers =
-                {-1, UNSPECIFIED, MediaFormat.COLOR_TRANSFER_LINEAR, MediaFormat.COLOR_TRANSFER_SDR_VIDEO};
+        final boolean isEncoder = true;
+        final boolean needAudio = false;
+        final boolean needVideo = true;
+        String[] mimes = {MediaFormat.MIMETYPE_VIDEO_AVC,
+                MediaFormat.MIMETYPE_VIDEO_HEVC,
+                MediaFormat.MIMETYPE_VIDEO_VP8,
+                MediaFormat.MIMETYPE_VIDEO_VP9};
+        int[] ranges = {-1,
+                UNSPECIFIED,
+                MediaFormat.COLOR_RANGE_FULL,
+                MediaFormat.COLOR_RANGE_LIMITED};
+        int[] standards = {-1,
+                UNSPECIFIED,
+                MediaFormat.COLOR_STANDARD_BT709,
+                MediaFormat.COLOR_STANDARD_BT601_PAL,
+                MediaFormat.COLOR_STANDARD_BT601_NTSC,
+                MediaFormat.COLOR_STANDARD_BT2020};
+        int[] transfers = {-1,
+                UNSPECIFIED,
+                MediaFormat.COLOR_TRANSFER_LINEAR,
+                MediaFormat.COLOR_TRANSFER_SDR_VIDEO};
         // TODO: COLOR_TRANSFER_ST2084, COLOR_TRANSFER_HLG are for 10 bit and above. Should these
         //  be tested as well?
         List<Object[]> exhaustiveArgsList = new ArrayList<>();
@@ -150,7 +143,8 @@
                 }
             }
         }
-        return exhaustiveArgsList;
+        return CodecTestBase
+                .prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, false);
     }
 
     @SmallTest
@@ -174,6 +168,7 @@
             }
             /* TODO(b/156571486) */
             if (encoder.equals("c2.android.hevc.encoder") ||
+                    encoder.equals("OMX.google.h264.encoder") ||
                     encoder.equals("c2.android.avc.encoder")) {
                 Log.d(LOG_TAG, "test skipped due to b/156571486");
                 mCodec.release();
diff --git a/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java b/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java
index d0e4030..f3e9ad7 100644
--- a/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java
+++ b/tests/media/src/android/mediav2/cts/EncoderProfileLevelTest.java
@@ -74,13 +74,9 @@
 
     @Parameterized.Parameters(name = "{index}({0})")
     public static Collection<Object[]> input() {
-        ArrayList<String> cddRequiredMimeList = new ArrayList<>();
-        if (isHandheld() || isTv() || isAutomotive()) {
-            // sec 2.2.2, 2.3.2, 2.5.2
-            cddRequiredMimeList.add(MediaFormat.MIMETYPE_AUDIO_AAC);
-            cddRequiredMimeList.add(MediaFormat.MIMETYPE_VIDEO_AVC);
-            cddRequiredMimeList.add(MediaFormat.MIMETYPE_VIDEO_VP8);
-        }
+        final boolean isEncoder = true;
+        final boolean needAudio = true;
+        final boolean needVideo = true;
         final List<Object[]> exhaustiveArgsList = Arrays.asList(new Object[][]{
                 // Audio - CodecMime, bit-rate, sample rate, channel count
                 {MediaFormat.MIMETYPE_AUDIO_AAC, 64000, 48000, 1, -1},
@@ -193,7 +189,7 @@
                 {MediaFormat.MIMETYPE_VIDEO_VP8, 512000, 176, 144, 20},
                 {MediaFormat.MIMETYPE_VIDEO_VP8, 512000, 480, 360, 20},
         });
-        return prepareParamList(cddRequiredMimeList, exhaustiveArgsList, true);
+        return prepareParamList(exhaustiveArgsList, isEncoder, needAudio, needVideo, false);
     }
 
     static {
diff --git a/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java b/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
index 632ae59..67ab0f0 100644
--- a/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
+++ b/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
@@ -1015,6 +1015,7 @@
 
         // Set subscription group with current sub Id.
         int subId = SubscriptionManager.getDefaultDataSubscriptionId();
+        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) return;
         ParcelUuid uuid = mSubscriptionManager.createSubscriptionGroup(Arrays.asList(subId));
 
         try {
@@ -1052,6 +1053,7 @@
 
         // Set subscription group with current sub Id.
         int subId = SubscriptionManager.getDefaultDataSubscriptionId();
+        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) return;
         ParcelUuid uuid = mSubscriptionManager.createSubscriptionGroup(Arrays.asList(subId));
 
         try {
@@ -1083,6 +1085,7 @@
         if (!hasCellular) return;
 
         int subId = SubscriptionManager.getDefaultDataSubscriptionId();
+        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) return;
         SubscriptionInfo info = mSubscriptionManager.getActiveSubscriptionInfo(subId);
         boolean oldOpportunistic = info.isOpportunistic();
         boolean newOpportunistic = !oldOpportunistic;
diff --git a/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java b/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
index 1fe4282..ad5db2b 100644
--- a/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
@@ -873,6 +873,7 @@
                 case 2:
                 case 3:
                 case 4:
+                case 41:
                     assertThat(teeEnforcedDigests, is(expectedDigests));
                     break;
 
diff --git a/tests/tests/net/ipsec/src/android/net/ipsec/ike/cts/IkeSessionTestBase.java b/tests/tests/net/ipsec/src/android/net/ipsec/ike/cts/IkeSessionTestBase.java
index a81063b..6264cea 100644
--- a/tests/tests/net/ipsec/src/android/net/ipsec/ike/cts/IkeSessionTestBase.java
+++ b/tests/tests/net/ipsec/src/android/net/ipsec/ike/cts/IkeSessionTestBase.java
@@ -56,7 +56,7 @@
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
 import com.android.compatibility.common.util.SystemUtil;
-import com.android.testutils.ArrayTrackRecord;
+import com.android.net.module.util.ArrayTrackRecord;
 
 import org.junit.After;
 import org.junit.AfterClass;
diff --git a/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java b/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
index 1726a47..c2ebc46 100644
--- a/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
+++ b/tests/tests/net/src/android/net/cts/ConnectivityDiagnosticsManagerTest.java
@@ -77,7 +77,7 @@
 
 import com.android.internal.telephony.uicc.IccUtils;
 import com.android.internal.util.ArrayUtils;
-import com.android.testutils.ArrayTrackRecord;
+import com.android.net.module.util.ArrayTrackRecord;
 import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
 import com.android.testutils.DevSdkIgnoreRunner;
 
diff --git a/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt b/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt
index c8e1fc3..d2ca3f8 100644
--- a/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt
+++ b/tests/tests/net/src/android/net/cts/NetworkAgentTest.kt
@@ -39,13 +39,6 @@
 import android.net.SocketKeepalive
 import android.net.StringNetworkSpecifier
 import android.net.Uri
-import android.os.Build
-import android.os.Bundle
-import android.os.Handler
-import android.os.HandlerThread
-import android.os.Looper
-import android.os.Message
-import android.os.Messenger
 import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnAddKeepalivePacketFilter
 import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnAutomaticReconnectDisabled
 import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnBandwidthUpdateRequested
@@ -56,15 +49,21 @@
 import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnStartSocketKeepalive
 import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnStopSocketKeepalive
 import android.net.cts.NetworkAgentTest.TestableNetworkAgent.CallbackEntry.OnValidationStatus
+import android.os.Build
+import android.os.Bundle
+import android.os.Handler
+import android.os.HandlerThread
+import android.os.Looper
+import android.os.Message
+import android.os.Messenger
 import androidx.test.InstrumentationRegistry
 import androidx.test.runner.AndroidJUnit4
 import com.android.internal.util.AsyncChannel
-import com.android.testutils.ArrayTrackRecord
+import com.android.net.module.util.ArrayTrackRecord
 import com.android.testutils.DevSdkIgnoreRule
 import com.android.testutils.RecorderCallback.CallbackEntry.Available
 import com.android.testutils.RecorderCallback.CallbackEntry.Lost
 import com.android.testutils.TestableNetworkCallback
-import java.util.UUID
 import org.junit.After
 import org.junit.Assert.assertArrayEquals
 import org.junit.Assert.fail
@@ -74,9 +73,10 @@
 import org.junit.runner.RunWith
 import java.net.InetAddress
 import java.time.Duration
+import java.util.UUID
 import kotlin.test.assertEquals
-import kotlin.test.assertFalse
 import kotlin.test.assertFailsWith
+import kotlin.test.assertFalse
 import kotlin.test.assertNotNull
 import kotlin.test.assertNull
 import kotlin.test.assertTrue
diff --git a/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java b/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
index d7a5e3f..16e3af0 100644
--- a/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
+++ b/tests/tests/permission/src/android/permission/cts/PermissionGroupChange.java
@@ -104,7 +104,7 @@
 
     protected void clickAllowButton() throws Exception {
         if (mIsAutomotive) {
-            mUiDevice.findObject(new UiSelector().text("Allow")).click();
+            mUiDevice.findObject(new UiSelector().textMatches("(?i)Allow")).click();
         } else {
             mUiDevice.findObject(new UiSelector().resourceId(
                     "com.android.permissioncontroller:id/permission_allow_button")).click();
diff --git a/tests/tests/telecom/src/android/telecom/cts/AdhocConferenceTest.java b/tests/tests/telecom/src/android/telecom/cts/AdhocConferenceTest.java
index d80d107..c92cd9a 100644
--- a/tests/tests/telecom/src/android/telecom/cts/AdhocConferenceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/AdhocConferenceTest.java
@@ -135,6 +135,24 @@
         MockConference conference = (MockConference) resultPair.first;
         conference.setConnectionCapabilities(conference.getConnectionCapabilities()
                 | Connection.CAPABILITY_ADD_PARTICIPANT);
+
+        // Wait for the capability change to propagate before adding participants.
+        waitUntilConditionIsTrueOrTimeout(
+                new Condition() {
+                    @Override
+                    public Object expected() {
+                        return true;
+                    }
+
+                    @Override
+                    public Object actual() {
+                        return call.getDetails().can(Call.Details.CAPABILITY_ADD_PARTICIPANT);
+                    }
+                },
+                WAIT_FOR_STATE_CHANGE_TIMEOUT_MS,
+                "Call should have capability " + Call.Details.CAPABILITY_ADD_PARTICIPANT
+        );
+
         call.addConferenceParticipants(PARTICIPANTS);
         assertTrue(conference.acquireLock(WAIT_FOR_STATE_CHANGE_TIMEOUT_MS, TimeUnit.MILLISECONDS));
         assertTrue(conference.mParticipants.containsAll(PARTICIPANTS));
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java b/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java
index 48a6573..f3652a0 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CellInfoTest.java
@@ -530,7 +530,7 @@
 
     private void verifyCellIdentityNr(CellIdentityNr nr, boolean isRegistered) {
         // This class was added after numeric mcc/mncs were no longer provided, so it lacks the
-        // basic getMcc() and getMnc() - Dummy out those checks.
+        // basic getMcc() and getMnc() - empty out those checks.
         String mccStr = nr.getMccString();
         String mncStr = nr.getMncString();
         verifyPlmnInfo(mccStr, mncStr,
@@ -1001,7 +1001,7 @@
         String mncStr = tdscdma.getMncString();
 
         // This class was added after numeric mcc/mncs were no longer provided, so it lacks the
-        // basic getMcc() and getMnc() - Dummy out those checks.
+        // basic getMcc() and getMnc() - empty out those checks.
         verifyPlmnInfo(tdscdma.getMccString(), tdscdma.getMncString(),
                 mccStr != null ? Integer.parseInt(mccStr) : CellInfo.UNAVAILABLE,
                 mncStr != null ? Integer.parseInt(mncStr) : CellInfo.UNAVAILABLE);
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
index 3e6f2df..8d04be2 100755
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsManagerTest.java
@@ -433,7 +433,7 @@
         int originalWriteSmsMode = -1;
         String ctsPackageName = context.getPackageName();
         try {
-            // Insert some dummy sms
+            // Insert some test sms
             originalWriteSmsMode = context.getSystemService(AppOpsManager.class)
                     .unsafeCheckOpNoThrow(AppOpsManager.OPSTR_WRITE_SMS,
                             getPackageUid(ctsPackageName), ctsPackageName);
@@ -448,8 +448,8 @@
                         new Date().toString().replace(" ", "_"));
                 return contentResolver.insert(Telephony.Sms.CONTENT_URI, contentValues);
             });
-            assertNotNull("Failed to insert dummy sms", dummySmsUri);
-            assertNotEquals("Failed to insert dummy sms", dummySmsUri.getLastPathSegment(), "0");
+            assertNotNull("Failed to insert test sms", dummySmsUri);
+            assertNotEquals("Failed to insert test sms", dummySmsUri.getLastPathSegment(), "0");
             testSmsAccessAboutDefaultApp(LEGACY_SMS_APP);
             testSmsAccessAboutDefaultApp(MODERN_SMS_APP);
         } finally {
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
index 7cd5a53..1cb7ff6 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SubscriptionManagerTest.java
@@ -137,11 +137,11 @@
     }
 
     /**
-     * Sanity check that the device has a cellular network and a valid default data subId
+     * Correctness check that the device has a cellular network and a valid default data subId
      * when {@link PackageManager#FEATURE_TELEPHONY} support.
      */
     @Test
-    public void testSanity() throws Exception {
+    public void testCorrectness() throws Exception {
         if (!isSupported()) return;
 
         final boolean hasCellular = findCellularNetwork() != null;
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
index a9164b6ee..f5b7093 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -695,6 +695,12 @@
             Log.d(TAG, "Skipping test that requires config_voice_capable is true");
             return;
         }
+        int subId = SubscriptionManager.getDefaultDataSubscriptionId();
+        if (subId == SubscriptionManager.INVALID_SUBSCRIPTION_ID) {
+            Log.d(TAG, "Skipping test that requires DefaultDataSubscriptionId setting");
+            return;
+        }
+
         TelecomManager telecomManager = getContext().getSystemService(TelecomManager.class);
         PhoneAccountHandle handle =
                 telecomManager.getDefaultOutgoingPhoneAccount(PhoneAccount.SCHEME_TEL);
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
index 8255cf4..fa483e9 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
@@ -196,7 +196,7 @@
         if (tm.getSimState(sTestSlot) != TelephonyManager.SIM_STATE_READY) {
             fail("This test requires that there is a SIM in the device!");
         }
-        // Sanity check: ensure that the subscription hasn't changed between tests.
+        // Correctness check: ensure that the subscription hasn't changed between tests.
         int[] subs = SubscriptionManager.getSubId(sTestSlot);
 
         if (subs == null) {
diff --git a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/MmsTest.java b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/MmsTest.java
index 85df75d..36cf75b 100644
--- a/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/MmsTest.java
+++ b/tests/tests/telephonyprovider/src/android/telephonyprovider/cts/MmsTest.java
@@ -471,13 +471,13 @@
      *
      * When an insert fails, the resulting URI could be in several states. In many cases the
      * resulting URI will be null. However, if an insert fails due to appops privileges it will
-     * return a dummy URI. This URI should either point to no rows, or to a single row. If it does
-     * point to a row, it the subject should not match the subject of the attempted insert.
+     * return a placeholder URI. This URI should either point to no rows, or to a single row. If it
+     * does point to a row, it the subject should not match the subject of the attempted insert.
      *
      * In normal circumstances, the environment should be clean before the test, so as long as our
      * subjects are unique, we should not have a false test failure. However, if the environment is
-     * not clean, we could lead to a false test failure if the returned dummy URI subject happens to
-     * match the subject of our attempted insert.
+     * not clean, we could lead to a false test failure if the returned placeholder URI subject
+     * happens to match the subject of our attempted insert.
      */
     private void assertThatMmsInsertFailed(@Nullable Uri uriReturnedFromInsert,
             String subjectOfAttemptedInsert) {
diff --git a/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java b/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
index f47f454..65a8c7c 100644
--- a/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
+++ b/tests/tests/tethering/src/android/tethering/cts/TetheringManagerTest.java
@@ -72,7 +72,7 @@
 import androidx.test.InstrumentationRegistry;
 import androidx.test.runner.AndroidJUnit4;
 
-import com.android.testutils.ArrayTrackRecord;
+import com.android.net.module.util.ArrayTrackRecord;
 
 import org.junit.After;
 import org.junit.Before;
diff --git a/tests/tests/webkit/assets/webkit/test_jsInterface.html b/tests/tests/webkit/assets/webkit/test_jsInterface.html
index 662dfe0..9365cac 100644
--- a/tests/tests/webkit/assets/webkit/test_jsInterface.html
+++ b/tests/tests/webkit/assets/webkit/test_jsInterface.html
@@ -16,6 +16,6 @@
 <html>
     <title>Original title</title>
     <!-- Calls into the javascript interface for the activity -->
-    <body onload='window.dummy.provideResult(document.title)'>
+    <body onload='window.interface.provideResult(document.title)'>
     </body>
 </html>
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
index e580ec6..3c99a2a 100755
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
@@ -602,7 +602,7 @@
         mOnUiThread.getSettings().setJavaScriptEnabled(true);
         mOnUiThread.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
 
-        final class DummyJavaScriptInterface {
+        final class TestJavaScriptInterface {
             private boolean mWasProvideResultCalled;
             private String mResult;
 
@@ -632,8 +632,8 @@
             }
         }
 
-        final DummyJavaScriptInterface obj = new DummyJavaScriptInterface();
-        mOnUiThread.addJavascriptInterface(obj, "dummy");
+        final TestJavaScriptInterface obj = new TestJavaScriptInterface();
+        mOnUiThread.addJavascriptInterface(obj, "interface");
         assertFalse(obj.wasProvideResultCalled());
 
         startWebServer(false);
@@ -644,13 +644,13 @@
         // Verify that only methods annotated with @JavascriptInterface are exposed
         // on the JavaScript interface object.
         assertEquals("\"function\"",
-                mOnUiThread.evaluateJavascriptSync("typeof dummy.provideResult"));
+                mOnUiThread.evaluateJavascriptSync("typeof interface.provideResult"));
 
         assertEquals("\"undefined\"",
-                mOnUiThread.evaluateJavascriptSync("typeof dummy.wasProvideResultCalled"));
+                mOnUiThread.evaluateJavascriptSync("typeof interface.wasProvideResultCalled"));
 
         assertEquals("\"undefined\"",
-                mOnUiThread.evaluateJavascriptSync("typeof dummy.getClass"));
+                mOnUiThread.evaluateJavascriptSync("typeof interface.getClass"));
     }
 
     public void testAddJavascriptInterfaceNullObject() throws Exception {
@@ -779,14 +779,14 @@
             }
         };
 
-        mOnUiThread.addJavascriptInterface(mJsInterfaceWasCalled, "dummy");
+        mOnUiThread.addJavascriptInterface(mJsInterfaceWasCalled, "interface");
 
         mOnUiThread.loadUrlAndWaitForCompletion("about:blank");
 
         assertFalse(mJsInterfaceWasCalled.get());
 
         assertEquals("\"pass\"", mOnUiThread.evaluateJavascriptSync(
-                "try {dummy.call(); 'fail'; } catch (exception) { 'pass'; } "));
+                "try {interface.call(); 'fail'; } catch (exception) { 'pass'; } "));
         assertTrue(mJsInterfaceWasCalled.get());
     }
 
@@ -797,19 +797,16 @@
 
         mOnUiThread.getSettings().setJavaScriptEnabled(true);
 
-        class DummyJavaScriptInterface {
-        }
-        final DummyJavaScriptInterface obj = new DummyJavaScriptInterface();
-        mOnUiThread.addJavascriptInterface(obj, "dummy");
+        mOnUiThread.addJavascriptInterface(new Object(), "interface");
         mOnUiThread.loadUrlAndWaitForCompletion("about:blank");
 
-        assertEquals("42", mOnUiThread.evaluateJavascriptSync("dummy.custom_property = 42"));
+        assertEquals("42", mOnUiThread.evaluateJavascriptSync("interface.custom_property = 42"));
 
-        assertEquals("true", mOnUiThread.evaluateJavascriptSync("'custom_property' in dummy"));
+        assertEquals("true", mOnUiThread.evaluateJavascriptSync("'custom_property' in interface"));
 
         mOnUiThread.reloadAndWaitForCompletion();
 
-        assertEquals("false", mOnUiThread.evaluateJavascriptSync("'custom_property' in dummy"));
+        assertEquals("false", mOnUiThread.evaluateJavascriptSync("'custom_property' in interface"));
     }
 
     public void testJavascriptInterfaceForClientPopup() throws Exception {
@@ -821,18 +818,18 @@
         mOnUiThread.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
         mOnUiThread.getSettings().setSupportMultipleWindows(true);
 
-        class DummyJavaScriptInterface {
+        class TestJavaScriptInterface {
             @JavascriptInterface
             public int test() {
                 return 42;
             }
         }
-        final DummyJavaScriptInterface obj = new DummyJavaScriptInterface();
+        final TestJavaScriptInterface obj = new TestJavaScriptInterface();
 
         final WebView childWebView = mOnUiThread.createWebView();
         WebViewOnUiThread childOnUiThread = new WebViewOnUiThread(childWebView);
         childOnUiThread.getSettings().setJavaScriptEnabled(true);
-        childOnUiThread.addJavascriptInterface(obj, "dummy");
+        childOnUiThread.addJavascriptInterface(obj, "interface");
 
         final SettableFuture<Void> onCreateWindowFuture = SettableFuture.create();
         mOnUiThread.setWebChromeClient(new WebViewSyncLoader.WaitForProgressClient(mOnUiThread) {
@@ -857,10 +854,10 @@
 
         childOnUiThread.loadUrlAndWaitForCompletion("about:blank");
 
-        assertEquals("true", childOnUiThread.evaluateJavascriptSync("'dummy' in window"));
+        assertEquals("true", childOnUiThread.evaluateJavascriptSync("'interface' in window"));
 
         assertEquals("The injected object should be functional", "42",
-                childOnUiThread.evaluateJavascriptSync("dummy.test()"));
+                childOnUiThread.evaluateJavascriptSync("interface.test()"));
     }
 
     private final class TestPictureListener implements PictureListener {
diff --git a/tests/tests/widget/res/layout/textview_selectallonfocus.xml b/tests/tests/widget/res/layout/textview_selectallonfocus.xml
index b1c3682..af292b0 100644
--- a/tests/tests/widget/res/layout/textview_selectallonfocus.xml
+++ b/tests/tests/widget/res/layout/textview_selectallonfocus.xml
@@ -35,7 +35,7 @@
         android:selectAllOnFocus="false"
         android:focusable="true"/>
 
-        <TextView android:id="@+id/selectAllOnFocus_dummy"
+        <TextView android:id="@+id/selectAllOnFocus_placeholder"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:focusable="true"/>
diff --git a/tests/tests/widget/src/android/widget/cts/TextViewTest.java b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
index 35db2c9..a45d585 100644
--- a/tests/tests/widget/src/android/widget/cts/TextViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/TextViewTest.java
@@ -738,7 +738,7 @@
         mTextView = findTextView(R.id.selectAllOnFocus_default);
         mTextView.setText(blank, BufferType.SPANNABLE);
         // change the focus
-        findTextView(R.id.selectAllOnFocus_dummy).requestFocus();
+        findTextView(R.id.selectAllOnFocus_placeholder).requestFocus();
         assertFalse(mTextView.isFocused());
         mTextView.requestFocus();
         assertTrue(mTextView.isFocused());
@@ -749,7 +749,7 @@
         mTextView.setText(content, BufferType.SPANNABLE);
         mTextView.setSelectAllOnFocus(true);
         // change the focus
-        findTextView(R.id.selectAllOnFocus_dummy).requestFocus();
+        findTextView(R.id.selectAllOnFocus_placeholder).requestFocus();
         assertFalse(mTextView.isFocused());
         mTextView.requestFocus();
         assertTrue(mTextView.isFocused());
@@ -760,7 +760,7 @@
         Selection.setSelection((Spannable) mTextView.getText(), 0);
         mTextView.setSelectAllOnFocus(false);
         // change the focus
-        findTextView(R.id.selectAllOnFocus_dummy).requestFocus();
+        findTextView(R.id.selectAllOnFocus_placeholder).requestFocus();
         assertFalse(mTextView.isFocused());
         mTextView.requestFocus();
         assertTrue(mTextView.isFocused());
@@ -771,7 +771,7 @@
         mTextView.setText(blank, BufferType.SPANNABLE);
         mTextView.setSelectAllOnFocus(true);
         // change the focus
-        findTextView(R.id.selectAllOnFocus_dummy).requestFocus();
+        findTextView(R.id.selectAllOnFocus_placeholder).requestFocus();
         assertFalse(mTextView.isFocused());
         mTextView.requestFocus();
         assertTrue(mTextView.isFocused());
@@ -782,7 +782,7 @@
         Selection.setSelection((Spannable) mTextView.getText(), 0);
         mTextView.setSelectAllOnFocus(false);
         // change the focus
-        findTextView(R.id.selectAllOnFocus_dummy).requestFocus();
+        findTextView(R.id.selectAllOnFocus_placeholder).requestFocus();
         assertFalse(mTextView.isFocused());
         mTextView.requestFocus();
         assertTrue(mTextView.isFocused());
@@ -5789,11 +5789,11 @@
     public void testSelectAllJustAfterTap() throws Throwable {
         // Prepare an EditText with focus.
         mActivityRule.runOnUiThread(() -> {
-            // Make a dummy focusable so that initial focus doesn't go to our test textview
+            // Make a placeholder focusable so that initial focus doesn't go to our test textview
             LinearLayout top = new LinearLayout(mActivity);
-            TextView dummy = new TextView(mActivity);
-            dummy.setFocusableInTouchMode(true);
-            top.addView(dummy, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+            TextView placeholder = new TextView(mActivity);
+            placeholder.setFocusableInTouchMode(true);
+            top.addView(placeholder, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
             mTextView = new EditText(mActivity);
             top.addView(mTextView, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
             mActivity.setContentView(top);
@@ -6951,11 +6951,11 @@
         final View.OnClickListener mockOnClickListener = mock(View.OnClickListener.class);
         final int safeDoubleTapTimeout = ViewConfiguration.getDoubleTapTimeout() + 1;
         mActivityRule.runOnUiThread(() -> {
-            // set up a dummy focusable so that initial focus doesn't go to our test textview
+            // set up a placeholder focusable so that initial focus doesn't go to our test textview
             LinearLayout top = new LinearLayout(mActivity);
-            TextView dummy = new TextView(mActivity);
-            dummy.setFocusableInTouchMode(true);
-            top.addView(dummy, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
+            TextView placeholder = new TextView(mActivity);
+            placeholder.setFocusableInTouchMode(true);
+            top.addView(placeholder, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
             mTextView = new TextView(mActivity);
             mTextView.setText("...text 11:11. some more text is in here...");
             mTextView.setFocusable(true);