Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException in MediaController.notifyAccepted() #49

Closed
h6ah4i opened this issue Mar 3, 2022 · 2 comments
Closed

IllegalStateException in MediaController.notifyAccepted() #49

h6ah4i opened this issue Mar 3, 2022 · 2 comments
Assignees
Labels

Comments

@h6ah4i
Copy link
Contributor

h6ah4i commented Mar 3, 2022

Hi. I noticed the following crash report in Crashlytics for my app.

Example stack trace (copied from Firebase Crashlytics)

Fatal Exception: java.lang.IllegalStateException
       at androidx.media3.common.util.Assertions.checkState(Assertions.java:85)
       at androidx.media3.session.MediaController.notifyAccepted(MediaController.java:1800)
       at androidx.media3.session.MediaControllerImplLegacy.updateControllerInfo(MediaControllerImplLegacy.java:1357)
       at androidx.media3.session.MediaControllerImplLegacy.handleNewLegacyParameters(MediaControllerImplLegacy.java:1318)
       at androidx.media3.session.MediaControllerImplLegacy.access$500(MediaControllerImplLegacy.java:109)
       at androidx.media3.session.MediaControllerImplLegacy$ControllerCompatCallback.onSessionReady(MediaControllerImplLegacy.java:1559)
       at android.support.v4.media.session.MediaControllerCompat$Callback$MessageHandler.handleMessage(MediaControllerCompat.java:1121)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:214)
       at android.app.ActivityThread.main(ActivityThread.java:7386)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:980)

Where the exception thrown

Library versions

  • androidx.media3: Built from source (Commit ID: f92ae23)
  • androidx.media: v1.5.0

Affected Android versions (obtained info from Firebase Crashlytics)

  • Android 8, 9, 10, 11 and 12
    (older OS might also be affected)

How to reproduce the issue?

Sorry, I have not succeeded in reproducing the issue yet. I'll post details if I can get any info.

@entibaldi
Copy link

We are also reproducing this issue for several of our users

@tonihei tonihei assigned tonihei and unassigned marcbaechinger Nov 10, 2022
microkatz pushed a commit that referenced this issue Nov 10, 2022
The connection to a legacy MediaSession may receive additional
onSessionReady callbacks that are treated as additional state updates.
We currently also set the "notifyConnected" flag for these updates
even though we are connected already, causing an IllegalStateException.

Fix the exception by not setting this flag.

We can also remove the wording about "locked" updates since this class
operates everything on a single application thread.

Issue: #49
PiperOrigin-RevId: 487487286
microkatz pushed a commit that referenced this issue Nov 22, 2022
The connection to a legacy MediaSession may receive additional
onSessionReady callbacks that are treated as additional state updates.
We currently also set the "notifyConnected" flag for these updates
even though we are connected already, causing an IllegalStateException.

Fix the exception by not setting this flag.

We can also remove the wording about "locked" updates since this class
operates everything on a single application thread.

Issue: #49
PiperOrigin-RevId: 487487286
(cherry picked from commit b24161a)
@h6ah4i
Copy link
Contributor Author

h6ah4i commented Jan 14, 2023

@tonihei Thanks for the fix in 1.0.0-beta03. I no longer see the app crashes due to this error anymore 👍

@h6ah4i h6ah4i closed this as completed Jan 14, 2023
@androidx androidx locked and limited conversation to collaborators Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants