Automattic / Automattic/pocket-casts-android

Bottom sheet animation causing IllegalStateException

Open
#205 1 comment 0 reactions 0 assignees View on GitHub
[Area] Player UI [Priority] Low [Type] Bug
Dominant language
Kotlin
Stars
2.8k
Forks
308
Avg merge
1d 10h
Merged PRs (30d)
187

Description

[This crash](https://console.firebase.google.com/u/0/project/singular-vector-91401/crashlytics/app/android:au.com.shiftyjelly.pocketcasts/issues/37c8c76de71f958ab877ece623fcf600?time=last-seven-days&sessionEventKey=62EA767A02240001713619D006091735_1706085247576423926) appears like it may be caused when the show bottom sheet animation completes after `onSaveInstanceState` is called, which is causing an `illegalStateException` to be thrown.

```
Fatal Exception: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1601)
at androidx.fragment.app.FragmentManager.ensureExecReady(FragmentManager.java:1702)
at androidx.fragment.app.FragmentManager.execSingleAction(FragmentManager.java:1716)
at androidx.fragment.app.BackStackRecord.commitNow(BackStackRecord.java:317)
at androidx.fragment.app.FragmentManagerKt.commitNow$default(FragmentManagerKt.java:56)
at au.com.shiftyjelly.pocketcasts.ui.MainActivity.showBottomSheet(MainActivity.kt:624)
at au.com.shiftyjelly.pocketcasts.ui.MainActivity.showBottomSheet(MainActivity.kt:611)
at au.com.shiftyjelly.pocketcasts.ui.MainActivity.onUpNextClicked(MainActivity.kt:427)
at au.com.shiftyjelly.pocketcasts.ui.MainActivity.onMiniPlayerVisible(MainActivity.kt:572)
at au.com.shiftyjelly.pocketcasts.player.view.PlayerBottomSheet$setUpNext$1.onAnimationEnd(PlayerBottomSheet.kt:168)
at android.view.ViewPropertyAnimator$AnimatorEventListener.onAnimationEnd(ViewPropertyAnimator.java:1115)
at android.animation.Animator$AnimatorListener.onAnimationEnd(Animator.java:600)
at android.animation.ValueAnimator.endAnimation(ValueAnimator.java:1333)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1575)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:307)
at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(AnimationHandler.java)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:86)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1229)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
at android.view.Choreographer.doCallbacks(Choreographer.java:899)
at android.view.Choreographer.doFrame(Choreographer.java:827)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7898)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
```

Contributor guide

Open the contributing guide

Research direction

Start with the Firebase Crashlytics trace and inspect PlayerBottomSheet.kt:168, then follow the calls into MainActivity.kt:427, 572, 611, and 624. Confirm how the animation-end callback interacts with onSaveInstanceState; done means the bottom sheet no longer throws IllegalStateException when the animation completes after state saving.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.