
A fatal `PlaybackException` is mapped to a legacy playback state in state `STATE_ERROR` with error code, message and extras. A non-fatal error sent to controllers with `MediaSession.sendError` is synced to the legacy session by setting error code and message and merging the extras while preserving the rest of the state in sync with the session player. Vice versa, a `MediaController` connected to a legacy session receives fatal errors through `Player.onPlayerErrorChanged()` and non-fatal errors through `MediaController.Listener.onError()`. Error codes are mapped in `LegacyConversions`. Values of error codes in `@SessionError.ErrorCode` come from `@PlaybackExceptino.ErrorCode` with the exception of `@SessionError.ERROR_IO` and `@SessionError.ERROR_UNKNOWN`. These already exist in `@PlaybackException.ErrorCode` and are mapped accordingly to avoid semantic duplicates. PiperOrigin-RevId: 642595517
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