Commit cc06f275 by Googler Committed by Tianyi Feng

Removing @CallSuper from [add,remove]Listener of ForwardingListener.

PiperOrigin-RevId: 543373503
(cherry picked from commit 03e30b458449e1dc0c30ac39e102539271a6c7d6)
parent a04ebf63
......@@ -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 com.google.android.exoplayer2.audio.AudioAttributes;
import com.google.android.exoplayer2.metadata.Metadata;
......@@ -59,13 +58,14 @@ public class ForwardingPlayer implements Player {
/**
* Calls {@link Player#addListener(Listener)} on the delegate.
*
* <p>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
* <p>Overrides of this method must <strong>not</strong> 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));
}
......@@ -73,12 +73,11 @@ public class ForwardingPlayer implements Player {
/**
* Calls {@link Player#removeListener(Listener)} on the delegate.
*
* <p>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).
* <p>Overrides of this method must <strong>not</strong> 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));
}
......
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