#984
Fix release scanner and background-service crashes
Description
Fix release-only QR scanner initialization and crash-prone concurrency and background-service paths.
Changes
- Preserve the no-argument constructors ML Kit discovers through Firebase component registration. R8 previously retained the registrar classes but removed their reflective constructors.
- Serialize security-cache traversal and paired timestamp/set updates; avoid size-based snapshots of concurrently changing relay connections.
- Promote the mesh foreground service before transport initialization. Handle denied starts, denied promotions, and revoked permissions without crashing callers or scheduling sticky retries. Preserve the activity retry after a denied start and clear it only when a later request is accepted.
- Recheck Wi-Fi Aware discovery permissions after attachment, contain revocation during publish/subscribe, release partial sessions, and avoid permission-denial restart loops.
- Add deterministic regression tests and an opt-in minified release scanner test with a synthetic QR frame. Normal production signing and dependency versions remain unchanged.
Verification
- Phone unit suite: 664 passed, 3 skipped; Wear unit suite: 227 passed.
- Foreground-service tests cover API 31 and 34; Wi-Fi permission-race tests cover API 32 and 34. The activity retry regression reproduces before the fix for both system start denial and permission revocation; all four cases pass after the fix.
- Release scanner creation, actual synthetic QR decoding, and frame cleanup: 2 passed on API 36. The scanner crash was reproduced before applying the fix.
- Phone and Wear debug/release APK builds and separate production AAB builds succeeded.
testDebugUnitTest lintDebug clientRewriteContractTestcompleted successfully after the retry fix. Lint adds no findings compared with the existing PR report; the existing backlog remains.- Fresh lint comparison against
main: no added findings in either module. The existing lint backlog is not resolved by this PR. - Dependency pins are unchanged; lockfile additions cover only release instrumentation configurations.
git diff --checkand the scanner regression script syntax check passed.
Risk and remaining validation
- Foreground-service startup ordering and Wi-Fi Aware teardown behavior change. Physical Mesh Lab coverage (
broadcast,dm,session_recovery, plus Wi-Fi Aware permission/recovery checks) is not run and remains a release gate. Emulator tests do not establish physical BLE/NAN correctness. - One full-suite run failed in the unchanged randomized
FragmentManagerTestreassembly test; the subsequent complete suite passed. That intermittent failure was not diagnosed or modified here. -PreleaseUiTests=trueuses debug signing for instrumentation only. Those test APKs must not be distributed as production releases.- No layout, protocol, storage-format, or version-number changes. No release artifacts are included.
Checklist
- Performed a self-review.
- Added automated regression coverage.
- Reported verification results and outstanding hardware validation.
- Physical Mesh Lab validation before release.
Activity
2chatgpt-codex-connector[bot]reviewed8d ago
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 002c3cb92a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
002c3cbℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.