Commit 2522815d by ibaker Committed by Ian Baker

Add TYPE_USE to 'frequently used' IntDefs in a backwards-compatible way

This ensures Kotlin usages of these IntDef annotations in the 'old'
position will continue to compile.

'Frequently used' is a subjective judgement. I have a parallel change
that marks all the other public IntDefs in the library as TYPE_USE
(those that I've judged to be 'rarely used' by apps).

A follow-up change will fix the positions of existing usages to be as if
they're only TYPE_USE.

#minor-release

PiperOrigin-RevId: 426427334
parent 01c814e2
...@@ -18,6 +18,10 @@ package androidx.media3.common; ...@@ -18,6 +18,10 @@ package androidx.media3.common;
import static androidx.media3.common.util.Assertions.checkArgument; import static androidx.media3.common.util.Assertions.checkArgument;
import static androidx.media3.common.util.Assertions.checkState; import static androidx.media3.common.util.Assertions.checkState;
import static java.lang.Math.max; import static java.lang.Math.max;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.ElementType.TYPE_USE;
import android.net.Uri; import android.net.Uri;
...@@ -417,8 +421,11 @@ public final class AdPlaybackState implements Bundleable { ...@@ -417,8 +421,11 @@ public final class AdPlaybackState implements Bundleable {
* #AD_STATE_AVAILABLE}, {@link #AD_STATE_SKIPPED}, {@link #AD_STATE_PLAYED} or {@link * #AD_STATE_AVAILABLE}, {@link #AD_STATE_SKIPPED}, {@link #AD_STATE_PLAYED} or {@link
* #AD_STATE_ERROR}. * #AD_STATE_ERROR}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({ @IntDef({
AD_STATE_UNAVAILABLE, AD_STATE_UNAVAILABLE,
AD_STATE_AVAILABLE, AD_STATE_AVAILABLE,
......
...@@ -303,10 +303,13 @@ public final class C { ...@@ -303,10 +303,13 @@ public final class C {
* #STREAM_TYPE_RING}, {@link #STREAM_TYPE_SYSTEM}, {@link #STREAM_TYPE_VOICE_CALL} or {@link * #STREAM_TYPE_RING}, {@link #STREAM_TYPE_SYSTEM}, {@link #STREAM_TYPE_VOICE_CALL} or {@link
* #STREAM_TYPE_DEFAULT}. * #STREAM_TYPE_DEFAULT}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@SuppressLint("UniqueConstants") // Intentional duplication to set STREAM_TYPE_DEFAULT. @SuppressLint("UniqueConstants") // Intentional duplication to set STREAM_TYPE_DEFAULT.
@UnstableApi @UnstableApi
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({ @IntDef({
STREAM_TYPE_ALARM, STREAM_TYPE_ALARM,
STREAM_TYPE_DTMF, STREAM_TYPE_DTMF,
...@@ -535,10 +538,13 @@ public final class C { ...@@ -535,10 +538,13 @@ public final class C {
* #VIDEO_SCALING_MODE_SCALE_TO_FIT}, {@link #VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING} or * #VIDEO_SCALING_MODE_SCALE_TO_FIT}, {@link #VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING} or
* {@link #VIDEO_SCALING_MODE_DEFAULT}. * {@link #VIDEO_SCALING_MODE_DEFAULT}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@SuppressLint("UniqueConstants") // Intentional duplication to set VIDEO_SCALING_MODE_DEFAULT. @SuppressLint("UniqueConstants") // Intentional duplication to set VIDEO_SCALING_MODE_DEFAULT.
@UnstableApi @UnstableApi
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({ @IntDef({
VIDEO_SCALING_MODE_SCALE_TO_FIT, VIDEO_SCALING_MODE_SCALE_TO_FIT,
VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING, VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING,
...@@ -557,9 +563,12 @@ public final class C { ...@@ -557,9 +563,12 @@ public final class C {
@UnstableApi public static final int VIDEO_SCALING_MODE_DEFAULT = VIDEO_SCALING_MODE_SCALE_TO_FIT; @UnstableApi public static final int VIDEO_SCALING_MODE_DEFAULT = VIDEO_SCALING_MODE_SCALE_TO_FIT;
/** Strategies for calling {@link Surface#setFrameRate}. */ /** Strategies for calling {@link Surface#setFrameRate}. */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@UnstableApi @UnstableApi
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF, VIDEO_CHANGE_FRAME_RATE_STRATEGY_ONLY_IF_SEAMLESS}) @IntDef({VIDEO_CHANGE_FRAME_RATE_STRATEGY_OFF, VIDEO_CHANGE_FRAME_RATE_STRATEGY_ONLY_IF_SEAMLESS})
public @interface VideoChangeFrameRateStrategy {} public @interface VideoChangeFrameRateStrategy {}
/** /**
...@@ -614,9 +623,12 @@ public final class C { ...@@ -614,9 +623,12 @@ public final class C {
* Represents a streaming or other media type. One of {@link #TYPE_DASH}, {@link #TYPE_SS}, {@link * Represents a streaming or other media type. One of {@link #TYPE_DASH}, {@link #TYPE_SS}, {@link
* #TYPE_HLS}, {@link #TYPE_RTSP} or {@link #TYPE_OTHER}. * #TYPE_HLS}, {@link #TYPE_RTSP} or {@link #TYPE_OTHER}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@UnstableApi @UnstableApi
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({TYPE_DASH, TYPE_SS, TYPE_HLS, TYPE_RTSP, TYPE_OTHER}) @IntDef({TYPE_DASH, TYPE_SS, TYPE_HLS, TYPE_RTSP, TYPE_OTHER})
public @interface ContentType {} public @interface ContentType {}
/** Value returned by {@link Util#inferContentType(String)} for DASH manifests. */ /** Value returned by {@link Util#inferContentType(String)} for DASH manifests. */
...@@ -967,9 +979,12 @@ public final class C { ...@@ -967,9 +979,12 @@ public final class C {
* #NETWORK_TYPE_4G}, {@link #NETWORK_TYPE_5G_SA}, {@link #NETWORK_TYPE_5G_NSA}, {@link * #NETWORK_TYPE_4G}, {@link #NETWORK_TYPE_5G_SA}, {@link #NETWORK_TYPE_5G_NSA}, {@link
* #NETWORK_TYPE_CELLULAR_UNKNOWN}, {@link #NETWORK_TYPE_ETHERNET} or {@link #NETWORK_TYPE_OTHER}. * #NETWORK_TYPE_CELLULAR_UNKNOWN}, {@link #NETWORK_TYPE_ETHERNET} or {@link #NETWORK_TYPE_OTHER}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@UnstableApi @UnstableApi
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({ @IntDef({
NETWORK_TYPE_UNKNOWN, NETWORK_TYPE_UNKNOWN,
NETWORK_TYPE_OFFLINE, NETWORK_TYPE_OFFLINE,
...@@ -1130,9 +1145,12 @@ public final class C { ...@@ -1130,9 +1145,12 @@ public final class C {
* #FORMAT_EXCEEDS_CAPABILITIES}, {@link #FORMAT_UNSUPPORTED_DRM}, {@link * #FORMAT_EXCEEDS_CAPABILITIES}, {@link #FORMAT_UNSUPPORTED_DRM}, {@link
* #FORMAT_UNSUPPORTED_SUBTYPE} or {@link #FORMAT_UNSUPPORTED_TYPE}. * #FORMAT_UNSUPPORTED_SUBTYPE} or {@link #FORMAT_UNSUPPORTED_TYPE}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@UnstableApi @UnstableApi
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({ @IntDef({
FORMAT_HANDLED, FORMAT_HANDLED,
FORMAT_EXCEEDS_CAPABILITIES, FORMAT_EXCEEDS_CAPABILITIES,
......
...@@ -15,11 +15,18 @@ ...@@ -15,11 +15,18 @@
*/ */
package androidx.media3.common.util; package androidx.media3.common.util;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.media3.common.Player; import androidx.media3.common.Player;
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;
/** Util class for repeat mode handling. */ /** Util class for repeat mode handling. */
@UnstableApi @UnstableApi
...@@ -30,8 +37,11 @@ public final class RepeatModeUtil { ...@@ -30,8 +37,11 @@ public final class RepeatModeUtil {
* {@link #REPEAT_TOGGLE_MODE_NONE}, {@link #REPEAT_TOGGLE_MODE_ONE} and {@link * {@link #REPEAT_TOGGLE_MODE_NONE}, {@link #REPEAT_TOGGLE_MODE_ONE} and {@link
* #REPEAT_TOGGLE_MODE_ALL}. * #REPEAT_TOGGLE_MODE_ALL}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef( @IntDef(
flag = true, flag = true,
value = {REPEAT_TOGGLE_MODE_NONE, REPEAT_TOGGLE_MODE_ONE, REPEAT_TOGGLE_MODE_ALL}) value = {REPEAT_TOGGLE_MODE_NONE, REPEAT_TOGGLE_MODE_ONE, REPEAT_TOGGLE_MODE_ALL})
......
...@@ -18,6 +18,10 @@ package androidx.media3.datasource.cache; ...@@ -18,6 +18,10 @@ package androidx.media3.datasource.cache;
import static androidx.media3.common.util.Assertions.checkNotNull; import static androidx.media3.common.util.Assertions.checkNotNull;
import static androidx.media3.common.util.Util.castNonNull; import static androidx.media3.common.util.Util.castNonNull;
import static java.lang.Math.min; import static java.lang.Math.min;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.ElementType.TYPE_USE;
import android.net.Uri; import android.net.Uri;
...@@ -364,8 +368,11 @@ public final class CacheDataSource implements DataSource { ...@@ -364,8 +368,11 @@ public final class CacheDataSource implements DataSource {
* Reasons the cache may be ignored. One of {@link #CACHE_IGNORED_REASON_ERROR} or {@link * Reasons the cache may be ignored. One of {@link #CACHE_IGNORED_REASON_ERROR} or {@link
* #CACHE_IGNORED_REASON_UNSET_LENGTH}. * #CACHE_IGNORED_REASON_UNSET_LENGTH}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({CACHE_IGNORED_REASON_ERROR, CACHE_IGNORED_REASON_UNSET_LENGTH}) @IntDef({CACHE_IGNORED_REASON_ERROR, CACHE_IGNORED_REASON_UNSET_LENGTH})
public @interface CacheIgnoredReason {} public @interface CacheIgnoredReason {}
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
*/ */
package androidx.media3.exoplayer; package androidx.media3.exoplayer;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock; import android.os.SystemClock;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -35,6 +41,7 @@ import java.io.IOException; ...@@ -35,6 +41,7 @@ import java.io.IOException;
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;
/** Thrown when a non locally recoverable playback failure occurs. */ /** Thrown when a non locally recoverable playback failure occurs. */
public final class ExoPlaybackException extends PlaybackException { public final class ExoPlaybackException extends PlaybackException {
...@@ -44,9 +51,12 @@ public final class ExoPlaybackException extends PlaybackException { ...@@ -44,9 +51,12 @@ public final class ExoPlaybackException extends PlaybackException {
* {@link #TYPE_UNEXPECTED} or {@link #TYPE_REMOTE}. Note that new types may be added in the * {@link #TYPE_UNEXPECTED} or {@link #TYPE_REMOTE}. Note that new types may be added in the
* future and error handling should handle unknown type values. * future and error handling should handle unknown type values.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@UnstableApi @UnstableApi
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({TYPE_SOURCE, TYPE_RENDERER, TYPE_UNEXPECTED, TYPE_REMOTE}) @IntDef({TYPE_SOURCE, TYPE_RENDERER, TYPE_UNEXPECTED, TYPE_REMOTE})
public @interface Type {} public @interface Type {}
/** /**
......
...@@ -15,12 +15,19 @@ ...@@ -15,12 +15,19 @@
*/ */
package androidx.media3.exoplayer; package androidx.media3.exoplayer;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.media3.common.Player; import androidx.media3.common.Player;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
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;
/** A timeout of an operation on the ExoPlayer playback thread. */ /** A timeout of an operation on the ExoPlayer playback thread. */
@UnstableApi @UnstableApi
...@@ -32,8 +39,11 @@ public final class ExoTimeoutException extends RuntimeException { ...@@ -32,8 +39,11 @@ public final class ExoTimeoutException extends RuntimeException {
* {@link #TIMEOUT_OPERATION_UNDEFINED}. Note that new operations may be added in the future and * {@link #TIMEOUT_OPERATION_UNDEFINED}. Note that new operations may be added in the future and
* error handling should handle unknown operation values. * error handling should handle unknown operation values.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({ @IntDef({
TIMEOUT_OPERATION_UNDEFINED, TIMEOUT_OPERATION_UNDEFINED,
TIMEOUT_OPERATION_RELEASE, TIMEOUT_OPERATION_RELEASE,
......
...@@ -16,6 +16,11 @@ ...@@ -16,6 +16,11 @@
package androidx.media3.exoplayer.analytics; package androidx.media3.exoplayer.analytics;
import static androidx.media3.common.util.Assertions.checkNotNull; import static androidx.media3.common.util.Assertions.checkNotNull;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import android.media.MediaCodec; import android.media.MediaCodec;
import android.media.MediaCodec.CodecException; import android.media.MediaCodec.CodecException;
...@@ -60,6 +65,7 @@ import java.io.IOException; ...@@ -60,6 +65,7 @@ import java.io.IOException;
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;
/** /**
* A listener for analytics events. * A listener for analytics events.
...@@ -155,8 +161,11 @@ public interface AnalyticsListener { ...@@ -155,8 +161,11 @@ public interface AnalyticsListener {
* *
* <p>One of the {@link AnalyticsListener}{@code .EVENT_*} flags. * <p>One of the {@link AnalyticsListener}{@code .EVENT_*} flags.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({ @IntDef({
EVENT_TIMELINE_CHANGED, EVENT_TIMELINE_CHANGED,
EVENT_MEDIA_ITEM_TRANSITION, EVENT_MEDIA_ITEM_TRANSITION,
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
*/ */
package androidx.media3.exoplayer.drm; package androidx.media3.exoplayer.drm;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import android.media.MediaDrm; import android.media.MediaDrm;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
...@@ -25,6 +31,7 @@ import java.io.IOException; ...@@ -25,6 +31,7 @@ import java.io.IOException;
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.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
...@@ -70,8 +77,11 @@ public interface DrmSession { ...@@ -70,8 +77,11 @@ public interface DrmSession {
* The state of the DRM session. One of {@link #STATE_RELEASED}, {@link #STATE_ERROR}, {@link * The state of the DRM session. One of {@link #STATE_RELEASED}, {@link #STATE_ERROR}, {@link
* #STATE_OPENING}, {@link #STATE_OPENED} or {@link #STATE_OPENED_WITH_KEYS}. * #STATE_OPENING}, {@link #STATE_OPENED} or {@link #STATE_OPENED_WITH_KEYS}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({STATE_RELEASED, STATE_ERROR, STATE_OPENING, STATE_OPENED, STATE_OPENED_WITH_KEYS}) @IntDef({STATE_RELEASED, STATE_ERROR, STATE_OPENING, STATE_OPENED, STATE_OPENED_WITH_KEYS})
@interface State {} @interface State {}
/** The session has been released. This is a terminal state. */ /** The session has been released. This is a terminal state. */
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
*/ */
package androidx.media3.exoplayer.drm; package androidx.media3.exoplayer.drm;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import android.media.DeniedByServerException; import android.media.DeniedByServerException;
import android.media.MediaDrm; import android.media.MediaDrm;
import android.media.MediaDrmResetException; import android.media.MediaDrmResetException;
...@@ -29,14 +35,18 @@ import androidx.media3.common.util.Util; ...@@ -29,14 +35,18 @@ import androidx.media3.common.util.Util;
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;
/** DRM-related utility methods. */ /** DRM-related utility methods. */
@UnstableApi @UnstableApi
public final class DrmUtil { public final class DrmUtil {
/** Identifies the operation which caused a DRM-related error. */ /** Identifies the operation which caused a DRM-related error. */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef( @IntDef(
value = { value = {
ERROR_SOURCE_EXO_MEDIA_DRM, ERROR_SOURCE_EXO_MEDIA_DRM,
......
...@@ -15,11 +15,16 @@ ...@@ -15,11 +15,16 @@
*/ */
package androidx.media3.exoplayer.drm; package androidx.media3.exoplayer.drm;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.media3.common.util.UnstableApi; import androidx.media3.common.util.UnstableApi;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Target;
import java.lang.annotation.RetentionPolicy;
/** Thrown when the requested DRM scheme is not supported. */ /** Thrown when the requested DRM scheme is not supported. */
@UnstableApi @UnstableApi
...@@ -29,8 +34,10 @@ public final class UnsupportedDrmException extends Exception { ...@@ -29,8 +34,10 @@ public final class UnsupportedDrmException extends Exception {
* The reason for the exception. One of {@link #REASON_UNSUPPORTED_SCHEME} or {@link * The reason for the exception. One of {@link #REASON_UNSUPPORTED_SCHEME} or {@link
* #REASON_INSTANTIATION_ERROR}. * #REASON_INSTANTIATION_ERROR}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added. @Retention(RetentionPolicy.SOURCE)
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({REASON_UNSUPPORTED_SCHEME, REASON_INSTANTIATION_ERROR}) @IntDef({REASON_UNSUPPORTED_SCHEME, REASON_INSTANTIATION_ERROR})
public @interface Reason {} public @interface Reason {}
/** The requested DRM scheme is unsupported by the device. */ /** The requested DRM scheme is unsupported by the device. */
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
*/ */
package androidx.media3.exoplayer.offline; package androidx.media3.exoplayer.offline;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
import androidx.media3.common.C; import androidx.media3.common.C;
import androidx.media3.common.util.Assertions; import androidx.media3.common.util.Assertions;
...@@ -22,6 +28,7 @@ import androidx.media3.common.util.UnstableApi; ...@@ -22,6 +28,7 @@ import androidx.media3.common.util.UnstableApi;
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;
/** Represents state of a download. */ /** Represents state of a download. */
@UnstableApi @UnstableApi
...@@ -32,8 +39,11 @@ public final class Download { ...@@ -32,8 +39,11 @@ public final class Download {
* #STATE_DOWNLOADING}, {@link #STATE_COMPLETED}, {@link #STATE_FAILED}, {@link #STATE_REMOVING} * #STATE_DOWNLOADING}, {@link #STATE_COMPLETED}, {@link #STATE_FAILED}, {@link #STATE_REMOVING}
* or {@link #STATE_RESTARTING}. * or {@link #STATE_RESTARTING}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({ @IntDef({
STATE_QUEUED, STATE_QUEUED,
STATE_STOPPED, STATE_STOPPED,
...@@ -71,8 +81,11 @@ public final class Download { ...@@ -71,8 +81,11 @@ public final class Download {
public static final int STATE_RESTARTING = 7; public static final int STATE_RESTARTING = 7;
/** Failure reasons. Either {@link #FAILURE_REASON_NONE} or {@link #FAILURE_REASON_UNKNOWN}. */ /** Failure reasons. Either {@link #FAILURE_REASON_NONE} or {@link #FAILURE_REASON_UNKNOWN}. */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({FAILURE_REASON_NONE, FAILURE_REASON_UNKNOWN}) @IntDef({FAILURE_REASON_NONE, FAILURE_REASON_UNKNOWN})
public @interface FailureReason {} public @interface FailureReason {}
/** The download isn't failed. */ /** The download isn't failed. */
......
...@@ -15,6 +15,12 @@ ...@@ -15,6 +15,12 @@
*/ */
package androidx.media3.exoplayer.scheduler; package androidx.media3.exoplayer.scheduler;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
...@@ -34,6 +40,7 @@ import androidx.media3.common.util.Util; ...@@ -34,6 +40,7 @@ import androidx.media3.common.util.Util;
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;
/** Defines a set of device state requirements. */ /** Defines a set of device state requirements. */
@UnstableApi @UnstableApi
...@@ -43,8 +50,11 @@ public final class Requirements implements Parcelable { ...@@ -43,8 +50,11 @@ public final class Requirements implements Parcelable {
* Requirement flags. Possible flag values are {@link #NETWORK}, {@link #NETWORK_UNMETERED}, * Requirement flags. Possible flag values are {@link #NETWORK}, {@link #NETWORK_UNMETERED},
* {@link #DEVICE_IDLE}, {@link #DEVICE_CHARGING} and {@link #DEVICE_STORAGE_NOT_LOW}. * {@link #DEVICE_IDLE}, {@link #DEVICE_CHARGING} and {@link #DEVICE_STORAGE_NOT_LOW}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef( @IntDef(
flag = true, flag = true,
value = {NETWORK, NETWORK_UNMETERED, DEVICE_IDLE, DEVICE_CHARGING, DEVICE_STORAGE_NOT_LOW}) value = {NETWORK, NETWORK_UNMETERED, DEVICE_IDLE, DEVICE_CHARGING, DEVICE_STORAGE_NOT_LOW})
......
...@@ -17,6 +17,11 @@ package androidx.media3.exoplayer.trackselection; ...@@ -17,6 +17,11 @@ package androidx.media3.exoplayer.trackselection;
import static java.lang.Math.max; import static java.lang.Math.max;
import static java.lang.Math.min; import static java.lang.Math.min;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE_USE;
import android.util.Pair; import android.util.Pair;
import androidx.annotation.IntDef; import androidx.annotation.IntDef;
...@@ -43,6 +48,7 @@ import com.google.common.collect.ImmutableList; ...@@ -43,6 +48,7 @@ import com.google.common.collect.ImmutableList;
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.util.Arrays; import java.util.Arrays;
import org.checkerframework.checker.nullness.compatqual.NullableType; import org.checkerframework.checker.nullness.compatqual.NullableType;
...@@ -62,8 +68,11 @@ public abstract class MappingTrackSelector extends TrackSelector { ...@@ -62,8 +68,11 @@ public abstract class MappingTrackSelector extends TrackSelector {
* {@link #RENDERER_SUPPORT_NO_TRACKS}, {@link #RENDERER_SUPPORT_UNSUPPORTED_TRACKS}, {@link * {@link #RENDERER_SUPPORT_NO_TRACKS}, {@link #RENDERER_SUPPORT_UNSUPPORTED_TRACKS}, {@link
* #RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS} or {@link #RENDERER_SUPPORT_PLAYABLE_TRACKS}. * #RENDERER_SUPPORT_EXCEEDS_CAPABILITIES_TRACKS} or {@link #RENDERER_SUPPORT_PLAYABLE_TRACKS}.
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
@IntDef({ @IntDef({
RENDERER_SUPPORT_NO_TRACKS, RENDERER_SUPPORT_NO_TRACKS,
RENDERER_SUPPORT_UNSUPPORTED_TRACKS, RENDERER_SUPPORT_UNSUPPORTED_TRACKS,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment