Skip to content

feat(mobile): draw the album grid when no system picker exists - #836

Merged
huichen merged 4 commits into
mainfrom
feat/album-inapp
Sep 25, 2026
Merged

huichen merged 4 commits into
mainfrom
feat/album-inapp

Conversation

@huichen

@huichen huichen commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

The device report: HUAWEI Mate XT ULTIMATE DESIGN (GRL-AL10), HarmonyOS 6.1.0.135 SP8 — the APK runs inside 卓易通, which per its users exposes no system gallery to Android apps. After #829 the album therefore reported itself unavailable; this PR draws the album instead.

  • future-file-handler gains listAlbumImages(limit): MediaStore's image collection, newest first and bounded, with a walk of the usual photo directories (DCIM / Pictures / Download / Screenshots / Movies / Documents / Android/media, depth- and budget-limited) when a container maps shared storage without a media database.
  • The album router keeps every system route ahead of the grid and adds two more: a gallery that only answers ACTION_GET_CONTENT, and the Play-services photo picker (com.google.android.gms.provider.action.PICK_IMAGES). Only a device where nothing can present an album gets AlbumPickerModal — a plain newest-first grid (no albums, editing or paging) with multi-select capped by the remaining quota.
  • Chosen images go through the same pipeline as any gallery pick (prepareAlbumImages): copied into the cache while the grant is live, then size/format/quota checked, with the reported name kept. The grid is the only route that asks for the media permission, and it says so inside the sheet when refused; system pickers keep working without it.
  • <queries> fix: the probe's declarations now name android:scheme="content" as well as the MIME type, and each picker action is declared with and without data. Package visibility hides a target whose filter declares a scheme from a rule that only names a type, and a filter with no data is matched only by a data-less intent — either way the router would have read a real picker as absent.

Validation

  • tsc --noEmit, eslint clean; 128 suites / 2035 tests pass, including new cases for: the grid appearing only when no system picker answers, selection order and the quota cap, albumSource() routing (gallery / photo picker / Play-services picker / GET_CONTENT gallery / file-manager-only → grid), album listing permission handling, and the pipeline keeping reported names.
  • Native compiled locally: :future-file-handler:compileReleaseKotlin BUILD SUCCESSFUL; :app:processReleaseManifest merged the new <queries> (verified in the merged release manifest).
  • Not verified on a physical device, and it is a native change: the fix reaches the phone only through a rebuilt APK.

Two device outcomes to watch: the grid lists photos (container maps media — done), or the grid is empty / asks for a permission the container does not grant (then the container exposes nothing to the APK and only a HarmonyOS-native photoAccessHelper.PhotoViewPicker target could serve it). Both are recorded in docs/internals/mobile/harmonyos-compatibility.zh-CN.md.

A Mate XT on HarmonyOS 6.1 runs the APK inside 卓易通, an Android
compatibility container that exposes neither a gallery app nor a photo picker.
#829 turned that into an honest "album unavailable" message, but the phone
reports the user's own files through shared storage, so the album can simply be
drawn here.

- future-file-handler gains listAlbumImages: MediaStore's image collection
  (newest first, bounded), falling back to walking the usual photo directories
  when the container maps storage without a media database.
- The album router keeps every system route ahead of it and adds two: a gallery
  that only answers ACTION_GET_CONTENT, and the Play-services photo picker.
  Only when nothing can present an album does the app show AlbumPickerModal —
  a plain newest-first grid, no albums, editing or paging — and only that route
  asks for the media permission, saying so inside the grid when it is refused.
- The chosen images go through the same pipeline as a gallery pick: copied into
  the cache while the read grant is live, then size/format/quota checked.
- The probe's <queries> now name the scheme as well as the MIME type, and each
  picker action is declared with and without data. Package visibility hides a
  target whose filter declares android:scheme="content" from a rule that only
  names a type, and a filter that declares no data is matched only by a data-less
  intent — either way the router would have read the phone as "no album app".
@huichen
huichen enabled auto-merge (squash) September 25, 2026 12:46
The full suite reported 128/128 suites passing and still exited non-zero: a
live FlatList keeps its batching timer, which outlives the run. Unmount every
tree the modal test renders.
@huichen
huichen merged commit d60b757 into main Sep 25, 2026
12 checks passed
@huichen
huichen deleted the feat/album-inapp branch September 25, 2026 12:57
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