mirror of
https://github.com/samsonjs/media.git
synced 2026-03-25 09:25:53 +00:00
Remove invalid command comparison
The removed check searched for a player command inside a list of
session commands, which is not allowed by the IntDef definition
and only worked because both types map to a Java int.
PiperOrigin-RevId: 612758442
(cherry picked from commit c79ac5ba21)
This commit is contained in:
parent
e28d772423
commit
672d149a73
2 changed files with 2 additions and 20 deletions
|
|
@ -292,10 +292,9 @@ public final class CommandButton implements Bundleable {
|
|||
*/
|
||||
/* package */ static boolean isEnabled(
|
||||
CommandButton button, SessionCommands sessionCommands, Player.Commands playerCommands) {
|
||||
return playerCommands.contains(button.playerCommand)
|
||||
|| (button.sessionCommand != null && sessionCommands.contains(button.sessionCommand))
|
||||
return (button.sessionCommand != null && sessionCommands.contains(button.sessionCommand))
|
||||
|| (button.playerCommand != Player.COMMAND_INVALID
|
||||
&& sessionCommands.contains(button.playerCommand));
|
||||
&& playerCommands.contains(button.playerCommand));
|
||||
}
|
||||
|
||||
// Bundleable implementation.
|
||||
|
|
|
|||
|
|
@ -47,23 +47,6 @@ public class CommandButtonTest {
|
|||
.isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isEnabled_playerCommandAvailableOrUnavailableInSessionCommands_isEnabledCorrectly() {
|
||||
CommandButton button =
|
||||
new CommandButton.Builder()
|
||||
.setDisplayName("button")
|
||||
.setIconResId(R.drawable.media3_notification_small_icon)
|
||||
.setPlayerCommand(Player.COMMAND_SEEK_TO_NEXT)
|
||||
.build();
|
||||
SessionCommands availableSessionCommands =
|
||||
SessionCommands.EMPTY.buildUpon().add(Player.COMMAND_SEEK_TO_NEXT).build();
|
||||
|
||||
assertThat(CommandButton.isEnabled(button, SessionCommands.EMPTY, Player.Commands.EMPTY))
|
||||
.isFalse();
|
||||
assertThat(CommandButton.isEnabled(button, availableSessionCommands, Player.Commands.EMPTY))
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isEnabled_sessionCommandAvailableOrUnavailable_isEnabledCorrectly() {
|
||||
SessionCommand command1 = new SessionCommand("command1", Bundle.EMPTY);
|
||||
|
|
|
|||
Loading…
Reference in a new issue