Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
3fbaf80
Bump reactivecircus/android-emulator-runner from 2.30.1 to 2.31.0 (#3…
dependabot[bot] Jul 2, 2024
25f1ca4
Bump codecov/codecov-action from 4.3.1 to 4.5.0 (#3533)
dependabot[bot] Jul 2, 2024
e34c467
[SR] Session Replay (#3339)
romtsn Jul 15, 2024
2937c11
release: 7.12.0
getsentry-bot Jul 15, 2024
9c4170f
Merge branch 'release/7.12.0'
Jul 15, 2024
a449452
Bump github/codeql-action from 3.25.10 to 3.25.11 (#3529)
dependabot[bot] Jul 16, 2024
028e225
Bump JamesIves/github-pages-deploy-action from 4.5.0 to 4.6.1 (#3531)
dependabot[bot] Jul 16, 2024
83b0c04
Bump gradle/actions (#3532)
dependabot[bot] Jul 16, 2024
7620eac
Add sentry-android-replay module to craft and readme (#3578)
romtsn Jul 16, 2024
73237da
Check app start spans time and foreground state (#3550)
stefanosiano Jul 17, 2024
391c199
release: 7.12.1
getsentry-bot Jul 23, 2024
60865fe
Bump github/codeql-action from 3.25.11 to 3.25.13 (#3591)
dependabot[bot] Jul 23, 2024
485ff61
Bump reactivecircus/android-emulator-runner from 2.31.0 to 2.32.0 (#3…
dependabot[bot] Jul 23, 2024
74ed0f6
Bump JamesIves/github-pages-deploy-action from 4.6.1 to 4.6.3 (#3590)
dependabot[bot] Jul 23, 2024
a0423a0
Bump gradle/actions (#3597)
dependabot[bot] Jul 23, 2024
fc84053
Bump gradle/wrapper-validation-action from 3.4.2 to 3.5.0 (#3589)
dependabot[bot] Jul 23, 2024
7ee0493
Merge branch 'release/7.12.1'
Jul 25, 2024
3a89243
Bump Spring Boot to 3.3.2 (#3541)
adinauer Jul 29, 2024
e039872
[SR] Capture Replays for ANRs and crashes (#3565)
romtsn Jul 30, 2024
b64477e
release: 7.13.0
getsentry-bot Jul 30, 2024
ae2294f
Merge branch 'release/7.13.0'
Jul 31, 2024
7c34b37
Fix lazy select queries instrumentation (#3604)
stefanosiano Aug 1, 2024
09dab51
Avoid ArrayIndexOutOfBoundsException on Android cpu data collection (…
stefanosiano Aug 1, 2024
d4b1f82
[SR] ANR with buffered Replay integration test (#3612)
romtsn Aug 2, 2024
9486895
[SR] Buffer mode improvements (#3622)
romtsn Aug 9, 2024
19d98e8
[SR] Gesture/touch support for Flutter (#3623)
romtsn Aug 9, 2024
32eed6a
Fix app start spans missing from Pixel devices (#3634)
stefanosiano Aug 12, 2024
f6e97b1
[SR] Fix Session Replay crashes (#3628)
romtsn Aug 12, 2024
65295e4
release: 7.14.0
getsentry-bot Aug 12, 2024
9762f09
Merge branch 'release/7.14.0'
Aug 13, 2024
a22aea0
Verify sentry-android-replay for Google Play SDK Console (#3651)
markushi Aug 29, 2024
014dbef
[SR] Rename errorSampleRate to onErrorSampleRate (#3637)
romtsn Sep 3, 2024
70d1da1
Avoid stopping appStartProfiler after application creation (#3630)
stefanosiano Sep 3, 2024
1aaf7d1
Bump JamesIves/github-pages-deploy-action from 4.6.3 to 4.6.4 (#3681)
dependabot[bot] Sep 9, 2024
8586d1f
Bump github/codeql-action from 3.25.13 to 3.26.6 (#3672)
dependabot[bot] Sep 9, 2024
731ae5a
[SR] Detect dominant color for TextViews with Spans (#3682)
romtsn Sep 11, 2024
9e9e16d
Bump github/codeql-action from 3.26.6 to 3.26.7 (#3692)
dependabot[bot] Sep 16, 2024
80d5908
Bump gradle/actions (#3691)
dependabot[bot] Sep 16, 2024
6368d4f
[SR] Add custom redaction options (#3689)
romtsn Sep 16, 2024
61c8d80
Add support for `feedback` envelope header item type (#3687)
denrase Sep 17, 2024
6c8acb8
Bump github/codeql-action from 3.26.7 to 3.26.8 (#3708)
dependabot[bot] Sep 25, 2024
b11dc55
Ensure app context is used even when SDK is initialized via Activity …
markushi Sep 26, 2024
7e57220
Adds breadcrumb origin field (#3727)
antonis Oct 1, 2024
b5b093e
Replace Calendar.getInstance with System.currentTimeMillis for breadc…
romtsn Oct 3, 2024
955c6ee
chore(readme): Add info about updated release channels (#3773)
kahest Oct 8, 2024
503f916
[QA] Lazily load SentryOptions members (#3749)
romtsn Oct 8, 2024
1607621
[QA] Fix potential ANRs due to default integrations (#3778)
markushi Oct 9, 2024
6548825
[SR] Support Jetpack Compose redaction (#3739)
romtsn Oct 9, 2024
0ab3bb3
[SR] Change terminology from redact/ignore to mask/unmask (#3741)
romtsn Oct 9, 2024
f74af4a
release: 7.15.0
getsentry-bot Oct 9, 2024
fe8ba2c
Merge branch 'release/7.15.0'
Oct 9, 2024
f79c9c1
Deprecate `enableTracing` in v7 (#3777)
adinauer Oct 10, 2024
c107ea6
merge
adinauer Oct 14, 2024
7b1bc4a
replace synchronized with reentrant lock
adinauer Oct 14, 2024
7e9de7b
downgrade coil to 2.0.0 to fix build problems
adinauer Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
gradle-home-cache-cleanup: true

- name: Initialize CodeQL
uses: github/codeql-action/init@8214744c546c1e5c8f03dde8fab3a7353211988d # pin@v2
uses: github/codeql-action/init@294a9d92911152fe08befb9ec03e240add280cb3 # pin@v2
with:
languages: ${{ matrix.language }}

Expand All @@ -55,4 +55,4 @@ jobs:
./gradlew buildForCodeQL

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@8214744c546c1e5c8f03dde8fab3a7353211988d # pin@v2
uses: github/codeql-action/analyze@294a9d92911152fe08befb9ec03e240add280cb3 # pin@v2
127 changes: 74 additions & 53 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ Sentry SDK for Java and Android
| sentry-opentelemetry-core | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-opentelemetry-core/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-opentelemetry-core) |
| sentry-okhttp | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-okhttp/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.sentry/sentry-okhttp) |

# Releases

This repo uses the following ways to release SDK updates:

- `Pre-release`: We create pre-releases (alpha, beta, RC,…) for larger and potentially more impactful changes, such as new features or major versions.
- `Latest`: We continuously release major/minor/hotfix versions from the `main` branch. These releases go through all our internal quality gates and are very safe to use and intended to be the default for most teams.
- `Stable`: We promote releases from `Latest` when they have been used in the field for some time and in scale, considering time since release, adoption, and other quality and stability metrics. These releases will be indicated on the releases page (https://github.com/getsentry/sentry-java/releases/) with the `Stable` suffix.

# Useful links and docs

Expand Down
6 changes: 5 additions & 1 deletion buildSrc/src/main/java/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ object Config {
val appCompat = "androidx.appcompat:appcompat:1.3.0"
val timber = "com.jakewharton.timber:timber:4.7.1"
val okhttp = "com.squareup.okhttp3:okhttp:$okHttpVersion"
val leakCanary = "com.squareup.leakcanary:leakcanary-android:2.8.1"
val leakCanary = "com.squareup.leakcanary:leakcanary-android:2.14"
val constraintLayout = "androidx.constraintlayout:constraintlayout:2.1.3"

private val lifecycleVersion = "2.2.0"
Expand Down Expand Up @@ -148,8 +148,11 @@ object Config {
val composeActivity = "androidx.activity:activity-compose:1.4.0"
val composeFoundation = "androidx.compose.foundation:foundation:$composeVersion"
val composeUi = "androidx.compose.ui:ui:$composeVersion"

val composeUiReplay = "androidx.compose.ui:ui:1.5.0" // Note: don't change without testing forwards compatibility
val composeFoundationLayout = "androidx.compose.foundation:foundation-layout:$composeVersion"
val composeMaterial = "androidx.compose.material3:material3:1.0.0-alpha13"
val composeCoil = "io.coil-kt:coil-compose:2.0.0"

val apolloKotlin = "com.apollographql.apollo3:apollo-runtime:3.8.2"

Expand Down Expand Up @@ -199,6 +202,7 @@ object Config {
val hsqldb = "org.hsqldb:hsqldb:2.6.1"
val javaFaker = "com.github.javafaker:javafaker:1.0.2"
val msgpack = "org.msgpack:msgpack-core:0.9.8"
val leakCanaryInstrumentation = "com.squareup.leakcanary:leakcanary-android-instrumentation:2.14"
}

object QualityPlugins {
Expand Down
1 change: 1 addition & 0 deletions sentry-android-core/api/sentry-android-core.api
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public final class io/sentry/android/core/BuildInfoProvider {
}

public final class io/sentry/android/core/ContextUtils {
public static fun getApplicationContext (Landroid/content/Context;)Landroid/content/Context;
public static fun isForegroundImportance ()Z
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public void onActivityCreated(

firstActivityCreated = true;

if (fullyDisplayedReporter != null) {
if (performanceEnabled && ttfdSpan != null && fullyDisplayedReporter != null) {
fullyDisplayedReporter.registerFullyDrawnListener(() -> onFullFrameDrawn(ttfdSpan));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ static void loadDefaultAndMetadataOptions(
final @NotNull BuildInfoProvider buildInfoProvider) {
Objects.requireNonNull(context, "The context is required.");

// it returns null if ContextImpl, so let's check for nullability
if (context.getApplicationContext() != null) {
context = context.getApplicationContext();
}
context = ContextUtils.getApplicationContext(context);

Objects.requireNonNull(options, "The options object is required.");
Objects.requireNonNull(logger, "The ILogger object is required.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public AndroidTransactionProfiler(
final boolean isProfilingEnabled,
final int profilingTracesHz,
final @NotNull ISentryExecutorService executorService) {
this.context = Objects.requireNonNull(context, "The application context is required");
this.context =
Objects.requireNonNull(
ContextUtils.getApplicationContext(context), "The application context is required");
this.logger = Objects.requireNonNull(logger, "ILogger is required");
this.frameMetricsCollector =
Objects.requireNonNull(frameMetricsCollector, "SentryFrameMetricsCollector is required");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class AnrIntegration implements Integration, Closeable {
private final @NotNull AutoClosableReentrantLock startLock = new AutoClosableReentrantLock();

public AnrIntegration(final @NotNull Context context) {
this.context = context;
this.context = ContextUtils.getApplicationContext(context);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public AnrV2EventProcessor(
final @NotNull SentryAndroidOptions options,
final @NotNull BuildInfoProvider buildInfoProvider,
final @Nullable SecureRandom random) {
this.context = context;
this.context = ContextUtils.getApplicationContext(context);
this.options = options;
this.buildInfoProvider = buildInfoProvider;
this.random = random;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public AnrV2Integration(final @NotNull Context context) {

AnrV2Integration(
final @NotNull Context context, final @NotNull ICurrentDateProvider dateProvider) {
this.context = context;
this.context = ContextUtils.getApplicationContext(context);
this.dateProvider = dateProvider;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public final class AppComponentsBreadcrumbsIntegration
private @Nullable SentryAndroidOptions options;

public AppComponentsBreadcrumbsIntegration(final @NotNull Context context) {
this.context = Objects.requireNonNull(context, "Context is required");
this.context =
Objects.requireNonNull(ContextUtils.getApplicationContext(context), "Context is required");
}

@Override
Expand Down Expand Up @@ -84,43 +85,25 @@ public void close() throws IOException {
@SuppressWarnings("deprecation")
@Override
public void onConfigurationChanged(@NotNull Configuration newConfig) {
if (scopes != null) {
final Device.DeviceOrientation deviceOrientation =
DeviceOrientations.getOrientation(context.getResources().getConfiguration().orientation);

String orientation;
if (deviceOrientation != null) {
orientation = deviceOrientation.name().toLowerCase(Locale.ROOT);
} else {
orientation = "undefined";
}

final Breadcrumb breadcrumb = new Breadcrumb();
breadcrumb.setType("navigation");
breadcrumb.setCategory("device.orientation");
breadcrumb.setData("position", orientation);
breadcrumb.setLevel(SentryLevel.INFO);

final Hint hint = new Hint();
hint.set(ANDROID_CONFIGURATION, newConfig);

scopes.addBreadcrumb(breadcrumb, hint);
}
final long now = System.currentTimeMillis();
executeInBackground(() -> captureConfigurationChangedBreadcrumb(now, newConfig));
}

@Override
public void onLowMemory() {
createLowMemoryBreadcrumb(null);
final long now = System.currentTimeMillis();
executeInBackground(() -> captureLowMemoryBreadcrumb(now, null));
}

@Override
public void onTrimMemory(final int level) {
createLowMemoryBreadcrumb(level);
final long now = System.currentTimeMillis();
executeInBackground(() -> captureLowMemoryBreadcrumb(now, level));
}

private void createLowMemoryBreadcrumb(final @Nullable Integer level) {
private void captureLowMemoryBreadcrumb(final long timeMs, final @Nullable Integer level) {
if (scopes != null) {
final Breadcrumb breadcrumb = new Breadcrumb();
final Breadcrumb breadcrumb = new Breadcrumb(timeMs);
if (level != null) {
// only add breadcrumb if TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_MODERATE or
// TRIM_MEMORY_COMPLETE.
Expand All @@ -146,4 +129,42 @@ private void createLowMemoryBreadcrumb(final @Nullable Integer level) {
scopes.addBreadcrumb(breadcrumb);
}
}

private void captureConfigurationChangedBreadcrumb(
final long timeMs, final @NotNull Configuration newConfig) {
if (scopes != null) {
final Device.DeviceOrientation deviceOrientation =
DeviceOrientations.getOrientation(context.getResources().getConfiguration().orientation);

String orientation;
if (deviceOrientation != null) {
orientation = deviceOrientation.name().toLowerCase(Locale.ROOT);
} else {
orientation = "undefined";
}

final Breadcrumb breadcrumb = new Breadcrumb(timeMs);
breadcrumb.setType("navigation");
breadcrumb.setCategory("device.orientation");
breadcrumb.setData("position", orientation);
breadcrumb.setLevel(SentryLevel.INFO);

final Hint hint = new Hint();
hint.set(ANDROID_CONFIGURATION, newConfig);

scopes.addBreadcrumb(breadcrumb, hint);
}
}

private void executeInBackground(final @NotNull Runnable runnable) {
if (options != null) {
try {
options.getExecutorService().submit(runnable);
} catch (Throwable t) {
options
.getLogger()
.log(SentryLevel.ERROR, t, "Failed to submit app components breadcrumb task");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -383,4 +383,19 @@ static void setAppPackageInfo(
}
app.setPermissions(permissions);
}

/**
* Get the app context
*
* @return the app context, or if not available, the provided context
*/
@NotNull
public static Context getApplicationContext(final @NotNull Context context) {
// it returns null if ContextImpl, so let's check for nullability
final @Nullable Context appContext = context.getApplicationContext();
if (appContext != null) {
return appContext;
}
return context;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public DefaultAndroidEventProcessor(
final @NotNull Context context,
final @NotNull BuildInfoProvider buildInfoProvider,
final @NotNull SentryAndroidOptions options) {
this.context = Objects.requireNonNull(context, "The application context is required.");
this.context =
Objects.requireNonNull(
ContextUtils.getApplicationContext(context), "The application context is required.");
this.buildInfoProvider =
Objects.requireNonNull(buildInfoProvider, "The BuildInfoProvider is required.");
this.options = Objects.requireNonNull(options, "The options object is required.");
Expand All @@ -57,7 +59,7 @@ public DefaultAndroidEventProcessor(
// some device info performs disk I/O, but it's result is cached, let's pre-cache it
final @NotNull ExecutorService executorService = Executors.newSingleThreadExecutor();
this.deviceInfoUtil =
executorService.submit(() -> DeviceInfoUtil.getInstance(context, options));
executorService.submit(() -> DeviceInfoUtil.getInstance(this.context, options));
executorService.shutdown();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static DeviceInfoUtil getInstance(
if (instance == null) {
try (final @NotNull ISentryLifecycleToken ignored = staticLock.acquire()) {
if (instance == null) {
instance = new DeviceInfoUtil(context.getApplicationContext(), options);
instance = new DeviceInfoUtil(ContextUtils.getApplicationContext(context), options);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import io.sentry.ISentryLifecycleToken;
import io.sentry.SentryLevel;
import io.sentry.Session;
import io.sentry.android.core.internal.util.BreadcrumbFactory;
import io.sentry.transport.CurrentDateProvider;
import io.sentry.transport.ICurrentDateProvider;
import io.sentry.util.AutoClosableReentrantLock;
Expand Down Expand Up @@ -92,7 +91,6 @@ private void startSession() {
if (lastUpdatedSession == 0L
|| (lastUpdatedSession + sessionIntervalMillis) <= currentTimeMillis) {
if (enableSessionTracking) {
addSessionBreadcrumb("start");
scopes.startSession();
}
scopes.getOptions().getReplayController().start();
Expand Down Expand Up @@ -127,7 +125,6 @@ private void scheduleEndSession() {
@Override
public void run() {
if (enableSessionTracking) {
addSessionBreadcrumb("end");
scopes.endSession();
}
scopes.getOptions().getReplayController().stop();
Expand Down Expand Up @@ -159,11 +156,6 @@ private void addAppBreadcrumb(final @NotNull String state) {
}
}

private void addSessionBreadcrumb(final @NotNull String state) {
final Breadcrumb breadcrumb = BreadcrumbFactory.forSession(state);
scopes.addBreadcrumb(breadcrumb);
}

@TestOnly
@Nullable
TimerTask getTimerTask() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ final class ManifestMetadataReader {

static final String REPLAYS_ERROR_SAMPLE_RATE = "io.sentry.session-replay.on-error-sample-rate";

static final String REPLAYS_REDACT_ALL_TEXT = "io.sentry.session-replay.redact-all-text";
static final String REPLAYS_MASK_ALL_TEXT = "io.sentry.session-replay.mask-all-text";

static final String REPLAYS_REDACT_ALL_IMAGES = "io.sentry.session-replay.redact-all-images";
static final String REPLAYS_MASK_ALL_IMAGES = "io.sentry.session-replay.mask-all-images";

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

Expand Down Expand Up @@ -389,12 +389,12 @@ static void applyMetadata(
options
.getExperimental()
.getSessionReplay()
.setRedactAllText(readBool(metadata, logger, REPLAYS_REDACT_ALL_TEXT, true));
.setMaskAllText(readBool(metadata, logger, REPLAYS_MASK_ALL_TEXT, true));

options
.getExperimental()
.getSessionReplay()
.setRedactAllImages(readBool(metadata, logger, REPLAYS_REDACT_ALL_IMAGES, true));
.setMaskAllImages(readBool(metadata, logger, REPLAYS_MASK_ALL_IMAGES, true));
}

options
Expand Down
Loading
Loading