Stop appending requireOriginal to URIs loaded by Glide on Android R+#5668
Merged
copybara-service[bot] merged 1 commit intomasterfrom Apr 7, 2026
Merged
Stop appending requireOriginal to URIs loaded by Glide on Android R+#5668copybara-service[bot] merged 1 commit intomasterfrom
copybara-service[bot] merged 1 commit intomasterfrom
Conversation
be95aab to
0ab095a
Compare
2e5a18a to
e1cb7be
Compare
Motivation and Context On Android R and above, Glide no longer appends the requireOriginal parameter when loading MediaStore URIs. Having the ACCESS_MEDIA_LOCATION permission does not always guarantee access to an unredacted file or location sharing. For example, unnecessarily adding requireOriginal to Android Photopicker URIs can cause apps to crash, as an UnsupportedOperationException may be thrown by the MediaProvider if the criteria to return an original unredacted file is not met by a PickerURI. Furthermore, the previous approach of selectively ignoring Picker URIs from the requireOriginal appending caused an inconsistency in the expectations of Glide's clients. Clients could not reliably predict whether Glide would load the original or redacted file, as the behavior differed silently based on the specific type of URI being processed. To provide a consistent and predictable API, the automatic appending behavior is removed entirely for Android R and above. If an app requires the original file, it should explicitly call and handle setRequireOriginal itself. (Note: The automatic appending behavior is preserved for Android Q to avoid regressions related to known OS bugs). PiperOrigin-RevId: 895749372
e1cb7be to
c0a2dd4
Compare
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.
Stop appending requireOriginal to URIs loaded by Glide on Android R+
Motivation and Context
On Android R and above, Glide no longer appends the requireOriginal parameter when loading MediaStore URIs. Having the ACCESS_MEDIA_LOCATION permission does not always guarantee access to an unredacted file or location sharing. For example, unnecessarily adding requireOriginal to Android Photopicker URIs can cause apps to crash, as an UnsupportedOperationException may be thrown by the MediaProvider if the criteria to return an original unredacted file is not met by a PickerURI.
Furthermore, the previous approach of selectively ignoring Picker URIs from the requireOriginal appending caused an inconsistency in the expectations of Glide's clients. Clients could not reliably predict whether Glide would load the original or redacted file, as the behavior differed silently based on the specific type of URI being processed.
To provide a consistent and predictable API, the automatic appending behavior is removed entirely for Android R and above. If an app requires the original file, it should explicitly call and handle setRequireOriginal itself. (Note: The automatic appending behavior is preserved for Android Q to avoid regressions related to known OS bugs).