Add a method to distinguish whether a player can be set by MediaSession
PiperOrigin-RevId: 388835913
This commit is contained in:
parent
7375fe3105
commit
a533d8190a
@ -89,6 +89,16 @@ public abstract class BasePlayer implements Player {
|
|||||||
return getAvailableCommands().contains(command);
|
return getAvailableCommands().contains(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*
|
||||||
|
* <p>BasePlayer and its descendents will return {@code true}.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public final boolean canAdvertiseSession() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void play() {
|
public final void play() {
|
||||||
setPlayWhenReady(true);
|
setPlayWhenReady(true);
|
||||||
|
@ -151,6 +151,11 @@ public class ForwardingPlayer implements Player {
|
|||||||
return player.isCommandAvailable(command);
|
return player.isCommandAvailable(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canAdvertiseSession() {
|
||||||
|
return player.canAdvertiseSession();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Commands getAvailableCommands() {
|
public Commands getAvailableCommands() {
|
||||||
return player.getAvailableCommands();
|
return player.getAvailableCommands();
|
||||||
|
@ -1543,6 +1543,9 @@ public interface Player {
|
|||||||
*/
|
*/
|
||||||
boolean isCommandAvailable(@Command int command);
|
boolean isCommandAvailable(@Command int command);
|
||||||
|
|
||||||
|
/** Returns whether the player can be used to advertise a media session. */
|
||||||
|
boolean canAdvertiseSession();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the player's currently available {@link Commands}.
|
* Returns the player's currently available {@link Commands}.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user