Skip to content

Commit c2b4400

Browse files
committed
reverted UserInteractionIntegration changes, as it's called in register() in the main thread anyway
1 parent 34c1166 commit c2b4400

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ public final class UserInteractionIntegration
2929
private @Nullable IScopes scopes;
3030
private @Nullable SentryAndroidOptions options;
3131

32-
private final @NotNull LazyEvaluator<Boolean> isAndroidXAvailable;
33-
private final @NotNull LazyEvaluator<Boolean> isAndroidxLifecycleAvailable;
32+
private final boolean isAndroidXAvailable;
33+
private final boolean isAndroidxLifecycleAvailable;
3434

3535
public UserInteractionIntegration(
3636
final @NotNull Application application, final @NotNull io.sentry.util.LoadClass classLoader) {
3737
this.application = Objects.requireNonNull(application, "Application is required");
3838
isAndroidXAvailable =
39-
classLoader.isClassAvailableLazy("androidx.core.view.GestureDetectorCompat", options);
39+
classLoader.isClassAvailable("androidx.core.view.GestureDetectorCompat", options);
4040
isAndroidxLifecycleAvailable =
41-
classLoader.isClassAvailableLazy("androidx.lifecycle.Lifecycle", options);
41+
classLoader.isClassAvailable("androidx.lifecycle.Lifecycle", options);
4242
}
4343

4444
private void startTracking(final @NotNull Activity activity) {
@@ -129,13 +129,13 @@ public void register(@NotNull IScopes scopes, @NotNull SentryOptions options) {
129129
.log(SentryLevel.DEBUG, "UserInteractionIntegration enabled: %s", integrationEnabled);
130130

131131
if (integrationEnabled) {
132-
if (isAndroidXAvailable.getValue()) {
132+
if (isAndroidXAvailable) {
133133
application.registerActivityLifecycleCallbacks(this);
134134
this.options.getLogger().log(SentryLevel.DEBUG, "UserInteractionIntegration installed.");
135135
addIntegrationToSdkVersion("UserInteraction");
136136

137137
// In case of a deferred init, we hook into any resumed activity
138-
if (isAndroidxLifecycleAvailable.getValue()) {
138+
if (isAndroidxLifecycleAvailable) {
139139
final @Nullable Activity activity = CurrentActivityHolder.getInstance().getActivity();
140140
if (activity instanceof LifecycleOwner) {
141141
if (((LifecycleOwner) activity).getLifecycle().getCurrentState()

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ class UserInteractionIntegrationTest {
4444
isLifecycleAvailable: Boolean = true,
4545
): UserInteractionIntegration {
4646
whenever(
47-
loadClass.isClassAvailableLazy(
47+
loadClass.isClassAvailable(
4848
eq("androidx.core.view.GestureDetectorCompat"),
4949
anyOrNull<SentryAndroidOptions>(),
5050
)
5151
)
52-
.thenReturn(LazyEvaluator { isAndroidXAvailable })
52+
.thenReturn(isAndroidXAvailable)
5353
whenever(
54-
loadClass.isClassAvailableLazy(
54+
loadClass.isClassAvailable(
5555
eq("androidx.lifecycle.Lifecycle"),
5656
anyOrNull<SentryAndroidOptions>(),
5757
)
5858
)
59-
.thenReturn(LazyEvaluator { isLifecycleAvailable })
59+
.thenReturn(isLifecycleAvailable)
6060
whenever(scopes.options).thenReturn(options)
6161
if (callback != null) {
6262
window.callback = callback

0 commit comments

Comments
 (0)