Merge "Camera: Revise hardware level requirement for MPC" into android12-tests-dev
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index c642038..67e6b86 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -18,7 +18,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.android.cts.verifier"
           android:versionCode="5"
-          android:versionName="12_r12">
+          android:versionName="12_r13">
 
     <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31"/>
 
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 6bffc8b..e6f38a0 100755
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -3873,7 +3873,7 @@
         2. Go to OEM unlocking settings, if this device has this Settings option. It is often located under \"Developer options\".\n
         Confirm that:\n
            - Oem Unlocking is disabled.\n
-           - Enabling Oem unlocking is not possible and triggers a support message.\n\n
+           - Enabling Oem unlocking is not possible, and pressing the button or menu option to enable it triggers a support message (if pressing is possible).\n\n
         Return back to this page.
     </string>
     <string name="device_owner_user_restriction_set">Set restriction</string>
diff --git a/hostsidetests/car/src/android/car/cts/CarHostJUnit4TestCase.java b/hostsidetests/car/src/android/car/cts/CarHostJUnit4TestCase.java
index 8cc1552..d22a74c 100644
--- a/hostsidetests/car/src/android/car/cts/CarHostJUnit4TestCase.java
+++ b/hostsidetests/car/src/android/car/cts/CarHostJUnit4TestCase.java
@@ -267,6 +267,31 @@
     }
 
     /**
+     * Waits until the user switch to {@code userId} completes.
+     *
+     * <p>There is asynchronous part of a user switch after the core user switch. This method
+     * ensures a user switch to {@code userId} completes by {@code CarService}.
+     */
+    protected void waitForUserSwitchCompleted(int userId) throws Exception {
+        CommonTestUtils.waitUntil("timed out (" + DEFAULT_TIMEOUT_SEC
+                + "s) waiting for the last active userId to be " + userId
+                + ", but it is " + getLastActiveUserId(),
+                DEFAULT_TIMEOUT_SEC,
+                () -> getLastActiveUserId() == userId);
+    }
+
+    /**
+     * Gets the global settings value of android.car.LAST_ACTIVE_USER_ID, which is set by
+     * {@code CarUserService} when a user switch completes.
+     *
+     * @return userId of the current active user.
+     */
+    protected int getLastActiveUserId() throws Exception {
+        return executeAndParseCommand(output -> Integer.parseInt(output.trim()),
+                "cmd settings get global android.car.LAST_ACTIVE_USER_ID");
+    }
+
+    /**
      * Creates a full user with car service shell command.
      */
     protected int createFullUser(String name) throws Exception {
diff --git a/hostsidetests/car/src/android/car/cts/UiModeHostTest.java b/hostsidetests/car/src/android/car/cts/UiModeHostTest.java
index f0158f7..70820a4 100644
--- a/hostsidetests/car/src/android/car/cts/UiModeHostTest.java
+++ b/hostsidetests/car/src/android/car/cts/UiModeHostTest.java
@@ -16,8 +16,7 @@
 
 package android.car.cts;
 
-import static com.google.common.truth.Truth.assertThat;
-
+import com.android.compatibility.common.util.CommonTestUtils;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 
 import org.junit.Test;
@@ -31,6 +30,7 @@
 @RunWith(DeviceJUnit4ClassRunner.class)
 public final class UiModeHostTest extends CarHostJUnit4TestCase {
 
+    private static final int DEFAULT_TIMEOUT_SEC = 20;
     private static final Pattern NIGHT_MODE_REGEX = Pattern.compile("Night mode: (yes|no)");
 
     /**
@@ -46,46 +46,58 @@
 
         // start current user in day mode
         setDayMode();
-        assertThat(isNightMode()).isFalse();
+        waitUntilDayMode();
 
         // set to night mode
         setNightMode();
-        assertThat(isNightMode()).isTrue();
+        waitUntilNightMode();
 
         // switch to new user and verify night mode
         switchUser(newUserId);
-        assertThat(isNightMode()).isTrue();
+        waitForUserSwitchCompleted(newUserId);
+        waitUntilNightMode();
 
         // set to day mode
         setDayMode();
-        assertThat(isNightMode()).isFalse();
+        waitUntilDayMode();
 
-        // switch bach to initial user and verify day mode
+        // switch back to initial user and verify day mode
         switchUser(originalUserId);
-        assertThat(isNightMode()).isFalse();
+        waitForUserSwitchCompleted(originalUserId);
+        waitUntilDayMode();
     }
 
     /**
      * Sets the UI mode to day mode.
      */
-    protected void setDayMode() throws Exception {
+    private void setDayMode() throws Exception {
         executeCommand("cmd car_service day-night-mode day");
     }
 
     /**
      * Sets the UI mode to night mode.
      */
-    protected void setNightMode() throws Exception {
+    private void setNightMode() throws Exception {
         executeCommand("cmd car_service day-night-mode night");
     }
 
     /**
      * Returns true if the current UI mode is night mode, false otherwise.
      */
-    protected boolean isNightMode() throws Exception {
+    private boolean isNightMode() throws Exception {
         return executeAndParseCommand(NIGHT_MODE_REGEX,
                 "get night mode status failed",
                 matcher -> matcher.group(1).equals("yes"),
                 "cmd uimode night");
     }
+
+    private void waitUntilNightMode() throws Exception {
+        CommonTestUtils.waitUntil("timed out waiting for the night mode",
+                DEFAULT_TIMEOUT_SEC, () -> isNightMode());
+    }
+
+    private void waitUntilDayMode() throws Exception {
+        CommonTestUtils.waitUntil("timed out waiting for the day mode",
+                DEFAULT_TIMEOUT_SEC, () -> !isNightMode());
+    }
 }
diff --git a/hostsidetests/webkit/app/src/com/android/cts/webkit/WebViewDeviceSideMultipleProfileTest.java b/hostsidetests/webkit/app/src/com/android/cts/webkit/WebViewDeviceSideMultipleProfileTest.java
index f5e1775..502e311 100644
--- a/hostsidetests/webkit/app/src/com/android/cts/webkit/WebViewDeviceSideMultipleProfileTest.java
+++ b/hostsidetests/webkit/app/src/com/android/cts/webkit/WebViewDeviceSideMultipleProfileTest.java
@@ -17,20 +17,19 @@
 package com.android.cts.webkit;
 
 import android.app.admin.DeviceAdminReceiver;
-import android.util.Log;
 import android.webkit.WebView;
 import android.webkit.cts.WebViewSyncLoader;
 
 import androidx.test.annotation.UiThreadTest;
 import androidx.test.ext.junit.rules.ActivityScenarioRule;
 
+import com.android.compatibility.common.util.NullWebViewUtils;
+
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 
-import java.io.IOException;
-
 public class WebViewDeviceSideMultipleProfileTest {
     // Profile owner component.
     public static class BasicAdminReceiver extends DeviceAdminReceiver {}
@@ -51,6 +50,10 @@
     @Test
     @UiThreadTest
     public void testCreateWebViewAndNavigate() {
+        if (!NullWebViewUtils.isWebViewAvailable()) {
+            return;
+        }
+
         mActivity.createAndAttachWebView();
         WebView webView = mActivity.getWebView();
         Assert.assertNotNull(webView);
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java
index f0e3b67..d23e211 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDispatchTest.java
@@ -25,7 +25,6 @@
 import static android.accessibilityservice.cts.utils.GestureUtils.IS_ACTION_POINTER_UP;
 import static android.accessibilityservice.cts.utils.GestureUtils.IS_ACTION_UP;
 import static android.accessibilityservice.cts.utils.GestureUtils.add;
-import static android.accessibilityservice.cts.utils.GestureUtils.ceil;
 import static android.accessibilityservice.cts.utils.GestureUtils.click;
 import static android.accessibilityservice.cts.utils.GestureUtils.diff;
 import static android.accessibilityservice.cts.utils.GestureUtils.dispatchGesture;
@@ -56,11 +55,11 @@
 import android.accessibilityservice.cts.activities.AccessibilityTestActivity;
 import android.app.Instrumentation;
 import android.app.UiAutomation;
-import android.content.Context;
 import android.content.pm.PackageManager;
 import android.graphics.Matrix;
 import android.graphics.Path;
 import android.graphics.PointF;
+import android.graphics.Rect;
 import android.os.Bundle;
 import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
@@ -69,7 +68,6 @@
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewConfiguration;
-import android.view.WindowManager;
 import android.widget.TextView;
 
 import androidx.test.rule.ActivityTestRule;
@@ -88,8 +86,6 @@
 import java.util.List;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import android.graphics.Rect;
-
 /**
  * Verify that gestures dispatched from an accessibility service show up in the current UI
  */
@@ -196,7 +192,8 @@
         // Verify other MotionEvent fields in this test to make sure they get initialized.
         assertEquals(0, clickDown.getActionIndex());
         assertEquals(VIRTUAL_KEYBOARD, clickDown.getDeviceId());
-        assertEquals(MotionEvent.FLAG_IS_ACCESSIBILITY_EVENT, clickDown.getFlags());
+        assertEquals(MotionEvent.FLAG_IS_ACCESSIBILITY_EVENT,
+                clickDown.getFlags() & MotionEvent.FLAG_IS_ACCESSIBILITY_EVENT);
         assertEquals(0, clickDown.getEdgeFlags());
         assertEquals(1F, clickDown.getXPrecision(), 0F);
         assertEquals(1F, clickDown.getYPrecision(), 0F);
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
index eb9f037..9f49daf 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
@@ -26,6 +26,7 @@
 import static android.accessibilityservice.cts.utils.ActivityLaunchUtils.supportsMultiDisplay;
 import static android.accessibilityservice.cts.utils.AsyncUtils.DEFAULT_TIMEOUT_MS;
 import static android.accessibilityservice.cts.utils.DisplayUtils.VirtualDisplaySession;
+import static android.accessibilityservice.cts.utils.DisplayUtils.getNavBarHeight;
 import static android.accessibilityservice.cts.utils.DisplayUtils.getStatusBarHeight;
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMARY;
 import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
@@ -843,6 +844,7 @@
                 }, activity),
                 addWindow(R.string.button2, params -> {
                     params.gravity = Gravity.BOTTOM;
+                    params.y = getNavBarHeight(activity);
                 }, activity)
         };
     }
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/DisplayUtils.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/DisplayUtils.java
index 862b7b8..e0566f2 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/DisplayUtils.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/DisplayUtils.java
@@ -21,14 +21,13 @@
 import android.app.Activity;
 import android.content.Context;
 import android.graphics.PixelFormat;
-import android.graphics.Rect;
 import android.hardware.display.DisplayManager;
 import android.hardware.display.VirtualDisplay;
 import android.media.ImageReader;
 import android.os.Looper;
 import android.util.DisplayMetrics;
 import android.view.Display;
-import android.view.Window;
+import android.view.WindowInsets;
 
 import com.android.compatibility.common.util.TestUtils;
 
@@ -39,10 +38,13 @@
     private static final int DISPLAY_ADDED_TIMEOUT_MS = 5000;
 
     public static int getStatusBarHeight(Activity activity) {
-        final Rect rect = new Rect();
-        Window window = activity.getWindow();
-        window.getDecorView().getWindowVisibleDisplayFrame(rect);
-        return rect.top;
+        return activity.getWindow().getDecorView().getRootWindowInsets()
+                .getInsets(WindowInsets.Type.statusBars()).top;
+    }
+
+    public static int getNavBarHeight(Activity activity) {
+        return activity.getWindow().getDecorView().getRootWindowInsets()
+                .getInsets(WindowInsets.Type.statusBars()).bottom;
     }
 
     public static class VirtualDisplaySession implements AutoCloseable {
diff --git a/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java b/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
index a11de75..1779f9c 100644
--- a/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
+++ b/tests/tests/accounts/src/android/accounts/cts/AccountManagerUnaffiliatedAuthenticatorTests.java
@@ -23,8 +23,6 @@
 import android.accounts.OperationCanceledException;
 import android.accounts.cts.common.AuthenticatorContentProvider;
 import android.accounts.cts.common.Fixtures;
-import android.accounts.cts.common.tx.StartAddAccountSessionTx;
-import android.accounts.cts.common.tx.StartUpdateCredentialsSessionTx;
 import android.content.ContentProviderClient;
 import android.content.ContentResolver;
 import android.os.Bundle;
@@ -295,8 +293,6 @@
         assertTrue(future.isDone());
         assertNotNull(result);
 
-        validateStartAddAccountSessionParameters(options);
-
         // Validate that auth token was stripped from result.
         assertNull(result.get(AccountManager.KEY_AUTHTOKEN));
 
@@ -331,9 +327,6 @@
         Bundle result = future.getResult();
         assertTrue(future.isDone());
         assertNotNull(result);
-
-        validateStartUpdateCredentialsSessionParameters(options);
-
         // Validate no auth token in result.
         assertNull(result.get(AccountManager.KEY_AUTHTOKEN));
 
@@ -461,29 +454,6 @@
         }
     }
 
-    private void validateStartAddAccountSessionParameters(Bundle inOpt)
-            throws RemoteException {
-        Bundle params = mProviderClient.call(AuthenticatorContentProvider.METHOD_GET, null, null);
-        params.setClassLoader(StartAddAccountSessionTx.class.getClassLoader());
-        StartAddAccountSessionTx tx = params.<StartAddAccountSessionTx>getParcelable(
-                AuthenticatorContentProvider.KEY_TX);
-        assertEquals(tx.accountType, Fixtures.TYPE_STANDARD_UNAFFILIATED);
-        assertEquals(tx.options.getString(Fixtures.KEY_ACCOUNT_NAME),
-                inOpt.getString(Fixtures.KEY_ACCOUNT_NAME));
-    }
-
-    private void validateStartUpdateCredentialsSessionParameters(Bundle inOpt)
-            throws RemoteException {
-        Bundle params = mProviderClient.call(AuthenticatorContentProvider.METHOD_GET, null, null);
-        params.setClassLoader(StartUpdateCredentialsSessionTx.class.getClassLoader());
-        StartUpdateCredentialsSessionTx tx =
-                params.<StartUpdateCredentialsSessionTx>getParcelable(
-                        AuthenticatorContentProvider.KEY_TX);
-        assertEquals(tx.account, Fixtures.ACCOUNT_UNAFFILIATED_FIXTURE_SUCCESS);
-        assertEquals(tx.options.getString(Fixtures.KEY_ACCOUNT_NAME),
-                inOpt.getString(Fixtures.KEY_ACCOUNT_NAME));
-    }
-
     private Bundle createOptionsWithAccountName(final String accountName) {
         Bundle options = new Bundle();
         options.putString(Fixtures.KEY_ACCOUNT_NAME, accountName);
diff --git a/tests/tests/content/AndroidTest.xml b/tests/tests/content/AndroidTest.xml
index c03dd80..6b9f451 100644
--- a/tests/tests/content/AndroidTest.xml
+++ b/tests/tests/content/AndroidTest.xml
@@ -24,6 +24,13 @@
 
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
 
+    <target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
+        <option name="force-skip-system-props" value="true" />
+        <option name="set-global-setting" key="verifier_engprod" value="1" />
+        <option name="set-global-setting" key="verifier_verify_adb_installs" value="0" />
+        <option name="restore-settings" value="true" />
+    </target_preparer>
+
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
         <option name="run-command" value="mkdir -p /data/local/tmp/cts/content" />
         <option name="teardown-command" value="rm -rf /data/local/tmp/cts"/>
diff --git a/tests/tests/content/src/android/content/pm/cts/ChecksumsTest.java b/tests/tests/content/src/android/content/pm/cts/ChecksumsTest.java
index fa9f14e..5a9d5bd 100644
--- a/tests/tests/content/src/android/content/pm/cts/ChecksumsTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/ChecksumsTest.java
@@ -16,6 +16,9 @@
 
 package android.content.pm.cts;
 
+import static android.Manifest.permission.INSTALL_PACKAGES;
+import static android.Manifest.permission.USE_INSTALLER_V2;
+import static android.Manifest.permission.USE_SYSTEM_DATA_LOADERS;
 import static android.content.pm.Checksum.TYPE_PARTIAL_MERKLE_ROOT_1M_SHA256;
 import static android.content.pm.Checksum.TYPE_PARTIAL_MERKLE_ROOT_1M_SHA512;
 import static android.content.pm.Checksum.TYPE_WHOLE_MD5;
@@ -491,7 +494,7 @@
 
     @Test
     public void testInstallerSignedChecksumsInvalidSignature() throws Exception {
-        getUiAutomation().adoptShellPermissionIdentity();
+        adoptShellPermissionIdentity();
         try {
             final PackageInstaller installer = getPackageInstaller();
             final SessionParams params = new SessionParams(SessionParams.MODE_FULL_INSTALL);
@@ -507,7 +510,7 @@
                 // expected
             }
         } finally {
-            getUiAutomation().dropShellPermissionIdentity();
+            dropShellPermissionIdentity();
         }
     }
 
@@ -674,7 +677,7 @@
         final Certificate installerCertificate = getInstallerCertificate();
 
         // Original package checksums: base + split0.
-        getUiAutomation().adoptShellPermissionIdentity();
+        adoptShellPermissionIdentity();
         try {
             final PackageInstaller installer = getPackageInstaller();
             final SessionParams params = new SessionParams(SessionParams.MODE_FULL_INSTALL);
@@ -692,7 +695,7 @@
             session.commit(receiver.getIntentSender());
             CommitIntentReceiver.checkSuccess(receiver.getResult());
         } finally {
-            getUiAutomation().dropShellPermissionIdentity();
+            dropShellPermissionIdentity();
         }
 
         {
@@ -739,7 +742,7 @@
         }
 
         // Update the package with one split+checksums and another split without checksums.
-        getUiAutomation().adoptShellPermissionIdentity();
+        adoptShellPermissionIdentity();
         try {
             final PackageInstaller installer = getPackageInstaller();
             final SessionParams params = new SessionParams(SessionParams.MODE_INHERIT_EXISTING);
@@ -757,7 +760,7 @@
             session.commit(receiver.getIntentSender());
             CommitIntentReceiver.checkSuccess(receiver.getResult());
         } finally {
-            getUiAutomation().dropShellPermissionIdentity();
+            dropShellPermissionIdentity();
         }
 
         {
@@ -856,7 +859,7 @@
         final Certificate certificate = readCertificate();
 
         // Original package checksums: base + split0.
-        getUiAutomation().adoptShellPermissionIdentity();
+        adoptShellPermissionIdentity();
         try {
             final PackageInstaller installer = getPackageInstaller();
             final SessionParams params = new SessionParams(SessionParams.MODE_FULL_INSTALL);
@@ -874,7 +877,7 @@
             session.commit(receiver.getIntentSender());
             CommitIntentReceiver.checkSuccess(receiver.getResult());
         } finally {
-            getUiAutomation().dropShellPermissionIdentity();
+            dropShellPermissionIdentity();
         }
 
         {
@@ -921,7 +924,7 @@
         }
 
         // Update the package with one split+checksums and another split without checksums.
-        getUiAutomation().adoptShellPermissionIdentity();
+        adoptShellPermissionIdentity();
         try {
             final PackageInstaller installer = getPackageInstaller();
             final SessionParams params = new SessionParams(SessionParams.MODE_INHERIT_EXISTING);
@@ -939,7 +942,7 @@
             session.commit(receiver.getIntentSender());
             CommitIntentReceiver.checkSuccess(receiver.getResult());
         } finally {
-            getUiAutomation().dropShellPermissionIdentity();
+            dropShellPermissionIdentity();
         }
 
         {
@@ -1113,7 +1116,7 @@
 
     @Test
     public void testInstallerChecksumsDuplicate() throws Exception {
-        getUiAutomation().adoptShellPermissionIdentity();
+        adoptShellPermissionIdentity();
         try {
             final PackageInstaller installer = getPackageInstaller();
             final SessionParams params = new SessionParams(SessionParams.MODE_FULL_INSTALL);
@@ -1129,7 +1132,7 @@
                 // expected
             }
         } finally {
-            getUiAutomation().dropShellPermissionIdentity();
+            dropShellPermissionIdentity();
         }
     }
 
@@ -1165,7 +1168,7 @@
 
     private Intent installApkWithChecksums(String apk, String apkName,
             String checksumsName, Checksum[] checksums, byte[] signature) throws Exception {
-        getUiAutomation().adoptShellPermissionIdentity();
+        adoptShellPermissionIdentity();
         try {
             final PackageInstaller installer = getPackageInstaller();
             final SessionParams params = new SessionParams(SessionParams.MODE_FULL_INSTALL);
@@ -1179,7 +1182,7 @@
             session.commit(receiver.getIntentSender());
             return receiver.getResult();
         } finally {
-            getUiAutomation().dropShellPermissionIdentity();
+            dropShellPermissionIdentity();
         }
     }
 
@@ -1190,7 +1193,7 @@
 
     private void installApkWithChecksumsIncrementally(final String inPath, final String apk,
             final Checksum[] checksums, final byte[] signature) throws Exception {
-        getUiAutomation().adoptShellPermissionIdentity();
+        adoptShellPermissionIdentity();
         try {
             final PackageInstaller installer = getPackageInstaller();
             final SessionParams params = new SessionParams(SessionParams.MODE_FULL_INSTALL);
@@ -1212,7 +1215,7 @@
             session.commit(receiver.getIntentSender());
             CommitIntentReceiver.checkSuccess(receiver.getResult());
         } finally {
-            getUiAutomation().dropShellPermissionIdentity();
+            dropShellPermissionIdentity();
         }
     }
 
@@ -1356,6 +1359,17 @@
         }
     }
 
+    private void adoptShellPermissionIdentity() {
+        // For non-shell/non-root/non-system uids, USE_SYSTEM_DATA_LOADERS means
+        // "install-related test adapted shell identity".
+        getUiAutomation().adoptShellPermissionIdentity(INSTALL_PACKAGES, USE_SYSTEM_DATA_LOADERS,
+                USE_INSTALLER_V2);
+    }
+
+    private void dropShellPermissionIdentity() {
+        getUiAutomation().dropShellPermissionIdentity();
+    }
+
     private static class LocalListener implements PackageManager.OnChecksumsReadyListener {
         private final LinkedBlockingQueue<ApkChecksum[]> mResult = new LinkedBlockingQueue<>();
 
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/GoogleAtvReferenceRemoteControlTest.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/GoogleAtvReferenceRemoteControlTest.java
index 1afad38..4200bc4 100755
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/GoogleAtvReferenceRemoteControlTest.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/GoogleAtvReferenceRemoteControlTest.java
@@ -16,7 +16,6 @@
 
 package android.hardware.input.cts.tests;
 
-import android.content.Intent;
 import android.hardware.cts.R;
 import android.server.wm.WindowManagerStateHelper;
 
@@ -49,11 +48,6 @@
     public void testHomeKey() {
         testInputEvents(R.raw.google_atvreferenceremote_homekey);
         WindowManagerStateHelper wmStateHelper = new WindowManagerStateHelper();
-        Intent intent = new Intent();
-        intent.addCategory(Intent.CATEGORY_HOME);
-        intent.setAction(Intent.ACTION_MAIN);
-        mActivityRule.getActivity().startActivity(intent);
-
         wmStateHelper.waitForHomeActivityVisible();
         wmStateHelper.assertHomeActivityVisible(true);
     }
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/RazerRaijuMobileBluetoothTest.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/RazerRaijuMobileBluetoothTest.java
index d27c96c..a55c3b6 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/RazerRaijuMobileBluetoothTest.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/RazerRaijuMobileBluetoothTest.java
@@ -16,7 +16,6 @@
 
 package android.hardware.input.cts.tests;
 
-import android.content.Intent;
 import android.hardware.cts.R;
 import android.server.wm.WindowManagerStateHelper;
 import android.view.KeyEvent;
@@ -55,12 +54,6 @@
     public void testHomeKey() throws Exception {
         mActivityRule.getActivity().addUnhandleKeyCode(KeyEvent.KEYCODE_BUTTON_MODE);
         testInputEvents(R.raw.razer_raiju_mobile_bluetooth_homekey);
-        // Put DUT on home screen
-        Intent intent = new Intent();
-        intent.addCategory(Intent.CATEGORY_HOME);
-        intent.setAction(Intent.ACTION_MAIN);
-        mActivityRule.getActivity().startActivity(intent);
-
 
         WindowManagerStateHelper wmStateHelper = new WindowManagerStateHelper();
 
diff --git a/tests/tests/hardware/src/android/hardware/input/cts/tests/RazerServalTest.java b/tests/tests/hardware/src/android/hardware/input/cts/tests/RazerServalTest.java
index 1405530..030c030 100644
--- a/tests/tests/hardware/src/android/hardware/input/cts/tests/RazerServalTest.java
+++ b/tests/tests/hardware/src/android/hardware/input/cts/tests/RazerServalTest.java
@@ -16,7 +16,6 @@
 
 package android.hardware.input.cts.tests;
 
-import android.content.Intent;
 import android.hardware.cts.R;
 import android.server.wm.WindowManagerStateHelper;
 
@@ -55,12 +54,6 @@
     public void testHomeKey() {
         testInputEvents(R.raw.razer_serval_homekey);
         WindowManagerStateHelper wmStateHelper = new WindowManagerStateHelper();
-        // Put DUT on home screen
-        Intent intent = new Intent();
-        intent.addCategory(Intent.CATEGORY_HOME);
-        intent.setAction(Intent.ACTION_MAIN);
-        mActivityRule.getActivity().startActivity(intent);
-
 
         wmStateHelper.waitForHomeActivityVisible();
         wmStateHelper.assertHomeActivityVisible(true);
diff --git a/tests/tests/icu/AndroidManifest.xml b/tests/tests/icu/AndroidManifest.xml
index 418c215..5e9fcd6 100644
--- a/tests/tests/icu/AndroidManifest.xml
+++ b/tests/tests/icu/AndroidManifest.xml
@@ -18,7 +18,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="android.icu.cts">
 
-    <application>
+    <!-- b/323694623 RBBIMonkeyTest needs a larger heap. -->
+    <application android:largeHeap="true">
         <uses-library android:name="android.test.runner" />
     </application>
 
diff --git a/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java b/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java
index 09076ac..7396023 100644
--- a/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java
+++ b/tests/tests/media/src/android/media/cts/AdaptivePlaybackTest.java
@@ -1405,11 +1405,14 @@
 
         Log.i(TAG, "format=" + media.getFormat());
         ArrayList<ByteBuffer> csds = new ArrayList<ByteBuffer>();
-        for (String tag: new String[] { "csd-0", "csd-1" }) {
-            if (media.getFormat().containsKey(tag)) {
-                ByteBuffer csd = media.getFormat().getByteBuffer(tag);
-                Log.i(TAG, tag + "=" + AdaptivePlaybackTest.byteBufferToString(csd, 0, 16));
-                csds.add(csd);
+        // CSD in VP9 can not be combined with frame data
+        if (!media.getMime().equals(MediaFormat.MIMETYPE_VIDEO_VP9)) {
+            for (String tag: new String[] { "csd-0", "csd-1" }) {
+                if (media.getFormat().containsKey(tag)) {
+                    ByteBuffer csd = media.getFormat().getByteBuffer(tag);
+                    Log.i(TAG, tag + "=" + AdaptivePlaybackTest.byteBufferToString(csd, 0, 16));
+                    csds.add(csd);
+                }
             }
         }
 
diff --git a/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt b/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt
index b517298..a67e00b 100644
--- a/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt
+++ b/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt
@@ -37,6 +37,7 @@
 import org.junit.Assert.*
 import org.junit.Assume.assumeFalse
 import org.junit.Assume.assumeTrue
+import org.junit.AssumptionViolatedException;
 import org.junit.Before
 import org.junit.Rule
 import org.junit.Test
@@ -200,12 +201,17 @@
         try {
             eventually {
                 val privacyChip = uiDevice.findObject(By.res(PRIVACY_CHIP_ID))
-                assertNotNull("view with id $PRIVACY_CHIP_ID not found", privacyChip)
+                assumeTrue("view with id $PRIVACY_CHIP_ID not found", privacyChip !== null)
                 privacyChip.click()
                 chipFound = true
             }
         } catch (e: Exception) {
-            // Handle more gracefully below
+            val cause = e.cause
+            if (cause is AssumptionViolatedException) {
+                throw cause
+            }
+
+            // Handle other exceptions more gracefully below
         }
 
         if (useMic) {
diff --git a/tests/tests/security/src/android/security/cts/CertificateData.java b/tests/tests/security/src/android/security/cts/CertificateData.java
index e3c45b9..dda846e 100644
--- a/tests/tests/security/src/android/security/cts/CertificateData.java
+++ b/tests/tests/security/src/android/security/cts/CertificateData.java
@@ -77,7 +77,46 @@
       "28:90:3A:63:5B:52:80:FA:E6:77:4C:0B:6D:A7:D6:BA:A6:4A:F2:E8",
       "3B:C0:38:0B:33:C3:F6:A6:0C:86:15:22:93:D9:DF:F5:4B:81:C0:04",
       "D2:73:96:2A:2A:5E:39:9F:73:3F:E1:C7:1E:64:3F:03:38:34:FC:4D",
-      "E1:C9:50:E6:EF:22:F8:4C:56:45:72:8B:92:20:60:D7:D5:A7:A3:E8"
+      "E1:C9:50:E6:EF:22:F8:4C:56:45:72:8B:92:20:60:D7:D5:A7:A3:E8",
+      "F4:8B:11:BF:DE:AB:BE:94:54:20:71:E6:41:DE:6B:BE:88:2B:40:B9",
+      "B4:90:82:DD:45:0C:BE:8B:5B:B1:66:D3:E2:A4:08:26:CD:ED:42:CF",
+      "02:FA:F3:E2:91:43:54:68:60:78:57:69:4D:F5:E4:5B:68:85:18:68",
+      "76:E2:7E:C1:4F:DB:82:C1:C0:A6:75:B5:05:BE:3D:29:B4:ED:DB:BB",
+      "22:D5:D8:DF:8F:02:31:D1:8D:F7:9D:B7:CF:8A:2D:64:C9:3F:6C:3A",
+      "03:9E:ED:B8:0B:E7:A0:3C:69:53:89:3B:20:D2:D9:32:3A:4C:2A:FD",
+      "AA:DB:BC:22:23:8F:C4:01:A1:27:BB:38:DD:F4:1D:DB:08:9E:F0:12",
+      "1E:0E:56:19:0A:D1:8B:25:98:B2:04:44:FF:66:8A:04:17:99:5F:3F",
+      "2F:8F:36:4F:E1:58:97:44:21:59:87:A5:2A:9A:D0:69:95:26:7F:B5",
+      "DE:28:F4:A4:FF:E5:B9:2F:A3:C5:03:D1:A3:49:A7:F9:96:2A:82:12",
+      "13:2D:0D:45:53:4B:69:97:CD:B2:D5:C3:39:E2:55:76:60:9B:5C:C6",
+      "59:AF:82:79:91:86:C7:B4:75:07:CB:CF:03:57:46:EB:04:DD:B7:16",
+      "C9:A8:B9:E7:55:80:5E:58:E3:53:77:A7:25:EB:AF:C3:7B:27:CC:D7",
+      "37:9A:19:7B:41:85:45:35:0C:A6:03:69:F3:3C:2E:AF:47:4F:20:79",
+      "4E:B6:D5:78:49:9B:1C:CF:5F:58:1E:AD:56:BE:3D:9B:67:44:A5:E5",
+      "E6:21:F3:35:43:79:05:9A:4B:68:30:9D:8A:2F:74:22:15:87:EC:79",
+      "32:3C:11:8E:1B:F7:B8:B6:52:54:E2:E2:10:0D:D6:02:90:37:F0:96",
+      "91:C6:D6:EE:3E:8A:C8:63:84:E5:48:C2:99:29:5C:75:6C:81:7B:81",
+      "59:22:A1:E1:5A:EA:16:35:21:F8:98:39:6A:46:46:B0:44:1B:0F:A9",
+      "8F:6B:F2:A9:27:4A:DA:14:A0:C4:F4:8E:61:27:F9:C0:1E:78:5D:D1",
+      "26:F9:93:B4:ED:3D:28:27:B0:B9:4B:A7:E9:15:1D:A3:8D:92:E5:32",
+      "99:9A:64:C3:7F:F4:7D:9F:AB:95:F1:47:69:89:14:60:EE:C4:C3:C5", 
+      "73:A5:E6:4A:3B:FF:83:16:FF:0E:DC:CC:61:8A:90:6E:4E:AE:4D:74",
+      "E7:F3:A3:C8:CF:6F:C3:04:2E:6D:0E:67:32:C5:9E:68:95:0D:5E:D2",
+      "89:D4:83:03:4F:9E:9A:48:80:5F:72:37:D4:A9:A6:EF:CB:7C:1F:D1",
+      "F1:8B:53:8D:1B:E9:03:B6:A6:F0:56:43:5B:17:15:89:CA:F3:6B:F2",
+      "E1:C9:50:E6:EF:22:F8:4C:56:45:72:8B:92:20:60:D7:D5:A7:A3:E8",
+      "57:73:A5:61:5D:80:B2:E6:AC:38:82:FC:68:07:31:AC:9F:B5:92:5A",
+      "18:52:3B:0D:06:37:E4:D6:3A:DF:23:E4:98:FB:5B:16:FB:86:74:48",
+      "EC:2C:83:40:72:AF:26:95:10:FF:0E:F2:03:EE:31:70:F6:78:9D:CA",
+      "9E:BC:75:10:42:B3:02:F3:81:F4:F7:30:62:D4:8F:C3:A7:51:B2:DD",
+      "3C:3F:EF:57:0F:FE:65:93:86:9E:A0:FE:B0:F6:ED:8E:D1:13:C7:E5",
+      "EC:8A:39:6C:40:F0:2E:BC:42:75:D4:9F:AB:1C:1A:5B:67:BE:D2:9A",
+      "07:86:C0:D8:DD:8E:C0:80:98:06:98:D0:58:7A:EF:DE:A6:CC:A2:5D",
+      "6D:0A:5F:F7:B4:23:06:B4:85:B3:B7:97:64:FC:AC:75:F5:33:F2:93",
+      "63:CF:B6:C1:27:2B:56:E4:88:8E:1C:23:9A:B6:2E:81:47:24:C3:C7",
+      "9F:5F:D9:1A:54:6D:F5:0C:71:F0:EE:7A:BD:17:49:98:84:73:E2:39",
+      "AD:98:F9:F3:E4:7D:75:3B:65:D4:82:B3:A4:52:17:BB:6E:F5:E4:38",
+      "EA:B0:E2:52:1B:89:93:4C:11:68:F2:D8:9A:AC:22:4C:A3:8A:57:AE"
   };
 
   static final String[] CERTIFICATE_DATA = {
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 e0df06e..3ca372c 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/SmsUsageMonitorShortCodeTest.java
@@ -71,10 +71,17 @@
             new ShortCodeTest("al", "55600", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("al", "654321", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("ae", "625315", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ae", "6211", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ae", "6253", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("am", "112", expectedReturnCode("112")),
             new ShortCodeTest("am", "101", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("am", "102", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("am", "103", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("am", "71522", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("am", "71512", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("am", "71502", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("am", "222", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("am", "1111", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("am", "9999", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -82,6 +89,13 @@
             new ShortCodeTest("am", "1141", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("am", "1161", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("am", "3024", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("am", "715224", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("am", "71523", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+
+            new ShortCodeTest("ar", "1912892", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ar", "191287", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ar", "191289", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("ar", "39010", SMS_CATEGORY_FREE_SHORT_CODE),
 
             new ShortCodeTest("at", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("at", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
@@ -125,6 +139,10 @@
             new ShortCodeTest("bg", "1935", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("bg", "18423", SMS_CATEGORY_PREMIUM_SHORT_CODE),
 
+            new ShortCodeTest("br", "265262", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("br", "2654", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("br", "2652", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("by", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("by", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("by", "3336", SMS_CATEGORY_PREMIUM_SHORT_CODE),
@@ -156,6 +174,14 @@
             new ShortCodeTest("cn", "1065123456", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("cn", "1066335588", SMS_CATEGORY_PREMIUM_SHORT_CODE),
 
+            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("cr", "4664537", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("cr", "466458", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("cr", "466453", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("cy", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("cy", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("cy", "4321", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -196,6 +222,15 @@
             new ShortCodeTest("dk", "16123", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("dk", "987654321", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("do", "9128922", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("do", "912898", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("do", "912892", SMS_CATEGORY_FREE_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),
+            new ShortCodeTest("ec", "18512", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("ee", "112", expectedReturnCode("112")),
             new ShortCodeTest("ee", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("ee", "123", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -230,6 +265,7 @@
             new ShortCodeTest("fr", "45678", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             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("gb", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("gb", "999", SMS_CATEGORY_NOT_SHORT_CODE),
@@ -249,6 +285,15 @@
             new ShortCodeTest("ge", "8013", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("ge", "8014", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("ge", "8889", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ge", "95201", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("ge", "95202", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("ge", "95203", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("ge", "95208", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ge", "952014", SMS_CATEGORY_NOT_SHORT_CODE),
+
+            new ShortCodeTest("gh", "377789", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("gh", "3775", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("gh", "3777", SMS_CATEGORY_FREE_SHORT_CODE),
 
             new ShortCodeTest("gr", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("gr", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
@@ -257,6 +302,10 @@
             new ShortCodeTest("gr", "19678", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("gr", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("gt", "4664548", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("gt", "466459", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("gt", "466453", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("hu", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("hu", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("hu", "012", SMS_CATEGORY_NOT_SHORT_CODE),
@@ -272,6 +321,10 @@
             new ShortCodeTest("hu", "2345678901", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("hu", "01234567890", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("hn", "4664599", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("hn", "466499", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("hn", "466453", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("ie", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("ie", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("ie", "50123", SMS_CATEGORY_FREE_SHORT_CODE),
@@ -285,7 +338,18 @@
             new ShortCodeTest("il", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("il", "4422", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("il", "4545", SMS_CATEGORY_PREMIUM_SHORT_CODE),
-            new ShortCodeTest("il", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("il", "987651", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("il", "374771", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("il", "37499", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("il", "37477", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("il", "668191", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("il", "6688", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("il", "6681", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("ir", "7007924", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ir", "700799", 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("it", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("it", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
@@ -319,6 +383,21 @@
             new ShortCodeTest("kz", "7790", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("kz", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("ke", "240889", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ke", "24099", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ke", "24088", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("ke", "230549", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ke", "23059", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ke", "23054", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("kw", "509761", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("kw", "50979", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("kw", "50976", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("id", "992626", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("id", "99268", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("id", "99265", 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),
@@ -344,11 +423,30 @@
             new ShortCodeTest("lv", "1874", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("lv", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("ma", "538191", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ma", "53899", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ma", "53819", SMS_CATEGORY_FREE_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),
+            new ShortCodeTest("mn", "45678", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("mn", "445566", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("mx", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("mx", "2345", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("mx", "7766", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("mx", "23456", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("mx", "53035", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("mx", "550399", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("mx", "550346", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("mx", "30303025", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("mx", "3030302", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("mx", "3030303", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("mw", "427611", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("mw", "4279", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("mw", "4276", SMS_CATEGORY_FREE_SHORT_CODE),
 
             new ShortCodeTest("my", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("my", "1234", SMS_CATEGORY_NOT_SHORT_CODE),
@@ -356,6 +454,19 @@
             new ShortCodeTest("my", "32298", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("my", "33776", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("my", "345678", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("my", "66966", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("mz", "171491", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("mz", "1715", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("mz", "1714", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("na", "400059", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("na", "40009", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("na", "40005", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("ni", "4664599", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ni", "466499", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ni", "466453", SMS_CATEGORY_FREE_SHORT_CODE),
 
             new ShortCodeTest("nl", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("nl", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
@@ -379,6 +490,16 @@
             new ShortCodeTest("nz", "8995", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("nz", "23456", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("pe", "3013031", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("pe", "301307", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("pe", "301303", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("pk", "9092345", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("pk", "90958", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("pk", "9092", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("pk", "909203", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("pk", "909201", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+
             new ShortCodeTest("pl", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("pl", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("pl", "7890", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -389,6 +510,10 @@
             new ShortCodeTest("pl", "92525", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("pl", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("ps", "662134", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ps", "6691", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ps", "6681", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("pt", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("pt", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("pt", "61000", SMS_CATEGORY_PREMIUM_SHORT_CODE),
@@ -397,6 +522,10 @@
             new ShortCodeTest("pt", "69876", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("pt", "87654321", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("py", "1912891", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("py", "191286", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("py", "191289", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("ro", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("ro", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("ro", "1234", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
@@ -415,6 +544,10 @@
             new ShortCodeTest("ru", "7781", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("ru", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("rw", "50623", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("rw", "5065", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("rw", "5061", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("se", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("se", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("se", "1234", SMS_CATEGORY_NOT_SHORT_CODE),
@@ -437,6 +570,11 @@
             new ShortCodeTest("si", "3838", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("si", "72999", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("sn", "212159", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("sn", "21299", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("sn", "21215", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("sn", "21098", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("sk", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("sk", "116117", SMS_CATEGORY_FREE_SHORT_CODE),
             new ShortCodeTest("sk", "1234", SMS_CATEGORY_PREMIUM_SHORT_CODE),
@@ -444,6 +582,10 @@
             new ShortCodeTest("sk", "7604", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("sk", "72999", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            new ShortCodeTest("sv", "4664599", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("sv", "466499", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("sv", "466453", SMS_CATEGORY_FREE_SHORT_CODE),
+
             new ShortCodeTest("tj", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("tj", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("tj", "1161", SMS_CATEGORY_PREMIUM_SHORT_CODE),
@@ -452,6 +594,18 @@
             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("tn", "85765", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("tn", "85799", 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("ua", "112", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("ua", "5432", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
             new ShortCodeTest("ua", "4448", SMS_CATEGORY_PREMIUM_SHORT_CODE),
@@ -459,6 +613,10 @@
             new ShortCodeTest("ua", "7540", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("ua", "98765", SMS_CATEGORY_NOT_SHORT_CODE),
 
+            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("us", "911", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("us", "+18005551234", SMS_CATEGORY_NOT_SHORT_CODE),
             new ShortCodeTest("us", "8005551234", SMS_CATEGORY_NOT_SHORT_CODE),
@@ -469,6 +627,35 @@
             new ShortCodeTest("us", "21472", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("us", "23333", SMS_CATEGORY_PREMIUM_SHORT_CODE),
             new ShortCodeTest("us", "99807", SMS_CATEGORY_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("us", "9683999", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("us", "968319", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("us", "96831", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("uy", "55003", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("uy", "55002", SMS_CATEGORY_FREE_SHORT_CODE),
+            new ShortCodeTest("uy", "1912896", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("uy", "191238", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("uy", "191289", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("vn", "807982", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("vn", "8078", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("vn", "8079", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("ve", "5383526", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ve", "538358", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ve", "538352", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("ye", "50824", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("ye", "5084", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("ye", "5081", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("za", "330092", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("za", "33001", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("za", "33009", SMS_CATEGORY_FREE_SHORT_CODE),
+
+            new ShortCodeTest("zw", "336791", SMS_CATEGORY_NOT_SHORT_CODE),
+            new ShortCodeTest("zw", "33642", SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE),
+            new ShortCodeTest("zw", "33679", SMS_CATEGORY_FREE_SHORT_CODE),
 
             // generic rules for other countries: 5 digits or less considered potential short code
             new ShortCodeTest("zz", "2000000", SMS_CATEGORY_NOT_SHORT_CODE),
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java
index 352e31c..cc0f898 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/EdgeEffectTests.java
@@ -706,6 +706,7 @@
             EdgeEffect edgeEffect = new EdgeEffect(getContext());
             edgeEffect.setSize(WIDTH, HEIGHT);
             initializer.initialize(edgeEffect);
+            sleepAnimationTime(timeBetweenFrames);
             RenderNode renderNode1 = drawEdgeEffect(edgeEffect, 0, 0);
             float oldStretch = getStretchDownPixelCount(renderNode1);
             for (int i = 0; i < 3; i++) {
diff --git a/tests/tests/vcn/AndroidManifest.xml b/tests/tests/vcn/AndroidManifest.xml
index ac0625c..3324d96 100644
--- a/tests/tests/vcn/AndroidManifest.xml
+++ b/tests/tests/vcn/AndroidManifest.xml
@@ -27,6 +27,8 @@
     <uses-permission android:name="android.permission.INTERNET"/>
     <!--Allow tests to read telephony configurations -->
     <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+    <!--Allow tests to set global settings -->
+    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
 
     <application android:label="CtsVcnTestCases">
         <uses-library android:name="android.test.runner" />
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 9670611..b87fb9b 100644
--- a/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
+++ b/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
@@ -17,6 +17,9 @@
 package android.net.vcn.cts;
 
 import static android.content.pm.PackageManager.FEATURE_TELEPHONY;
+import static android.net.ConnectivitySettingsManager.CAPTIVE_PORTAL_MODE_PROMPT;
+import static android.net.ConnectivitySettingsManager.getCaptivePortalMode;
+import static android.net.ConnectivitySettingsManager.setCaptivePortalMode;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_METERED;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VCN_MANAGED;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_VALIDATED;
@@ -95,6 +98,7 @@
     private final SubscriptionManager mSubscriptionManager;
     private final TelephonyManager mTelephonyManager;
     private final ConnectivityManager mConnectivityManager;
+    private final int mOldCaptivePortalMode;
 
     private TestNetworkWrapper mTestNetworkWrapper;
 
@@ -104,6 +108,7 @@
         mSubscriptionManager = mContext.getSystemService(SubscriptionManager.class);
         mTelephonyManager = mContext.getSystemService(TelephonyManager.class);
         mConnectivityManager = mContext.getSystemService(ConnectivityManager.class);
+        mOldCaptivePortalMode = getCaptivePortalMode(mContext, CAPTIVE_PORTAL_MODE_PROMPT);
     }
 
     @Before
@@ -111,6 +116,9 @@
         assumeTrue(mContext.getPackageManager().hasSystemFeature(FEATURE_TELEPHONY));
 
         getInstrumentation().getUiAutomation().adoptShellPermissionIdentity();
+
+        // Ensure Internet probing check will be performed on VCN networks
+        setCaptivePortalMode(mContext, CAPTIVE_PORTAL_MODE_PROMPT);
     }
 
     @After
@@ -121,6 +129,7 @@
                 mTestNetworkWrapper = null;
             }
         } finally {
+            setCaptivePortalMode(mContext, mOldCaptivePortalMode);
             getInstrumentation().getUiAutomation().dropShellPermissionIdentity();
         }
     }
diff --git a/tests/tests/voiceRecognition/src/android/voicerecognition/cts/RecognitionServiceMicIndicatorTest.java b/tests/tests/voiceRecognition/src/android/voicerecognition/cts/RecognitionServiceMicIndicatorTest.java
index 138b897..26332e7 100644
--- a/tests/tests/voiceRecognition/src/android/voicerecognition/cts/RecognitionServiceMicIndicatorTest.java
+++ b/tests/tests/voiceRecognition/src/android/voicerecognition/cts/RecognitionServiceMicIndicatorTest.java
@@ -216,7 +216,13 @@
 
         final UiObject2 privacyChip =
                 mUiDevice.findObject(By.res(PRIVACY_CHIP_PACKAGE_NAME, PRIVACY_CHIP_ID));
-        assertWithMessage("Can not find mic indicator").that(privacyChip).isNotNull();
+        if (isCar()) {
+            assumeTrue(
+                    "A target automotive device implementation doesn't implement the privacy chip.",
+                    privacyChip != null);
+        } else {
+            assertWithMessage("Can not find mic indicator").that(privacyChip).isNotNull();
+        }
 
         // Click the privacy indicator and verify the calling app name display status in the dialog.
         privacyChip.click();
@@ -226,8 +232,8 @@
         String contentId = isCar() ? CAR_PRIVACY_DIALOG_CONTENT_ID : PRIVACY_DIALOG_CONTENT_ID;
         List<UiObject2> recognitionCallingAppLabels = mUiDevice.findObjects(
                 By.res(PRIVACY_DIALOG_PACKAGE_NAME, contentId));
-        assertWithMessage("No permission dialog shown after clicking  privacy chip.").that(
-                recognitionCallingAppLabels).isNotEmpty();
+        assumeTrue("No permission dialog shown after clicking  privacy chip.",
+                !recognitionCallingAppLabels.isEmpty());
 
         // get dialog content
         final String dialogDescription =
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
index 4180165..6fb6342 100755
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewTest.java
@@ -1833,6 +1833,12 @@
         getInstrumentation().sendPointerSync(
                 MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN,
                         middleX, middleY, 0));
+
+        time = SystemClock.uptimeMillis();
+        getInstrumentation().sendPointerSync(
+                MotionEvent.obtain(time, time, MotionEvent.ACTION_UP,
+                        middleX, middleY, 0));
+
         getInstrumentation().waitForIdleSync();
         mOnUiThread.requestImageRef(msg);
         new PollingCheck() {
diff --git a/tests/tests/wifi/src/android/net/wifi/cts/ScanResultTest.java b/tests/tests/wifi/src/android/net/wifi/cts/ScanResultTest.java
index 98ba803..15358fa 100644
--- a/tests/tests/wifi/src/android/net/wifi/cts/ScanResultTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/cts/ScanResultTest.java
@@ -199,7 +199,9 @@
                     ScanResult.WIFI_STANDARD_LEGACY,
                     ScanResult.WIFI_STANDARD_11N,
                     ScanResult.WIFI_STANDARD_11AC,
-                    ScanResult.WIFI_STANDARD_11AX
+                    ScanResult.WIFI_STANDARD_11AX,
+                    ScanResult.WIFI_STANDARD_11AD,
+                    8
             );
 
             scanResult.isPasspointNetwork();
diff --git a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
index a8735d4..2c55f05 100644
--- a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
@@ -3351,11 +3351,11 @@
     }
 
     /**
-     * Test that {@link WifiManager#getCurrentNetwork()} returns a Network obeject consistent
-     * with {@link ConnectivityManager#registerNetworkCallback} when connected to a Wifi network,
-     * and returns null when not connected.
+     * Helper function to test getCurrentNetwork
+     * @param shouldDisableWifi true to disable wifi, false to disconnect
+     * @throws Exception
      */
-    public void testGetCurrentNetwork() throws Exception {
+    private void testGetCurrentNetwork(boolean shouldDisableWifi) throws Exception {
         if (!WifiFeature.isWifiSupported(getContext())) {
             // skip the test if WiFi is not supported
             return;
@@ -3364,10 +3364,16 @@
         // ensure Wifi is connected
         ShellIdentityUtils.invokeWithShellPermissions(() -> mWifiManager.reconnect());
         PollingCheck.check(
-                "Wifi not connected - Please ensure there is a saved network in range of this "
-                        + "device",
+                "Connection info network id is invalid - Please ensure there is a " +
+                " saved network in range of this device",
                 WIFI_CONNECT_TIMEOUT_MILLIS,
                 () -> mWifiManager.getConnectionInfo().getNetworkId() != -1);
+        PollingCheck.check(
+                "Wifi current network is null - Please ensure there is a saved network " +
+                        " in range of this device",
+                WIFI_CONNECT_TIMEOUT_MILLIS,
+                () -> ShellIdentityUtils.invokeWithShellPermissions(mWifiManager::getCurrentNetwork)
+                        != null);
 
         Network wifiCurrentNetwork = ShellIdentityUtils.invokeWithShellPermissions(
                 mWifiManager::getCurrentNetwork);
@@ -3391,13 +3397,43 @@
         Network connectivityCurrentNetwork = networkCallbackListener.network;
         assertEquals(connectivityCurrentNetwork, wifiCurrentNetwork);
 
-        setWifiEnabled(false);
+        if (shouldDisableWifi) {
+            setWifiEnabled(false);
+            PollingCheck.check(
+                    "Wifi not disabled!",
+                    20000,
+                    () -> !mWifiManager.isWifiEnabled());
+        } else {
+            ShellIdentityUtils.invokeWithShellPermissions(() -> mWifiManager.disconnect());
+        }
         PollingCheck.check(
-                "Wifi not disconnected!",
+                "Wifi not disconnected! Connection info network id still valid",
                 20000,
                 () -> mWifiManager.getConnectionInfo().getNetworkId() == -1);
 
-        assertNull(ShellIdentityUtils.invokeWithShellPermissions(mWifiManager::getCurrentNetwork));
+        PollingCheck.check(
+                "Wifi not disconnected! Current network is not null",
+                WIFI_CONNECT_TIMEOUT_MILLIS,
+                () -> ShellIdentityUtils.invokeWithShellPermissions(mWifiManager::getCurrentNetwork)
+                        == null);
+    }
+
+    /**
+     * Test that {@link WifiManager#getCurrentNetwork()} returns a Network object consistent
+     * with {@link ConnectivityManager#registerNetworkCallback} when connected to a Wifi network,
+     * and returns null when disconnected.
+     */
+    public void testGetCurrentNetworkWifiDisconnected() throws Exception {
+        testGetCurrentNetwork(false);
+    }
+
+    /**
+     * Test that {@link WifiManager#getCurrentNetwork()} returns a Network object consistent
+     * with {@link ConnectivityManager#registerNetworkCallback} when connected to a Wifi network,
+     * and returns null when wifi disabled.
+     */
+    public void testGetCurrentNetworkWifiDisabled() throws Exception {
+        testGetCurrentNetwork(true);
     }
 
     /**
diff --git a/tools/cts-tradefed/Android.bp b/tools/cts-tradefed/Android.bp
index 8b0c973..d2e04bf 100644
--- a/tools/cts-tradefed/Android.bp
+++ b/tools/cts-tradefed/Android.bp
@@ -34,7 +34,7 @@
     wrapper: "etc/cts-tradefed",
     short_name: "CTS",
     full_name: "Compatibility Test Suite",
-    version: "12_r12",
+    version: "12_r13",
     static_libs: ["cts-tradefed-harness"],
     required: ["compatibility-host-util"],
 }
diff --git a/tools/cts-tradefed/res/config/cts-focused.xml b/tools/cts-tradefed/res/config/cts-focused.xml
new file mode 100644
index 0000000..a69b2fc
--- /dev/null
+++ b/tools/cts-tradefed/res/config/cts-focused.xml
@@ -0,0 +1,27 @@
+<?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="Runs a subset of CTS for GKI">
+
+    <include name="cts" />
+
+    <option name="plan" value="cts-focused" />
+
+    <!-- Excluded test cases start-->
+
+    <!-- b/329356314 -->
+    <option name="compatibility:exclude-filter" value="CtsAccessibilityTestCases" />
+
+</configuration>
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index 2dda1d9..ae231db 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -313,9 +313,12 @@
     <option name="compatibility:exclude-filter" value="CtsAppOpsTestCases android.app.appops.cts.AppOpEventCollectionTest#noteFromTwoProxiesAndVerifyProxyInfo" />
     <option name="compatibility:exclude-filter" value="CtsAppOpsTestCases android.app.appops.cts.AppOpEventCollectionTest#startStopTrustedProxyVerifyRunningAndTime" />
     <option name="compatibility:exclude-filter" value="CtsAppOpsTestCases android.app.appops.cts.AppOpEventCollectionTest#startStopTrustedAndUntrustedProxyVerifyProxyInfo" />
-    <option name="compatibility:exclude-filter" value="CtsAttributionSourceTestCases android.attributionsource.cts.RuntimePermissionsAppOpTrackingTest#testTrustedAccessSmsAttributeToAnother" />
-    <option name="compatibility:exclude-filter" value="CtsAttributionSourceTestCases android.attributionsource.cts.RuntimePermissionsAppOpTrackingTest#testTrustedAccessCallLogAttributeToAnother" />
-    <option name="compatibility:exclude-filter" value="CtsAttributionSourceTestCases android.attributionsource.cts.RuntimePermissionsAppOpTrackingTest#testTrustedAccessContactsAttributeToAnother" />
-    <option name="compatibility:exclude-filter" value="CtsAttributionSourceTestCases android.attributionsource.cts.RuntimePermissionsAppOpTrackingTest#testTrustedAccessCalendarAttributeToAnother" />
+    <option name="compatibility:exclude-filter" value="CtsPermission5TestCases android.permission5.cts.RuntimePermissionsAppOpTrackingTest#testTrustedAccessSmsAttributeToAnother" />
+    <option name="compatibility:exclude-filter" value="CtsPermission5TestCases android.permission5.cts.RuntimePermissionsAppOpTrackingTest#testTrustedAccessCallLogAttributeToAnother" />
+    <option name="compatibility:exclude-filter" value="CtsPermission5TestCases android.permission5.cts.RuntimePermissionsAppOpTrackingTest#testTrustedAccessContactsAttributeToAnother" />
+    <option name="compatibility:exclude-filter" value="CtsPermission5TestCases android.permission5.cts.RuntimePermissionsAppOpTrackingTest#testTrustedAccessCalendarAttributeToAnother" />
+
+    <!-- b/326655855 -->
+    <option name="compatibility:exclude-filter" value="CtsShortcutManagerTestCases android.content.pm.cts.shortcutmanager.ShortcutManagerUsageTest#testReportShortcutUsed" />
 
 </configuration>
diff --git a/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml b/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml
index 6bf9ada..8960bfe 100644
--- a/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml
+++ b/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml
@@ -93,6 +93,9 @@
       <!-- b/199996926 - No UWB stack support in AOSP for Android S -->
     <option name="compatibility:exclude-filter" value="CtsUwbTestCases" />
 
+    <!-- b/272163895 mediapc tests are disabled in GSI builds -->
+    <option name="compatibility:exclude-filter" value="CtsMediaPerformanceClassTestCases" />
+
     <!-- b/198226244 -->
     <option name="compatibility:exclude-filter" value="CtsVideoTestCases android.video.cts.CodecEncoderPerformanceTest#testPerformanceOfHardwareVideoEncoders" />