Add support for Android 11 new privacy settings #335
Merged
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.
Changes
When this library is used on Android 11, the new privacy rules kick in preventing our
CustomTabsController
class to query for browser apps in order to pick the best candidate. The result is a failure, or an automatically cancelled authentication. By using the latest Android Gradle Plugin patch and adding the "queries" tag in the library's manifest, the final manifestThe lint-ignore rule at the top of the manifest is required until we target SDK 30. In order to do that, we need to migrate to and support AndroidX.
Compiling: For anyone running into compiling issues where the "queries" tag in the manifest is not a valid tag, that's because your app is using an old version of the Android Gradle Plugin that still doesn't have support for queries. Check the link below to learn to what version you should update.
References
Testing
I've tested this on a separate sample app that targets SDK 30. As seen in the attached screenshot, bottom right, the "queries" tag is added to the merged manifest file and comes from the changes on this PR.
I've also tested this when the sample app defines its own set of queries. And both turn out to be merged correctly, without the need to use any special node annotation.
Checklist
I have read the Auth0 general contribution guidelines
I have read the Auth0 Code of Conduct
All existing and new tests complete without errors