Technical Documentation: Dr-TSNG/ZygiskNext
โน๏ธ Provenance: Multi-Tier Ingestion ยท CodeWiki Reference
Overview (`README.md`)
Zygisk Next
Standalone implementation of Zygisk, providing Zygisk API support for KernelSU and a replacement of Magisk's built-in Zygisk.
Requirements
General
- No multiple root implementation installed
KernelSU
- Minimal KernelSU version: 10940
- Minimal KernelSU Manager (ksud) version: 11575
Magisk
- Minimal version: 26402
- Built-in Zygisk turned off
Translations
You can contribute to translations for the WebUI via making pull requests to the i18n branch.
Zygisk Next API
Zygisk Next provides an API for injecting into init-oriented processes. See zygisk_next_api.h for more information.
Example usage can be found in ZygiskNextModuleSample.
Zygisk Next also supports application callbacks for HyperOS Rust Runtime, which are documented in docs/hyos_runtime.md. This is a native-only API and does not provide ART or JNI compatibility to regular Zygisk modules.
Copyright Notice
Copyright ยฉ 2024-2026 Zygisk Next developers. All rights reserved.
The software Zygisk Next, starting from version v4-0.9.2, is no longer under the GPL-3.0 License. Instead, all rights to the software are reserved by the owner.
The following conditions now apply:
No Modifications: The software may not be modified in any way. This includes but is not limited to changing, adding, or removing any part of the software's code or functionality.
No Redistribution: The software may not be redistributed in any form. This includes but is not limited to renaming, selling, or including the software as part of another project.
No Picking: No parts, pieces, or components of the software may be extracted and submitted to other projects. This includes, but is not limited to, code snippets, functions, and released binaries.
No Claim to Succession: Any fork of the software that was created before the license change may not claim to be an official or unofficial successor to the project. This includes but is not limited to using the project's name, branding, or reputation to imply a connection to the original project.
Hyos Runtime (`docs/hyos_runtime.md`)
HyperOS Rust Runtime API
Zygisk Next provides a native API for modules that target applications running in Xiaomi's
HyperOS Rust Runtime. This environment is independent of ART and does not provide JNI or
Java objects.
Registration
Add the module library to zn_modules.txt:
path=/system_ext/bin/hyos_spawner lib/arm64-v8a/libexample.soExport the regular zn_module entry. During onModuleLoaded, query the current runtime and
register a ZygiskNextHyosModule when the Hyos Runtime API is available:
#include "zygisk_next_api.h"
static void app_specialized(const ZnHyosAppSpecializeArgs *args) {
// Application-specific initialization.
}
static const ZygiskNextHyosModule hyos_module = {
.target_api_version = ZYGISK_NEXT_HYOS_API_VERSION,
.onAppSpecialized = app_specialized,
};
static void on_module_loaded(void *, const ZygiskNextAPI *api) {
const ZygiskNextRuntime *runtime = api->getRuntime();
if (runtime == nullptr || runtime->type != ZN_RUNTIME_HYOS ||
runtime->api_version < ZYGISK_NEXT_HYOS_API_VERSION) {
return;
}
if (runtime->registerModule(&hyos_module) != ZN_SUCCESS) {
// Registration failed.
}
}
extern "C" __attribute__((visibility("default"))) ZygiskNextModule zn_module = {
.target_api_version = ZYGISK_NEXT_API_VERSION,
.onModuleLoaded = on_module_loaded,
};getRuntime() returns nullptr when the current process does not expose a supported runtime.
Always check type and api_version before passing the corresponding runtime-specific module
structure to registerModule.
Call registerModule during onModuleLoaded. The runtime copies the supplied module structure
before returning. The ZygiskNextAPI and ZygiskNextRuntime objects remain valid for the lifetime
of the process.
Specialization callback
onAppSpecialized is called once in each successfully specialized application process, after its
uid, gid, supplementary groups, and SELinux application context have been applied. The callback
runs before the runtime continues application execution.
ZnHyosAppSpecializeArgs contains:
process_name: non-null process name.package_name: non-null package name.se_info: non-null SELinux seinfo value used for application context selection.
The argument structure and strings are read-only and valid only for the duration of the callback.
Modifying them does not affect process specialization.
The module is inherited by every child selected by the manifest entry. Validate the process or
package name inside onAppSpecialized before performing application-specific work.
Because the callback runs in a post-fork child, avoid operations that depend on inherited locks,
starting threads, and allocator-heavy work. The standard ZygiskNextAPI, including companion
connections, remains available from the callback.
--- METRICS ---
- Files Extracted: 2
- Estimated Token Budget: ~1298 tokens
- Canonical Reference: https://codewiki.google/github.com/Dr-TSNG/ZygiskNext