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

Crash in ComposeLoopFrameActvity when in Story Editing Mode #280

Open
mzorz opened this issue Mar 20, 2020 · 1 comment
Open

Crash in ComposeLoopFrameActvity when in Story Editing Mode #280

mzorz opened this issue Mar 20, 2020 · 1 comment
Labels
Serialization [Type] Crash The app stops unexpectedly.

Comments

@mzorz
Copy link
Contributor

mzorz commented Mar 20, 2020

First spotted by @jd-alexander in #278 (review)

I was able to reproduce with the following steps:

  1. turn Don't keep activities developer setting ON
  2. launch the app
  3. tap on the FAB button to start the composer activity
  4. take a picture, observe the editing mode is shown with the bottom strip with one frame and the + button tto add more
  5. send the app to the background
  6. bring it back again to the foreground
  7. observe the bottom strip doesn't contain any frames at all now (as the Activity has been re-created).
  8. Tap NEXT
  9. 💥
2020-03-20 11:41:57.281 23469-23469/com.automattic.portkey D/AndroidRuntime: Shutting down VM
2020-03-20 11:41:57.283 23469-23469/com.automattic.portkey E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.automattic.portkey, PID: 23469
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.get(ArrayList.java:437)
        at java.util.Collections$UnmodifiableList.get(Collections.java:1351)
        at com.automattic.portkey.compose.story.StoryViewModel.getCurrentStoryFrameAt(StoryViewModel.kt:84)
        at com.automattic.portkey.compose.ComposeLoopFrameActivity.addCurrentViewsToFrameAtIndex(ComposeLoopFrameActivity.kt:599)
        at com.automattic.portkey.compose.ComposeLoopFrameActivity.access$addCurrentViewsToFrameAtIndex(ComposeLoopFrameActivity.kt:105)
        at com.automattic.portkey.compose.ComposeLoopFrameActivity$addClickListeners$9.onClick(ComposeLoopFrameActivity.kt:543)
        at android.view.View.performClick(View.java:6256)
        at android.view.View$PerformClick.run(View.java:24701)
        at android.os.Handler.handleCallback(Handler.java:789)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:164)
        at android.app.ActivityThread.main(ActivityThread.java:6541)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
2020-03-20 11:41:57.286 23469-23469/com.automattic.portkey D/io.sentry.android.event.helper.AndroidEventBuilderHelper: Proguard UUIDs file not found.

This one is tricky because we'd need to save the instance state, and for that, we need to be able to serialize the StoryFrameItem which contains both information about each frame's background surface view and the Added views (text, emoji) - such as placement coordinates, rotation, size, and transformation matrix. While I keep plans for this in the long run, this is not a trivial fix and the right way to do that is by implementing some sort of serialization. I could also prevent the actual crash from happening but it wouldn't prevent the situation of "my frames are lost", which is the core thing here. So, opening a new separate issue to tackle once we get back on track with serialization (see previous abandoned effort here).

@mzorz
Copy link
Contributor Author

mzorz commented Jul 16, 2020

Tackled in #414, #435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Serialization [Type] Crash The app stops unexpectedly.
Projects
None yet
Development

No branches or pull requests

1 participant