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:
ibaker 2021-11-01 12:29:21 +00:00 committed by Ian Baker
parent b3c8c2a06c
commit 15e2a13ea3
14 changed files with 32 additions and 40 deletions

View File

@ -126,8 +126,8 @@ public final class Format implements Bundleable {
@Nullable private String id; @Nullable private String id;
@Nullable private String label; @Nullable private String label;
@Nullable private String language; @Nullable private String language;
@C.SelectionFlags private int selectionFlags; private @C.SelectionFlags int selectionFlags;
@C.RoleFlags private int roleFlags; private @C.RoleFlags int roleFlags;
private int averageBitrate; private int averageBitrate;
private int peakBitrate; private int peakBitrate;
@Nullable private String codecs; @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. */ /** The language as an IETF BCP 47 conformant tag, or null if unknown or not applicable. */
@Nullable public final String language; @Nullable public final String language;
/** Track selection flags. */ /** Track selection flags. */
@C.SelectionFlags public final int selectionFlags; public final @C.SelectionFlags int selectionFlags;
/** Track role flags. */ /** 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 * 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 * way in which this field is populated depends on the type of media to which the format

View File

@ -1265,8 +1265,8 @@ public final class MediaItem implements Bundleable {
private Uri uri; private Uri uri;
@Nullable private String mimeType; @Nullable private String mimeType;
@Nullable private String language; @Nullable private String language;
@C.SelectionFlags private int selectionFlags; private @C.SelectionFlags int selectionFlags;
@C.RoleFlags private int roleFlags; private @C.RoleFlags int roleFlags;
@Nullable private String label; @Nullable private String label;
/** /**
@ -1340,9 +1340,9 @@ public final class MediaItem implements Bundleable {
/** The language. */ /** The language. */
@Nullable public final String language; @Nullable public final String language;
/** The selection flags. */ /** The selection flags. */
@C.SelectionFlags public final int selectionFlags; public final @C.SelectionFlags int selectionFlags;
/** The role flags. */ /** The role flags. */
@C.RoleFlags public final int roleFlags; public final @C.RoleFlags int roleFlags;
/** The label. */ /** The label. */
@Nullable public final String label; @Nullable public final String label;

View File

@ -628,7 +628,7 @@ public final class MediaMetadata implements Bundleable {
/** Optional artwork data as a compressed byte array. */ /** Optional artwork data as a compressed byte array. */
@Nullable public final byte[] artworkData; @Nullable public final byte[] artworkData;
/** Optional {@link PictureType} of the artwork data. */ /** Optional {@link PictureType} of the artwork data. */
@Nullable @PictureType public final Integer artworkDataType; @Nullable public final @PictureType Integer artworkDataType;
/** Optional artwork {@link Uri}. */ /** Optional artwork {@link Uri}. */
@Nullable public final Uri artworkUri; @Nullable public final Uri artworkUri;
/** Optional track number. */ /** Optional track number. */
@ -636,7 +636,7 @@ public final class MediaMetadata implements Bundleable {
/** Optional total number of tracks. */ /** Optional total number of tracks. */
@Nullable public final Integer totalTrackCount; @Nullable public final Integer totalTrackCount;
/** Optional {@link FolderType}. */ /** Optional {@link FolderType}. */
@Nullable @FolderType public final Integer folderType; @Nullable public final @FolderType Integer folderType;
/** Optional boolean for media playability. */ /** Optional boolean for media playability. */
@Nullable public final Boolean isPlayable; @Nullable public final Boolean isPlayable;
/** @deprecated Use {@link #recordingYear} instead. */ /** @deprecated Use {@link #recordingYear} instead. */

View File

@ -321,7 +321,7 @@ public class PlaybackException extends Exception implements Bundleable {
} }
/** An error code which identifies the cause of the playback failure. */ /** 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. */ /** The value of {@link SystemClock#elapsedRealtime()} when this exception was created. */
public final long timestampMs; public final long timestampMs;

View File

@ -450,8 +450,7 @@ public interface Player {
* @return The {@link Event} at the given index. * @return The {@link Event} at the given index.
* @throws IndexOutOfBoundsException If index is outside the allowed range. * @throws IndexOutOfBoundsException If index is outside the allowed range.
*/ */
@Event public @Event int get(int index) {
public int get(int index) {
return flags.get(index); return flags.get(index);
} }
@ -871,8 +870,7 @@ public interface Player {
* @return The {@link Command} at the given index. * @return The {@link Command} at the given index.
* @throws IndexOutOfBoundsException If index is outside the allowed range. * @throws IndexOutOfBoundsException If index is outside the allowed range.
*/ */
@Command public @Command int get(int index) {
public int get(int index) {
return flags.get(index); return flags.get(index);
} }

View File

@ -81,13 +81,13 @@ public class TrackSelectionParameters implements Bundleable {
private ImmutableList<String> preferredVideoMimeTypes; private ImmutableList<String> preferredVideoMimeTypes;
// Audio // Audio
private ImmutableList<String> preferredAudioLanguages; private ImmutableList<String> preferredAudioLanguages;
@C.RoleFlags private int preferredAudioRoleFlags; private @C.RoleFlags int preferredAudioRoleFlags;
private int maxAudioChannelCount; private int maxAudioChannelCount;
private int maxAudioBitrate; private int maxAudioBitrate;
private ImmutableList<String> preferredAudioMimeTypes; private ImmutableList<String> preferredAudioMimeTypes;
// Text // Text
private ImmutableList<String> preferredTextLanguages; private ImmutableList<String> preferredTextLanguages;
@C.RoleFlags private int preferredTextRoleFlags; private @C.RoleFlags int preferredTextRoleFlags;
private boolean selectUndeterminedTextLanguage; private boolean selectUndeterminedTextLanguage;
// General // General
private boolean forceLowestBitrate; 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 * 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}. * 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 * Maximum allowed audio channel count. The default value is {@link Integer#MAX_VALUE} (i.e. no
* constraint). * constraint).
@ -816,7 +816,7 @@ public class TrackSelectionParameters implements Bundleable {
* | {@link C#ROLE_FLAG_DESCRIBES_MUSIC_AND_SOUND} if the accessibility {@link CaptioningManager} * | {@link C#ROLE_FLAG_DESCRIBES_MUSIC_AND_SOUND} if the accessibility {@link CaptioningManager}
* is enabled. * 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 * 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 * #preferredTextLanguages} is available, or if {@link #preferredTextLanguages} is unset. The

View File

@ -563,16 +563,16 @@ public final class Cue implements Bundleable {
@Nullable private Alignment multiRowAlignment; @Nullable private Alignment multiRowAlignment;
private float line; private float line;
@LineType private int lineType; @LineType private int lineType;
@AnchorType private int lineAnchor; private @AnchorType int lineAnchor;
private float position; private float position;
@AnchorType private int positionAnchor; private @AnchorType int positionAnchor;
@TextSizeType private int textSizeType; private @TextSizeType int textSizeType;
private float textSize; private float textSize;
private float size; private float size;
private float bitmapHeight; private float bitmapHeight;
private boolean windowColorSet; private boolean windowColorSet;
@ColorInt private int windowColor; @ColorInt private int windowColor;
@VerticalType private int verticalType; private @VerticalType int verticalType;
private float shearDegrees; private float shearDegrees;
public Builder() { public Builder() {

View File

@ -44,7 +44,7 @@ public final class CommandButton implements Bundleable {
public static final class Builder { public static final class Builder {
@Nullable private SessionCommand sessionCommand; @Nullable private SessionCommand sessionCommand;
@Player.Command private int playerCommand; private @Player.Command int playerCommand;
@DrawableRes private int iconResId; @DrawableRes private int iconResId;
private CharSequence displayName; private CharSequence displayName;
private Bundle extras; 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 * The {@link Player.Command} command of the button. Can be {@link Player#COMMAND_INVALID} if the
* button is a placeholder. * 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 * The icon resource id of the button. Can be {@code 0} if the command is predefined and a custom

View File

@ -134,7 +134,7 @@ public final class LibraryResult<V> implements Bundleable {
public static final int RESULT_ERROR_SESSION_SETUP_REQUIRED = -108; public static final int RESULT_ERROR_SESSION_SETUP_REQUIRED = -108;
/** The {@link Code} of this result. */ /** 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 * The completion time of the command in milliseconds. It's the same as {@link

View File

@ -631,8 +631,7 @@ public class MediaController implements Player {
} }
@Override @Override
@PlaybackSuppressionReason public @PlaybackSuppressionReason int getPlaybackSuppressionReason() {
public int getPlaybackSuppressionReason() {
verifyApplicationThread(); verifyApplicationThread();
return isConnected() return isConnected()
? impl.getPlaybackSuppressionReason() ? impl.getPlaybackSuppressionReason()
@ -640,8 +639,7 @@ public class MediaController implements Player {
} }
@Override @Override
@State public @State int getPlaybackState() {
public int getPlaybackState() {
verifyApplicationThread(); verifyApplicationThread();
return isConnected() ? impl.getPlaybackState() : Player.STATE_IDLE; return isConnected() ? impl.getPlaybackState() : Player.STATE_IDLE;
} }
@ -1466,8 +1464,7 @@ public class MediaController implements Player {
} }
@Override @Override
@RepeatMode public @RepeatMode int getRepeatMode() {
public int getRepeatMode() {
verifyApplicationThread(); verifyApplicationThread();
return isConnected() ? impl.getRepeatMode() : Player.REPEAT_MODE_OFF; return isConnected() ? impl.getRepeatMode() : Player.REPEAT_MODE_OFF;
} }

View File

@ -870,8 +870,7 @@ public class MediaSession {
* @see Player.Command#COMMAND_SET_TRACK_SELECTION_PARAMETERS * @see Player.Command#COMMAND_SET_TRACK_SELECTION_PARAMETERS
* @see Player.Command#COMMAND_GET_TRACK_INFOS * @see Player.Command#COMMAND_GET_TRACK_INFOS
*/ */
@SessionResult.Code default @SessionResult.Code int onPlayerCommandRequest(
default int onPlayerCommandRequest(
MediaSession session, ControllerInfo controller, @Player.Command int playerCommand) { MediaSession session, ControllerInfo controller, @Player.Command int playerCommand) {
return RESULT_SUCCESS; return RESULT_SUCCESS;
} }
@ -976,8 +975,7 @@ public class MediaSession {
* @param extras An extra {@link Bundle}. May be empty. * @param extras An extra {@link Bundle}. May be empty.
* @return A result code. * @return A result code.
*/ */
@SessionResult.Code default @SessionResult.Code int onSetMediaUri(
default int onSetMediaUri(
MediaSession session, ControllerInfo controller, Uri uri, Bundle extras) { MediaSession session, ControllerInfo controller, Uri uri, Bundle extras) {
return RESULT_ERROR_NOT_SUPPORTED; return RESULT_ERROR_NOT_SUPPORTED;
} }

View File

@ -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 * The command code of a predefined command. It will be {@link #COMMAND_CODE_CUSTOM} for a custom
* command. * 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. */ /** The action of a custom command. It will be an empty string for a predefined command. */
public final String customAction; public final String customAction;

View File

@ -137,7 +137,7 @@ public final class SessionResult implements Bundleable {
public static final int RESULT_ERROR_SESSION_SETUP_REQUIRED = -108; public static final int RESULT_ERROR_SESSION_SETUP_REQUIRED = -108;
/** The {@link Code} of this result. */ /** The {@link Code} of this result. */
@Code public final int resultCode; public final @Code int resultCode;
/** The extra {@link Bundle} for the result. */ /** The extra {@link Bundle} for the result. */
public final Bundle extras; public final Bundle extras;

View File

@ -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 * Returns the type of this token. One of {@link #TYPE_SESSION}, {@link #TYPE_SESSION_SERVICE}, or
* {@link #TYPE_LIBRARY_SERVICE}. * {@link #TYPE_LIBRARY_SERVICE}.
*/ */
@TokenType public @TokenType int getType() {
public int getType() {
return impl.getType(); return impl.getType();
} }