Skip to content

[codex] Support Android selected photo access - #98059

Merged
steipete merged 2 commits into
openclaw:mainfrom
NianJiuZst:codex/android-selected-photos-permission
Jul 2, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
NianJiuZst:codex/android-selected-photos-permission

Conversation

@NianJiuZst

@NianJiuZst NianJiuZst commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Android 14 partial photo access can grant READ_MEDIA_VISUAL_USER_SELECTED without granting full READ_MEDIA_IMAGES. The Android app declared the selected-photo permission, but runtime checks and UI state only looked for the full image permission, so selected-only access still appeared denied and photos.latest could reject usable MediaStore access.

Why This Change Was Made

This adds one shared photo permission helper for the Android app. API 34+ now requests both full-image and selected-photo permissions, and permission checks treat either grant as photo access. The helper is used by photos.latest, device.permissions, onboarding, and settings so the status and request paths stay aligned.

User Impact

Users who choose Android's selected-photos option can use the Android Photos capability with the selected library items instead of being treated as unpermitted. Settings/onboarding also reflect selected-photo access as granted and let users manage it afterward.

Evidence

Prepared on exact head db11e9f0f3e24cf33d1e2eb31e5b468666b4204e.

Before After
Current main had no Photos state on the reachable Phone Capabilities screen. Before: Phone Capabilities without Photos The selected-only grant is recognized and enabled. After: selected photo access enabled

Android 16 emulator state: READ_MEDIA_VISUAL_USER_SELECTED granted; READ_MEDIA_IMAGES denied. Tapping the enabled Photos row opened Android app-info for permission management.

Commands run:

ANDROID_HOME="$HOME/Library/Android/sdk" ANDROID_SDK_ROOT="$HOME/Library/Android/sdk" ./gradlew :app:testThirdPartyDebugUnitTest --tests ai.openclaw.app.PhotoPermissionsTest --tests ai.openclaw.app.node.PhotosHandlerTest --tests ai.openclaw.app.node.DeviceHandlerTest --tests ai.openclaw.app.node.InvokeDispatcherTest :app:ktlintCheck :app:assembleThirdPartyDebug
node --import tsx scripts/native-app-i18n.ts check
git diff --check
.agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main

Results: focused permission/handler/dispatcher tests, ktlint, third-party debug assembly, native i18n validation, diff validation, and fresh autoreview passed. Exact-head GitHub CI passed 48/48 jobs: https://github.com/openclaw/openclaw/actions/runs/28576179076.

Known proof boundary: the emulator proves selected-only grant recognition and the reachable settings interaction. photos.latest behavior is covered by focused handler/dispatcher tests rather than a live MediaStore result.

@NianJiuZst
NianJiuZst marked this pull request as ready for review June 30, 2026 06:54
@clawsweeper

clawsweeper Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 30, 2026, 3:10 AM ET / 07:10 UTC.

Summary
The PR adds a shared Android photo permission helper and uses it in photos.latest, device.permissions, onboarding, settings, and permission labels so API 34+ requests/checks both full-image and selected-photo grants.

PR surface: Other +62. Total +62 across 7 files.

Reproducibility: yes. source-reproducible: current main targets SDK 36 and declares READ_MEDIA_VISUAL_USER_SELECTED, but the runtime and UI permission paths only check/request READ_MEDIA_IMAGES on API 33+. I did not run a live Android 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 from a real setup 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 Android 14+ device/emulator proof: grant selected photos only, invoke photos.latest or show equivalent live output, and show settings/onboarding/device.permissions treating Photos as granted.

Proof guidance:

  • [P1] Needs real behavior proof before merge: Only unit tests, CI-style checks, and autoreview evidence are provided; the contributor should add redacted Android 14+ device/emulator proof showing selected-only photo access after the fix, then update the PR body to trigger a fresh review or ask a maintainer for @clawsweeper re-review.

Risk before merge

  • [P1] The PR has only unit/CI-style evidence, so selected-only MediaStore access plus settings/onboarding/device.permissions behavior has not been shown on a real Android 14+ device or emulator.

Maintainer options:

  1. Decide the mitigation before merge
    Land this after the contributor adds redacted Android 14+ selected-photo proof, keeping one shared helper as the canonical request/check path across runtime and UI surfaces.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P1] Contributor action is needed for real Android selected-photo proof; there is no narrow code repair for ClawSweeper to attempt from the current review.

Security
Cleared: No concrete security or supply-chain issue was found; the diff changes Android media permission checks/UI and tests without adding dependencies, workflows, secrets, downloads, or new manifest permissions.

Review details

Best possible solution:

Land this after the contributor adds redacted Android 14+ selected-photo proof, keeping one shared helper as the canonical request/check path across runtime and UI surfaces.

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

Yes, source-reproducible: current main targets SDK 36 and declares READ_MEDIA_VISUAL_USER_SELECTED, but the runtime and UI permission paths only check/request READ_MEDIA_IMAGES on API 33+. I did not run a live Android reproduction in this read-only review.

Is this the best way to solve the issue?

Yes, this appears to be the best narrow fix shape: centralize Android photo permission request/check logic and use it in the handler, device status, onboarding, and settings instead of keeping parallel one-off checks. The solution still needs real Android selected-photo proof before merge.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 56c2d637d940.

Label changes

Label justifications:

  • P2: This is a normal-priority Android bug fix for a bounded Photos permission path with limited blast radius and passing Android CI lanes.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only unit tests, CI-style checks, and autoreview evidence are provided; the contributor should add redacted Android 14+ device/emulator proof showing selected-only photo access after the fix, then update the PR body to trigger a fresh review or ask a maintainer for @clawsweeper re-review.
Evidence reviewed

PR surface:

Other +62. Total +62 across 7 files.

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 7 94 32 +62
Total 7 94 32 +62

What I checked:

  • Repository policy read and applied: Root AGENTS.md was read fully; there is no scoped AGENTS.md under apps/android, and the root policy required reading source, sibling surfaces, tests, dependency contract, proof, and history before verdict. (AGENTS.md:1, 56c2d637d940)
  • Current main has the selected-photo declaration but not aligned checks: Current main declares READ_MEDIA_VISUAL_USER_SELECTED in the Android manifest, but PhotosHandler, DeviceHandler, onboarding, and settings still check/request READ_MEDIA_IMAGES or READ_EXTERNAL_STORAGE only, which matches the PR's reported gap. (apps/android/app/src/main/java/ai/openclaw/app/node/PhotosHandler.kt:60, 56c2d637d940)
  • Android permission contract supports the requested fix shape: Official Android guidance for apps targeting Android 14+ says selected photo access uses READ_MEDIA_VISUAL_USER_SELECTED with the media read permissions, and permission-state checks should treat that permission as partial access. (developer.android.com)
  • PR updates the full Android photo permission surface: The PR adds PhotoPermissions.kt and switches PhotosHandler, DeviceHandler, onboarding, and settings from one-off image permission checks to the shared helper/request list; PermissionRequester labels the selected-photo permission as Photos. (apps/android/app/src/main/java/ai/openclaw/app/PhotoPermissions.kt:1, a70fd8c383b0)
  • Current CI passed Android test/build lanes: The live PR status shows android-test-third-party, android-test-play, and android-build-play succeeding on the current head; targeted unit proof is present but does not replace real selected-photo behavior proof. (a70fd8c383b0)
  • Real behavior proof is still missing under the review gate: The PR body lists Gradle unit tests, git diff check, and autoreview, but no redacted Android 14+ device/emulator proof showing selected-only Photos access, photos.latest, or settings/onboarding state after the change. (a70fd8c383b0)

Likely related people:

  • obviyus: Authored and merged the PR that added Android photos.latest, manifest media permissions, DeviceHandler permission reporting, and runtime/dispatcher wiring for the photo capability. (role: feature introducer / Android photo capability owner; confidence: high; commits: c7aa30e1babf, f260a8ca013e, b1a313c389d4; files: apps/android/app/src/main/java/ai/openclaw/app/node/PhotosHandler.kt, apps/android/app/src/main/java/ai/openclaw/app/node/DeviceHandler.kt, apps/android/app/src/main/AndroidManifest.xml)
  • Kaneki-x: Authored the merged PhotosHandler bitmap lifecycle fix, which is adjacent to the photos.latest runtime path reviewed here. (role: recent PhotosHandler contributor; confidence: medium; commits: 79fe34832a68, e7b143a282ef; files: apps/android/app/src/main/java/ai/openclaw/app/node/PhotosHandler.kt)
  • masatohoshino: Local blame in this shallow checkout maps the current Android photo permission and manifest lines to the grafted current-main snapshot commit; this is useful provenance but likely not the original feature authorship. (role: current-main line provenance; confidence: low; commits: 888f399499c4; files: apps/android/app/src/main/java/ai/openclaw/app/node/PhotosHandler.kt, apps/android/app/src/main/java/ai/openclaw/app/node/DeviceHandler.kt, apps/android/app/src/main/AndroidManifest.xml)
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.

@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 force-pushed the codex/android-selected-photos-permission branch from a70fd8c to c374a99 Compare July 2, 2026 08:20
@steipete

steipete commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Android 16 emulator before/after proof on prepared head c374a99d9a9be6461368f02db03faade8d817662.

Test state: third-party debug build with only READ_MEDIA_VISUAL_USER_SELECTED granted; READ_MEDIA_IMAGES remained denied.

Before — current main had no photo-permission state on the reachable Phone Capabilities screen:

Before: Phone Capabilities has no Photos row

After — the same selected-only grant is recognized and shown as enabled on the live settings surface:

After: selected photo access is recognized

Interaction proof: toggling the granted Photos row opened Android app-info so the user can manage or revoke access. Runtime permission, photos.latest, device.permissions, onboarding, and settings all share the same API-specific helper. Focused third-party tests, ktlint, assembly, native i18n validation, and fresh autoreview passed.

@steipete

steipete commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Android 16 emulator before/after proof on final rebased head db11e9f0f3e24cf33d1e2eb31e5b468666b4204e.

Test state: third-party debug build with only READ_MEDIA_VISUAL_USER_SELECTED granted; READ_MEDIA_IMAGES remained denied.

Before — current main had no photo-permission state on the reachable Phone Capabilities screen:

Before: Phone Capabilities has no Photos row

After — the same selected-only grant is recognized and shown as enabled on the live settings surface:

After: selected photo access is recognized

Interaction proof: toggling the granted Photos row opened Android app-info so the user can manage or revoke access. Runtime permission, photos.latest, device.permissions, onboarding, and settings all share the same API-specific helper. Focused third-party tests, ktlint, assembly, native i18n validation, and fresh autoreview passed.

Exact-head CI passed 48/48 jobs: https://github.com/openclaw/openclaw/actions/runs/28576179076

Known proof boundary: the emulator proves selected-only grant recognition and the reachable settings interaction; photos.latest is covered by focused handler/dispatcher tests rather than a live MediaStore result.

Thanks @NianJiuZst for identifying and implementing the Android selected-photo path.

@steipete
steipete force-pushed the codex/android-selected-photos-permission branch from c374a99 to db11e9f Compare July 2, 2026 08:25
@steipete
steipete merged commit 04e4c37 into openclaw:main Jul 2, 2026
86 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: support Android selected photo access

* fix(android): expose selected photo access in settings

---------

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: support Android selected photo access

* fix(android): expose selected photo access in settings

---------

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: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants