Skip to content

ADFA-4460 refactor(main): move MainActivity one-off threads to shared executor#75

Merged
luisguzman-adfa merged 1 commit into
mainfrom
refactor/ADFA-4460-mainactivity-threads
Jun 26, 2026
Merged

ADFA-4460 refactor(main): move MainActivity one-off threads to shared executor#75
luisguzman-adfa merged 1 commit into
mainfrom
refactor/ADFA-4460-mainactivity-threads

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

Summary

Phase 2 (concurrency) — MainActivity/Watchdog area (ADFA-4460), first slice. Pure refactor, no behaviour change.

Migrate the 4 ad-hoc new Thread(() -> {...}).start() one-off background jobs in MainActivity (box/local status pings, orphaned-proot killall, OTA update check) to the shared AppExecutors.io() (from ADFA-4457). Same background execution, pooled instead of a fresh thread each time; bodies unchanged (still hop to the UI thread via runOnUiThread where needed).

Diff is exactly 5 lines: 1 import + 4 wrapper swaps. Additive/minimal edit to the god class.

Not changed (on purpose)

  • M1 (wakelock): WatchdogService intentionally acquires PARTIAL_WAKE_LOCK with no timeout (a 90 GB transfer can take hours; released manually in onDestroy). By design — left as-is.
  • The VPN flag read inside one ping thread is dead code (unused since v1) — left untouched; flagged for a dedicated cleanup review, not changed mid-refactor.

Verification

Built locally — OK. On-device smoke test: no regressions observed (startup, box/local status detection).

Deferred under this ticket: audit MainActivity's recurring Handler loops (onResume/onPause teardown). Part of epic ADFA-1028 (Phase 2); reuses the shared executor from ADFA-4457.

… executor

Phase 2 (concurrency) -- MainActivity/Watchdog area, first slice. No behaviour change.

Migrate the 4 ad-hoc `new Thread(() -> {...}).start()` one-off background jobs in
MainActivity (box/local pings, orphaned-proot killall, OTA update check) to the
shared AppExecutors.io() (from ADFA-4457). Same background execution, pooled
instead of a fresh thread each time; bodies unchanged (still hop to the UI thread
via runOnUiThread where needed).

Note on M1 (wakelock): WatchdogService intentionally acquires PARTIAL_WAKE_LOCK
with NO timeout (a 90 GB transfer can take hours; released manually in onDestroy).
That is by design -- left as-is; not a blind 1-line 'add timeout' change.

Deferred follow-up under this ticket: MainActivity's recurring Handler loops
(onResume/onPause teardown audit). NOT built locally yet.
@luisguzman-adfa luisguzman-adfa merged commit ba9cad1 into main Jun 26, 2026
1 check passed
@luisguzman-adfa luisguzman-adfa deleted the refactor/ADFA-4460-mainactivity-threads branch June 26, 2026 09:21
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