File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
sentry-android-core/src/main/java/io/sentry/android/core Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 17
17
import io .sentry .Hint ;
18
18
import io .sentry .SentryEvent ;
19
19
import io .sentry .SentryLevel ;
20
+ import io .sentry .util .HintUtils ;
20
21
import io .sentry .util .Objects ;
21
22
import java .io .ByteArrayOutputStream ;
22
23
import java .io .Closeable ;
@@ -51,10 +52,18 @@ public ScreenshotEventProcessor(
51
52
application .registerActivityLifecycleCallbacks (this );
52
53
}
53
54
55
+ public void setCurrentActivity (@ NonNull Activity activity ) {
56
+ if (currentActivity != null && currentActivity .get () == activity ) {
57
+ return ;
58
+ }
59
+ currentActivity = new WeakReference <>(activity );
60
+ }
61
+
54
62
@ SuppressWarnings ("NullAway" )
55
63
@ Override
56
64
public @ NotNull SentryEvent process (final @ NotNull SentryEvent event , @ NotNull Hint hint ) {
57
- if (!lifecycleCallbackInstalled ) {
65
+ if (!lifecycleCallbackInstalled
66
+ || !HintUtils .shouldApplyScopeData (hint )) {
58
67
return event ;
59
68
}
60
69
if (!options .isAttachScreenshot ()) {
@@ -167,13 +176,6 @@ private void cleanCurrentActivity(@NonNull Activity activity) {
167
176
}
168
177
}
169
178
170
- private void setCurrentActivity (@ NonNull Activity activity ) {
171
- if (currentActivity != null && currentActivity .get () == activity ) {
172
- return ;
173
- }
174
- currentActivity = new WeakReference <>(activity );
175
- }
176
-
177
179
@ SuppressLint ("NewApi" )
178
180
private boolean isActivityValid (@ Nullable Activity activity ) {
179
181
if (activity == null ) {
You can’t perform that action at this time.
0 commit comments