Merge "Add CtsVcnTestCases to presubmit"
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/os/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/os/OWNERS
index a72093f..827908f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/os/OWNERS
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/os/OWNERS
@@ -19,4 +19,4 @@
 surbhikadam@google.com
 ttarsenal@google.com
 yeabkal@google.com
-yfz@google.com
\ No newline at end of file
+yfz@google.com
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/usb/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/usb/OWNERS
index e176df9..568938c 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/usb/OWNERS
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/usb/OWNERS
@@ -1,2 +1 @@
 # Bug component: 175220
-moltmann@google.com
\ No newline at end of file
diff --git a/hostsidetests/appsecurity/test-apps/DuplicatePermissionDeclareApp/OWNERS b/hostsidetests/appsecurity/test-apps/DuplicatePermissionDeclareApp/OWNERS
index 2c0ed78..e6f3e8d 100644
--- a/hostsidetests/appsecurity/test-apps/DuplicatePermissionDeclareApp/OWNERS
+++ b/hostsidetests/appsecurity/test-apps/DuplicatePermissionDeclareApp/OWNERS
@@ -1,3 +1,2 @@
 # Bug component: 137825
-moltmann@google.com
 eugenesusla@google.com
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/OWNERS b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/OWNERS
index 2c0ed78..e6f3e8d 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/OWNERS
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareApp/OWNERS
@@ -1,3 +1,2 @@
 # Bug component: 137825
-moltmann@google.com
 eugenesusla@google.com
diff --git a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/OWNERS b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/OWNERS
index 2c0ed78..e6f3e8d 100644
--- a/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/OWNERS
+++ b/hostsidetests/appsecurity/test-apps/PermissionDeclareAppCompat/OWNERS
@@ -1,3 +1,2 @@
 # Bug component: 137825
-moltmann@google.com
 eugenesusla@google.com
diff --git a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/OWNERS b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/OWNERS
index 2c0ed78..e6f3e8d 100644
--- a/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/OWNERS
+++ b/hostsidetests/appsecurity/test-apps/UsePermissionDiffCert/OWNERS
@@ -1,3 +1,2 @@
 # Bug component: 137825
-moltmann@google.com
 eugenesusla@google.com
diff --git a/hostsidetests/hdmicec/AndroidTest.xml b/hostsidetests/hdmicec/AndroidTest.xml
index a0a4350..78bfb01 100644
--- a/hostsidetests/hdmicec/AndroidTest.xml
+++ b/hostsidetests/hdmicec/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Config for CTS HdmiCec host test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="hdmi" />
+    <option name="config-descriptor:metadata" key="token" value="CEC_TEST_CONTROLLER" />
     <!-- Instant apps for TV is not supported. -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
diff --git a/hostsidetests/hdmicec/README.md b/hostsidetests/hdmicec/README.md
index 4ed1acb..db02090 100644
--- a/hostsidetests/hdmicec/README.md
+++ b/hostsidetests/hdmicec/README.md
@@ -28,3 +28,11 @@
 ```
 atest CtsHdmiCecHostTestCases
 ```
+
+To shard the test (distribute and run the tests on multiple devices), use this
+command -
+```
+./cts-tradefed run commandAndExit cts --enable-token-sharding --shard-count 3 -m CtsHdmiCecHostTestCases
+```
+
+The shard count corresponds to the number of DUTs connected to the host.
diff --git a/tests/libcore/wycheproof-bc/Android.bp b/tests/libcore/wycheproof-bc/Android.bp
index 57f59b7..6b6c34b 100644
--- a/tests/libcore/wycheproof-bc/Android.bp
+++ b/tests/libcore/wycheproof-bc/Android.bp
@@ -17,6 +17,7 @@
     defaults: ["cts_support_defaults"],
     platform_apis: true,
     static_libs: [
+        "bouncycastle-repackaged-unbundled",
         "cts-core-test-runner-axt",
 
         // Jar containing expectations files.
diff --git a/tests/libcore/wycheproof-bc/src/android/libcore/cts/wycheproof/BouncyCastleTest.java b/tests/libcore/wycheproof-bc/src/android/libcore/cts/wycheproof/BouncyCastleTest.java
index dfb71e8..699dcaf 100644
--- a/tests/libcore/wycheproof-bc/src/android/libcore/cts/wycheproof/BouncyCastleTest.java
+++ b/tests/libcore/wycheproof-bc/src/android/libcore/cts/wycheproof/BouncyCastleTest.java
@@ -16,7 +16,7 @@
 
 package android.libcore.cts.wycheproof;
 
-import com.android.org.bouncycastle.jce.provider.BouncyCastleProvider;
+import com.android.internal.org.bouncycastle.jce.provider.BouncyCastleProvider;
 import com.google.security.wycheproof.AesGcmTest;
 import com.google.security.wycheproof.BasicTest;
 import com.google.security.wycheproof.CipherInputStreamTest;
diff --git a/tests/mocking/OWNERS b/tests/mocking/OWNERS
index f3a43ea..9c61a53 100644
--- a/tests/mocking/OWNERS
+++ b/tests/mocking/OWNERS
@@ -1,2 +1 @@
 # Bug component: 85797
-moltmann@google.com
diff --git a/tests/mocking/debuggable/OWNERS b/tests/mocking/debuggable/OWNERS
index f3a43ea..9c61a53 100644
--- a/tests/mocking/debuggable/OWNERS
+++ b/tests/mocking/debuggable/OWNERS
@@ -1,2 +1 @@
 # Bug component: 85797
-moltmann@google.com
diff --git a/tests/pdf/OWNERS b/tests/pdf/OWNERS
index 81cf137..76e4746 100644
--- a/tests/pdf/OWNERS
+++ b/tests/pdf/OWNERS
@@ -1,2 +1 @@
 # Bug component: 47273
-moltmann@google.com
diff --git a/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java b/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java
index a36af18..16c843d 100644
--- a/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarPropertyManagerTest.java
@@ -422,6 +422,16 @@
                 mCarPropertyManager.isPropertyAvailable(
                         VehiclePropertyIds.WHEEL_TICK, VehicleAreaType.VEHICLE_AREA_TYPE_GLOBAL));
 
+        CarPropertyConfig wheelTickConfig = mCarPropertyManager.getCarPropertyConfig(
+                VehiclePropertyIds.WHEEL_TICK);
+        CarPropertyConfig speedConfig = mCarPropertyManager.getCarPropertyConfig(
+                VehiclePropertyIds.PERF_VEHICLE_SPEED);
+        // Ignores the test if sampleRates for properties are too low.
+        Assume.assumeTrue("The SampleRates for properties are too low, "
+                + "skip testUnregisterWithPropertyId test",
+                wheelTickConfig.getMaxSampleRate() < FAST_OR_FASTEST_EVENT_COUNTER
+                        || speedConfig.getMaxSampleRate() < FAST_OR_FASTEST_EVENT_COUNTER);
+
         CarPropertyEventCounter speedAndWheelTicksListener = new CarPropertyEventCounter();
         mCarPropertyManager.registerCallback(speedAndWheelTicksListener,
                 VehiclePropertyIds.PERF_VEHICLE_SPEED, CarPropertyManager.SENSOR_RATE_FASTEST);
diff --git a/tests/tests/packageinstaller/install/OWNERS b/tests/tests/packageinstaller/install/OWNERS
index 0088192..bf3cfe7 100644
--- a/tests/tests/packageinstaller/install/OWNERS
+++ b/tests/tests/packageinstaller/install/OWNERS
@@ -1,2 +1 @@
 # Bug component: 36137
-moltmann@google.com
\ No newline at end of file
diff --git a/tests/tests/packageinstaller/install_appop_default/OWNERS b/tests/tests/packageinstaller/install_appop_default/OWNERS
index 0088192..bf3cfe7 100644
--- a/tests/tests/packageinstaller/install_appop_default/OWNERS
+++ b/tests/tests/packageinstaller/install_appop_default/OWNERS
@@ -1,2 +1 @@
 # Bug component: 36137
-moltmann@google.com
\ No newline at end of file
diff --git a/tests/tests/packageinstaller/install_appop_denied/OWNERS b/tests/tests/packageinstaller/install_appop_denied/OWNERS
index 0088192..bf3cfe7 100644
--- a/tests/tests/packageinstaller/install_appop_denied/OWNERS
+++ b/tests/tests/packageinstaller/install_appop_denied/OWNERS
@@ -1,2 +1 @@
 # Bug component: 36137
-moltmann@google.com
\ No newline at end of file
diff --git a/tests/tests/packageinstaller/nopermission/OWNERS b/tests/tests/packageinstaller/nopermission/OWNERS
index c126a70..98dc09e 100644
--- a/tests/tests/packageinstaller/nopermission/OWNERS
+++ b/tests/tests/packageinstaller/nopermission/OWNERS
@@ -1,2 +1 @@
 # Bug component: 137825
-moltmann@google.com
\ No newline at end of file
diff --git a/tests/tests/packageinstaller/nopermission25/OWNERS b/tests/tests/packageinstaller/nopermission25/OWNERS
index c126a70..98dc09e 100644
--- a/tests/tests/packageinstaller/nopermission25/OWNERS
+++ b/tests/tests/packageinstaller/nopermission25/OWNERS
@@ -1,2 +1 @@
 # Bug component: 137825
-moltmann@google.com
\ No newline at end of file
diff --git a/tests/tests/packageinstaller/tapjacking/OWNERS b/tests/tests/packageinstaller/tapjacking/OWNERS
index 0088192..bf3cfe7 100644
--- a/tests/tests/packageinstaller/tapjacking/OWNERS
+++ b/tests/tests/packageinstaller/tapjacking/OWNERS
@@ -1,2 +1 @@
 # Bug component: 36137
-moltmann@google.com
\ No newline at end of file
diff --git a/tests/tests/packageinstaller/uninstall/OWNERS b/tests/tests/packageinstaller/uninstall/OWNERS
index 0088192..bf3cfe7 100644
--- a/tests/tests/packageinstaller/uninstall/OWNERS
+++ b/tests/tests/packageinstaller/uninstall/OWNERS
@@ -1,2 +1 @@
 # Bug component: 36137
-moltmann@google.com
\ No newline at end of file
diff --git a/tests/tests/permission/OWNERS b/tests/tests/permission/OWNERS
index a383144..9adfc77 100644
--- a/tests/tests/permission/OWNERS
+++ b/tests/tests/permission/OWNERS
@@ -1,5 +1,4 @@
 # Bug component: 137825
-moltmann@google.com
 per-file PowerManagerServicePermissionTest.java = dehboxturtle@google.com
 per-file RequestLocation.java = hallliu@google.com
 per-file NoAudioPermissionTest.java = elaurent@google.com
diff --git a/tests/tests/permission/sdk28/OWNERS b/tests/tests/permission/sdk28/OWNERS
index c126a70..98dc09e 100644
--- a/tests/tests/permission/sdk28/OWNERS
+++ b/tests/tests/permission/sdk28/OWNERS
@@ -1,2 +1 @@
 # Bug component: 137825
-moltmann@google.com
\ No newline at end of file
diff --git a/tests/tests/permission/src/android/permission/cts/ConnectivityManagerPermissionTest.java b/tests/tests/permission/src/android/permission/cts/ConnectivityManagerPermissionTest.java
index a95c96e..0e8797d 100644
--- a/tests/tests/permission/src/android/permission/cts/ConnectivityManagerPermissionTest.java
+++ b/tests/tests/permission/src/android/permission/cts/ConnectivityManagerPermissionTest.java
@@ -17,34 +17,48 @@
 package android.permission.cts;
 
 import android.content.Context;
+import android.content.pm.PackageManager;
 import android.net.ConnectivityManager;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import android.net.OemNetworkPreferences;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.concurrent.Executor;
 
 /**
 * Test that protected android.net.ConnectivityManager methods cannot be called without
 * permissions
 */
-public class ConnectivityManagerPermissionTest extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class ConnectivityManagerPermissionTest {
 
-    private ConnectivityManager mConnectivityManager = null;
+    private ConnectivityManager mConnectivityManager;
+    private Context mContext;
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mConnectivityManager = (ConnectivityManager) mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
+    @Before
+    public void setUp() throws Exception {
+        mContext = InstrumentationRegistry.getTargetContext();
+        mConnectivityManager = mContext.getSystemService(ConnectivityManager.class);
         assertNotNull(mConnectivityManager);
     }
 
-
-
     /**
      * Verify that calling {@link ConnectivityManager#getNetworkInfo(int))}
      * requires permissions.
      * <p>Tests Permission:
      *   {@link android.Manifest.permission#ACCESS_NETWORK_STATE}.
      */
-    @SmallTest
+    @Test
     public void testGetNetworkInfo() {
         try {
             mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
@@ -53,4 +67,54 @@
             // expected
         }
     }
+
+    /**
+     * Verify that calling {@link ConnectivityManager#setOemNetworkPreference(OemNetworkPreferences,
+     * Executor, ConnectivityManager.OnSetOemNetworkPreferenceListener)}
+     * requires permissions.
+     * <p>Tests Permission:
+     *   {@link android.Manifest.permission#CONTROL_OEM_PAID_NETWORK_PREFERENCE}.
+     */
+    @Test
+    public void testSetOemNetworkPreference() {
+        assumeTrue(mContext.getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_AUTOMOTIVE));
+        try {
+            final String testPackage = "does.not.matter.com";
+            final int testPref = OemNetworkPreferences.OEM_NETWORK_PREFERENCE_OEM_PAID;
+            final OemNetworkPreferences preferences =
+                    new OemNetworkPreferences.Builder()
+                    .addNetworkPreference(testPackage, testPref)
+                    .build();
+            mConnectivityManager.setOemNetworkPreference(preferences, null, null);
+            fail("Was able to call setOemNetworkPreference");
+        } catch (SecurityException e) {
+            // expected
+        }
+    }
+
+    /**
+     * Verify that calling {@link ConnectivityManager#setOemNetworkPreference(OemNetworkPreferences,
+     * Executor, ConnectivityManager.OnSetOemNetworkPreferenceListener)}
+     * requires automotive feature.
+     * <p>Tests Feature:
+     *   {@link PackageManager#FEATURE_AUTOMOTIVE}.
+     */
+    @Test
+    public void testSetOemNetworkPreferenceHasAutomotiveFeature() {
+        assumeFalse(mContext.getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_AUTOMOTIVE));
+        try {
+            final String testPackage = "does.not.matter.com";
+            final int testPref = OemNetworkPreferences.OEM_NETWORK_PREFERENCE_OEM_PAID;
+            final OemNetworkPreferences preferences =
+                    new OemNetworkPreferences.Builder()
+                            .addNetworkPreference(testPackage, testPref)
+                            .build();
+            mConnectivityManager.setOemNetworkPreference(preferences, null, null);
+            fail("Was able to call setOemNetworkPreference");
+        } catch (UnsupportedOperationException e) {
+            // expected
+        }
+    }
 }
diff --git a/tests/tests/permission2/OWNERS b/tests/tests/permission2/OWNERS
index 3e44a8c..7916475 100644
--- a/tests/tests/permission2/OWNERS
+++ b/tests/tests/permission2/OWNERS
@@ -1,5 +1,4 @@
 # Bug component: 137825
-moltmann@google.com
 svetoslavganov@google.com
 per-file NoLocationPermissionTest.java = hallliu@google.com
 per-file RestrictedStoragePermissionSharedUidTest.java = nandana@google.com
diff --git a/tests/tests/permission2/res/raw/OWNERS b/tests/tests/permission2/res/raw/OWNERS
index f46dbfe..a67ff98 100644
--- a/tests/tests/permission2/res/raw/OWNERS
+++ b/tests/tests/permission2/res/raw/OWNERS
@@ -1,4 +1,3 @@
-moltmann@google.com
 svetoslavganov@google.com
 cbrubaker@google.com
 hackbod@google.com
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index 5911070..b835ca5 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -1771,6 +1771,12 @@
     <permission android:name="android.permission.WIFI_ACCESS_COEX_UNSAFE_CHANNELS"
         android:protectionLevel="signature|privileged" />
 
+    <!-- @SystemApi @hide Allows an application to manage an automotive device's application network
+         preference as it relates to OEM_PAID and OEM_PRIVATE capable networks.
+         <p>Not for use by third-party or privileged applications. -->
+    <permission android:name="android.permission.CONTROL_OEM_PAID_NETWORK_PREFERENCE"
+        android:protectionLevel="signature" />
+
     <!-- ======================================= -->
     <!-- Permissions for short range, peripheral networks -->
     <!-- ======================================= -->
diff --git a/tests/tests/permission3/OWNERS b/tests/tests/permission3/OWNERS
index d4d6a95..928d01c 100644
--- a/tests/tests/permission3/OWNERS
+++ b/tests/tests/permission3/OWNERS
@@ -1,6 +1,5 @@
 # Bug component: 137825
 svetoslavganov@google.com
-moltmann@google.com
 zhanghai@google.com
 eugenesusla@google.com
 evanseverson@google.com
diff --git a/tests/tests/permission4/OWNERS b/tests/tests/permission4/OWNERS
index d4d6a95..928d01c 100644
--- a/tests/tests/permission4/OWNERS
+++ b/tests/tests/permission4/OWNERS
@@ -1,6 +1,5 @@
 # Bug component: 137825
 svetoslavganov@google.com
-moltmann@google.com
 zhanghai@google.com
 eugenesusla@google.com
 evanseverson@google.com
diff --git a/tests/tests/print/OWNERS b/tests/tests/print/OWNERS
index 81cf137..76e4746 100644
--- a/tests/tests/print/OWNERS
+++ b/tests/tests/print/OWNERS
@@ -1,2 +1 @@
 # Bug component: 47273
-moltmann@google.com
diff --git a/tests/tests/role/OWNERS b/tests/tests/role/OWNERS
index 904ef0b..f297ddb 100644
--- a/tests/tests/role/OWNERS
+++ b/tests/tests/role/OWNERS
@@ -1,5 +1,4 @@
 # Bug component: 137825
 zhanghai@google.com
 svetoslavganov@google.com
-moltmann@google.com
 eugenesusla@google.com
diff --git a/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ContentNotificationsTest.java b/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ContentNotificationsTest.java
index ae3b13e..0e3b6e7 100644
--- a/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ContentNotificationsTest.java
+++ b/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ContentNotificationsTest.java
@@ -20,7 +20,6 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import android.app.Instrumentation;
 import android.content.ContentResolver;
 import android.content.ContentValues;
 import android.content.pm.PackageManager;
@@ -35,8 +34,8 @@
 import androidx.annotation.Nullable;
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.platform.app.InstrumentationRegistry;
 
+import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.RequiredFeatureRule;
 
 import org.junit.After;
@@ -54,6 +53,8 @@
 @RunWith(AndroidJUnit4.class)
 public class SimPhonebookContract_ContentNotificationsTest {
 
+    private static final int DEFAULT_TIMEOUT = 5000;
+
     @ClassRule
     public static final SimsPowerRule SIMS_POWER_RULE = SimsPowerRule.on();
     private final SimCleanupRule mSimCleanupRule = new SimCleanupRule(ElementaryFiles.EF_ADN);
@@ -64,24 +65,15 @@
             .around(mSimCleanupRule);
 
     private int mSubId;
-    private Instrumentation mInstrumentation;
     private ContentResolver mResolver;
-    private ContentObserver mObserver;
-    private List<Uri> mObserved;
+    private RecordingContentObserver mObserver;
 
     @Before
     public void setUp() {
-        mInstrumentation = InstrumentationRegistry.getInstrumentation();
         mResolver = ApplicationProvider.getApplicationContext().getContentResolver();
-        mObserved = new CopyOnWriteArrayList<>();
-        mObserver = new ContentObserver(new Handler(Looper.getMainLooper())) {
-            @Override
-            public void onChange(boolean selfChange, @Nullable Uri uri) {
-                mObserved.add(uri);
-            }
-        };
+        mObserver = new RecordingContentObserver();
         mResolver.registerContentObserver(SimPhonebookContract.AUTHORITY_URI, false, mObserver);
-        assertThat(mObserved).isEmpty();
+        assertThat(mObserver.observed).isEmpty();
 
         // Make sure the provider has been created.
         mResolver.getType(SimPhonebookContract.SimRecords.getContentUri(1, EF_ADN));
@@ -95,39 +87,49 @@
     }
 
     @Test
-    public void insert_notifiesObserver() {
+    public void insert_notifiesObserver() throws Exception {
         ContentValues values = new ContentValues();
         values.put(SimPhonebookContract.SimRecords.PHONE_NUMBER, "5550101");
         mResolver.insert(SimPhonebookContract.SimRecords.getContentUri(mSubId, EF_ADN), values);
 
-        mInstrumentation.runOnMainSync(() -> assertThat(mObserved).hasSize(1));
+        PollingCheck.check(
+                "No content notifications observed for insert.",
+                DEFAULT_TIMEOUT, () -> !mObserver.observed.isEmpty());
     }
 
     @Test
-    public void update_notifiesObserver() {
+    public void update_notifiesObserver() throws Exception {
         ContentValues values = new ContentValues();
         values.put(SimPhonebookContract.SimRecords.PHONE_NUMBER, "5550101");
         Uri itemUri = mResolver.insert(
                 SimPhonebookContract.SimRecords.getContentUri(mSubId, EF_ADN), values);
-        mObserved.clear();
+        PollingCheck.check(
+                "No content notifications observed for insert.",
+                DEFAULT_TIMEOUT, () -> mObserver.observed.size() == 1);
 
         values.put(SimPhonebookContract.SimRecords.PHONE_NUMBER, "5550102");
         mResolver.update(itemUri, values, null);
 
-        mInstrumentation.runOnMainSync(() -> assertThat(mObserved).hasSize(1));
+        PollingCheck.check(
+                "No content notifications observed for update.",
+                DEFAULT_TIMEOUT, () -> mObserver.observed.size() > 1);
     }
 
     @Test
-    public void delete_notifiesObserver() {
+    public void delete_notifiesObserver() throws Exception {
         ContentValues values = new ContentValues();
         values.put(SimPhonebookContract.SimRecords.PHONE_NUMBER, "5550101");
         Uri itemUri = mResolver.insert(
                 SimPhonebookContract.SimRecords.getContentUri(mSubId, EF_ADN), values);
-        mObserved.clear();
+        PollingCheck.check(
+                "No content notifications observed for insert.",
+                DEFAULT_TIMEOUT, () -> mObserver.observed.size() == 1);
 
         mResolver.delete(itemUri, null);
 
-        mInstrumentation.runOnMainSync(() -> assertThat(mObserved).hasSize(1));
+        PollingCheck.check(
+                "No content notifications observed for delete.",
+                DEFAULT_TIMEOUT, () -> mObserver.observed.size() > 1);
     }
 
     @Test
@@ -135,17 +137,34 @@
         try {
             // Mimic removal or insertion of a SIM by powering off the slot.
             SIMS_POWER_RULE.powerOff(0);
-            // Sleep a bit more even though the powerOff call waits for the subscription to become
-            // active to allow the listeners to be notified of any changes.
-            Thread.sleep(1000);
 
-            mInstrumentation.runOnMainSync(() -> assertThat(mObserved).isNotEmpty());
-            mObserved.clear();
+            PollingCheck.check(
+                    "No content notifications observed for SIM removal",
+                    DEFAULT_TIMEOUT, () -> mObserver.observed.size() >= 1);
+            // It takes some time the SIM state transitions to finish so we sleep a bit to attempt
+            // to allow the notifications they trigger to stop so that the notifications we observe
+            // for the power on aren't polluted by the power off.
+            Thread.sleep(DEFAULT_TIMEOUT);
+            mObserver.observed.clear();
         } finally {
             SIMS_POWER_RULE.powerOn(0);
-            Thread.sleep(1000);
         }
-        mInstrumentation.runOnMainSync(() -> assertThat(mObserved).isNotEmpty());
-        assertThat(mObserved).isNotEmpty();
+        PollingCheck.check(
+                "No content notifications observed for SIM insertion",
+                DEFAULT_TIMEOUT, () -> mObserver.observed.size() >= 1);
+    }
+
+    private static class RecordingContentObserver extends ContentObserver {
+
+        List<Uri> observed = new CopyOnWriteArrayList<>();
+
+        public RecordingContentObserver() {
+            super(new Handler(Looper.getMainLooper()));
+        }
+
+        @Override
+        public void onChange(boolean selfChange, @Nullable Uri uri) {
+            observed.add(uri);
+        }
     }
 }
diff --git a/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ElementaryFilesTest.java b/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ElementaryFilesTest.java
index 981ca3e..acdb215 100644
--- a/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ElementaryFilesTest.java
+++ b/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ElementaryFilesTest.java
@@ -21,6 +21,7 @@
 import static com.android.internal.telephony.testing.CursorSubject.assertThat;
 
 import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
 
 import android.Manifest;
 import android.content.ContentResolver;
@@ -32,6 +33,7 @@
 import android.provider.SimPhonebookContract.SimRecords;
 import android.telephony.SubscriptionInfo;
 import android.telephony.SubscriptionManager;
+import android.util.SparseBooleanArray;
 
 import androidx.annotation.NonNull;
 import androidx.test.core.app.ApplicationProvider;
@@ -40,6 +42,7 @@
 import com.android.compatibility.common.util.RequiredFeatureRule;
 import com.android.compatibility.common.util.SystemUtil;
 
+import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -47,6 +50,7 @@
 import org.junit.rules.TestRule;
 import org.junit.runner.RunWith;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
 
@@ -81,6 +85,37 @@
         List<SubscriptionInfo> subscriptionInfos = SystemUtil.callWithShellPermissionIdentity(
                 () -> mSubscriptionManager.getActiveSubscriptionInfoList(),
                 Manifest.permission.READ_PHONE_STATE);
+        // FDN and SDN support are more rare and less important than ADN so we allow the test to
+        // work on a SIM where they are unsupported. This does leave a gap in coverage but given
+        // their relatively low importance as compared to ADN and the fact that the implementation
+        // should be very similar for each type it's OK to just assume good faith on the part of the
+        // implementation.
+        SparseBooleanArray fdnSupportedBySubId = new SparseBooleanArray();
+        SparseBooleanArray sdnSupportedBySubId = new SparseBooleanArray();
+        for (SubscriptionInfo info : subscriptionInfos) {
+            int subscriptionId = info.getSubscriptionId();
+            try (Cursor cursor = mResolver.query(
+                    ElementaryFiles.getItemUri(subscriptionId, ElementaryFiles.EF_FDN),
+                    new String[]{ElementaryFiles.SUBSCRIPTION_ID}, null, null)) {
+                // If the EF is unsupported the item Uri will return an empty cursor
+                if (cursor.moveToFirst()) {
+                    assertWithMessage("subscriptionId")
+                            .that(subscriptionId).isEqualTo(cursor.getInt(0));
+                    fdnSupportedBySubId.append(subscriptionId, true);
+                }
+            }
+            try (Cursor cursor = mResolver.query(
+                    ElementaryFiles.getItemUri(subscriptionId, ElementaryFiles.EF_SDN),
+                    new String[]{ElementaryFiles.SUBSCRIPTION_ID}, null, null)) {
+                // If the EF is unsupported the item Uri will return an empty cursor
+                if (cursor.moveToFirst()) {
+                    assertWithMessage("subscriptionId")
+                            .that(subscriptionId).isEqualTo(cursor.getInt(0));
+                    sdnSupportedBySubId.append(subscriptionId, true);
+                }
+            }
+        }
+
         try (Cursor cursor = query(ElementaryFiles.CONTENT_URI,
                 new String[]{
                         ElementaryFiles.SLOT_INDEX,
@@ -91,12 +126,19 @@
                         ElementaryFiles.PHONE_NUMBER_MAX_LENGTH
                 })) {
 
-            assertThat(cursor).hasCount(subscriptionInfos.size() * 3);
+            assertThat(cursor).hasCount(subscriptionInfos.size() + fdnSupportedBySubId.size()
+                    + sdnSupportedBySubId.size());
             cursor.moveToPosition(-1);
             for (SubscriptionInfo info : subscriptionInfos) {
-                for (int efType : new int[]{
-                        ElementaryFiles.EF_ADN, ElementaryFiles.EF_FDN, ElementaryFiles.EF_SDN
-                }) {
+                List<Integer> supportedEfs = new ArrayList<>(3);
+                supportedEfs.add(ElementaryFiles.EF_ADN);
+                if (fdnSupportedBySubId.get(info.getSubscriptionId())) {
+                    supportedEfs.add(ElementaryFiles.EF_FDN);
+                }
+                if (sdnSupportedBySubId.get(info.getSubscriptionId())) {
+                    supportedEfs.add(ElementaryFiles.EF_SDN);
+                }
+                for (int efType : supportedEfs) {
                     assertThat(cursor.moveToNext()).isTrue();
                     assertThat(cursor)
                             .hasRowValue(ElementaryFiles.SLOT_INDEX, info.getSimSlotIndex())
@@ -142,24 +184,42 @@
     }
 
     @Test
-    public void query_itemUri_returnsCorrectRow() {
-        String[] projection = {
-                ElementaryFiles.SUBSCRIPTION_ID,
-                ElementaryFiles.EF_TYPE
-        };
-        try (Cursor adn = query(
+    public void query_adnItemUri_returnsCorrectRow() {
+        try (Cursor cursor = query(
                 ElementaryFiles.getItemUri(mValidSubscriptionId, ElementaryFiles.EF_ADN),
-                projection);
-             Cursor fdn = query(
-                     ElementaryFiles.getItemUri(mValidSubscriptionId, ElementaryFiles.EF_FDN),
-                     projection);
-             Cursor sdn = query(
-                     ElementaryFiles.getItemUri(mValidSubscriptionId, ElementaryFiles.EF_SDN),
-                     projection)
-        ) {
-            assertThat(adn).hasSingleRow(mValidSubscriptionId, ElementaryFiles.EF_ADN);
-            assertThat(fdn).hasSingleRow(mValidSubscriptionId, ElementaryFiles.EF_FDN);
-            assertThat(sdn).hasSingleRow(mValidSubscriptionId, ElementaryFiles.EF_SDN);
+                new String[]{
+                        ElementaryFiles.SUBSCRIPTION_ID,
+                        ElementaryFiles.EF_TYPE
+                })) {
+            assertThat(cursor).hasSingleRow(mValidSubscriptionId, ElementaryFiles.EF_ADN);
+        }
+    }
+
+    @Test
+    public void query_fdnItemUri_returnsCorrectRow() {
+        try (Cursor cursor = query(
+                ElementaryFiles.getItemUri(mValidSubscriptionId, ElementaryFiles.EF_FDN),
+                new String[]{
+                        ElementaryFiles.SUBSCRIPTION_ID,
+                        ElementaryFiles.EF_TYPE
+                })) {
+            // Use an assumption so that the tests don't fail if the SIM doesn't support FDN.
+            Assume.assumeTrue("SIM should support EF_FDN but does not.", cursor.moveToFirst());
+            assertThat(cursor).hasSingleRow(mValidSubscriptionId, ElementaryFiles.EF_FDN);
+        }
+    }
+
+    @Test
+    public void query_sdnItemUri_returnsCorrectRow() {
+        try (Cursor cursor = query(
+                ElementaryFiles.getItemUri(mValidSubscriptionId, ElementaryFiles.EF_SDN),
+                new String[]{
+                        ElementaryFiles.SUBSCRIPTION_ID,
+                        ElementaryFiles.EF_TYPE
+                })) {
+            // Use an assumption so that the tests don't fail if the SIM doesn't support SDN.
+            Assume.assumeTrue("SIM should support EF_SDN but does not.", cursor.moveToFirst());
+            assertThat(cursor).hasSingleRow(mValidSubscriptionId, ElementaryFiles.EF_SDN);
         }
     }
 
diff --git a/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_SimRecordsTest.java b/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_SimRecordsTest.java
index 7031023..d231ad2 100644
--- a/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_SimRecordsTest.java
+++ b/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_SimRecordsTest.java
@@ -51,6 +51,7 @@
 import com.google.common.collect.ImmutableList;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.RuleChain;
@@ -84,8 +85,7 @@
     public final TestRule mRule = RuleChain
             .outerRule(new RequiredFeatureRule(PackageManager.FEATURE_TELEPHONY))
             .around(new SimPhonebookRequirementsRule())
-            .around(mAdnCleanupRule)
-            .around(mFdnCleanupRule);
+            .around(mAdnCleanupRule);
     /**
      * The number of records in the SDN file for the SIM card.
      *
@@ -170,6 +170,7 @@
         }
     }
 
+    @Ignore
     @Test
     public void querySdn_returnsCursorWithSdnRecords() {
         // Create an ADN contact to validate that this query at least returns something different
@@ -208,6 +209,7 @@
         }
     }
 
+    @Ignore
     @Test
     public void queryFdn_nonEmpty_returnsFdnRecordsFromSim() throws Exception {
         insertFdn(mDefaultSubscriptionId, "Name1", "5550101");
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/ApnThrottleStatusTest.java b/tests/tests/telephony/current/src/android/telephony/cts/ThrottleStatusTest.java
similarity index 82%
rename from tests/tests/telephony/current/src/android/telephony/cts/ApnThrottleStatusTest.java
rename to tests/tests/telephony/current/src/android/telephony/cts/ThrottleStatusTest.java
index 717ea54..ff622e7 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/ApnThrottleStatusTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/ThrottleStatusTest.java
@@ -22,23 +22,23 @@
 import android.os.Parcel;
 import android.telephony.AccessNetworkConstants;
 import android.telephony.data.ApnSetting;
-import android.telephony.data.ApnThrottleStatus;
+import android.telephony.data.ThrottleStatus;
 
 import org.junit.Test;
 
-public class ApnThrottleStatusTest {
+public class ThrottleStatusTest {
 
     private static final int SLOT_INDEX = 10;
     private static final int TRANSPORT_TYPE = AccessNetworkConstants.TRANSPORT_TYPE_WWAN;
     private static final int APN_TYPE = ApnSetting.TYPE_IMS;
-    private static final int THROTTLE_TYPE = ApnThrottleStatus.THROTTLE_TYPE_ELAPSED_TIME;
+    private static final int THROTTLE_TYPE = ThrottleStatus.THROTTLE_TYPE_ELAPSED_TIME;
     private static final long THROTTLE_EXPIRY_TIME_MILLIS = 5005;
-    private static final int RETRY_TYPE = ApnThrottleStatus.RETRY_TYPE_NEW_CONNECTION;
+    private static final int RETRY_TYPE = ThrottleStatus.RETRY_TYPE_NEW_CONNECTION;
 
     @Test
     public void testBuilderAndGetters() {
 
-        ApnThrottleStatus status = new ApnThrottleStatus.Builder()
+        ThrottleStatus status = new ThrottleStatus.Builder()
                 .setSlotIndex(SLOT_INDEX)
                 .setTransportType(TRANSPORT_TYPE)
                 .setApnType(APN_TYPE)
@@ -57,14 +57,14 @@
     @Test
     public void testEquals() {
 
-        ApnThrottleStatus status1 = new ApnThrottleStatus.Builder()
+        ThrottleStatus status1 = new ThrottleStatus.Builder()
                 .setSlotIndex(SLOT_INDEX)
                 .setTransportType(TRANSPORT_TYPE)
                 .setApnType(APN_TYPE)
                 .setThrottleExpiryTimeMillis(THROTTLE_EXPIRY_TIME_MILLIS)
                 .setRetryType(RETRY_TYPE)
                 .build();
-        ApnThrottleStatus status2 = new ApnThrottleStatus.Builder()
+        ThrottleStatus status2 = new ThrottleStatus.Builder()
                 .setSlotIndex(SLOT_INDEX)
                 .setTransportType(TRANSPORT_TYPE)
                 .setApnType(APN_TYPE)
@@ -77,14 +77,14 @@
 
     @Test
     public void testNotEquals() {
-        ApnThrottleStatus status1 = new ApnThrottleStatus.Builder()
+        ThrottleStatus status1 = new ThrottleStatus.Builder()
                 .setSlotIndex(SLOT_INDEX)
                 .setTransportType(TRANSPORT_TYPE)
                 .setApnType(APN_TYPE)
                 .setThrottleExpiryTimeMillis(THROTTLE_EXPIRY_TIME_MILLIS)
                 .setRetryType(RETRY_TYPE)
                 .build();
-        ApnThrottleStatus status2 = new ApnThrottleStatus.Builder()
+        ThrottleStatus status2 = new ThrottleStatus.Builder()
                 .setSlotIndex(SLOT_INDEX)
                 .setTransportType(TRANSPORT_TYPE)
                 .setApnType(APN_TYPE)
@@ -96,7 +96,7 @@
 
     @Test
     public void testParcel() {
-        ApnThrottleStatus status = new ApnThrottleStatus.Builder()
+        ThrottleStatus status = new ThrottleStatus.Builder()
                 .setSlotIndex(SLOT_INDEX)
                 .setTransportType(TRANSPORT_TYPE)
                 .setApnType(APN_TYPE)
@@ -108,7 +108,7 @@
         status.writeToParcel(stateParcel, 0);
         stateParcel.setDataPosition(0);
 
-        ApnThrottleStatus postParcel = ApnThrottleStatus.CREATOR.createFromParcel(stateParcel);
+        ThrottleStatus postParcel = ThrottleStatus.CREATOR.createFromParcel(stateParcel);
         assertEquals(status, postParcel);
     }
 }
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsRegistrationAttributesTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsRegistrationAttributesTest.java
new file mode 100644
index 0000000..55a8d0c
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsRegistrationAttributesTest.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.telephony.ims.cts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import android.os.Parcel;
+import android.telephony.AccessNetworkConstants;
+import android.telephony.ims.ImsRegistrationAttributes;
+import android.telephony.ims.stub.ImsRegistrationImplBase;
+import android.util.ArraySet;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class ImsRegistrationAttributesTest {
+
+    @Test
+    public void testRegistrationTypeToTransportAttr() {
+        ArraySet<String> featureTags = new ArraySet<>();
+        featureTags.add("+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.msg\"");
+        featureTags.add("+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.session\"");
+        featureTags.add("+g.gsma.callcomposer");
+
+
+        // IWLAN
+        ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder(
+                ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN).setFeatureTags(featureTags)
+                .build();
+        assertEquals(ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN,
+                attr.getRegistrationTechnology());
+        assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WLAN,
+                attr.getTransportType());
+        assertEquals(featureTags, attr.getFeatureTags());
+
+        //LTE
+        attr = new ImsRegistrationAttributes.Builder(
+                ImsRegistrationImplBase.REGISTRATION_TECH_LTE).build();
+        assertEquals(ImsRegistrationImplBase.REGISTRATION_TECH_LTE,
+                attr.getRegistrationTechnology());
+        assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WWAN,
+                attr.getTransportType());
+        assertNotNull(attr.getFeatureTags());
+        assertEquals(0, attr.getFeatureTags().size());
+    }
+
+    @Test
+    public void testParcelUnparcel() {
+
+        ArraySet<String> featureTags = new ArraySet<>();
+        featureTags.add("+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.msg\"");
+        featureTags.add("+g.3gpp.icsi-ref=\"urn%3Aurn-7%3A3gpp-service.ims.icsi.oma.cpm.session\"");
+        featureTags.add("+g.gsma.callcomposer");
+        ImsRegistrationAttributes attr = new ImsRegistrationAttributes.Builder(
+                ImsRegistrationImplBase.REGISTRATION_TECH_IWLAN).setFeatureTags(featureTags)
+                .build();
+
+        Parcel parcel = Parcel.obtain();
+        attr.writeToParcel(parcel, 0);
+        parcel.setDataPosition(0);
+        ImsRegistrationAttributes unparcelledAttr =
+                ImsRegistrationAttributes.CREATOR.createFromParcel(parcel);
+        parcel.recycle();
+
+        assertEquals(attr.getRegistrationTechnology(), unparcelledAttr.getRegistrationTechnology());
+        assertEquals(attr.getTransportType(), unparcelledAttr.getTransportType());
+        assertEquals(attr.getAttributeFlags(), unparcelledAttr.getAttributeFlags());
+        assertEquals(attr.getFeatureTags(), unparcelledAttr.getFeatureTags());
+    }
+}
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 a9e6417..db31a7f 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
@@ -45,6 +45,7 @@
 import android.telephony.ims.ImsMmTelManager;
 import android.telephony.ims.ImsRcsManager;
 import android.telephony.ims.ImsReasonInfo;
+import android.telephony.ims.ImsRegistrationAttributes;
 import android.telephony.ims.ProvisioningManager;
 import android.telephony.ims.RcsClientConfiguration;
 import android.telephony.ims.RcsUceAdapter;
@@ -56,6 +57,7 @@
 import android.telephony.ims.stub.ImsConfigImplBase;
 import android.telephony.ims.stub.ImsFeatureConfiguration;
 import android.telephony.ims.stub.ImsRegistrationImplBase;
+import android.util.ArraySet;
 import android.util.Base64;
 import android.util.Pair;
 
@@ -756,6 +758,112 @@
     }
 
     @Test
+    public void testMmTelManagerRegistrationCallbackS() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+
+        final ArraySet<String> featureTags = new ArraySet<>();
+        featureTags.add("featureTag1");
+        featureTags.add("featureTag2");
+
+        triggerFrameworkConnectToCarrierImsService();
+
+        // Start deregistered
+        sServiceConnector.getCarrierService().getImsRegistration().onDeregistered(
+                new ImsReasonInfo(ImsReasonInfo.CODE_LOCAL_NOT_REGISTERED,
+                        ImsReasonInfo.CODE_UNSPECIFIED, ""));
+
+        LinkedBlockingQueue<ImsRegistrationAttributes> mRegQueue =
+                new LinkedBlockingQueue<>();
+        LinkedBlockingQueue<ImsReasonInfo> mDeregQueue =
+                new LinkedBlockingQueue<>();
+        RegistrationManager.RegistrationCallback callback =
+                new RegistrationManager.RegistrationCallback() {
+            @Override
+            public void onRegistered(ImsRegistrationAttributes attributes) {
+                mRegQueue.offer(attributes);
+            }
+
+            @Override
+            public void onRegistering(ImsRegistrationAttributes attributes) {
+                mRegQueue.offer(attributes);
+            }
+
+            @Override
+            public void onUnregistered(ImsReasonInfo info) {
+                mDeregQueue.offer(info);
+            }
+        };
+
+        final UiAutomation automan = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+        try {
+            // First try without the correct permissions.
+            ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+            ImsMmTelManager mmTelManager = imsManager.getImsMmTelManager(sTestSub);
+            mmTelManager.registerImsRegistrationCallback(getContext().getMainExecutor(), callback);
+            fail("registerImsRegistrationCallback requires READ_PRECISE_PHONE_STATE permission.");
+        } catch (SecurityException e) {
+            //expected
+        }
+
+        // Latch will count down here (we callback on the state during registration).
+        try {
+            automan.adoptShellPermissionIdentity();
+            ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+            ImsMmTelManager mmTelManager = imsManager.getImsMmTelManager(sTestSub);
+            mmTelManager.registerImsRegistrationCallback(getContext().getMainExecutor(), callback);
+        } finally {
+            automan.dropShellPermissionIdentity();
+        }
+        ImsReasonInfo deregResult = waitForResult(mDeregQueue);
+        assertNotNull(deregResult);
+        assertEquals(ImsReasonInfo.CODE_LOCAL_NOT_REGISTERED, deregResult.getCode());
+
+        // Start registration
+        ImsRegistrationAttributes lteTagsAttr = new ImsRegistrationAttributes.Builder(
+                ImsRegistrationImplBase.REGISTRATION_TECH_LTE)
+                .setFeatureTags(featureTags)
+                .build();
+        sServiceConnector.getCarrierService().getImsRegistration().onRegistering(lteTagsAttr);
+        ImsRegistrationAttributes attrResult = waitForResult(mRegQueue);
+        assertNotNull(attrResult);
+        assertEquals(ImsRegistrationImplBase.REGISTRATION_TECH_LTE,
+                attrResult.getRegistrationTechnology());
+        assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, attrResult.getTransportType());
+        assertEquals(0, attrResult.getAttributeFlags());
+        assertEquals(featureTags, attrResult.getFeatureTags());
+
+        // Complete registration
+        sServiceConnector.getCarrierService().getImsRegistration().onRegistered(lteTagsAttr);
+        attrResult = waitForResult(mRegQueue);
+        assertNotNull(attrResult);
+        assertEquals(ImsRegistrationImplBase.REGISTRATION_TECH_LTE,
+                attrResult.getRegistrationTechnology());
+        assertEquals(AccessNetworkConstants.TRANSPORT_TYPE_WWAN, attrResult.getTransportType());
+        assertEquals(0, attrResult.getAttributeFlags());
+        assertEquals(featureTags, attrResult.getFeatureTags());
+
+        try {
+            automan.adoptShellPermissionIdentity();
+            ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+            ImsMmTelManager mmTelManager = imsManager.getImsMmTelManager(sTestSub);
+            mmTelManager.unregisterImsRegistrationCallback(callback);
+        } finally {
+            automan.dropShellPermissionIdentity();
+        }
+
+        try {
+            ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+            ImsMmTelManager mmTelManager = imsManager.getImsMmTelManager(sTestSub);
+            mmTelManager.unregisterImsRegistrationCallback(callback);
+            fail("unregisterImsRegistrationCallback requires READ_PRECISE_PHONE_STATE permission.");
+        } catch (SecurityException e) {
+            //expected
+        }
+    }
+
+    @Test
     public void testMmTelManagerRegistrationCallback() throws Exception {
         if (!ImsUtils.shouldTestImsService()) {
             return;
@@ -772,7 +880,6 @@
         // extend ImsMmTelManager.RegistrationCallback (because it doesn't exist), so this has to
         // happen as an anon class here.
         LinkedBlockingQueue<Integer> mQueue = new LinkedBlockingQueue<>();
-        // Deprecated in R, see testMmTelManagerRegistrationCallbackR below.
         ImsMmTelManager.RegistrationCallback callback = new ImsMmTelManager.RegistrationCallback() {
             @Override
             public void onRegistered(int imsTransportType) {
diff --git a/tests/tests/toast/OWNERS b/tests/tests/toast/OWNERS
index 5cb1f47..9363c1a 100644
--- a/tests/tests/toast/OWNERS
+++ b/tests/tests/toast/OWNERS
@@ -1,4 +1,3 @@
 # Bug component: 137825
 svetoslavganov@google.com
-moltmann@google.com
 toddke@google.com
diff --git a/tests/tests/usb/OWNERS b/tests/tests/usb/OWNERS
index 62d0db4..ad5a496 100644
--- a/tests/tests/usb/OWNERS
+++ b/tests/tests/usb/OWNERS
@@ -1,7 +1,6 @@
 # Bug component: 175220
 badhri@google.com
 elaurent@google.com
-moltmann@google.com
 albertccwang@google.com
 jameswei@google.com
 howardyen@google.com
\ No newline at end of file
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index de90e52..ad28ed9 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -219,4 +219,7 @@
 
     <!-- b/135533962 -->
     <option name="compatibility:exclude-filter" value="arm64-v8a CtsWrapWrapDebugMallocDebugTestCases" />
+
+    <!-- b/175319005 -->
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.ManagedProfileTest#testAppLinks_verificationStatus" />
 </configuration>