CI-915 Keep The Login Pipeline Alive Across Rotation - #3890
Open
OrangeAndGreen wants to merge 3 commits into
Open
CI-915 Keep The Login Pipeline Alive Across Rotation#3890OrangeAndGreen wants to merge 3 commits into
OrangeAndGreen wants to merge 3 commits into
Conversation
Contributor
Author
Suggested Review Order
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## CI-915-progress-dialog-state-loss-fix #3890 +/- ##
===========================================================================
+ Coverage 27.92% 28.14% +0.21%
- Complexity 4885 4923 +38
===========================================================================
Files 987 988 +1
Lines 58969 58996 +27
Branches 7022 7023 +1
===========================================================================
+ Hits 16465 16602 +137
+ Misses 40525 40405 -120
- Partials 1979 1989 +10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
OrangeAndGreen
marked this pull request as ready for review
August 28, 2026 19:24
The login pipeline ran on LoginActivity's lifecycleScope, which is cancelled at onDestroy. Rotating mid-login therefore tore it down: SyncOperations cancels DataPullTask when its continuation is cancelled, so the restore was aborted part-way, no result was ever delivered, and the progress dialog was left up for a login that was no longer running. Pre-2.64 this was handled by the task-connector framework - DataPullTask was held in TaskConnectorViewModel and re-attached to the recreated activity. The headless login engine opted out of that (HeadlessTaskConnector.connectTask is a no-op), so restore an equivalent: LoginViewModel owns the job in viewModelScope, which survives configuration changes and is cancelled only when the activity genuinely finishes. Progress and result are exposed as LiveData so the recreated activity re-subscribes instead of being handed callbacks bound to the destroyed instance. Replaying progress is what rebuilds the dialog after a rotation; currentLoginPhase deliberately stays on the activity, because it is the phase-vs-null mismatch on a fresh instance that triggers the re-show. The result is single-use so a rotation after login completes does not hand the same outcome to the next activity. LoginController.start() existed only to bridge into lifecycleScope and had a single caller, so it is removed rather than adapted; the ViewModel calls performLogin directly, as ConnectAppLauncher already does. Passing the application context also drops the activity reference the pipeline's collaborators used to hold for its whole duration. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
OrangeAndGreen
force-pushed
the
CI-915-login-rotation-viewmodel
branch
from
August 28, 2026 19:35
976eead to
a8702ec
Compare
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.
CI-915
Stacked on PR #3881 that fixes the initial crash when trying to show the dialog on resume.
Product Description
Rotating the device during login no longer breaks it. Previously, a rotation mid-sync aborted the data pull, left the progress dialog frozen part-way, and never completed or failed the login — the user had to force-quit and start over.
Technical Summary
LoginActivity'slifecycleScope, which is cancelled atonDestroySyncOperationscancelledDataPullTaskfrom itsinvokeOnCancellationhandlerPre-2.64 this was handled by the task-connector framework, but the headless login engine opted out of that and uses
HeadlessTaskConnector.connectTaskinstead.This PR introduces
LoginViewModelto own the job inviewModelScopeso it can survive configuration changes.A couple extra notes:
currentLoginPhasestayed inLoginActivityso it gets reset on activity recreation and is used to show the dialog againSafety Assurance
Safety story
Automated test coverage
Four tests added to
LoginProgressDialogLifecycleTest:rotation keeps the login running and puts its dialog backstop button cancels a pipeline that survived rotationa consumed result is not redelivered after rotationa finished login leaves no dialog behind on rotation