Repository navigation
docs(android): upload a created report from setScreenshotAsync's callback - #175
dsheikherev wants to merge 3 commits into
Conversation
…back Report.setScreenshot encodes and writes the image on the calling thread, and the createReport listener runs on the main thread. A report uploaded right after setScreenshotAsync can be sent without the new screenshot. "Programmatic report creation" now lists setScreenshotAsync and shows uploading from its callback (bugsee/bugsee-android#851). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
| return; // SDK not launched, or creation failed | ||
| } | ||
| report.setSummary("Checkout frozen"); | ||
| report.setScreenshotAsync(bitmap, () -> Bugsee.upload(report)); |
There was a problem hiding this comment.
Severity: P3 Low
Problem: bitmap is never defined in either example, and the text doesn't say where it comes from or who owns it. Unlike the example above, the snippet doesn't compile as written.
Impact: setScreenshotAsync encodes the bitmap after it returns. A reader who copies this and then recycles or reuses the bitmap right after the call (a common Android habit) races the encoder. The page doesn't warn about that.
Scenario: Bitmap bmp = renderScreen(); report.setScreenshotAsync(bmp, ...); bmp.recycle();. If the SDK reads the bitmap after the call returns, it hits a recycled bitmap.
Fix: Show where the bitmap comes from (e.g. Bitmap bitmap = captureScreen(); // your own bitmap). Add one line saying not to recycle or mutate it until the callback fires, if the SDK really reads it asynchronously. Please confirm against IssueReportScreenshot first.
There was a problem hiding this comment.
Fixed in e56e321. Both examples now produce the bitmap (renderCheckoutScreen(), "a Bitmap your app produces"). The section also says that the SDK reads the bitmap on a background thread after the call returns and does not copy it, so it must not be recycled or changed until the callback runs, and that the report neither keeps nor recycles it. I checked this against SDK v7.6.0: IssueReportScreenshot.setScreenshotAsync posts setScreenshotInternal(bitmap, …) to the aux thread, and the Report.setScreenshotAsync Javadoc says "The bitmap is fully encoded before it runs and is neither retained nor recycled by the report: the caller owns it."
Review summaryThis is a small docs-only change: one new subsection and one bullet in Overall risk: Low Merge recommendation: Approve, with one optional nit. Findings
Observations, no action needed
Positives
|
The list of commonly used Report members named only the asynchronous call. It now names both and says how they differ. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review update (after commit ad7265e)This is a docs-only change to New since my last review: commit Earlier finding, still open: the P3 inline comment at line 237 still applies. Overall risk: Low Positives: the page gives a concrete rule (upload from the callback). The threading claim is pinned to a specific SDK version. The PR is open about leaving |
…wns it The examples used an undeclared `bitmap`. They now produce it, and the section says that setScreenshotAsync reads the bitmap on a background thread without copying it, so it must not be recycled or changed until the callback runs (Report.java:360-361 at SDK v7.6.0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review update (after commit e56e321)This is a docs-only change to Earlier finding fixed: my P3 about the undefined New findings: none. The Overall risk: Low Positives:
|
Documents how to replace the screenshot of a report created with
Bugsee.createReporton Android, as agreed in bugsee/bugsee-android#851. The Javadoc counterpart is bugsee/bugsee-android#852.Why
Report.setScreenshot(Bitmap)encodes the image (WEBP) and writes it on the calling thread. On a Pixel 8 emulator (API 35, SDK 7.6.0) that took 125-178 ms for an app-like 1080×2400 bitmap.createReportlistener runs on the main thread.setScreenshotAsyncreturns at once, but a report uploaded right after it was often sent without the new screenshot: 3 and 5 of 10 in two runs. Uploading from its callback kept the screenshot in 10 of 10.Code path and measurements: bugsee/bugsee-android#851.
Changes
docs/sdk/android/manual/bug-reporting.mdx, section "Programmatic report creation":setScreenshotAsync(Bitmap, Runnable);setScreenshotAsyncinonCreated;Looper, otherwise the main thread (IssueReportScreenshot.java:150-155at SDKv7.6.0).Not done
report-handler.mdxlistssetScreenshotAsyncamong the members a handler can use. In a handler the same rule should apply: call the handler's completion fromsetScreenshotAsync's callback. I did not test that case, so the page is unchanged.Checks
npm run buildpasses: the new anchor is in the output, and no broken links are reported.npx cspellon the page passes.🤖 Generated with Claude Code