Merge "Check navigation mode before running PreferredActivitiesTestCases" into rvc-dev
diff --git a/tests/BlobStore/src/com/android/cts/blob/BlobStoreManagerTest.java b/tests/BlobStore/src/com/android/cts/blob/BlobStoreManagerTest.java
index 3599107..bb86844 100644
--- a/tests/BlobStore/src/com/android/cts/blob/BlobStoreManagerTest.java
+++ b/tests/BlobStore/src/com/android/cts/blob/BlobStoreManagerTest.java
@@ -65,6 +65,7 @@
 import java.io.OutputStream;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Random;
@@ -1621,6 +1622,72 @@
         }, Pair.create(KEY_MAX_BLOB_ACCESS_PERMITTED_PACKAGES, String.valueOf(1)));
     }
 
+    @Test
+    public void testBlobHandleEquality() throws Exception {
+        // Check that BlobHandle objects are considered equal when digest, label, expiry time
+        // and tag are equal.
+        {
+            final BlobHandle blobHandle1 = BlobHandle.createWithSha256("digest".getBytes(),
+                    "Dummy blob", 1111L, "tag");
+            final BlobHandle blobHandle2 = BlobHandle.createWithSha256("digest".getBytes(),
+                    "Dummy blob", 1111L, "tag");
+            assertThat(blobHandle1).isEqualTo(blobHandle2);
+        }
+
+        // Check that BlobHandle objects are not equal if digests are not equal.
+        {
+            final BlobHandle blobHandle1 = BlobHandle.createWithSha256("digest1".getBytes(),
+                    "Dummy blob", 1111L, "tag");
+            final BlobHandle blobHandle2 = BlobHandle.createWithSha256("digest2".getBytes(),
+                    "Dummy blob", 1111L, "tag");
+            assertThat(blobHandle1).isNotEqualTo(blobHandle2);
+        }
+
+        // Check that BlobHandle objects are not equal if expiry times are not equal.
+        {
+            final BlobHandle blobHandle1 = BlobHandle.createWithSha256("digest".getBytes(),
+                    "Dummy blob", 1111L, "tag");
+            final BlobHandle blobHandle2 = BlobHandle.createWithSha256("digest".getBytes(),
+                    "Dummy blob", 1112L, "tag");
+            assertThat(blobHandle1).isNotEqualTo(blobHandle2);
+        }
+
+        // Check that BlobHandle objects are not equal if labels are not equal.
+        {
+            final BlobHandle blobHandle1 = BlobHandle.createWithSha256("digest".getBytes(),
+                    "Dummy blob1", 1111L, "tag");
+            final BlobHandle blobHandle2 = BlobHandle.createWithSha256("digest".getBytes(),
+                    "Dummy blob2", 1111L, "tag");
+            assertThat(blobHandle1).isNotEqualTo(blobHandle2);
+        }
+
+        // Check that BlobHandle objects are not equal if tags are not equal.
+        {
+            final BlobHandle blobHandle1 = BlobHandle.createWithSha256("digest".getBytes(),
+                    "Dummy blob", 1111L, "tag1");
+            final BlobHandle blobHandle2 = BlobHandle.createWithSha256("digest".getBytes(),
+                    "Dummy blob", 1111L, "tag2");
+            assertThat(blobHandle1).isNotEqualTo(blobHandle2);
+        }
+    }
+
+    @Test
+    public void testBlobHandleCreation() throws Exception {
+        // Creating a BlobHandle with label > 100 chars will fail
+        {
+            final CharSequence label = String.join("", Collections.nCopies(101, "a"));
+            assertThrows(IllegalArgumentException.class,
+                    () -> BlobHandle.createWithSha256("digest".getBytes(), label, 1111L, "tag"));
+        }
+
+        // Creating a BlobHandle with tag > 128 chars will fail
+        {
+            final String tag = String.join("", Collections.nCopies(129, "a"));
+            assertThrows(IllegalArgumentException.class,
+                    () -> BlobHandle.createWithSha256("digest".getBytes(), "label", 1111L, tag));
+        }
+    }
+
     private static void runWithKeyValues(ThrowingRunnable runnable,
             Pair<String, String>... keyValues) throws Exception {
         final Map<String, String> previousValues = new ArrayMap();
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/TouchExplorerTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/TouchExplorerTest.java
index 56d5240..80a3054 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/TouchExplorerTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/TouchExplorerTest.java
@@ -291,28 +291,6 @@
     }
 
     /**
-     * Test the case where we want to long click on the item that has accessibility focus. Note that
-     * this test does not request that double tap and hold be dispatched to the accessibility
-     * service, meaning that it will be handled by the framework and the view will be long clicked.
-     */
-    @Test
-    @AppModeFull
-    public void testDoubleTapAndHoldAccessibilityFocus_performsLongClick() {
-        if (!mHasTouchscreen || !mScreenBigEnough) return;
-        syncAccessibilityFocusToInputFocus();
-        dispatch(doubleTapAndHold(mTapLocation));
-        mHoverListener.assertNonePropagated();
-        // The click should not be delivered via touch events in this case.
-        mTouchListener.assertNonePropagated();
-        mService.assertPropagated(
-                TYPE_VIEW_ACCESSIBILITY_FOCUSED,
-                TYPE_TOUCH_INTERACTION_START,
-                TYPE_VIEW_LONG_CLICKED,
-                TYPE_TOUCH_INTERACTION_END);
-        mLongClickListener.assertLongClicked(mView);
-    }
-
-    /**
      * Test the case where we double tap and hold but there is no accessibility focus. Nothing
      * should happen.
      */
diff --git a/tests/tests/media/src/android/media/cts/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index 62c6012..8c90275 100644
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -35,6 +35,7 @@
 import android.media.MediaCodecInfo.CodecCapabilities;
 import android.media.MediaExtractor;
 import android.media.MediaFormat;
+import android.os.Build;
 import android.platform.test.annotations.AppModeFull;
 import android.util.Log;
 import android.view.Display;
@@ -42,6 +43,7 @@
 import android.net.Uri;
 import android.os.Bundle;
 
+import com.android.compatibility.common.util.ApiLevelUtil;
 import com.android.compatibility.common.util.CddTest;
 import com.android.compatibility.common.util.DeviceReportLog;
 import com.android.compatibility.common.util.DynamicConfigDeviceSide;
@@ -50,6 +52,8 @@
 import com.android.compatibility.common.util.ResultType;
 import com.android.compatibility.common.util.ResultUnit;
 
+import androidx.test.filters.SdkSuppress;
+
 import java.io.BufferedInputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -70,6 +74,7 @@
 public class DecoderTest extends MediaPlayerTestBase {
     private static final String TAG = "DecoderTest";
     private static final String REPORT_LOG_NAME = "CtsMediaTestCases";
+    private static boolean mIsAtLeastR = ApiLevelUtil.isAtLeast(Build.VERSION_CODES.R);
 
     private static final int RESET_MODE_NONE = 0;
     private static final int RESET_MODE_RECONFIGURE = 1;
@@ -274,6 +279,8 @@
     private void verifyChannelsAndRates(String[] mimetypes, int[] sampleRates,
                                        int[] channelMasks) throws Exception {
 
+        if (!MediaUtils.check(mIsAtLeastR, "test invalid before Android 11")) return;
+
         for (String mimetype : mimetypes) {
             // ensure we find a codec for all listed mime/channel/rate combinations
             MediaCodecList mcl = new MediaCodecList(MediaCodecList.ALL_CODECS);
@@ -3579,6 +3586,7 @@
         return pm.hasSystemFeature(PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE);
     }
 
+    @SdkSuppress(minSdkVersion = Build.VERSION_CODES.R)
     public void testLowLatencyVp9At1280x720() throws Exception {
         testLowLatencyVideo(
                 R.raw.video_1280x720_webm_vp9_csd_309kbps_25fps_vorbis_stereo_128kbps_48000hz, 300,
@@ -3588,6 +3596,7 @@
                 true /* useNdk */);
     }
 
+    @SdkSuppress(minSdkVersion = Build.VERSION_CODES.R)
     public void testLowLatencyVp9At1920x1080() throws Exception {
         testLowLatencyVideo(
                 R.raw.bbb_s2_1920x1080_webm_vp9_0p41_10mbps_60fps_vorbis_6ch_384kbps_22050hz, 300,
@@ -3597,6 +3606,7 @@
                 true /* useNdk */);
     }
 
+    @SdkSuppress(minSdkVersion = Build.VERSION_CODES.R)
     public void testLowLatencyVp9At3840x2160() throws Exception {
         testLowLatencyVideo(
                 R.raw.bbb_s2_3840x2160_webm_vp9_0p51_20mbps_60fps_vorbis_6ch_384kbps_32000hz, 300,