From a78b18298bef5bdd8da1cbe23ac407bc06bad153 Mon Sep 17 00:00:00 2001 From: olly Date: Wed, 21 Apr 2021 12:07:41 +0100 Subject: [PATCH] Remove some long deprecated methods PiperOrigin-RevId: 369626542 --- RELEASENOTES.md | 15 ++++++ .../exoplayer2/decoder/CryptoInfo.java | 6 --- .../exoplayer2/util/NotificationUtil.java | 8 --- .../source/dash/manifest/DashManifest.java | 33 ------------- .../ui/PlayerNotificationManager.java | 49 ++----------------- 5 files changed, 18 insertions(+), 93 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index e5cb1a9e2b..564864fb40 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -87,6 +87,21 @@ module instead. * Remove `DefaultMediaSourceEventListener`. Use `MediaSourceEventListener` instead. + * Remove + `NotificationUtil.createNotificationChannel(Context, String, int, int)`. + Use `createNotificationChannel(Context, String, int, int, int)` + instead. + * Remove `PlayerNotificationManager.NotificationListener` + `onNotificationStarted(int, Notification)` and + `onNotificationCancelled(int)`. Use + `onNotificationPosted(int, Notification, boolean)` and + `onNotificationCancelled(int, boolean)` instead. + * Remove `PlayerNotificationManager.setNotificationListener`. Use + `PlayerNotificationManager.Builder.setNotificationListener` instead. + * Remove `DashManifest` constructor. Use the remaining constructor with + `programInformation` and `serviceDescription` set to `null` instead. + * Remove `CryptoInfo.getFrameworkCryptoInfoV16`. Use + `CryptoInfo.getFrameworkCryptoInfo` instead. * DRM: * Only dispatch DRM session acquire and release events once per period when playing content that uses the same encryption keys for both audio & diff --git a/library/common/src/main/java/com/google/android/exoplayer2/decoder/CryptoInfo.java b/library/common/src/main/java/com/google/android/exoplayer2/decoder/CryptoInfo.java index 7eaab6ae1d..a669587e13 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/decoder/CryptoInfo.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/decoder/CryptoInfo.java @@ -121,12 +121,6 @@ public final class CryptoInfo { return frameworkCryptoInfo; } - /** @deprecated Use {@link #getFrameworkCryptoInfo()}. */ - @Deprecated - public android.media.MediaCodec.CryptoInfo getFrameworkCryptoInfoV16() { - return getFrameworkCryptoInfo(); - } - /** * Increases the number of clear data for the first sub sample by {@code count}. * diff --git a/library/core/src/main/java/com/google/android/exoplayer2/util/NotificationUtil.java b/library/core/src/main/java/com/google/android/exoplayer2/util/NotificationUtil.java index 6c2b337344..9f6274afd6 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/util/NotificationUtil.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/util/NotificationUtil.java @@ -63,14 +63,6 @@ public final class NotificationUtil { /** @see NotificationManager#IMPORTANCE_HIGH */ public static final int IMPORTANCE_HIGH = NotificationManager.IMPORTANCE_HIGH; - /** @deprecated Use {@link #createNotificationChannel(Context, String, int, int, int)}. */ - @Deprecated - public static void createNotificationChannel( - Context context, String id, @StringRes int nameResourceId, @Importance int importance) { - createNotificationChannel( - context, id, nameResourceId, /* descriptionResourceId= */ 0, importance); - } - /** * Creates a notification channel that notifications can be posted to. See {@link * NotificationChannel} and {@link diff --git a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifest.java b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifest.java index 36135e0454..b1b61fde5f 100644 --- a/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifest.java +++ b/library/dash/src/main/java/com/google/android/exoplayer2/source/dash/manifest/DashManifest.java @@ -93,39 +93,6 @@ public class DashManifest implements FilterableManifest { private final List periods; - /** - * @deprecated Use {@link #DashManifest(long, long, long, boolean, long, long, long, long, - * ProgramInformation, UtcTimingElement, ServiceDescriptionElement, Uri, List)}. - */ - @Deprecated - public DashManifest( - long availabilityStartTimeMs, - long durationMs, - long minBufferTimeMs, - boolean dynamic, - long minUpdatePeriodMs, - long timeShiftBufferDepthMs, - long suggestedPresentationDelayMs, - long publishTimeMs, - @Nullable UtcTimingElement utcTiming, - @Nullable Uri location, - List periods) { - this( - availabilityStartTimeMs, - durationMs, - minBufferTimeMs, - dynamic, - minUpdatePeriodMs, - timeShiftBufferDepthMs, - suggestedPresentationDelayMs, - publishTimeMs, - /* programInformation= */ null, - utcTiming, - /* serviceDescription= */ null, - location, - periods); - } - public DashManifest( long availabilityStartTimeMs, long durationMs, diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java index eefd6a7293..3139cd451d 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java @@ -260,25 +260,6 @@ public class PlayerNotificationManager { /** A listener for changes to the notification. */ public interface NotificationListener { - /** - * Called after the notification has been started. - * - * @param notificationId The id with which the notification has been posted. - * @param notification The {@link Notification}. - * @deprecated Use {@link #onNotificationPosted(int, Notification, boolean)} instead. - */ - @Deprecated - default void onNotificationStarted(int notificationId, Notification notification) {} - - /** - * Called after the notification has been cancelled. - * - * @param notificationId The id of the notification which has been cancelled. - * @deprecated Use {@link #onNotificationCancelled(int, boolean)}. - */ - @Deprecated - default void onNotificationCancelled(int notificationId) {} - /** * Called after the notification has been cancelled. * @@ -644,6 +625,7 @@ public class PlayerNotificationManager { private final String channelId; private final int notificationId; private final MediaDescriptionAdapter mediaDescriptionAdapter; + @Nullable private final NotificationListener notificationListener; @Nullable private final CustomActionReceiver customActionReceiver; private final Handler mainHandler; private final NotificationManagerCompat notificationManager; @@ -663,7 +645,6 @@ public class PlayerNotificationManager { private ControlDispatcher controlDispatcher; private boolean isNotificationStarted; private int currentNotificationTag; - @Nullable private NotificationListener notificationListener; @Nullable private MediaSessionCompat.Token mediaSessionToken; private boolean usePreviousAction; private boolean useNextAction; @@ -962,21 +943,6 @@ public class PlayerNotificationManager { } } - /** - * Sets the {@link NotificationListener}. - * - *

Please note that you should call this method before you call {@link #setPlayer(Player)} or - * you may not get the {@link NotificationListener#onNotificationStarted(int, Notification)} - * called on your listener. - * - * @param notificationListener The {@link NotificationListener}. - * @deprecated Pass the notification listener to the constructor instead. - */ - @Deprecated - public final void setNotificationListener(NotificationListener notificationListener) { - this.notificationListener = notificationListener; - } - /** * @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link * DefaultControlDispatcher#DefaultControlDispatcher(long, long)}. @@ -1290,8 +1256,6 @@ 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) { boolean ongoing = getOngoing(player); builder = createNotification(player, builder, ongoing, bitmap); @@ -1303,22 +1267,16 @@ public class PlayerNotificationManager { notificationManager.notify(notificationId, notification); if (!isNotificationStarted) { context.registerReceiver(notificationBroadcastReceiver, intentFilter); - if (notificationListener != null) { - notificationListener.onNotificationStarted(notificationId, notification); - } } - @Nullable NotificationListener listener = notificationListener; - if (listener != null) { + if (notificationListener != null) { // Always pass true for ongoing with the first notification to tell a service to go into // foreground even when paused. - listener.onNotificationPosted( + notificationListener.onNotificationPosted( notificationId, notification, ongoing || !isNotificationStarted); } isNotificationStarted = true; } - // We're calling a deprecated listener method that we still want to notify. - @SuppressWarnings("deprecation") private void stopNotification(boolean dismissedByUser) { if (isNotificationStarted) { isNotificationStarted = false; @@ -1327,7 +1285,6 @@ public class PlayerNotificationManager { context.unregisterReceiver(notificationBroadcastReceiver); if (notificationListener != null) { notificationListener.onNotificationCancelled(notificationId, dismissedByUser); - notificationListener.onNotificationCancelled(notificationId); } } }