Skip to content

Commit fd1ce4a

Browse files
committed
activate options earlier
1 parent 45d3d35 commit fd1ce4a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

sentry-android-core/src/main/java/io/sentry/android/core/AndroidOptionsInitializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ static void loadDefaultAndMetadataOptions(
142142

143143
readDefaultOptionValues(options, finalContext, buildInfoProvider);
144144
AppState.getInstance().registerLifecycleObserver(options);
145+
options.activate();
145146
}
146147

147148
@TestOnly

sentry-android-core/src/test/java/io/sentry/android/core/SentryAndroidTest.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import io.sentry.DateUtils
1616
import io.sentry.Hint
1717
import io.sentry.ILogger
1818
import io.sentry.ISentryClient
19+
import io.sentry.NoOpSentryExecutorService
1920
import io.sentry.Sentry
2021
import io.sentry.Sentry.OptionsConfiguration
2122
import io.sentry.SentryEnvelope
@@ -528,6 +529,19 @@ class SentryAndroidTest {
528529
assertEquals(99, AppStartMetrics.getInstance().appStartTimeSpan.startUptimeMs)
529530
}
530531

532+
@Test
533+
fun `executor service is not NoOp when AndroidConnectionStatusProvider is initialized`() {
534+
var executorServiceIsNoOp = true
535+
fixture.initSut(context = context) { options ->
536+
options.dsn = "https://key@sentry.io/123"
537+
// the config callback runs before initializeIntegrationsAndProcessors, which creates
538+
// AndroidConnectionStatusProvider - so if the executor is already real here,
539+
// it's guaranteed to be real when the provider calls submitSafe()
540+
executorServiceIsNoOp = options.executorService is NoOpSentryExecutorService
541+
}
542+
assertFalse(executorServiceIsNoOp)
543+
}
544+
531545
@Test
532546
fun `if the config options block throws still intializes android event processors`() {
533547
lateinit var optionsRef: SentryOptions

0 commit comments

Comments
 (0)