Fix Switch browser back stack error#2750
Merged
Merged
Conversation
|
❌ Work item link check failed. Description does not contain AB#{ID}. Click here to Learn more. |
…ine intent handling and improve code clarity
…uce SwitchBrowserActivity for improved browser switching flow
…mproved logging and clarity; streamline intent creation in SwitchBrowserProtocolCoordinator
… remove unused parameters for improved clarity and simplicity
…dle user cancellations and improve activity lifecycle management
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements a redesigned switch browser flow to fix back stack management issues. The changes replace direct browser launching from the challenge handler with a dedicated SwitchBrowserActivity that manages the browser lifecycle more cleanly.
Key Changes:
- Introduced
SwitchBrowserActivityto handle browser launch and redirect management - Updated
SwitchBrowserRequestHandlerto delegate to the new activity instead of launching browsers directly - Modified protocol coordinator to support the new activity-based flow
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| SwitchBrowserActivity.kt | New activity that manages browser launch and authentication redirects |
| SwitchBrowserRequestHandler.kt | Simplified to launch SwitchBrowserActivity instead of managing browsers directly |
| SwitchBrowserProtocolCoordinator.kt | Updated to work with new activity and renamed property |
| WebViewAuthorizationFragment.java | Added static bundle management for switch browser resume data |
| BrokerAuthorizationActivity.java | Removed switch browser specific onNewIntent handling |
| AuthorizationActivityFactory.kt | Removed switch browser specific intent flags |
| Test files | Updated to reflect API changes and removed unused dependencies |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
…oviders/oauth2/SwitchBrowserActivity.kt Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…oviders/oauth2/WebViewAuthorizationFragment.java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
shahzaibj
reviewed
Sep 2, 2025
…rove browser launch logic
shahzaibj
approved these changes
Sep 2, 2025
melissaahn
approved these changes
Sep 2, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
The current DUNA implementation launches
BrokerAuthorizationActivitywithFLAG_ACTIVITY_NEW_TASKandFLAG_ACTIVITY_CLEAR_TASK.This causes:
The issue arises because the activity stack is cleared, preventing proper continuation of dependent flows.
Solution
Introduce
SwitchBrowserActivityto handle the browser switch during the DUNA authentication flow.This approach:
Activity Stack Behavior
BrokerAuthorizationActivitylaunchesSwitchBrowserActivityin Task 2BrokerAuthorizationActivity| Task 2:SwitchBrowserActivity→ Chrome Custom TabsBrokerAuthorizationActivity| Task 2:SwitchBrowserActivity→ Chrome Custom Tabs | Task 3:BrokerBrowserRedirectActivityBrokerAuthorizationActivity| Task 2:SwitchBrowserActivity→ Chrome Custom Tabs | Task 3:BrokerBrowserRedirectActivity(finishes)Flow Overview of
SwitchBrowserActivityWebViewAuthorizationFragmentreceives a SwitchBrowser challengeSwitchBrowserActivityis launched with browser configuration parametersBrokerBrowserRedirectActivityin a new taskBrokerBrowserRedirectActivityforwards redirect result back toSwitchBrowserActivityviaonNewIntent()SwitchBrowserActivitypasses the result toWebViewAuthorizationFragmentSwitchBrowserActivityfinishes and removes itself from the task stackSecurity Note
SwitchBrowserActivityis not exported