Add @Deprecated to SEP methods that override deprecated methods

Without this annotation it seems that `SimpleExoPlayer` effectively
'un-deprecates' the method, specifically:
* A usage of these methods isn't flagged by Android Studio if the
  declared type is `SimpleExoPlayer` (up-casting to e.g.
  `ExoPlayer.VideoComponent` results in the warning showing up).
* The `SimpleExoPlayer` javadoc doesn't mention this method is
  deprecated:
  https://exoplayer.dev/doc/reference/com/google/android/exoplayer2/SimpleExoPlayer.html#addVideoListener(com.google.android.exoplayer2.video.VideoListener)
* The Metalava API output for `SimpleExoPlayer` doesn't show these
  methods as deprecated.

PiperOrigin-RevId: 382756174
This commit is contained in:
ibaker 2021-07-02 17:31:50 +01:00 committed by kim-vde
parent 6035932fa3
commit 6e43ea97e7
2 changed files with 16 additions and 0 deletions

View File

@ -21,6 +21,9 @@
cause of the failure in order to simplify error handling. cause of the failure in order to simplify error handling.
* Add `@FallbackType` to `LoadErrorHandlingPolicy` to support * Add `@FallbackType` to `LoadErrorHandlingPolicy` to support
customization of the exclusion duration for locations and tracks. customization of the exclusion duration for locations and tracks.
* Explicitly mark several methods on `SimpleExoPlayer` as `@Deprecated`.
These methods are all overrides and are already deprecated on `Player`
and the respective `ExoPlayer` component classes (since 2.14.0).
* Remove deprecated symbols: * Remove deprecated symbols:
* Remove `Player.getPlaybackError`. Use `Player.getPlayerError` instead. * Remove `Player.getPlaybackError`. Use `Player.getPlayerError` instead.
* Remove `Player.getCurrentTag`. Use `Player.getCurrentMediaItem` and * Remove `Player.getCurrentTag`. Use `Player.getCurrentMediaItem` and

View File

@ -963,6 +963,7 @@ public class SimpleExoPlayer extends BasePlayer
player.removeAudioOffloadListener(listener); player.removeAudioOffloadListener(listener);
} }
@Deprecated
@Override @Override
public void addAudioListener(AudioListener listener) { public void addAudioListener(AudioListener listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -970,6 +971,7 @@ public class SimpleExoPlayer extends BasePlayer
audioListeners.add(listener); audioListeners.add(listener);
} }
@Deprecated
@Override @Override
public void removeAudioListener(AudioListener listener) { public void removeAudioListener(AudioListener listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -1175,6 +1177,7 @@ public class SimpleExoPlayer extends BasePlayer
return audioDecoderCounters; return audioDecoderCounters;
} }
@Deprecated
@Override @Override
public void addVideoListener(VideoListener listener) { public void addVideoListener(VideoListener listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -1182,6 +1185,7 @@ public class SimpleExoPlayer extends BasePlayer
videoListeners.add(listener); videoListeners.add(listener);
} }
@Deprecated
@Override @Override
public void removeVideoListener(VideoListener listener) { public void removeVideoListener(VideoListener listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -1236,6 +1240,7 @@ public class SimpleExoPlayer extends BasePlayer
.send(); .send();
} }
@Deprecated
@Override @Override
public void addTextOutput(TextOutput listener) { public void addTextOutput(TextOutput listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -1243,6 +1248,7 @@ public class SimpleExoPlayer extends BasePlayer
textOutputs.add(listener); textOutputs.add(listener);
} }
@Deprecated
@Override @Override
public void removeTextOutput(TextOutput listener) { public void removeTextOutput(TextOutput listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -1255,6 +1261,7 @@ public class SimpleExoPlayer extends BasePlayer
return currentCues; return currentCues;
} }
@Deprecated
@Override @Override
public void addMetadataOutput(MetadataOutput listener) { public void addMetadataOutput(MetadataOutput listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -1262,6 +1269,7 @@ public class SimpleExoPlayer extends BasePlayer
metadataOutputs.add(listener); metadataOutputs.add(listener);
} }
@Deprecated
@Override @Override
public void removeMetadataOutput(MetadataOutput listener) { public void removeMetadataOutput(MetadataOutput listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -1297,6 +1305,7 @@ public class SimpleExoPlayer extends BasePlayer
addListener(eventListener); addListener(eventListener);
} }
@Deprecated
@Override @Override
public void addListener(Player.EventListener listener) { public void addListener(Player.EventListener listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -1316,6 +1325,7 @@ public class SimpleExoPlayer extends BasePlayer
removeListener(eventListener); removeListener(eventListener);
} }
@Deprecated
@Override @Override
public void removeListener(Player.EventListener listener) { public void removeListener(Player.EventListener listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -1606,6 +1616,7 @@ public class SimpleExoPlayer extends BasePlayer
player.setForegroundMode(foregroundMode); player.setForegroundMode(foregroundMode);
} }
@Deprecated
@Override @Override
public void stop(boolean reset) { public void stop(boolean reset) {
verifyApplicationThread(); verifyApplicationThread();
@ -1824,6 +1835,7 @@ public class SimpleExoPlayer extends BasePlayer
} }
} }
@Deprecated
@Override @Override
public void addDeviceListener(DeviceListener listener) { public void addDeviceListener(DeviceListener listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.
@ -1831,6 +1843,7 @@ public class SimpleExoPlayer extends BasePlayer
deviceListeners.add(listener); deviceListeners.add(listener);
} }
@Deprecated
@Override @Override
public void removeDeviceListener(DeviceListener listener) { public void removeDeviceListener(DeviceListener listener) {
// Don't verify application thread. We allow calls to this method from any thread. // Don't verify application thread. We allow calls to this method from any thread.