
The max number of commands for media items of a browser or controller can be configured with `setMaxCommandsForMediaItems(int)` on `MediaController.Builder` and `MediaBrowser.Builder`. An app that has only limited space for displaying commands can hint this limit to the session. A session can receive the value of a connected browser or controller through `getMaxCommandsForMediaItems()` of a `ControllerInfo` that is passed into every callback method. The session can then pick the most sensible commands instead of making the browser app truncating the commands rather randomly. When a `MediaBrowser` is connected against a legacy `MediaBrowserServiceCompat`, the max number of commands is automatically added to the root hints. Conversely, the value passed in with the root hints to `MediaLibraryService` by a legacy `MediaBrowserCompat`, is read into `ControllerInfo` like for a Media3 browser. Issue: androidx/media#1474 #cherrypick PiperOrigin-RevId: 679076506
Session test module
Tests cross-process use of the session module. To run the tests:
- Prepare a device (either an emulator or a real device) to run the tests on.
- Run
./gradlew :test-session-current:cAT