Open naveensingh opened 12 months ago
@tonihei (tagging you to make sure the issue isn't ignored/passed silently into the final 1.2.0 release)
ffd7bb5639f3c25b877f3689eadf07bdbfdee2b0 seems to be the commit that introduced this issue.
Thanks for reporting! We just reworked this part of the code to make it more robust (for reasons unrelated to this IllegalStateException
). See https://github.com/androidx/media/commit/64bd3bcad3fa4b0e433b16d583456920afad3ce2 (from yesterday) that removed the code path listed above.
@marcbaechinger Do you reckon the "not-yet-connected-controller" issue that was reported here could somehow still be a problem after the recent change? I guess not anymore since we are not directly using a controller for this now, right?
Yes, agreed this should be fixed in the next release for several reasons (including the CL regarding adding MediaSession.Callback.onMediaButtonEvent()
that I just sent for internal review).
After these changes, the strongest reason why this can't happen anymore is that a) we use a fallback if the media notification controller is not connected. This fallback would also prevent crashes if the media notification controller is not connected at all, because then the event would go the same path through sessionCompat.getMediaController().dispatchMediaButtonEvent()
as it was before. So the worst that can happen would be to receive the event through the platform session as before.
For b) the change in internal review also post a Runnable
to the application thread of the session from within onStartCommand
. Only that runnable in the app thread then calls MediaSessionImpl.onMediaButtonEvent
. Hence, attempting to get the ControllerInfo
of the media notification controller happens in a new Looper
event (no postOrRun
) on the app thread. When this runnable is posted, the media notification controller is already connecting on the application thread and adds the ControllerInfo
to the ConnectedControllersManager
.
I'm still trying to repro with beta-01 and will comment again here in the issue when the second CL currently in review landed here on the main branch.
Version
Media3 pre-release (alpha, beta or RC not in this list)
More version details
Version 1.2.0-alpha02
Devices that reproduce the issue
Reproducible on all Android versions, check the screenshot in the Actual result section
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Not tested
Reproduction steps
Expected result
The app starts playback successfully.
Actual result
Stacktrace:
Crash statistics:
Media
Not applicable.
Bug Report
adb bugreport
to android-media-github@google.com after filing this issue.