Chore: Deep link and initialization improvements#3010
Merged
5 commits merged intoJun 29, 2026
Merged
Conversation
The 'Up arrow tracking logs' commit added logcat calls in BackstackController that run during BackstackControllerTest and DeepLinkNavigationTest, where the default NoLog logger throws. Install TestLogcatLoggingRule in both so the suite stays green.
Two defensive fixes for the report of a 'deep-link stack' (Home shown with a back arrow instead of the nav bar) appearing after a plain icon launch + login, with no deep-link action by the user. 1. Snapshot-back BackstackController.isOwnTask. The lone-deep-link chrome derives the back-arrow-vs-nav-bar decision partly from isTaskRoot, previously read via a non-observable () -> Boolean lambda. A normal lone Home then renders as a deep-link stack whenever isTaskRoot is false, and could latch that stale reading. isOwnTask is now a mutableStateOf-backed Boolean, refreshed from isTaskRoot in onCreate and on every onResume, so the chrome recomposes and self-corrects. 2. Time-bound the persisted pendingDeepLink. It survives process death (for the mid-OTP case) but was never age-bounded, so a link stashed long ago could bleed into an unrelated later login as a lone stack. It now carries a stash timestamp; on restore a link older than 30 minutes (or with no timestamp, or a backwards clock) is dropped. Adds regression tests for the isOwnTask toggle, the pending-timestamp lifecycle, and the 30-minute freshness boundary.
Follow-up cleanups on the two defensive fixes: - Seed BackstackController.isOwnTask from the Activity's isTaskRoot at first construction (threaded through NavRetainedViewModel) instead of relying on the true default and the onCreate wiring running before any read. onResume remains the authoritative refresh; the default stays only for unit tests. - Collapse the isOwnTask backing field + explicit accessors into a single 'by mutableStateOf' delegate. - In NavigationStateBridge.restoreAndPersist, sample the clock once (was twice, letting the logged age disagree with the freshness decision) and use takeIf. - Express the pending-deep-link window as 30.minutes (kotlin.time.Duration), the repo idiom, instead of raw millis arithmetic.
Verbose logs are skipped in datadog and firebase, only shown locally
panasetskaya
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Do some small improvements around the initialization and refreshing of isOwnTask so that if it changes it properly gets set in the
backstackControllerAlso make deep links "expire" in case they were not acted upon in a short period of time. If we somehow stash a deep link for a long time and only later login, we can safely discard that.
Add some logs around the initialization and make those tracking logs VERBOSE
Verbose logs are skipped in datadog and firebase, only shown locally