diff --git a/libraries/common/src/main/java/androidx/media3/common/ForwardingPlayer.java b/libraries/common/src/main/java/androidx/media3/common/ForwardingPlayer.java index 9aeb2777ea..5aba4cef1a 100644 --- a/libraries/common/src/main/java/androidx/media3/common/ForwardingPlayer.java +++ b/libraries/common/src/main/java/androidx/media3/common/ForwardingPlayer.java @@ -20,7 +20,6 @@ import android.view.Surface; import android.view.SurfaceHolder; import android.view.SurfaceView; import android.view.TextureView; -import androidx.annotation.CallSuper; import androidx.annotation.Nullable; import androidx.media3.common.text.Cue; import androidx.media3.common.text.CueGroup; @@ -51,13 +50,14 @@ public class ForwardingPlayer implements Player { /** * Calls {@link Player#addListener(Listener)} on the delegate. * - *
Overrides of this method must delegate to {@code super.addListener} and not {@code - * delegate.addListener}, in order to ensure the correct {@link Player} instance is passed to - * {@link Player.Listener#onEvents(Player, Events)} (i.e. this forwarding instance, and not the + *
Overrides of this method must not directly call {@code + * delegate.addListener}. If the override wants to pass the {@link Player.Listener} instance to + * the delegate {@link Player}, it must do so by calling {@code super.addListener} instead. This + * ensures the correct {@link Player} instance is passed to {@link + * Player.Listener#onEvents(Player, Events)} (i.e. this forwarding instance, and not the * underlying {@code delegate} instance). */ @Override - @CallSuper public void addListener(Listener listener) { player.addListener(new ForwardingListener(this, listener)); } @@ -65,12 +65,11 @@ public class ForwardingPlayer implements Player { /** * Calls {@link Player#removeListener(Listener)} on the delegate. * - *
Overrides of this method must delegate to {@code super.removeListener} and not {@code - * delegate.removeListener}, in order to ensure the listener 'matches' the listener added via - * {@link #addListener} (otherwise the listener registered on the delegate won't be removed). + *
Overrides of this method must not directly call {@code + * delegate.removeListener}. If the override wants to pass the {@link Player.Listener} instance to + * the delegate {@link Player}, it must do so by calling {@code super.removeListener} instead. */ @Override - @CallSuper public void removeListener(Listener listener) { player.removeListener(new ForwardingListener(this, listener)); }