|
54 | 54 | import io.sentry.protocol.SentryTransaction;
|
55 | 55 | import io.sentry.protocol.User;
|
56 | 56 | import io.sentry.util.HintUtils;
|
57 |
| -import io.sentry.util.Random; |
| 57 | +import io.sentry.util.SentryRandom; |
58 | 58 | import java.io.File;
|
59 | 59 | import java.util.ArrayList;
|
60 | 60 | import java.util.Arrays;
|
@@ -83,24 +83,13 @@ public final class AnrV2EventProcessor implements BackfillingEventProcessor {
|
83 | 83 |
|
84 | 84 | private final @NotNull SentryExceptionFactory sentryExceptionFactory;
|
85 | 85 |
|
86 |
| - private final @Nullable Random random; |
87 |
| - |
88 | 86 | public AnrV2EventProcessor(
|
89 | 87 | final @NotNull Context context,
|
90 | 88 | final @NotNull SentryAndroidOptions options,
|
91 | 89 | final @NotNull BuildInfoProvider buildInfoProvider) {
|
92 |
| - this(context, options, buildInfoProvider, null); |
93 |
| - } |
94 |
| - |
95 |
| - AnrV2EventProcessor( |
96 |
| - final @NotNull Context context, |
97 |
| - final @NotNull SentryAndroidOptions options, |
98 |
| - final @NotNull BuildInfoProvider buildInfoProvider, |
99 |
| - final @Nullable Random random) { |
100 | 90 | this.context = ContextUtils.getApplicationContext(context);
|
101 | 91 | this.options = options;
|
102 | 92 | this.buildInfoProvider = buildInfoProvider;
|
103 |
| - this.random = random; |
104 | 93 |
|
105 | 94 | final SentryStackTraceFactory sentryStackTraceFactory =
|
106 | 95 | new SentryStackTraceFactory(this.options);
|
@@ -180,9 +169,8 @@ private boolean sampleReplay(final @NotNull SentryEvent event) {
|
180 | 169 |
|
181 | 170 | try {
|
182 | 171 | // we have to sample here with the old sample rate, because it may change between app launches
|
183 |
| - final @NotNull Random random = this.random != null ? this.random : new Random(); |
184 | 172 | final double replayErrorSampleRateDouble = Double.parseDouble(replayErrorSampleRate);
|
185 |
| - if (replayErrorSampleRateDouble < random.nextDouble()) { |
| 173 | + if (replayErrorSampleRateDouble < SentryRandom.current().nextDouble()) { |
186 | 174 | options
|
187 | 175 | .getLogger()
|
188 | 176 | .log(
|
|
0 commit comments