mapbox / mapbox/mapbox-maps-android

Crash during animation when useBackgroundThread is set

Open
#2,212 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

auto-triaged bug :beetle:
Dominant language
Kotlin
Stars
578
Forks
161
PR merge metrics
No merged PRs in 30d

Description

## Environment

- Android OS version: 13
- Devices affected: Xiaomi Poco F5
- Maps SDK Version: 10.16.1

A user reported an app crash. This is what we got via bugsnag:
```
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object android.animation.TypeEvaluator.evaluate(float, java.lang.Object, java.lang.Object)' on a null object reference
at android.animation.KeyframeSet.getValue(KeyframeSet.java:202)
at android.animation.PropertyValuesHolder.calculateValue(PropertyValuesHolder.java:1017)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1648)
at android.animation.ValueAnimator.animateBasedOnTime(ValueAnimator.java:1440)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1572)
at android.animation.ValueAnimator.pulseAnimationFrame(ValueAnimator.java:1591)
at android.animation.AnimatorSet.pulseFrame(AnimatorSet.java:1170)
at android.animation.AnimatorSet.doAnimationFrame(AnimatorSet.java:1061)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:307)
at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:86)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1457)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1467)
at android.view.Choreographer.doCallbacks(Choreographer.java:1089)
at android.view.Choreographer.doFrame(Choreographer.java:998)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1435)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.os.HandlerThread.run(HandlerThread.java:67)
```

And then in Threads we got this:
```
Thread 19401 - MapboxAnimThread - (RUNNABLE)
at android.animation.KeyframeSet.getValue(KeyframeSet.java:202)
at android.animation.PropertyValuesHolder.calculateValue(PropertyValuesHolder.java:1017)
at android.animation.ValueAnimator.animateValue(ValueAnimator.java:1648)
at android.animation.ValueAnimator.animateBasedOnTime(ValueAnimator.java:1440)
at android.animation.ValueAnimator.doAnimationFrame(ValueAnimator.java:1572)
at android.animation.ValueAnimator.pulseAnimationFrame(ValueAnimator.java:1591)
at android.animation.AnimatorSet.pulseFrame(AnimatorSet.java:1170)
at android.animation.AnimatorSet.doAnimationFrame(AnimatorSet.java:1061)
at android.animation.AnimationHandler.doAnimationFrame(AnimationHandler.java:307)
at android.animation.AnimationHandler.-$$Nest$mdoAnimationFrame(Unknown)
at android.animation.AnimationHandler$1.doFrame(AnimationHandler.java:86)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1457)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1467)
at android.view.Choreographer.doCallbacks(Choreographer.java:1089)
at android.view.Choreographer.doFrame(Choreographer.java:998)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1435)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.os.HandlerThread.run(HandlerThread.java:67)
```

Which makes me believe, that the error comes from Mapbox SDK.

I still remember, that we opened an issue earlier, where Xiaomi devices had issues with rendering in AA, when the phone screen was off:
https://github.com/mapbox/mapbox-maps-android/issues/1413

The solution was to toggle an option, that uses a different render thread. However there seems to be an issue with that in rare cases. @kiryldz you worked on that previously, could you please check, if the error is somehow related to that?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Android animation stack trace and the useBackgroundThread option, then review issue #1413 for the earlier render-thread change. Investigate whether MapboxAnimThread can reach this null evaluator on the reported Android 13 device and identify a reproducible path. Done means the crash is prevented or otherwise resolved, with the relevant behavior verified.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.