diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 8704cf7801..cadfa7637e 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -117,6 +117,16 @@ `ControlDispatcher` that implements custom preparation logic in `dispatchPrepare`. Extend `DefaultControlDispatcher` to avoid having to implement the other `ControlDispatcher` methods. + * Remove `setRewindIncrementMs` and `setFastForwardIncrementMs` from UI + components. Use `setControlDispatcher` on the same components, passing + a `DefaultControlDispatcher` built using + `DefaultControlDispatcher(long, long)`. + * Remove `PlayerNotificationManager` constructors and `createWith` + methods. Use `PlayerNotificationManager.Builder` instead. + * Remove `PlayerNotificationManager` `setUseNavigationActions` and + `setUseNavigationActionsInCompactView`. Use `setUseNextAction`, + `setUsePreviousAction`, `setUseNextActionInCompactView` and + `setUsePreviousActionInCompactView` 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/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java b/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java index f806a579be..59b34c25ed 100644 --- a/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java +++ b/extensions/mediasession/src/main/java/com/google/android/exoplayer2/ext/mediasession/MediaSessionConnector.java @@ -551,32 +551,6 @@ public final class MediaSessionConnector { } } - /** - * @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link - * DefaultControlDispatcher#DefaultControlDispatcher(long, long)} instead. - */ - @SuppressWarnings("deprecation") - @Deprecated - public void setRewindIncrementMs(int rewindMs) { - if (controlDispatcher instanceof DefaultControlDispatcher) { - ((DefaultControlDispatcher) controlDispatcher).setRewindIncrementMs(rewindMs); - invalidateMediaSessionPlaybackState(); - } - } - - /** - * @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link - * DefaultControlDispatcher#DefaultControlDispatcher(long, long)} instead. - */ - @SuppressWarnings("deprecation") - @Deprecated - public void setFastForwardIncrementMs(int fastForwardMs) { - if (controlDispatcher instanceof DefaultControlDispatcher) { - ((DefaultControlDispatcher) controlDispatcher).setFastForwardIncrementMs(fastForwardMs); - invalidateMediaSessionPlaybackState(); - } - } - /** * Sets the optional {@link ErrorMessageProvider}. * diff --git a/library/common/src/main/java/com/google/android/exoplayer2/DefaultControlDispatcher.java b/library/common/src/main/java/com/google/android/exoplayer2/DefaultControlDispatcher.java index 03f03d5903..a90305f1a2 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/DefaultControlDispatcher.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/DefaultControlDispatcher.java @@ -29,9 +29,8 @@ public class DefaultControlDispatcher implements ControlDispatcher { private static final int MAX_POSITION_FOR_SEEK_TO_PREVIOUS = 3000; private final Timeline.Window window; - - private long rewindIncrementMs; - private long fastForwardIncrementMs; + private final long rewindIncrementMs; + private final long fastForwardIncrementMs; /** Creates an instance. */ public DefaultControlDispatcher() { @@ -168,24 +167,6 @@ public class DefaultControlDispatcher implements ControlDispatcher { return fastForwardIncrementMs; } - /** - * @deprecated Create a new instance instead and pass the new instance to the UI component. This - * makes sure the UI gets updated and is in sync with the new values. - */ - @Deprecated - public void setRewindIncrementMs(long rewindMs) { - this.rewindIncrementMs = rewindMs; - } - - /** - * @deprecated Create a new instance instead and pass the new instance to the UI component. This - * makes sure the UI gets updated and is in sync with the new values. - */ - @Deprecated - public void setFastForwardIncrementMs(long fastForwardMs) { - this.fastForwardIncrementMs = fastForwardMs; - } - // Internal methods. private static void seekToOffset(Player player, long offsetMs) { diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java index d0420452d9..11d584e466 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java @@ -666,32 +666,6 @@ public class PlayerControlView extends FrameLayout { updateNavigation(); } - /** - * @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link - * DefaultControlDispatcher#DefaultControlDispatcher(long, long)}. - */ - @SuppressWarnings("deprecation") - @Deprecated - public void setRewindIncrementMs(int rewindMs) { - if (controlDispatcher instanceof DefaultControlDispatcher) { - ((DefaultControlDispatcher) controlDispatcher).setRewindIncrementMs(rewindMs); - updateNavigation(); - } - } - - /** - * @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link - * DefaultControlDispatcher#DefaultControlDispatcher(long, long)}. - */ - @SuppressWarnings("deprecation") - @Deprecated - public void setFastForwardIncrementMs(int fastForwardMs) { - if (controlDispatcher instanceof DefaultControlDispatcher) { - ((DefaultControlDispatcher) controlDispatcher).setFastForwardIncrementMs(fastForwardMs); - updateNavigation(); - } - } - /** * Returns the playback controls timeout. The playback controls are automatically hidden after * this duration of time has elapsed without user input. 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 5956073542..2b6e995370 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 @@ -45,7 +45,6 @@ import android.support.v4.media.session.MediaSessionCompat; import androidx.annotation.DrawableRes; import androidx.annotation.IntDef; import androidx.annotation.Nullable; -import androidx.annotation.StringRes; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import androidx.media.app.NotificationCompat.MediaStyle; @@ -660,152 +659,6 @@ public class PlayerNotificationManager { private boolean useChronometer; @Nullable private String groupKey; - /** @deprecated Use the {@link Builder} instead. */ - @SuppressWarnings("deprecation") - @Deprecated - public static PlayerNotificationManager createWithNotificationChannel( - Context context, - String channelId, - @StringRes int channelName, - int notificationId, - MediaDescriptionAdapter mediaDescriptionAdapter) { - return createWithNotificationChannel( - context, - channelId, - channelName, - /* channelDescription= */ 0, - notificationId, - mediaDescriptionAdapter); - } - - /** @deprecated Use the {@link Builder} instead. */ - @Deprecated - public static PlayerNotificationManager createWithNotificationChannel( - Context context, - String channelId, - @StringRes int channelName, - @StringRes int channelDescription, - int notificationId, - MediaDescriptionAdapter mediaDescriptionAdapter) { - NotificationUtil.createNotificationChannel( - context, channelId, channelName, channelDescription, NotificationUtil.IMPORTANCE_LOW); - return new PlayerNotificationManager( - context, channelId, notificationId, mediaDescriptionAdapter); - } - - /** @deprecated Use the {@link Builder} instead. */ - @Deprecated - public static PlayerNotificationManager createWithNotificationChannel( - Context context, - String channelId, - @StringRes int channelName, - int notificationId, - MediaDescriptionAdapter mediaDescriptionAdapter, - @Nullable NotificationListener notificationListener) { - return createWithNotificationChannel( - context, - channelId, - channelName, - /* channelDescription= */ 0, - notificationId, - mediaDescriptionAdapter, - notificationListener); - } - - /** @deprecated Use the {@link Builder} instead. */ - @Deprecated - public static PlayerNotificationManager createWithNotificationChannel( - Context context, - String channelId, - @StringRes int channelName, - @StringRes int channelDescription, - int notificationId, - MediaDescriptionAdapter mediaDescriptionAdapter, - @Nullable NotificationListener notificationListener) { - NotificationUtil.createNotificationChannel( - context, channelId, channelName, channelDescription, NotificationUtil.IMPORTANCE_LOW); - return new PlayerNotificationManager( - context, channelId, notificationId, mediaDescriptionAdapter, notificationListener); - } - - /** @deprecated Use the {@link Builder} instead. */ - @Deprecated - public PlayerNotificationManager( - Context context, - String channelId, - int notificationId, - MediaDescriptionAdapter mediaDescriptionAdapter) { - this( - context, - channelId, - notificationId, - mediaDescriptionAdapter, - /* notificationListener= */ null, - /* customActionReceiver */ null); - } - - /** @deprecated Use the {@link Builder} instead. */ - @Deprecated - public PlayerNotificationManager( - Context context, - String channelId, - int notificationId, - MediaDescriptionAdapter mediaDescriptionAdapter, - @Nullable NotificationListener notificationListener) { - this( - context, - channelId, - notificationId, - mediaDescriptionAdapter, - notificationListener, - /* customActionReceiver= */ null); - } - - /** @deprecated Use the {@link Builder} instead. */ - @SuppressWarnings("deprecation") - @Deprecated - public PlayerNotificationManager( - Context context, - String channelId, - int notificationId, - MediaDescriptionAdapter mediaDescriptionAdapter, - @Nullable CustomActionReceiver customActionReceiver) { - this( - context, - channelId, - notificationId, - mediaDescriptionAdapter, - /* notificationListener= */ null, - customActionReceiver); - } - - /** @deprecated Use the {@link Builder} instead. */ - @Deprecated - public PlayerNotificationManager( - Context context, - String channelId, - int notificationId, - MediaDescriptionAdapter mediaDescriptionAdapter, - @Nullable NotificationListener notificationListener, - @Nullable CustomActionReceiver customActionReceiver) { - this( - context, - channelId, - notificationId, - mediaDescriptionAdapter, - notificationListener, - customActionReceiver, - R.drawable.exo_notification_small_icon, - R.drawable.exo_notification_play, - R.drawable.exo_notification_pause, - R.drawable.exo_notification_stop, - R.drawable.exo_notification_rewind, - R.drawable.exo_notification_fastforward, - R.drawable.exo_notification_previous, - R.drawable.exo_notification_next, - null); - } - private PlayerNotificationManager( Context context, String channelId, @@ -926,32 +779,6 @@ public class PlayerNotificationManager { } } - /** - * @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link - * DefaultControlDispatcher#DefaultControlDispatcher(long, long)}. - */ - @SuppressWarnings("deprecation") - @Deprecated - public final void setFastForwardIncrementMs(long fastForwardMs) { - if (controlDispatcher instanceof DefaultControlDispatcher) { - ((DefaultControlDispatcher) controlDispatcher).setFastForwardIncrementMs(fastForwardMs); - invalidate(); - } - } - - /** - * @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link - * DefaultControlDispatcher#DefaultControlDispatcher(long, long)}. - */ - @SuppressWarnings("deprecation") - @Deprecated - public final void setRewindIncrementMs(long rewindMs) { - if (controlDispatcher instanceof DefaultControlDispatcher) { - ((DefaultControlDispatcher) controlDispatcher).setRewindIncrementMs(rewindMs); - invalidate(); - } - } - /** * Sets whether the next action should be used. * @@ -976,18 +803,6 @@ public class PlayerNotificationManager { } } - /** - * Sets whether the navigation actions should be used. - * - * @param useNavigationActions Whether to use navigation actions. - * @deprecated Use {@link #setUseNextAction(boolean)} and {@link #setUsePreviousAction(boolean)}. - */ - @Deprecated - public final void setUseNavigationActions(boolean useNavigationActions) { - setUseNextAction(useNavigationActions); - setUsePreviousAction(useNavigationActions); - } - /** * If {@link #setUseNextAction useNextAction} is {@code true}, sets whether the next action should * also be used in compact view. Has no effect if {@link #setUseNextAction useNextAction} is @@ -1016,22 +831,6 @@ public class PlayerNotificationManager { } } - /** - * If {@link #setUseNavigationActions useNavigationActions} is {@code true}, sets whether - * navigation actions should also be used in compact view. Has no effect if {@link - * #setUseNavigationActions useNavigationActions} is {@code false}. - * - * @param useNavigationActionsInCompactView Whether to use navigation actions in compact view. - * @deprecated Use {@link #setUseNextActionInCompactView(boolean)} and {@link - * #setUsePreviousActionInCompactView(boolean)} instead. - */ - @Deprecated - public final void setUseNavigationActionsInCompactView( - boolean useNavigationActionsInCompactView) { - setUseNextActionInCompactView(useNavigationActionsInCompactView); - setUsePreviousActionInCompactView(useNavigationActionsInCompactView); - } - /** * Sets whether the play and pause actions should be used. * @@ -1141,8 +940,8 @@ public class PlayerNotificationManager { *

See {@link NotificationCompat.Builder#setPriority(int)}. * *

To set the priority for API levels above 25, you can create your own {@link - * NotificationChannel} with a given importance level and pass the id of the channel to the {@link - * #PlayerNotificationManager(Context, String, int, MediaDescriptionAdapter) constructor}. + * NotificationChannel} with a given importance level and pass the id of the channel to {@link + * Builder#Builder(Context, int, String, MediaDescriptionAdapter)}. * * @param priority The priority which can be one of {@link NotificationCompat#PRIORITY_DEFAULT}, * {@link NotificationCompat#PRIORITY_MAX}, {@link NotificationCompat#PRIORITY_HIGH}, {@link diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java index c95f99d0e3..912eb5735a 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java @@ -47,7 +47,6 @@ import androidx.annotation.RequiresApi; import androidx.core.content.ContextCompat; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.ControlDispatcher; -import com.google.android.exoplayer2.DefaultControlDispatcher; import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player.DiscontinuityReason; @@ -975,28 +974,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider { controller.setShowNextButton(showNextButton); } - /** - * @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link - * DefaultControlDispatcher#DefaultControlDispatcher(long, long)}. - */ - @SuppressWarnings("deprecation") - @Deprecated - public void setRewindIncrementMs(int rewindMs) { - Assertions.checkStateNotNull(controller); - controller.setRewindIncrementMs(rewindMs); - } - - /** - * @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link - * DefaultControlDispatcher#DefaultControlDispatcher(long, long)}. - */ - @SuppressWarnings("deprecation") - @Deprecated - public void setFastForwardIncrementMs(int fastForwardMs) { - Assertions.checkStateNotNull(controller); - controller.setFastForwardIncrementMs(fastForwardMs); - } - /** * Sets which repeat toggle modes are enabled. *