11
11
import io .sentry .ILogger ;
12
12
import io .sentry .ISentryLifecycleToken ;
13
13
import io .sentry .ITransactionProfiler ;
14
+ import io .sentry .NoOpCompositePerformanceCollector ;
14
15
import io .sentry .NoOpConnectionStatusProvider ;
15
16
import io .sentry .NoOpContinuousProfiler ;
16
17
import io .sentry .NoOpTransactionProfiler ;
35
36
import io .sentry .cache .PersistingScopeObserver ;
36
37
import io .sentry .compose .gestures .ComposeGestureTargetLocator ;
37
38
import io .sentry .compose .viewhierarchy .ComposeViewHierarchyExporter ;
39
+ import io .sentry .internal .debugmeta .NoOpDebugMetaLoader ;
38
40
import io .sentry .internal .gestures .GestureTargetLocator ;
41
+ import io .sentry .internal .modules .NoOpModulesLoader ;
39
42
import io .sentry .internal .viewhierarchy .ViewHierarchyExporter ;
40
43
import io .sentry .transport .CurrentDateProvider ;
41
44
import io .sentry .transport .NoOpEnvelopeCache ;
45
+ import io .sentry .transport .NoOpTransportGate ;
42
46
import io .sentry .util .LazyEvaluator ;
43
47
import io .sentry .util .Objects ;
48
+ import io .sentry .util .thread .NoOpThreadChecker ;
44
49
import java .io .File ;
45
50
import java .util .ArrayList ;
46
51
import java .util .List ;
@@ -163,7 +168,9 @@ static void initializeIntegrationsAndProcessors(
163
168
options .addEventProcessor (new ScreenshotEventProcessor (options , buildInfoProvider ));
164
169
options .addEventProcessor (new ViewHierarchyEventProcessor (options ));
165
170
options .addEventProcessor (new AnrV2EventProcessor (context , options , buildInfoProvider ));
166
- options .setTransportGate (new AndroidTransportGate (options ));
171
+ if (options .getTransportGate () instanceof NoOpTransportGate ) {
172
+ options .setTransportGate (new AndroidTransportGate (options ));
173
+ }
167
174
168
175
// Check if the profiler was already instantiated in the app start.
169
176
// We use the Android profiler, that uses a global start/stop api, so we need to preserve the
@@ -185,8 +192,12 @@ static void initializeIntegrationsAndProcessors(
185
192
appStartTransactionProfiler ,
186
193
appStartContinuousProfiler );
187
194
188
- options .setModulesLoader (new AssetsModulesLoader (context , options .getLogger ()));
189
- options .setDebugMetaLoader (new AssetsDebugMetaLoader (context , options .getLogger ()));
195
+ if (options .getModulesLoader () instanceof NoOpModulesLoader ) {
196
+ options .setModulesLoader (new AssetsModulesLoader (context , options .getLogger ()));
197
+ }
198
+ if (options .getDebugMetaLoader () instanceof NoOpDebugMetaLoader ) {
199
+ options .setDebugMetaLoader (new AssetsDebugMetaLoader (context , options .getLogger ()));
200
+ }
190
201
191
202
final boolean isAndroidXScrollViewAvailable =
192
203
loadClass .isClassAvailable ("androidx.core.view.ScrollingView" , options );
@@ -218,7 +229,9 @@ static void initializeIntegrationsAndProcessors(
218
229
options .setViewHierarchyExporters (viewHierarchyExporters );
219
230
}
220
231
221
- options .setThreadChecker (AndroidThreadChecker .getInstance ());
232
+ if (options .getThreadChecker () instanceof NoOpThreadChecker ) {
233
+ options .setThreadChecker (AndroidThreadChecker .getInstance ());
234
+ }
222
235
if (options .getPerformanceCollectors ().isEmpty ()) {
223
236
options .addPerformanceCollector (new AndroidMemoryCollector ());
224
237
options .addPerformanceCollector (new AndroidCpuCollector (options .getLogger ()));
@@ -232,7 +245,9 @@ static void initializeIntegrationsAndProcessors(
232
245
"options.getFrameMetricsCollector is required" )));
233
246
}
234
247
}
235
- options .setCompositePerformanceCollector (new DefaultCompositePerformanceCollector (options ));
248
+ if (options .getCompositePerformanceCollector () instanceof NoOpCompositePerformanceCollector ) {
249
+ options .setCompositePerformanceCollector (new DefaultCompositePerformanceCollector (options ));
250
+ }
236
251
}
237
252
238
253
/** Setup the correct profiler (transaction or continuous) based on the options. */
0 commit comments