Skip to content

fix(sample): Drop Nav3 Activity ui.load transactions when the toggle is off - #6401

Open
0xadam-brown wants to merge 1 commit into
mainfrom
0xadam-brown/fix/nav3-sample-ui-load-toggle
Open

0xadam-brown wants to merge 1 commit into
mainfrom
0xadam-brown/fix/nav3-sample-ui-load-toggle

Conversation

@0xadam-brown

Copy link
Copy Markdown
Member

📜 Description

Makes the Nav3 sample's "Activity ui.load transaction" toggle actually drop the Nav3 Activities' ui.load transactions when it's off.

The sample used to cancel the ui.load transaction through the scope. That missed it whenever the SDK hadn't bound it, which happens when another transaction (e.g., the previous Activity's nav transaction) is already bound. applyActivityUiLoadTransactionSetting() still cancels a bound transaction, and now also drops unbound ones, through an event processor, for Nav3 Activities created with the toggle off.

💡 Motivation and Context

With the toggle off, Nav3FragmentsActivity, Nav3ProductsActivity and Nav3CheckoutActivity ui.load transactions were still sent, which made manual test runs of the Nav3 scenarios noisy.

💚 How did you test it?

On an emulator: with the toggle off, no ui.load transaction is sent for Nav3Activity or Nav3FragmentsActivity. With it on, they're sent as before.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🔮 Next steps

#skip-changelog

…is off

The sample cancelled the Activity's ui.load transaction through the scope. When another
transaction was already bound, such as the previous Activity's nav transaction, the SDK didn't
bind ui.load, so the cancel missed and the transaction was still sent, often waiting the full
deadline with the Activity's spans.

Keep cancelling a bound ui.load transaction so it doesn't block the first nav transaction, and
also drop Nav3 sample Activities' ui.load transactions in an event processor when the Activity
was created with the toggle off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sentry

sentry Bot commented Oct 27, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.62.0 (1) release

⚙️ sentry-android Build Distribution Settings

@0xadam-brown 0xadam-brown added the ship-it PR is ready to merge from a reviewer perspective label Oct 27, 2026
@0xadam-brown
0xadam-brown marked this pull request as ready for review October 27, 2026 19:24
@0xadam-brown
0xadam-brown requested review from a team and adinauer as code owners October 27, 2026 19:24

@runningcode runningcode left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this can't compile due to calling java8 APIs. (I can't believe I'm writing that in 2026) see the CI failure! Otherwise, i have a concern about the duration of the stuff under the lock. Approving otherwise!


/** Drops ui.load transactions for sample Activities created with the ui.load toggle off. */
private object SuppressedActivityUiLoadTransactions : EventProcessor {
val activityNames: MutableSet<String> = ConcurrentHashMap.newKeySet()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dang, build failure says we need API 24 for this:

    val activityNames: MutableSet<String> = ConcurrentHashMap.newKeySet()```


fun install() {
if (installed) return
synchronized(this) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for my understanding, is this exclusively called from the main thread?

how long is Sentry.getCurrentScopes().options.addEventProcessor(this) expected to take?

This branch has not been deployed

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

Labels

ship-it PR is ready to merge from a reviewer perspective

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants