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

Use the MuzeiArtProvider's authority as the unique key #570

merged 8 commits into from Sep 14, 2018


None yet
1 participant

ianhanniballake commented Sep 14, 2018

Rather than rely on the ComponentName of the MuzeiArtProvider as its unique key within Muzei, use the unique authority attached to the MuzeiArtProvider to identify each provider. This ensures that developers can freely refactor their MuzeiArtProvider class without breaking Muzei.

This change has two effects on the Muzei API:

  • The replacement metadata should be the authority String, not a ComponentName (although a ComponentName is still supported)
  • The ProviderContract.Artwork methods that take a ComponentName have been removed in favor of versions that take an authority. The authority versions should be preferred to avoid a PackageManager lookup.

ianhanniballake added some commits Sep 14, 2018

Convert to using the MuzeiArtProvider authority as the unique key
Every ContentProvider as a unique authority, so switch to using that over using the ComponentName of the MuzeiArtProvider.
Replace with
Remove an extension method on String and scope it to ProviderManager
Replace String.getProviderDescription with ProviderManager method
Instead of having an extension on String, move the method to ProviderManager to scope it properly
Replace ProviderContract ComponentName methods with authority versions
Developers should either use the Class versions if they know the exact class or use the authority as the unique key for a given MuzeiArtProvider.
Simplify ProviderContract.Artwork.getContentUri
Remove the PackageManager check, making this a much less expensive operation.
Prefer the authority ProviderContract methods where possible
Save a PackageManager lookup by preferring the authority versions of ProviderContract.Artwork methods.

@ianhanniballake ianhanniballake added this to the api-3.0.0-alpha04 milestone Sep 14, 2018

@ianhanniballake ianhanniballake merged commit 4603f5f into romannurik:master Sep 14, 2018

@ianhanniballake ianhanniballake deleted the ianhanniballake:authority_as_key branch Sep 14, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment