Re-position IntDefs in media3 stable API
These IntDefs are now annotated with TYPE_USE [1], so they can be moved to directly before the type (int). [1] Since https://github.com/androidx/media/commit/9ba21a75f PiperOrigin-RevId: 406803555
This commit is contained in:
parent
b3c8c2a06c
commit
15e2a13ea3
@ -126,8 +126,8 @@ public final class Format implements Bundleable {
|
||||
@Nullable private String id;
|
||||
@Nullable private String label;
|
||||
@Nullable private String language;
|
||||
@C.SelectionFlags private int selectionFlags;
|
||||
@C.RoleFlags private int roleFlags;
|
||||
private @C.SelectionFlags int selectionFlags;
|
||||
private @C.RoleFlags int roleFlags;
|
||||
private int averageBitrate;
|
||||
private int peakBitrate;
|
||||
@Nullable private String codecs;
|
||||
@ -618,9 +618,9 @@ public final class Format implements Bundleable {
|
||||
/** The language as an IETF BCP 47 conformant tag, or null if unknown or not applicable. */
|
||||
@Nullable public final String language;
|
||||
/** Track selection flags. */
|
||||
@C.SelectionFlags public final int selectionFlags;
|
||||
public final @C.SelectionFlags int selectionFlags;
|
||||
/** Track role flags. */
|
||||
@C.RoleFlags public final int roleFlags;
|
||||
public final @C.RoleFlags int roleFlags;
|
||||
/**
|
||||
* The average bitrate in bits per second, or {@link #NO_VALUE} if unknown or not applicable. The
|
||||
* way in which this field is populated depends on the type of media to which the format
|
||||
|
@ -1265,8 +1265,8 @@ public final class MediaItem implements Bundleable {
|
||||
private Uri uri;
|
||||
@Nullable private String mimeType;
|
||||
@Nullable private String language;
|
||||
@C.SelectionFlags private int selectionFlags;
|
||||
@C.RoleFlags private int roleFlags;
|
||||
private @C.SelectionFlags int selectionFlags;
|
||||
private @C.RoleFlags int roleFlags;
|
||||
@Nullable private String label;
|
||||
|
||||
/**
|
||||
@ -1340,9 +1340,9 @@ public final class MediaItem implements Bundleable {
|
||||
/** The language. */
|
||||
@Nullable public final String language;
|
||||
/** The selection flags. */
|
||||
@C.SelectionFlags public final int selectionFlags;
|
||||
public final @C.SelectionFlags int selectionFlags;
|
||||
/** The role flags. */
|
||||
@C.RoleFlags public final int roleFlags;
|
||||
public final @C.RoleFlags int roleFlags;
|
||||
/** The label. */
|
||||
@Nullable public final String label;
|
||||
|
||||
|
@ -628,7 +628,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
/** Optional artwork data as a compressed byte array. */
|
||||
@Nullable public final byte[] artworkData;
|
||||
/** Optional {@link PictureType} of the artwork data. */
|
||||
@Nullable @PictureType public final Integer artworkDataType;
|
||||
@Nullable public final @PictureType Integer artworkDataType;
|
||||
/** Optional artwork {@link Uri}. */
|
||||
@Nullable public final Uri artworkUri;
|
||||
/** Optional track number. */
|
||||
@ -636,7 +636,7 @@ public final class MediaMetadata implements Bundleable {
|
||||
/** Optional total number of tracks. */
|
||||
@Nullable public final Integer totalTrackCount;
|
||||
/** Optional {@link FolderType}. */
|
||||
@Nullable @FolderType public final Integer folderType;
|
||||
@Nullable public final @FolderType Integer folderType;
|
||||
/** Optional boolean for media playability. */
|
||||
@Nullable public final Boolean isPlayable;
|
||||
/** @deprecated Use {@link #recordingYear} instead. */
|
||||
|
@ -321,7 +321,7 @@ public class PlaybackException extends Exception implements Bundleable {
|
||||
}
|
||||
|
||||
/** An error code which identifies the cause of the playback failure. */
|
||||
@ErrorCode public final int errorCode;
|
||||
public final @ErrorCode int errorCode;
|
||||
|
||||
/** The value of {@link SystemClock#elapsedRealtime()} when this exception was created. */
|
||||
public final long timestampMs;
|
||||
|
@ -450,8 +450,7 @@ public interface Player {
|
||||
* @return The {@link Event} at the given index.
|
||||
* @throws IndexOutOfBoundsException If index is outside the allowed range.
|
||||
*/
|
||||
@Event
|
||||
public int get(int index) {
|
||||
public @Event int get(int index) {
|
||||
return flags.get(index);
|
||||
}
|
||||
|
||||
@ -871,8 +870,7 @@ public interface Player {
|
||||
* @return The {@link Command} at the given index.
|
||||
* @throws IndexOutOfBoundsException If index is outside the allowed range.
|
||||
*/
|
||||
@Command
|
||||
public int get(int index) {
|
||||
public @Command int get(int index) {
|
||||
return flags.get(index);
|
||||
}
|
||||
|
||||
|
@ -81,13 +81,13 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
private ImmutableList<String> preferredVideoMimeTypes;
|
||||
// Audio
|
||||
private ImmutableList<String> preferredAudioLanguages;
|
||||
@C.RoleFlags private int preferredAudioRoleFlags;
|
||||
private @C.RoleFlags int preferredAudioRoleFlags;
|
||||
private int maxAudioChannelCount;
|
||||
private int maxAudioBitrate;
|
||||
private ImmutableList<String> preferredAudioMimeTypes;
|
||||
// Text
|
||||
private ImmutableList<String> preferredTextLanguages;
|
||||
@C.RoleFlags private int preferredTextRoleFlags;
|
||||
private @C.RoleFlags int preferredTextRoleFlags;
|
||||
private boolean selectUndeterminedTextLanguage;
|
||||
// General
|
||||
private boolean forceLowestBitrate;
|
||||
@ -786,7 +786,7 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
* The preferred {@link C.RoleFlags} for audio tracks. {@code 0} selects the default track if
|
||||
* there is one, or the first track if there's no default. The default value is {@code 0}.
|
||||
*/
|
||||
@C.RoleFlags public final int preferredAudioRoleFlags;
|
||||
public final @C.RoleFlags int preferredAudioRoleFlags;
|
||||
/**
|
||||
* Maximum allowed audio channel count. The default value is {@link Integer#MAX_VALUE} (i.e. no
|
||||
* constraint).
|
||||
@ -816,7 +816,7 @@ public class TrackSelectionParameters implements Bundleable {
|
||||
* | {@link C#ROLE_FLAG_DESCRIBES_MUSIC_AND_SOUND} if the accessibility {@link CaptioningManager}
|
||||
* is enabled.
|
||||
*/
|
||||
@C.RoleFlags public final int preferredTextRoleFlags;
|
||||
public final @C.RoleFlags int preferredTextRoleFlags;
|
||||
/**
|
||||
* Whether a text track with undetermined language should be selected if no track with {@link
|
||||
* #preferredTextLanguages} is available, or if {@link #preferredTextLanguages} is unset. The
|
||||
|
@ -563,16 +563,16 @@ public final class Cue implements Bundleable {
|
||||
@Nullable private Alignment multiRowAlignment;
|
||||
private float line;
|
||||
@LineType private int lineType;
|
||||
@AnchorType private int lineAnchor;
|
||||
private @AnchorType int lineAnchor;
|
||||
private float position;
|
||||
@AnchorType private int positionAnchor;
|
||||
@TextSizeType private int textSizeType;
|
||||
private @AnchorType int positionAnchor;
|
||||
private @TextSizeType int textSizeType;
|
||||
private float textSize;
|
||||
private float size;
|
||||
private float bitmapHeight;
|
||||
private boolean windowColorSet;
|
||||
@ColorInt private int windowColor;
|
||||
@VerticalType private int verticalType;
|
||||
private @VerticalType int verticalType;
|
||||
private float shearDegrees;
|
||||
|
||||
public Builder() {
|
||||
|
@ -44,7 +44,7 @@ public final class CommandButton implements Bundleable {
|
||||
public static final class Builder {
|
||||
|
||||
@Nullable private SessionCommand sessionCommand;
|
||||
@Player.Command private int playerCommand;
|
||||
private @Player.Command int playerCommand;
|
||||
@DrawableRes private int iconResId;
|
||||
private CharSequence displayName;
|
||||
private Bundle extras;
|
||||
@ -153,7 +153,7 @@ public final class CommandButton implements Bundleable {
|
||||
* The {@link Player.Command} command of the button. Can be {@link Player#COMMAND_INVALID} if the
|
||||
* button is a placeholder.
|
||||
*/
|
||||
@Player.Command public final int playerCommand;
|
||||
public final @Player.Command int playerCommand;
|
||||
|
||||
/**
|
||||
* The icon resource id of the button. Can be {@code 0} if the command is predefined and a custom
|
||||
|
@ -134,7 +134,7 @@ public final class LibraryResult<V> implements Bundleable {
|
||||
public static final int RESULT_ERROR_SESSION_SETUP_REQUIRED = -108;
|
||||
|
||||
/** The {@link Code} of this result. */
|
||||
@Code public final int resultCode;
|
||||
public final @Code int resultCode;
|
||||
|
||||
/**
|
||||
* The completion time of the command in milliseconds. It's the same as {@link
|
||||
|
@ -631,8 +631,7 @@ public class MediaController implements Player {
|
||||
}
|
||||
|
||||
@Override
|
||||
@PlaybackSuppressionReason
|
||||
public int getPlaybackSuppressionReason() {
|
||||
public @PlaybackSuppressionReason int getPlaybackSuppressionReason() {
|
||||
verifyApplicationThread();
|
||||
return isConnected()
|
||||
? impl.getPlaybackSuppressionReason()
|
||||
@ -640,8 +639,7 @@ public class MediaController implements Player {
|
||||
}
|
||||
|
||||
@Override
|
||||
@State
|
||||
public int getPlaybackState() {
|
||||
public @State int getPlaybackState() {
|
||||
verifyApplicationThread();
|
||||
return isConnected() ? impl.getPlaybackState() : Player.STATE_IDLE;
|
||||
}
|
||||
@ -1466,8 +1464,7 @@ public class MediaController implements Player {
|
||||
}
|
||||
|
||||
@Override
|
||||
@RepeatMode
|
||||
public int getRepeatMode() {
|
||||
public @RepeatMode int getRepeatMode() {
|
||||
verifyApplicationThread();
|
||||
return isConnected() ? impl.getRepeatMode() : Player.REPEAT_MODE_OFF;
|
||||
}
|
||||
|
@ -870,8 +870,7 @@ public class MediaSession {
|
||||
* @see Player.Command#COMMAND_SET_TRACK_SELECTION_PARAMETERS
|
||||
* @see Player.Command#COMMAND_GET_TRACK_INFOS
|
||||
*/
|
||||
@SessionResult.Code
|
||||
default int onPlayerCommandRequest(
|
||||
default @SessionResult.Code int onPlayerCommandRequest(
|
||||
MediaSession session, ControllerInfo controller, @Player.Command int playerCommand) {
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
@ -976,8 +975,7 @@ public class MediaSession {
|
||||
* @param extras An extra {@link Bundle}. May be empty.
|
||||
* @return A result code.
|
||||
*/
|
||||
@SessionResult.Code
|
||||
default int onSetMediaUri(
|
||||
default @SessionResult.Code int onSetMediaUri(
|
||||
MediaSession session, ControllerInfo controller, Uri uri, Bundle extras) {
|
||||
return RESULT_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public final class SessionCommand implements Bundleable {
|
||||
* The command code of a predefined command. It will be {@link #COMMAND_CODE_CUSTOM} for a custom
|
||||
* command.
|
||||
*/
|
||||
@CommandCode public final int commandCode;
|
||||
public final @CommandCode int commandCode;
|
||||
|
||||
/** The action of a custom command. It will be an empty string for a predefined command. */
|
||||
public final String customAction;
|
||||
|
@ -137,7 +137,7 @@ public final class SessionResult implements Bundleable {
|
||||
public static final int RESULT_ERROR_SESSION_SETUP_REQUIRED = -108;
|
||||
|
||||
/** The {@link Code} of this result. */
|
||||
@Code public final int resultCode;
|
||||
public final @Code int resultCode;
|
||||
|
||||
/** The extra {@link Bundle} for the result. */
|
||||
public final Bundle extras;
|
||||
|
@ -223,8 +223,7 @@ public final class SessionToken implements Bundleable {
|
||||
* Returns the type of this token. One of {@link #TYPE_SESSION}, {@link #TYPE_SESSION_SERVICE}, or
|
||||
* {@link #TYPE_LIBRARY_SERVICE}.
|
||||
*/
|
||||
@TokenType
|
||||
public int getType() {
|
||||
public @TokenType int getType() {
|
||||
return impl.getType();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user