Commit 12422372 by olly Committed by Oliver Woodman

Add isBlacklisted method to ExoTrackSelection interface.

Make BaseTrackSelection blacklist and isBlacklisted methods non-final.

PiperOrigin-RevId: 366256521
parent b4aee72a
......@@ -164,7 +164,7 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
}
@Override
public final boolean blacklist(int index, long exclusionDurationMs) {
public boolean blacklist(int index, long exclusionDurationMs) {
long nowMs = SystemClock.elapsedRealtime();
boolean canExclude = isBlacklisted(index, nowMs);
for (int i = 0; i < length && !canExclude; i++) {
......@@ -180,15 +180,8 @@ public abstract class BaseTrackSelection implements ExoTrackSelection {
return true;
}
// Internal methods.
/**
* Returns whether the track at the specified index in the selection is excluded.
*
* @param index The index of the track in the selection.
* @param nowMs The current time in the timebase of {@link SystemClock#elapsedRealtime()}.
*/
protected final boolean isBlacklisted(int index, long nowMs) {
@Override
public boolean isBlacklisted(int index, long nowMs) {
return excludeUntilTimes[index] > nowMs;
}
......
......@@ -271,4 +271,13 @@ public interface ExoTrackSelection extends TrackSelection {
* @return Whether exclusion was successful.
*/
boolean blacklist(int index, long exclusionDurationMs);
/**
* Returns whether the track at the specified index in the selection is excluded.
*
* @param index The index of the track in the selection.
* @param nowMs The current time in the timebase of {@link
* android.os.SystemClock#elapsedRealtime()}.
*/
boolean isBlacklisted(int index, long nowMs);
}
......@@ -150,4 +150,10 @@ public final class FakeTrackSelection implements ExoTrackSelection {
assertThat(isEnabled).isTrue();
return false;
}
@Override
public boolean isBlacklisted(int index, long exclusionDurationMs) {
assertThat(isEnabled).isTrue();
return false;
}
}
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