Mark @C.SelectionReason as TYPE_USE (only) and use it in more places
This is not backwards compatible if the @SelectionReason annotation is used in Kotlin code, but before this change there aren't many library surfaces that return a value annotated with @SelectionReason, so it seems relatively unlikely that it is in use in any/many apps. A follow-up change will fix the positions of existing usages to match this new config. #minor-release PiperOrigin-RevId: 426409877
This commit is contained in:
parent
0e856402a2
commit
6fc5f9800e
@ -745,6 +745,7 @@ public final class C {
|
||||
@UnstableApi
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@Target(TYPE_USE)
|
||||
@IntDef(
|
||||
open = true,
|
||||
value = {
|
||||
|
@ -43,7 +43,7 @@ public final class MediaLoadData {
|
||||
* One of the {@link SelectionReason selection reasons} if the data belongs to a track. {@link
|
||||
* C#SELECTION_REASON_UNKNOWN} otherwise.
|
||||
*/
|
||||
public final int trackSelectionReason;
|
||||
public final @C.SelectionReason int trackSelectionReason;
|
||||
/**
|
||||
* Optional data associated with the selection of the track to which the data belongs. Null if the
|
||||
* data does not belong to a track.
|
||||
|
@ -548,7 +548,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSelectionReason() {
|
||||
public @C.SelectionReason int getSelectionReason() {
|
||||
return trackSelection.getSelectionReason();
|
||||
}
|
||||
|
||||
|
@ -316,7 +316,7 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
|
||||
|
||||
private float playbackSpeed;
|
||||
private int selectedIndex;
|
||||
private int reason;
|
||||
private @C.SelectionReason int reason;
|
||||
private long lastBufferEvaluationMs;
|
||||
@Nullable private MediaChunk lastBufferEvaluationMediaChunk;
|
||||
|
||||
@ -449,7 +449,7 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
|
||||
}
|
||||
|
||||
int previousSelectedIndex = selectedIndex;
|
||||
int previousReason = reason;
|
||||
@C.SelectionReason int previousReason = reason;
|
||||
int formatIndexOfPreviousChunk =
|
||||
queue.isEmpty() ? C.INDEX_UNSET : indexOf(Iterables.getLast(queue).trackFormat);
|
||||
if (formatIndexOfPreviousChunk != C.INDEX_UNSET) {
|
||||
@ -487,7 +487,7 @@ public class AdaptiveTrackSelection extends BaseTrackSelection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSelectionReason() {
|
||||
public @C.SelectionReason int getSelectionReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
|
@ -125,6 +125,7 @@ public interface ExoTrackSelection extends TrackSelection {
|
||||
int getSelectedIndex();
|
||||
|
||||
/** Returns the reason for the current track selection. */
|
||||
@C.SelectionReason
|
||||
int getSelectionReason();
|
||||
|
||||
/** Returns optional data associated with the current track selection. */
|
||||
|
@ -28,7 +28,7 @@ import java.util.List;
|
||||
@UnstableApi
|
||||
public final class FixedTrackSelection extends BaseTrackSelection {
|
||||
|
||||
private final int reason;
|
||||
private final @C.SelectionReason int reason;
|
||||
@Nullable private final Object data;
|
||||
|
||||
/**
|
||||
@ -56,7 +56,11 @@ public final class FixedTrackSelection extends BaseTrackSelection {
|
||||
* @param data Optional data associated with the track selection.
|
||||
*/
|
||||
public FixedTrackSelection(
|
||||
TrackGroup group, int track, @Type int type, int reason, @Nullable Object data) {
|
||||
TrackGroup group,
|
||||
int track,
|
||||
@Type int type,
|
||||
@C.SelectionReason int reason,
|
||||
@Nullable Object data) {
|
||||
super(group, /* tracks= */ new int[] {track}, type);
|
||||
this.reason = reason;
|
||||
this.data = data;
|
||||
@ -78,7 +82,7 @@ public final class FixedTrackSelection extends BaseTrackSelection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSelectionReason() {
|
||||
public @C.SelectionReason int getSelectionReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
|
@ -915,7 +915,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSelectionReason() {
|
||||
public @C.SelectionReason int getSelectionReason() {
|
||||
return C.SELECTION_REASON_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public final class FakeTrackSelection implements ExoTrackSelection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSelectionReason() {
|
||||
public @C.SelectionReason int getSelectionReason() {
|
||||
return C.SELECTION_REASON_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ public final class MediaPeriodAsserts {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSelectionReason() {
|
||||
public @C.SelectionReason int getSelectionReason() {
|
||||
return C.SELECTION_REASON_UNKNOWN;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user