ADFA-4576 (F1 slice 1): carve the OTA self-updater into UpdateController#140
Merged
Merged
Conversation
First slice of the MainActivity god-class carve (F1). Moves the OTA self-update glue out of MainActivity into update/presentation/UpdateController, mirroring the Controller seam used for DeployFragment/SyncFragment. No Host needed — the flow is self-contained (Activity-scoped), so the controller just takes the Activity. - New UpdateController: owns checkForUpdates, the update dialog, the download (staged in the app's private external dir), the DownloadManager receiver, same-cert signature verification, the in-app progress dialog and the install hand-off. Sits on the existing update/ slice (UpdateViewModel/ApkVerifier). Cooldown for the manual trigger moved in as checkForUpdatesManual(). - MainActivity: dropped the 4 OTA fields, the downloadReceiver and the 10 OTA methods; the version-footer tap/click now calls updateController.checkForUpdatesManual(), onResume/onPause forward register/unregister, and the initial check is updateController.checkForUpdates(false). 2288 -> 1918 LOC (-370). Behaviour-preserving.
This was referenced Jul 7, 2026
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.
Context
F1inTECH_DEBT_PLAN.md:MainActivity(~2288 LOC) is the last god class. This is the first slice of its carve, using the same Controller seam asDeployFragment/SyncFragment. The OTA self-updater is fully self-contained (Activity-scoped, no callbacks back intoMainActivity), so no Host is needed — the controller just takes theAppCompatActivity.Changes
update/presentation/UpdateController— owns the whole OTA flow:checkForUpdates, the update dialog, the download (staged in the app's private external dir), theDownloadManagercompletion receiver, same-certificateApkVerifiercheck, the in-app progress dialog (renderUpdateState) and the install hand-off (FileProvider + unknown-sources permission). Sits on the existing layeredupdate/slice (UpdateViewModel/UpdateUiState/ApkVerifier/UpdateViewModelFactory— same package, no new domain code). The manual-trigger 10s cooldown moved in ascheckForUpdatesManual().MainActivity— removed the 4 OTA fields, thedownloadReceiver, and the 10 OTA methods. NowupdateController = new UpdateController(this)inonCreate; the version-footer tap/click callupdateController.checkForUpdatesManual();onResume/onPauseforwardregister/unregisterDownloadReceiver(); startup check isupdateController.checkForUpdates(false). 2288 → 1918 LOC (−370).Behaviour-preserving. The version-footer long-press (terminal spawn) stays in
MainActivity— it belongs to the terminal slice (next).Verification (sandbox)
javachere (JRE only) — please build:app:lintDebug+assembleDebug.MainActivityto any removed OTA symbol (only the threeupdateController.*calls remain).UpdateViewModelFactory(Context),UpdateViewModel.track/onReady/onInstalling/onError/cancel/state,UpdateUiState.Status+ fields,ApkVerifier.isSignedBySameCertAsApp(Context, File).Test (device)
Next slices (same F1 family, separate PRs)
addNewTerminalSession()(~730 LOC) → a terminal-session controller.