Enable Google Photos in the device media picker#23102
Conversation
|
|
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #23102 +/- ##
=======================================
Coverage 37.57% 37.58%
=======================================
Files 2341 2342 +1
Lines 127098 127112 +14
Branches 17538 17545 +7
=======================================
+ Hits 47763 47772 +9
- Misses 75423 75424 +1
- Partials 3912 3916 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
86037b7 to
ef9cca3
Compare
When the custom media grid's "Choose from device" action allows both
visual media and other files (the editor's add-file flow), tapping it
now shows a menu anchored to the action-bar item: "Photos and videos"
opens the visual picker (which the OS surfaces as the Android Photo
Picker on Android 13+), and "Other files" opens the document/audio
chooser. Flows with a single known type (featured image, site icon,
gravatar, editor photo/video) launch their picker directly, unchanged.
This preserves the custom grid's edit-before-upload capability while
enabling Google Photos browsing via the nested device picker.
- MediaPickerFragment: carry allowedTypes on OpenSystemPicker; add an
onSystemPickerTypeChosen passthrough.
- MediaPickerViewModel: pass allowedTypes through; re-run the picker
with a narrowed type set on menu selection; restrict the {AUDIO,
DOCUMENT} context to audio + document MIME types.
- MediaPickerActivity: show the disambiguation PopupMenu anchored to the
browse action item when the selection is ambiguous.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
For visual-media contexts, Android 13+ routes ACTION_GET_CONTENT to the
system Photo Picker, which filters album and cloud contents by an exact
match against EXTRA_MIME_TYPES. Passing our explicit list of accepted
subtypes (image/jpeg, image/heic, ...) made Google Photos albums and
"From this device" appear empty ("No photos yet"), because cloud items
may not report a subtype in that list.
Use a broad type (image/* and/or video/*) for the PHOTO, VIDEO, and
PHOTO_OR_VIDEO contexts so the picker shows all visual media, matching
how other apps behave. Audio and document flows use the document browser
and keep the explicit accepted-types list.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Picking a category from the "Photos and videos" / "Other files"
disambiguation menu re-triggered the icon click, which fired the
MEDIA_PICKER_OPEN_DEVICE_LIBRARY event a second time (the first firing
happened when the menu was shown, before any picker opened). Split the
navigation out of clickIcon so the category re-trigger navigates without
tracking again.
Also tighten the {AUDIO, DOCUMENT} chooser branch to an exact set match
instead of a containsAll subset test, so only the disambiguation
"Other files" selection routes there.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ewModel The Activity previously re-derived the visual-vs-other-files classification to decide whether to show the disambiguation menu, duplicating the allowedTypes taxonomy the ViewModel already owns. The ViewModel now makes that decision and emits a dedicated ShowSystemPickerTypeMenu action; the Activity just renders the menu. This also corrects the "device library opened" analytics timing: the ambiguous tap now shows the menu without tracking, and the open is tracked when the user picks a category (the point at which a picker actually opens), so dismissing the menu no longer counts as an open. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Update the "all supported files" test to expect the new ShowSystemPickerTypeMenu action, and add coverage for choosing a category (photos/videos -> PHOTO_OR_VIDEO, other files -> MEDIA_FILE) and for the device-library open being tracked on category choice rather than when the disambiguation menu is shown. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…rator Move the allowedTypes -> (ChooserContext, MIME types) mapping and the visual-vs-other-files ambiguity check out of MediaPickerViewModel into a new SystemPickerResolver. This keeps the ViewModel under detekt's LargeClass threshold (the disambiguation additions had pushed it over) and makes the picker-type resolution independently testable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…io/docs The disambiguation "Other files" option scoped the document browser to audio and documents only, which regressed the pre-disambiguation file picker: an image or video reachable only by browsing the filesystem (e.g. a freshly downloaded image in Downloads that the Photo Picker hasn't surfaced) could no longer be selected. Send the full accepted- types set so ACTION_OPEN_DOCUMENT shows images, videos, audio, and documents, matching trunk's file picker. Remove the now-unused audio+documents-only resolver branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Match the surrounding branches (including the OpenCameraForPhotos object) which use `is` for their type checks, for consistency. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ef9cca3 to
9ad06dc
Compare
| return | ||
| } | ||
| } | ||
| // Do we need tracking here?; review tracking need. |
There was a problem hiding this comment.
Deemed a lingering comment that is no longer relevant from reviewing #13075.
| navigateForIcon(icon) | ||
| } | ||
|
|
||
| private fun navigateForIcon(icon: MediaPickerIcon) { |
There was a problem hiding this comment.
Extracted to ensure analytic events occur on navigation, not simply tapping the icon button the menu bar. E.g., this avoids duplicate events when tapping "Choose from device" → "Photos and videos."
There was a problem hiding this comment.
Extracted from MediaPickerViewModel to avoid Detekt warnings regarding class size.
| case PHOTO: | ||
| return new String[]{"image/*"}; | ||
| case VIDEO: | ||
| return new String[]{"video/*"}; | ||
| case PHOTO_OR_VIDEO: | ||
| return new String[]{"image/*", "video/*"}; |
There was a problem hiding this comment.
The broader MIME types ensure Google Photos does not display populated albums in its top-level view that then appear empty ("No photos yet" message) once navigating into an album itself.
|
@dcalhoun I haven't tested this yet, but I did a Claude review which may be helpful to you. |
|
@nbradbury thanks. Claude provided me similar feedback when I used it for review before requesting your own. Are there items you believe are worthwhile addressing? 1. The empty-albums fix misses the editor’s “Choose from device” flow 2. Broad types drop subtype filtering on the document-browser route 3. Menu items hardcode type sets instead of deriving from the flow’s 4. Two sources of truth for the visual-context MIME mapping |
|
@dcalhoun The way Claude worded the first one made it sound like a problem, but the rest sounded like nitpicks. I'm okay with leaving things as-is if you are. |
|
@dcalhoun This isn't working for me. I went to My Site > Media, tapped the + button and selected "Choose from device," but I still see the same "Choose from device" screen as I do prior to this PR. |
|
@nbradbury it appears the testing instructions steps lack nuanced steps that are showcased in the screen recording in the PR description. One needs to tap the image icon button in the top-right corner once viewing the custom media grid (shown when tapping "Choose from device"). I'll update the testing instructions. |
|
Ah! That explains it. For some reason the video wouldn't play for me so I
missed that step, but I just tried again and it works fine.
…On Wed, Jul 15, 2026, 10:38 AM David Calhoun ***@***.***> wrote:
*dcalhoun* left a comment (wordpress-mobile/WordPress-Android#23102)
<#23102 (comment)>
@nbradbury <https://github.com/nbradbury> it appears the testing
instructions steps lack nuanced steps that are showcased in the screen
recording in the PR description. One needs to tap the image icon button in
the top-right corner once viewing the custom media grid (shown when tapping
"Choose from device"). I'll update the testing instructions.
—
Reply to this email directly, view it on GitHub
<#23102?email_source=notifications&email_token=AA5ZCDORVD5TS3PIKFKGKZ35E6JOLA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIOJYGE4DENZQGY4KM4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4981827068>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA5ZCDP6GYBCIFIKRMBHLRD5E6JOLAVCNFSNUABDKJSXA33TNF2G64TZHM4TGMBWGU3DQO2JONZXKZJ3GQ4DQNBRGMZDINBVUF3AE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
…ypes The broad image/* and video/* wildcards for the Photo Picker were decided in WPMediaUtils.getMimeTypesForChooser, which overrode and discarded the explicit subtype lists SystemPickerResolver had computed for the same visual contexts. That left dead data in the resolver and duplicated the ChooserContext -> MIME mapping across two files and two languages. Move the wildcards into the resolver (the sole producer of OpenSystemPicker) and drop the override so prepareChooserIntent uses the resolved MIME types directly. Behavior is unchanged; add assertions locking in image/* and image/*+video/* for the visual contexts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@dcalhoun When I add a Screen_recording_20260715_124329.mp4 |
|
Also, when adding an image to a post, should I see the image icon? Screen_recording_20260715_124805.mp4 |
|
@nbradbury it appears you are using GutenbergKit. These changes do not impact GutenbergKit, only Gutenberg Mobile. I hoped the note in the PR description atop the testing instructions would clearly communicate that. Will you try Gutenberg Mobile instead? |
Apologies, @dcalhoun - I think I was juggling too much along with this review. I'll approve the PR. |


Description
Fix CMM-2161. Fix CMM-2162.
This adds an enhancement and addresses an existing bug.
Enhancement: Google Photos access from the media grid "Choose from device" picker. In the custom media grid, tapping "Choose from device" previously handed off to the system chooser using whatever media type the flow was configured for. For flows that allow both visual media and other files (e.g. My Site → Media), the type was ambiguous, so the flow fell back to the file/document browser instead of the system Photo Picker. Now, when the selection is ambiguous, a small menu (anchored to the browse action) lets the user choose "Photos and videos" or "Other files". This improves the selection experience and allows accessing Google Photos albums.
Alternative considered
Replace the "Choose from device" menu item within the existing menu attached to the media grid's + icon button with the new menu items (Photos and videos, Other files). Deferred as a larger change that would remove media grid features (e.g., edit image before uploading) and increase likelihood of regressions.
Bug: Fix empty Google Photos albums. When picking photos/videos, Android 13+ routes the picker to the system Photo Picker, which filters album and cloud contents by an exact match against
EXTRA_MIME_TYPES. The app was passing an explicit list of accepted subtypes (image/jpeg,image/heic, …), so Google Photos albums and "From this device" appeared empty because cloud items may not report a matching subtype. Visual contexts now pass a broad type (image/*and/orvideo/*), matching how other apps behave; audio and document flows keep the explicit accepted-types list.Historical context found in related PRs:
Testing instructions
Important
These changes do not impact the GutenbergKit editing experience; only the Gutenberg Mobile editor experience.
My Site → Media (originally reported flow):
photo/video uploads to the site.
Google Photos access (in-grid device picker, editor):
and Other files.
Empty Google Photos albums fix (other flows):
Featured Image or add an image via an editor image block
Android Photo Picker.
No behavior change for single-type flows:
menu, and selection/upload works as before.
Regression:
Screen_Recording_20260714_104732_Jetpack.Debug.mp4