Skip to content

Stop appending requireOriginal to URIs loaded by Glide on Android R+#5668

Merged
copybara-service[bot] merged 1 commit intomasterfrom
test_890962602
Apr 7, 2026
Merged

Stop appending requireOriginal to URIs loaded by Glide on Android R+#5668
copybara-service[bot] merged 1 commit intomasterfrom
test_890962602

Conversation

@copybara-service
Copy link
Copy Markdown

@copybara-service copybara-service bot commented Mar 28, 2026

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).

@copybara-service copybara-service bot force-pushed the test_890962602 branch 11 times, most recently from be95aab to 0ab095a Compare March 31, 2026 19:03
@copybara-service copybara-service bot changed the title Stop appending requireOriginal to URIs loaded by Glide Stop appending requireOriginal to URIs loaded by Glide on Android R+ Mar 31, 2026
@copybara-service copybara-service bot force-pushed the test_890962602 branch 9 times, most recently from 2e5a18a to e1cb7be Compare April 7, 2026 08:09
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
@copybara-service copybara-service bot merged commit c0a2dd4 into master Apr 7, 2026
@copybara-service copybara-service bot deleted the test_890962602 branch April 7, 2026 08:39
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