Commit 60a68f88 by ibaker Committed by Andrew Lewis

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
parent d39ffa5a
...@@ -2175,7 +2175,7 @@ public interface Player { ...@@ -2175,7 +2175,7 @@ public interface Player {
int getMediaItemCount(); int getMediaItemCount();
/** Returns the {@link MediaItem} at the given index. */ /** 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 * Returns the duration of the current content or ad in milliseconds, or {@link C#TIME_UNSET} if
......
...@@ -35,6 +35,7 @@ import android.view.SurfaceHolder; ...@@ -35,6 +35,7 @@ import android.view.SurfaceHolder;
import android.view.SurfaceView; import android.view.SurfaceView;
import android.view.TextureView; import android.view.TextureView;
import androidx.annotation.FloatRange; import androidx.annotation.FloatRange;
import androidx.annotation.IntRange;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
import androidx.media3.common.AudioAttributes; import androidx.media3.common.AudioAttributes;
...@@ -676,6 +677,7 @@ public class MediaController implements Player { ...@@ -676,6 +677,7 @@ public class MediaController implements Player {
} }
@Override @Override
@IntRange(from = 0, to = 100)
public int getBufferedPercentage() { public int getBufferedPercentage() {
verifyApplicationThread(); verifyApplicationThread();
return isConnected() ? impl.getBufferedPercentage() : 0; return isConnected() ? impl.getBufferedPercentage() : 0;
...@@ -1627,6 +1629,7 @@ public class MediaController implements Player { ...@@ -1627,6 +1629,7 @@ public class MediaController implements Player {
} }
@Override @Override
@IntRange(from = 0)
public int getDeviceVolume() { public int getDeviceVolume() {
verifyApplicationThread(); verifyApplicationThread();
if (!isConnected()) { if (!isConnected()) {
...@@ -1645,7 +1648,7 @@ public class MediaController implements Player { ...@@ -1645,7 +1648,7 @@ public class MediaController implements Player {
} }
@Override @Override
public void setDeviceVolume(int volume) { public void setDeviceVolume(@IntRange(from = 0) int volume) {
verifyApplicationThread(); verifyApplicationThread();
if (!isConnected()) { if (!isConnected()) {
Log.w(TAG, "The controller is not connected. Ignoring setDeviceVolume()."); Log.w(TAG, "The controller is not connected. Ignoring setDeviceVolume().");
......
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