Repository navigation
fix(mobile): route the album from resolved handlers, never a file browser - #829
Merged
Merged
Conversation
…wser #823 opened the gallery below API 33 and still let AndroidX's photo-picker contract run when no gallery answered. On the Huawei phone that reported the bug the album item keeps showing the document picker — the file browser the report was about — because the contract degrades to ACTION_OPEN_DOCUMENT wherever no system photo picker exists, and because nothing tells us whether the gallery intent reaches a gallery or a file manager. Resolve the candidates first instead of guessing from the API level: - future-file-handler gains resolveImagePickRoutes, which reports the apps that would answer the album intent, Android 13's photo picker, the AOSP photo picker backport, and (for diagnostics) the document picker. Its manifest declares those intents in <queries>, without which package visibility hides user-installed galleries from the query and the router would read them as absent. - The album router then decides: Android 13+ keeps the system photo picker (multi-select) when it answers; below 33 a gallery that advertises ACTION_PICK on MediaStore's image collection wins and is launched explicitly by component, so a file manager that also advertises the pick cannot stand in for it; a real backport photo picker is next; otherwise the album reports itself unavailable. It never opens the document picker — that is what "Choose files" is for, and opening one under the album label is the failure being fixed. - Gallery recognition uses package-name hints, since Android has no "is this a gallery" flag. An unknown package is not treated as a gallery: a missed gallery degrades to the honest message, while a false positive reproduces the original complaint. The resolution is logged when nothing can present the album, so a device report can tell "no album app" from "only a file manager". - App binaries without the probe keep the previous order, so a JS/native version skew does not change behaviour.
huichen
enabled auto-merge (squash)
September 25, 2026 10:40
huichen
added a commit
that referenced
this pull request
Sep 25, 2026
* feat(mobile): draw the album grid when no system picker exists 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". * test(mobile): unmount the album grid so jest can exit 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The report after #823: on a Huawei phone without Play services the album item still opens the document picker (the file browser). Two reasons, both now addressed by resolving the candidates before launching anything instead of guessing from the API level:
ACTION_OPEN_DOCUMENTwherever no system photo picker exists. That is the document picker, and it is what "Choose files" is for.Now:
future-file-handlergainsresolveImagePickRoutes, which reports the apps answering the album intent, Android 13's system photo picker, the AOSP photo-picker backport (androidx.activity.result.contract.action.PICK_IMAGES), and — diagnostics only — the document picker. The module manifest declares those intents in<queries>; without it package visibility hides user-installed galleries from the query and the router would read them as absent.ACTION_PICKon MediaStore's image collection wins and is launched by explicit component, so a file manager that also advertises the pick cannot stand in for it; a real backport photo picker comes next; otherwise the album reports itself unavailable (existingattachment_album_unavailablestring, now aligned with the "选择手机文件" label).Validation
tsc --noEmit,eslintclean; 125 suites / 1938 tests pass, including new cases for: targeting the gallery when a file manager also answers, reporting unavailable when only a file manager (or nothing) answers, Android 13 keeping the system picker, the backport picker replacing the document picker, and a package-classification table with real OEM names (com.huawei.photos,com.miui.gallery,com.huawei.hidisk,com.android.documentsui, …).:future-file-handler:compileReleaseKotlinBUILD SUCCESSFUL, and:app:processReleaseManifestmerged the new<queries>(verified present in the merged release manifest).Docs updated:
docs/internals/mobile/README.md,README.zh-CN.md,harmonyos-compatibility.zh-CN.md(including how to read the two possible device outcomes).