Commit f5d8efbf by ibaker Committed by Ian Baker

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
parent d699fb5d
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
### dev-v2 (not yet released) ### dev-v2 (not yet released)
* Core Library:
* 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).
* Video: * Video:
* Fix `IncorrectContextUseViolation` strict mode warning on Android 11 * Fix `IncorrectContextUseViolation` strict mode warning on Android 11
([#8246](https://github.com/google/ExoPlayer/pull/8246)). ([#8246](https://github.com/google/ExoPlayer/pull/8246)).
......
...@@ -963,6 +963,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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 ...@@ -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.
...@@ -1582,6 +1592,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -1582,6 +1592,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();
...@@ -1790,6 +1801,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -1790,6 +1801,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.
...@@ -1797,6 +1809,7 @@ public class SimpleExoPlayer extends BasePlayer ...@@ -1797,6 +1809,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.
......
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