3

We are getting reports about a crash which seems to be caused by google cast SDK. We don't know how to reproduce it, just that it occurs in production.

'com.google.android.gms:play-services-cast-framework:11.6.2'

..and here is the report from crashlytics:

Fatal Exception: java.lang.IllegalStateException: Not connected to a device
   at com.google.android.gms.internal.zzbbc.zzaey(Unknown Source)
   at com.google.android.gms.internal.zzbbc.isMute(Unknown Source)
   at com.google.android.gms.cast.Cast$CastApi$zza.isMute(Unknown Source)
   at com.google.android.gms.cast.framework.CastSession.isMute(Unknown Source)
   at com.google.android.gms.internal.zzazf.zzaee(Unknown Source)
   at com.google.android.gms.internal.zzazf.onMediaStatusUpdated(Unknown Source)
   at com.google.android.gms.cast.framework.media.uicontroller.UIMediaController.zzaed(Unknown Source)
   at com.google.android.gms.cast.framework.media.uicontroller.UIMediaController.onStatusUpdated(Unknown Source)
   at com.google.android.gms.cast.framework.media.zzn.onStatusUpdated(Unknown Source)
   at com.google.android.gms.internal.zzbbw.onStatusUpdated(Unknown Source)
   at com.google.android.gms.internal.zzbbw.zza(Unknown Source)
   at com.google.android.gms.internal.zzbbw.zzfg(Unknown Source)
   at com.google.android.gms.cast.framework.media.RemoteMediaClient.onMessageReceived(Unknown Source)
   at com.google.android.gms.internal.zzbbi.run(Unknown Source)
   at android.os.Handler.handleCallback(Handler.java:751)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:154)
   at android.app.ActivityThread.main(ActivityThread.java:6776)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)

Does anyone have any insight on this? Everything in the logs seems to be internal things, nothing on our app.

Edit: This is the code from com.google.android.gms.internal where the crash occurs. My best bet is that there is a race condition where the app loses connection just before the call to var1.isMute() which in turn throws the Exception "Not connected to a device"

protected final void zzaer() {
    CastSession var1;
    if((var1 = CastContext.getSharedInstance(this.zzbhi).getSessionManager().getCurrentCastSession()) != null && var1.isConnected()) {
        RemoteMediaClient var2;
        if((var2 = this.getRemoteMediaClient()) != null && var2.hasMediaSession()) {
            this.zzfbo.setEnabled(true);
        } else {
            this.zzfbo.setEnabled(false);
        }

        if(var1.isMute()) { // This row causes the crash
            this.zzaz(true);
        } else {
            this.zzaz(false);
        }
    } else {
        this.zzfbo.setEnabled(false);
    }
}

Edit: I've filed the issue to google: https://issuetracker.google.com/issues/72880677

Edit: Creating custom expanded controls and making sure that mute button is not binded to the views seems to mitigate the crashes.

user1354603
  • 4,034
  • 4
  • 31
  • 43

0 Answers0