Skip to content

Integrate android-crashkit in Android app#8307

Draft
aitorvs wants to merge 1 commit intodevelopfrom
feature/aitorvs/crashpad-integration
Draft

Integrate android-crashkit in Android app#8307
aitorvs wants to merge 1 commit intodevelopfrom
feature/aitorvs/crashpad-integration

Conversation

@aitorvs
Copy link
Copy Markdown
Collaborator

@aitorvs aitorvs commented Apr 16, 2026

Task/Issue URL: https://app.asana.com/1/137249556945/project/1198194956794324/task/1214089263947931?focus=true

Description

Integrated the android-crashkit library in the Android app

Steps to test this PR

Test

  • install from this branch internal debug and launch app
  • expected: m_app_register_native_crash_handler pixel is sent
  • go to settings -> crash and ANRs settings and tap on "Dump without crash"
  • go to settings -> crash and ANRs settings -> minidump browser
  • expected: crash minidump is recorded and can be deleted
  • go to settings -> crash and ANRs settings and tap on "Trigger native crash"
  • expected: app crashes
  • re-open app and go to settings -> crash and ANRs settings -> minidump browser
  • expected: crash minidump is recorded and can be deleted
  • clone https://github.com/duckduckgo/android-crashkit locally
  • cd android-crashkit and run ./server/crashpad_server.py
  • open http://localhost:8080/crashes in the browser
  • go to settings -> crash and ANRs settings -> crash upload
  • set the URL to the Upload URL printed when executing the server and check No rate limit, then save and restart
  • go to settings -> crash and ANRs settings and tap on "Trigger native crash"
  • expected: the crash should be uploaded to the server and should appear in http://localhost:8080/crashes
  • View the crash and ensure the annotations do not contain anything that's not needed

Note

Medium Risk
Introduces Crashpad-based native crash handling across multiple processes and adds internal tooling for generating/sharing/uploading minidumps; failures could affect startup/crash reporting and APK packaging of native binaries.

Overview
Integrates com.duckduckgo.crashkit:android-crashkit and switches native crash handling from the existing NDK signal-handler path to Crashpad initialization via a new CrashpadInitializer abstraction, emitting new pixels (m_app_register_native_crash_handler, m_app_native_crash) and attaching basic annotations (process, custom tab, WebView info).

Adds internal-only Crashpad tooling: a new dev hub (CrashAnrDevActivity) with pluggable capabilities to trigger a native crash or dump without crashing, browse/share/delete minidumps, and configure an upload URL/no-rate-limit toggle (with restart) via an internal CrashpadInitializer replacement. Build/packaging is updated (useLegacyPackaging = true) to ensure the Crashpad handler binary is extracted to disk, and helper scripts are added to generate Breakpad symbols.

Reviewed by Cursor Bugbot for commit 31b5cc6. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown
Collaborator Author

aitorvs commented Apr 16, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@aitorvs aitorvs marked this pull request as draft April 16, 2026 20:50
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 31b5cc6. Configure here.

"customTab" to "$isCustomTab",
),
)
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature toggle kill switch dropped from Crashpad initialization

High Severity

The new initCrashpad() method does not check the nativeCrashFeature.nativeCrashHandling() or nativeCrashHandlingSecondaryProcess() feature toggles before initializing Crashpad. The old code in success() (now dead code at lines 122–123) gated crash handler registration behind these toggles, which serve as remotely-controllable kill switches (both default to TRUE). Without these checks, there is no way to remotely disable Crashpad initialization if a problem is discovered in production.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 31b5cc6. Configure here.

LibraryLoader.loadLibrary(context, "crash-ndk", this)
// private fun asyncLoadNativeLibrary() {
// LibraryLoader.loadLibrary(context, "crash-ndk", this)
// }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dead code left from incomplete migration to Crashpad

Medium Severity

The migration to Crashpad left behind substantial dead code: the commented-out asyncLoadNativeLibrary() method and its calls (lines 91, 100, 109, 140–142), plus the now-unreachable success() and failure() callbacks, the jni_register_sighandler external function, and the LibraryLoaderListener interface on the class. Since LibraryLoader.loadLibrary() is no longer called, none of these code paths can execute. This obscures the actual logic and makes it harder to see the missing feature toggle check.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 31b5cc6. Configure here.

@aitorvs aitorvs force-pushed the feature/aitorvs/crashpad-integration branch 3 times, most recently from 48e342a to ccbb0e0 Compare April 17, 2026 12:40
@aitorvs aitorvs force-pushed the feature/aitorvs/crashpad-integration branch from ccbb0e0 to 8580f8e Compare April 17, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant