Skip to content

Use Android Photo Picker for external media selection - #2010

Open
cryptochrome wants to merge 1 commit into
DrKLO:masterfrom
cryptochrome:agent/use-android-photo-picker
Open

Use Android Photo Picker for external media selection#2010
cryptochrome wants to merge 1 commit into
DrKLO:masterfrom
cryptochrome:agent/use-android-photo-picker

Conversation

@cryptochrome

@cryptochrome cryptochrome commented Aug 6, 2026

Copy link
Copy Markdown

Summary

  • use the system MediaStore.ACTION_PICK_IMAGES flow for single external image/video selection on Android 13 and newer
  • fall back to ACTION_OPEN_DOCUMENT with image/video MIME filters on older devices or when the system Photo Picker cannot be resolved
  • detect returned videos by MIME type and copy non-file-backed picker URIs to Telegram's cache off the UI thread before opening the video editor

Why

The external media action currently combines ACTION_PICK for images with ACTION_GET_CONTENT for videos. Because these are implicit intents, device manufacturers can resolve them to different apps; on Samsung devices this can open Samsung Gallery instead of Android's privacy-preserving Photo Picker and omit configured cloud media providers.

ACTION_PICK_IMAGES is the platform-recommended image/video selection action on supported Android versions. Picker URIs do not expose a normal filesystem path, so the result handling also needs to use the returned MIME type and copy video content when necessary.

User impact

On supported devices, Telegram's external media action opens the Android Photo Picker consistently and can expose the user's configured cloud media provider. Older devices retain a system picker fallback without requiring a new dependency.

Validation

  • git diff --check passes
  • verified both chat attachment entry points use the shared picker helper
  • verified the existing request codes and single-URI result flow are preserved
  • searched existing upstream pull requests for photo picker and ACTION_PICK_IMAGES; no duplicate implementation was found

@cryptochrome
cryptochrome marked this pull request as ready for review August 6, 2026 09:18
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