tonihei b34a5b4e5d Align logic to ignore disabled and non-custom buttons in custom layout
The legacy custom layout doesn't support disabled buttons or buttons
with non-custom actions. These are currently filtered out, but in
inconsistent ways:
 - MediaControllerImplBase doesn't filter at all.
 - DefaultNotificationProvider filters before converting
   mediaButtonPreferences, PlayerWrapper filters after the conversion.
 - PlayerWrapper doesn't disable buttons that are unavailable.

To ensure it's consistent, we can add these checks to the existing util
method in CommandButton and also make sure PlayerWrapper disables
unavailable buttons before triggering the util method.

This also means we can simplify some of the tests that rely on the
mediaButtonPreference to customLayout conversion in MediaController.

This change also includes two bug fixes in PlayerWrapper that
became evident in the tests: The extras need to be copied to
avoid modifying a Bundle instance that be used elsewhere and
we need to update the custom layout and potentially the session
extras when the available commands change, as they depend on them.

PiperOrigin-RevId: 704678404
2024-12-10 06:13:54 -08:00
..
2021-10-27 09:12:46 +01:00

Session module

This module provides media session functionality through which media information and controls can be exposed to the Android platform, as well as to other processes and applications.

Getting the module

The easiest way to get the module is to add it as a gradle dependency:

implementation 'androidx.media3:media3-session:1.X.X'

where 1.X.X is the version, which must match the version of the other media modules being used.

Alternatively, you can clone this GitHub project and depend on the module locally. Instructions for doing this can be found in the top level README.