fix(engine): safe-area insets never re-polled after app resume (stale on fold/unfold) #116
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Medium-High (Android correctness)
Problem
rearm_on_resumed(solitaire_engine/src/safe_area.rs) resetsSafeAreaPollTriesto 0 onAppLifecycle::WillResumeso thatrefresh_insets"re-queries JNI in the frames immediately after the app returns to the foreground."But
refresh_insetsearly-returns whenever the cached insets are already populated:Once insets resolve on first launch,
insets.is_populated()is permanently true, so the poll-counter reset on resume is a no-op — JNI is never queried again for the lifetime of the process.Consequence
If the system insets change while the app is backgrounded (rotation, fold/unfold on a foldable, gesture-nav ↔ 3-button nav switch, split-screen), the layout keeps the stale insets until the app is killed and relaunched. This directly affects the Galaxy Fold 7 fold/unfold flow.
Also
The doc comment above
rearm_on_resumed(around line 193) still describes the old behaviour: "resets bothSafeAreaPollTriesandSafeAreaInsetsto zero". The code intentionally no longer zeroes the insets (to avoid the resume double-flash), so the comment is stale and contradicts the later comment on the function itself.Suggested fix
refresh_insetsre-polls for a few frames after resume even when insets are populated, updating only when the value actually differs — preserving the no-flash behaviour.Found during scripted repo review (todoctx/peek audit), 2026-07-06.