From 4223e8e3903deb01029596a46e7656c6351c9ecc Mon Sep 17 00:00:00 2001 From: Alexandru Gologan Date: Tue, 6 Oct 2020 16:22:08 +0300 Subject: [PATCH] Add package visibility manifest query for accessing browsers on sdk 30 --- README.md | 20 ------------------- app/AndroidManifest.xml | 13 ------------ library/AndroidManifest.xml | 8 ++++++++ .../appauth/browser/BrowserSelector.java | 3 +-- 4 files changed, 9 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 747741a0..a8b13c2c 100644 --- a/README.md +++ b/README.md @@ -51,26 +51,6 @@ either through custom URI scheme redirects, or App Links. AS's that assume all clients are web-based or require clients to maintain confidentiality of the client secrets may not work well. -From Android API 30 (R) and above, set [queries](https://developer.android.com/preview/privacy/package-visibility) in the manifest, -to enable AppAuth searching for usable installed browsers. -```xml - - - - - - - - - - - - - - ... - -``` - ## Demo app A demo app is contained within this repository. For instructions on how to diff --git a/app/AndroidManifest.xml b/app/AndroidManifest.xml index 0a180c70..d5549e1f 100644 --- a/app/AndroidManifest.xml +++ b/app/AndroidManifest.xml @@ -17,19 +17,6 @@ - - - - - - - - - - - - - + + + + + + + + diff --git a/library/java/net/openid/appauth/browser/BrowserSelector.java b/library/java/net/openid/appauth/browser/BrowserSelector.java index 75da1ca5..b3f3881b 100644 --- a/library/java/net/openid/appauth/browser/BrowserSelector.java +++ b/library/java/net/openid/appauth/browser/BrowserSelector.java @@ -182,8 +182,7 @@ private static boolean hasWarmupService(PackageManager pm, String packageName) { private static boolean isFullBrowser(ResolveInfo resolveInfo) { // The filter must match ACTION_VIEW, CATEGORY_BROWSEABLE, and at least one scheme, if (!resolveInfo.filter.hasAction(Intent.ACTION_VIEW) - || !(resolveInfo.filter.hasCategory(Intent.CATEGORY_BROWSABLE) - || (resolveInfo.filter.hasCategory(Intent.CATEGORY_APP_BROWSER))) + || !resolveInfo.filter.hasCategory(Intent.CATEGORY_BROWSABLE) || resolveInfo.filter.schemesIterator() == null) { return false; }