Suppress deprecation warnings in deprecated places

PiperOrigin-RevId: 320970814
This commit is contained in:
ibaker 2020-07-13 17:29:58 +01:00 committed by Oliver Woodman
parent f205539616
commit 23d680a4b4
13 changed files with 21 additions and 1 deletions

View file

@ -243,6 +243,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* @deprecated Use {@link #CronetDataSource(CronetEngine, Executor)} and {@link * @deprecated Use {@link #CronetDataSource(CronetEngine, Executor)} and {@link
* #setContentTypePredicate(Predicate)}. * #setContentTypePredicate(Predicate)}.
*/ */
@SuppressWarnings("deprecation")
@Deprecated @Deprecated
public CronetDataSource( public CronetDataSource(
CronetEngine cronetEngine, CronetEngine cronetEngine,
@ -276,6 +277,7 @@ public class CronetDataSource extends BaseDataSource implements HttpDataSource {
* @deprecated Use {@link #CronetDataSource(CronetEngine, Executor, int, int, boolean, * @deprecated Use {@link #CronetDataSource(CronetEngine, Executor, int, int, boolean,
* RequestProperties)} and {@link #setContentTypePredicate(Predicate)}. * RequestProperties)} and {@link #setContentTypePredicate(Predicate)}.
*/ */
@SuppressWarnings("deprecation")
@Deprecated @Deprecated
public CronetDataSource( public CronetDataSource(
CronetEngine cronetEngine, CronetEngine cronetEngine,

View file

@ -421,6 +421,7 @@ import java.util.List;
listener.onShuffleModeChanged(Utils.getShuffleMode(shuffleModeEnabled)); listener.onShuffleModeChanged(Utils.getShuffleMode(shuffleModeEnabled));
} }
@SuppressWarnings("deprecation")
private void handlePlaybackParametersChanged(PlaybackParameters playbackParameters) { private void handlePlaybackParametersChanged(PlaybackParameters playbackParameters) {
listener.onPlaybackSpeedChanged(playbackParameters.speed); listener.onPlaybackSpeedChanged(playbackParameters.speed);
} }

View file

@ -119,6 +119,7 @@ public class OkHttpDataSource extends BaseDataSource implements HttpDataSource {
* @deprecated Use {@link #OkHttpDataSource(Call.Factory, String)} and {@link * @deprecated Use {@link #OkHttpDataSource(Call.Factory, String)} and {@link
* #setContentTypePredicate(Predicate)}. * #setContentTypePredicate(Predicate)}.
*/ */
@SuppressWarnings("deprecation")
@Deprecated @Deprecated
public OkHttpDataSource( public OkHttpDataSource(
Call.Factory callFactory, Call.Factory callFactory,

View file

@ -564,6 +564,7 @@ public final class C {
// ) // )
/** @deprecated Use {@code Renderer.VideoScalingMode}. */ /** @deprecated Use {@code Renderer.VideoScalingMode}. */
@SuppressWarnings("deprecation")
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@IntDef(value = {VIDEO_SCALING_MODE_SCALE_TO_FIT, VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING}) @IntDef(value = {VIDEO_SCALING_MODE_SCALE_TO_FIT, VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING})

View file

@ -1213,6 +1213,8 @@ public final class Format implements Parcelable {
return new Builder().setId(id).setSampleMimeType(sampleMimeType).build(); return new Builder().setId(id).setSampleMimeType(sampleMimeType).build();
} }
// Some fields are deprecated but they're still assigned below.
@SuppressWarnings("deprecation")
/* package */ Format( /* package */ Format(
@Nullable String id, @Nullable String id,
@Nullable String label, @Nullable String label,
@ -1298,7 +1300,8 @@ public final class Format implements Parcelable {
this.exoMediaCryptoType = exoMediaCryptoType; this.exoMediaCryptoType = exoMediaCryptoType;
} }
@SuppressWarnings("ResourceType") // Some fields are deprecated but they're still assigned below.
@SuppressWarnings({"ResourceType", "deprecation"})
/* package */ Format(Parcel in) { /* package */ Format(Parcel in) {
id = in.readString(); id = in.readString();
label = in.readString(); label = in.readString();

View file

@ -302,6 +302,7 @@ public interface AudioSink {
* @deprecated Use {@link #setPlaybackSpeed(float)} and {@link #setSkipSilenceEnabled(boolean)} * @deprecated Use {@link #setPlaybackSpeed(float)} and {@link #setSkipSilenceEnabled(boolean)}
* instead. * instead.
*/ */
@SuppressWarnings("deprecation")
@Deprecated @Deprecated
void setPlaybackParameters(PlaybackParameters playbackParameters); void setPlaybackParameters(PlaybackParameters playbackParameters);

View file

@ -86,6 +86,7 @@ public final class DefaultAudioSink implements AudioSink {
* @deprecated Use {@link #applyPlaybackSpeed(float)} and {@link * @deprecated Use {@link #applyPlaybackSpeed(float)} and {@link
* #applySkipSilenceEnabled(boolean)} instead. * #applySkipSilenceEnabled(boolean)} instead.
*/ */
@SuppressWarnings("deprecation")
@Deprecated @Deprecated
PlaybackParameters applyPlaybackParameters(PlaybackParameters playbackParameters); PlaybackParameters applyPlaybackParameters(PlaybackParameters playbackParameters);

View file

@ -229,6 +229,7 @@ public final class SingleSampleMediaSource extends BaseMediaSource {
} }
/** @deprecated Use {@link Factory} instead. */ /** @deprecated Use {@link Factory} instead. */
@SuppressWarnings("deprecation")
@Deprecated @Deprecated
public SingleSampleMediaSource( public SingleSampleMediaSource(
Uri uri, Uri uri,

View file

@ -150,6 +150,7 @@ public class DefaultHttpDataSource extends BaseDataSource implements HttpDataSou
* @deprecated Use {@link #DefaultHttpDataSource(String)} and {@link * @deprecated Use {@link #DefaultHttpDataSource(String)} and {@link
* #setContentTypePredicate(Predicate)}. * #setContentTypePredicate(Predicate)}.
*/ */
@SuppressWarnings("deprecation")
@Deprecated @Deprecated
public DefaultHttpDataSource(String userAgent, @Nullable Predicate<String> contentTypePredicate) { public DefaultHttpDataSource(String userAgent, @Nullable Predicate<String> contentTypePredicate) {
this( this(

View file

@ -134,6 +134,7 @@ public final class SimpleCache implements Cache {
* @deprecated Use a constructor that takes a {@link DatabaseProvider} for improved performance. * @deprecated Use a constructor that takes a {@link DatabaseProvider} for improved performance.
*/ */
@Deprecated @Deprecated
@SuppressWarnings("deprecation")
public SimpleCache(File cacheDir, CacheEvictor evictor) { public SimpleCache(File cacheDir, CacheEvictor evictor) {
this(cacheDir, evictor, null, false); this(cacheDir, evictor, null, false);
} }

View file

@ -1603,6 +1603,7 @@ public final class AnalyticsCollectorTest {
assertThat(reportedEvents).isEmpty(); assertThat(reportedEvents).isEmpty();
} }
@SuppressWarnings("deprecation") // Testing deprecated behaviour.
@Override @Override
public void onPlayerStateChanged( public void onPlayerStateChanged(
EventTime eventTime, boolean playWhenReady, @Player.State int playbackState) { EventTime eventTime, boolean playWhenReady, @Player.State int playbackState) {
@ -1626,6 +1627,7 @@ public final class AnalyticsCollectorTest {
reportedEvents.add(new ReportedEvent(EVENT_SEEK_STARTED, eventTime)); reportedEvents.add(new ReportedEvent(EVENT_SEEK_STARTED, eventTime));
} }
@SuppressWarnings("deprecation") // Testing deprecated behaviour.
@Override @Override
public void onSeekProcessed(EventTime eventTime) { public void onSeekProcessed(EventTime eventTime) {
reportedEvents.add(new ReportedEvent(EVENT_SEEK_PROCESSED, eventTime)); reportedEvents.add(new ReportedEvent(EVENT_SEEK_PROCESSED, eventTime));

View file

@ -82,6 +82,7 @@ public class SsMediaSourceTest {
} }
// Tests backwards compatibility // Tests backwards compatibility
@SuppressWarnings("deprecation")
@Test @Test
public void factoryCreateMediaSource_setsDeprecatedMediaSourceTag() { public void factoryCreateMediaSource_setsDeprecatedMediaSourceTag() {
Object tag = new Object(); Object tag = new Object();

View file

@ -971,6 +971,8 @@ public class PlayerNotificationManager {
} }
} }
// We're calling a deprecated listener method that we still want to notify.
@SuppressWarnings("deprecation")
private void startOrUpdateNotification(Player player, @Nullable Bitmap bitmap) { private void startOrUpdateNotification(Player player, @Nullable Bitmap bitmap) {
boolean ongoing = getOngoing(player); boolean ongoing = getOngoing(player);
builder = createNotification(player, builder, ongoing, bitmap); builder = createNotification(player, builder, ongoing, bitmap);
@ -993,6 +995,8 @@ public class PlayerNotificationManager {
} }
} }
// We're calling a deprecated listener method that we still want to notify.
@SuppressWarnings("deprecation")
private void stopNotification(boolean dismissedByUser) { private void stopNotification(boolean dismissedByUser) {
if (isNotificationStarted) { if (isNotificationStarted) {
isNotificationStarted = false; isNotificationStarted = false;