Skip to content

Restore injected system_server connections after daemon restart - #1017

Open
bartasc4 wants to merge 1 commit into
JingMatrix:masterfrom
bartasc4:fix/system-server-reattach
Open

bartasc4 wants to merge 1 commit into
JingMatrix:masterfrom
bartasc4:fix/system-server-reattach

Conversation

@bartasc4

@bartasc4 bartasc4 commented Oct 18, 2026 •

Copy link
Copy Markdown

When the daemon restarts while an injected system_server survives, the existing bridge can receive its replacement binder but the daemon loses process registration, module services and hot-reload targets. The manager then reports the framework as detached. This change restores that connection through the existing bridge without rerunning module entry points or reinstalling hooks.

  • Authenticate the system-server reattach, derive status from its live heartbeat, and make registration/death handling safe for retries and stale notifications.
  • Rebind loaded modern-module contexts and remote-preference subscriptions, preserving reported generation versions and restoring the process channel for later hot reloads. Complete boot initialization when the boot broadcast has already passed.
  • Retry the existing native rendezvous until the registration handshake succeeds, including when the proxy name temporarily resolves to an ordinary service. Keep the existing bounded retry budget.

Fixes #1015. Related to #878. Applies directly to master; #1012 handles the separate daemon/compiler-mount lifecycle. No new manager control, public module API, service endpoint or application interception point is introduced.

Log: vector-lifecycle-sanitized-evidence.zip

Validation and limits

Validation: clean-source Kotlin and four-ABI native builds; 68 lifecycle assertions for each selected API branch (controlled host doubles), plus native handshake retry/failure tests. The combined changes with #1012 and hot-reload cleanup #1018 also compile and pass their regression suites. On Android 12 with NeoZygisk, a local validation build reconnected after two daemon replacements while preserving the kernel boot ID and the PID/start time of system_server and both zygotes. New application injection continued to work. A subsequent KernelSU emulated soft reboot completed with one daemon and the same compiler-mount count; application tests and two further hot reloads passed. The clean PR sources were built separately from that local validation build.

Limits: this recovers an already injected system server. It cannot inject an untouched running process, restore external module overlays, or resolve the firmware/APEX failure reported in #878. The locked-bootloader LKM late-load setup was not reproduced. Host API branches are not a device compatibility matrix. Deployment needs one full reboot so the running framework contains this change.

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.

Manager keeps reporting 'system_server not injected' after the daemon restarts, with no way to re-attach without restarting system_server

1 participant