Respect default browser of the user#379
Conversation
a possible default browser of the user is respected. fixes: openid#372 split from openid#369 Signed-off-by: Henning Nielsen Lund <henning.n.lund@jp.dk>
|
As stated in #369 I have tried to look more into it. Looking at the code generating the list returned by queryIntentActivities: |
|
Fixes #368 |
Add support for custom tabs in Firefox. Support for custom tabs was added to stable Firefox in version 57.0 Fixes: openid#368 Signed-off-by: Henning Nielsen Lund <henning.n.lund@jp.dk>
iainmcgin
left a comment
There was a problem hiding this comment.
Thanks for this! If you can address the review comments, in particular the need for tests, I can merge this change.
| if (VERSION.SDK_INT >= VERSION_CODES.M) { | ||
| queryFlag |= PackageManager.MATCH_ALL; | ||
| } | ||
| ResolveInfo resolvedDefaultActivity = |
There was a problem hiding this comment.
Could you add a brief comment here describing the issue, e.g.
When requesting all matching activities for an intent from the package manager, the user's preferred browser is not guaranteed to be at the head of this list. Therefore, the preferred browser must be separately determined and the resultant list of browsers reordered to restored this desired property.
|
|
||
| if (hasWarmupService(pm, info.activityInfo.packageName)) { | ||
| browsers.add(new BrowserDescriptor(packageInfo, true)); | ||
| BrowserDescriptor customTabBrowserDescriptor = |
There was a problem hiding this comment.
Could you add tests to BrowserSelectorTest that demonstrate:
- If the user has no default browser, the order of the returned browsers matches the order of matching intents returned by
queryIntentActivities. This case is likely already covered by the existing tests, but it will help to make that more explicit. - If the user has a default browser, with custom tab support, the two entries for that browser are at the start of the list, with the custom tab descriptor first.
- If the user has a default browser, without custom tab support, that one entry for that browser is at the start of the list.
The code looks correct to me, but I just want to make sure that the changes are appropriately covered by tests so that future changes don't result in regressions.
There was a problem hiding this comment.
The tests have now been added.
a possible default browser of the user is respected. fixes: openid#372 split from openid#369 Signed-off-by: Henning Nielsen Lund <henning.n.lund@jp.dk>
…droid into default-browser
openid#379 (comment) Signed-off-by: Henning Nielsen Lund <henning.n.lund@jp.dk>
The test is now also checking if the BrowserDesriptors are added in the correct order, by checking useCustomTab. Signed-off-by: Henning Nielsen Lund <henning.n.lund@jp.dk>
Now also check if there is no browser supporting custom tabs, but a browser is set as the default browser, so it should be returned. Signed-off-by: Henning Nielsen Lund <henning.n.lund@jp.dk>
iainmcgin
left a comment
There was a problem hiding this comment.
Thank you for your patience, and for the addition of the tests.
* Minor README fixes (openid#351) Thanks to @celphy for spotting these mistakes. * Add WeWork to AUTHORS WeWork, as my employer, is now the copyright owner for my contributions to AppAuth. * Dependency version bump * Handle CustomTabsSession.newSession failures Fixes openid#315. * Enable Java 8 language features * Do not automatically pass scope on token exchange request Fixes openid#297. * Do not override tab title setting Fixes openid#358. * Firefox customtabs (openid#378) Add support for custom tabs in Firefox. Support for custom tabs was added to stable Firefox in version 57.0 Fixes: openid#368 Signed-off-by: Henning Nielsen Lund <henning.n.lund@jp.dk> * Respect default browser of the user (openid#379) Correctly orders the user's preferred browser to the start of the returned list. * Custom Tabs was first added in Samsung Internet 4.0 (openid#383) At the moment all versions of the Samsung Internet Browser is set to support Custom Tabs. Support for Custom Tabs was first added in version 4.0. fixes: openid#382 * add getBrowserDescriptor() (openid#388) Make it possible to get the BrowserDescriptor used by AuthorizationService. fixes: openid#387 Signed-off-by: Henning Nielsen Lund <henning.n.lund@jp.dk> * Android gradle plugin version bump * Implement ID Token validation according to OIDC spec (openid#385) Validate ID Tokens (if any) on TokenResponses according to http://openid.net/specs/openid-connect-core-1_0.html#IDTokenValidation * Add Øyvind to the contributors list * Update CONTRIBUTORS with email (openid#397) * Use CustomTabsService.ACTION_CUSTOM_TABS_CONNECTION in BrowserSelector. (openid#411) * This helps with the jetification. I produced an artifact locally, and wrote a sample app using: ```gradle implementation 'androidx.appcompat:appcompat:1.0.0-rc02' implementation 'androidx.browser:browser:1.0.0-rc02' ``` to make sure that the app works. Fixes: openid#395 * Issue openid#402: fixes NPE in case input stream is null (openid#414) * Fix spelling mistake * Update link to custom tabs documentation * Fix typo in README.md (openid#455) * Fix `Using access tokens` snippet in the readme (openid#510) The snippet code in the `Using access tokens` section didn't follow java code formatting. * Use capitalized form for "Bearer" token type While this is case-insensitive, some provider implementations do not correctly handle the lower case form. * Migrate to AndroidX & Update dependencies (openid#508) * gradle update to 5.4.1 * gradle plugin update to 3.5.3 * minor bintray update * bump compile sdk to 29 - this requires bumping build tools to 29 - also updating the gradlewrapper (again, fully) to 5.4.1 * Migrate to AndroidX This required changes to checkstyle & javadocs gradle files (perhaps because of jetifier? not sure tbh) Also mockito now can mock all final classes * Fix compiler warning * update travis build tools to 29.0.2 to align with build.gradle * update travis android sdk version to 29 to align with build.gradle * Android11 support (openid#558) - Migrated from the deprecated Android Support libraries to the newest versions of the AndroidX libraries. - The Android gradle plugin is updated to the current 4.0.0. - Glide is updated to the current 4.11.0, and 4.1x.x is needed for AndroidX support. - limit the allowed queries to only fullbrowsers - openid#554 . - Add support for CATEGORY_APP_BROWSER. - Update dependencies * Deprecate whitelist and blacklist (openid#555) * Replace BrowserBlacklist with BrowserDenyList and BrowserWhitelist with BrowserAllowList * Add xmlpull library dependency for tests because some of the unit tests fail without it. * Override constructors and add a deprecation migration test * Update library version to 0.8.0-skyscanner * Fix build after upgrading gradle plugin (as result of syncing up with openid repo) Co-authored-by: Iain McGinniss <iainmcgin@gmail.com> Co-authored-by: Iain McGinniss <iain.mcginniss@wework.com> Co-authored-by: Henning Lund <40355805+hnljp@users.noreply.github.com> Co-authored-by: Øyvind Robertsen <oyvindrobertsen@gmail.com> Co-authored-by: Rahul Ravikumar <tikurahul@users.noreply.github.com> Co-authored-by: Thomas Rebouillon <thomas.rebouillon@gmail.com> Co-authored-by: Mark Kowalski <mark.kowalski86@googlemail.com> Co-authored-by: Ahmad El-Melegy <ahmad.melegy@gmail.com> Co-authored-by: Paul Blundell <blundell.app.dev@gmail.com> Co-authored-by: Jon F Hancock <jonfhancock@gmail.com> Co-authored-by: Athila Santos <athilahs>


a possible default browser of the user is respected.
fixes: #372
split from #369
Signed-off-by: Henning Nielsen Lund henning.n.lund@jp.dk