Skip to content

[codex] Fix Android camera snap cleanup#98040

Merged
steipete merged 2 commits into
openclaw:mainfrom
NianJiuZst:codex/android-camera-snap-unbind
Jul 2, 2026
Merged

[codex] Fix Android camera snap cleanup#98040
steipete merged 2 commits into
openclaw:mainfrom
NianJiuZst:codex/android-camera-snap-unbind

Conversation

@NianJiuZst

Copy link
Copy Markdown
Contributor

What Problem This Solves

Android camera.snap bound a one-shot CameraX ImageCapture use case but did not release that use case after the capture completed. That could leave the camera pipeline active after a single still capture, unlike camera.clip, which explicitly unbinds its capture use cases after recording.

Why This Change Was Made

This wraps the still-capture work in a finally cleanup and unbinds only the ImageCapture instance owned by the current invocation. The cleanup is scoped to the snap use case instead of using a final unbindAll(), so a completed snap does not tear down a newer camera invocation that may have bound its own use cases.

User Impact

Users invoking Android camera snaps should no longer leave the camera active after a successful, failed, or cancelled still capture. Concurrent or immediately-following camera work is less likely to be disrupted because the final cleanup only targets the completed snap's use case.

Evidence

  • cd apps/android && ./gradlew :app:testThirdPartyDebugUnitTest --tests ai.openclaw.app.node.CameraHandlerTest --tests ai.openclaw.app.node.JpegSizeLimiterTest
  • git diff --check
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main

@clawsweeper

clawsweeper Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 2, 2026, 8:08 AM ET / 12:08 UTC.

Summary
The PR wraps Android camera.snap JPEG capture in a try/finally and unbinds the invocation-owned CameraX ImageCapture use case after the still capture completes.

PR surface: Other +6. Total +6 across 1 file.

Reproducibility: yes. at source level: current main binds ImageCapture for camera.snap and never unbinds it afterward, while the CameraX contract keeps use cases bound until unbound or lifecycle destruction. I did not establish a live Android device reproduction in this read-only review.

Review metrics: none identified.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🐚 platinum hermit
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted real Android after-fix proof showing camera.snap completes and releases the camera use case after success or failure.
  • Update the PR body after adding proof so ClawSweeper can re-review automatically, or ask a maintainer to comment @clawsweeper re-review if it does not rerun.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body contains command evidence only and no after-fix real Android device proof; a redacted recording, terminal/log output, or linked artifact should be added, with private details such as IP addresses, API keys, phone numbers, and non-public endpoints removed. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

Maintainer options:

  1. Decide the mitigation before merge
    Merge only after redacted real Android after-fix proof for the scoped camera.snap cleanup, while keeping the broader camera.list privacy work tracked separately.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] The remaining action is contributor or maintainer real Android proof plus normal review; there is no narrow automated code repair indicated.

Security
Cleared: No concrete security or supply-chain regression was found; the diff only narrows CameraX use-case cleanup and does not change permissions, dependencies, secrets, workflows, downloads, or publishing paths.

Review details

Best possible solution:

Merge only after redacted real Android after-fix proof for the scoped camera.snap cleanup, while keeping the broader camera.list privacy work tracked separately.

Do we have a high-confidence way to reproduce the issue?

Yes at source level: current main binds ImageCapture for camera.snap and never unbinds it afterward, while the CameraX contract keeps use cases bound until unbound or lifecycle destruction. I did not establish a live Android device reproduction in this read-only review.

Is this the best way to solve the issue?

Yes, this appears to be the best narrow code shape: unbind the exact ImageCapture owned by the completed snap rather than calling a final unbindAll() that could disrupt newer camera work. The remaining blocker is proof, not an identified code defect.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 4f933ccf7b62.

Label changes

Label changes:

  • add status: 🔁 re-review loop: A fresh ClawSweeper review was explicitly requested after the latest review. Needs real behavior proof before merge: The PR body contains command evidence only and no after-fix real Android device proof; a redacted recording, terminal/log output, or linked artifact should be added, with private details such as IP addresses, API keys, phone numbers, and non-public endpoints removed. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • remove status: 📣 needs proof: Current PR status label is status: 🔁 re-review loop.

Label justifications:

  • P2: This is a bounded Android camera resource-cleanup bug fix with limited blast radius and no evidence of data loss, security bypass, or core runtime outage.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 🔁 re-review loop: A fresh ClawSweeper review was explicitly requested after the latest review. Needs real behavior proof before merge: The PR body contains command evidence only and no after-fix real Android device proof; a redacted recording, terminal/log output, or linked artifact should be added, with private details such as IP addresses, API keys, phone numbers, and non-public endpoints removed. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Other +6. Total +6 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 7 1 +6
Total 1 7 1 +6

What I checked:

Likely related people:

  • smartprogrammer93: The original Android companion camera snap/clip work that introduced this capture surface maps to this author in commit metadata. (role: introduced behavior; confidence: high; commits: c179f71f42bc; files: apps/android/app/src/main/java/ai/openclaw/android/node/CameraCaptureManager.kt, apps/android/app/src/main/java/ai/openclaw/android/node/CameraHandler.kt)
  • Kaneki-x: Authored the focused bitmap cleanup in CameraCaptureManager.snap, the same still-capture path this PR modifies. (role: recent adjacent contributor; confidence: medium; commits: d38561acbefa; files: apps/android/app/src/main/java/ai/openclaw/app/node/CameraCaptureManager.kt)
  • obviyus: Commit metadata shows this handle carried Android camera work forward as committer/author on package rename and camera cleanup changes. (role: feature merger and adjacent owner; confidence: medium; commits: 5568b393a86d, d38561acbefa; files: apps/android/app/src/main/java/ai/openclaw/app/node/CameraCaptureManager.kt)
  • steipete: Recent commits maintained Android camera comments/dependencies, and PR metadata shows the latest branch commit narrows the cleanup implementation. (role: recent area contributor and reviewer; confidence: medium; commits: 85beee613c64, 0ef6702af379, 8bf6682cbff6; files: apps/android/app/src/main/java/ai/openclaw/app/node/CameraCaptureManager.kt, apps/android/gradle/libs.versions.toml)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@NianJiuZst
NianJiuZst marked this pull request as ready for review June 30, 2026 06:17
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 30, 2026
@steipete steipete self-assigned this Jul 2, 2026
@steipete
steipete force-pushed the codex/android-camera-snap-unbind branch from 0d31970 to 8bf6682 Compare July 2, 2026 12:00
@steipete

steipete commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Maintainer live proof — exact head 8bf6682cbff68f2b51f67df4021c0c612e0f3f45

The scoped fix now unbinds the invocation-owned ImageCapture immediately after JPEG acquisition succeeds or throws, before decode/recompression. This follows CameraX's documented bound-use-case lifecycle: https://developer.android.com/reference/kotlin/androidx/camera/lifecycle/ProcessCameraProvider

Before / after: successful camera.snap

Before: current main After: fixed head
Camera privacy chip remains active after the RPC returned. No privacy chip; dumpsys media.camera has no active client; AppOps records a completed 514 ms camera access with no (running) state.
Before current main: camera privacy chip remains active after successful camera snap After fixed head: camera privacy chip released after successful camera snap

After: post-bind failure

I induced a real post-bind write failure by making the app cache unwritable. The RPC returned UNAVAILABLE: Permission denied; the privacy chip was absent, dumpsys media.camera had no active client, and AppOps had no running camera operation.

After fixed head: camera privacy chip released after failed camera snap

Validation:

The broader eager CameraX initialization / camera.list concern remains tracked in #92737; this PR intentionally fixes only one-shot snap cleanup.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@clawsweeper clawsweeper Bot added status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 2, 2026
@steipete
steipete merged commit 98e9766 into openclaw:main Jul 2, 2026
59 of 63 checks passed
@steipete

steipete commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Merged via squash.

LeonidasLux pushed a commit to LeonidasLux/openclaw that referenced this pull request Jul 3, 2026
* fix: release Android camera snap use case

* fix(android): release one-shot camera capture promptly

---------

Co-authored-by: NianJiuZst <180004567+users.noreply.github.com>
Co-authored-by: Peter Steinberger <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 3, 2026
* fix: release Android camera snap use case

* fix(android): release one-shot camera capture promptly

---------

Co-authored-by: NianJiuZst <180004567+users.noreply.github.com>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS status: 🔁 re-review loop A fresh ClawSweeper review was explicitly requested after the latest review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants