Remove IntRange from Player.getMediaItemAt

No other index-related methods in Player are annotated, it's considered
obvious that these should be >=0.

PiperOrigin-RevId: 405882756
This commit is contained in:
ibaker 2021-10-27 15:10:30 +01:00 committed by Andrew Lewis
parent d39ffa5a34
commit 60a68f8891
2 changed files with 5 additions and 2 deletions

View File

@ -2175,7 +2175,7 @@ public interface Player {
int getMediaItemCount();
/** Returns the {@link MediaItem} at the given index. */
MediaItem getMediaItemAt(@IntRange(from = 0) int index);
MediaItem getMediaItemAt(int index);
/**
* Returns the duration of the current content or ad in milliseconds, or {@link C#TIME_UNSET} if

View File

@ -35,6 +35,7 @@ import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.TextureView;
import androidx.annotation.FloatRange;
import androidx.annotation.IntRange;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.media3.common.AudioAttributes;
@ -676,6 +677,7 @@ public class MediaController implements Player {
}
@Override
@IntRange(from = 0, to = 100)
public int getBufferedPercentage() {
verifyApplicationThread();
return isConnected() ? impl.getBufferedPercentage() : 0;
@ -1627,6 +1629,7 @@ public class MediaController implements Player {
}
@Override
@IntRange(from = 0)
public int getDeviceVolume() {
verifyApplicationThread();
if (!isConnected()) {
@ -1645,7 +1648,7 @@ public class MediaController implements Player {
}
@Override
public void setDeviceVolume(int volume) {
public void setDeviceVolume(@IntRange(from = 0) int volume) {
verifyApplicationThread();
if (!isConnected()) {
Log.w(TAG, "The controller is not connected. Ignoring setDeviceVolume().");