Skip to content

Android: settled RiveViews keep drawing every vsync (render loop only stops when paused) #424

Open

Description

@mikevocalz

On Android (src/new, rive-android 11.12.1, @rive-app/react-native 0.5.5), the Choreographer render loop in RiveReactNativeView.kt calls worker.draw(...) on every frame unless the view is paused:

if (paused && !needsRedraw) { … return }
…
if (!paused && !settled) worker.advanceStateMachine(sm, deltaTime)
worker.draw(art, sm, rs, activeFit, …)   // runs every frame while not paused

A settled state machine stops advancing but is still redrawn every vsync. In our app, four small control views (autoPlay, data-bound, no looping timelines) kept the UI thread busy at about 30–44 ms per frame while nothing on screen changed (Surface Duo, dumpsys gfxinfo: about 260 frames in 5 s).

Two contributing factors:

  1. The loop's skip condition ignores settled. if ((paused || settled) && !needsRedraw) would fix it.
  2. settled is only set from the deprecated CommandQueue.settledFlow, which is fed by StateMachineSettlingStore. That store only accepts a settlement matching a pending request ID, set by unsettle, and the view never calls unsettle. In our testing settled never became true, so fixing (1) alone made no measurable difference. This is from reading the 11.12.1 bytecode plus device measurements; we didn't add native logging.

Workaround in our app: pause() the view about 600 ms after the last view-model write (longest timeline × 2), and resume with playIfNeeded(). Idle frames went from about 260 to 0 per 5 s, and controls still animate on input.

Happy to open a PR for (1) and wire the view to the non-deprecated settle API if you can point at the intended public surface.

Activity

  1. mfazekas commented on Oct 17, 2026

    @mfazekas
    Collaborator

    Thanks for the detailed report. We reproduced it on main: with a few settled, data-bound views the Android backend keeps drawing every frame (~250 frames per 5 s while idle). A PR would be very welcome. Our battery fix in #416 also touches this render loop and may land as well, but please go ahead if you'd like to open one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions