Annotate the StreamingAeadSeekableDecryptingChannel with "RequiresApi"

PiperOrigin-RevId: 464044165
diff --git a/java_src/src/main/java/com/google/crypto/tink/BUILD.bazel b/java_src/src/main/java/com/google/crypto/tink/BUILD.bazel
index dff9e7d..4520c1d 100644
--- a/java_src/src/main/java/com/google/crypto/tink/BUILD.bazel
+++ b/java_src/src/main/java/com/google/crypto/tink/BUILD.bazel
@@ -16,6 +16,7 @@
 java_library(
     name = "streaming_aead",
     srcs = ["StreamingAead.java"],
+    deps = ["@maven//:androidx_annotation_annotation"],
 )
 
 java_library(
@@ -826,6 +827,7 @@
 android_library(
     name = "streaming_aead-android",
     srcs = ["StreamingAead.java"],
+    deps = ["@maven//:androidx_annotation_annotation"],
 )
 
 android_library(
diff --git a/java_src/src/main/java/com/google/crypto/tink/StreamingAead.java b/java_src/src/main/java/com/google/crypto/tink/StreamingAead.java
index 6805870..b62d3bf 100644
--- a/java_src/src/main/java/com/google/crypto/tink/StreamingAead.java
+++ b/java_src/src/main/java/com/google/crypto/tink/StreamingAead.java
@@ -16,6 +16,7 @@
 
 package com.google.crypto.tink;
 
+import androidx.annotation.RequiresApi;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -161,6 +162,7 @@
    *     associatedData is not correct.
    * @throws IOException if an IOException occurred while reading from ciphertextDestination.
    */
+  @RequiresApi(24) // https://developer.android.com/reference/java/nio/channels/SeekableByteChannel
   SeekableByteChannel newSeekableDecryptingChannel(
       SeekableByteChannel ciphertextSource, byte[] associatedData)
       throws GeneralSecurityException, IOException;
diff --git a/java_src/src/main/java/com/google/crypto/tink/streamingaead/BUILD.bazel b/java_src/src/main/java/com/google/crypto/tink/streamingaead/BUILD.bazel
index 5696900..12bba89 100644
--- a/java_src/src/main/java/com/google/crypto/tink/streamingaead/BUILD.bazel
+++ b/java_src/src/main/java/com/google/crypto/tink/streamingaead/BUILD.bazel
@@ -42,6 +42,7 @@
     deps = [
         "//src/main/java/com/google/crypto/tink:primitive_set",
         "//src/main/java/com/google/crypto/tink:streaming_aead",
+        "@maven//:androidx_annotation_annotation",
         "@maven//:com_google_code_findbugs_jsr305",
     ],
 )
@@ -65,6 +66,7 @@
         ":seekable_byte_channel_decrypter",
         "//src/main/java/com/google/crypto/tink:primitive_set",
         "//src/main/java/com/google/crypto/tink:streaming_aead",
+        "@maven//:androidx_annotation_annotation",
     ],
 )
 
@@ -183,6 +185,7 @@
     deps = [
         "//src/main/java/com/google/crypto/tink:primitive_set-android",
         "//src/main/java/com/google/crypto/tink:streaming_aead-android",
+        "@maven//:androidx_annotation_annotation",
         "@maven//:com_google_code_findbugs_jsr305",
     ],
 )
@@ -206,6 +209,7 @@
         ":seekable_byte_channel_decrypter-android",
         "//src/main/java/com/google/crypto/tink:primitive_set-android",
         "//src/main/java/com/google/crypto/tink:streaming_aead-android",
+        "@maven//:androidx_annotation_annotation",
     ],
 )
 
diff --git a/java_src/src/main/java/com/google/crypto/tink/streamingaead/SeekableByteChannelDecrypter.java b/java_src/src/main/java/com/google/crypto/tink/streamingaead/SeekableByteChannelDecrypter.java
index 64e9230..ac3a472 100644
--- a/java_src/src/main/java/com/google/crypto/tink/streamingaead/SeekableByteChannelDecrypter.java
+++ b/java_src/src/main/java/com/google/crypto/tink/streamingaead/SeekableByteChannelDecrypter.java
@@ -16,6 +16,7 @@
 
 package com.google.crypto.tink.streamingaead;
 
+import androidx.annotation.RequiresApi;
 import com.google.crypto.tink.PrimitiveSet;
 import com.google.crypto.tink.StreamingAead;
 import java.io.IOException;
@@ -27,9 +28,8 @@
 import java.util.Deque;
 import javax.annotation.concurrent.GuardedBy;
 
-/**
- * A decrypter for ciphertext given in a {@link SeekableByteChannel}.
- */
+/** A decrypter for ciphertext given in a {@link SeekableByteChannel}. */
+@RequiresApi(24) // https://developer.android.com/reference/java/nio/channels/SeekableByteChannel
 final class SeekableByteChannelDecrypter implements SeekableByteChannel {
   @GuardedBy("this")
   SeekableByteChannel attemptingChannel;
diff --git a/java_src/src/main/java/com/google/crypto/tink/streamingaead/StreamingAeadHelper.java b/java_src/src/main/java/com/google/crypto/tink/streamingaead/StreamingAeadHelper.java
index 412466c..7bcbff5 100644
--- a/java_src/src/main/java/com/google/crypto/tink/streamingaead/StreamingAeadHelper.java
+++ b/java_src/src/main/java/com/google/crypto/tink/streamingaead/StreamingAeadHelper.java
@@ -16,6 +16,7 @@
 
 package com.google.crypto.tink.streamingaead;
 
+import androidx.annotation.RequiresApi;
 import com.google.crypto.tink.PrimitiveSet;
 import com.google.crypto.tink.StreamingAead;
 import java.io.IOException;
@@ -62,6 +63,7 @@
   }
 
   @Override
+  @RequiresApi(24) // https://developer.android.com/reference/java/nio/channels/SeekableByteChannel
   public SeekableByteChannel newSeekableDecryptingChannel(
       SeekableByteChannel ciphertextChannel, byte[] associatedData)
       throws GeneralSecurityException, IOException {
diff --git a/java_src/src/main/java/com/google/crypto/tink/subtle/StreamingAeadSeekableDecryptingChannel.java b/java_src/src/main/java/com/google/crypto/tink/subtle/StreamingAeadSeekableDecryptingChannel.java
index 89da714..62161c1 100644
--- a/java_src/src/main/java/com/google/crypto/tink/subtle/StreamingAeadSeekableDecryptingChannel.java
+++ b/java_src/src/main/java/com/google/crypto/tink/subtle/StreamingAeadSeekableDecryptingChannel.java
@@ -29,6 +29,7 @@
  * An instance of {@link SeekableByteChannel} that allows random access to the plaintext of some
  * ciphertext.
  */
+@RequiresApi(24) // https://developer.android.com/reference/java/nio/channels/SeekableByteChannel
 class StreamingAeadSeekableDecryptingChannel implements SeekableByteChannel {
   // Each plaintext segment has 16 bytes more of memory than the actual plaintext that it contains.
   // This is a workaround for an incompatibility between Conscrypt and OpenJDK in their
@@ -168,7 +169,6 @@
    * @throws IOException if the header was incorrectly formatted or if there was an exception during
    *     the key derivation.
    */
-  @RequiresApi(24)
   private boolean tryReadHeader() throws IOException {
     ciphertextChannel.position(header.position() + firstSegmentOffset);
     ciphertextChannel.read(header);