mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00

This change adds an API in the ForwardingPlayer to disable commands. This is affecting what Player.isCommandAvailable() returns as well as what is being advertised from the EventListener.onAvailableCommandsChanged() callback. For the callback case, the ForwardingPlayer needs to intercept the callback. It does so by wrapping registered EventListener and Listener instances, which resulted in some boiler-plate code. In addition, there is logic on the wrapped listeners to avoid triggering a queued callback if all listeners have been removed in the meantime. This includes the case where new listeners are added while callbacks scheduled for the removed listeners are still pending. PiperOrigin-RevId: 371139703