Skip to content

feat(android): skip transition graph for non-animated navigation#11271

Open
edusperoni wants to merge 1 commit into
mainfrom
feat/ignore-none-transition
Open

feat(android): skip transition graph for non-animated navigation#11271
edusperoni wants to merge 1 commit into
mainfrom
feat/ignore-none-transition

Conversation

@edusperoni

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

On Android, every non-animated page navigation sets up a zero-duration NoTransition/CustomTransition graph. Its only purpose is to receive a transition-end callback that drives navigation completion — there is no actual animation to run. Besides being wasteful, this graph is the source of a memory leak: androidx attaches end listeners to the (shared) AnimatorSet that are never removed for a zero-duration run, so each navigation leaves a stale listener retaining the previous fragment and its page.

What is the new behavior?

Regular (non-nested) non-animated navigation no longer creates any fragment transitions. Navigation completion is already driven by FragmentCallbacksImplementation.onResume -> frame.setCurrent whenever nothing is animating, so the zero-duration transition was unnecessary. The nested-first-navigation path is left untouched (it runs once per nested frame, not per navigation, so it does not accumulate). This removes the leak at its source for the common case and avoids building/tearing down a transition + dummy animator on every navigation.

Related / split PRs

This is the root-cause half of the fix and is intentionally split from #11270 because it is more behaviorally risky: it makes the existing onResume fallback the primary completion path for non-animated navigation, which is worth extra scrutiny across edge cases (clearHistory, modal frames, rapid/queued navigations, app suspend/resume mid-navigation).

#11270 is the lower-risk native fix (run each CustomTransition on a per-invocation AnimatorSet clone so framework listeners can't accumulate) and stands on its own. The two are complementary: #11270 protects all remaining CustomTransition users (animated/custom transitions and the nested path); this PR additionally avoids creating the graph at all for the common non-animated case. #11270 can ship independently of this one.

Regular (non-nested) non-animated navigation created a zero-duration
NoTransition/CustomTransition on every navigation purely to receive a
transition-end callback that drives navigation completion. That graph is
leak-prone: androidx attaches end listeners to the (shared) AnimatorSet
which are not removed for a zero-duration run, so each navigation left a
stale listener retaining the previous fragment and page.

Skip setting up any fragment transitions for this case. Completion is
already driven by FragmentCallbacksImplementation.onResume -> setCurrent
when nothing is animating, so no transition-end callback is needed. The
nested-first-navigation path is left untouched (it is a one-off per frame,
not per navigation, so it does not accumulate).
@nx-cloud

nx-cloud Bot commented Jun 18, 2026

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit 7938ba7

Command Status Duration Result
nx test apps-automated -c=android ❌ Failed 34m 50s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded <1s View ↗

💡 Dealing with memory or CPU issues? See memory and CPU details with the resource usage add-on ↗.


☁️ Nx Cloud last updated this comment at 2026-06-18 18:21:52 UTC

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant