Skip to content

fix(android): use Google Code Scanner for onboarding QR#45021

Merged
obviyus merged 2 commits intomainfrom
codex/android-google-code-scanner
Mar 13, 2026
Merged

fix(android): use Google Code Scanner for onboarding QR#45021
obviyus merged 2 commits intomainfrom
codex/android-google-code-scanner

Conversation

@obviyus
Copy link
Copy Markdown
Contributor

@obviyus obviyus commented Mar 13, 2026

Summary

  • replace the onboarding QR flow's legacy JourneyApps ZXing activity with Google Code Scanner
  • keep the existing setup-code parsing path and manual entry path intact
  • show a direct Play Services/manual-entry error when the scanner cannot start

Testing

  • ./gradlew :app:compileDebugKotlin :app:testDebugUnitTest --tests 'ai.openclaw.app.ui.GatewayConfigResolverTest'

@openclaw-barnacle openclaw-barnacle bot added app: android App: android size: S maintainer Maintainer-authored PR labels Mar 13, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 13, 2026

Greptile Summary

This PR replaces the legacy JourneyApps ZXing activity-based QR scanner with Google Code Scanner (play-services-code-scanner) for the onboarding flow. The scanning logic, setup-code parsing, and manual-entry fallback paths are all preserved correctly. Callbacks run on the main thread as guaranteed by the GMS Task API, so the Compose state mutations are safe.

Changes:

  • build.gradle.kts: swaps com.journeyapps:zxing-android-embedded:4.3.0 for com.google.android.gms:play-services-code-scanner:16.1.0
  • OnboardingFlow.kt: removes ScanContract/ScanOptions activity launcher; creates a GmsBarcodeScanner client with remember and invokes startScan() with success/failure/cancel listeners inline
  • Adds resolveQrScannerError to produce a user-friendly error message that nudges users toward updating Play Services or using manual entry

Issues found:

  • GmsBarcodeScanner implements AutoCloseable but qrScanner.close() is never called when the composable leaves composition — a DisposableEffect should be added to close the client on disposal

Confidence Score: 4/5

  • Safe to merge; the migration is functionally correct with one minor resource-management improvement needed
  • All scanning and code-parsing logic is faithfully ported, state mutations are on the main thread, and error handling is covered. The only gap is that GmsBarcodeScanner.close() is never called on composable disposal, which is a best-practice style issue rather than a functional bug.
  • apps/android/app/src/main/java/ai/openclaw/app/ui/OnboardingFlow.kt — add a DisposableEffect to close the scanner client on disposal
Prompt To Fix All With AI
This is a comment left during a code review.
Path: apps/android/app/src/main/java/ai/openclaw/app/ui/OnboardingFlow.kt
Line: 251

Comment:
**Scanner client not closed on disposal**

`GmsBarcodeScanner` implements `AutoCloseable`. The client returned by `GmsBarcodeScanning.getClient(...)` should be closed when the composable leaves composition to release its connection to Play Services. Currently there is no `DisposableEffect` that calls `qrScanner.close()`, so the connection is held until the `remember` slot is garbage-collected.

Add a companion `DisposableEffect` right after this `remember` call:

```kotlin
  val qrScanner = remember(context, qrScannerOptions) { GmsBarcodeScanning.getClient(context, qrScannerOptions) }
  DisposableEffect(qrScanner) {
    onDispose { qrScanner.close() }
  }
```

How can I resolve this? If you propose a fix, please make it concise.

Last reviewed commit: f04bcd5

@obviyus
Copy link
Copy Markdown
Contributor Author

obviyus commented Mar 13, 2026

@codex review

@obviyus obviyus force-pushed the codex/android-google-code-scanner branch from f04bcd5 to a738edb Compare March 13, 2026 11:42
@obviyus obviyus merged commit 45721d5 into main Mar 13, 2026
23 checks passed
@obviyus obviyus deleted the codex/android-google-code-scanner branch March 13, 2026 11:43
@obviyus
Copy link
Copy Markdown
Contributor Author

obviyus commented Mar 13, 2026

Landed on main.

Jerry-Xin pushed a commit to Jerry-Xin/openclaw that referenced this pull request Mar 13, 2026
mrosmarin added a commit to mrosmarin/openclaw that referenced this pull request Mar 13, 2026
* main: (168 commits)
  fix: stabilize macos daemon onboarding
  fix(ui): keep shared auth on insecure control-ui connects (openclaw#45088)
  docs(plugins): clarify workspace shadowing
  fix(node-host): harden perl approval binding
  fix(node-host): harden pnpm approval binding
  fix(discovery): add missing domain to wideArea Zod config schema (openclaw#35615)
  chore(gitignore): add docker-compose override (openclaw#42879)
  feat(ios): add onboarding welcome pager (openclaw#45054)
  fix(signal): add groups config to Signal channel schema (openclaw#27199)
  fix: restore web fetch firecrawl config in runtime zod schema (openclaw#42583)
  fix: polish Android QR scanner onboarding (openclaw#45021)
  fix(android): use Google Code Scanner for onboarding QR
  fix(config): add missing params field to agents.list[] validation schema (openclaw#41171)
  docs(contributing): update Android app ownership
  fix(agents): rephrase session reset prompt to avoid Azure content filter (openclaw#43403)
  test(config): cover requiresOpenAiAnthropicToolPayload in compat schema fixture
  fix(agents): respect explicit user compat overrides for non-native openai-completions (openclaw#44432)
  Android: fix HttpURLConnection leak in TalkModeVoiceResolver (openclaw#43780)
  Docker: add OPENCLAW_TZ timezone support (openclaw#34119)
  fix(agents): avoid injecting memory file twice on case-insensitive mounts (openclaw#26054)
  ...
z-hao-wang pushed a commit to z-hao-wang/openclaw that referenced this pull request Mar 13, 2026
hougangdev pushed a commit to hougangdev/clawdbot that referenced this pull request Mar 14, 2026
ecochran76 pushed a commit to ecochran76/openclaw that referenced this pull request Mar 14, 2026
Interstellar-code pushed a commit to Interstellar-code/operator1 that referenced this pull request Mar 16, 2026
@obviyus obviyus self-assigned this Mar 23, 2026
sbezludny pushed a commit to sbezludny/openclaw that referenced this pull request Mar 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android maintainer Maintainer-authored PR size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant