ADFA-4460 refactor(main): move MainActivity one-off threads to shared executor#75
Merged
Merged
Conversation
… 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.
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.
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 inMainActivity(box/local status pings, orphaned-prootkillall, OTA update check) to the sharedAppExecutors.io()(from ADFA-4457). Same background execution, pooled instead of a fresh thread each time; bodies unchanged (still hop to the UI thread viarunOnUiThreadwhere needed).Diff is exactly 5 lines: 1 import + 4 wrapper swaps. Additive/minimal edit to the god class.
Not changed (on purpose)
WatchdogServiceintentionally acquiresPARTIAL_WAKE_LOCKwith no timeout (a 90 GB transfer can take hours; released manually inonDestroy). By design — left as-is.Verification
Built locally — OK. On-device smoke test: no regressions observed (startup, box/local status detection).
Deferred under this ticket: audit MainActivity's recurring
Handlerloops (onResume/onPause teardown). Part of epic ADFA-1028 (Phase 2); reuses the shared executor from ADFA-4457.