From ca8de0e49b03339b03a6e048e7e7a27df86e5ff5 Mon Sep 17 00:00:00 2001 From: ibaker Date: Thu, 10 Nov 2022 10:00:48 +0000 Subject: [PATCH] Fix Dackka/Metalava errors in test_utils module This involves reducing the visibility of methods/constructors that are already unusable outside the `androidx.media3.test.utils` package. #minor-release PiperOrigin-RevId: 487473005 --- .../android/exoplayer2/testutil/Action.java | 140 +++++++++--------- .../exoplayer2/testutil/ActionSchedule.java | 14 +- .../exoplayer2/testutil/FakeClock.java | 2 +- 3 files changed, 78 insertions(+), 78 deletions(-) diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/Action.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/Action.java index fe81ebf4cbd..e7cf180dde1 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/Action.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/Action.java @@ -64,6 +64,18 @@ public Action(@Size(max = 23) String tag, @Nullable String description) { 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. * @@ -75,7 +87,7 @@ public Action(@Size(max = 23) String tag, @Nullable String description) { * @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, @@ -99,7 +111,7 @@ public final void doActionAndScheduleNext( * @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, @@ -111,18 +123,6 @@ protected void doActionAndScheduleNextImpl( } } - /** - * 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 { @@ -695,7 +695,13 @@ public PlayUntilPosition(@Size(max = 23) String tag, int mediaItemIndex, long po } @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, @@ -737,12 +743,6 @@ protected void doActionAndScheduleNextImpl( } player.play(); } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** Waits for {@link Player.Listener#onTimelineChanged(Timeline, int)}. */ @@ -783,7 +783,13 @@ public WaitForTimelineChanged(String tag) { } @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, @@ -811,12 +817,6 @@ && timelinesAreSame(player.getCurrentTimeline(), expectedTimeline)) { nextAction.schedule(player, trackSelector, surface, handler); } } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** @@ -833,7 +833,13 @@ public WaitForPositionDiscontinuity(String tag) { } @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, @@ -854,12 +860,6 @@ public void onPositionDiscontinuity( } }); } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** @@ -880,7 +880,13 @@ public WaitForPlayWhenReady(@Size(max = 23) String tag, boolean playWhenReady) { } @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, @@ -905,12 +911,6 @@ public void onPlayWhenReadyChanged( }); } } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** @@ -931,7 +931,13 @@ public WaitForPlaybackState(@Size(max = 23) String tag, @Player.State int target } @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, @@ -955,12 +961,6 @@ public void onPlaybackStateChanged(@Player.State int playbackState) { }); } } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** @@ -981,7 +981,13 @@ public WaitForMessage(@Size(max = 23) String tag, PlayerTarget playerTarget) { } @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, @@ -995,12 +1001,6 @@ protected void doActionAndScheduleNextImpl( playerTarget.setCallback(callback); } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** @@ -1021,7 +1021,13 @@ public WaitForIsLoading(@Size(max = 23) String tag, boolean targetIsLoading) { } @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, @@ -1045,12 +1051,6 @@ public void onIsLoadingChanged(boolean isLoading) { }); } } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** Waits until the player acknowledged all pending player commands. */ @@ -1064,7 +1064,13 @@ public WaitForPendingPlayerCommands(String tag) { } @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, @@ -1082,12 +1088,6 @@ protected void doActionAndScheduleNextImpl( .setLooper(Util.getCurrentOrMainLooper()) .send(); } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } /** Calls {@code Runnable.run()}. */ diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/ActionSchedule.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/ActionSchedule.java index 267c1c3bd2a..22422a0c91c 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/ActionSchedule.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/ActionSchedule.java @@ -827,7 +827,13 @@ public void setCallback(@Nullable Callback callback) { } @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, @@ -839,11 +845,5 @@ protected void doActionAndScheduleNextImpl( handler.post(callback::onActionScheduleFinished); } } - - @Override - protected void doActionImpl( - ExoPlayer player, DefaultTrackSelector trackSelector, @Nullable Surface surface) { - // Not triggered. - } } } diff --git a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeClock.java b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeClock.java index 8c2c33388cf..b9ae5096198 100644 --- a/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeClock.java +++ b/testutils/src/main/java/com/google/android/exoplayer2/testutil/FakeClock.java @@ -284,7 +284,7 @@ protected final class HandlerMessage private final int arg2; @Nullable private final Object obj; - public HandlerMessage( + private HandlerMessage( long timeMs, ClockHandler handler, int what,