Skip to content

Commit 4b757b8

Browse files
authored
Merge branch 'main' into feat/feature-flags-on-scope
2 parents 0ab241e + b77456b commit 4b757b8

File tree

67 files changed

+2353
-310
lines changed

Some content is hidden

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

67 files changed

+2353
-310
lines changed

.craft.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ targets:
3434
maven:io.sentry:sentry-apache-http-client-5:
3535
maven:io.sentry:sentry-android:
3636
maven:io.sentry:sentry-android-core:
37+
maven:io.sentry:sentry-android-distribution:
3738
maven:io.sentry:sentry-android-ndk:
3839
maven:io.sentry:sentry-android-timber:
3940
maven:io.sentry:sentry-kotlin-extensions:

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
3737

3838
- name: Initialize CodeQL
39-
uses: github/codeql-action/init@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # pin@v2
39+
uses: github/codeql-action/init@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # pin@v2
4040
with:
4141
languages: 'java'
4242

@@ -45,4 +45,4 @@ jobs:
4545
./gradlew buildForCodeQL --no-build-cache
4646
4747
- name: Perform CodeQL Analysis
48-
uses: github/codeql-action/analyze@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # pin@v2
48+
uses: github/codeql-action/analyze@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # pin@v2

.github/workflows/danger.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ name: Danger
22

33
on:
44
pull_request:
5-
types: [opened, synchronize, reopened, edited, ready_for_review]
5+
types: [opened, synchronize, reopened, edited, ready_for_review, labeled, unlabeled]
66

77
jobs:
88
danger:
9-
uses: getsentry/github-workflows/.github/workflows/danger.yml@v2
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: getsentry/github-workflows/danger@v3

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,41 @@
22

33
## Unreleased
44

5+
### Features
6+
7+
- Attach MDC properties to logs as attributes ([#4786](https://github.com/getsentry/sentry-java/pull/4786))
8+
- MDC properties set using supported logging frameworks (Logback, Log4j2, java.util.Logging) are now attached to structured logs as attributes.
9+
- The attribute reflected on the log is `mdc.<key>`, where `<key>` is the original key in the MDC.
10+
- This means that you will be able to filter/aggregate logs in the product based on these properties.
11+
- Only properties with keys matching the configured `contextTags` are sent as log attributes.
12+
- You can configure which properties are sent using `options.setContextTags` if initalizing manually, or by specifying a comma-separated list of keys with a `context-tags` entry in `sentry.properties` or `sentry.context-tags` in `application.properties`.
13+
- Note that keys containing spaces are not supported.
14+
- Add experimental Sentry Android Distribution module for integrating with Sentry Build Distribution to check for and install updates ([#4804](https://github.com/getsentry/sentry-java/pull/4804))
15+
- Allow passing a different `Handler` to `SystemEventsBreadcrumbsIntegration` and `AndroidConnectionStatusProvider` so their callbacks are deliver to that handler ([#4808](https://github.com/getsentry/sentry-java/pull/4808))
16+
- Session Replay: Add new _experimental_ Canvas Capture Strategy ([#4777](https://github.com/getsentry/sentry-java/pull/4777))
17+
- A new screenshot capture strategy that uses Android's Canvas API for more accurate and reliable text and image masking
18+
- Any `.drawText()` or `.drawBitmap()` calls are replaced by rectangles, ensuring no text or images are present in the resulting output
19+
- Note: If this strategy is used, all text and images will be masked, regardless of any masking configuration
20+
- To enable this feature, set the `screenshotStrategy`, either via code:
21+
```kotlin
22+
SentryAndroid.init(context) { options ->
23+
options.sessionReplay.screenshotStrategy = ScreenshotStrategyType.CANVAS
24+
}
25+
```
26+
or AndroidManifest.xml:
27+
```xml
28+
<application>
29+
<meta-data android:name="io.sentry.session-replay.screenshot-strategy" android:value="canvas" />
30+
</application>
31+
```
32+
533
### Fixes
634

35+
- Avoid StrictMode warnings ([#4724](https://github.com/getsentry/sentry-java/pull/4724))
736
- Use logger from options for JVM profiler ([#4771](https://github.com/getsentry/sentry-java/pull/4771))
37+
- Session Replay: Avoid deadlock when pausing replay if no connection ([#4788](https://github.com/getsentry/sentry-java/pull/4788))
38+
- Session Replay: Fix capturing roots with no windows ([#4805](https://github.com/getsentry/sentry-java/pull/4805))
39+
- Session Replay: Fix `java.lang.IllegalArgumentException: width and height must be > 0` ([#4805](https://github.com/getsentry/sentry-java/pull/4805))
840

941
### Miscellaneous
1042

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Sentry SDK for Java and Android
2020
|-----------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------- |
2121
| sentry-android | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android) | 21 |
2222
| sentry-android-core | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-core) | 21 |
23+
| sentry-android-distribution | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-distribution/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-distribution) | 21 |
2324
| sentry-android-ndk | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-ndk/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-ndk) | 21 |
2425
| sentry-android-timber | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-timber/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-timber) | 21 |
2526
| sentry-android-fragment | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-fragment/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-android-fragment) | 21 |

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ subprojects {
161161
}
162162
}
163163

164-
if (!this.name.contains("sample") && !this.name.contains("integration-tests") && this.name != "sentry-system-test-support" && this.name != "sentry-test-support" && this.name != "sentry-android-distribution") {
164+
if (!this.name.contains("sample") && !this.name.contains("integration-tests") && this.name != "sentry-system-test-support" && this.name != "sentry-test-support") {
165165
apply<DistributionPlugin>()
166166
apply<com.vanniktech.maven.publish.MavenPublishPlugin>()
167167

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ androidx-navigation-runtime = { module = "androidx.navigation:navigation-runtime
9191
androidx-navigation-compose = { module = "androidx.navigation:navigation-compose", version.ref = "androidxNavigation" }
9292
androidx-sqlite = { module = "androidx.sqlite:sqlite", version = "2.5.2" }
9393
androidx-recyclerview = { module = "androidx.recyclerview:recyclerview", version = "1.2.1" }
94+
androidx-browser = { module = "androidx.browser:browser", version = "1.8.0" }
9495
coil-compose = { module = "io.coil-kt:coil-compose", version = "2.6.0" }
9596
commons-compress = {module = "org.apache.commons:commons-compress", version = "1.25.0"}
9697
context-propagation = { module = "io.micrometer:context-propagation", version = "1.1.0" }

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ public class io/sentry/android/core/SpanFrameMetricsCollector : io/sentry/IPerfo
446446

447447
public final class io/sentry/android/core/SystemEventsBreadcrumbsIntegration : io/sentry/Integration, io/sentry/android/core/AppState$AppStateListener, java/io/Closeable {
448448
public fun <init> (Landroid/content/Context;)V
449+
public fun <init> (Landroid/content/Context;Landroid/os/Handler;)V
449450
public fun <init> (Landroid/content/Context;Ljava/util/List;)V
450451
public fun close ()V
451452
public static fun getDefaultActions ()Ljava/util/List;

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import io.sentry.android.core.internal.modules.AssetsModulesLoader;
3131
import io.sentry.android.core.internal.util.AndroidConnectionStatusProvider;
3232
import io.sentry.android.core.internal.util.AndroidCurrentDateProvider;
33+
import io.sentry.android.core.internal.util.AndroidRuntimeManager;
3334
import io.sentry.android.core.internal.util.AndroidThreadChecker;
3435
import io.sentry.android.core.internal.util.SentryFrameMetricsCollector;
3536
import io.sentry.android.core.performance.AppStartMetrics;
@@ -108,7 +109,7 @@ static void loadDefaultAndMetadataOptions(
108109
final @NotNull BuildInfoProvider buildInfoProvider) {
109110
Objects.requireNonNull(context, "The context is required.");
110111

111-
context = ContextUtils.getApplicationContext(context);
112+
@NotNull final Context finalContext = ContextUtils.getApplicationContext(context);
112113

113114
Objects.requireNonNull(options, "The options object is required.");
114115
Objects.requireNonNull(logger, "The ILogger object is required.");
@@ -120,17 +121,22 @@ static void loadDefaultAndMetadataOptions(
120121
options.setDefaultScopeType(ScopeType.CURRENT);
121122
options.setOpenTelemetryMode(SentryOpenTelemetryMode.OFF);
122123
options.setDateProvider(new SentryAndroidDateProvider());
124+
options.setRuntimeManager(new AndroidRuntimeManager());
123125

124126
// set a lower flush timeout on Android to avoid ANRs
125127
options.setFlushTimeoutMillis(DEFAULT_FLUSH_TIMEOUT_MS);
126128

127129
options.setFrameMetricsCollector(
128-
new SentryFrameMetricsCollector(context, logger, buildInfoProvider));
130+
new SentryFrameMetricsCollector(finalContext, logger, buildInfoProvider));
129131

130-
ManifestMetadataReader.applyMetadata(context, options, buildInfoProvider);
131-
options.setCacheDirPath(getCacheDir(context).getAbsolutePath());
132+
ManifestMetadataReader.applyMetadata(finalContext, options, buildInfoProvider);
132133

133-
readDefaultOptionValues(options, context, buildInfoProvider);
134+
options.setCacheDirPath(
135+
options
136+
.getRuntimeManager()
137+
.runWithRelaxedPolicy(() -> getCacheDir(finalContext).getAbsolutePath()));
138+
139+
readDefaultOptionValues(options, finalContext, buildInfoProvider);
134140
AppState.getInstance().registerLifecycleObserver(options);
135141
}
136142

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import io.sentry.ILogger;
77
import io.sentry.InitPriority;
88
import io.sentry.ProfileLifecycle;
9+
import io.sentry.ScreenshotStrategyType;
910
import io.sentry.SentryFeedbackOptions;
1011
import io.sentry.SentryIntegrationPackageStorage;
1112
import io.sentry.SentryLevel;
@@ -111,6 +112,7 @@ final class ManifestMetadataReader {
111112
static final String REPLAYS_MASK_ALL_IMAGES = "io.sentry.session-replay.mask-all-images";
112113

113114
static final String REPLAYS_DEBUG = "io.sentry.session-replay.debug";
115+
static final String REPLAYS_SCREENSHOT_STRATEGY = "io.sentry.session-replay.screenshot-strategy";
114116

115117
static final String FORCE_INIT = "io.sentry.force-init";
116118

@@ -476,6 +478,16 @@ static void applyMetadata(
476478

477479
options.getSessionReplay().setDebug(readBool(metadata, logger, REPLAYS_DEBUG, false));
478480

481+
final @Nullable String screenshotStrategyRaw =
482+
readString(metadata, logger, REPLAYS_SCREENSHOT_STRATEGY, null);
483+
if (screenshotStrategyRaw != null) {
484+
if ("canvas".equals(screenshotStrategyRaw.toLowerCase(Locale.ROOT))) {
485+
options.getSessionReplay().setScreenshotStrategy(ScreenshotStrategyType.CANVAS);
486+
} else {
487+
// always default to PIXEL_COPY
488+
options.getSessionReplay().setScreenshotStrategy(ScreenshotStrategyType.PIXEL_COPY);
489+
}
490+
}
479491
options.setIgnoredErrors(readList(metadata, logger, IGNORED_ERRORS));
480492

481493
final @Nullable List<String> includes = readList(metadata, logger, IN_APP_INCLUDES);

0 commit comments

Comments
 (0)