Skip to content

fix: harden Android capture, memory and background operations - #34

Merged
andre487 merged 3 commits into
mainfrom
fix/android-crash-memory-hardening
Oct 15, 2026
Merged

andre487 merged 3 commits into
mainfrom
fix/android-crash-memory-hardening

Conversation

@andre487

@andre487 andre487 commented Oct 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

A burst of notifications, image allocation failure, corrupt preferences or a stalled HTTP request could exhaust memory, crash a background callback, or leave the UI loading indefinitely. This change contains those failures and keeps queued data available for retry.

  • Bound notification/background queues and isolate SMS processing, with an 8-second broadcast completion deadline.
  • Serialize bitmap allocations using the available heap budget; fall back to text on image allocation failure and retain placeholders for unavailable app icons.
  • Keep explicit Dispatchers.IO boundaries for update operations and cancellation checks during downloads; format diagnostic events/stack traces on the diagnostics worker. Guard startup/update callbacks, check preference writes, tolerate malformed individual fields, and offer Retry when initial settings loading fails.
  • Recover queued events in bounded pages and wait for WorkManager enqueue completion. Check stored metadata size before allocation; oversized/unreadable payloads become blocked without deleting their data.
  • Disconnect HTTP requests on coroutine cancellation and enforce a whole-request deadline. Clean abandoned update downloads and old APKs; handle unavailable/restricted system settings activities.

Notification backlog: 32 waiting tasks; SMS backlog: 16. HTTP deadline: 2 minutes. Stored metadata is limited to 8 MiB and the available-memory budget; streamed image files are not subject to that metadata limit. Documented in both testing guides.

Validation

  • 135 JVM/Compose tests passed, including injected allocation failure, queue overflow, corrupt preferences, settings-load retry, payload limits, pagination, APK cleanup and HTTP deadline/cancellation regressions.
  • All 11 instrumentation tests passed on each disposable Google APIs emulator: API 26 and API 35. Includes real HTTP cancellation/deadlines, Keystore/storage, image recovery and UI StrictMode checks, including initial settings-load failure/retry, update-download failure/temporary-file cleanup, and error reporting initiated on the main thread.
  • Debug/release lint and APK builds passed, including release R8 processing.
  • Normal cold start on API 35 produced no StrictMode violations or crashes.

The OOM tests inject allocation errors rather than exhausting the emulator heap. Debug emulator results do not replace signed-release/device acceptance testing.

APK artifacts

Built from commit c9c4c875 by CI run #80.
Artifacts expire after 14 days. Neither APK uses the Message487 release key.

@andre487
andre487 merged commit e78fd4e into main Oct 15, 2026
17 checks passed
@andre487
andre487 deleted the fix/android-crash-memory-hardening branch October 15, 2026 18:04
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