Skip to content

Commit 0be61c3

Browse files
authored
Merge pull request #2361 from bugsnag/release/v6.21.0
Release v6.21.0
2 parents e48ea92 + 1e39f2c commit 0be61c3

25 files changed

Lines changed: 155 additions & 27 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ jobs:
4444

4545
steps:
4646
- name: Checkout repository
47-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 #v6.0.0
47+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 #v6.0.1
4848
with:
4949
submodules: recursive
5050
- uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 #v5.0.0
5151

52-
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #v5.0.0
52+
- uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e #v5.1.0
5353
with:
5454
distribution: 'zulu'
5555
java-version: 17
@@ -64,7 +64,7 @@ jobs:
6464

6565
# Initializes the CodeQL tools for scanning.
6666
- name: Initialize CodeQL
67-
uses: github/codeql-action/init@fe4161a26a8629af62121b670040955b330f9af2 #v4.31.6
67+
uses: github/codeql-action/init@1b168cd39490f61582a9beae412bb7057a6b2c4e #v4.31.8
6868
with:
6969
languages: ${{ matrix.language }}
7070
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -83,6 +83,6 @@ jobs:
8383
./gradlew --no-daemon assemble
8484
8585
- name: Perform CodeQL Analysis
86-
uses: github/codeql-action/analyze@fe4161a26a8629af62121b670040955b330f9af2 #v4.31.6
86+
uses: github/codeql-action/analyze@1b168cd39490f61582a9beae412bb7057a6b2c4e #v4.31.8
8787
with:
8888
category: "/language:${{matrix.language}}"

.github/workflows/scorecard.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232

3333
steps:
3434
- name: "Checkout code"
35-
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
35+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3636
with:
3737
persist-credentials: false
3838

@@ -59,7 +59,7 @@ jobs:
5959
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
6060
# format to the repository Actions tab.
6161
- name: "Upload artifact"
62-
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
62+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
6363
with:
6464
name: SARIF file
6565
path: results.sarif
@@ -68,13 +68,13 @@ jobs:
6868
# Upload the results to GitHub's code scanning dashboard (optional).
6969
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
7070
- name: "Upload to code-scanning"
71-
uses: github/codeql-action/upload-sarif@fe4161a26a8629af62121b670040955b330f9af2 # v4.31.6
71+
uses: github/codeql-action/upload-sarif@1b168cd39490f61582a9beae412bb7057a6b2c4e # v4.31.8
7272
with:
7373
sarif_file: results.sarif
7474

7575
gradle-wrapper-validation:
7676
name: "Checksum validation of Gradle Wrappers"
7777
runs-on: ubuntu-latest
7878
steps:
79-
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
79+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
8080
- uses: gradle/actions/wrapper-validation@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5.0.0

CHANGELOG.md

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

3+
## 6.21.0 (2026-01-05)
4+
5+
### Enhancements
6+
7+
* Added the OS security patch version to the reported device metadata
8+
[#2345](https://github.com/bugsnag/bugsnag-android/pull/2345)
9+
* Added `ErrorCaptureOptions.CAPTURE_ALL` field to more easily change only the captured metadata when specifying `ErrorOptions`
10+
[#2358](https://github.com/bugsnag/bugsnag-android/pull/2358)
11+
12+
### Bug fixes
13+
14+
* Synthesized ANRs from the exitinfo plugin will now include the user details (captured when they are synthesized)
15+
[#2352](https://github.com/bugsnag/bugsnag-android/pull/2352)
16+
317
## 6.20.0 (2025-12-03)
418

519
### Enhancements

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ gem 'bugsnag-maze-runner', '~>10.0'
1111

1212
gem "license_finder", "~> 7.0"
1313

14-
gem "openssl", "~> 3.3"
14+
gem "openssl", "~> 4.0"

bugsnag-android-core/api/bugsnag-android-core.api

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ public class com/bugsnag/android/Error : com/bugsnag/android/JsonStream$Streamab
358358
}
359359

360360
public final class com/bugsnag/android/ErrorCaptureOptions {
361+
public static final field CAPTURE_ALL I
361362
public static final field CAPTURE_BREADCRUMBS I
362363
public static final field CAPTURE_FEATURE_FLAGS I
363364
public static final field CAPTURE_STACKTRACE I
@@ -394,9 +395,12 @@ public final class com/bugsnag/android/ErrorCaptureOptions$Companion {
394395
public final class com/bugsnag/android/ErrorOptions {
395396
public fun <init> ()V
396397
public fun <init> (Lcom/bugsnag/android/ErrorCaptureOptions;)V
397-
public synthetic fun <init> (Lcom/bugsnag/android/ErrorCaptureOptions;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
398+
public fun <init> (Lcom/bugsnag/android/ErrorCaptureOptions;Z)V
399+
public synthetic fun <init> (Lcom/bugsnag/android/ErrorCaptureOptions;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
398400
public final fun getCapture ()Lcom/bugsnag/android/ErrorCaptureOptions;
401+
public final fun isFatal ()Z
399402
public final fun setCapture (Lcom/bugsnag/android/ErrorCaptureOptions;)V
403+
public final fun setFatal (Z)V
400404
}
401405

402406
public final class com/bugsnag/android/ErrorType : java/lang/Enum {

bugsnag-android-core/src/androidTest/java/com/bugsnag/android/ClientTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public void testPopulateDeviceMetadata() {
191191
client = generateClient();
192192
Map<String, Object> metadata = client.getDeviceDataCollector().getDeviceMetadata();
193193

194-
assertEquals(9, metadata.size());
194+
assertEquals(10, metadata.size());
195195
assertNotNull(metadata.get("batteryLevel"));
196196
assertNotNull(metadata.get("charging"));
197197
assertNotNull(metadata.get("locationStatus"));
@@ -201,6 +201,7 @@ public void testPopulateDeviceMetadata() {
201201
assertNotNull(metadata.get("dpi"));
202202
assertNotNull(metadata.get("emulator"));
203203
assertNotNull(metadata.get("screenResolution"));
204+
assertNotNull(metadata.get("securityPatch"));
204205
}
205206

206207
@Test

bugsnag-android-core/src/main/java/com/bugsnag/android/Client.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.bugsnag.android;
22

33
import static com.bugsnag.android.SeverityReason.REASON_HANDLED_EXCEPTION;
4+
import static com.bugsnag.android.SeverityReason.REASON_UNHANDLED_EXCEPTION;
45

56
import com.bugsnag.android.internal.BackgroundTaskService;
67
import com.bugsnag.android.internal.ForegroundDetector;
@@ -776,7 +777,11 @@ public void notify(
776777
if (immutableConfig.shouldDiscardError(exc)) {
777778
return;
778779
}
779-
SeverityReason severityReason = SeverityReason.newInstance(REASON_HANDLED_EXCEPTION);
780+
SeverityReason severityReason =
781+
options == null || !options.isFatal()
782+
? SeverityReason.newInstance(REASON_HANDLED_EXCEPTION)
783+
: SeverityReason.newInstance(REASON_UNHANDLED_EXCEPTION);
784+
780785
Event event = createEventWithOptions(exc, severityReason, options);
781786
event.setGroupingDiscriminator(getGroupingDiscriminator());
782787
populateAndNotifyAndroidEvent(event, options, onError);
@@ -861,7 +866,7 @@ void populateAndNotifyAndroidEvent(@NonNull Event event,
861866
event.setInternalMetrics(internalMetrics);
862867
event.setGroupingDiscriminator(getGroupingDiscriminator());
863868

864-
notifyInternal(event, onError);
869+
notifyInternalWithErrorOptions(event, onError, options);
865870
}
866871

867872
private void populateDeviceAndAppData(@NonNull Event event) {
@@ -893,7 +898,15 @@ private void populateEventData(@NonNull Event event, @Nullable ErrorOptions opti
893898
}
894899

895900
void notifyInternal(@NonNull Event event,
896-
@Nullable OnErrorCallback onError) {
901+
@Nullable OnErrorCallback onError
902+
) {
903+
notifyInternalWithErrorOptions(event, onError, null);
904+
}
905+
906+
void notifyInternalWithErrorOptions(@NonNull Event event,
907+
@Nullable OnErrorCallback onError,
908+
@Nullable ErrorOptions options
909+
) {
897910
// set the redacted keys on the event as this
898911
// will not have been set for RN/Unity events
899912
Collection<Pattern> redactedKeys = metadataState.getMetadata().getRedactedKeys();
@@ -920,6 +933,9 @@ void notifyInternal(@NonNull Event event,
920933
setGroupingDiscriminator(getGroupingDiscriminator());
921934

922935
deliveryDelegate.deliver(event);
936+
if (options != null && options.isFatal()) {
937+
setAutoNotify(false);
938+
}
923939
}
924940

925941
/**

bugsnag-android-core/src/main/java/com/bugsnag/android/DeviceDataCollector.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ internal class DeviceDataCollector(
115115
map["dpi"] = dpi
116116
map["emulator"] = emulator
117117
map["screenResolution"] = screenResolution
118+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
119+
map["securityPatch"] = Build.VERSION.SECURITY_PATCH
120+
}
118121
return map
119122
}
120123

bugsnag-android-core/src/main/java/com/bugsnag/android/ErrorOptions.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ package com.bugsnag.android
55
*/
66
class ErrorOptions @JvmOverloads constructor(
77
/** Controls which data fields are captured during Event creation. */
8-
var capture: ErrorCaptureOptions = ErrorCaptureOptions()
8+
var capture: ErrorCaptureOptions = ErrorCaptureOptions(),
9+
/**
10+
* Use with caution. Marks the error as fatal / non-fatal. A fatal error is marked as `unhandled`, and causes
11+
* all automatic error reporting to be turned off (discarding all subsequent unhandled crashes).
12+
*/
13+
var isFatal: Boolean = false
914
)
1015

1116
/**
@@ -51,6 +56,13 @@ class ErrorCaptureOptions(
5156
const val CAPTURE_THREADS = 8
5257
const val CAPTURE_USER = 16
5358

59+
const val CAPTURE_ALL =
60+
CAPTURE_STACKTRACE or
61+
CAPTURE_BREADCRUMBS or
62+
CAPTURE_FEATURE_FLAGS or
63+
CAPTURE_THREADS or
64+
CAPTURE_USER
65+
5466
/**
5567
* A convenience method to capture only selected event fields using a bit-mask of field
5668
* names (a mask of [CAPTURE_STACKTRACE], [CAPTURE_BREADCRUMBS], etc.).

bugsnag-android-core/src/main/java/com/bugsnag/android/ExceptionHandler.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class ExceptionHandler implements UncaughtExceptionHandler {
1919
private final StrictModeHandler strictModeHandler = new StrictModeHandler();
2020
private final Client client;
2121
private final Logger logger;
22+
private boolean enabled = true;
2223

2324
ExceptionHandler(Client client, Logger logger) {
2425
this.client = client;
@@ -27,17 +28,19 @@ class ExceptionHandler implements UncaughtExceptionHandler {
2728
}
2829

2930
void install() {
31+
enabled = true;
3032
Thread.setDefaultUncaughtExceptionHandler(this);
3133
}
3234

3335
void uninstall() {
36+
enabled = false;
3437
Thread.setDefaultUncaughtExceptionHandler(originalHandler);
3538
}
3639

3740
@Override
3841
public void uncaughtException(@NonNull Thread thread, @NonNull Throwable throwable) {
3942
try {
40-
if (client.getConfig().shouldDiscardError(throwable)) {
43+
if (!enabled || client.getConfig().shouldDiscardError(throwable)) {
4144
return;
4245
}
4346

0 commit comments

Comments
 (0)