Skip to content

refactor(deploy): carve backup/restore out of DeployFragment into BackupController#43

Merged
luisguzman-adfa merged 2 commits into
mainfrom
refactor/deployfragment-backup-controller
Jun 24, 2026
Merged

refactor(deploy): carve backup/restore out of DeployFragment into BackupController#43
luisguzman-adfa merged 2 commits into
mainfrom
refactor/deployfragment-backup-controller

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

First god-class carve (strangler-fig) toward re-enabling the disabled Fragment lint detectors (see controller/docs/TECH_DEBT_PLAN.md). No behaviour change — code is relocated, not rewritten.

What

  • New backup/presentation/BackupController (non-Fragment): owns the backup selection state + SAF launchers + import spinner; wires the backup/restore/import buttons + the backup menu. ~596 LOC moved off the Fragment.
  • New backup/presentation/BackupHost: narrow seam the Fragment implements — isSystemBusy / getSystemBusyMessage / enable|disableSystemProtection / getTermuxArch / updateDynamicButtons + setImporting / setRestoring / setBackupInProgress / isBackupInProgress. mainAct is passed in for isServerAlive / runOnUiThread / invalidateModuleStateTrust.
  • DeployFragment delegates via backupController.registerLaunchers() / bind(...); the 6 cross-feature methods became public to satisfy the seam. 3032 → 2441 LOC.

Why

The disabled checks (FragmentBackPressedCallback, FragmentLiveDataObserve, FragmentAddMenuProvider) hang because the detector's call-graph walk explodes on oversized Fragment methods. Moving cohesive logic to a non-Fragment class shrinks that graph. This is carve 1 of a few; the detectors stay disabled in this PR (bindInstall*, onRootfsSizeResolved, etc. remain) and get re-enabled once DeployFragment is lean.

Verification

Brace/paren balanced; the extraction is fully contained (no external refs to the moved members); all seam calls routed through host.; no unprefixed Fragment calls; lint detectors confirmed still disabled. CI does compile + unit tests + lint. Recommend an on-device backup → export → import → restore smoke test before merge (user-facing feature, moved blind without a local Android build).

…kupController

First god-class carve (strangler-fig) toward re-enabling the disabled Fragment
lint detectors (see TECH_DEBT_PLAN.md). No behaviour change.

- New backup/presentation/BackupController (non-Fragment) owns the backup
  selection state + SAF launchers + import-spinner, and wires the backup/restore/
  import buttons + the backup menu. Moves ~596 LOC off the Fragment.
- New backup/presentation/BackupHost: narrow seam the Fragment implements
  (isSystemBusy/getSystemBusyMessage/enable|disableSystemProtection/getTermuxArch/
  updateDynamicButtons + setImporting/setRestoring/setBackupInProgress/
  isBackupInProgress). mainAct is passed in for isServerAlive/runOnUiThread/
  invalidateModuleStateTrust.
- DeployFragment delegates via backupController.registerLaunchers()/bind(...);
  the 6 cross-feature methods are now public to satisfy the seam.
- DeployFragment 3032 -> 2441 LOC. Lint detectors stay disabled (still
  bindInstall*/onRootfsSizeResolved/etc.); re-enable after the next carves.

Verified: brace/paren balance, no dangling refs (fully contained), seam routed
through host., no unprefixed Fragment calls. CI = compile+tests+lint.
…oup imports to BackupController

Compile fix for the carve PR (#43): the moved backup-menu row code uses
Color.TRANSPARENT and ViewGroup.LayoutParams with simple names; the new file
needs the imports. No logic change.
@luisguzman-adfa luisguzman-adfa merged commit 54bc3d7 into main Jun 24, 2026
1 check passed
@luisguzman-adfa luisguzman-adfa deleted the refactor/deployfragment-backup-controller branch June 24, 2026 16:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant