Remove unnecessary RequiresApi annotation

This commit is contained in:
Gaëtan Muller 2024-01-16 11:29:08 +01:00 committed by Ian Baker
parent 973b717914
commit 963e517a5a
32 changed files with 2 additions and 93 deletions

View File

@ -25,7 +25,6 @@ import android.os.Looper;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.OptIn; import androidx.annotation.OptIn;
import androidx.annotation.RequiresApi;
import androidx.fragment.app.FragmentManager; import androidx.fragment.app.FragmentManager;
import androidx.media3.common.C; import androidx.media3.common.C;
import androidx.media3.common.DrmInitData; import androidx.media3.common.DrmInitData;
@ -354,7 +353,6 @@ public class DownloadTracker {
} }
/** Downloads a Widevine offline license in a background thread. */ /** Downloads a Widevine offline license in a background thread. */
@RequiresApi(18)
private static final class WidevineOfflineLicenseFetchTask { private static final class WidevineOfflineLicenseFetchTask {
private final Format format; private final Format format;

View File

@ -21,7 +21,6 @@ import android.opengl.EGLContext;
import android.opengl.EGLDisplay; import android.opengl.EGLDisplay;
import android.opengl.EGLSurface; import android.opengl.EGLSurface;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import androidx.annotation.RequiresApi;
import androidx.media3.common.util.GlUtil.GlException; import androidx.media3.common.util.GlUtil.GlException;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
@ -39,7 +38,6 @@ public interface GlObjectsProvider {
* @param configAttributes The attributes to configure EGL with. * @param configAttributes The attributes to configure EGL with.
* @throws GlException If an error occurs during creation. * @throws GlException If an error occurs during creation.
*/ */
@RequiresApi(17)
EGLContext createEglContext( EGLContext createEglContext(
EGLDisplay eglDisplay, @IntRange(from = 2, to = 3) int openGlVersion, int[] configAttributes) EGLDisplay eglDisplay, @IntRange(from = 2, to = 3) int openGlVersion, int[] configAttributes)
throws GlException; throws GlException;
@ -54,7 +52,6 @@ public interface GlObjectsProvider {
* @param isEncoderInputSurface Whether the {@code surface} is the input surface of an encoder. * @param isEncoderInputSurface Whether the {@code surface} is the input surface of an encoder.
* @throws GlException If an error occurs during creation. * @throws GlException If an error occurs during creation.
*/ */
@RequiresApi(17)
EGLSurface createEglSurface( EGLSurface createEglSurface(
EGLDisplay eglDisplay, EGLDisplay eglDisplay,
Object surface, Object surface,
@ -72,7 +69,6 @@ public interface GlObjectsProvider {
* surface. * surface.
* @throws GlException If an error occurs during creation. * @throws GlException If an error occurs during creation.
*/ */
@RequiresApi(17)
EGLSurface createFocusedPlaceholderEglSurface(EGLContext eglContext, EGLDisplay eglDisplay) EGLSurface createFocusedPlaceholderEglSurface(EGLContext eglContext, EGLDisplay eglDisplay)
throws GlException; throws GlException;

View File

@ -28,7 +28,6 @@ import android.os.Looper;
import android.view.accessibility.CaptioningManager; import android.view.accessibility.CaptioningManager;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.util.BundleCollectionUtil; import androidx.media3.common.util.BundleCollectionUtil;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
@ -830,7 +829,6 @@ public class TrackSelectionParameters implements Bundleable {
return new TrackSelectionParameters(this); return new TrackSelectionParameters(this);
} }
@RequiresApi(19)
private void setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettingsV19( private void setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettingsV19(
Context context) { Context context) {
if (Util.SDK_INT < 23 && Looper.myLooper() == null) { if (Util.SDK_INT < 23 && Looper.myLooper() == null) {

View File

@ -27,14 +27,12 @@ import android.opengl.GLES20;
import android.os.Handler; import android.os.Handler;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target; import java.lang.annotation.Target;
/** Generates a {@link SurfaceTexture} using EGL/GLES functions. */ /** Generates a {@link SurfaceTexture} using EGL/GLES functions. */
@RequiresApi(17)
@UnstableApi @UnstableApi
public final class EGLSurfaceTexture implements SurfaceTexture.OnFrameAvailableListener, Runnable { public final class EGLSurfaceTexture implements SurfaceTexture.OnFrameAvailableListener, Runnable {

View File

@ -37,7 +37,6 @@ import android.opengl.Matrix;
import androidx.annotation.DoNotInline; import androidx.annotation.DoNotInline;
import androidx.annotation.IntRange; import androidx.annotation.IntRange;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.C; import androidx.media3.common.C;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
@ -227,7 +226,6 @@ public final class GlUtil {
} }
/** Returns an initialized default {@link EGLDisplay}. */ /** Returns an initialized default {@link EGLDisplay}. */
@RequiresApi(17)
public static EGLDisplay getDefaultEglDisplay() throws GlException { public static EGLDisplay getDefaultEglDisplay() throws GlException {
return Api17.getDefaultEglDisplay(); return Api17.getDefaultEglDisplay();
} }
@ -240,7 +238,6 @@ public final class GlUtil {
* *
* @param eglDisplay The {@link EGLDisplay} to create an {@link EGLContext} for. * @param eglDisplay The {@link EGLDisplay} to create an {@link EGLContext} for.
*/ */
@RequiresApi(17)
public static EGLContext createEglContext(EGLDisplay eglDisplay) throws GlException { public static EGLContext createEglContext(EGLDisplay eglDisplay) throws GlException {
return createEglContext( return createEglContext(
EGL14.EGL_NO_CONTEXT, eglDisplay, /* openGlVersion= */ 2, EGL_CONFIG_ATTRIBUTES_RGBA_8888); EGL14.EGL_NO_CONTEXT, eglDisplay, /* openGlVersion= */ 2, EGL_CONFIG_ATTRIBUTES_RGBA_8888);
@ -256,7 +253,6 @@ public final class GlUtil {
* @param configAttributes The attributes to configure EGL with. Accepts either {@link * @param configAttributes The attributes to configure EGL with. Accepts either {@link
* #EGL_CONFIG_ATTRIBUTES_RGBA_1010102}, or {@link #EGL_CONFIG_ATTRIBUTES_RGBA_8888}. * #EGL_CONFIG_ATTRIBUTES_RGBA_1010102}, or {@link #EGL_CONFIG_ATTRIBUTES_RGBA_8888}.
*/ */
@RequiresApi(17)
public static EGLContext createEglContext( public static EGLContext createEglContext(
EGLContext sharedContext, EGLContext sharedContext,
EGLDisplay eglDisplay, EGLDisplay eglDisplay,
@ -282,7 +278,6 @@ public final class GlUtil {
* C#COLOR_TRANSFER_SDR}, {@link C#COLOR_TRANSFER_HLG} and {@link C#COLOR_TRANSFER_ST2084}. * C#COLOR_TRANSFER_SDR}, {@link C#COLOR_TRANSFER_HLG} and {@link C#COLOR_TRANSFER_ST2084}.
* @param isEncoderInputSurface Whether the {@code surface} is the input surface of an encoder. * @param isEncoderInputSurface Whether the {@code surface} is the input surface of an encoder.
*/ */
@RequiresApi(17)
public static EGLSurface createEglSurface( public static EGLSurface createEglSurface(
EGLDisplay eglDisplay, EGLDisplay eglDisplay,
Object surface, Object surface,
@ -325,7 +320,6 @@ public final class GlUtil {
* @param configAttributes EGL configuration attributes. Valid arguments include {@link * @param configAttributes EGL configuration attributes. Valid arguments include {@link
* #EGL_CONFIG_ATTRIBUTES_RGBA_8888} and {@link #EGL_CONFIG_ATTRIBUTES_RGBA_1010102}. * #EGL_CONFIG_ATTRIBUTES_RGBA_8888} and {@link #EGL_CONFIG_ATTRIBUTES_RGBA_1010102}.
*/ */
@RequiresApi(17)
private static EGLSurface createPbufferSurface( private static EGLSurface createPbufferSurface(
EGLDisplay eglDisplay, int width, int height, int[] configAttributes) throws GlException { EGLDisplay eglDisplay, int width, int height, int[] configAttributes) throws GlException {
int[] pbufferAttributes = int[] pbufferAttributes =
@ -347,7 +341,6 @@ public final class GlUtil {
* @param eglDisplay The {@link EGLDisplay} to attach the surface to. * @param eglDisplay The {@link EGLDisplay} to attach the surface to.
* @return {@link EGL14#EGL_NO_SURFACE} if supported and a 1x1 pixel buffer surface otherwise. * @return {@link EGL14#EGL_NO_SURFACE} if supported and a 1x1 pixel buffer surface otherwise.
*/ */
@RequiresApi(17)
public static EGLSurface createFocusedPlaceholderEglSurface( public static EGLSurface createFocusedPlaceholderEglSurface(
EGLContext eglContext, EGLDisplay eglDisplay) throws GlException { EGLContext eglContext, EGLDisplay eglDisplay) throws GlException {
// EGL_CONFIG_ATTRIBUTES_RGBA_1010102 could be used for HDR input, but EGL14.EGL_NO_SURFACE // EGL_CONFIG_ATTRIBUTES_RGBA_1010102 could be used for HDR input, but EGL14.EGL_NO_SURFACE
@ -369,7 +362,6 @@ public final class GlUtil {
* <p>Returns {@code 0} if no {@link EGLContext} {@linkplain #createFocusedPlaceholderEglSurface * <p>Returns {@code 0} if no {@link EGLContext} {@linkplain #createFocusedPlaceholderEglSurface
* is focused}. * is focused}.
*/ */
@RequiresApi(17)
public static long getContextMajorVersion() throws GlException { public static long getContextMajorVersion() throws GlException {
return Api17.getContextMajorVersion(); return Api17.getContextMajorVersion();
} }
@ -381,7 +373,6 @@ public final class GlUtil {
* #createFocusedPlaceholderEglSurface is focused}, or the focused {@link EGLContext} version is * #createFocusedPlaceholderEglSurface is focused}, or the focused {@link EGLContext} version is
* less than 3.0. * less than 3.0.
*/ */
@RequiresApi(17)
public static long createGlSyncFence() throws GlException { public static long createGlSyncFence() throws GlException {
// If the context is an OpenGL 3.0 context, we must be running API 18 or later. // If the context is an OpenGL 3.0 context, we must be running API 18 or later.
return Api17.getContextMajorVersion() >= 3 ? Api18.createSyncFence() : 0; return Api17.getContextMajorVersion() >= 3 ? Api18.createSyncFence() : 0;
@ -422,7 +413,6 @@ public final class GlUtil {
} }
/** Gets the current {@link EGLContext context}. */ /** Gets the current {@link EGLContext context}. */
@RequiresApi(17)
public static EGLContext getCurrentContext() { public static EGLContext getCurrentContext() {
return Api17.getCurrentContext(); return Api17.getCurrentContext();
} }
@ -498,7 +488,6 @@ public final class GlUtil {
* Makes the specified {@code eglSurface} the render target, using a viewport of {@code width} by * Makes the specified {@code eglSurface} the render target, using a viewport of {@code width} by
* {@code height} pixels. * {@code height} pixels.
*/ */
@RequiresApi(17)
public static void focusEglSurface( public static void focusEglSurface(
EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, int width, int height) EGLDisplay eglDisplay, EGLContext eglContext, EGLSurface eglSurface, int width, int height)
throws GlException { throws GlException {
@ -510,7 +499,6 @@ public final class GlUtil {
* Makes the specified {@code framebuffer} the render target, using a viewport of {@code width} by * Makes the specified {@code framebuffer} the render target, using a viewport of {@code width} by
* {@code height} pixels. * {@code height} pixels.
*/ */
@RequiresApi(17)
public static void focusFramebuffer( public static void focusFramebuffer(
EGLDisplay eglDisplay, EGLDisplay eglDisplay,
EGLContext eglContext, EGLContext eglContext,
@ -712,7 +700,6 @@ public final class GlUtil {
* <p>This is a no-op if called on already-destroyed {@link EGLDisplay} and {@link EGLContext} * <p>This is a no-op if called on already-destroyed {@link EGLDisplay} and {@link EGLContext}
* instances. * instances.
*/ */
@RequiresApi(17)
public static void destroyEglContext( public static void destroyEglContext(
@Nullable EGLDisplay eglDisplay, @Nullable EGLContext eglContext) throws GlException { @Nullable EGLDisplay eglDisplay, @Nullable EGLContext eglContext) throws GlException {
Api17.destroyEglContext(eglDisplay, eglContext); Api17.destroyEglContext(eglDisplay, eglContext);
@ -722,7 +709,6 @@ public final class GlUtil {
* Destroys the {@link EGLSurface} identified by the provided {@link EGLDisplay} and {@link * Destroys the {@link EGLSurface} identified by the provided {@link EGLDisplay} and {@link
* EGLSurface}. * EGLSurface}.
*/ */
@RequiresApi(17)
public static void destroyEglSurface( public static void destroyEglSurface(
@Nullable EGLDisplay eglDisplay, @Nullable EGLSurface eglSurface) throws GlException { @Nullable EGLDisplay eglDisplay, @Nullable EGLSurface eglSurface) throws GlException {
Api17.destroyEglSurface(eglDisplay, eglSurface); Api17.destroyEglSurface(eglDisplay, eglSurface);
@ -751,7 +737,6 @@ public final class GlUtil {
} }
} }
@RequiresApi(17)
private static final class Api17 { private static final class Api17 {
private Api17() {} private Api17() {}
@ -921,7 +906,6 @@ public final class GlUtil {
} }
} }
@RequiresApi(18)
private static final class Api18 { private static final class Api18 {
private Api18() {} private Api18() {}

View File

@ -15,7 +15,6 @@
*/ */
package androidx.media3.common.util; package androidx.media3.common.util;
import androidx.annotation.RequiresApi;
import androidx.media3.common.MediaLibraryInfo; import androidx.media3.common.MediaLibraryInfo;
/** Calls through to {@link android.os.Trace} methods on supported API levels. */ /** Calls through to {@link android.os.Trace} methods on supported API levels. */
@ -33,7 +32,7 @@ public final class TraceUtil {
*/ */
public static void beginSection(String sectionName) { public static void beginSection(String sectionName) {
if (MediaLibraryInfo.TRACE_ENABLED) { if (MediaLibraryInfo.TRACE_ENABLED) {
beginSectionV18(sectionName); android.os.Trace.beginSection(sectionName);
} }
} }
@ -44,17 +43,7 @@ public final class TraceUtil {
*/ */
public static void endSection() { public static void endSection() {
if (MediaLibraryInfo.TRACE_ENABLED) { if (MediaLibraryInfo.TRACE_ENABLED) {
endSectionV18(); android.os.Trace.endSection();
} }
} }
@RequiresApi(18)
private static void beginSectionV18(String sectionName) {
android.os.Trace.beginSection(sectionName);
}
@RequiresApi(18)
private static void endSectionV18() {
android.os.Trace.endSection();
}
} }

View File

@ -1560,7 +1560,6 @@ public final class Util {
* @throws NoSuchElementException If the array is empty. * @throws NoSuchElementException If the array is empty.
*/ */
@UnstableApi @UnstableApi
@RequiresApi(18)
public static long minValue(SparseLongArray sparseLongArray) { public static long minValue(SparseLongArray sparseLongArray) {
if (sparseLongArray.size() == 0) { if (sparseLongArray.size() == 0) {
throw new NoSuchElementException(); throw new NoSuchElementException();
@ -1580,7 +1579,6 @@ public final class Util {
* @throws NoSuchElementException If the array is empty. * @throws NoSuchElementException If the array is empty.
*/ */
@UnstableApi @UnstableApi
@RequiresApi(18)
public static long maxValue(SparseLongArray sparseLongArray) { public static long maxValue(SparseLongArray sparseLongArray) {
if (sparseLongArray.size() == 0) { if (sparseLongArray.size() == 0) {
throw new NoSuchElementException(); throw new NoSuchElementException();
@ -3698,7 +3696,6 @@ public final class Util {
outSize.y = mode.getPhysicalHeight(); outSize.y = mode.getPhysicalHeight();
} }
@RequiresApi(17)
private static void getDisplaySizeV17(Display display, Point outSize) { private static void getDisplaySizeV17(Display display, Point outSize) {
display.getRealSize(outSize); display.getRealSize(outSize);
} }

View File

@ -1586,7 +1586,6 @@ public interface ExoPlayer extends Player {
* *
* @param videoEffects The {@link List} of {@linkplain Effect video effects} to apply. * @param videoEffects The {@link List} of {@linkplain Effect video effects} to apply.
*/ */
@RequiresApi(18)
@UnstableApi @UnstableApi
void setVideoEffects(List<Effect> videoEffects); void setVideoEffects(List<Effect> videoEffects);

View File

@ -22,7 +22,6 @@ import android.media.AudioTimestamp;
import android.media.AudioTrack; import android.media.AudioTrack;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.C; import androidx.media3.common.C;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
@ -266,7 +265,6 @@ import java.lang.annotation.Target;
} }
} }
@RequiresApi(19)
private static final class AudioTimestampV19 { private static final class AudioTimestampV19 {
private final AudioTrack audioTrack; private final AudioTrack audioTrack;

View File

@ -29,7 +29,6 @@ import android.os.SystemClock;
import android.util.Pair; import android.util.Pair;
import androidx.annotation.GuardedBy; import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.C; import androidx.media3.common.C;
import androidx.media3.common.DrmInitData.SchemeData; import androidx.media3.common.DrmInitData.SchemeData;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
@ -57,7 +56,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.RequiresNonNull; import org.checkerframework.checker.nullness.qual.RequiresNonNull;
/** A {@link DrmSession} that supports playbacks using {@link ExoMediaDrm}. */ /** A {@link DrmSession} that supports playbacks using {@link ExoMediaDrm}. */
@RequiresApi(18)
/* package */ class DefaultDrmSession implements DrmSession { /* package */ class DefaultDrmSession implements DrmSession {
/** Thrown when an unexpected exception or error is thrown during provisioning or key requests. */ /** Thrown when an unexpected exception or error is thrown during provisioning or key requests. */

View File

@ -29,7 +29,6 @@ import android.os.Message;
import android.os.SystemClock; import android.os.SystemClock;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.C; import androidx.media3.common.C;
import androidx.media3.common.DrmInitData; import androidx.media3.common.DrmInitData;
import androidx.media3.common.DrmInitData.SchemeData; import androidx.media3.common.DrmInitData.SchemeData;
@ -68,7 +67,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
* <p>This implementation supports pre-acquisition of sessions using {@link * <p>This implementation supports pre-acquisition of sessions using {@link
* #preacquireSession(DrmSessionEventListener.EventDispatcher, Format)}. * #preacquireSession(DrmSessionEventListener.EventDispatcher, Format)}.
*/ */
@RequiresApi(18)
@UnstableApi @UnstableApi
public class DefaultDrmSessionManager implements DrmSessionManager { public class DefaultDrmSessionManager implements DrmSessionManager {

View File

@ -20,7 +20,6 @@ import static androidx.media3.exoplayer.drm.DefaultDrmSessionManager.MODE_PLAYBA
import androidx.annotation.GuardedBy; import androidx.annotation.GuardedBy;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.MediaItem; import androidx.media3.common.MediaItem;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
@ -88,7 +87,6 @@ public final class DefaultDrmSessionManagerProvider implements DrmSessionManager
} }
} }
@RequiresApi(18)
private DrmSessionManager createManager(MediaItem.DrmConfiguration drmConfiguration) { private DrmSessionManager createManager(MediaItem.DrmConfiguration drmConfiguration) {
DataSource.Factory dataSourceFactory = DataSource.Factory dataSourceFactory =
drmHttpDataSourceFactory != null drmHttpDataSourceFactory != null

View File

@ -106,7 +106,6 @@ public final class DrmUtil {
// Internal classes. // Internal classes.
@RequiresApi(18)
private static final class Api18 { private static final class Api18 {
@DoNotInline @DoNotInline

View File

@ -18,7 +18,6 @@ package androidx.media3.exoplayer.drm;
import android.media.MediaDrmException; import android.media.MediaDrmException;
import android.os.PersistableBundle; import android.os.PersistableBundle;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.C; import androidx.media3.common.C;
import androidx.media3.common.DrmInitData; import androidx.media3.common.DrmInitData;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
@ -29,7 +28,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** An {@link ExoMediaDrm} that does not support any protection schemes. */ /** An {@link ExoMediaDrm} that does not support any protection schemes. */
@RequiresApi(18)
@UnstableApi @UnstableApi
public final class DummyExoMediaDrm implements ExoMediaDrm { public final class DummyExoMediaDrm implements ExoMediaDrm {

View File

@ -52,7 +52,6 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
/** An {@link ExoMediaDrm} implementation that wraps the framework {@link MediaDrm}. */ /** An {@link ExoMediaDrm} implementation that wraps the framework {@link MediaDrm}. */
@RequiresApi(18)
public final class FrameworkMediaDrm implements ExoMediaDrm { public final class FrameworkMediaDrm implements ExoMediaDrm {
private static final String TAG = "FrameworkMediaDrm"; private static final String TAG = "FrameworkMediaDrm";

View File

@ -22,7 +22,6 @@ import android.os.HandlerThread;
import android.os.Looper; import android.os.Looper;
import android.util.Pair; import android.util.Pair;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.DrmInitData; import androidx.media3.common.DrmInitData;
import androidx.media3.common.Format; import androidx.media3.common.Format;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
@ -38,7 +37,6 @@ import java.util.Map;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
/** Helper class to download, renew and release offline licenses. */ /** Helper class to download, renew and release offline licenses. */
@RequiresApi(18)
@UnstableApi @UnstableApi
public final class OfflineLicenseHelper { public final class OfflineLicenseHelper {

View File

@ -250,7 +250,6 @@ public interface MediaCodecAdapter {
* *
* @see MediaCodec#setParameters(Bundle) * @see MediaCodec#setParameters(Bundle)
*/ */
@RequiresApi(19)
void setParameters(Bundle params); void setParameters(Bundle params);
/** /**

View File

@ -17,7 +17,6 @@ package androidx.media3.exoplayer.mediacodec;
import android.media.MediaCodec; import android.media.MediaCodec;
import android.os.Bundle; import android.os.Bundle;
import androidx.annotation.RequiresApi;
import androidx.media3.decoder.CryptoInfo; import androidx.media3.decoder.CryptoInfo;
/** /**
@ -57,7 +56,6 @@ import androidx.media3.decoder.CryptoInfo;
* *
* @see MediaCodec#setParameters(Bundle) * @see MediaCodec#setParameters(Bundle)
*/ */
@RequiresApi(19)
void setParameters(Bundle parameters); void setParameters(Bundle parameters);
/** Flushes the instance. */ /** Flushes the instance. */

View File

@ -698,7 +698,6 @@ public final class MediaCodecInfo {
return isAdaptiveV19(capabilities); return isAdaptiveV19(capabilities);
} }
@RequiresApi(19)
private static boolean isAdaptiveV19(CodecCapabilities capabilities) { private static boolean isAdaptiveV19(CodecCapabilities capabilities) {
return capabilities.isFeatureSupported(CodecCapabilities.FEATURE_AdaptivePlayback); return capabilities.isFeatureSupported(CodecCapabilities.FEATURE_AdaptivePlayback);
} }

View File

@ -192,7 +192,6 @@ public final class SynchronousMediaCodecAdapter implements MediaCodecAdapter {
} }
@Override @Override
@RequiresApi(19)
public void setParameters(Bundle params) { public void setParameters(Bundle params) {
codec.setParameters(params); codec.setParameters(params);
} }

View File

@ -1682,7 +1682,6 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer
&& (!codecInfo.secure || PlaceholderSurface.isSecureSupported(context)); && (!codecInfo.secure || PlaceholderSurface.isSecureSupported(context));
} }
@RequiresApi(17)
private void releasePlaceholderSurface() { private void releasePlaceholderSurface() {
if (displaySurface == placeholderSurface) { if (displaySurface == placeholderSurface) {
displaySurface = null; displaySurface = null;

View File

@ -26,7 +26,6 @@ import android.os.HandlerThread;
import android.os.Message; import android.os.Message;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.EGLSurfaceTexture; import androidx.media3.common.util.EGLSurfaceTexture;
import androidx.media3.common.util.EGLSurfaceTexture.SecureMode; import androidx.media3.common.util.EGLSurfaceTexture.SecureMode;
@ -37,7 +36,6 @@ import androidx.media3.common.util.Util;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull; import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** A placeholder {@link Surface}. */ /** A placeholder {@link Surface}. */
@RequiresApi(17)
@UnstableApi @UnstableApi
public final class PlaceholderSurface extends Surface { public final class PlaceholderSurface extends Surface {

View File

@ -499,7 +499,6 @@ public final class VideoFrameReleaseHelper {
} }
} }
@RequiresApi(17)
private static final class DisplayHelperV17 private static final class DisplayHelperV17
implements DisplayHelper, DisplayManager.DisplayListener { implements DisplayHelper, DisplayManager.DisplayListener {
@ -652,7 +651,6 @@ public final class VideoFrameReleaseHelper {
} }
} }
@RequiresApi(17)
private static final class Api17 { private static final class Api17 {
@DoNotInline @DoNotInline

View File

@ -21,7 +21,6 @@ import android.media.MediaDrm;
import android.media.UnsupportedSchemeException; import android.media.UnsupportedSchemeException;
import android.view.Surface; import android.view.Surface;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import androidx.annotation.RequiresApi;
import androidx.annotation.Size; import androidx.annotation.Size;
import androidx.media3.common.C; import androidx.media3.common.C;
import androidx.media3.common.Format; import androidx.media3.common.Format;
@ -509,7 +508,6 @@ import java.util.List;
* Creates a new {@code MediaDrm} object. The encapsulation ensures that the tests can be executed * Creates a new {@code MediaDrm} object. The encapsulation ensures that the tests can be executed
* for API level < 18. * for API level < 18.
*/ */
@RequiresApi(18)
private static final class MediaDrmBuilder { private static final class MediaDrmBuilder {
public static MediaDrm build() { public static MediaDrm build() {

View File

@ -16,7 +16,6 @@
package androidx.media3.test.utils; package androidx.media3.test.utils;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.util.NullableType; import androidx.media3.common.util.NullableType;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.common.util.Util; import androidx.media3.common.util.Util;
@ -39,7 +38,6 @@ import org.junit.runners.model.Statement;
* <p>Includes special handling for {@link AssertionError} to ensure that test failures are * <p>Includes special handling for {@link AssertionError} to ensure that test failures are
* correctly distinguished from test errors (all other errors/exceptions). * correctly distinguished from test errors (all other errors/exceptions).
*/ */
@RequiresApi(19)
@UnstableApi @UnstableApi
public final class AdditionalFailureInfo implements TestRule { public final class AdditionalFailureInfo implements TestRule {

View File

@ -145,7 +145,6 @@ public class BitmapPixelTestUtil {
* @return A {@link Bitmap}. * @return A {@link Bitmap}.
* @throws IOException If the bitmap can't be read. * @throws IOException If the bitmap can't be read.
*/ */
@RequiresApi(19) // BitmapFactory.Options#inPremultiplied.
public static Bitmap readBitmapUnpremultipliedAlpha(String assetString) throws IOException { public static Bitmap readBitmapUnpremultipliedAlpha(String assetString) throws IOException {
Bitmap bitmap; Bitmap bitmap;
try (InputStream inputStream = getApplicationContext().getAssets().open(assetString)) { try (InputStream inputStream = getApplicationContext().getAssets().open(assetString)) {
@ -161,7 +160,6 @@ public class BitmapPixelTestUtil {
* Returns a bitmap with the same information as the provided alpha/red/green/blue 8-bits per * Returns a bitmap with the same information as the provided alpha/red/green/blue 8-bits per
* component image. * component image.
*/ */
@RequiresApi(19)
public static Bitmap createArgb8888BitmapFromRgba8888Image(Image image) { public static Bitmap createArgb8888BitmapFromRgba8888Image(Image image) {
int width = image.getWidth(); int width = image.getWidth();
int height = image.getHeight(); int height = image.getHeight();
@ -186,7 +184,6 @@ public class BitmapPixelTestUtil {
/** /**
* Returns a grayscale bitmap from the Luma channel in the {@link ImageFormat#YUV_420_888} image. * Returns a grayscale bitmap from the Luma channel in the {@link ImageFormat#YUV_420_888} image.
*/ */
@RequiresApi(19)
public static Bitmap createGrayscaleArgb8888BitmapFromYuv420888Image(Image image) { public static Bitmap createGrayscaleArgb8888BitmapFromYuv420888Image(Image image) {
int width = image.getWidth(); int width = image.getWidth();
int height = image.getHeight(); int height = image.getHeight();
@ -423,7 +420,6 @@ public class BitmapPixelTestUtil {
// createUnpremultipliedArgb8888BitmapFromFocusedGlFramebuffer back to // createUnpremultipliedArgb8888BitmapFromFocusedGlFramebuffer back to
// createArgb8888BitmapFromFocusedGlFramebuffer. Also, apply // createArgb8888BitmapFromFocusedGlFramebuffer. Also, apply
// setPremultiplied(false) to createBitmapFromFocusedGlFrameBuffer. // setPremultiplied(false) to createBitmapFromFocusedGlFrameBuffer.
@RequiresApi(17) // #flipBitmapVertically.
public static Bitmap createArgb8888BitmapFromFocusedGlFramebuffer(int width, int height) public static Bitmap createArgb8888BitmapFromFocusedGlFramebuffer(int width, int height)
throws GlUtil.GlException { throws GlUtil.GlException {
return createBitmapFromFocusedGlFrameBuffer( return createBitmapFromFocusedGlFrameBuffer(
@ -440,7 +436,6 @@ public class BitmapPixelTestUtil {
* @param height The height of the pixel rectangle to read. * @param height The height of the pixel rectangle to read.
* @return A {@link Bitmap} with the framebuffer's values. * @return A {@link Bitmap} with the framebuffer's values.
*/ */
@RequiresApi(19) // Bitmap#setPremultiplied.
public static Bitmap createUnpremultipliedArgb8888BitmapFromFocusedGlFramebuffer( public static Bitmap createUnpremultipliedArgb8888BitmapFromFocusedGlFramebuffer(
int width, int height) throws GlUtil.GlException { int width, int height) throws GlUtil.GlException {
Bitmap bitmap = Bitmap bitmap =
@ -471,7 +466,6 @@ public class BitmapPixelTestUtil {
width, height, /* pixelSize= */ 8, GLES30.GL_HALF_FLOAT, Bitmap.Config.RGBA_F16); width, height, /* pixelSize= */ 8, GLES30.GL_HALF_FLOAT, Bitmap.Config.RGBA_F16);
} }
@RequiresApi(17) // #flipBitmapVertically.
private static Bitmap createBitmapFromFocusedGlFrameBuffer( private static Bitmap createBitmapFromFocusedGlFrameBuffer(
int width, int height, int pixelSize, int glReadPixelsFormat, Bitmap.Config bitmapConfig) int width, int height, int pixelSize, int glReadPixelsFormat, Bitmap.Config bitmapConfig)
throws GlUtil.GlException { throws GlUtil.GlException {
@ -494,14 +488,12 @@ public class BitmapPixelTestUtil {
* @param bitmap A {@link Bitmap}. * @param bitmap A {@link Bitmap}.
* @return The identifier of the newly created texture. * @return The identifier of the newly created texture.
*/ */
@RequiresApi(17) // #flipBitmapVertically.
public static int createGlTextureFromBitmap(Bitmap bitmap) throws GlUtil.GlException { public static int createGlTextureFromBitmap(Bitmap bitmap) throws GlUtil.GlException {
// Put the flipped bitmap in the OpenGL texture as the bitmap's positive y-axis points down // Put the flipped bitmap in the OpenGL texture as the bitmap's positive y-axis points down
// while OpenGL's positive y-axis points up. // while OpenGL's positive y-axis points up.
return GlUtil.createTexture(flipBitmapVertically(bitmap)); return GlUtil.createTexture(flipBitmapVertically(bitmap));
} }
@RequiresApi(17) // Bitmap#isPremultiplied.
public static Bitmap flipBitmapVertically(Bitmap bitmap) { public static Bitmap flipBitmapVertically(Bitmap bitmap) {
boolean wasPremultiplied = bitmap.isPremultiplied(); boolean wasPremultiplied = bitmap.isPremultiplied();
if (!wasPremultiplied) { if (!wasPremultiplied) {

View File

@ -174,7 +174,6 @@ public class CapturingRenderersFactory implements RenderersFactory, Dumper.Dumpa
constructedAdapters = new ArrayList<>(); constructedAdapters = new ArrayList<>();
} }
@RequiresApi(18)
@Override @Override
public MediaCodecAdapter createAdapter(Configuration configuration) throws IOException { public MediaCodecAdapter createAdapter(Configuration configuration) throws IOException {
CapturingMediaCodecAdapter adapter = CapturingMediaCodecAdapter adapter =
@ -343,7 +342,6 @@ public class CapturingRenderersFactory implements RenderersFactory, Dumper.Dumpa
delegate.setOutputSurface(surface); delegate.setOutputSurface(surface);
} }
@RequiresApi(19)
@Override @Override
public void setParameters(Bundle params) { public void setParameters(Bundle params) {
delegate.setParameters(params); delegate.setParameters(params);

View File

@ -31,7 +31,6 @@ import static org.mockito.Mockito.verifyNoMoreInteractions;
import android.net.Uri; import android.net.Uri;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.C; import androidx.media3.common.C;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
@ -68,7 +67,6 @@ import org.mockito.Mockito;
* not required) to also annotate this {@link Ignore @Ignore} so that JUnit correctly reports the * not required) to also annotate this {@link Ignore @Ignore} so that JUnit correctly reports the
* test as skipped/ignored instead of passing. * test as skipped/ignored instead of passing.
*/ */
@RequiresApi(19)
@UnstableApi @UnstableApi
public abstract class DataSourceContractTest { public abstract class DataSourceContractTest {

View File

@ -19,7 +19,6 @@ package androidx.media3.test.utils;
import static androidx.media3.test.utils.WebServerDispatcher.getRequestPath; import static androidx.media3.test.utils.WebServerDispatcher.getRequestPath;
import android.net.Uri; import android.net.Uri;
import androidx.annotation.RequiresApi;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import androidx.media3.datasource.HttpDataSource; import androidx.media3.datasource.HttpDataSource;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -32,7 +31,6 @@ import org.junit.Rule;
import org.junit.rules.ExternalResource; import org.junit.rules.ExternalResource;
/** A JUnit {@link Rule} that creates test resources for {@link HttpDataSource} contract tests. */ /** A JUnit {@link Rule} that creates test resources for {@link HttpDataSource} contract tests. */
@RequiresApi(19)
@UnstableApi @UnstableApi
public class HttpDataSourceTestEnv extends ExternalResource { public class HttpDataSourceTestEnv extends ExternalResource {
private static int seed = 0; private static int seed = 0;

View File

@ -23,7 +23,6 @@ import android.graphics.Bitmap;
import android.os.Build; import android.os.Build;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.GlTextureInfo; import androidx.media3.common.GlTextureInfo;
import androidx.media3.common.VideoFrameProcessingException; import androidx.media3.common.VideoFrameProcessingException;
import androidx.media3.common.util.GlUtil; import androidx.media3.common.util.GlUtil;
@ -93,7 +92,6 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
// createArgb8888BitmapFromFocusedGlFramebuffer, so that TextureBitmapReader always reads bitmaps // createArgb8888BitmapFromFocusedGlFramebuffer, so that TextureBitmapReader always reads bitmaps
// as unpremultiplied alpha. Then, remove this method (as we'll already be using premultiplied // as unpremultiplied alpha. Then, remove this method (as we'll already be using premultiplied
// alpha). // alpha).
@RequiresApi(17) // BitmapPixelTestUtil#createArgb8888BitmapFromFocusedGlFramebuffer.
public void readBitmap(GlTextureInfo outputTexture, long presentationTimeUs) public void readBitmap(GlTextureInfo outputTexture, long presentationTimeUs)
throws VideoFrameProcessingException { throws VideoFrameProcessingException {
try { try {
@ -114,7 +112,6 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
* <p>The read result can be fetched by calling {@link #getBitmapAtPresentationTimeUs} or {@link * <p>The read result can be fetched by calling {@link #getBitmapAtPresentationTimeUs} or {@link
* #getBitmap}. * #getBitmap}.
*/ */
@RequiresApi(19) // BitmapPixelTestUtil#createArgb8888BitmapFromFocusedGlFramebuffer.
public void readBitmapUnpremultipliedAlpha(GlTextureInfo outputTexture, long presentationTimeUs) public void readBitmapUnpremultipliedAlpha(GlTextureInfo outputTexture, long presentationTimeUs)
throws VideoFrameProcessingException { throws VideoFrameProcessingException {
checkState(!useHighPrecisionColorComponents); checkState(!useHighPrecisionColorComponents);
@ -130,7 +127,6 @@ public final class TextureBitmapReader implements VideoFrameProcessorTestRunner.
} }
} }
@RequiresApi(17) // BitmapPixelTestUtil#createArgb8888BitmapFromFocusedGlFramebuffer.
private static Bitmap createBitmapFromCurrentGlFrameBuffer( private static Bitmap createBitmapFromCurrentGlFrameBuffer(
int width, int height, boolean useHighPrecisionColorComponents) throws GlUtil.GlException { int width, int height, boolean useHighPrecisionColorComponents) throws GlUtil.GlException {
if (!useHighPrecisionColorComponents) { if (!useHighPrecisionColorComponents) {

View File

@ -35,7 +35,6 @@ import android.media.MediaFormat;
import android.util.Pair; import android.util.Pair;
import android.view.Surface; import android.view.Surface;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.media3.common.ColorInfo; import androidx.media3.common.ColorInfo;
import androidx.media3.common.DebugViewProvider; import androidx.media3.common.DebugViewProvider;
import androidx.media3.common.Effect; import androidx.media3.common.Effect;
@ -61,7 +60,6 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
/** A test runner for {@link VideoFrameProcessor} tests. */ /** A test runner for {@link VideoFrameProcessor} tests. */
@UnstableApi @UnstableApi
@RequiresApi(19)
public final class VideoFrameProcessorTestRunner { public final class VideoFrameProcessorTestRunner {
/** A builder for {@link VideoFrameProcessorTestRunner} instances. */ /** A builder for {@link VideoFrameProcessorTestRunner} instances. */

View File

@ -114,7 +114,6 @@ public final class CaptionStyleCompat {
* @param captionStyle A {@link CaptionStyle}. * @param captionStyle A {@link CaptionStyle}.
* @return The equivalent {@link CaptionStyleCompat}. * @return The equivalent {@link CaptionStyleCompat}.
*/ */
@RequiresApi(19)
public static CaptionStyleCompat createFromCaptionStyle( public static CaptionStyleCompat createFromCaptionStyle(
CaptioningManager.CaptionStyle captionStyle) { CaptioningManager.CaptionStyle captionStyle) {
if (Util.SDK_INT >= 21) { if (Util.SDK_INT >= 21) {
@ -149,7 +148,6 @@ public final class CaptionStyleCompat {
this.typeface = typeface; this.typeface = typeface;
} }
@RequiresApi(19)
@SuppressWarnings("ResourceType") @SuppressWarnings("ResourceType")
private static CaptionStyleCompat createFromCaptionStyleV19( private static CaptionStyleCompat createFromCaptionStyleV19(
CaptioningManager.CaptionStyle captionStyle) { CaptioningManager.CaptionStyle captionStyle) {