Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
13985f0
Merge pull request #2232 from bugsnag/main
lemnik Aug 1, 2025
43258f0
Remove unused file
YYChen01988 Aug 1, 2025
1125ec4
Merge pull request #2233 from bugsnag/YYChen/remove-FragmentActivityL…
lemnik Aug 1, 2025
d8ab053
chore(docker): update release dockerfiles
lemnik Jul 31, 2025
3215e72
build(deps): bump github/codeql-action from 3.29.4 to 3.29.5
dependabot[bot] Aug 5, 2025
ecf1e8a
Merge pull request #2234 from bugsnag/lemnik/docker-release-fixes
lemnik Aug 5, 2025
07e057e
Correct pipeline YAML
Aug 7, 2025
a11a3ac
Only use Buildkie plugins once per step
Aug 8, 2025
3958315
Merge pull request #2239 from bugsnag/tms/plugins
twometresteve Aug 8, 2025
0ffe7a9
Merge pull request #2238 from bugsnag/tms/correct-yaml
twometresteve Aug 11, 2025
e49a534
feat(memoryTrim): do not report `lowMemory` or `memoryTrimLevel` when…
lemnik Aug 5, 2025
7091167
Merge pull request #2236 from bugsnag/dependabot/github_actions/githu…
lemnik Aug 12, 2025
6fa7815
chore(example): removed unused dependencies in example app
lemnik Aug 12, 2025
21c5f7d
Merge pull request #2237 from bugsnag/PLAT-14601/no-memoryTrim
lemnik Aug 12, 2025
2cbfdb2
feat(exit-info): made the exit-info plugin de-duplication more robust
lemnik Jul 31, 2025
18fe1a2
build(deps): bump actions/checkout from 4.2.2 to 5.0.0
dependabot[bot] Aug 12, 2025
c0227fe
Merge pull request #2242 from bugsnag/dependabot/github_actions/actio…
YYChen01988 Aug 12, 2025
db690a0
build(deps): bump gradle/actions from 4.4.1 to 4.4.2 (#2241)
dependabot[bot] Aug 12, 2025
06186ac
Merge pull request #2235 from bugsnag/PLAT-14598/exitinfo-avoid-unmat…
lemnik Aug 13, 2025
861d357
fix(ndk): fix the reported loadAddress for system libs
lemnik Aug 12, 2025
33cdcec
Merge pull request #2245 from bugsnag/lemnik/example-app-dependencies
lemnik Aug 13, 2025
d1567d8
build(deps): bump github/codeql-action from 3.29.4 to 3.29.8 (#2243)
dependabot[bot] Aug 13, 2025
cdba181
update how bumpsnag is called
joshedney Aug 13, 2025
488986a
Merge pull request #2244 from bugsnag/PLAT-14678/ndk-system-address-fix
lemnik Aug 13, 2025
465b827
Merge pull request #2246 from bugsnag/je/update-bumpsnag
joshedney Aug 13, 2025
e5cfc9d
Change to discardOldestFileIfNeeded sorting (#2189)
clr182 Aug 14, 2025
c9c1aa4
Release v6.17.0
YYChen01988 Aug 14, 2025
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
1 change: 0 additions & 1 deletion .buildkite/pipeline.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1013,7 +1013,6 @@ steps:
image-repository: 855461928731.dkr.ecr.us-west-1.amazonaws.com/android
cache-from:
- android-common:855461928731.dkr.ecr.us-west-1.amazonaws.com/android:latest
- docker-compose#v4.7.0:
push:
- android-common:855461928731.dkr.ecr.us-west-1.amazonaws.com/android:latest

Expand Down
6 changes: 0 additions & 6 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ steps:
env:
JAVA_VERSION: 17
command: './gradlew --continue checkstyle detekt lint ktlintCheck'
env:
JAVA_VERSION: 17

- label: ':android: Binary compatibility checks'
timeout_in_minutes: 20
Expand All @@ -62,8 +60,6 @@ steps:
env:
JAVA_VERSION: 17
command: './gradlew apiCheck'
env:
JAVA_VERSION: 17

- label: ':android: CppCheck'
timeout_in_minutes: 10
Expand Down Expand Up @@ -100,8 +96,6 @@ steps:
env:
JAVA_VERSION: 17
command: './gradlew test'
env:
JAVA_VERSION: 17

- label: ':android: Instrumentation tests'
timeout_in_minutes: 10
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
with:
submodules: recursive
- uses: gradle/wrapper-validation-action@f9c9c575b8b21b6485636a91ffecd10e558c62f6 #v3.5.0
Expand All @@ -64,7 +64,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@4e828ff8d448a8a6e532957b1811f387a63867e8 #v3.29.4
uses: github/codeql-action/init@76621b61decf072c1cee8dd1ce2d2a82d33c17ed #v3.29.8
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -83,6 +83,6 @@ jobs:
./gradlew --no-daemon assemble

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 #v3.29.4
uses: github/codeql-action/analyze@76621b61decf072c1cee8dd1ce2d2a82d33c17ed #v3.29.8
with:
category: "/language:${{matrix.language}}"
2 changes: 1 addition & 1 deletion .github/workflows/downstream_updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ jobs:
- run: >
curl -X POST https://api.github.com/repos/${{ matrix.downstream_repo }}/dispatches
-H 'Content-Type: application/json'
-H "Authorization: Bearer ${{ secrets.DEP_UPDATER_BEARER_TOKEN }}"
-H "Authorization: Token ${{ secrets.DEP_UPDATER_BEARER_TOKEN }}"
-d '{"event_type":"update-dependency","client_payload": {"target_submodule":"bugsnag-android", "target_version": "${{ env.RELEASE_VERSION }}"}}'
8 changes: 4 additions & 4 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false

Expand Down Expand Up @@ -68,13 +68,13 @@ jobs:
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
uses: github/codeql-action/upload-sarif@76621b61decf072c1cee8dd1ce2d2a82d33c17ed # v3.29.8
with:
sarif_file: results.sarif

gradle-wrapper-validation:
name: "Checksum validation of Gradle Wrappers"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: gradle/actions/wrapper-validation@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- uses: gradle/actions/wrapper-validation@017a9effdb900e5b5b2fddfb590a105619dca3c3 # v4.4.2
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 6.17.0 (2025-08-14)

### Enhancements

* `memoryTrimLevel` and `lowMemory` will not be reported when they are not set (newer versions of Android do not set these values)
[#2237](https://github.com/bugsnag/bugsnag-android/pull/2237)

### Bug fixes

* Handle edge-cases to reduce the changes of duplicate ANR reporting from `bugsnag-plugin-android-exitinfo` when `reportUnmatchedANR = true && disableProcessStateSummaryOverride = true`
[#2235](https://github.com/bugsnag/bugsnag-android/pull/2235)
* Correct the reporting of the loadAddress for native system libraries and JIT frames
[#2244](https://github.com/bugsnag/bugsnag-android/pull/2244)
* Added deterministic sorting for `discardOldestFileIfNeeded` method to avoid potential crashes where mutliple files have the same last modified time
[#2189](https://github.com/bugsnag/bugsnag-android/pull/2189)

## 6.16.0 (2025-07-31)

### Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,12 @@ public void testAppDataCollection() {
public void testAppDataMetadata() {
client = generateClient();
Map<String, Object> app = client.getAppDataCollector().getAppDataMetadata();
assertEquals(11, app.size());
assertEquals(9, app.size());
assertEquals("Bugsnag Android Tests", app.get("name"));
assertEquals("com.bugsnag.android.core.test", app.get("processName"));
assertNotNull(app.get("memoryUsage"));
assertTrue(app.containsKey("activeScreen"));
assertTrue(app.containsKey("installerPackage"));
assertNotNull(app.get("lowMemory"));
assertNotNull(app.get("memoryTrimLevel"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,15 @@ internal class AppDataCollector(
val map = HashMap<String, Any?>()
map["name"] = appName
map["activeScreen"] = sessionTracker.get().contextActivity
map["lowMemory"] = memoryTrimState.isLowMemory
map["memoryTrimLevel"] = memoryTrimState.trimLevelDescription
map["processImportance"] = getProcessImportance()

// only report the memory trim/low memory state if it has been captured
// more recent Android versions will not report these
if (memoryTrimState.memoryTrimLevel != null) {
map["lowMemory"] = memoryTrimState.isLowMemory
map["memoryTrimLevel"] = memoryTrimState.trimLevelDescription
}

populateRuntimeMemoryMetadata(map)

bgWorkRestricted?.let {
Expand Down
58 changes: 40 additions & 18 deletions bugsnag-android-core/src/main/java/com/bugsnag/android/FileStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,32 @@ internal abstract class FileStore(

fun discardOldestFileIfNeeded() {
// Limit number of saved payloads to prevent disk space issues
if (isStorageDirValid(storageDir)) {
val listFiles = storageDir.listFiles() ?: return
if (listFiles.size < maxStoreCount) return
val sortedListFiles = listFiles.sortedBy { it.lastModified() }
// Number of files to discard takes into account that a new file may need to be written
val numberToDiscard = listFiles.size - maxStoreCount + 1
var discardedCount = 0
for (file in sortedListFiles) {
if (discardedCount == numberToDiscard) {
return
} else if (!queuedFiles.contains(file)) {
logger.w(
"Discarding oldest error as stored error limit reached: '" +
file.path + '\''
)
deleteStoredFiles(setOf(file))
discardedCount++
}
if (!isStorageDirValid(storageDir)) return
val listFiles = storageDir.listFiles() ?: return
if (listFiles.size < maxStoreCount) return

// Store lastModified to ensure it doesn't change during sort
val timestampedFiles = listFiles.mapTo(ArrayList(listFiles.size)) { file ->
FileWithTimestamp(file, file.lastModified())
}

// Sort by cached lastModified timestamps
timestampedFiles.sort()

// Number of files to discard takes into account that a new file may need to be written
val numberToDiscard = listFiles.size - maxStoreCount + 1
var discardedCount = 0

for (fileMeta in timestampedFiles) {
val file = fileMeta.file
if (discardedCount == numberToDiscard) {
return
} else if (!queuedFiles.contains(file)) {
logger.w(
"Discarding oldest error as stored error limit reached: '${file.path}'"
)
deleteStoredFiles(setOf(file))
discardedCount++
}
}
}
Expand Down Expand Up @@ -188,4 +196,18 @@ internal abstract class FileStore(
lock.unlock()
}
}

/**
* A data holder for associating a {@link File} with its last modified timestamp.
*
* @param file The file to associate with a timestamp.
* @param timestamp The last modified time of the file, cached to ensure consistent ordering.
*/
private data class FileWithTimestamp(
val file: File,
val timestamp: Long
) : Comparable<FileWithTimestamp> {
override fun compareTo(other: FileWithTimestamp): Int =
timestamp.compareTo(other.timestamp)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.io.IOException
*/
class Notifier @JvmOverloads constructor(
var name: String = "Android Bugsnag Notifier",
var version: String = "6.16.0",
var version: String = "6.17.0",
var url: String = "https://bugsnag.com"
) : JsonStream.Streamable {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.bugsnag.android

import android.app.ActivityManager
import android.content.ComponentCallbacks2
import android.content.Context
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
Expand Down Expand Up @@ -30,7 +31,11 @@ internal class AppMetadataSerializationTest {
val sessionTracker = mock(SessionTracker::class.java)
val launchCrashTracker = mock(LaunchCrashTracker::class.java)
val config = BugsnagTestUtils.generateConfiguration()

val memoryTrimState = MemoryTrimState()
memoryTrimState.isLowMemory = true
@Suppress("DEPRECATION")
memoryTrimState.memoryTrimLevel = ComponentCallbacks2.TRIM_MEMORY_MODERATE

// populate summary fields
config.appType = "React Native"
Expand Down Expand Up @@ -59,14 +64,27 @@ internal class AppMetadataSerializationTest {
appData.codeBundleId = "foo-99"
appData.setBinaryArch("x86")

val withMemoryTrim = prepareAppMetadata(appData)

memoryTrimState.memoryTrimLevel = null
val noMemoryTrim = prepareAppMetadata(appData)

return generateSerializationTestCases(
"app_meta_data",
withMemoryTrim,
noMemoryTrim
)
}

private fun prepareAppMetadata(appData: AppDataCollector): Map<String, Any> {
val metadata = appData.getAppDataMetadata()
assertNotNull(metadata.remove("memoryUsage"))
assertNotNull(metadata.remove("totalMemory"))
assertNotNull(metadata.remove("freeMemory"))
assertNotNull(metadata.remove("memoryLimit"))

@Suppress("UNCHECKED_CAST")
return generateSerializationTestCases("app_meta_data", metadata.toMap() as Map<String, Any>)
return metadata as Map<String, Any>
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"memoryTrimLevel": "None",
"memoryTrimLevel": "Moderate",
"activeScreen": "MyActivity",
"name": "MyApp",
"lowMemory": false
"lowMemory": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"activeScreen": "MyActivity",
"name": "MyApp"
}
5 changes: 2 additions & 3 deletions bugsnag-plugin-android-exitinfo/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
<SmellBaseline>
<ManuallySuppressedIssues/>
<CurrentIssues>
<ID>CyclomaticComplexMethod:CodeStrings.kt$@RequiresApi(Build.VERSION_CODES.R) @SuppressLint("SwitchIntDef") @Suppress("DEPRECATION") internal fun importanceDescriptionOf(exitInfo: ApplicationExitInfo)</ID>
<ID>CyclomaticComplexMethod:CodeStrings.kt$@RequiresApi(Build.VERSION_CODES.R) internal fun exitReasonOf(exitInfo: ApplicationExitInfo)</ID>
<ID>CyclomaticComplexMethod:CodeDescriptions.kt$@RequiresApi(Build.VERSION_CODES.R) @SuppressLint("SwitchIntDef") @Suppress("DEPRECATION") internal fun importanceDescriptionOf(exitInfo: ApplicationExitInfo)</ID>
<ID>CyclomaticComplexMethod:CodeDescriptions.kt$@RequiresApi(Build.VERSION_CODES.R) internal fun exitReasonOf(exitInfo: ApplicationExitInfo)</ID>
<ID>LongParameterList:TombstoneParser.kt$TombstoneParser$( exitInfo: ApplicationExitInfo, listOpenFds: Boolean, includeLogcat: Boolean, threadConsumer: (BugsnagThread) -> Unit, fileDescriptorConsumer: (Int, String, String) -> Unit, logcatConsumer: (String) -> Unit )</ID>
<ID>MagicNumber:TraceParser.kt$TraceParser$16</ID>
<ID>MagicNumber:TraceParser.kt$TraceParser$3</ID>
<ID>MaxLineLength:ExitInfoCallbackTest.kt$ExitInfoCallbackTest$exitInfoCallback = ExitInfoCallback(context, nativeEnhancer, anrEventEnhancer, null, ApplicationExitInfoMatcher(context, 100))</ID>
<ID>MaxLineLength:TraceParserInvalidStackframesTest.kt$TraceParserInvalidStackframesTest.Companion$"#01 pc 0000000000000c5c /data/app/~~sKQbJGqVJA5glcnvEjZCMg==/com.example.bugsnag.android-fVuoJh5GpAL7sRAeI3vjSw==/lib/arm64/libentrypoint.so "</ID>
<ID>MaxLineLength:TraceParserInvalidStackframesTest.kt$TraceParserInvalidStackframesTest.Companion$"#01 pc 0000000000000c5c /data/app/~~sKQbJGqVJA5glcnvEjZCMg==/com.example.bugsnag.android-fVuoJh5GpAL7sRAeI3vjSw==/lib/arm64/libentrypoint.so (Java_com_example_bugsnag_android_BaseCrashyActivity_anrFromCXX+20"</ID>
<ID>MaxLineLength:TraceParserInvalidStackframesTest.kt$TraceParserInvalidStackframesTest.Companion$"#01 pc 0000000000000c5c /data/app/~~sKQbJGqVJA5glcnvEjZCMg==/com.example.bugsnag.android-fVuoJh5GpAL7sRAeI3vjSw==/lib/arm64/libentrypoint.so (Java_com_example_bugsnag_android_BaseCrashyActivity_anrFromCXX+20) ("</ID>
Expand Down
Loading
Loading