You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 13297ef
Browse filesBrowse the repository at this point in the historyBrowse files
fix(android): Stop attributing Nav3 data to Activities without a SentryNavEffect
Stop misattributing nav data and spans to a Nav3 root when the user navigates to a new Activity (or ViewPager2 page) that doesn't contain a SentryNavEffect.
THE PROBLEM:
Assume Home Activity has a `SentryNavEffect` but Plain Activity doesn't.
```
1. App goes to background: Home ON_PAUSE ──────────────────▶ Home ON_STOP
2. Covered by PlainActivity: Home ON_PAUSE ─▶ Plain ON_RESUME ─▶ Home ON_STOP
^^^^^^^^^^^^^^^
Invisible to Home's SentryNavEffect
```
Case (1) is already handled properly today; case (2) is what this PR addresses.
With case (2), spans generated by the Plain Activity will be (wrongly) attributed to the Home Activity's nav transaction, and errors thrown by Plain Activity will contain the Home Activity's nav context (screen name + back stack).
Note that cases (1) and (2) require opposite implementations. For (1), the leaseholder should keep its data b/c it's still the last activity the user saw and the user may come back to it. For (2), the leaseholder's data no longer describes what's on the screen and it should be cleared.
THE SOLUTION:
This commit satisfies both cases by clearing Home's nav context and unbinding its nav transaction when Plain is resumed. If Home returns, its nav context and transaction (if still unfinished) is restored.
Implemented by the existing `NavLeaseCoordinator` via the concept of "lease withdrawal".
(Note: Fragments not used as ViewPager2 pages don't have the problem discussed above because the Home fragment's view would be destroyed when the Plain fragment showed up, meaning the leaseholder's data would be cleared in case (2).)
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
5
5
### Fixes
6
6
7
+
- Stop attributing errors and spans from an Activity or ViewPager2 page without a `SentryNavEffect` to the most recently visited Navigation 3 root ([#6457](https://github.com/getsentry/sentry-java/pull/6457))
7
8
- Fix missing Navigation 3 transactions for preloaded ViewPager2 pages and destinations reached while another Activity or Fragment owns navigation tracking ([#6400](https://github.com/getsentry/sentry-java/pull/6400))
8
9
- Keep UI profiling running when `startProfiler` is called before a requested stop takes effect at the end of the current chunk ([#6291](https://github.com/getsentry/sentry-java/pull/6291))
9
10
- Before, the start call was ignored and the profiler still stopped at the end of the chunk, even in `TRACE` mode while sampled spans were active. On API 34 and lower, every later profile also stopped after one chunk.
Copy file name to clipboardExpand all lines: sentry-android-navigation3/src/test/kotlin/io/sentry/compose/navigation3/CoordinatedBackStackObserverTest.kt
0 commit comments