diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/Action.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/Action.java index cf5f420c6a..5b5ed5b678 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/Action.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/Action.java @@ -66,6 +66,18 @@ public abstract class Action { this.description = description; } + /** + * Called by {@link #doActionAndScheduleNextImpl(ExoPlayer, DefaultTrackSelector, Surface, + * HandlerWrapper, ActionNode)} to perform the action. + * + * @param player The player to which the action should be applied. + * @param trackSelector The track selector to which the action should be applied. + * @param surface The surface to use when applying actions, or {@code null} if no surface is + * needed. + */ + protected abstract void doActionImpl( + ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface); + /** * Executes the action and schedules the next. * @@ -77,7 +89,7 @@ public abstract class Action { * @param nextAction The next action to schedule immediately after this action finished, or {@code * null} if there's no next action. */ - public final void doActionAndScheduleNext( + /* package */ final void doActionAndScheduleNext( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -101,7 +113,7 @@ public abstract class Action { * @param nextAction The next action to schedule immediately after this action finished, or {@code * null} if there's no next action. */ - protected void doActionAndScheduleNextImpl( + /* package */ void doActionAndScheduleNextImpl( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -113,18 +125,6 @@ public abstract class Action { } } - /** - * Called by {@link #doActionAndScheduleNextImpl(ExoPlayer, DefaultTrackSelector, Surface, - * HandlerWrapper, ActionNode)} to perform the action. - * - * @param player The player to which the action should be applied. - * @param trackSelector The track selector to which the action should be applied. - * @param surface The surface to use when applying actions, or {@code null} if no surface is - * needed. - */ - protected abstract void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface); - /** Calls {@link Player#seekTo(long)} or {@link Player#seekTo(int, long)}. */ public static final class Seek extends Action { @@ -697,7 +697,13 @@ public abstract class Action { } @Override - protected void doActionAndScheduleNextImpl( + protected void doActionImpl( + ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { + // Not triggered. + } + + @Override + /* package */ void doActionAndScheduleNextImpl( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -739,12 +745,6 @@ public abstract class Action { } player.play(); } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** Waits for {@link Player.Listener#onTimelineChanged(Timeline, int)}. */ @@ -785,7 +785,13 @@ public abstract class Action { } @Override - protected void doActionAndScheduleNextImpl( + protected void doActionImpl( + ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { + // Not triggered. + } + + @Override + /* package */ void doActionAndScheduleNextImpl( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -813,12 +819,6 @@ public abstract class Action { nextAction.schedule(player, trackSelector, surface, handler); } } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** @@ -835,7 +835,13 @@ public abstract class Action { } @Override - protected void doActionAndScheduleNextImpl( + protected void doActionImpl( + ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { + // Not triggered. + } + + @Override + /* package */ void doActionAndScheduleNextImpl( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -856,12 +862,6 @@ public abstract class Action { } }); } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** @@ -882,7 +882,13 @@ public abstract class Action { } @Override - protected void doActionAndScheduleNextImpl( + protected void doActionImpl( + ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { + // Not triggered. + } + + @Override + /* package */ void doActionAndScheduleNextImpl( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -907,12 +913,6 @@ public abstract class Action { }); } } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** @@ -933,7 +933,13 @@ public abstract class Action { } @Override - protected void doActionAndScheduleNextImpl( + protected void doActionImpl( + ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { + // Not triggered. + } + + @Override + /* package */ void doActionAndScheduleNextImpl( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -957,12 +963,6 @@ public abstract class Action { }); } } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** @@ -983,7 +983,13 @@ public abstract class Action { } @Override - protected void doActionAndScheduleNextImpl( + protected void doActionImpl( + ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { + // Not triggered. + } + + @Override + /* package */ void doActionAndScheduleNextImpl( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -997,12 +1003,6 @@ public abstract class Action { playerTarget.setCallback(callback); } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** @@ -1023,7 +1023,13 @@ public abstract class Action { } @Override - protected void doActionAndScheduleNextImpl( + protected void doActionImpl( + ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { + // Not triggered. + } + + @Override + /* package */ void doActionAndScheduleNextImpl( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -1047,12 +1053,6 @@ public abstract class Action { }); } } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** Waits until the player acknowledged all pending player commands. */ @@ -1066,7 +1066,13 @@ public abstract class Action { } @Override - protected void doActionAndScheduleNextImpl( + protected void doActionImpl( + ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { + // Not triggered. + } + + @Override + /* package */ void doActionAndScheduleNextImpl( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -1084,12 +1090,6 @@ public abstract class Action { .setLooper(Util.getCurrentOrMainLooper()) .send(); } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** Calls {@code Runnable.run()}. */ diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/ActionSchedule.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/ActionSchedule.java index 66611b6ac1..019b9c4699 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/ActionSchedule.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/ActionSchedule.java @@ -829,7 +829,13 @@ public final class ActionSchedule { } @Override - protected void doActionAndScheduleNextImpl( + protected void doActionImpl( + ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { + // Not triggered. + } + + @Override + /* package */ void doActionAndScheduleNextImpl( ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface, @@ -841,11 +847,5 @@ public final class ActionSchedule { handler.post(callback::onActionScheduleFinished); } } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } } diff --git a/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeClock.java b/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeClock.java index 5080661ca2..bbd558208a 100644 --- a/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeClock.java +++ b/libraries/test_utils/src/main/java/androidx/media3/test/utils/FakeClock.java @@ -286,7 +286,7 @@ public class FakeClock implements Clock { private final int arg2; @Nullable private final Object obj; - public HandlerMessage( + private HandlerMessage( long timeMs, ClockHandler handler, int what,