Merge "Add CTS test for TelephonyManager.getPhoneAccount" into sc-dev
diff --git a/apps/CameraITS/tests/scene2_a/test_effects.py b/apps/CameraITS/tests/scene2_a/test_effects.py
index 59c01ef..b437194 100644
--- a/apps/CameraITS/tests/scene2_a/test_effects.py
+++ b/apps/CameraITS/tests/scene2_a/test_effects.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies android.control.availableEffects that are supported."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene2_a/test_faces.py b/apps/CameraITS/tests/scene2_a/test_faces.py
index bd7d3bca..220628d 100644
--- a/apps/CameraITS/tests/scene2_a/test_faces.py
+++ b/apps/CameraITS/tests/scene2_a/test_faces.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies faces are detected and landmarks in bounding boxes."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene2_a/test_format_combos.py b/apps/CameraITS/tests/scene2_a/test_format_combos.py
index d299d09..740de49 100644
--- a/apps/CameraITS/tests/scene2_a/test_format_combos.py
+++ b/apps/CameraITS/tests/scene2_a/test_format_combos.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies different combinations of output formats."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene2_a/test_jpeg_quality.py b/apps/CameraITS/tests/scene2_a/test_jpeg_quality.py
index a46dde7..57ba5b2 100644
--- a/apps/CameraITS/tests/scene2_a/test_jpeg_quality.py
+++ b/apps/CameraITS/tests/scene2_a/test_jpeg_quality.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifiers android.jpeg.quality increases JPEG image quality."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene2_a/test_num_faces.py b/apps/CameraITS/tests/scene2_a/test_num_faces.py
index 5d8eea1..9cdca32 100644
--- a/apps/CameraITS/tests/scene2_a/test_num_faces.py
+++ b/apps/CameraITS/tests/scene2_a/test_num_faces.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies 3 faces with different skin tones are detected."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene2_b/test_auto_per_frame_control.py b/apps/CameraITS/tests/scene2_b/test_auto_per_frame_control.py
index b947d4f7..eaa5531 100644
--- a/apps/CameraITS/tests/scene2_b/test_auto_per_frame_control.py
+++ b/apps/CameraITS/tests/scene2_b/test_auto_per_frame_control.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies per_frame_control."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene2_e/test_continuous_picture.py b/apps/CameraITS/tests/scene2_e/test_continuous_picture.py
index 48e49ea..acd914f 100644
--- a/apps/CameraITS/tests/scene2_e/test_continuous_picture.py
+++ b/apps/CameraITS/tests/scene2_e/test_continuous_picture.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies 3A converges in CONTINUOUS_PICTURE mode."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene3/test_3a_consistency.py b/apps/CameraITS/tests/scene3/test_3a_consistency.py
index 0fa008e..71469fe 100644
--- a/apps/CameraITS/tests/scene3/test_3a_consistency.py
+++ b/apps/CameraITS/tests/scene3/test_3a_consistency.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies 3A settles consistently 3x."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene3/test_edge_enhancement.py b/apps/CameraITS/tests/scene3/test_edge_enhancement.py
index fdfb35c..9539971 100644
--- a/apps/CameraITS/tests/scene3/test_edge_enhancement.py
+++ b/apps/CameraITS/tests/scene3/test_edge_enhancement.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies android.edge.mode works properly."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene3/test_flip_mirror.py b/apps/CameraITS/tests/scene3/test_flip_mirror.py
index 24606fa5..2282a28 100644
--- a/apps/CameraITS/tests/scene3/test_flip_mirror.py
+++ b/apps/CameraITS/tests/scene3/test_flip_mirror.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies image is not flipped or mirrored."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene3/test_lens_movement_reporting.py b/apps/CameraITS/tests/scene3/test_lens_movement_reporting.py
index 1f3c97c..9eba414 100644
--- a/apps/CameraITS/tests/scene3/test_lens_movement_reporting.py
+++ b/apps/CameraITS/tests/scene3/test_lens_movement_reporting.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies android.lens.state when lens is moving."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene3/test_lens_position.py b/apps/CameraITS/tests/scene3/test_lens_position.py
index 4d3e99c..09f74f0 100644
--- a/apps/CameraITS/tests/scene3/test_lens_position.py
+++ b/apps/CameraITS/tests/scene3/test_lens_position.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies android.lens.focusDistance for lens moving and stationary."""
 
 
 import logging
diff --git a/apps/CameraITS/tests/scene3/test_reprocess_edge_enhancement.py b/apps/CameraITS/tests/scene3/test_reprocess_edge_enhancement.py
index 1c17a73..b19ac1f 100644
--- a/apps/CameraITS/tests/scene3/test_reprocess_edge_enhancement.py
+++ b/apps/CameraITS/tests/scene3/test_reprocess_edge_enhancement.py
@@ -11,6 +11,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Verifies android.edge.mode param behavior for reprocessing reqs."""
 
 
 import logging
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
index 902438f..70f725c7 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
@@ -1877,9 +1877,6 @@
     public void testAddNetworkWithKeychainKey_granted() throws Exception {
         assumeHasWifiFeature();
 
-        // STOPSHIP(b/160457441): remove when KS2 is the only one.
-        assumeTrue(getBooleanSystemProperty("persist.android.security.keystore2.enable", false));
-
         executeDeviceTestMethod(".WifiTest", "testAddNetworkWithKeychainKey_granted");
     }
 
@@ -1887,9 +1884,6 @@
     public void testAddNetworkSuggestionWithKeychainKey_granted() throws Exception {
         assumeHasWifiFeature();
 
-        // STOPSHIP(b/160457441): remove when KS2 is the only one.
-        assumeTrue(getBooleanSystemProperty("persist.android.security.keystore2.enable", false));
-
         executeDeviceTestMethod(".WifiTest", "testAddNetworkSuggestionWithKeychainKey_granted");
     }
 
@@ -1897,9 +1891,6 @@
     public void testAddNetworkSuggestionWithKeychainKey_notGranted() throws Exception {
         assumeHasWifiFeature();
 
-        // STOPSHIP(b/160457441): remove when KS2 is the only one.
-        assumeTrue(getBooleanSystemProperty("persist.android.security.keystore2.enable", false));
-
         executeDeviceTestMethod(".WifiTest", "testAddNetworkSuggestionWithKeychainKey_notGranted");
     }
 
@@ -1907,9 +1898,6 @@
     public void testAddNetworkWithKeychainKey_notGranted() throws Exception {
         assumeHasWifiFeature();
 
-        // STOPSHIP(b/160457441): remove when KS2 is the only one.
-        assumeTrue(getBooleanSystemProperty("persist.android.security.keystore2.enable", false));
-
         executeDeviceTestMethod(".WifiTest", "testAddNetworkWithKeychainKey_notGranted");
     }
 
diff --git a/hostsidetests/hdmicec/src/android/hdmicec/cts/common/HdmiCecStartupTest.java b/hostsidetests/hdmicec/src/android/hdmicec/cts/common/HdmiCecStartupTest.java
index bab9e65..fd0f33c 100644
--- a/hostsidetests/hdmicec/src/android/hdmicec/cts/common/HdmiCecStartupTest.java
+++ b/hostsidetests/hdmicec/src/android/hdmicec/cts/common/HdmiCecStartupTest.java
@@ -37,7 +37,7 @@
 import java.util.stream.Collectors;
 
 /**
- * HDMI CEC tests verifying CEC messages sent after startup (CEC 2.0 CTS Section 7.5)
+ * HDMI CEC tests verifying CEC messages sent after startup
  */
 @RunWith(DeviceJUnit4ClassRunner.class)
 public final class HdmiCecStartupTest extends BaseHdmiCecCtsTest {
@@ -50,11 +50,13 @@
                     .around(hdmiCecClient);
 
     /**
+     * CEC 1.4
+     *
      * Tests that the device sends all the messages that should be sent on startup. It also ensures
      * that only the device only sends messages which are allowed by the spec.
      */
     @Test
-    public void cectVerifyStartupMessages() throws Exception {
+    public void cectVerifyStartupMessages_Cec14b() throws Exception {
         ITestDevice device = getDevice();
 
         List<CecOperand> expectedMessages = Collections.singletonList(
@@ -85,10 +87,8 @@
                 notPermittedMessages).isEmpty();
         assertWithMessage("Some necessary messages are missing").that(requiredMessages).hasSize(
                 expectedMessages.size());
-        assertWithMessage("Expected <Report Features> first").that(
-                requiredMessages.get(0)).isEqualTo(CecOperand.REPORT_FEATURES);
-        assertWithMessage("Expected <Report Physical Address> last").that(
-                requiredMessages.get(1)).isEqualTo(CecOperand.REPORT_PHYSICAL_ADDRESS);
+        assertWithMessage("Expected <Report Physical Address>").that(
+                requiredMessages.get(0)).isEqualTo(CecOperand.REPORT_PHYSICAL_ADDRESS);
     }
 
     /**
diff --git a/hostsidetests/media/app/MediaMetricsTest/Android.bp b/hostsidetests/media/app/MediaMetricsTest/Android.bp
index 942e070..7ac3324 100644
--- a/hostsidetests/media/app/MediaMetricsTest/Android.bp
+++ b/hostsidetests/media/app/MediaMetricsTest/Android.bp
@@ -28,6 +28,7 @@
     ],
     static_libs: [
         "androidx.test.rules",
+        "truth-prebuilt",
     ],
     sdk_version: "test_current",
     min_sdk_version: "30",
diff --git a/hostsidetests/media/app/MediaMetricsTest/src/android/media/metrics/cts/MediaMetricsAtomHostSideTests.java b/hostsidetests/media/app/MediaMetricsTest/src/android/media/metrics/cts/MediaMetricsAtomHostSideTests.java
index 8416e58..a252fa7 100644
--- a/hostsidetests/media/app/MediaMetricsTest/src/android/media/metrics/cts/MediaMetricsAtomHostSideTests.java
+++ b/hostsidetests/media/app/MediaMetricsTest/src/android/media/metrics/cts/MediaMetricsAtomHostSideTests.java
@@ -16,14 +16,19 @@
 
 package android.media.metrics.cts;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import android.content.Context;
+import android.media.metrics.LogSessionId;
 import android.media.metrics.MediaMetricsManager;
 import android.media.metrics.NetworkEvent;
 import android.media.metrics.PlaybackErrorEvent;
 import android.media.metrics.PlaybackMetrics;
 import android.media.metrics.PlaybackSession;
 import android.media.metrics.PlaybackStateEvent;
+import android.media.metrics.RecordingSession;
 import android.media.metrics.TrackChangeEvent;
+import android.os.Bundle;
 
 import androidx.test.InstrumentationRegistry;
 
@@ -40,6 +45,7 @@
                 new PlaybackStateEvent.Builder()
                         .setTimeSinceCreatedMillis(1763L)
                         .setState(PlaybackStateEvent.STATE_JOINING_FOREGROUND)
+                        .setMetricsBundle(new Bundle())
                         .build();
         s.reportPlaybackStateEvent(e);
     }
@@ -52,9 +58,10 @@
         PlaybackErrorEvent e =
                 new PlaybackErrorEvent.Builder()
                         .setTimeSinceCreatedMillis(17630000L)
-                        .setErrorCode(PlaybackErrorEvent.ERROR_CODE_RUNTIME)
+                        .setErrorCode(PlaybackErrorEvent.ERROR_RUNTIME)
                         .setSubErrorCode(378)
                         .setException(new Exception("test exception"))
+                        .setMetricsBundle(new Bundle())
                         .build();
         s.reportPlaybackErrorEvent(e);
     }
@@ -88,6 +95,7 @@
                 new NetworkEvent.Builder()
                         .setTimeSinceCreatedMillis(3032L)
                         .setNetworkType(NetworkEvent.NETWORK_TYPE_WIFI)
+                        .setMetricsBundle(new Bundle())
                         .build();
         s.reportNetworkEvent(e);
     }
@@ -113,7 +121,32 @@
                         .setNetworkBytesRead(102400)
                         .setLocalBytesRead(2000)
                         .setNetworkTransferDurationMillis(6000)
+                        .setDrmSessionId(new byte[] {2, 3, 3, 10})
+                        .setMetricsBundle(new Bundle())
                         .build();
         s.reportPlaybackMetrics(e);
     }
+
+    @Test
+    public void testSessionId() throws Exception {
+        Context context = InstrumentationRegistry.getContext();
+        MediaMetricsManager manager = context.getSystemService(MediaMetricsManager.class);
+        PlaybackSession s = manager.createPlaybackSession();
+
+        LogSessionId idObj = s.getSessionId();
+        assertThat(idObj).isNotEqualTo(null);
+        assertThat(idObj.getStringId().length()).isGreaterThan(0);
+    }
+
+    @Test
+    public void testRecordingSession() throws Exception {
+        Context context = InstrumentationRegistry.getContext();
+        MediaMetricsManager manager = context.getSystemService(MediaMetricsManager.class);
+        RecordingSession s = manager.createRecordingSession();
+
+        assertThat(s).isNotEqualTo(null);
+        LogSessionId idObj = s.getSessionId();
+        assertThat(idObj).isNotEqualTo(null);
+        assertThat(idObj.getStringId().length()).isGreaterThan(0);
+    }
 }
diff --git a/hostsidetests/media/src/android/media/metrics/cts/MediaMetricsAtomTests.java b/hostsidetests/media/src/android/media/metrics/cts/MediaMetricsAtomTests.java
index 43548043..313bc16 100644
--- a/hostsidetests/media/src/android/media/metrics/cts/MediaMetricsAtomTests.java
+++ b/hostsidetests/media/src/android/media/metrics/cts/MediaMetricsAtomTests.java
@@ -30,6 +30,8 @@
 import com.android.tradefed.testtype.IBuildReceiver;
 
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Base64;
 import java.util.List;
 
 public class MediaMetricsAtomTests extends DeviceTestCase implements IBuildReceiver {
@@ -188,5 +190,35 @@
         assertThat(result.getNetworkBytesRead()).isEqualTo(102400);
         assertThat(result.getLocalBytesRead()).isEqualTo(2000);
         assertThat(result.getNetworkTransferDurationMillis()).isEqualTo(6000);
+        // TODO: needs Base64 decoders to verify the data
+        assertThat(result.getDrmSessionId()).isNotEqualTo(null);
     }
+
+    public void testSessionId() throws Exception {
+        ConfigUtils.uploadConfigForPushedAtom(getDevice(), TEST_PKG,
+                AtomsProto.Atom.MEDIAMETRICS_PLAYBACK_REPORTED_FIELD_NUMBER);
+        DeviceUtils.runDeviceTests(
+                getDevice(),
+                TEST_PKG,
+                "android.media.metrics.cts.MediaMetricsAtomHostSideTests",
+                "testSessionId");
+        Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+
+        List<StatsLog.EventMetricData> data = ReportUtils.getEventMetricDataList(getDevice());
+        assertThat(data.size()).isEqualTo(0);
+   }
+
+    public void testRecordingSession() throws Exception {
+        ConfigUtils.uploadConfigForPushedAtom(getDevice(), TEST_PKG,
+                AtomsProto.Atom.MEDIAMETRICS_PLAYBACK_REPORTED_FIELD_NUMBER);
+        DeviceUtils.runDeviceTests(
+                getDevice(),
+                TEST_PKG,
+                "android.media.metrics.cts.MediaMetricsAtomHostSideTests",
+                "testRecordingSession");
+        Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+
+        List<StatsLog.EventMetricData> data = ReportUtils.getEventMetricDataList(getDevice());
+        assertThat(data.size()).isEqualTo(0);
+   }
 }
diff --git a/hostsidetests/security/src/android/security/cts/KernelConfigTest.java b/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
index 6de6044..aab9484 100644
--- a/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
+++ b/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
@@ -249,6 +249,16 @@
         put("mt6873", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
         put("MT6853V/TZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
         put("MT6853V/TNZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6833V/ZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6833V/NZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6833V/TZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6833V/TNZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6833V/MZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6833V/MNZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6877V/ZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6877V/NZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6877V/TZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
+        put("MT6877V/TNZA", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
         put("SDMMAGPIE", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
         put("SM6150", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
         put("SM7150", new String[]{"CONFIG_HARDEN_BRANCH_PREDICTOR=y"});
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2016-8332/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2016-8332/Android.bp
index cb2f6bd..382d629 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2016-8332/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2016-8332/Android.bp
@@ -28,8 +28,8 @@
     cflags: [
         "-DCHECK_OVERFLOW",
     ],
-    shared_libs: [
-        "libpdfium",
+    static_libs: [
+        "libpdfium-libopenjpeg2",
     ],
     include_dirs: [
         "external/pdfium/third_party/libopenjpeg20",
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/gnss/GnssPowerStatsTests.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/gnss/GnssPowerStatsTests.java
new file mode 100644
index 0000000..47f1905
--- /dev/null
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/gnss/GnssPowerStatsTests.java
@@ -0,0 +1,106 @@
+/*
+ * 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.cts.statsdatom.gnss;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.cts.statsdatom.lib.AtomTestUtils;
+import android.cts.statsdatom.lib.ConfigUtils;
+import android.cts.statsdatom.lib.DeviceUtils;
+import android.cts.statsdatom.lib.ReportUtils;
+
+import com.android.os.AtomsProto;
+import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.testtype.DeviceTestCase;
+import com.android.tradefed.testtype.IBuildReceiver;
+
+import java.util.List;
+
+public class GnssPowerStatsTests extends DeviceTestCase implements IBuildReceiver {
+    private static final boolean OPTIONAL_TESTS_ENABLED = true;
+
+    private IBuildInfo mCtsBuild;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        assertThat(mCtsBuild).isNotNull();
+        ConfigUtils.removeConfig(getDevice());
+        ReportUtils.clearReports(getDevice());
+        DeviceUtils.installStatsdTestApp(getDevice(), mCtsBuild);
+        Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        ConfigUtils.removeConfig(getDevice());
+        ReportUtils.clearReports(getDevice());
+        DeviceUtils.uninstallStatsdTestApp(getDevice());
+        super.tearDown();
+    }
+
+    @Override
+    public void setBuild(IBuildInfo buildInfo) {
+        mCtsBuild = buildInfo;
+    }
+
+    public void testGnssPowerStats() throws Exception {
+        if (!OPTIONAL_TESTS_ENABLED) return;
+
+        ConfigUtils.uploadConfigForPulledAtom(getDevice(), DeviceUtils.STATSD_ATOM_TEST_PKG,
+                AtomsProto.Atom.GNSS_POWER_STATS_FIELD_NUMBER);
+
+        AtomTestUtils.sendAppBreadcrumbReportedAtom(getDevice());
+        Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+
+        List<AtomsProto.Atom> dataList = ReportUtils.getGaugeMetricAtoms(getDevice());
+
+        for (AtomsProto.Atom atom : dataList) {
+            assertThat(atom.getGnssPowerStats().getElapsedRealtimeUncertaintyNanos())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getTotalEnergyMicroJoule()).isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getSinglebandTrackingModeEnergyMicroJoule())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getMultibandTrackingModeEnergyMicroJoule())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getSinglebandAcquisitionModeEnergyMicroJoule())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getMultibandAcquisitionModeEnergyMicroJoule())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getVendorSpecificPowerModesEnergyMicroJoule0())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getVendorSpecificPowerModesEnergyMicroJoule1())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getVendorSpecificPowerModesEnergyMicroJoule2())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getVendorSpecificPowerModesEnergyMicroJoule3())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getVendorSpecificPowerModesEnergyMicroJoule4())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getVendorSpecificPowerModesEnergyMicroJoule5())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getVendorSpecificPowerModesEnergyMicroJoule6())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getVendorSpecificPowerModesEnergyMicroJoule7())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getVendorSpecificPowerModesEnergyMicroJoule8())
+                    .isAtLeast(0L);
+            assertThat(atom.getGnssPowerStats().getVendorSpecificPowerModesEnergyMicroJoule9())
+                    .isAtLeast(0L);
+        }
+    }
+}
diff --git a/hostsidetests/tagging/sdk_30/src/android/cts/tagging/sdk30/TaggingTest.java b/hostsidetests/tagging/sdk_30/src/android/cts/tagging/sdk30/TaggingTest.java
index 6261de1..51dedf2 100644
--- a/hostsidetests/tagging/sdk_30/src/android/cts/tagging/sdk30/TaggingTest.java
+++ b/hostsidetests/tagging/sdk_30/src/android/cts/tagging/sdk30/TaggingTest.java
@@ -73,6 +73,7 @@
         mContext.startActivity(intent);
 
         assertTrue(receiver.await());
+        assertTrue(Utils.mistaggedKernelUaccessFails());
     }
 
     @Test
@@ -90,7 +91,7 @@
         mContext.startActivity(intent);
 
         assertTrue(receiver.await());
-        assertTrue(Utils.mistaggedKernelUaccessFails());
+        assertFalse(Utils.mistaggedKernelUaccessFails());
     }
 
     @Test
diff --git a/tests/app/NotificationProvider/src/com/android/test/notificationprovider/RichNotificationActivity.kt b/tests/app/NotificationProvider/src/com/android/test/notificationprovider/RichNotificationActivity.kt
index 4197760..e511936 100644
--- a/tests/app/NotificationProvider/src/com/android/test/notificationprovider/RichNotificationActivity.kt
+++ b/tests/app/NotificationProvider/src/com/android/test/notificationprovider/RichNotificationActivity.kt
@@ -27,7 +27,7 @@
  */
 class RichNotificationActivity : Activity() {
     companion object {
-        const val NOTIFICATION_CHANNEL_ID = "NotificationManagerTest"
+        const val NOTIFICATION_MANAGER_CHANNEL_ID = "NotificationManagerTest"
         const val EXTRA_ACTION = "action"
         const val ACTION_SEND_7 = "send-7"
         const val ACTION_SEND_8 = "send-8"
@@ -35,15 +35,15 @@
         const val ACTION_CANCEL_8 = "cancel-8"
     }
 
-    enum class NotificationPreset(val id: Int) {
-        Preset7(7),
-        Preset8(8);
+    enum class NotificationPreset(val id: Int, val channelId: String) {
+        Preset7(7, NOTIFICATION_MANAGER_CHANNEL_ID),
+        Preset8(8, NOTIFICATION_MANAGER_CHANNEL_ID);
 
         fun build(context: Context): Notification {
             val extras = Bundle()
             extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI,
                     "content://com.android.test.notificationprovider.provider/background$id.png")
-            return Notification.Builder(context, NOTIFICATION_CHANNEL_ID)
+            return Notification.Builder(context, NOTIFICATION_MANAGER_CHANNEL_ID)
                     .setContentTitle("Rich Notification #$id")
                     .setSmallIcon(android.R.drawable.sym_def_app_icon)
                     .addExtras(extras)
@@ -59,11 +59,7 @@
             ACTION_SEND_8 -> sendNotification(NotificationPreset.Preset8)
             ACTION_CANCEL_7 -> cancelNotification(NotificationPreset.Preset7)
             ACTION_CANCEL_8 -> cancelNotification(NotificationPreset.Preset8)
-            else -> {
-                // reset both
-                cancelNotification(NotificationPreset.Preset7)
-                cancelNotification(NotificationPreset.Preset8)
-            }
+            else -> NotificationPreset.values().forEach(::cancelNotification)
         }
         finish()
     }
@@ -71,8 +67,8 @@
     private val notificationManager by lazy { getSystemService(NotificationManager::class.java)!! }
 
     private fun sendNotification(preset: NotificationPreset) {
-        notificationManager.createNotificationChannel(NotificationChannel(NOTIFICATION_CHANNEL_ID,
-                "Notifications", NotificationManager.IMPORTANCE_DEFAULT))
+        notificationManager.createNotificationChannel(NotificationChannel(preset.channelId,
+                "${preset.channelId} Notifications", NotificationManager.IMPORTANCE_DEFAULT))
         notificationManager.notify(preset.id, preset.build(this))
     }
 
diff --git a/tests/app/app/Android.bp b/tests/app/app/Android.bp
index 0a7de18..44c365c 100644
--- a/tests/app/app/Android.bp
+++ b/tests/app/app/Android.bp
@@ -46,6 +46,7 @@
         "cts",
         "general-tests",
     ],
+    additional_manifests: ["ProviderAndroidManifest.xml"],
     platform_apis: true,
 }
 
diff --git a/tests/app/app/ProviderAndroidManifest.xml b/tests/app/app/ProviderAndroidManifest.xml
new file mode 100644
index 0000000..2aef16d
--- /dev/null
+++ b/tests/app/app/ProviderAndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ * 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.
+ -->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+     package="android.app.stubs">
+
+    <application>
+
+        <provider
+            android:name="android.app.stubs.AssetFileProvider"
+            android:authorities="android.app.stubs.assets"
+            android:exported="false"
+            android:grantUriPermissions="true"
+        />
+
+    </application>
+
+</manifest>
diff --git a/tests/app/app/assets/picture_400_by_300.png b/tests/app/app/assets/picture_400_by_300.png
new file mode 100644
index 0000000..cc3283c
--- /dev/null
+++ b/tests/app/app/assets/picture_400_by_300.png
Binary files differ
diff --git a/tests/app/app/src/android/app/stubs/AssetFileProvider.kt b/tests/app/app/src/android/app/stubs/AssetFileProvider.kt
new file mode 100644
index 0000000..7b3fb67
--- /dev/null
+++ b/tests/app/app/src/android/app/stubs/AssetFileProvider.kt
@@ -0,0 +1,58 @@
+/*
+ * 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.app.stubs
+
+import android.content.ContentProvider
+import android.content.ContentValues
+import android.content.res.AssetFileDescriptor
+import android.database.Cursor
+import android.net.Uri
+
+class AssetFileProvider : ContentProvider() {
+    override fun onCreate() = true
+
+    override fun openAssetFile(uri: Uri, mode: String): AssetFileDescriptor? {
+        val assets = context?.assets
+        val filename = uri.lastPathSegment
+        if (mode == "r" && assets != null && filename != null) {
+            return assets.openFd(filename)
+        }
+        return super.openAssetFile(uri, mode)
+    }
+
+    override fun query(
+        uri: Uri,
+        projection: Array<String>?,
+        selection: String?,
+        selectionArgs: Array<String>?,
+        sortOrder: String?
+    ): Cursor = throw UnsupportedOperationException()
+
+    override fun getType(uri: Uri): String? = null
+
+    override fun insert(uri: Uri, values: ContentValues?): Uri =
+            throw UnsupportedOperationException()
+
+    override fun delete(uri: Uri, selection: String?, selectionArgs: Array<String>?): Int =
+            throw UnsupportedOperationException()
+
+    override fun update(
+        uri: Uri,
+        values: ContentValues?,
+        selection: String?,
+        selectionArgs: Array<String>?
+    ): Int = throw UnsupportedOperationException()
+}
\ No newline at end of file
diff --git a/tests/app/app/src/android/app/stubs/TestNotificationListener.java b/tests/app/app/src/android/app/stubs/TestNotificationListener.java
index 14d5416..eabde5c 100644
--- a/tests/app/app/src/android/app/stubs/TestNotificationListener.java
+++ b/tests/app/app/src/android/app/stubs/TestNotificationListener.java
@@ -21,6 +21,8 @@
 import android.service.notification.StatusBarNotification;
 
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
 
 public class TestNotificationListener extends NotificationListenerService {
     public static final String TAG = "TestNotificationListener";
@@ -30,7 +32,7 @@
     private ArrayList<String> mTestPackages = new ArrayList<>();
 
     public ArrayList<StatusBarNotification> mPosted = new ArrayList<>();
-    public ArrayList<StatusBarNotification> mRemoved = new ArrayList<>();
+    public Map<String, Integer> mRemoved = new HashMap<>();
     public RankingMap mRankingMap;
 
     /**
@@ -105,10 +107,11 @@
     }
 
     @Override
-    public void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap) {
+    public void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap,
+            int reason) {
         if (sbn == null || !mTestPackages.contains(sbn.getPackageName())) { return; }
         mRankingMap = rankingMap;
-        mRemoved.add(sbn);
+        mRemoved.put(sbn.getKey(), reason);
     }
 
     @Override
diff --git a/tests/app/src/android/app/cts/NotificationManagerTest.java b/tests/app/src/android/app/cts/NotificationManagerTest.java
index a37144d..89e5e9c 100644
--- a/tests/app/src/android/app/cts/NotificationManagerTest.java
+++ b/tests/app/src/android/app/cts/NotificationManagerTest.java
@@ -568,6 +568,20 @@
         fail("Couldn't find posted notification with id= " + id);
     }
 
+    private int getCancellationReason(String key) {
+        for (int tries = 3; tries-- > 0; ) {
+            if (mListener.mRemoved.containsKey(key)) {
+                return mListener.mRemoved.get(key);
+            }
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException ex) {
+                // pass
+            }
+        }
+        return -1;
+    }
+
     private boolean checkNotificationExistence(int id, boolean shouldExist) {
         // notification is a bit asynchronous so it may take a few ms to appear in
         // getActiveNotifications()
@@ -4254,6 +4268,21 @@
         }
     }
 
+    public void testChannelDeletion_cancelReason() throws Exception {
+        setUpNotifListener();
+
+        sendNotification(566, R.drawable.black);
+
+        Thread.sleep(500); // wait for notification listener to receive notification
+        assertEquals(1, mListener.mPosted.size());
+        String key = mListener.mPosted.get(0).getKey();
+
+        mNotificationManager.deleteNotificationChannel(NOTIFICATION_CHANNEL_ID);
+
+        assertEquals(NotificationListenerService.REASON_CHANNEL_REMOVED,
+                getCancellationReason(key));
+    }
+
     private static class EventCallback extends Handler {
         private static final int BROADCAST_RECEIVED = 1;
         private static final int SERVICE_STARTED = 2;
diff --git a/tests/app/src/android/app/cts/NotificationTemplateTest.kt b/tests/app/src/android/app/cts/NotificationTemplateTest.kt
index b294b6e..954a6c5 100644
--- a/tests/app/src/android/app/cts/NotificationTemplateTest.kt
+++ b/tests/app/src/android/app/cts/NotificationTemplateTest.kt
@@ -25,6 +25,7 @@
 import android.graphics.Canvas
 import android.graphics.Color
 import android.graphics.drawable.Icon
+import android.net.Uri
 import android.view.View
 import android.widget.ImageView
 import android.widget.TextView
@@ -66,6 +67,22 @@
         }
     }
 
+    fun testWideIcon_inCollapsedState_canShowUriIcon() {
+        val uri = Uri.parse("content://android.app.stubs.assets/picture_400_by_300.png")
+        val icon = Icon.createWithContentUri(uri)
+        val views = Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
+                .setSmallIcon(R.drawable.ic_media_play)
+                .setContentTitle("Title")
+                .setLargeIcon(icon)
+                .createContentView()
+        checkIconView(views) { iconView ->
+            assertThat(iconView.visibility).isEqualTo(View.VISIBLE)
+            assertThat(iconView.width.toFloat())
+                    .isWithin(1f)
+                    .of((iconView.height * 4 / 3).toFloat())
+        }
+    }
+
     fun testWideIcon_inCollapsedState_neverNarrowerThanSquare() {
         val icon = Bitmap.createBitmap(200, 300, Bitmap.Config.ARGB_8888)
         val views = Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
@@ -217,6 +234,74 @@
         }
     }
 
+    fun testBigPictureStyle_populatesExtrasCompatibly() {
+        val bitmap = Bitmap.createBitmap(40, 30, Bitmap.Config.ARGB_8888)
+        val uri = Uri.parse("content://android.app.stubs.assets/picture_400_by_300.png")
+        val iconWithUri = Icon.createWithContentUri(uri)
+        val iconWithBitmap = Icon.createWithBitmap(bitmap)
+        val style = Notification.BigPictureStyle()
+        val builder = Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
+                .setSmallIcon(R.drawable.ic_media_play)
+                .setContentTitle("Title")
+                .setStyle(style)
+
+        style.bigPicture(bitmap)
+        builder.build().let {
+            assertThat(it.extras.getParcelable<Bitmap>(Notification.EXTRA_PICTURE))
+                    .isSameInstanceAs(bitmap)
+            assertThat(it.extras.get(Notification.EXTRA_PICTURE_ICON)).isNull()
+        }
+
+        style.bigPicture(iconWithUri)
+        builder.build().let {
+            assertThat(it.extras.get(Notification.EXTRA_PICTURE)).isNull()
+            assertThat(it.extras.getParcelable<Icon>(Notification.EXTRA_PICTURE_ICON))
+                    .isSameInstanceAs(iconWithUri)
+        }
+
+        style.bigPicture(iconWithBitmap)
+        builder.build().let {
+            assertThat(it.extras.getParcelable<Bitmap>(Notification.EXTRA_PICTURE))
+                    .isSameInstanceAs(bitmap)
+            assertThat(it.extras.get(Notification.EXTRA_PICTURE_ICON)).isNull()
+        }
+    }
+
+    fun testBigPictureStyle_bigPictureUriIcon() {
+        val pictureUri = Uri.parse("content://android.app.stubs.assets/picture_400_by_300.png")
+        val pictureIcon = Icon.createWithContentUri(pictureUri)
+        val builder = Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
+                .setSmallIcon(R.drawable.ic_media_play)
+                .setContentTitle("Title")
+                .setStyle(Notification.BigPictureStyle().bigPicture(pictureIcon))
+        checkViews(builder.createBigContentView()) {
+            val pictureView = requireViewByIdName<ImageView>("big_picture")
+            assertThat(pictureView.visibility).isEqualTo(View.VISIBLE)
+            assertThat(pictureView.drawable.intrinsicWidth).isEqualTo(400)
+            assertThat(pictureView.drawable.intrinsicHeight).isEqualTo(300)
+        }
+    }
+
+    fun testPromoteBigPicture_withBigPictureUriIcon() {
+        val pictureUri = Uri.parse("content://android.app.stubs.assets/picture_400_by_300.png")
+        val pictureIcon = Icon.createWithContentUri(pictureUri)
+        val builder = Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
+                .setSmallIcon(R.drawable.ic_media_play)
+                .setContentTitle("Title")
+                .setStyle(Notification.BigPictureStyle()
+                        .bigPicture(pictureIcon)
+                        .showBigPictureWhenCollapsed(true)
+                )
+        checkIconView(builder.createContentView()) { iconView ->
+            assertThat(iconView.visibility).isEqualTo(View.VISIBLE)
+            assertThat(iconView.width.toFloat())
+                    .isWithin(1f)
+                    .of((iconView.height * 4 / 3).toFloat())
+            assertThat(iconView.drawable.intrinsicWidth).isEqualTo(400)
+            assertThat(iconView.drawable.intrinsicHeight).isEqualTo(300)
+        }
+    }
+
     fun testPromoteBigPicture_withoutLargeIcon() {
         val picture = Bitmap.createBitmap(40, 30, Bitmap.Config.ARGB_8888)
         val builder = Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
@@ -295,6 +380,25 @@
             assertThat(iconView.drawable.intrinsicWidth).isEqualTo(80)
             assertThat(iconView.drawable.intrinsicHeight).isEqualTo(75)
         }
+        assertThat(builder.build().extras.getParcelable<Bitmap>(Notification.EXTRA_PICTURE))
+                .isSameInstanceAs(picture)
+    }
+
+    fun testBigPicture_withBigLargeIcon_withContentUri() {
+        val iconUri = Uri.parse("content://android.app.stubs.assets/picture_400_by_300.png")
+        val icon = Icon.createWithContentUri(iconUri)
+        val builder = Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
+                .setSmallIcon(R.drawable.ic_media_play)
+                .setContentTitle("Title")
+                .setStyle(Notification.BigPictureStyle().bigLargeIcon(icon))
+        checkIconView(builder.createBigContentView()) { iconView ->
+            assertThat(iconView.visibility).isEqualTo(View.VISIBLE)
+            assertThat(iconView.width.toFloat())
+                    .isWithin(1f)
+                    .of((iconView.height * 4 / 3).toFloat())
+            assertThat(iconView.drawable.intrinsicWidth).isEqualTo(400)
+            assertThat(iconView.drawable.intrinsicHeight).isEqualTo(300)
+        }
     }
 
     @SmallTest
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/AdminPermissionControlParamsTests.java b/tests/devicepolicy/src/android/devicepolicy/cts/AdminPermissionControlParamsTests.java
new file mode 100644
index 0000000..1719c94
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/AdminPermissionControlParamsTests.java
@@ -0,0 +1,85 @@
+/*
+ * 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.devicepolicy.cts;
+
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DevicePolicyManager;
+import android.os.Parcel;
+import android.permission.AdminPermissionControlParams;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import com.android.bedstead.harrier.annotations.Postsubmit;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class AdminPermissionControlParamsTests {
+    private static final String PKG = "somePackage";
+    private static final String PERMISSION = "somePackage";
+    private static final int GRANT_STATE = DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED;
+    private static final boolean CAN_ADMIN_GRANT = true;
+
+    @Postsubmit(reason="new test")
+    @Test
+    public void gettersReturnConstructorValue() {
+        AdminPermissionControlParams params = createViaParcel(
+                PKG, PERMISSION, GRANT_STATE, CAN_ADMIN_GRANT);
+
+        assertThat(params.getGranteePackageName()).isEqualTo(PKG);
+        assertThat(params.getPermission()).isEqualTo(PERMISSION);
+        assertThat(params.getGrantState()).isEqualTo(GRANT_STATE);
+        assertThat(params.canAdminGrantSensorsPermissions()).isEqualTo(CAN_ADMIN_GRANT);
+    }
+
+    @Postsubmit(reason="new test")
+    @Test
+    public void correctParcelingAndUnparceling() {
+        AdminPermissionControlParams params = createViaParcel();
+
+        Parcel parcel = Parcel.obtain();
+        params.writeToParcel(parcel, 0);
+        parcel.setDataPosition(0);
+        AdminPermissionControlParams loadedParams =
+                AdminPermissionControlParams.CREATOR.createFromParcel(parcel);
+
+        assertThat(params.getGranteePackageName()).isEqualTo(loadedParams.getGranteePackageName());
+        assertThat(params.getPermission()).isEqualTo(loadedParams.getPermission());
+        assertThat(params.getGrantState()).isEqualTo(loadedParams.getGrantState());
+        assertThat(params.canAdminGrantSensorsPermissions())
+                .isEqualTo(loadedParams.canAdminGrantSensorsPermissions());
+    }
+
+    private AdminPermissionControlParams createViaParcel(
+            String packageName, String permission, int grantState, boolean canAdminGrant) {
+        Parcel parcel = Parcel.obtain();
+        parcel.writeString(packageName);
+        parcel.writeString(permission);
+        parcel.writeInt(grantState);
+        parcel.writeBoolean(canAdminGrant);
+        parcel.setDataPosition(0);
+
+        return AdminPermissionControlParams.CREATOR.createFromParcel(parcel);
+    }
+
+    private AdminPermissionControlParams createViaParcel() {
+        return createViaParcel(PKG, PERMISSION, GRANT_STATE, CAN_ADMIN_GRANT);
+    }
+}
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
index cd66878..36f9890 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
@@ -22,10 +22,12 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import android.content.ComponentCallbacks;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
+import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.os.IBinder;
 import android.platform.test.annotations.AppModeFull;
@@ -33,8 +35,13 @@
 import android.view.View;
 import android.view.WindowManager;
 
+import androidx.annotation.NonNull;
+
 import org.junit.Test;
 
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 /**
  * Tests that verify the behavior of window context
  *
@@ -99,4 +106,45 @@
             windowContext.unbindService(serviceConnection);
         }
     }
+
+    /**
+     * Verify if the {@link ComponentCallbacks#onConfigurationChanged(Configuration)} callback
+     * is received when the window context configuration changes.
+     */
+    @Test
+    public void testWindowContextRegisterComponentCallbacks() throws Exception {
+        final TestComponentCallbacks callbacks = new TestComponentCallbacks();
+        final WindowManagerState.DisplayContent display = createManagedVirtualDisplaySession()
+                .setSimulateDisplay(true).createDisplay();
+        final Context windowContext = createWindowContext(display.mId);
+        final DisplayMetricsSession displayMetricsSession =
+                createManagedDisplayMetricsSession(display.mId);
+
+        windowContext.registerComponentCallbacks(callbacks);
+
+        callbacks.mLatch = new CountDownLatch(1);
+
+        displayMetricsSession.changeDisplayMetrics(1.2 /* sizeRatio */, 1.1 /* densityRatio */);
+
+        // verify if there is a gicallback from the window context configuration change.
+        assertTrue(callbacks.mLatch.await(4, TimeUnit.SECONDS));
+        Rect bounds = callbacks.mConfiguration.windowConfiguration.getBounds();
+        assertBoundsEquals(displayMetricsSession.getDisplayMetrics(), bounds);
+
+        windowContext.unregisterComponentCallbacks(callbacks);
+    }
+
+    private static class TestComponentCallbacks implements ComponentCallbacks {
+        private Configuration mConfiguration;
+        private CountDownLatch mLatch = new CountDownLatch(1);
+
+        @Override
+        public void onConfigurationChanged(@NonNull Configuration newConfig) {
+            mConfiguration = newConfig;
+            mLatch.countDown();
+        }
+
+        @Override
+        public void onLowMemory() {}
+    }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationTestBase.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationTestBase.java
index 4bd5106..76b34f7 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationTestBase.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationTestBase.java
@@ -21,6 +21,7 @@
 import static android.view.WindowInsets.Type.navigationBars;
 import static android.view.WindowInsets.Type.statusBars;
 import static android.view.WindowInsets.Type.systemBars;
+import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE;
 import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
 import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN;
 
@@ -338,6 +339,8 @@
             getWindow().getAttributes().layoutInDisplayCutoutMode =
                     LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
             getWindow().setSoftInputMode(SOFT_INPUT_STATE_HIDDEN);
+            getWindow().getDecorView().getWindowInsetsController().setSystemBarsBehavior(
+                    BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
             setContentView(mView);
             mEditor.requestFocus();
         }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java
index 536f27e..6e01a3c 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java
@@ -94,6 +94,7 @@
 public class WindowInsetsControllerTests extends WindowManagerTestBase {
 
     private final static long TIMEOUT = 1000; // milliseconds
+    private final static long TIMEOUT_UPDATING_INPUT_WINDOW = 500; // milliseconds
     private final static long TIME_SLICE = 50; // milliseconds
     private final static AnimationCallback ANIMATION_CALLBACK = new AnimationCallback();
 
@@ -233,6 +234,10 @@
         tapOnDisplay(rootView.getWidth() / 2f, rootView.getHeight() / 2f);
         PollingCheck.waitFor(TIMEOUT, () -> !rootView.getRootWindowInsets().isVisible(types));
 
+        // Wait for status bar invisible from InputDispatcher. Otherwise, the following
+        // dragFromTopToCenter might expand notification shade.
+        SystemClock.sleep(TIMEOUT_UPDATING_INPUT_WINDOW);
+
         // Swiping from top of display can show bars.
         dragFromTopToCenter(rootView);
         PollingCheck.waitFor(TIMEOUT, () -> rootView.getRootWindowInsets().isVisible(types));
@@ -256,9 +261,17 @@
         tapOnDisplay(rootView.getWidth() / 2f, rootView.getHeight() / 2f);
         PollingCheck.waitFor(TIMEOUT, () -> !rootView.getRootWindowInsets().isVisible(types));
 
+        // Wait for status bar invisible from InputDispatcher. Otherwise, the following
+        // dragFromTopToCenter might expand notification shade.
+        SystemClock.sleep(TIMEOUT_UPDATING_INPUT_WINDOW);
+
         // Swiping from top of display can show transient bars, but apps cannot detect that.
         dragFromTopToCenter(rootView);
-        PollingCheck.waitFor(TIMEOUT, () -> !rootView.getRootWindowInsets().isVisible(types));
+        // Make sure status bar stays invisible.
+        for (long time = TIMEOUT; time >= 0; time -= TIME_SLICE) {
+            assertFalse(rootView.getRootWindowInsets().isVisible(types));
+            SystemClock.sleep(TIME_SLICE);
+        }
     }
 
     @Test
@@ -395,13 +408,17 @@
             rootView.setWindowInsetsAnimationCallback(ANIMATION_CALLBACK);
             rootView.setSystemUiVisibility(targetFlags);
         });
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT, () -> !rootView.getRootWindowInsets().isVisible(types));
 
-        getInstrumentation().waitForIdleSync();
+        // Wait for status bar invisible from InputDispatcher. Otherwise, the following
+        // dragFromTopToCenter might expand notification shade.
+        SystemClock.sleep(TIMEOUT_UPDATING_INPUT_WINDOW);
 
         // Swiping from top of display can show bars.
+        ANIMATION_CALLBACK.reset();
         dragFromTopToCenter(rootView);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT, () -> rootView.getRootWindowInsets().isVisible(types)
             && rootView.getSystemUiVisibility() != targetFlags);
 
@@ -411,11 +428,17 @@
             rootView.setWindowInsetsAnimationCallback(ANIMATION_CALLBACK);
             rootView.setSystemUiVisibility(targetFlags);
         });
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT, () -> !rootView.getRootWindowInsets().isVisible(types));
 
+        // Wait for status bar invisible from InputDispatcher. Otherwise, the following
+        // dragFromTopToCenter might expand notification shade.
+        SystemClock.sleep(TIMEOUT_UPDATING_INPUT_WINDOW);
+
         // Swiping from top of display can show bars.
+        ANIMATION_CALLBACK.reset();
         dragFromTopToCenter(rootView);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT, () -> rootView.getRootWindowInsets().isVisible(types));
 
         // The swipe action brings down the notification shade which causes subsequent tests to
@@ -442,7 +465,7 @@
             rootView.setWindowInsetsAnimationCallback(ANIMATION_CALLBACK);
             rootView.setSystemUiVisibility(SYSTEM_UI_FLAG_FULLSCREEN);
         });
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT, () -> !rootView.getRootWindowInsets().isVisible(types));
 
         // Clearing the flag can show status bar.
@@ -457,7 +480,7 @@
             rootView.setWindowInsetsAnimationCallback(ANIMATION_CALLBACK);
             rootView.setSystemUiVisibility(SYSTEM_UI_FLAG_FULLSCREEN);
         });
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT, () -> !rootView.getRootWindowInsets().isVisible(types));
 
         // Clearing the flag can show status bar.
@@ -471,7 +494,7 @@
     public void testHideOnCreate() throws Exception {
         final TestHideOnCreateActivity activity = startActivity(TestHideOnCreateActivity.class);
         final View rootView = activity.getWindow().getDecorView();
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT,
                 () -> !rootView.getRootWindowInsets().isVisible(statusBars())
                         && !rootView.getRootWindowInsets().isVisible(navigationBars()));
@@ -485,7 +508,7 @@
         MockImeHelper.createManagedMockImeSession(this);
         final TestShowOnCreateActivity activity = startActivity(TestShowOnCreateActivity.class);
         final View rootView = activity.getWindow().getDecorView();
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT, () -> rootView.getRootWindowInsets().isVisible(ime()));
     }
 
@@ -494,7 +517,7 @@
         // Start an activity which hides system bars.
         final TestHideOnCreateActivity activity = startActivity(TestHideOnCreateActivity.class);
         final View rootView = activity.getWindow().getDecorView();
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT,
                 () -> !rootView.getRootWindowInsets().isVisible(statusBars())
                         && !rootView.getRootWindowInsets().isVisible(navigationBars()));
@@ -525,7 +548,7 @@
     public void testWindowInsetsController_availableAfterAddView() throws Exception {
         final TestHideOnCreateActivity activity = startActivity(TestHideOnCreateActivity.class);
         final View rootView = activity.getWindow().getDecorView();
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT,
                 () -> !rootView.getRootWindowInsets().isVisible(statusBars())
                         && !rootView.getRootWindowInsets().isVisible(navigationBars()));
@@ -573,7 +596,7 @@
             rootView.setWindowInsetsAnimationCallback(ANIMATION_CALLBACK);
             rootView.getWindowInsetsController().hide(systemBars());
         });
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
 
         // ... should only trigger one dispatchApplyWindowInsets
         assertEquals(1, dispatchApplyWindowInsetsCount[0]);
@@ -585,7 +608,7 @@
             rootView.setWindowInsetsAnimationCallback(ANIMATION_CALLBACK);
             rootView.getWindowInsetsController().show(systemBars());
         });
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
 
         // ... should only trigger one dispatchApplyWindowInsets
         assertEquals(1, dispatchApplyWindowInsetsCount[0]);
@@ -613,7 +636,7 @@
             rootView.setWindowInsetsAnimationCallback(ANIMATION_CALLBACK);
             rootView.getWindowInsetsController().show(ime());
         });
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
 
         // ... should only trigger one dispatchApplyWindowInsets
         assertEquals(1, dispatchApplyWindowInsetsCount[0]);
@@ -625,7 +648,7 @@
             rootView.setWindowInsetsAnimationCallback(ANIMATION_CALLBACK);
             rootView.getWindowInsetsController().hide(ime());
         });
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
 
         // ... should only trigger one dispatchApplyWindowInsets
         assertEquals(1, dispatchApplyWindowInsetsCount[0]);
@@ -645,7 +668,7 @@
             view.setWindowInsetsAnimationCallback(ANIMATION_CALLBACK);
             view.getWindowInsetsController().hide(types);
         });
-        ANIMATION_CALLBACK.waitForFinishing(TIMEOUT);
+        ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT, () -> !view.getRootWindowInsets().isVisible(types));
     }
 
@@ -692,6 +715,8 @@
 
     private static class AnimationCallback extends WindowInsetsAnimation.Callback {
 
+        private static final long ANIMATION_TIMEOUT = 5000; // milliseconds
+
         private boolean mFinished = false;
 
         AnimationCallback() {
@@ -712,10 +737,10 @@
             }
         }
 
-        void waitForFinishing(long timeout) throws InterruptedException {
+        void waitForFinishing() throws InterruptedException {
             synchronized (this) {
                 if (!mFinished) {
-                    wait(timeout);
+                    wait(ANIMATION_TIMEOUT);
                 }
             }
         }
diff --git a/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java b/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java
index 6c33f4a..f56ede2 100644
--- a/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java
+++ b/tests/tests/content/src/android/content/cts/ClipDescriptionTest.java
@@ -251,6 +251,6 @@
         intent.setClassName(mContext.getPackageName(), clazz.getName());
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         mContext.startActivity(intent);
-        mUiDevice.wait(Until.hasObject(By.clazz(clazz)), 5000);
+        mUiDevice.wait(Until.hasObject(By.clazz(clazz)), 15000);
     }
 }
diff --git a/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java b/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java
index b2379aa..e2cca56 100644
--- a/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java
+++ b/tests/tests/content/src/android/content/cts/ClipboardManagerTest.java
@@ -321,7 +321,7 @@
         intent.setClassName(mContext.getPackageName(), clazz.getName());
         intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         mContext.startActivity(intent);
-        mUiDevice.wait(Until.hasObject(By.clazz(clazz)), 5000);
+        mUiDevice.wait(Until.hasObject(By.clazz(clazz)), 15000);
     }
 
     private class ExpectedClipItem {
diff --git a/tests/tests/graphics/src/android/graphics/cts/ColorTest.java b/tests/tests/graphics/src/android/graphics/cts/ColorTest.java
index 70e0735..ccfb722 100644
--- a/tests/tests/graphics/src/android/graphics/cts/ColorTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/ColorTest.java
@@ -76,42 +76,66 @@
         };
 
         int systemColors[] = {
-                android.R.color.system_primary_0,
-                android.R.color.system_primary_50,
-                android.R.color.system_primary_100,
-                android.R.color.system_primary_200,
-                android.R.color.system_primary_300,
-                android.R.color.system_primary_400,
-                android.R.color.system_primary_500,
-                android.R.color.system_primary_600,
-                android.R.color.system_primary_700,
-                android.R.color.system_primary_800,
-                android.R.color.system_primary_900,
-                android.R.color.system_primary_1000,
-                android.R.color.system_secondary_0,
-                android.R.color.system_secondary_50,
-                android.R.color.system_secondary_100,
-                android.R.color.system_secondary_200,
-                android.R.color.system_secondary_300,
-                android.R.color.system_secondary_400,
-                android.R.color.system_secondary_500,
-                android.R.color.system_secondary_600,
-                android.R.color.system_secondary_700,
-                android.R.color.system_secondary_800,
-                android.R.color.system_secondary_900,
-                android.R.color.system_secondary_1000,
-                android.R.color.system_neutral_0,
-                android.R.color.system_neutral_50,
-                android.R.color.system_neutral_100,
-                android.R.color.system_neutral_200,
-                android.R.color.system_neutral_300,
-                android.R.color.system_neutral_400,
-                android.R.color.system_neutral_500,
-                android.R.color.system_neutral_600,
-                android.R.color.system_neutral_700,
-                android.R.color.system_neutral_800,
-                android.R.color.system_neutral_900,
-                android.R.color.system_neutral_1000,
+                android.R.color.system_neutral1_0,
+                android.R.color.system_neutral1_50,
+                android.R.color.system_neutral1_100,
+                android.R.color.system_neutral1_200,
+                android.R.color.system_neutral1_300,
+                android.R.color.system_neutral1_400,
+                android.R.color.system_neutral1_500,
+                android.R.color.system_neutral1_600,
+                android.R.color.system_neutral1_700,
+                android.R.color.system_neutral1_800,
+                android.R.color.system_neutral1_900,
+                android.R.color.system_neutral1_1000,
+                android.R.color.system_neutral2_0,
+                android.R.color.system_neutral2_50,
+                android.R.color.system_neutral2_100,
+                android.R.color.system_neutral2_200,
+                android.R.color.system_neutral2_300,
+                android.R.color.system_neutral2_400,
+                android.R.color.system_neutral2_500,
+                android.R.color.system_neutral2_600,
+                android.R.color.system_neutral2_700,
+                android.R.color.system_neutral2_800,
+                android.R.color.system_neutral2_900,
+                android.R.color.system_neutral2_1000,
+                android.R.color.system_accent1_0,
+                android.R.color.system_accent1_50,
+                android.R.color.system_accent1_100,
+                android.R.color.system_accent1_200,
+                android.R.color.system_accent1_300,
+                android.R.color.system_accent1_400,
+                android.R.color.system_accent1_500,
+                android.R.color.system_accent1_600,
+                android.R.color.system_accent1_700,
+                android.R.color.system_accent1_800,
+                android.R.color.system_accent1_900,
+                android.R.color.system_accent1_1000,
+                android.R.color.system_accent2_0,
+                android.R.color.system_accent2_50,
+                android.R.color.system_accent2_100,
+                android.R.color.system_accent2_200,
+                android.R.color.system_accent2_300,
+                android.R.color.system_accent2_400,
+                android.R.color.system_accent2_500,
+                android.R.color.system_accent2_600,
+                android.R.color.system_accent2_700,
+                android.R.color.system_accent2_800,
+                android.R.color.system_accent2_900,
+                android.R.color.system_accent2_1000,
+                android.R.color.system_accent3_0,
+                android.R.color.system_accent3_50,
+                android.R.color.system_accent3_100,
+                android.R.color.system_accent3_200,
+                android.R.color.system_accent3_300,
+                android.R.color.system_accent3_400,
+                android.R.color.system_accent3_500,
+                android.R.color.system_accent3_600,
+                android.R.color.system_accent3_700,
+                android.R.color.system_accent3_800,
+                android.R.color.system_accent3_900,
+                android.R.color.system_accent3_1000,
         };
 
         List<Integer> expectedColorStateLists = Arrays.asList(
diff --git a/tests/tests/graphics/src/android/graphics/cts/SystemPalette.java b/tests/tests/graphics/src/android/graphics/cts/SystemPalette.java
index 5e0d4f6..0ba7165 100644
--- a/tests/tests/graphics/src/android/graphics/cts/SystemPalette.java
+++ b/tests/tests/graphics/src/android/graphics/cts/SystemPalette.java
@@ -42,43 +42,40 @@
 public class SystemPalette {
 
     private static final double MAX_CHROMA_DISTANCE = 0.1;
-    private static final String LOG_TAG = SystemPalette.class.getSimpleName();
 
     @Test
     public void testShades0and1000() {
         final Context context = getInstrumentation().getTargetContext();
-        final int primary0 = context.getColor(R.color.system_primary_0);
-        final int primary1000 = context.getColor(R.color.system_primary_1000);
-        final int secondary0 = context.getColor(R.color.system_secondary_0);
-        final int secondary1000 = context.getColor(R.color.system_secondary_1000);
-        final int neutral0 = context.getColor(R.color.system_neutral_0);
-        final int neutral1000 = context.getColor(R.color.system_neutral_1000);
-        assertColor(primary0, Color.WHITE);
-        assertColor(primary1000, Color.BLACK);
-        assertColor(secondary0, Color.WHITE);
-        assertColor(secondary1000, Color.BLACK);
-        assertColor(neutral0, Color.WHITE);
-        assertColor(neutral1000, Color.BLACK);
+        final int[] leftmostColors = new int[]{
+                R.color.system_neutral1_0, R.color.system_neutral2_0, R.color.system_accent1_0,
+                R.color.system_accent2_0, R.color.system_accent3_0
+        };
+        final int[] rightmostColors = new int[]{
+                R.color.system_neutral1_1000, R.color.system_neutral2_1000,
+                R.color.system_accent1_1000, R.color.system_accent2_1000,
+                R.color.system_accent3_1000
+        };
+        for (int i = 0; i < leftmostColors.length; i++) {
+            assertColor(context.getColor(leftmostColors[0]), Color.WHITE);
+        }
+        for (int i = 0; i < rightmostColors.length; i++) {
+            assertColor(context.getColor(rightmostColors[0]), Color.BLACK);
+        }
     }
 
     @Test
     public void testAllColorsBelongToSameFamily() {
         final Context context = getInstrumentation().getTargetContext();
-        final int[] primaryColors = getAllPrimaryColors(context);
-        final int[] secondaryColors = getAllSecondaryColors(context);
-        final int[] neutralColors = getAllNeutralColors(context);
+        List<int[]> allPalettes = Arrays.asList(getAllAccent1Colors(context),
+                getAllAccent2Colors(context), getAllAccent3Colors(context),
+                getAllNeutral1Colors(context), getAllNeutral2Colors(context));
 
-        for (int i = 2; i < primaryColors.length - 1; i++) {
-            assertWithMessage("Primary color " + Integer.toHexString((primaryColors[i - 1]))
-                    + " has different chroma compared to " + Integer.toHexString(primaryColors[i]))
-                    .that(similarChroma(primaryColors[i - 1], primaryColors[i])).isTrue();
-            assertWithMessage("Secondary color " + Integer.toHexString((secondaryColors[i - 1]))
-                    + " has different chroma compared to " + Integer.toHexString(
-                    secondaryColors[i]))
-                    .that(similarChroma(secondaryColors[i - 1], secondaryColors[i])).isTrue();
-            assertWithMessage("Neutral color " + Integer.toHexString((neutralColors[i - 1]))
-                    + " has different chroma compared to " + Integer.toHexString(neutralColors[i]))
-                    .that(similarChroma(neutralColors[i - 1], neutralColors[i])).isTrue();
+        for (int[] palette : allPalettes) {
+            for (int i = 2; i < palette.length; i++) {
+                assertWithMessage("Color " + Integer.toHexString((palette[i - 1]))
+                        + " has different chroma compared to " + Integer.toHexString(palette[i]))
+                        .that(similarChroma(palette[i - 1], palette[i])).isTrue();
+            }
         }
     }
 
@@ -108,34 +105,23 @@
     @Test
     public void testColorsMatchExpectedLuminosity() {
         final Context context = getInstrumentation().getTargetContext();
-        final int[] primaryColors = getAllPrimaryColors(context);
-        final int[] secondaryColors = getAllSecondaryColors(context);
-        final int[] neutralColors = getAllNeutralColors(context);
+        List<int[]> allPalettes = Arrays.asList(getAllAccent1Colors(context),
+                getAllAccent2Colors(context), getAllAccent3Colors(context),
+                getAllNeutral1Colors(context), getAllNeutral2Colors(context));
 
-        final double[] labPrimary = new double[3];
-        final double[] labSecondary = new double[3];
-        final double[] labNeutral = new double[3];
+        final double[] labColor = new double[3];
         final double[] expectedL = {100, 95, 90, 80, 70, 60, 49, 40, 30, 20, 10, 0};
 
-        for (int i = 0; i < primaryColors.length; i++) {
-            ColorUtils.RGBToLAB(Color.red(primaryColors[i]), Color.green(primaryColors[i]),
-                    Color.blue(primaryColors[i]), labPrimary);
-            ColorUtils.RGBToLAB(Color.red(secondaryColors[i]), Color.green(secondaryColors[i]),
-                    Color.blue(secondaryColors[i]), labSecondary);
-            ColorUtils.RGBToLAB(Color.red(neutralColors[i]), Color.green(neutralColors[i]),
-                    Color.blue(neutralColors[i]), labNeutral);
+        for (int[] palette : allPalettes) {
+            for (int i = 0; i < palette.length; i++) {
+                ColorUtils.colorToLAB(palette[i], labColor);
 
-            // Colors in the same palette should vary mostly in L, decreasing lightness as we move
-            // across the palette.
-            assertWithMessage("Color " + Integer.toHexString((primaryColors[i]))
-                    + " at index " + i + " should have L " + expectedL[i] + " in LAB space.")
-                    .that(labPrimary[0]).isWithin(3).of(expectedL[i]);
-            assertWithMessage("Color " + Integer.toHexString((secondaryColors[i]))
-                    + " at index " + i + " should have L " + expectedL[i] + " in LAB space.")
-                    .that(labSecondary[0]).isWithin(3).of(expectedL[i]);
-            assertWithMessage("Color " + Integer.toHexString((neutralColors[i]))
-                    + " at index " + i + " should have L " + expectedL[i] + " in LAB space.")
-                    .that(labNeutral[0]).isWithin(3).of(expectedL[i]);
+                // Colors in the same palette should vary mostly in L, decreasing lightness as we
+                // move across the palette.
+                assertWithMessage("Color " + Integer.toHexString((palette[i]))
+                        + " at index " + i + " should have L " + expectedL[i] + " in LAB space.")
+                        .that(labColor[0]).isWithin(3).of(expectedL[i]);
+            }
         }
     }
 
@@ -151,12 +137,12 @@
                 new Pair<>(300, 700), new Pair<>(400, 800), new Pair<>(500, 900),
                 new Pair<>(600, 1000));
 
-        final int[] primaryColors = getAllPrimaryColors(context);
-        final int[] secondaryColors = getAllSecondaryColors(context);
-        final int[] neutralColors = getAllNeutralColors(context);
+        List<int[]> allPalettes = Arrays.asList(getAllAccent1Colors(context),
+                getAllAccent2Colors(context), getAllAccent3Colors(context),
+                getAllNeutral1Colors(context), getAllNeutral2Colors(context));
 
-        for (int[] palette: Arrays.asList(primaryColors, secondaryColors, neutralColors)) {
-            for (Pair<Integer, Integer> shades: atLeast4dot5) {
+        for (int[] palette : allPalettes) {
+            for (Pair<Integer, Integer> shades : atLeast4dot5) {
                 final int background = palette[shadeToArrayIndex(shades.first)];
                 final int foreground = palette[shadeToArrayIndex(shades.second)];
                 final double contrast = ColorUtils.calculateContrast(foreground, background);
@@ -166,7 +152,7 @@
                         .isGreaterThan(4.5);
             }
 
-            for (Pair<Integer, Integer> shades: atLeast3dot0) {
+            for (Pair<Integer, Integer> shades : atLeast3dot0) {
                 final int background = palette[shadeToArrayIndex(shades.first)];
                 final int foreground = palette[shadeToArrayIndex(shades.second)];
                 final double contrast = ColorUtils.calculateContrast(foreground, background);
@@ -183,9 +169,8 @@
      *
      * @param shade Shade from 0 to 1000.
      * @return index in array
-     * @see #getAllPrimaryColors(Context)
-     * @see #getAllSecondaryColors(Context)
-     * @see #getAllNeutralColors(Context)
+     * @see #getAllAccent1Colors(Context) (Context)
+     * @see #getAllNeutral1Colors(Context)
      */
     private int shadeToArrayIndex(int shade) {
         if (shade == 0) {
@@ -199,58 +184,91 @@
 
     private void assertColor(@ColorInt int observed, @ColorInt int expected) {
         Assert.assertEquals("Color = " + Integer.toHexString(observed) + ", "
-                        + Integer.toHexString(expected) + " expected",
-                observed, expected);
+                        + Integer.toHexString(expected) + " expected", expected, observed);
     }
 
-    private int[] getAllPrimaryColors(Context context) {
+    private int[] getAllAccent1Colors(Context context) {
         final int[] colors = new int[12];
-        colors[0] = context.getColor(R.color.system_primary_0);
-        colors[1] = context.getColor(R.color.system_primary_50);
-        colors[2] = context.getColor(R.color.system_primary_100);
-        colors[3] = context.getColor(R.color.system_primary_200);
-        colors[4] = context.getColor(R.color.system_primary_300);
-        colors[5] = context.getColor(R.color.system_primary_400);
-        colors[6] = context.getColor(R.color.system_primary_500);
-        colors[7] = context.getColor(R.color.system_primary_600);
-        colors[8] = context.getColor(R.color.system_primary_700);
-        colors[9] = context.getColor(R.color.system_primary_800);
-        colors[10] = context.getColor(R.color.system_primary_900);
-        colors[11] = context.getColor(R.color.system_primary_1000);
+        colors[0] = context.getColor(R.color.system_accent1_0);
+        colors[1] = context.getColor(R.color.system_accent1_50);
+        colors[2] = context.getColor(R.color.system_accent1_100);
+        colors[3] = context.getColor(R.color.system_accent1_200);
+        colors[4] = context.getColor(R.color.system_accent1_300);
+        colors[5] = context.getColor(R.color.system_accent1_400);
+        colors[6] = context.getColor(R.color.system_accent1_500);
+        colors[7] = context.getColor(R.color.system_accent1_600);
+        colors[8] = context.getColor(R.color.system_accent1_700);
+        colors[9] = context.getColor(R.color.system_accent1_800);
+        colors[10] = context.getColor(R.color.system_accent1_900);
+        colors[11] = context.getColor(R.color.system_accent1_1000);
         return colors;
     }
 
-    private int[] getAllSecondaryColors(Context context) {
+    private int[] getAllAccent2Colors(Context context) {
         final int[] colors = new int[12];
-        colors[0] = context.getColor(R.color.system_secondary_0);
-        colors[1] = context.getColor(R.color.system_secondary_50);
-        colors[2] = context.getColor(R.color.system_secondary_100);
-        colors[3] = context.getColor(R.color.system_secondary_200);
-        colors[4] = context.getColor(R.color.system_secondary_300);
-        colors[5] = context.getColor(R.color.system_secondary_400);
-        colors[6] = context.getColor(R.color.system_secondary_500);
-        colors[7] = context.getColor(R.color.system_secondary_600);
-        colors[8] = context.getColor(R.color.system_secondary_700);
-        colors[9] = context.getColor(R.color.system_secondary_800);
-        colors[10] = context.getColor(R.color.system_secondary_900);
-        colors[11] = context.getColor(R.color.system_secondary_1000);
+        colors[0] = context.getColor(R.color.system_accent2_0);
+        colors[1] = context.getColor(R.color.system_accent2_50);
+        colors[2] = context.getColor(R.color.system_accent2_100);
+        colors[3] = context.getColor(R.color.system_accent2_200);
+        colors[4] = context.getColor(R.color.system_accent2_300);
+        colors[5] = context.getColor(R.color.system_accent2_400);
+        colors[6] = context.getColor(R.color.system_accent2_500);
+        colors[7] = context.getColor(R.color.system_accent2_600);
+        colors[8] = context.getColor(R.color.system_accent2_700);
+        colors[9] = context.getColor(R.color.system_accent2_800);
+        colors[10] = context.getColor(R.color.system_accent2_900);
+        colors[11] = context.getColor(R.color.system_accent2_1000);
         return colors;
     }
 
-    private int[] getAllNeutralColors(Context context) {
+    private int[] getAllAccent3Colors(Context context) {
         final int[] colors = new int[12];
-        colors[0] = context.getColor(R.color.system_neutral_0);
-        colors[1] = context.getColor(R.color.system_neutral_50);
-        colors[2] = context.getColor(R.color.system_neutral_100);
-        colors[3] = context.getColor(R.color.system_neutral_200);
-        colors[4] = context.getColor(R.color.system_neutral_300);
-        colors[5] = context.getColor(R.color.system_neutral_400);
-        colors[6] = context.getColor(R.color.system_neutral_500);
-        colors[7] = context.getColor(R.color.system_neutral_600);
-        colors[8] = context.getColor(R.color.system_neutral_700);
-        colors[9] = context.getColor(R.color.system_neutral_800);
-        colors[10] = context.getColor(R.color.system_neutral_900);
-        colors[11] = context.getColor(R.color.system_neutral_1000);
+        colors[0] = context.getColor(R.color.system_accent3_0);
+        colors[1] = context.getColor(R.color.system_accent3_50);
+        colors[2] = context.getColor(R.color.system_accent3_100);
+        colors[3] = context.getColor(R.color.system_accent3_200);
+        colors[4] = context.getColor(R.color.system_accent3_300);
+        colors[5] = context.getColor(R.color.system_accent3_400);
+        colors[6] = context.getColor(R.color.system_accent3_500);
+        colors[7] = context.getColor(R.color.system_accent3_600);
+        colors[8] = context.getColor(R.color.system_accent3_700);
+        colors[9] = context.getColor(R.color.system_accent3_800);
+        colors[10] = context.getColor(R.color.system_accent3_900);
+        colors[11] = context.getColor(R.color.system_accent3_1000);
+        return colors;
+    }
+
+    private int[] getAllNeutral1Colors(Context context) {
+        final int[] colors = new int[12];
+        colors[0] = context.getColor(R.color.system_neutral1_0);
+        colors[1] = context.getColor(R.color.system_neutral1_50);
+        colors[2] = context.getColor(R.color.system_neutral1_100);
+        colors[3] = context.getColor(R.color.system_neutral1_200);
+        colors[4] = context.getColor(R.color.system_neutral1_300);
+        colors[5] = context.getColor(R.color.system_neutral1_400);
+        colors[6] = context.getColor(R.color.system_neutral1_500);
+        colors[7] = context.getColor(R.color.system_neutral1_600);
+        colors[8] = context.getColor(R.color.system_neutral1_700);
+        colors[9] = context.getColor(R.color.system_neutral1_800);
+        colors[10] = context.getColor(R.color.system_neutral1_900);
+        colors[11] = context.getColor(R.color.system_neutral1_1000);
+        return colors;
+    }
+
+    private int[] getAllNeutral2Colors(Context context) {
+        final int[] colors = new int[12];
+        colors[0] = context.getColor(R.color.system_neutral2_0);
+        colors[1] = context.getColor(R.color.system_neutral2_50);
+        colors[2] = context.getColor(R.color.system_neutral2_100);
+        colors[3] = context.getColor(R.color.system_neutral2_200);
+        colors[4] = context.getColor(R.color.system_neutral2_300);
+        colors[5] = context.getColor(R.color.system_neutral2_400);
+        colors[6] = context.getColor(R.color.system_neutral2_500);
+        colors[7] = context.getColor(R.color.system_neutral2_600);
+        colors[8] = context.getColor(R.color.system_neutral2_700);
+        colors[9] = context.getColor(R.color.system_neutral2_800);
+        colors[10] = context.getColor(R.color.system_neutral2_900);
+        colors[11] = context.getColor(R.color.system_neutral2_1000);
         return colors;
     }
 }
diff --git a/tests/tests/media/src/android/media/cts/AudioPlaybackConfigurationTest.java b/tests/tests/media/src/android/media/cts/AudioPlaybackConfigurationTest.java
index f939b70..e54cf71 100644
--- a/tests/tests/media/src/android/media/cts/AudioPlaybackConfigurationTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioPlaybackConfigurationTest.java
@@ -50,6 +50,9 @@
 
     static final String mInpPrefix = WorkDir.getMediaDirString();
     private final static int TEST_TIMING_TOLERANCE_MS = 150;
+    /** acceptable timeout for the time it takes for a prepared MediaPlayer to have an audio device
+     * selected and reported when starting to play */
+    private final static int PLAY_ROUTING_TIMING_TOLERANCE_MS = 500;
     private final static int TEST_TIMEOUT_SOUNDPOOL_LOAD_MS = 3000;
     private final static long MEDIAPLAYER_PREPARE_TIMEOUT_MS = 2000;
 
@@ -444,7 +447,8 @@
         mp.start();
 
         assertTrue("onPlaybackConfigChanged play and device called expected "
-                , callback.waitForCallbacks(2));
+                , callback.waitForCallbacks(2,
+                        TEST_TIMING_TOLERANCE_MS + PLAY_ROUTING_TIMING_TOLERANCE_MS));
         assertEquals("number of active players not expected",
                 // one more player active
                 activePlayerCount/*expected*/, callback.getNbConfigs());
@@ -496,10 +500,10 @@
             mOnCalledMonitor.signal();
         }
 
-        public boolean waitForCallbacks(int calledCount) throws InterruptedException {
+        public boolean waitForCallbacks(int calledCount, long timeoutMs)
+                throws InterruptedException {
             int signalsCounted =
-                    mOnCalledMonitor.waitForCountedSignals(calledCount,
-                            calledCount*TEST_TIMING_TOLERANCE_MS);
+                    mOnCalledMonitor.waitForCountedSignals(calledCount, timeoutMs);
             return (signalsCounted == calledCount);
         }
     }
diff --git a/tests/tests/notificationlegacy/notificationlegacy27/Android.bp b/tests/tests/notificationlegacy/notificationlegacy27/Android.bp
index 9f48a60..144ceac 100644
--- a/tests/tests/notificationlegacy/notificationlegacy27/Android.bp
+++ b/tests/tests/notificationlegacy/notificationlegacy27/Android.bp
@@ -36,5 +36,5 @@
         "cts",
         "general-tests",
     ],
-    min_sdk_version: "27",
+    target_sdk_version: "27"
 }
diff --git a/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java b/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
index df0d592..dd7bf07 100644
--- a/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
+++ b/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/LegacyNotificationManagerTest.java
@@ -38,6 +38,7 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
+import android.os.Build;
 import android.os.ParcelFileDescriptor;
 import android.provider.Telephony.Threads;
 import android.service.notification.NotificationListenerService;
@@ -303,6 +304,26 @@
                 InstrumentationRegistry.getInstrumentation(), false);
     }
 
+    @Test
+    public void testChannelDeletion_cancelReason() throws Exception {
+        assertEquals(Build.VERSION_CODES.O_MR1, mContext.getApplicationInfo().targetSdkVersion);
+        toggleListenerAccess(TestNotificationListener.getId(),
+                InstrumentationRegistry.getInstrumentation(), true);
+        Thread.sleep(500); // wait for listener to be allowed
+        mListener = TestNotificationListener.getInstance();
+
+        sendNotification(566, R.drawable.icon_black);
+
+        Thread.sleep(500); // wait for notification listener to receive notification
+        assertEquals(1, mListener.mPosted.size());
+        String key = mListener.mPosted.get(0).getKey();
+
+        mNotificationManager.deleteNotificationChannel(NOTIFICATION_CHANNEL_ID);
+
+        assertEquals(NotificationListenerService.REASON_CHANNEL_BANNED,
+                getCancellationReason(key));
+    }
+
     private void sendNotification(final int id, final int icon) throws Exception {
         sendNotification(id, null, icon);
     }
@@ -327,6 +348,20 @@
         mNotificationManager.notify(id, notification);
     }
 
+    private int getCancellationReason(String key) {
+        for (int tries = 3; tries-- > 0; ) {
+            if (mListener.mRemoved.containsKey(key)) {
+                return mListener.mRemoved.get(key);
+            }
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException ex) {
+                // pass
+            }
+        }
+        return -1;
+    }
+
     private void toggleNotificationPolicyAccess(String packageName,
             Instrumentation instrumentation, boolean on) throws IOException {
 
diff --git a/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/TestNotificationListener.java b/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/TestNotificationListener.java
index c174d81..d8542e9 100644
--- a/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/TestNotificationListener.java
+++ b/tests/tests/notificationlegacy/notificationlegacy27/src/android/app/notification/legacy/cts/TestNotificationListener.java
@@ -21,6 +21,8 @@
 import android.util.Log;
 
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
 
 public class TestNotificationListener extends NotificationListenerService {
     public static final String TAG = "TestNotificationListener";
@@ -29,7 +31,7 @@
     private ArrayList<String> mTestPackages = new ArrayList<>();
 
     public ArrayList<StatusBarNotification> mPosted = new ArrayList<>();
-    public ArrayList<StatusBarNotification> mRemoved = new ArrayList<>();
+    public Map<String, Integer> mRemoved = new HashMap<>();
     public RankingMap mRankingMap;
 
     private static TestNotificationListener sNotificationListenerInstance = null;
@@ -80,10 +82,11 @@
     }
 
     @Override
-    public void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap) {
+    public void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap,
+            int reason) {
         if (!mTestPackages.contains(sbn.getPackageName())) { return; }
         mRankingMap = rankingMap;
-        mRemoved.add(sbn);
+        mRemoved.put(sbn.getKey(), reason);
     }
 
     @Override
diff --git a/tests/tests/packageinstaller/nopermission/src/android.packageinstaller.nopermission.cts/NoPermissionTests.kt b/tests/tests/packageinstaller/nopermission/src/android.packageinstaller.nopermission.cts/NoPermissionTests.kt
index 3923c35..e60e53a 100644
--- a/tests/tests/packageinstaller/nopermission/src/android.packageinstaller.nopermission.cts/NoPermissionTests.kt
+++ b/tests/tests/packageinstaller/nopermission/src/android.packageinstaller.nopermission.cts/NoPermissionTests.kt
@@ -20,6 +20,7 @@
 import android.content.Context
 import android.content.Intent
 import android.content.IntentFilter
+import android.content.pm.PackageManager;
 import android.content.pm.PackageInstaller
 import android.content.pm.PackageInstaller.EXTRA_STATUS
 import android.content.pm.PackageInstaller.STATUS_FAILURE_INVALID
@@ -38,6 +39,12 @@
 import org.junit.Before
 import org.junit.Test
 import org.junit.runner.RunWith
+import org.junit.runners.model.Statement
+import org.junit.runner.Description
+import org.junit.Rule
+import org.junit.rules.TestRule
+import org.junit.AssumptionViolatedException
+
 import java.io.File
 import java.lang.IllegalArgumentException
 
@@ -62,6 +69,7 @@
     private var packageName = context.packageName
     private var apkFile = File(context.filesDir, TEST_APK_NAME)
     private var uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
+    private var isWatch: Boolean = pm.hasSystemFeature(PackageManager.FEATURE_WATCH)
 
     private val receiver = object : BroadcastReceiver() {
         override fun onReceive(context: Context, intent: Intent) {
@@ -75,6 +83,21 @@
         }
     }
 
+    @get:Rule
+    val testRule: TestRule = object :TestRule {
+        override fun apply(base: Statement, description: Description?)
+                = NewStatement(base)
+        inner class NewStatement(private val base: Statement) : Statement() {
+            @Throws(Throwable::class)
+            override fun evaluate() {
+                if (isWatch) {
+                    throw AssumptionViolatedException("Install/uninstall feature is not supported on WearOs");
+                }
+                base.evaluate()
+            }
+        }
+    }
+
     @Before
     fun wakeUpScreen() {
         if (!uiDevice.isScreenOn) {
diff --git a/tests/tests/permission/StorageEscalationApp28/Android.bp b/tests/tests/permission/StorageEscalationApp28/Android.bp
index b59c3eb..520625a 100644
--- a/tests/tests/permission/StorageEscalationApp28/Android.bp
+++ b/tests/tests/permission/StorageEscalationApp28/Android.bp
@@ -25,5 +25,6 @@
         "cts",
         "general-tests",
         "mts",
+        "sts",
     ],
 }
diff --git a/tests/tests/permission/StorageEscalationApp29Full/Android.bp b/tests/tests/permission/StorageEscalationApp29Full/Android.bp
index daf8472..018c324 100644
--- a/tests/tests/permission/StorageEscalationApp29Full/Android.bp
+++ b/tests/tests/permission/StorageEscalationApp29Full/Android.bp
@@ -25,5 +25,6 @@
         "cts",
         "general-tests",
         "mts",
+        "sts",
     ],
 }
diff --git a/tests/tests/permission/StorageEscalationApp29Scoped/Android.bp b/tests/tests/permission/StorageEscalationApp29Scoped/Android.bp
index 7789919..5c0d89a 100644
--- a/tests/tests/permission/StorageEscalationApp29Scoped/Android.bp
+++ b/tests/tests/permission/StorageEscalationApp29Scoped/Android.bp
@@ -25,5 +25,6 @@
         "cts",
         "general-tests",
         "mts",
+        "sts",
     ],
 }
diff --git a/tests/tests/permission/src/android/permission/cts/StorageEscalationTest.kt b/tests/tests/permission/src/android/permission/cts/StorageEscalationTest.kt
index 00d4b40..0f21318 100644
--- a/tests/tests/permission/src/android/permission/cts/StorageEscalationTest.kt
+++ b/tests/tests/permission/src/android/permission/cts/StorageEscalationTest.kt
@@ -24,6 +24,7 @@
 import android.content.Context
 import android.content.pm.PackageManager
 import android.platform.test.annotations.AppModeFull
+import android.platform.test.annotations.SecurityTest
 import androidx.test.platform.app.InstrumentationRegistry
 import com.android.compatibility.common.util.SystemUtil
 import org.junit.After
@@ -72,11 +73,13 @@
     }
 
     @Test
+    @SecurityTest(minPatchLevel = "2021-03")
     fun testCannotEscalateWithSdkDowngrade() {
         runStorageEscalationTest(APP_APK_PATH_29_SCOPED, APP_APK_PATH_28)
     }
 
     @Test
+    @SecurityTest(minPatchLevel = "2021-03")
     fun testCannotEscalateWithNewManifestLegacyRequest() {
         runStorageEscalationTest(APP_APK_PATH_29_SCOPED, APP_APK_PATH_29_FULL)
     }
@@ -90,4 +93,4 @@
         Thread.sleep(DELAY_TIME_MS)
         assertStoragePermissionState(granted = false)
     }
-}
\ No newline at end of file
+}
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index dd7d4ab..b8939fe 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -2659,10 +2659,6 @@
     <permission android:name="android.permission.CREATE_USERS"
         android:protectionLevel="signature" />
 
-    <!-- @TestApi @hide Allows an application to query user info for all users on the device. -->
-    <permission android:name="android.permission.QUERY_USERS"
-                android:protectionLevel="signature" />
-
     <!-- @hide Allows an application to set the profile owners and the device owner.
          This permission is not available to third party applications.-->
     <permission android:name="android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS"
@@ -3447,6 +3443,14 @@
     <permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW"
         android:protectionLevel="signature" />
 
+    <!-- Allows an application to avoid all toast rate limiting restrictions.
+         <p>Not for use by third-party applications.
+         @hide
+    -->
+    <permission android:name="android.permission.UNLIMITED_TOASTS"
+                android:protectionLevel="signature" />
+    <uses-permission android:name="android.permission.UNLIMITED_TOASTS" />
+
     <!-- @SystemApi Allows an application to use
          {@link android.view.WindowManager.LayoutsParams#SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS}
          to hide non-system-overlay windows.
diff --git a/tests/tests/provider/AndroidManifest.xml b/tests/tests/provider/AndroidManifest.xml
index edc6310..e5e41ec 100644
--- a/tests/tests/provider/AndroidManifest.xml
+++ b/tests/tests/provider/AndroidManifest.xml
@@ -48,6 +48,7 @@
     <uses-permission android:name="android.permission.READ_SMS"/>
     <uses-permission android:name="android.permission.WRITE_SMS"/>
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
+    <uses-permission android:name="android.permission.MANAGE_MEDIA"/>
 
     <application>
         <uses-library android:name="android.test.runner"/>
diff --git a/tests/tests/security/src/android/security/cts/CVE_2021_0327/IntroActivity.java b/tests/tests/security/src/android/security/cts/CVE_2021_0327/IntroActivity.java
index fd2af3a..bc1ed91 100644
--- a/tests/tests/security/src/android/security/cts/CVE_2021_0327/IntroActivity.java
+++ b/tests/tests/security/src/android/security/cts/CVE_2021_0327/IntroActivity.java
@@ -2,30 +2,23 @@
 
 import android.app.Activity;
 import android.app.AlertDialog;
+import android.app.UiAutomation;
 import android.app.admin.DevicePolicyManager;
+import android.app.admin.ManagedProfileProvisioningParams;
+import android.app.admin.ProvisioningException;
 import android.content.ClipData;
 import android.content.ComponentName;
 import android.content.Intent;
 import android.net.Uri;
 import android.os.Bundle;
-import android.view.View;
-import android.util.Log;
-import android.os.SystemClock;
-
-//import android.support.test.InstrumentationRegistry;
-import androidx.test.InstrumentationRegistry;
-import android.support.test.uiautomator.UiDevice;
-import android.support.test.uiautomator.UiObject2;
-import android.support.test.uiautomator.By;
-import android.support.test.uiautomator.BySelector;
-import java.io.*;
-import java.util.stream.Collectors;
-
+import android.os.UserHandle;
 import android.security.cts.CVE_2021_0327.workprofilesetup.AdminReceiver;
+import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
 
 public class IntroActivity extends Activity {
 
-    private static final int AR_WORK_PROFILE_SETUP = 1;
     private static final String TAG = "CVE_2021_0327";
 
     private void launchOtherUserActivity() {
@@ -45,50 +38,7 @@
         } else if (canLaunchOtherUserActivity()) {
             launchOtherUserActivity();
         } else {
-            setupWorkProfile(null);
-
-            //detect buttons to click
-            boolean profileSetUp=false;
-            String button;
-            java.util.List<UiObject2> objects;
-            UiDevice mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
-            BySelector selector = By.clickable(true);
-
-
-            while(!profileSetUp){
-              do {
-                Log.i(TAG, "waiting for clickable");
-                SystemClock.sleep(3000);
-              } while((objects = mUiDevice.findObjects(selector)).size()==0);
-              for(UiObject2 o : objects){
-                button=o.getText();
-                Log.d(TAG,"button:" + button);
-
-                if(button==null){
-                  continue;
-                }
-
-                switch(button){
-                  case "Delete" :
-                    o.click();
-                    Log.i(TAG, "clicked: Delete");
-                    break;
-                  case "Accept & continue" :
-                    o.click();
-                    Log.i(TAG, "clicked: Accept & continue");
-                    break;
-                  case "Next" :
-                    o.click();
-                    profileSetUp=true;
-                    Log.i(TAG, "clicked: Next");
-                    break;
-                  default :
-                    continue;
-                }
-                break;
-              }
-            }
-            //end while(!profileSetUp);
+            setupWorkProfile();
         }
     }
 
@@ -101,29 +51,32 @@
         return (getPackageManager().resolveActivity(intent, 0) != null);
     }
 
-    public void setupWorkProfile(View view) {
+    private void setupWorkProfile() {
         Log.d(TAG, "setupWorkProfile()");
-        Intent intent = new Intent(DevicePolicyManager.ACTION_PROVISION_MANAGED_PROFILE);
-        intent.putExtra(
-                DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME,
-                new ComponentName(this, AdminReceiver.class)
-        );
-        startActivityForResult(intent, AR_WORK_PROFILE_SETUP);
+        UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+        uiAutomation.adoptShellPermissionIdentity();
+        DevicePolicyManager devicePolicyManager = getSystemService(DevicePolicyManager.class);
+        try {
+            UserHandle profile = devicePolicyManager.createAndProvisionManagedProfile(
+                    new ManagedProfileProvisioningParams.Builder(
+                            new ComponentName(this, AdminReceiver.class),
+                            "profileOwner").build());
+            if (profile == null) {
+                showErrorDialog();
+            } else {
+                launchOtherUserActivity();
+            }
+        } catch (ProvisioningException e) {
+            showErrorDialog();
+        } finally {
+            uiAutomation.dropShellPermissionIdentity();
+        }
     }
 
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        Log.d(TAG, "onActivityResult()");
-        if (requestCode == AR_WORK_PROFILE_SETUP) {
-            if (resultCode == RESULT_OK) {
-                launchOtherUserActivity();
-            } else {
-                new AlertDialog.Builder(this)
-                        .setMessage("Work profile setup failed")
-                        .setPositiveButton("ok", null)
-                        .show();
-            }
-        }
-        super.onActivityResult(requestCode, resultCode, data);
+    private void showErrorDialog() {
+        new AlertDialog.Builder(this)
+                .setMessage("Work profile setup failed")
+                .setPositiveButton("ok", null)
+                .show();
     }
 }
diff --git a/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java b/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
index f7ae500..cfc71a2 100644
--- a/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
+++ b/tests/tests/telecom/src/android/telecom/cts/BaseTelecomTestWithMockServices.java
@@ -1339,16 +1339,17 @@
                 new Condition() {
                     @Override
                     public Object expected() {
-                        return state;
+                        return true;
                     }
 
                     @Override
                     public Object actual() {
-                        return call.getState();
+                        return call.getState() == state && call.getDetails().getState() == state;
                     }
                 },
                 WAIT_FOR_STATE_CHANGE_TIMEOUT_MS,
-                "Call: " + call + " should be in state " + state
+                "Expected state: " + state + ", callState=" + call.getState() + ", detailState="
+                    + call.getDetails().getState()
         );
     }
 
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/LteVopsSupportInfoTest.java b/tests/tests/telephony/current/src/android/telephony/cts/LteVopsSupportInfoTest.java
deleted file mode 100644
index 1832fad..0000000
--- a/tests/tests/telephony/current/src/android/telephony/cts/LteVopsSupportInfoTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package android.telephony.cts;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import android.os.Parcel;
-import android.telephony.LteVopsSupportInfo;
-
-import org.junit.Test;
-
-public class LteVopsSupportInfoTest {
-
-    @Test
-    public void testLteVopsSupportInfo() {
-        LteVopsSupportInfo lteVops =
-                new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
-                LteVopsSupportInfo.LTE_STATUS_SUPPORTED);
-        assertEquals(0, lteVops.describeContents());
-        assertEquals(LteVopsSupportInfo.LTE_STATUS_SUPPORTED, lteVops.getVopsSupport());
-        assertEquals(LteVopsSupportInfo.LTE_STATUS_SUPPORTED, lteVops.getEmcBearerSupport());
-
-        Parcel lteVopsParcel = Parcel.obtain();
-        lteVops.writeToParcel(lteVopsParcel, 0);
-        lteVopsParcel.setDataPosition(0);
-        LteVopsSupportInfo checkLteVops =
-                LteVopsSupportInfo.CREATOR.createFromParcel(lteVopsParcel);
-        assertTrue(lteVops.equals(checkLteVops));
-    }
-}
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/VopsSupportInfoTest.java b/tests/tests/telephony/current/src/android/telephony/cts/VopsSupportInfoTest.java
new file mode 100644
index 0000000..431da5e
--- /dev/null
+++ b/tests/tests/telephony/current/src/android/telephony/cts/VopsSupportInfoTest.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.telephony.cts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import android.os.Parcel;
+import android.telephony.LteVopsSupportInfo;
+import android.telephony.NrVopsSupportInfo;
+import android.telephony.VopsSupportInfo;
+
+import org.junit.Test;
+
+public class VopsSupportInfoTest {
+
+    private static final int[] NR_VOPS_VALUE = {
+        NrVopsSupportInfo.NR_STATUS_VOPS_NOT_SUPPORTED,
+        NrVopsSupportInfo.NR_STATUS_VOPS_3GPP_SUPPORTED,
+        NrVopsSupportInfo.NR_STATUS_VOPS_NON_3GPP_SUPPORTED};
+    private static final int[] NR_EMC_VALUE = {
+        NrVopsSupportInfo.NR_STATUS_EMC_NOT_SUPPORTED,
+        NrVopsSupportInfo.NR_STATUS_EMC_5GCN_ONLY,
+        NrVopsSupportInfo.NR_STATUS_EMC_EUTRA_5GCN_ONLY,
+        NrVopsSupportInfo.NR_STATUS_EMC_NR_EUTRA_5GCN};
+    private static final int[] NR_EMF_VALUE = {
+        NrVopsSupportInfo.NR_STATUS_EMF_NOT_SUPPORTED,
+        NrVopsSupportInfo.NR_STATUS_EMF_5GCN_ONLY,
+        NrVopsSupportInfo.NR_STATUS_EMF_EUTRA_5GCN_ONLY,
+        NrVopsSupportInfo.NR_STATUS_EMF_NR_EUTRA_5GCN};
+
+    @Test
+    public void testLteVopsSupportInfoApi() {
+        VopsSupportInfo vops = new LteVopsSupportInfo(
+                LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
+                LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED);
+
+        assertEquals(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
+                ((LteVopsSupportInfo) vops).getVopsSupport());
+        assertEquals(LteVopsSupportInfo.LTE_STATUS_NOT_SUPPORTED,
+                ((LteVopsSupportInfo) vops).getEmcBearerSupport());
+        assertFalse(vops.isVopsSupported());
+        assertFalse(vops.isEmergencyServiceSupported());
+        assertFalse(vops.isEmergencyServiceFallbackSupported());
+
+        vops = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
+                LteVopsSupportInfo.LTE_STATUS_SUPPORTED);
+
+        assertEquals(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
+                ((LteVopsSupportInfo) vops).getVopsSupport());
+        assertEquals(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
+                ((LteVopsSupportInfo) vops).getEmcBearerSupport());
+        assertTrue(vops.isVopsSupported());
+        assertTrue(vops.isEmergencyServiceSupported());
+        assertFalse(vops.isEmergencyServiceFallbackSupported());
+    }
+
+    @Test
+    public void testLteVopsSupportInfoParcel() {
+        LteVopsSupportInfo vops = new LteVopsSupportInfo(LteVopsSupportInfo.LTE_STATUS_SUPPORTED,
+                LteVopsSupportInfo.LTE_STATUS_SUPPORTED);
+
+        Parcel vopsParcel = Parcel.obtain();
+        vops.writeToParcel(vopsParcel, 0);
+        vopsParcel.setDataPosition(0);
+        LteVopsSupportInfo checkLteVops =
+                LteVopsSupportInfo.CREATOR.createFromParcel(vopsParcel);
+
+        assertEquals(0, vops.describeContents());
+        assertEquals(vops, checkLteVops);
+    }
+
+    @Test
+    public void testNrVopsSupportInfoApi() {
+        for (int i = 0; i < NR_VOPS_VALUE.length; i++) {
+            for (int j = 0; j < NR_EMC_VALUE.length; j++) {
+                for (int k = 0; k < NR_EMF_VALUE.length; k++) {
+                    VopsSupportInfo vops = new NrVopsSupportInfo(NR_VOPS_VALUE[i],
+                            NR_EMC_VALUE[j], NR_EMF_VALUE[k]);
+
+                    assertEquals(NR_VOPS_VALUE[i], ((NrVopsSupportInfo) vops).getVopsSupport());
+                    assertEquals(NR_EMC_VALUE[j], ((NrVopsSupportInfo) vops).getEmcSupport());
+                    assertEquals(NR_EMF_VALUE[k], ((NrVopsSupportInfo) vops).getEmfSupport());
+                    assertEquals(isVopsSupportedByNrVopsInfo(NR_VOPS_VALUE[i]),
+                            vops.isVopsSupported());
+                    assertEquals(isEmcSupportedByNrVopsInfo(NR_EMC_VALUE[j]),
+                            vops.isEmergencyServiceSupported());
+                    assertEquals(isEmfSupportedByNrVopsInfo(NR_EMF_VALUE[k]),
+                            vops.isEmergencyServiceFallbackSupported());
+                }
+            }
+        }
+    }
+
+    @Test
+    public void testNrVopsSupportInfoParcel() {
+        NrVopsSupportInfo vops = new NrVopsSupportInfo(
+                NrVopsSupportInfo.NR_STATUS_VOPS_3GPP_SUPPORTED,
+                NrVopsSupportInfo.NR_STATUS_EMC_NR_EUTRA_5GCN,
+                NrVopsSupportInfo.NR_STATUS_EMF_NR_EUTRA_5GCN);
+
+        Parcel vopsParcel = Parcel.obtain();
+        vops.writeToParcel(vopsParcel, 0);
+        vopsParcel.setDataPosition(0);
+        NrVopsSupportInfo checkNrVops =
+                NrVopsSupportInfo.CREATOR.createFromParcel(vopsParcel);
+
+        assertEquals(0, vops.describeContents());
+        assertEquals(vops, checkNrVops);
+    }
+
+    private boolean isVopsSupportedByNrVopsInfo(int value) {
+        return value != NrVopsSupportInfo.NR_STATUS_VOPS_NOT_SUPPORTED;
+    }
+
+    private boolean isEmcSupportedByNrVopsInfo(int value) {
+        return value != NrVopsSupportInfo.NR_STATUS_EMC_NOT_SUPPORTED;
+    }
+
+    private boolean isEmfSupportedByNrVopsInfo(int value) {
+        return value != NrVopsSupportInfo.NR_STATUS_EMF_NOT_SUPPORTED;
+    }
+}
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java
index aafa6f8..c47d22d 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java
@@ -612,6 +612,7 @@
 
         // Verify that the contact capability is received and the onCompleted is called.
         RcsContactUceCapability capability = waitForResult(capabilityQueue);
+        assertNotNull("Capabilities were not received for contact: " + sTestNumberUri, capability);
         verifyCapabilityResult(capability, sTestNumberUri, REQUEST_RESULT_FOUND, true, true);
         waitForResult(completeQueue);
 
@@ -999,12 +1000,15 @@
 
         // Verify that all the three contact's capabilities are received
         RcsContactUceCapability capability = waitForResult(capabilityQueue);
+        assertNotNull("Capabilities were not received for contact: " + contact1, capability);
         verifyCapabilityResult(capability, contact1, REQUEST_RESULT_FOUND, true, true);
 
         capability = waitForResult(capabilityQueue);
+        assertNotNull("Capabilities were not received for contact: " + contact2, capability);
         verifyCapabilityResult(capability, contact2, REQUEST_RESULT_FOUND, true, false);
 
         capability = waitForResult(capabilityQueue);
+        assertNotNull("Capabilities were not received for contact: " + contact3, capability);
         verifyCapabilityResult(capability, contact3, REQUEST_RESULT_FOUND, false, false);
 
         // Verify the onCompleted is called
@@ -1121,9 +1125,9 @@
 
         // Verify the callback "onCapabilitiesReceived" is called.
         RcsContactUceCapability capability = waitForResult(capabilityQueue);
-        // Verify the callback "onComplete" is called.
-        waitForResult(completeQueue);
         assertNotNull("RcsContactUceCapability should not be null", capability);
+        // Verify the callback "onComplete" is called.
+        assertNotNull(waitForResult(completeQueue));
         assertEquals(RcsContactUceCapability.SOURCE_TYPE_NETWORK, capability.getSourceType());
         assertEquals(sTestNumberUri, capability.getContactUri());
         assertEquals(RcsContactUceCapability.REQUEST_RESULT_FOUND, capability.getRequestResult());
diff --git a/tests/tests/util/src/android/util/cts/SparseArrayTest.java b/tests/tests/util/src/android/util/cts/SparseArrayTest.java
index ce4382b..b90fd38 100644
--- a/tests/tests/util/src/android/util/cts/SparseArrayTest.java
+++ b/tests/tests/util/src/android/util/cts/SparseArrayTest.java
@@ -16,6 +16,8 @@
 
 package android.util.cts;
 
+import static com.google.common.truth.Truth.assertThat;
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
@@ -140,7 +142,7 @@
         assertEquals(LENGTH, sparseArray.size());
 
         assertEquals(VALUE_FOR_NON_EXISTED_KEY,
-                     sparseArray.get(NON_EXISTED_KEY, VALUE_FOR_NON_EXISTED_KEY));
+                sparseArray.get(NON_EXISTED_KEY, VALUE_FOR_NON_EXISTED_KEY));
         assertNull(sparseArray.get(NON_EXISTED_KEY)); // the default value is null
 
         int size = sparseArray.size();
@@ -196,6 +198,27 @@
     }
 
     @Test
+    public void testSet() {
+        SparseArray<String> first = new SparseArray<>();
+        first.put(0, "0");
+        first.put(1, "1");
+        first.put(2, "2");
+
+        SparseArray<String> second = new SparseArray<>();
+        second.set(2, "2");
+        second.set(0, "0");
+        second.set(1, "1");
+
+        assertThat(first.size()).isEqualTo(second.size());
+        assertThat(first.get(0)).isEqualTo(second.get(0));
+        assertThat(first.get(1)).isEqualTo(second.get(1));
+        assertThat(first.get(2)).isEqualTo(second.get(2));
+        assertThat(first.get(3, "-1")).isEqualTo(second.get(3, "-1"));
+
+        testContentEquals(first, second, SparseArray::contentEquals);
+    }
+
+    @Test
     public void testContentEquals() {
         SparseArray<TestData> first = new SparseArray<>();
         first.put(0, new TestData("0"));
diff --git a/tests/tests/voiceinteraction/AndroidManifest.xml b/tests/tests/voiceinteraction/AndroidManifest.xml
index 238f0ce..9d7839e 100644
--- a/tests/tests/voiceinteraction/AndroidManifest.xml
+++ b/tests/tests/voiceinteraction/AndroidManifest.xml
@@ -57,7 +57,7 @@
         </service>
         <service android:name="android.voiceinteraction.service.MainHotwordDetectionService"
                  android:permission="android.permission.BIND_HOTWORD_DETECTION_SERVICE"
-                 android:process=":remote"
+                 android:isolatedProcess="true"
                  android:exported="true">
         </service>
         <service android:name="android.voiceinteraction.service.MainInteractionService"
diff --git a/tests/tests/voiceinteraction/common/Android.bp b/tests/tests/voiceinteraction/common/Android.bp
index e9052de..1d8d77e 100644
--- a/tests/tests/voiceinteraction/common/Android.bp
+++ b/tests/tests/voiceinteraction/common/Android.bp
@@ -18,6 +18,8 @@
 
 java_library {
     name: "CtsVoiceInteractionCommon",
-    srcs: ["src/**/*.java"],
+    srcs: ["src/**/*.java",
+           "src/**/*.aidl"
+    ],
     sdk_version: "current",
 }
diff --git a/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/ICtsHotwordDetectionServiceCallback.aidl b/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/ICtsHotwordDetectionServiceCallback.aidl
new file mode 100644
index 0000000..3955dc0
--- /dev/null
+++ b/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/ICtsHotwordDetectionServiceCallback.aidl
@@ -0,0 +1,27 @@
+/*
+ * 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.voiceinteraction.common;
+
+/**
+ * Callback for returning the test result from the HotwordDetectionService.
+ */
+oneway interface ICtsHotwordDetectionServiceCallback {
+    /**
+     * Called to return the test result.
+     */
+    void onTestResult(int result);
+}
diff --git a/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/Utils.java b/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/Utils.java
index dd60884..553cbb4 100644
--- a/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/Utils.java
+++ b/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/Utils.java
@@ -139,6 +139,7 @@
     public static final String KEY_SERVICE_TYPE = "serviceType";
     public static final String KEY_TEST_EVENT = "testEvent";
     public static final String KEY_TEST_RESULT = "testResult";
+    public static final String KEY_TEST_FAKE_BINDER = "testFakeBinder";
 
     public static final String toBundleString(Bundle bundle) {
         if (bundle == null) {
diff --git a/tests/tests/voiceinteraction/service/AndroidManifest.xml b/tests/tests/voiceinteraction/service/AndroidManifest.xml
index b00ab57..e47d30b 100644
--- a/tests/tests/voiceinteraction/service/AndroidManifest.xml
+++ b/tests/tests/voiceinteraction/service/AndroidManifest.xml
@@ -79,7 +79,7 @@
         </service>
         <service android:name=".MainHotwordDetectionService"
             android:permission="android.permission.BIND_HOTWORD_DETECTION_SERVICE"
-            android:process=":remote"
+            android:isolatedProcess="true"
             android:exported="true">
         </service>
     </application>
diff --git a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/BasicVoiceInteractionService.java b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/BasicVoiceInteractionService.java
index a3aca7d..4b6bb95 100644
--- a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/BasicVoiceInteractionService.java
+++ b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/BasicVoiceInteractionService.java
@@ -20,11 +20,13 @@
 
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.RemoteException;
 import android.os.SharedMemory;
 import android.service.voice.AlwaysOnHotwordDetector;
 import android.service.voice.VoiceInteractionService;
 import android.system.ErrnoException;
 import android.util.Log;
+import android.voiceinteraction.common.ICtsHotwordDetectionServiceCallback;
 import android.voiceinteraction.common.Utils;
 
 import java.nio.ByteBuffer;
@@ -139,6 +141,17 @@
         // TODO : Add more data for testing
         Bundle bundle = new Bundle();
         bundle.putByteArray("fakeData", FAKE_BYTE_ARRAY_DATA);
+        ICtsHotwordDetectionServiceCallback callback =
+                new ICtsHotwordDetectionServiceCallback.Stub() {
+            @Override
+            public void onTestResult(int result) throws RemoteException {
+                Log.d(TAG, "onTestResult result = " + result);
+                broadcastIntentWithResult(
+                        Utils.BROADCAST_HOTWORD_DETECTION_SERVICE_TRIGGER_RESULT_INTENT,
+                        result);
+            }
+        };
+        bundle.putBinder(Utils.KEY_TEST_FAKE_BINDER, callback.asBinder());
         return bundle;
     }
 }
diff --git a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainHotwordDetectionService.java b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainHotwordDetectionService.java
index 4912f16..2ebdc4e 100644
--- a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainHotwordDetectionService.java
+++ b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainHotwordDetectionService.java
@@ -16,14 +16,16 @@
 
 package android.voiceinteraction.service;
 
-import android.content.Intent;
 import android.media.AudioFormat;
 import android.os.Bundle;
+import android.os.IBinder;
 import android.os.ParcelFileDescriptor;
+import android.os.RemoteException;
 import android.os.SharedMemory;
 import android.service.voice.HotwordDetectionService;
 import android.system.ErrnoException;
 import android.util.Log;
+import android.voiceinteraction.common.ICtsHotwordDetectionServiceCallback;
 import android.voiceinteraction.common.Utils;
 
 import androidx.annotation.NonNull;
@@ -50,16 +52,26 @@
     public void onUpdateState(@Nullable Bundle options, @Nullable SharedMemory sharedMemory) {
         Log.d(TAG, "onUpdateState");
 
-        // TODO : Check the options data and sharedMemory data. It will also need to use the new
-        // mechanism instead of sendBroadcast to respond the test result when submitting isolated
-        // process patch.
+        ICtsHotwordDetectionServiceCallback callback = null;
+        if (options != null) {
+            IBinder binder = options.getBinder(Utils.KEY_TEST_FAKE_BINDER);
+            callback = ICtsHotwordDetectionServiceCallback.Stub.asInterface(binder);
+        }
+
+        if (callback == null) {
+            Log.w(TAG, "no callback to return the test result");
+            return;
+        }
 
         if (sharedMemory != null) {
             try {
                 sharedMemory.mapReadWrite();
-                broadcastIntentWithResult(
-                        Utils.BROADCAST_HOTWORD_DETECTION_SERVICE_TRIGGER_RESULT_INTENT,
-                        Utils.HOTWORD_DETECTION_SERVICE_TRIGGER_SHARED_MEMORY_NOT_READ_ONLY);
+                try {
+                    callback.onTestResult(
+                            Utils.HOTWORD_DETECTION_SERVICE_TRIGGER_SHARED_MEMORY_NOT_READ_ONLY);
+                } catch (RemoteException e) {
+                    Log.d(TAG, "call onTestResult RemoteException : " + e);
+                }
                 return;
             } catch (ErrnoException e) {
                 // For read-only case
@@ -67,15 +79,11 @@
                 sharedMemory.close();
             }
         }
-        broadcastIntentWithResult(Utils.BROADCAST_HOTWORD_DETECTION_SERVICE_TRIGGER_RESULT_INTENT,
-                Utils.HOTWORD_DETECTION_SERVICE_TRIGGER_SUCCESS);
-    }
-
-    private void broadcastIntentWithResult(String intentName, int result) {
-        Intent intent = new Intent(intentName)
-                .addFlags(Intent.FLAG_RECEIVER_FOREGROUND | Intent.FLAG_RECEIVER_REGISTERED_ONLY)
-                .putExtra(Utils.KEY_TEST_RESULT, result);
-        Log.d(TAG, "broadcast intent = " + intent + ", result = " + result);
-        sendBroadcast(intent);
+        try {
+            callback.onTestResult(
+                    Utils.HOTWORD_DETECTION_SERVICE_TRIGGER_SUCCESS);
+        } catch (RemoteException e) {
+            Log.d(TAG, "call onTestResult RemoteException : " + e);
+        }
     }
 }
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsThemeColorsTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsThemeColorsTest.java
index f26a7c7..ead1ca3 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsThemeColorsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsThemeColorsTest.java
@@ -146,7 +146,7 @@
 
         // Add our host view to the activity behind this test. This is similar to how launchers
         // add widgets to the on-screen UI.
-        ViewGroup root = (ViewGroup) mActivityRule.getActivity().findViewById(R.id.remoteView_host);
+        ViewGroup root = mActivityRule.getActivity().findViewById(R.id.remoteView_host);
         FrameLayout.MarginLayoutParams lp = new FrameLayout.MarginLayoutParams(
                 ViewGroup.LayoutParams.MATCH_PARENT,
                 ViewGroup.LayoutParams.MATCH_PARENT);
@@ -158,8 +158,8 @@
 
     private static List<Integer> generateColorList() {
         List<Integer> colors = new ArrayList<>();
-        for (int color = android.R.color.system_primary_0;
-                color <= android.R.color.system_neutral_1000; color++) {
+        for (int color = android.R.color.system_neutral1_0;
+                color <= android.R.color.system_accent3_1000; color++) {
             colors.add(color);
         }
         return colors;
diff --git a/tests/tests/widget/src/android/widget/cts/ToastTest.java b/tests/tests/widget/src/android/widget/cts/ToastTest.java
index cc44b20..5fbd5c0 100644
--- a/tests/tests/widget/src/android/widget/cts/ToastTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ToastTest.java
@@ -979,6 +979,31 @@
         assertCustomToastNotShown(toasts.get(1));
     }
 
+    @Test
+    public void testAppWithUnlimitedToastsPermissionCanPostUnlimitedToasts() throws Throwable {
+        // enable rate limiting to test it
+        SystemUtil.runWithShellPermissionIdentity(() -> mNotificationManager
+                .setToastRateLimitingEnabled(true));
+
+        int highestToastRateLimit = TOAST_RATE_LIMITS[TOAST_RATE_LIMITS.length - 1];
+        List<TextToastInfo> toasts = createTextToasts(highestToastRateLimit + 1, "Text",
+                Toast.LENGTH_SHORT);
+
+        // We have to show one by one to avoid max number of toasts enqueued by a single package at
+        // a time.
+        for (TextToastInfo t : toasts) {
+            // The shell has the android.permission.UNLIMITED_TOASTS permission.
+            SystemUtil.runWithShellPermissionIdentity(() -> {
+                try {
+                    showToast(t);
+                } catch (Throwable throwable) {
+                    throw new RuntimeException(throwable);
+                }
+            });
+            assertTextToastShownAndHidden(t);
+        }
+    }
+
     /** Create given number of text toasts with the same given text and length. */
     private List<TextToastInfo> createTextToasts(int num, String text, int length)
             throws Throwable {
@@ -986,7 +1011,7 @@
         mActivityRule.runOnUiThread(() -> {
             toasts.addAll(Stream
                     .generate(() -> TextToastInfo.create(mContext, text, length))
-                    .limit(num + 1)
+                    .limit(num)
                     .collect(toList()));
         });
         return toasts;
@@ -999,7 +1024,7 @@
         mActivityRule.runOnUiThread(() -> {
             toasts.addAll(Stream
                     .generate(() -> CustomToastInfo.create(mContext, text, length))
-                    .limit(num + 1)
+                    .limit(num)
                     .collect(toList()));
         });
         return toasts;
@@ -1013,6 +1038,12 @@
         });
     }
 
+    private void showToast(ToastInfo toast) throws Throwable {
+        mActivityRule.runOnUiThread(() -> {
+            toast.getToast().show();
+        });
+    }
+
     private void assertTextToastsShownAndHidden(List<TextToastInfo> toasts) {
         for (int i = 0; i < toasts.size(); i++) {
             assertTextToastShownAndHidden(toasts.get(i));