Skip to content

Start serial registration in early daemon initialization#648

Merged
JingMatrix merged 2 commits into
masterfrom
serial
Apr 9, 2026
Merged

Start serial registration in early daemon initialization#648
JingMatrix merged 2 commits into
masterfrom
serial

Conversation

@JingMatrix

Copy link
Copy Markdown
Owner

On Xiaomi Android 12 [Xiaomi/toco_ru/toco:12/RKQ1.210614.002/V13.0.4.0.SFNRUXM:user/release-keys], it is observed that daemon is not started even the zygisk module in system_server has been waiting for 3 seconds.

We also increase the IPC waiting retries to ensure the communication.

@JingMatrix JingMatrix linked an issue Apr 8, 2026 that may be closed by this pull request
1 task
On some devices (e.g., Xiaomi Android 12 [Xiaomi/toco_ru/toco:12/RKQ1.210614.002/V13.0.4.0.SFNRUXM:user/release-keys]), the daemon takes longer to initialize, causing the Zygisk module in system_server to time out after the default 3 seconds while waiting for the proxy service.

We address the race condition with the following changes:
- Move proxy service registration (`SystemServerService.registerProxyService`) to the earliest possible phase in daemon initialization, before environmental setup and DEX preloading.
- Increase the Zygisk IPC waiting retries in `ipc_bridge.cpp` from 3 to 10 seconds to ensure successful communication on slower ROMs.
- Refactor `SystemServerService` into a singleton object.
- Move `system_server` crash recovery and restart logic directly into `VectorDaemon.kt` to better manage retry states during reinjection.
- Clean up variable usage and improve code comments to accurately reflect the proxy replacement lifecycle.
@JingMatrix
JingMatrix merged commit 9d89508 into master Apr 9, 2026
@JingMatrix
JingMatrix deleted the serial branch April 14, 2026 18:00
Enovale pushed a commit to Enovale/Vector that referenced this pull request Jul 13, 2026
…x#648)

On some devices (e.g., Xiaomi Android 12 [Xiaomi/toco_ru/toco:12/RKQ1.210614.002/V13.0.4.0.SFNRUXM:user/release-keys]), the daemon takes longer to initialize, causing the Zygisk module in system_server to time out after the default 3 seconds while waiting for the proxy service.

We address the race condition with the following changes:
- Move proxy service registration (`SystemServerService.registerProxyService`) to the earliest possible phase in daemon initialization, before environmental setup and DEX preloading.
- Increase the Zygisk IPC waiting retries in `ipc_bridge.cpp` from 3 to 10 seconds to ensure successful communication on slower ROMs.
- Refactor `SystemServerService` into a singleton object.
- Move `system_server` crash recovery and restart logic directly into `VectorDaemon.kt` to better manage retry states during reinjection.
- Clean up variable usage and improve code comments to accurately reflect the proxy replacement lifecycle.
JingMatrix added a commit that referenced this pull request Jul 25, 2026
The Zygisk module polls `ServiceManager.getService("serial")` while
specializing `system_server`, but since #648 the matching
`ServiceManager.addService` call sits inside the `SDK_INT >= R` branch that
exists only for `IServiceManager.registerForNotifications`. On Android 8.1 to
10 nothing claims the name, so the module aborts the injection after ten
attempts.

Keep only `registerForNotifications` behind the version check. Without the
callback we cannot capture the real service, but its own registration replaces
our proxy in servicemanager anyway.
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.

LSPosed Manager won't open. Android 12 (MIUI)

1 participant