Skip to content

Commit 3e1e45b

Browse files
authored
Merge 4efa6f7 into f1fdb9f
2 parents f1fdb9f + 4efa6f7 commit 3e1e45b

File tree

353 files changed

+10915
-4787
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

353 files changed

+10915
-4787
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Features
6+
7+
- Report exceptions returned by Throwable.getSuppressed() to Sentry as exception groups ([#3396] https://github.com/getsentry/sentry-java/pull/3396)
8+
39
## 7.9.0
410

511
### Features

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ allprojects {
9999
dependsOn("cleanTest")
100100
}
101101
withType<JavaCompile> {
102-
options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing"))
102+
options.compilerArgs.addAll(arrayOf("-Xlint:all", "-Werror", "-Xlint:-classfile", "-Xlint:-processing", "-Xlint:-try"))
103103
}
104104
}
105105
}

sentry-android-core/api/sentry-android-core.api

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public final class io/sentry/android/core/ActivityBreadcrumbsIntegration : andro
88
public fun onActivitySaveInstanceState (Landroid/app/Activity;Landroid/os/Bundle;)V
99
public fun onActivityStarted (Landroid/app/Activity;)V
1010
public fun onActivityStopped (Landroid/app/Activity;)V
11-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
11+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
1212
}
1313

1414
public final class io/sentry/android/core/ActivityFramesTracker {
@@ -33,7 +33,7 @@ public final class io/sentry/android/core/ActivityLifecycleIntegration : android
3333
public fun onActivitySaveInstanceState (Landroid/app/Activity;Landroid/os/Bundle;)V
3434
public fun onActivityStarted (Landroid/app/Activity;)V
3535
public fun onActivityStopped (Landroid/app/Activity;)V
36-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
36+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
3737
}
3838

3939
public final class io/sentry/android/core/AndroidCpuCollector : io/sentry/IPerformanceSnapshotCollector {
@@ -87,7 +87,7 @@ public class io/sentry/android/core/AndroidProfiler$ProfileStartData {
8787
public final class io/sentry/android/core/AnrIntegration : io/sentry/Integration, java/io/Closeable {
8888
public fun <init> (Landroid/content/Context;)V
8989
public fun close ()V
90-
public final fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
90+
public final fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
9191
}
9292

9393
public final class io/sentry/android/core/AnrIntegrationFactory {
@@ -97,14 +97,15 @@ public final class io/sentry/android/core/AnrIntegrationFactory {
9797

9898
public final class io/sentry/android/core/AnrV2EventProcessor : io/sentry/BackfillingEventProcessor {
9999
public fun <init> (Landroid/content/Context;Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;)V
100+
public fun getOrder ()Ljava/lang/Long;
100101
public fun process (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent;
101102
public fun process (Lio/sentry/protocol/SentryTransaction;Lio/sentry/Hint;)Lio/sentry/protocol/SentryTransaction;
102103
}
103104

104105
public class io/sentry/android/core/AnrV2Integration : io/sentry/Integration, java/io/Closeable {
105106
public fun <init> (Landroid/content/Context;)V
106107
public fun close ()V
107-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
108+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
108109
}
109110

110111
public final class io/sentry/android/core/AnrV2Integration$AnrV2Hint : io/sentry/hints/BlockingFlushHint, io/sentry/hints/AbnormalExit, io/sentry/hints/Backfillable {
@@ -123,13 +124,13 @@ public final class io/sentry/android/core/AppComponentsBreadcrumbsIntegration :
123124
public fun onConfigurationChanged (Landroid/content/res/Configuration;)V
124125
public fun onLowMemory ()V
125126
public fun onTrimMemory (I)V
126-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
127+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
127128
}
128129

129130
public final class io/sentry/android/core/AppLifecycleIntegration : io/sentry/Integration, java/io/Closeable {
130131
public fun <init> ()V
131132
public fun close ()V
132-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
133+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
133134
}
134135

135136
public final class io/sentry/android/core/AppState {
@@ -177,7 +178,7 @@ public final class io/sentry/android/core/CurrentActivityIntegration : android/a
177178
public fun onActivitySaveInstanceState (Landroid/app/Activity;Landroid/os/Bundle;)V
178179
public fun onActivityStarted (Landroid/app/Activity;)V
179180
public fun onActivityStopped (Landroid/app/Activity;)V
180-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
181+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
181182
}
182183

183184
public final class io/sentry/android/core/DeviceInfoUtil {
@@ -193,7 +194,7 @@ public abstract class io/sentry/android/core/EnvelopeFileObserverIntegration : i
193194
public fun <init> ()V
194195
public fun close ()V
195196
public static fun getOutboxFileObserver ()Lio/sentry/android/core/EnvelopeFileObserverIntegration;
196-
public final fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
197+
public final fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
197198
}
198199

199200
public abstract interface class io/sentry/android/core/IDebugImagesLoader {
@@ -219,23 +220,24 @@ public final class io/sentry/android/core/NdkIntegration : io/sentry/Integration
219220
public static final field SENTRY_NDK_CLASS_NAME Ljava/lang/String;
220221
public fun <init> (Ljava/lang/Class;)V
221222
public fun close ()V
222-
public final fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
223+
public final fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
223224
}
224225

225226
public final class io/sentry/android/core/NetworkBreadcrumbsIntegration : io/sentry/Integration, java/io/Closeable {
226227
public fun <init> (Landroid/content/Context;Lio/sentry/android/core/BuildInfoProvider;Lio/sentry/ILogger;)V
227228
public fun close ()V
228-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
229+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
229230
}
230231

231232
public final class io/sentry/android/core/PhoneStateBreadcrumbsIntegration : io/sentry/Integration, java/io/Closeable {
232233
public fun <init> (Landroid/content/Context;)V
233234
public fun close ()V
234-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
235+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
235236
}
236237

237238
public final class io/sentry/android/core/ScreenshotEventProcessor : io/sentry/EventProcessor {
238239
public fun <init> (Lio/sentry/android/core/SentryAndroidOptions;Lio/sentry/android/core/BuildInfoProvider;)V
240+
public fun getOrder ()Ljava/lang/Long;
239241
public fun process (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent;
240242
public fun process (Lio/sentry/protocol/SentryTransaction;Lio/sentry/Hint;)Lio/sentry/protocol/SentryTransaction;
241243
}
@@ -360,15 +362,15 @@ public final class io/sentry/android/core/SystemEventsBreadcrumbsIntegration : i
360362
public fun <init> (Landroid/content/Context;)V
361363
public fun <init> (Landroid/content/Context;Ljava/util/List;)V
362364
public fun close ()V
363-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
365+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
364366
}
365367

366368
public final class io/sentry/android/core/TempSensorBreadcrumbsIntegration : android/hardware/SensorEventListener, io/sentry/Integration, java/io/Closeable {
367369
public fun <init> (Landroid/content/Context;)V
368370
public fun close ()V
369371
public fun onAccuracyChanged (Landroid/hardware/Sensor;I)V
370372
public fun onSensorChanged (Landroid/hardware/SensorEvent;)V
371-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
373+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
372374
}
373375

374376
public final class io/sentry/android/core/UserInteractionIntegration : android/app/Application$ActivityLifecycleCallbacks, io/sentry/Integration, java/io/Closeable {
@@ -381,11 +383,12 @@ public final class io/sentry/android/core/UserInteractionIntegration : android/a
381383
public fun onActivitySaveInstanceState (Landroid/app/Activity;Landroid/os/Bundle;)V
382384
public fun onActivityStarted (Landroid/app/Activity;)V
383385
public fun onActivityStopped (Landroid/app/Activity;)V
384-
public fun register (Lio/sentry/IHub;Lio/sentry/SentryOptions;)V
386+
public fun register (Lio/sentry/IScopes;Lio/sentry/SentryOptions;)V
385387
}
386388

387389
public final class io/sentry/android/core/ViewHierarchyEventProcessor : io/sentry/EventProcessor {
388390
public fun <init> (Lio/sentry/android/core/SentryAndroidOptions;)V
391+
public fun getOrder ()Ljava/lang/Long;
389392
public fun process (Lio/sentry/SentryEvent;Lio/sentry/Hint;)Lio/sentry/SentryEvent;
390393
public fun process (Lio/sentry/protocol/SentryTransaction;Lio/sentry/Hint;)Lio/sentry/protocol/SentryTransaction;
391394
public static fun snapshotViewHierarchy (Landroid/app/Activity;Lio/sentry/ILogger;)Lio/sentry/protocol/ViewHierarchy;

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import android.os.Bundle;
99
import io.sentry.Breadcrumb;
1010
import io.sentry.Hint;
11-
import io.sentry.IHub;
11+
import io.sentry.IScopes;
1212
import io.sentry.Integration;
1313
import io.sentry.SentryLevel;
1414
import io.sentry.SentryOptions;
@@ -23,21 +23,21 @@ public final class ActivityBreadcrumbsIntegration
2323
implements Integration, Closeable, Application.ActivityLifecycleCallbacks {
2424

2525
private final @NotNull Application application;
26-
private @Nullable IHub hub;
26+
private @Nullable IScopes scopes;
2727
private boolean enabled;
2828

2929
public ActivityBreadcrumbsIntegration(final @NotNull Application application) {
3030
this.application = Objects.requireNonNull(application, "Application is required");
3131
}
3232

3333
@Override
34-
public void register(final @NotNull IHub hub, final @NotNull SentryOptions options) {
34+
public void register(final @NotNull IScopes scopes, final @NotNull SentryOptions options) {
3535
final SentryAndroidOptions androidOptions =
3636
Objects.requireNonNull(
3737
(options instanceof SentryAndroidOptions) ? (SentryAndroidOptions) options : null,
3838
"SentryAndroidOptions is required");
3939

40-
this.hub = Objects.requireNonNull(hub, "Hub is required");
40+
this.scopes = Objects.requireNonNull(scopes, "Scopes are required");
4141
this.enabled = androidOptions.isEnableActivityLifecycleBreadcrumbs();
4242
options
4343
.getLogger()
@@ -54,8 +54,9 @@ public void register(final @NotNull IHub hub, final @NotNull SentryOptions optio
5454
public void close() throws IOException {
5555
if (enabled) {
5656
application.unregisterActivityLifecycleCallbacks(this);
57-
if (hub != null) {
58-
hub.getOptions()
57+
if (scopes != null) {
58+
scopes
59+
.getOptions()
5960
.getLogger()
6061
.log(SentryLevel.DEBUG, "ActivityBreadcrumbsIntegration removed.");
6162
}
@@ -100,7 +101,7 @@ public synchronized void onActivityDestroyed(final @NotNull Activity activity) {
100101
}
101102

102103
private void addBreadcrumb(final @NotNull Activity activity, final @NotNull String state) {
103-
if (hub == null) {
104+
if (scopes == null) {
104105
return;
105106
}
106107

@@ -114,7 +115,7 @@ private void addBreadcrumb(final @NotNull Activity activity, final @NotNull Stri
114115
final Hint hint = new Hint();
115116
hint.set(ANDROID_ACTIVITY, activity);
116117

117-
hub.addBreadcrumb(breadcrumb, hint);
118+
scopes.addBreadcrumb(breadcrumb, hint);
118119
}
119120

120121
private @NotNull String getActivityName(final @NotNull Activity activity) {

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import android.view.View;
1313
import androidx.annotation.NonNull;
1414
import io.sentry.FullyDisplayedReporter;
15-
import io.sentry.IHub;
1615
import io.sentry.IScope;
16+
import io.sentry.IScopes;
1717
import io.sentry.ISpan;
1818
import io.sentry.ITransaction;
1919
import io.sentry.Instrumenter;
@@ -60,7 +60,7 @@ public final class ActivityLifecycleIntegration
6060

6161
private final @NotNull Application application;
6262
private final @NotNull BuildInfoProvider buildInfoProvider;
63-
private @Nullable IHub hub;
63+
private @Nullable IScopes scopes;
6464
private @Nullable SentryAndroidOptions options;
6565

6666
private boolean performanceEnabled = false;
@@ -102,13 +102,13 @@ public ActivityLifecycleIntegration(
102102
}
103103

104104
@Override
105-
public void register(final @NotNull IHub hub, final @NotNull SentryOptions options) {
105+
public void register(final @NotNull IScopes scopes, final @NotNull SentryOptions options) {
106106
this.options =
107107
Objects.requireNonNull(
108108
(options instanceof SentryAndroidOptions) ? (SentryAndroidOptions) options : null,
109109
"SentryAndroidOptions is required");
110110

111-
this.hub = Objects.requireNonNull(hub, "Hub is required");
111+
this.scopes = Objects.requireNonNull(scopes, "Scopes are required");
112112

113113
performanceEnabled = isPerformanceEnabled(this.options);
114114
fullyDisplayedReporter = this.options.getFullyDisplayedReporter();
@@ -150,10 +150,10 @@ private void stopPreviousTransactions() {
150150

151151
private void startTracing(final @NotNull Activity activity) {
152152
WeakReference<Activity> weakActivity = new WeakReference<>(activity);
153-
if (hub != null && !isRunningTransactionOrTrace(activity)) {
153+
if (scopes != null && !isRunningTransactionOrTrace(activity)) {
154154
if (!performanceEnabled) {
155155
activitiesWithOngoingTransactions.put(activity, NoOpTransaction.getInstance());
156-
TracingUtils.startNewTrace(hub);
156+
TracingUtils.startNewTrace(scopes);
157157
} else {
158158
// as we allow a single transaction running on the bound Scope, we finish the previous ones
159159
stopPreviousTransactions();
@@ -225,7 +225,7 @@ private void startTracing(final @NotNull Activity activity) {
225225

226226
// we can only bind to the scope if there's no running transaction
227227
ITransaction transaction =
228-
hub.startTransaction(
228+
scopes.startTransaction(
229229
new TransactionContext(
230230
activityName,
231231
TransactionNameSource.COMPONENT,
@@ -278,7 +278,7 @@ private void startTracing(final @NotNull Activity activity) {
278278
}
279279

280280
// lets bind to the scope so other integrations can pick it up
281-
hub.configureScope(
281+
scopes.configureScope(
282282
scope -> {
283283
applyScope(scope, transaction);
284284
});
@@ -356,10 +356,10 @@ private void finishTransaction(
356356
status = SpanStatus.OK;
357357
}
358358
transaction.finish(status);
359-
if (hub != null) {
359+
if (scopes != null) {
360360
// make sure to remove the transaction from scope, as it may contain running children,
361361
// therefore `finish` method will not remove it from scope
362-
hub.configureScope(
362+
scopes.configureScope(
363363
scope -> {
364364
clearScope(scope, transaction);
365365
});
@@ -371,9 +371,9 @@ private void finishTransaction(
371371
public synchronized void onActivityCreated(
372372
final @NotNull Activity activity, final @Nullable Bundle savedInstanceState) {
373373
setColdStart(savedInstanceState);
374-
if (hub != null) {
374+
if (scopes != null) {
375375
final @Nullable String activityClassName = ClassUtil.getClassName(activity);
376-
hub.configureScope(scope -> scope.setScreen(activityClassName));
376+
scopes.configureScope(scope -> scope.setScreen(activityClassName));
377377
}
378378
startTracing(activity);
379379
final @Nullable ISpan ttfdSpan = ttfdSpanMap.get(activity);
@@ -429,10 +429,10 @@ public void onActivityPrePaused(@NonNull Activity activity) {
429429
// well
430430
// this ensures any newly launched activity will not use the app start timestamp as txn start
431431
firstActivityCreated = true;
432-
if (hub == null) {
432+
if (scopes == null) {
433433
lastPausedTime = AndroidDateUtils.getCurrentSentryDateTime();
434434
} else {
435-
lastPausedTime = hub.getOptions().getDateProvider().now();
435+
lastPausedTime = scopes.getOptions().getDateProvider().now();
436436
}
437437
}
438438
}
@@ -445,10 +445,10 @@ public synchronized void onActivityPaused(final @NotNull Activity activity) {
445445
// well
446446
// this ensures any newly launched activity will not use the app start timestamp as txn start
447447
firstActivityCreated = true;
448-
if (hub == null) {
448+
if (scopes == null) {
449449
lastPausedTime = AndroidDateUtils.getCurrentSentryDateTime();
450450
} else {
451-
lastPausedTime = hub.getOptions().getDateProvider().now();
451+
lastPausedTime = scopes.getOptions().getDateProvider().now();
452452
}
453453
}
454454
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import io.sentry.ILogger;
1111
import io.sentry.ITransactionProfiler;
1212
import io.sentry.NoOpConnectionStatusProvider;
13+
import io.sentry.ScopeType;
1314
import io.sentry.SendFireAndForgetEnvelopeSender;
1415
import io.sentry.SendFireAndForgetOutboxSender;
1516
import io.sentry.SentryLevel;
@@ -98,6 +99,8 @@ static void loadDefaultAndMetadataOptions(
9899
// Firstly set the logger, if `debug=true` configured, logging can start asap.
99100
options.setLogger(logger);
100101

102+
options.setDefaultScopeType(ScopeType.CURRENT);
103+
101104
options.setDateProvider(new SentryAndroidDateProvider());
102105

103106
// set a lower flush timeout on Android to avoid ANRs

0 commit comments

Comments
 (0)