Skip to content

feat: support setting attributes after handler start#10

Merged
bobbyg603 merged 2 commits intomainfrom
bobby/runtime-attributes
Apr 8, 2026
Merged

feat: support setting attributes after handler start#10
bobbyg603 merged 2 commits intomainfrom
bobby/runtime-attributes

Conversation

@bobbyg603
Copy link
Copy Markdown
Member

@bobbyg603 bobbyg603 commented Apr 7, 2026

Summary

  • Adds BugSplat.setAttribute(key, value) and BugSplat.removeAttribute(key) to allow setting crash report attributes after init() has been called
  • Uses crashpad's SimpleStringDictionary registered on CrashpadInfo — the dictionary lives in process memory and is read directly by the crash handler at crash time, so updates are reflected immediately
  • Adds a "Set Attribute" button to the example app to test the feature

Test plan

  • Build and run the example app
  • Tap "Set Attribute", enter a key/value pair, and tap "Set"
  • Tap "Crash App" to trigger a native crash
  • Verify the attribute appears on the crash report in the BugSplat dashboard

🤖 Generated with Claude Code

Use crashpad's SimpleStringDictionary registered on CrashpadInfo to
allow runtime attribute updates. The dictionary lives in process memory
and is read directly by the crash handler at crash time.

Adds BugSplat.setAttribute() and BugSplat.removeAttribute() public API
methods, and updates the example app with a "Set Attribute" button to
test the feature.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 7, 2026 22:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for setting/removing BugSplat crash report attributes at runtime (after init()), backed by Crashpad’s SimpleStringDictionary stored in process memory, and exposes the feature in the example app UI.

Changes:

  • Added BugSplat.setAttribute(key, value) and BugSplat.removeAttribute(key) plus corresponding JNI bridge methods.
  • Registered a Crashpad SimpleStringDictionary via CrashpadInfo and implemented native setters/removers.
  • Updated the example app to include a “Set Attribute” button and input dialog for manual testing.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
example/src/main/res/values/styles.xml Adds a style for the new “Set Attribute” button.
example/src/main/res/values/strings.xml Adds the “Set Attribute” label resource.
example/src/main/res/layout/dialog_attribute.xml New dialog layout for entering key/value pairs.
example/src/main/res/layout/activity_main.xml Adds the new button to the main screen layout.
example/src/main/java/com/bugsplat/example/MainActivity.java Wires the new UI flow to call BugSplat.setAttribute().
app/src/main/java/com/bugsplat/android/BugSplatBridge.java Adds Java-to-JNI methods for set/remove attribute.
app/src/main/java/com/bugsplat/android/BugSplat.java Adds public SDK API methods and Javadoc.
app/src/main/cpp/native-lib.cpp Implements the Crashpad SimpleStringDictionary registration and JNI set/remove.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread example/src/main/res/layout/activity_main.xml
Comment thread example/src/main/java/com/bugsplat/example/MainActivity.java
Comment thread app/src/main/java/com/bugsplat/android/BugSplatBridge.java
Comment thread app/src/main/cpp/native-lib.cpp
Comment thread app/src/main/cpp/native-lib.cpp
Comment thread app/src/main/java/com/bugsplat/android/BugSplat.java
Fix layout constraint cycle in example app and add null/blank key
validation to setAttribute/removeAttribute to prevent JNI crashes.
Document SimpleStringDictionary limits in public Javadoc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bobbyg603 bobbyg603 merged commit 58faad5 into main Apr 8, 2026
3 checks passed
@bobbyg603 bobbyg603 deleted the bobby/runtime-attributes branch April 8, 2026 15:49
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.

3 participants