Commit cd16da03 by tonihei Committed by Rohit Singh

Rename misleading COMMAND_GET/SET_MEDIA_ITEMS_METADATA

The setter command is only used for setPlaylistMetadata and can
be named COMMAND_SET_PLAYLIST_METADATA. The getter commnad is
used to access getMediaMetadata and getPlaylistMetadata and can
be better named COMMAND_GET_METADATA to reflect this usage.

PiperOrigin-RevId: 523673286
parent 74ae1af7
...@@ -102,8 +102,8 @@ public final class CastPlayer extends BasePlayer { ...@@ -102,8 +102,8 @@ public final class CastPlayer extends BasePlayer {
COMMAND_SET_SPEED_AND_PITCH, COMMAND_SET_SPEED_AND_PITCH,
COMMAND_GET_CURRENT_MEDIA_ITEM, COMMAND_GET_CURRENT_MEDIA_ITEM,
COMMAND_GET_TIMELINE, COMMAND_GET_TIMELINE,
COMMAND_GET_MEDIA_ITEMS_METADATA, COMMAND_GET_METADATA,
COMMAND_SET_MEDIA_ITEMS_METADATA, COMMAND_SET_PLAYLIST_METADATA,
COMMAND_SET_MEDIA_ITEM, COMMAND_SET_MEDIA_ITEM,
COMMAND_CHANGE_MEDIA_ITEMS, COMMAND_CHANGE_MEDIA_ITEMS,
COMMAND_GET_TRACKS, COMMAND_GET_TRACKS,
......
...@@ -20,7 +20,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_CHANGE_MEDIA_ITEMS; ...@@ -20,7 +20,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_CHANGE_MEDIA_ITEMS;
import static com.google.android.exoplayer2.Player.COMMAND_GET_AUDIO_ATTRIBUTES; import static com.google.android.exoplayer2.Player.COMMAND_GET_AUDIO_ATTRIBUTES;
import static com.google.android.exoplayer2.Player.COMMAND_GET_CURRENT_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_GET_CURRENT_MEDIA_ITEM;
import static com.google.android.exoplayer2.Player.COMMAND_GET_DEVICE_VOLUME; import static com.google.android.exoplayer2.Player.COMMAND_GET_DEVICE_VOLUME;
import static com.google.android.exoplayer2.Player.COMMAND_GET_MEDIA_ITEMS_METADATA; import static com.google.android.exoplayer2.Player.COMMAND_GET_METADATA;
import static com.google.android.exoplayer2.Player.COMMAND_GET_TEXT; import static com.google.android.exoplayer2.Player.COMMAND_GET_TEXT;
import static com.google.android.exoplayer2.Player.COMMAND_GET_TIMELINE; import static com.google.android.exoplayer2.Player.COMMAND_GET_TIMELINE;
import static com.google.android.exoplayer2.Player.COMMAND_GET_VOLUME; import static com.google.android.exoplayer2.Player.COMMAND_GET_VOLUME;
...@@ -37,7 +37,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_PREVIOUS; ...@@ -37,7 +37,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_PREVIOUS;
import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM;
import static com.google.android.exoplayer2.Player.COMMAND_SET_DEVICE_VOLUME; import static com.google.android.exoplayer2.Player.COMMAND_SET_DEVICE_VOLUME;
import static com.google.android.exoplayer2.Player.COMMAND_SET_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_SET_MEDIA_ITEM;
import static com.google.android.exoplayer2.Player.COMMAND_SET_MEDIA_ITEMS_METADATA; import static com.google.android.exoplayer2.Player.COMMAND_SET_PLAYLIST_METADATA;
import static com.google.android.exoplayer2.Player.COMMAND_SET_REPEAT_MODE; import static com.google.android.exoplayer2.Player.COMMAND_SET_REPEAT_MODE;
import static com.google.android.exoplayer2.Player.COMMAND_SET_SHUFFLE_MODE; import static com.google.android.exoplayer2.Player.COMMAND_SET_SHUFFLE_MODE;
import static com.google.android.exoplayer2.Player.COMMAND_SET_SPEED_AND_PITCH; import static com.google.android.exoplayer2.Player.COMMAND_SET_SPEED_AND_PITCH;
...@@ -1360,8 +1360,8 @@ public class CastPlayerTest { ...@@ -1360,8 +1360,8 @@ public class CastPlayerTest {
assertThat(castPlayer.isCommandAvailable(COMMAND_SET_REPEAT_MODE)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_SET_REPEAT_MODE)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_GET_CURRENT_MEDIA_ITEM)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_GET_CURRENT_MEDIA_ITEM)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_GET_TIMELINE)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_GET_TIMELINE)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_GET_MEDIA_ITEMS_METADATA)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_GET_METADATA)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_SET_MEDIA_ITEMS_METADATA)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_SET_PLAYLIST_METADATA)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_CHANGE_MEDIA_ITEMS)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_CHANGE_MEDIA_ITEMS)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_SET_MEDIA_ITEM)).isTrue(); assertThat(castPlayer.isCommandAvailable(COMMAND_SET_MEDIA_ITEM)).isTrue();
assertThat(castPlayer.isCommandAvailable(COMMAND_GET_AUDIO_ATTRIBUTES)).isFalse(); assertThat(castPlayer.isCommandAvailable(COMMAND_GET_AUDIO_ATTRIBUTES)).isFalse();
......
...@@ -369,8 +369,8 @@ public interface Player { ...@@ -369,8 +369,8 @@ public interface Player {
COMMAND_SET_REPEAT_MODE, COMMAND_SET_REPEAT_MODE,
COMMAND_GET_CURRENT_MEDIA_ITEM, COMMAND_GET_CURRENT_MEDIA_ITEM,
COMMAND_GET_TIMELINE, COMMAND_GET_TIMELINE,
COMMAND_GET_MEDIA_ITEMS_METADATA, COMMAND_GET_METADATA,
COMMAND_SET_MEDIA_ITEMS_METADATA, COMMAND_SET_PLAYLIST_METADATA,
COMMAND_SET_MEDIA_ITEM, COMMAND_SET_MEDIA_ITEM,
COMMAND_CHANGE_MEDIA_ITEMS, COMMAND_CHANGE_MEDIA_ITEMS,
COMMAND_GET_AUDIO_ATTRIBUTES, COMMAND_GET_AUDIO_ATTRIBUTES,
...@@ -1417,8 +1417,8 @@ public interface Player { ...@@ -1417,8 +1417,8 @@ public interface Player {
* <li>{@link #COMMAND_SET_REPEAT_MODE} * <li>{@link #COMMAND_SET_REPEAT_MODE}
* <li>{@link #COMMAND_GET_CURRENT_MEDIA_ITEM} * <li>{@link #COMMAND_GET_CURRENT_MEDIA_ITEM}
* <li>{@link #COMMAND_GET_TIMELINE} * <li>{@link #COMMAND_GET_TIMELINE}
* <li>{@link #COMMAND_GET_MEDIA_ITEMS_METADATA} * <li>{@link #COMMAND_GET_METADATA}
* <li>{@link #COMMAND_SET_MEDIA_ITEMS_METADATA} * <li>{@link #COMMAND_SET_PLAYLIST_METADATA}
* <li>{@link #COMMAND_SET_MEDIA_ITEM} * <li>{@link #COMMAND_SET_MEDIA_ITEM}
* <li>{@link #COMMAND_CHANGE_MEDIA_ITEMS} * <li>{@link #COMMAND_CHANGE_MEDIA_ITEMS}
* <li>{@link #COMMAND_GET_AUDIO_ATTRIBUTES} * <li>{@link #COMMAND_GET_AUDIO_ATTRIBUTES}
...@@ -1436,6 +1436,7 @@ public interface Player { ...@@ -1436,6 +1436,7 @@ public interface Player {
*/ */
// @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility
// with Kotlin usages from before TYPE_USE was added. // with Kotlin usages from before TYPE_USE was added.
@SuppressWarnings("deprecation") // Listing deprecated constants.
@Documented @Documented
@Retention(RetentionPolicy.SOURCE) @Retention(RetentionPolicy.SOURCE)
@Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE})
...@@ -1459,7 +1460,9 @@ public interface Player { ...@@ -1459,7 +1460,9 @@ public interface Player {
COMMAND_GET_CURRENT_MEDIA_ITEM, COMMAND_GET_CURRENT_MEDIA_ITEM,
COMMAND_GET_TIMELINE, COMMAND_GET_TIMELINE,
COMMAND_GET_MEDIA_ITEMS_METADATA, COMMAND_GET_MEDIA_ITEMS_METADATA,
COMMAND_GET_METADATA,
COMMAND_SET_MEDIA_ITEMS_METADATA, COMMAND_SET_MEDIA_ITEMS_METADATA,
COMMAND_SET_PLAYLIST_METADATA,
COMMAND_SET_MEDIA_ITEM, COMMAND_SET_MEDIA_ITEM,
COMMAND_CHANGE_MEDIA_ITEMS, COMMAND_CHANGE_MEDIA_ITEMS,
COMMAND_GET_AUDIO_ATTRIBUTES, COMMAND_GET_AUDIO_ATTRIBUTES,
...@@ -1671,6 +1674,11 @@ public interface Player { ...@@ -1671,6 +1674,11 @@ public interface Player {
int COMMAND_GET_TIMELINE = 17; int COMMAND_GET_TIMELINE = 17;
/** /**
* @deprecated Use {@link #COMMAND_GET_METADATA} instead.
*/
@Deprecated int COMMAND_GET_MEDIA_ITEMS_METADATA = 18;
/**
* Command to get metadata related to the playlist and current {@link MediaItem}. * Command to get metadata related to the playlist and current {@link MediaItem}.
* *
* <p>The following methods must only be called if this command is {@linkplain * <p>The following methods must only be called if this command is {@linkplain
...@@ -1681,8 +1689,12 @@ public interface Player { ...@@ -1681,8 +1689,12 @@ public interface Player {
* <li>{@link #getPlaylistMetadata()} * <li>{@link #getPlaylistMetadata()}
* </ul> * </ul>
*/ */
// TODO(b/263132691): Rename this to COMMAND_GET_METADATA int COMMAND_GET_METADATA = 18;
int COMMAND_GET_MEDIA_ITEMS_METADATA = 18;
/**
* @deprecated Use {@link #COMMAND_SET_PLAYLIST_METADATA} instead.
*/
@Deprecated int COMMAND_SET_MEDIA_ITEMS_METADATA = 19;
/** /**
* Command to set the playlist metadata. * Command to set the playlist metadata.
...@@ -1690,8 +1702,7 @@ public interface Player { ...@@ -1690,8 +1702,7 @@ public interface Player {
* <p>The {@link #setPlaylistMetadata(MediaMetadata)} method must only be called if this command * <p>The {@link #setPlaylistMetadata(MediaMetadata)} method must only be called if this command
* is {@linkplain #isCommandAvailable(int) available}. * is {@linkplain #isCommandAvailable(int) available}.
*/ */
// TODO(b/263132691): Rename this to COMMAND_SET_PLAYLIST_METADATA int COMMAND_SET_PLAYLIST_METADATA = 19;
int COMMAND_SET_MEDIA_ITEMS_METADATA = 19;
/** /**
* Command to set a {@link MediaItem}. * Command to set a {@link MediaItem}.
...@@ -2562,7 +2573,7 @@ public interface Player { ...@@ -2562,7 +2573,7 @@ public interface Player {
* Listener#onMetadata(Metadata)}. If a field is populated in the {@link MediaItem#mediaMetadata}, * Listener#onMetadata(Metadata)}. If a field is populated in the {@link MediaItem#mediaMetadata},
* it will be prioritised above the same field coming from static or timed metadata. * it will be prioritised above the same field coming from static or timed metadata.
* *
* <p>This method must only be called if {@link #COMMAND_GET_MEDIA_ITEMS_METADATA} is {@linkplain * <p>This method must only be called if {@link #COMMAND_GET_METADATA} is {@linkplain
* #getAvailableCommands() available}. * #getAvailableCommands() available}.
*/ */
MediaMetadata getMediaMetadata(); MediaMetadata getMediaMetadata();
...@@ -2571,7 +2582,7 @@ public interface Player { ...@@ -2571,7 +2582,7 @@ public interface Player {
* Returns the playlist {@link MediaMetadata}, as set by {@link * Returns the playlist {@link MediaMetadata}, as set by {@link
* #setPlaylistMetadata(MediaMetadata)}, or {@link MediaMetadata#EMPTY} if not supported. * #setPlaylistMetadata(MediaMetadata)}, or {@link MediaMetadata#EMPTY} if not supported.
* *
* <p>This method must only be called if {@link #COMMAND_GET_MEDIA_ITEMS_METADATA} is {@linkplain * <p>This method must only be called if {@link #COMMAND_GET_METADATA} is {@linkplain
* #getAvailableCommands() available}. * #getAvailableCommands() available}.
*/ */
MediaMetadata getPlaylistMetadata(); MediaMetadata getPlaylistMetadata();
...@@ -2579,7 +2590,7 @@ public interface Player { ...@@ -2579,7 +2590,7 @@ public interface Player {
/** /**
* Sets the playlist {@link MediaMetadata}. * Sets the playlist {@link MediaMetadata}.
* *
* <p>This method must only be called if {@link #COMMAND_SET_MEDIA_ITEMS_METADATA} is {@linkplain * <p>This method must only be called if {@link #COMMAND_SET_PLAYLIST_METADATA} is {@linkplain
* #getAvailableCommands() available}. * #getAvailableCommands() available}.
*/ */
void setPlaylistMetadata(MediaMetadata mediaMetadata); void setPlaylistMetadata(MediaMetadata mediaMetadata);
......
...@@ -2396,7 +2396,7 @@ public abstract class SimpleBasePlayer extends BasePlayer { ...@@ -2396,7 +2396,7 @@ public abstract class SimpleBasePlayer extends BasePlayer {
verifyApplicationThreadAndInitState(); verifyApplicationThreadAndInitState();
// Use a local copy to ensure the lambda below uses the current state value. // Use a local copy to ensure the lambda below uses the current state value.
State state = this.state; State state = this.state;
if (!shouldHandleCommand(Player.COMMAND_SET_MEDIA_ITEMS_METADATA)) { if (!shouldHandleCommand(Player.COMMAND_SET_PLAYLIST_METADATA)) {
return; return;
} }
updateStateForPendingOperation( updateStateForPendingOperation(
...@@ -2903,7 +2903,7 @@ public abstract class SimpleBasePlayer extends BasePlayer { ...@@ -2903,7 +2903,7 @@ public abstract class SimpleBasePlayer extends BasePlayer {
/** /**
* Handles calls to {@link Player#setPlaylistMetadata}. * Handles calls to {@link Player#setPlaylistMetadata}.
* *
* <p>Will only be called if {@link Player#COMMAND_SET_MEDIA_ITEMS_METADATA} is available. * <p>Will only be called if {@link Player#COMMAND_SET_PLAYLIST_METADATA} is available.
* *
* @param playlistMetadata The requested {@linkplain MediaMetadata playlist metadata}. * @param playlistMetadata The requested {@linkplain MediaMetadata playlist metadata}.
* @return A {@link ListenableFuture} indicating the completion of all immediate {@link State} * @return A {@link ListenableFuture} indicating the completion of all immediate {@link State}
...@@ -2912,7 +2912,7 @@ public abstract class SimpleBasePlayer extends BasePlayer { ...@@ -2912,7 +2912,7 @@ public abstract class SimpleBasePlayer extends BasePlayer {
@ForOverride @ForOverride
protected ListenableFuture<?> handleSetPlaylistMetadata(MediaMetadata playlistMetadata) { protected ListenableFuture<?> handleSetPlaylistMetadata(MediaMetadata playlistMetadata) {
throw new IllegalStateException( throw new IllegalStateException(
"Missing implementation to handle COMMAND_SET_MEDIA_ITEMS_METADATA"); "Missing implementation to handle COMMAND_SET_PLAYLIST_METADATA");
} }
/** /**
......
...@@ -3067,7 +3067,7 @@ public class SimpleBasePlayerTest { ...@@ -3067,7 +3067,7 @@ public class SimpleBasePlayerTest {
.setAvailableCommands( .setAvailableCommands(
new Commands.Builder() new Commands.Builder()
.addAllCommands() .addAllCommands()
.remove(Player.COMMAND_SET_MEDIA_ITEMS_METADATA) .remove(Player.COMMAND_SET_PLAYLIST_METADATA)
.build()) .build())
.build(); .build();
AtomicBoolean callForwarded = new AtomicBoolean(); AtomicBoolean callForwarded = new AtomicBoolean();
......
...@@ -288,8 +288,8 @@ import java.util.concurrent.TimeoutException; ...@@ -288,8 +288,8 @@ import java.util.concurrent.TimeoutException;
COMMAND_SET_REPEAT_MODE, COMMAND_SET_REPEAT_MODE,
COMMAND_GET_CURRENT_MEDIA_ITEM, COMMAND_GET_CURRENT_MEDIA_ITEM,
COMMAND_GET_TIMELINE, COMMAND_GET_TIMELINE,
COMMAND_GET_MEDIA_ITEMS_METADATA, COMMAND_GET_METADATA,
COMMAND_SET_MEDIA_ITEMS_METADATA, COMMAND_SET_PLAYLIST_METADATA,
COMMAND_SET_MEDIA_ITEM, COMMAND_SET_MEDIA_ITEM,
COMMAND_CHANGE_MEDIA_ITEMS, COMMAND_CHANGE_MEDIA_ITEMS,
COMMAND_GET_TRACKS, COMMAND_GET_TRACKS,
......
...@@ -20,7 +20,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_CHANGE_MEDIA_ITEMS; ...@@ -20,7 +20,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_CHANGE_MEDIA_ITEMS;
import static com.google.android.exoplayer2.Player.COMMAND_GET_AUDIO_ATTRIBUTES; import static com.google.android.exoplayer2.Player.COMMAND_GET_AUDIO_ATTRIBUTES;
import static com.google.android.exoplayer2.Player.COMMAND_GET_CURRENT_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_GET_CURRENT_MEDIA_ITEM;
import static com.google.android.exoplayer2.Player.COMMAND_GET_DEVICE_VOLUME; import static com.google.android.exoplayer2.Player.COMMAND_GET_DEVICE_VOLUME;
import static com.google.android.exoplayer2.Player.COMMAND_GET_MEDIA_ITEMS_METADATA; import static com.google.android.exoplayer2.Player.COMMAND_GET_METADATA;
import static com.google.android.exoplayer2.Player.COMMAND_GET_TEXT; import static com.google.android.exoplayer2.Player.COMMAND_GET_TEXT;
import static com.google.android.exoplayer2.Player.COMMAND_GET_TIMELINE; import static com.google.android.exoplayer2.Player.COMMAND_GET_TIMELINE;
import static com.google.android.exoplayer2.Player.COMMAND_GET_TRACKS; import static com.google.android.exoplayer2.Player.COMMAND_GET_TRACKS;
...@@ -39,7 +39,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_PREVIOUS; ...@@ -39,7 +39,7 @@ import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_PREVIOUS;
import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_SEEK_TO_PREVIOUS_MEDIA_ITEM;
import static com.google.android.exoplayer2.Player.COMMAND_SET_DEVICE_VOLUME; import static com.google.android.exoplayer2.Player.COMMAND_SET_DEVICE_VOLUME;
import static com.google.android.exoplayer2.Player.COMMAND_SET_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_SET_MEDIA_ITEM;
import static com.google.android.exoplayer2.Player.COMMAND_SET_MEDIA_ITEMS_METADATA; import static com.google.android.exoplayer2.Player.COMMAND_SET_PLAYLIST_METADATA;
import static com.google.android.exoplayer2.Player.COMMAND_SET_REPEAT_MODE; import static com.google.android.exoplayer2.Player.COMMAND_SET_REPEAT_MODE;
import static com.google.android.exoplayer2.Player.COMMAND_SET_SHUFFLE_MODE; import static com.google.android.exoplayer2.Player.COMMAND_SET_SHUFFLE_MODE;
import static com.google.android.exoplayer2.Player.COMMAND_SET_SPEED_AND_PITCH; import static com.google.android.exoplayer2.Player.COMMAND_SET_SPEED_AND_PITCH;
...@@ -9091,8 +9091,8 @@ public final class ExoPlayerTest { ...@@ -9091,8 +9091,8 @@ public final class ExoPlayerTest {
assertThat(player.isCommandAvailable(COMMAND_SET_REPEAT_MODE)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_SET_REPEAT_MODE)).isTrue();
assertThat(player.isCommandAvailable(COMMAND_GET_CURRENT_MEDIA_ITEM)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_GET_CURRENT_MEDIA_ITEM)).isTrue();
assertThat(player.isCommandAvailable(COMMAND_GET_TIMELINE)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_GET_TIMELINE)).isTrue();
assertThat(player.isCommandAvailable(COMMAND_GET_MEDIA_ITEMS_METADATA)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_GET_METADATA)).isTrue();
assertThat(player.isCommandAvailable(COMMAND_SET_MEDIA_ITEMS_METADATA)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_SET_PLAYLIST_METADATA)).isTrue();
assertThat(player.isCommandAvailable(COMMAND_CHANGE_MEDIA_ITEMS)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_CHANGE_MEDIA_ITEMS)).isTrue();
assertThat(player.isCommandAvailable(COMMAND_SET_MEDIA_ITEM)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_SET_MEDIA_ITEM)).isTrue();
assertThat(player.isCommandAvailable(COMMAND_GET_AUDIO_ATTRIBUTES)).isTrue(); assertThat(player.isCommandAvailable(COMMAND_GET_AUDIO_ATTRIBUTES)).isTrue();
...@@ -12407,8 +12407,8 @@ public final class ExoPlayerTest { ...@@ -12407,8 +12407,8 @@ public final class ExoPlayerTest {
COMMAND_SET_REPEAT_MODE, COMMAND_SET_REPEAT_MODE,
COMMAND_GET_CURRENT_MEDIA_ITEM, COMMAND_GET_CURRENT_MEDIA_ITEM,
COMMAND_GET_TIMELINE, COMMAND_GET_TIMELINE,
COMMAND_GET_MEDIA_ITEMS_METADATA, COMMAND_GET_METADATA,
COMMAND_SET_MEDIA_ITEMS_METADATA, COMMAND_SET_PLAYLIST_METADATA,
COMMAND_CHANGE_MEDIA_ITEMS, COMMAND_CHANGE_MEDIA_ITEMS,
COMMAND_SET_MEDIA_ITEM, COMMAND_SET_MEDIA_ITEM,
COMMAND_GET_AUDIO_ATTRIBUTES, COMMAND_GET_AUDIO_ATTRIBUTES,
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
*/ */
package com.google.android.exoplayer2.ui; package com.google.android.exoplayer2.ui;
import static com.google.android.exoplayer2.Player.COMMAND_GET_MEDIA_ITEMS_METADATA; import static com.google.android.exoplayer2.Player.COMMAND_GET_METADATA;
import android.app.PendingIntent; import android.app.PendingIntent;
import android.graphics.Bitmap; import android.graphics.Bitmap;
...@@ -48,7 +48,7 @@ public final class DefaultMediaDescriptionAdapter implements MediaDescriptionAda ...@@ -48,7 +48,7 @@ public final class DefaultMediaDescriptionAdapter implements MediaDescriptionAda
@Override @Override
public CharSequence getCurrentContentTitle(Player player) { public CharSequence getCurrentContentTitle(Player player) {
if (!player.isCommandAvailable(COMMAND_GET_MEDIA_ITEMS_METADATA)) { if (!player.isCommandAvailable(COMMAND_GET_METADATA)) {
return ""; return "";
} }
@Nullable CharSequence displayTitle = player.getMediaMetadata().displayTitle; @Nullable CharSequence displayTitle = player.getMediaMetadata().displayTitle;
...@@ -69,7 +69,7 @@ public final class DefaultMediaDescriptionAdapter implements MediaDescriptionAda ...@@ -69,7 +69,7 @@ public final class DefaultMediaDescriptionAdapter implements MediaDescriptionAda
@Nullable @Nullable
@Override @Override
public CharSequence getCurrentContentText(Player player) { public CharSequence getCurrentContentText(Player player) {
if (!player.isCommandAvailable(COMMAND_GET_MEDIA_ITEMS_METADATA)) { if (!player.isCommandAvailable(COMMAND_GET_METADATA)) {
return null; return null;
} }
@Nullable CharSequence artist = player.getMediaMetadata().artist; @Nullable CharSequence artist = player.getMediaMetadata().artist;
...@@ -83,7 +83,7 @@ public final class DefaultMediaDescriptionAdapter implements MediaDescriptionAda ...@@ -83,7 +83,7 @@ public final class DefaultMediaDescriptionAdapter implements MediaDescriptionAda
@Nullable @Nullable
@Override @Override
public Bitmap getCurrentLargeIcon(Player player, BitmapCallback callback) { public Bitmap getCurrentLargeIcon(Player player, BitmapCallback callback) {
if (!player.isCommandAvailable(COMMAND_GET_MEDIA_ITEMS_METADATA)) { if (!player.isCommandAvailable(COMMAND_GET_METADATA)) {
return null; return null;
} }
@Nullable byte[] data = player.getMediaMetadata().artworkData; @Nullable byte[] data = player.getMediaMetadata().artworkData;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package com.google.android.exoplayer2.ui; package com.google.android.exoplayer2.ui;
import static com.google.android.exoplayer2.Player.COMMAND_GET_CURRENT_MEDIA_ITEM; import static com.google.android.exoplayer2.Player.COMMAND_GET_CURRENT_MEDIA_ITEM;
import static com.google.android.exoplayer2.Player.COMMAND_GET_MEDIA_ITEMS_METADATA; import static com.google.android.exoplayer2.Player.COMMAND_GET_METADATA;
import static com.google.android.exoplayer2.Player.COMMAND_GET_TEXT; import static com.google.android.exoplayer2.Player.COMMAND_GET_TEXT;
import static com.google.android.exoplayer2.Player.COMMAND_GET_TIMELINE; import static com.google.android.exoplayer2.Player.COMMAND_GET_TIMELINE;
import static com.google.android.exoplayer2.Player.COMMAND_GET_TRACKS; import static com.google.android.exoplayer2.Player.COMMAND_GET_TRACKS;
...@@ -1347,7 +1347,7 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider { ...@@ -1347,7 +1347,7 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
@RequiresNonNull("artworkView") @RequiresNonNull("artworkView")
private boolean setArtworkFromMediaMetadata(Player player) { private boolean setArtworkFromMediaMetadata(Player player) {
if (!player.isCommandAvailable(COMMAND_GET_MEDIA_ITEMS_METADATA)) { if (!player.isCommandAvailable(COMMAND_GET_METADATA)) {
return false; return false;
} }
MediaMetadata mediaMetadata = player.getMediaMetadata(); MediaMetadata mediaMetadata = player.getMediaMetadata();
......
...@@ -43,7 +43,7 @@ public class DefaultMediaDescriptionAdapterTest { ...@@ -43,7 +43,7 @@ public class DefaultMediaDescriptionAdapterTest {
PendingIntent.getActivity(context, 0, new Intent(), PendingIntent.FLAG_IMMUTABLE); PendingIntent.getActivity(context, 0, new Intent(), PendingIntent.FLAG_IMMUTABLE);
DefaultMediaDescriptionAdapter adapter = new DefaultMediaDescriptionAdapter(pendingIntent); DefaultMediaDescriptionAdapter adapter = new DefaultMediaDescriptionAdapter(pendingIntent);
when(player.isCommandAvailable(Player.COMMAND_GET_MEDIA_ITEMS_METADATA)).thenReturn(true); when(player.isCommandAvailable(Player.COMMAND_GET_METADATA)).thenReturn(true);
when(player.getMediaMetadata()).thenReturn(mediaMetadata); when(player.getMediaMetadata()).thenReturn(mediaMetadata);
assertThat(adapter.createCurrentContentIntent(player)).isEqualTo(pendingIntent); assertThat(adapter.createCurrentContentIntent(player)).isEqualTo(pendingIntent);
...@@ -63,7 +63,7 @@ public class DefaultMediaDescriptionAdapterTest { ...@@ -63,7 +63,7 @@ public class DefaultMediaDescriptionAdapterTest {
PendingIntent.getActivity(context, 0, new Intent(), PendingIntent.FLAG_IMMUTABLE); PendingIntent.getActivity(context, 0, new Intent(), PendingIntent.FLAG_IMMUTABLE);
DefaultMediaDescriptionAdapter adapter = new DefaultMediaDescriptionAdapter(pendingIntent); DefaultMediaDescriptionAdapter adapter = new DefaultMediaDescriptionAdapter(pendingIntent);
when(player.isCommandAvailable(Player.COMMAND_GET_MEDIA_ITEMS_METADATA)).thenReturn(false); when(player.isCommandAvailable(Player.COMMAND_GET_METADATA)).thenReturn(false);
when(player.getMediaMetadata()).thenReturn(mediaMetadata); when(player.getMediaMetadata()).thenReturn(mediaMetadata);
assertThat(adapter.createCurrentContentIntent(player)).isEqualTo(pendingIntent); assertThat(adapter.createCurrentContentIntent(player)).isEqualTo(pendingIntent);
......
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