New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid referencing resource names within Resource Loader #5388
Conversation
@benjaminRomano thanks for the pull request and sorry for the delay in reviewing it. Do you have an update on your test Plan, ("TODO: still building locally and verifying")? Can you update your commit message with the answer? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you squash this commit with your other commits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be extra safe, would it be possible for you to flag guard this change, roll it out in your binary, verify there are no issues, and then clean-up the flag?
See recent pull requests where this was done:
I tried to build locally, but I'm hitting the following error when running
I'm OK with wiring an experiment if need be, but it's likely unnecessary precautions. The content URI format being used has been around since Cupcake (ref): https://developer.android.com/reference/android/content/ContentResolver#the-android.resource-scheme_android_resource-scheme The equivalent code in AOSP can be found here: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/content/ContentResolver.java;l=1499?q=SCHEME_ANDROID_RESOURCE Tracing the AOSP source code, it can be verified that migrating the the new content URI scheme is safe. Effectively, About a month or two ago, we migrated all our content URIs to the new format for Snapchat and did not encounter any issues as expected.
I can do this once I've addressed all comments, but you'll also be able to squash merge my commits and re-write the commit messages when you merge changes through Github. |
Sorry for the late reply. I use JDK 17 to build. On my macOS device, I run
to build Glide. Thanks for addressing my other comments. Unfortunately, this repo is not configured to allow squashing and merging (and I don't have permission to change that). Can you take care of the squashing? |
Squash merged my commits. it should be good to go now. Unfortunately, I still can't get the dependency error. If I find some time, I'll dig into it further. Potentially this is an issue with some kind of global gradle config being mis-configured |
@falhassen when should I expect new version of Glide to be released? |
@benjaminRomano unfortunately getting a new version of Glide may take some time. However, you can immediately deploy the new changes in your app by depending on a Glide snapshot, following Glide's instructions: https://bumptech.github.io/glide/dev/snapshots.html#about-snapshots. I believe 5.0.0-SNAPSHOT/ should have your commit. |
Description
We are working on enabling the collapse names optimization of
aapt2
that removes the resource names from the Resource Table as an app size optimization. However, once enabled, we ran into issues loading resources.One requirement of removing resource names from the Resource Table is ensuring that resources are not referenced by resource name when loaded. If they are referenced by resource name, they must be explicitly kept with keep rules. (ref).
Motivation and Context
ResourceLoader is using the
android.resource://<package_name>/<resource_type>/<resource_name>
content URI to resolve Drawable resources, which is incompatible with collapse names optimization.Fortunately, the ContentResolver for resources has another URI scheme that enables loading resources without referencing the name:
android.resource://<package_name>/<resource_id>
, which can be used instead (ref).Test Plan
Pre-merge passes (TODO: still building locally and verifying)