Skip to content

Commit 4d84ee6

Browse files
authored
Merge pull request #6796 from getsentry/ref/consolidate-vendored-code-v9
ref!: [Vendored Packages 1] Consolidate vendored code packages
2 parents c134f76 + 25ab45c commit 4d84ee6

85 files changed

Lines changed: 363 additions & 543 deletions

File tree

Some content is hidden

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

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
### Breaking Changes
1212

13+
- Move third-party-derived implementation classes to upstream-specific `io.sentry.vendor.*` packages. Code importing the old implementation packages must update its imports ([#6796](https://github.com/getsentry/sentry-java/pull/6796))
1314
- Android: Narrow the SDK's consumer keep rules, so R8 can optimize more of your app ([#6787](https://github.com/getsentry/sentry-java/pull/6787))
1415
- Members of `io.sentry` enums are no longer kept. Enum constants can be renamed or removed.
1516
- Only the name and no-arg constructor of `SentryAndroidOptions` are kept, instead of every member of every `SentryOptions` subclass.

‎THIRD_PARTY_NOTICES.md‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ limitations under the License.
142142

143143
### Scope
144144

145-
The Sentry Java SDK includes an adapted version of Square's Tape library, a file-based FIFO queue implementation used for reliable event storage. The code resides in the `io.sentry.cache.tape` package and includes `QueueFile`, `FileObjectQueue`, and `ObjectQueue`.
145+
The Sentry Java SDK includes an adapted version of Square's Tape library, a file-based FIFO queue implementation used for reliable event storage. The code resides in the `io.sentry.vendor.tape` package and includes `QueueFile`, `FileObjectQueue`, and `ObjectQueue`.
146146

147147
Upstream was archived on 2024-10-25 and is no longer maintained. This copy is maintained in-tree and has diverged from the linked commit: it recovers from file corruption by recreating the file, bounds the queue to a maximum number of elements, and supports optional buffered writes flushed by an explicit `sync()`.
148148

@@ -172,7 +172,7 @@ limitations under the License.
172172

173173
### Scope
174174

175-
The Sentry Java SDK includes an adapted version of Square's Seismic shake detection algorithm. The rolling sample window approach and `SampleQueue`/`SamplePool` data structures in `io.sentry.android.core.SentryShakeDetector` are based on Seismic's `ShakeDetector`.
175+
The Sentry Java SDK includes an adapted version of Square's Seismic shake detection algorithm. The rolling sample window approach and `SampleQueue`/`SamplePool` data structures in `io.sentry.vendor.seismic.ShakeDetector` are based on Seismic's `ShakeDetector`.
176176

177177
```
178178
Copyright 2010 Square, Inc.
@@ -200,7 +200,7 @@ limitations under the License.
200200

201201
### Scope
202202

203-
The Sentry Java SDK includes adapted versions of Square's Curtains library for null-safe `Window.Callback` handling and for tracking attached window roots. The code resides in `io.sentry.android.replay.util.FixedWindowCallback` and `io.sentry.android.replay.Windows`.
203+
The Sentry Java SDK includes adapted versions of Square's Curtains library for null-safe `Window.Callback` handling and for tracking attached window roots. The code resides in the `io.sentry.vendor.curtains` package.
204204

205205
```
206206
Copyright 2021 Square Inc.
@@ -228,7 +228,7 @@ limitations under the License.
228228

229229
### Scope
230230

231-
The Sentry Java SDK includes adapted versions of `CircularFifoQueue`, `SynchronizedCollection`, and `SynchronizedQueue` from Apache Commons Collections. The code resides in `io.sentry.CircularFifoQueue`, `io.sentry.SynchronizedCollection`, and `io.sentry.SynchronizedQueue`.
231+
The Sentry Java SDK includes adapted versions of `CircularFifoQueue`, `SynchronizedCollection`, and `SynchronizedQueue` from Apache Commons Collections. The code resides in the `io.sentry.vendor.commons.collections` package.
232232

233233
```
234234
Licensed to the Apache Software Foundation (ASF) under one or more
@@ -257,7 +257,7 @@ limitations under the License.
257257

258258
### Scope
259259

260-
The Sentry Java SDK includes an adapted version of `ReusableCountLatch` from the JavaFixes library for concurrent synchronization. The code resides in `io.sentry.transport.ReusableCountLatch`.
260+
The Sentry Java SDK includes an adapted version of `ReusableCountLatch` from the JavaFixes library for concurrent synchronization. The code resides in `io.sentry.vendor.javafixes.concurrent.ReusableCountLatch`.
261261

262262
```
263263
Copyright (C) 2016 Matej Tymes
@@ -285,7 +285,7 @@ limitations under the License.
285285

286286
### Scope
287287

288-
The Sentry Java SDK includes an adapted UUID generation implementation from the Dynamic-Datasource library. The code resides in `io.sentry.util.UUIDGenerator`.
288+
The Sentry Java SDK includes an adapted UUID generation implementation from the Dynamic-Datasource library. The code resides in `io.sentry.vendor.dynamicdatasource.UUIDGenerator`.
289289

290290
```
291291
Copyright © 2018 organization baomidou
@@ -313,7 +313,7 @@ limitations under the License.
313313

314314
### Scope
315315

316-
The Sentry Java SDK includes an adapted version of `FirstDrawDoneListener` from the Firebase Android SDK for detecting initial display time via `OnDrawListener`. The code resides in `io.sentry.android.core.internal.util.FirstDrawDoneListener`.
316+
The Sentry Java SDK includes an adapted version of `FirstDrawDoneListener` from the Firebase Android SDK for detecting initial display time via `OnDrawListener`. The code resides in `io.sentry.vendor.firebase.FirstDrawDoneListener`.
317317

318318
```
319319
Copyright 2022 Google LLC
@@ -341,7 +341,7 @@ limitations under the License.
341341

342342
### Scope
343343

344-
The Sentry Java SDK includes adapted thread state and stack trace parsing code from the Android Open Source Project's bugreport tools. The code resides in the `io.sentry.android.core.internal.threaddump` package and includes `ThreadDumpParser`, `Line`, and `Lines`.
344+
The Sentry Java SDK includes adapted thread state and stack trace parsing code from the Android Open Source Project's bugreport tools. The code resides in the `io.sentry.vendor.aosp.threaddump` package and includes `ThreadDumpParser`, `Line`, and `Lines`.
345345

346346
```
347347
Copyright (C) 2016 The Android Open Source Project
@@ -370,7 +370,7 @@ limitations under the License.
370370

371371
### Scope
372372

373-
The Sentry Android Replay SDK includes code adapted from Jetpack Compose UI, used to compute Compose node bounds while traversing the view hierarchy for masking. The code resides in `io.sentry.android.replay.util.Nodes`: the `boundsInWindow` extension function (a faster copy of `LayoutCoordinates.boundsInWindow`) and the `fastMinOf`, `fastMaxOf`, `fastCoerceIn`, `fastCoerceAtLeast`, and `fastCoerceAtMost` numeric helpers (copied from `androidx.compose.ui.util.MathHelpers`).
373+
The Sentry Android Replay SDK includes code adapted from Jetpack Compose UI, used to compute Compose node bounds while traversing the view hierarchy for masking. The code resides in `io.sentry.vendor.androidx.compose.BoundsInWindow`: the `boundsInWindow` extension function (a faster copy of `LayoutCoordinates.boundsInWindow`) and the `fastMinOf`, `fastMaxOf`, `fastCoerceIn`, `fastCoerceAtLeast`, and `fastCoerceAtMost` numeric helpers (copied from `androidx.compose.ui.util.MathHelpers`).
374374

375375
```
376376
Copyright (C) 2019, 2020 The Android Open Source Project
@@ -398,7 +398,7 @@ limitations under the License.
398398

399399
### Scope
400400

401-
The Sentry Java SDK build includes an adapted version of the AndroidX build's POM rewriting, which adds `<type>aar</type>` to dependencies on Android libraries in published POMs. The code resides in the build logic at `build-logic/src/main/kotlin/io/sentry/gradle/AarTypes.kt` and is not part of the published artifacts.
401+
The Sentry Java SDK build includes an adapted version of the AndroidX build's POM rewriting, which adds `<type>aar</type>` to dependencies on Android libraries in published POMs. The code resides in the build logic at `build-logic/src/main/kotlin/io/sentry/vendor/androidx/maven/AarTypes.kt` and is not part of the published artifacts.
402402

403403
```
404404
Copyright 2018 The Android Open Source Project
@@ -426,7 +426,7 @@ limitations under the License.
426426

427427
### Scope
428428

429-
The Sentry Java SDK includes an adapted version of `ThreadLocalContextStorage` from the OpenTelemetry Java SDK for thread-local context storage. The code resides in `io.sentry.opentelemetry.SentryOtelThreadLocalStorage`.
429+
The Sentry Java SDK includes an adapted version of `ThreadLocalContextStorage` from the OpenTelemetry Java SDK for thread-local context storage. The code resides in `io.sentry.vendor.opentelemetry.SentryOtelThreadLocalStorage`.
430430

431431
```
432432
Copyright The OpenTelemetry Authors
@@ -455,7 +455,7 @@ limitations under the License.
455455

456456
### Scope
457457

458-
The Sentry Java SDK includes an adapted version of the ANR-WatchDog library for Application Not Responding (ANR) detection on Android. The code resides in `io.sentry.android.core.ANRWatchDog` and `io.sentry.android.core.ApplicationNotResponding` (adapted from `ANRError`).
458+
The Sentry Java SDK includes an adapted version of the ANR-WatchDog library for Application Not Responding (ANR) detection on Android. The code resides in `io.sentry.vendor.anrwatchdog.ANRWatchDog` and `io.sentry.android.core.ApplicationNotResponding` (adapted from `ANRError`).
459459

460460
```
461461
MIT License
@@ -490,7 +490,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
490490

491491
### Scope
492492

493-
The Sentry Java SDK includes an adapted root detection implementation from the Ravencoin Android wallet (originally from breadwallet). The code resides in `io.sentry.android.core.internal.util.RootChecker`.
493+
The Sentry Java SDK includes an adapted root detection implementation from the Ravencoin Android wallet (originally from breadwallet). The code resides in `io.sentry.vendor.breadwallet.RootChecker`.
494494

495495
```
496496
MIT License
@@ -526,7 +526,7 @@ THE SOFTWARE.
526526

527527
### Scope
528528

529-
The Sentry Java SDK includes an adapted PCG-based random number generator from the pcg-java library for fast sampling. The code resides in `io.sentry.util.Random`.
529+
The Sentry Java SDK includes an adapted PCG-based random number generator from the pcg-java library for fast sampling. The code resides in `io.sentry.vendor.pcg.Random`.
530530

531531
```
532532
MIT License
@@ -562,7 +562,7 @@ SOFTWARE.
562562

563563
### Scope
564564

565-
The Sentry Java SDK includes adapted UUID string manipulation utilities. The code resides in `io.sentry.util.UUIDStringUtils`.
565+
The Sentry Java SDK includes adapted UUID string manipulation utilities. The code resides in `io.sentry.vendor.fastuuid.UUIDStringUtils`.
566566

567567
```
568568
MIT License
@@ -598,7 +598,7 @@ SOFTWARE.
598598

599599
### Scope
600600

601-
The Sentry Android Replay SDK includes adapted versions of the video encoding and muxing classes from the flutter_screen_recorder library, used to encode and mux replay video frames into an MP4 file. The code resides in the `io.sentry.android.replay.video` package and includes `SimpleFrameMuxer`, `SimpleMp4FrameMuxer`, and `SimpleVideoEncoder`.
601+
The Sentry Android Replay SDK includes adapted versions of the video encoding and muxing classes from the flutter_screen_recorder library, used to encode and mux replay video frames into an MP4 file. The code resides in the `io.sentry.vendor.flutterscreenrecorder` package and includes `SimpleFrameMuxer`, `SimpleMp4FrameMuxer`, and `SimpleVideoEncoder`.
602602

603603
```
604604
Copyright (c) 2021 fzyzcjy
Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,7 @@
1-
/*
2-
* Adapted from https://github.com/androidx/androidx/blob/c799cba927a71f01ea6b421a8f83c181682633fb/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt#L524-L549
3-
*
4-
* Copyright 2018 The Android Open Source Project
5-
*
6-
* Licensed under the Apache License, Version 2.0 (the "License");
7-
* you may not use this file except in compliance with the License.
8-
* You may obtain a copy of the License at
9-
*
10-
* http://www.apache.org/licenses/LICENSE-2.0
11-
*
12-
* Unless required by applicable law or agreed to in writing, software
13-
* distributed under the License is distributed on an "AS IS" BASIS,
14-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15-
* See the License for the specific language governing permissions and
16-
* limitations under the License.
17-
*/
18-
191
package io.sentry.gradle
202

213
import com.vanniktech.maven.publish.MavenPublishBaseExtension
22-
import groovy.util.Node
4+
import io.sentry.vendor.androidx.maven.assignAarTypes
235

246
private val androidLibs =
257
setOf(
@@ -39,32 +21,5 @@ private val androidXLibs = listOf("androidx.core:core")
3921

4022
// Workaround for https://github.com/gradle/gradle/issues/3170
4123
fun MavenPublishBaseExtension.assignAarTypes() {
42-
pom {
43-
withXml {
44-
val dependencies =
45-
asNode().children().find { it is Node && it.name().toString().endsWith("dependencies") }
46-
as Node?
47-
48-
dependencies?.children()?.forEach { dep ->
49-
if (dep !is Node) {
50-
return@forEach
51-
}
52-
val group =
53-
dep.children().firstOrNull { it is Node && it.name().toString().endsWith("groupId") }
54-
as? Node
55-
val groupValue = group?.children()?.firstOrNull() as? String
56-
57-
val artifactId =
58-
dep.children().firstOrNull { it is Node && it.name().toString().endsWith("artifactId") }
59-
as? Node
60-
val artifactIdValue = artifactId?.children()?.firstOrNull() as? String
61-
62-
if (artifactIdValue in androidLibs) {
63-
dep.appendNode("type", "aar")
64-
} else if ("$groupValue:$artifactIdValue" in androidXLibs) {
65-
dep.appendNode("type", "aar")
66-
}
67-
}
68-
}
69-
}
24+
pom { withXml { asNode().assignAarTypes(androidLibs, androidXLibs) } }
7025
}

‎build-logic/src/main/kotlin/io/sentry/gradle/SentryApiValidationPlugin.kt‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ class SentryApiValidationPlugin : Plugin<Project> {
3535
kotlin.abiValidation {
3636
filters {
3737
// Lazy, because the module configures the extension after this plugin has been applied.
38-
exclude { byNames.addAll(extension.ignoredPackages.map { it.map { pkg -> "$pkg.**" } }) }
38+
exclude {
39+
byNames.add("io.sentry.vendor.**")
40+
byNames.addAll(extension.ignoredPackages.map { it.map { pkg -> "$pkg.**" } })
41+
}
3942
}
4043
}
4144
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Adapted from https://github.com/androidx/androidx/blob/c799cba927a71f01ea6b421a8f83c181682633fb/buildSrc/private/src/main/kotlin/androidx/build/MavenUploadHelper.kt#L524-L549
3+
*
4+
* Copyright 2018 The Android Open Source Project
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package io.sentry.vendor.androidx.maven
19+
20+
import groovy.util.Node
21+
22+
internal fun Node.assignAarTypes(androidLibs: Set<String>, androidXLibs: List<String>) {
23+
val dependencies =
24+
children().find { it is Node && it.name().toString().endsWith("dependencies") } as Node?
25+
26+
dependencies?.children()?.forEach { dep ->
27+
if (dep !is Node) {
28+
return@forEach
29+
}
30+
val group =
31+
dep.children().firstOrNull { it is Node && it.name().toString().endsWith("groupId") } as? Node
32+
val groupValue = group?.children()?.firstOrNull() as? String
33+
34+
val artifactId =
35+
dep.children().firstOrNull { it is Node && it.name().toString().endsWith("artifactId") }
36+
as? Node
37+
val artifactIdValue = artifactId?.children()?.firstOrNull() as? String
38+
39+
if (artifactIdValue in androidLibs) {
40+
dep.appendNode("type", "aar")
41+
} else if ("$groupValue:$artifactIdValue" in androidXLibs) {
42+
dep.appendNode("type", "aar")
43+
}
44+
}
45+
}

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

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,13 @@ public final class io/sentry/android/core/InternalSentrySdk {
325325
public static fun updateSessionForDroppedEventNonTerminating (Z)V
326326
}
327327

328+
public final class io/sentry/android/core/MainLooperHandler {
329+
public fun <init> ()V
330+
public fun <init> (Landroid/os/Looper;)V
331+
public fun getThread ()Ljava/lang/Thread;
332+
public fun post (Ljava/lang/Runnable;)V
333+
}
334+
328335
public final class io/sentry/android/core/MemoryLimiterIntegration : io/sentry/Integration, java/io/Closeable {
329336
public fun <init> (Landroid/content/Context;Lio/sentry/android/core/BuildInfoProvider;)V
330337
public fun close ()V
@@ -555,19 +562,6 @@ public final class io/sentry/android/core/SentryScreenshotOptions : io/sentry/Se
555562
public fun trackCustomMasking ()V
556563
}
557564

558-
public final class io/sentry/android/core/SentryShakeDetector : android/hardware/SensorEventListener {
559-
public fun <init> (Lio/sentry/ILogger;)V
560-
public fun close ()V
561-
public fun onAccuracyChanged (Landroid/hardware/Sensor;I)V
562-
public fun onSensorChanged (Landroid/hardware/SensorEvent;)V
563-
public fun start (Landroid/content/Context;Lio/sentry/android/core/SentryShakeDetector$Listener;)V
564-
public fun stop ()V
565-
}
566-
567-
public abstract interface class io/sentry/android/core/SentryShakeDetector$Listener {
568-
public abstract fun onShake ()V
569-
}
570-
571565
public final class io/sentry/android/core/SentryUserFeedbackForm : android/app/Dialog {
572566
public fun onDetachedFromWindow ()V
573567
public fun setCancelable (Z)V

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import io.sentry.TransactionContext;
3131
import io.sentry.TransactionOptions;
3232
import io.sentry.android.core.internal.util.ClassUtil;
33-
import io.sentry.android.core.internal.util.FirstDrawDoneListener;
3433
import io.sentry.android.core.performance.ActivityLifecycleSpanHelper;
3534
import io.sentry.android.core.performance.AppStartMetrics;
3635
import io.sentry.android.core.performance.TimeSpan;
@@ -40,6 +39,7 @@
4039
import io.sentry.util.AutoClosableReentrantLock;
4140
import io.sentry.util.Objects;
4241
import io.sentry.util.TracingUtils;
42+
import io.sentry.vendor.firebase.FirstDrawDoneListener;
4343
import java.io.Closeable;
4444
import java.io.IOException;
4545
import java.util.Collections;

‎sentry-android-core/src/main/java/io/sentry/android/core/AnrIntegration.java‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import io.sentry.util.AutoClosableReentrantLock;
1919
import io.sentry.util.HintUtils;
2020
import io.sentry.util.Objects;
21+
import io.sentry.vendor.anrwatchdog.ANRWatchDog;
2122
import java.io.Closeable;
2223
import java.io.IOException;
2324
import org.jetbrains.annotations.NotNull;
@@ -94,7 +95,11 @@ private void startAnrWatchdog(
9495
options.getAnrTimeoutIntervalMillis());
9596

9697
anrWatchDog =
97-
ANRWatchDog.create(options, error -> reportANR(scopes, options, error), context);
98+
ANRWatchDog.create(
99+
options,
100+
(message, thread) ->
101+
reportANR(scopes, options, new ApplicationNotResponding(message, thread)),
102+
context);
98103
anrWatchDog.start();
99104

100105
options.getLogger().log(SentryLevel.DEBUG, "AnrIntegration installed.");

‎sentry-android-core/src/main/java/io/sentry/android/core/AnrV2Integration.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
import io.sentry.SentryLevel;
1717
import io.sentry.SentryOptions;
1818
import io.sentry.android.core.cache.AndroidEnvelopeCache;
19-
import io.sentry.android.core.internal.threaddump.Lines;
20-
import io.sentry.android.core.internal.threaddump.ThreadDumpParser;
2119
import io.sentry.android.core.internal.util.NativeEventUtils;
2220
import io.sentry.hints.AbnormalExit;
2321
import io.sentry.hints.Backfillable;
@@ -31,6 +29,8 @@
3129
import io.sentry.util.ExceptionUtils;
3230
import io.sentry.util.HintUtils;
3331
import io.sentry.util.Objects;
32+
import io.sentry.vendor.aosp.threaddump.Lines;
33+
import io.sentry.vendor.aosp.threaddump.ThreadDumpParser;
3434
import java.io.BufferedReader;
3535
import java.io.ByteArrayInputStream;
3636
import java.io.Closeable;

‎sentry-android-core/src/main/java/io/sentry/android/core/DeviceInfoUtil.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
import io.sentry.android.core.internal.util.CpuInfoUtils;
2323
import io.sentry.android.core.internal.util.DeviceOrientations;
2424
import io.sentry.android.core.internal.util.NetworkConnection;
25-
import io.sentry.android.core.internal.util.RootChecker;
2625
import io.sentry.protocol.Device;
2726
import io.sentry.protocol.OperatingSystem;
2827
import io.sentry.util.ExceptionUtils;
28+
import io.sentry.vendor.breadwallet.RootChecker;
2929
import java.io.File;
3030
import java.util.Calendar;
3131
import java.util.Collections;

0 commit comments

Comments
 (0)