Modules / zygisk-sui

Zygisk - Sui

Fork by XiaoTong. Modern superuser interface implementation for Android root apps.

README

Sui

🇨🇳中文README | 🇯🇵日本語README

Modern super user interface (SUI) implementation for Android. The name, Sui, also comes from a character.

Introduction

Sui provides Java APIs, namely Shizuku API, for root / shell apps. It mainly provides two abilities:

  1. Use Android Framework APIs directly, almost as if calling system APIs from Java as root or shell.
  2. Start an app-defined AIDL-style Java service under root or shell.

This makes privileged Android app development much more comfortable.

Another advantage is that Sui does not add binaries to PATH and does not install a standalone manager app. This means we no longer need to spend a huge amount of time fighting apps that detect them.

To be clear, the full implementation of “root” is far more than su itself. There is a lot of hard work to be done before it. Sui is not a full root solution. It requires an existing root environment and runs as a Zygisk module.

Why "su" is unfriendly for app development

su, a “shell” running as root, is too far from the Android world.

To explain this, we need to briefly talk about how system APIs work. For example, we can use PackageManager#getInstalledApplications to get the app list. This is actually an inter-process communication (IPC) process between the app process and the system_server process. The Android Framework just hides the details for us.

Android uses Binder for this type of IPC. Binder allows the server side to learn the uid and pid of the client side, so system_server can check whether the app has permission to perform the operation.

Back to su. In a su environment, we usually only have commands provided by the Android system. In the same example, to get the app list with su, we have to run pm list. This is painful:

  1. Text-based output: there is no structured data like PackageInfo in Java. You have to parse text.
  2. Slow: running a command means at least one new process is started, and PackageManager#getInstalledApplications is still called inside pm list.
  3. Limited ability: commands only cover a small part of Android APIs.

Although it is possible to use Java APIs as root with app_process through libraries such as libsu or librootjava, transferring Binder objects between the app process and the root process is painful. If you want the root process to run as a daemon, once the app process restarts, there is no cheap way to get the Binder of the root process again.

In fact, for Magisk and other root solutions, making su work is not as easy as some people think. Both su itself and the communication between su and the manager app involve a lot of unpleasant work behind the scenes.

User guide

Note: the behavior of existing apps that only support su will NOT change.

Install

You can install Sui directly in KernelSU or another compatible root manager such as Magisk or APatch. Or download the zip from release and use Install from storage in your root manager.

Sui requires a compatible root environment. On Magisk, this means Magisk 24.0+ with Zygisk enabled. On KernelSU or APatch, it additionally requires a separate Zygisk implementation such as Zygisk Next, ReZygisk, or NeoZygisk. Do not add SystemUI or Settings to Zygisk DenyList, otherwise the injected management UI may not work properly.

Management UI

  • Long press the System Settings icon on the home screen to see the Sui shortcut
  • In the Sui management interface, tap the menu button in the top-right corner and select Add shortcut to home screen
  • Enter *#*#784784#*#* in the default dialer app
  • Open the Sui management interface via the Action button in KernelSU/Magisk manager

Note: On some systems, the Sui shortcut may not appear when long-pressing Settings.
Additionally, to avoid disturbing users, newer versions have removed the feature that automatically prompts to add a shortcut when entering Developer options.

Permission modes

Sui stores permission states by UID. The main modes are:

  • Ask / default: the app can connect to Sui and request permission through the normal flow.
  • Allow root: the app will be routed to the root backend.
  • Allow shell: the app will be routed to the shell backend.
  • Deny: deny the app from using Sui.
  • Hide: hide Sui from the target app. When Hide is enabled, the target app UID is intercepted in the Native Binder execTransact stage. Its Sui bridge transaction is swallowed before it can enter BridgeService and obtain the Sui Binder.

When the permission state changes, Sui may force-stop affected apps to cut off old Binder handles and make them obtain the correct backend on the next launch.

Interactive shell

Sui provides an interactive shell.

Since Sui does not add files to PATH, the required files need to be copied manually. See /data/adb/sui/post-install.example.sh to learn how to do this automatically.

After the files are correctly copied, use rish as sh to start an interactive shell.

adb root

Sui also provides optional adb root support. When enabled, Sui sets up an adbd wrapper plus preload hook so that adbd can run under the current root implementation’s SELinux domain while keeping the expected adbd socket label.

This feature is disabled by default. Enable it by creating one of the following marker files from a root shell, then reboot so Sui can apply the setup during post-fs-data:

  • Enable for the next boot only:

    touch /data/adb/sui/enable_adb_root_once
    
  • Enable persistently for every boot:

    touch /data/adb/sui/enable_adb_root
    

After reboot, use adb root normally.

To disable the persistent mode again:

rm /data/adb/sui/enable_adb_root

This feature depends on your root implementation and SELinux policy. Sui checks the required setcurrent, dyntransition, and setsockcreate permissions before enabling it. Existing app behavior does not change. This only affects the device adbd path. If your device uses a heavily customized adbd implementation, compatibility may vary.

Application development guide

Sui app development should still primarily follow the upstream Shizuku API documentation:

https://github.com/RikkaApps/Shizuku-API

Apps are recommended to use rikka.shizuku.Shizuku as the unified compatibility layer. Do not maintain a Sui-only code path. In this way, one wrapper can support both Shizuku and Sui.

In the normal integration pattern, you only need ShizukuProvider plus the regular Shizuku API flow. ShizukuProvider already attempts Sui initialization automatically, so app code usually does not need to import or call rikka.sui.Sui directly.

If you intentionally disable ShizukuProvider’s automatic Sui initialization, you can still call Sui.init(packageName) manually inside your wrapper. If it receives a Binder, it passes it to the Shizuku API layer; if not, the app can continue with the normal Shizuku flow.

Example pattern with the normal auto-initialization flow:

import android.content.pm.PackageManager
import android.content.pm.IPackageManager
import rikka.shizuku.Shizuku
import rikka.shizuku.ShizukuBinderWrapper
import rikka.shizuku.SystemServiceHelper

fun initPrivilegedApi() {
    Shizuku.addBinderReceivedListener {
        checkShizukuPermission()
    }

    if (Shizuku.pingBinder()) {
        checkShizukuPermission()
    }
}

fun checkShizukuPermission() {
    if (Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED) {
        val binder = SystemServiceHelper.getSystemService("package")
            ?: return

        val pm = IPackageManager.Stub.asInterface(
            ShizukuBinderWrapper(binder)
        )

        pm.isPackageAvailable("android", 0)
    } else {
        Shizuku.requestPermission(0)
    }
}

If you want manual initialization instead, add import rikka.sui.Sui and call Sui.init(packageName) before waiting for the binder.

Common APIs include:

  • Shizuku.pingBinder()
  • Shizuku.checkSelfPermission()
  • Shizuku.requestPermission(requestCode)
  • Shizuku.getUid(), which can be used to check the current backend identity, for example 0 for root and 2000 for shell
  • SystemServiceHelper.getSystemService(name)
  • ShizukuBinderWrapper, used to wrap Android Framework service binders
  • bindUserService(), used to start an app-defined Java service running as root or shell

Build

Clone with submodules:

git clone --recurse-submodules https://github.com/XiaoTong6666/Sui.git

Gradle tasks:

BuildType could be Debug or Release.

  • :module:assemble<BuildType>

    Build the module. After assemble finishes, the flashable module zip will be generated to out.

  • :module:zip<BuildType>

    Generate the flashable module zip to out.

  • :module:push<BuildType>

    Push the zip with adb to /data/local/tmp.

  • :module:flash<BuildType>

    Install the zip with adb shell su -c magisk --install-module.

  • :module:flashWithKsud<BuildType>

    Install the zip with adb shell su -c ksud module install.

  • :module:flashAndReboot<BuildType>

    Install the zip and reboot the device.

  • :module:flashWithKsudAndReboot<BuildType>

    Install the zip with ksud and reboot the device.

For example:

./gradlew :module:assembleRelease
./gradlew :module:zipRelease
./gradlew :module:flashRelease

Internals

Sui requires Zygisk. Zygisk allows us to inject into system_server, SystemUI, Settings and related app processes.

Overall, there are five main parts, and an optional adb root path:

  • Root process

    This is a root process started by the root implementation during the post-fs-data stage. It starts a Java server that implements Shizuku API and private APIs used by other parts.

    The root server is the main source of permission configuration. It maintains the UID permission database and syncs hidden, root allowed, shell allowed, denied and default mode states to system_server.

  • Shell process

    The shell server runs as shell and serves apps granted with shell permission.

    It loads UID permission states from the configuration file mirrored by the root server. When the shell backend needs to show a permission confirmation window, it delegates the request to the root server, which then triggers the SystemUI confirmation UI.

  • SystemServer inject

    • Hooks Binder#execTransact to intercept the dedicated Binder transaction used by Sui inside system_server
    • Keeps the root binder, shell binder, and permission caches for hidden/root allowed/shell allowed/denied/default mode
    • Chooses which backend Binder to return based on the UID’s effective permission: root gets the root binder, shell gets the shell binder
    • For hidden UIDs, blocks the Sui bridge request directly; for ask/deny, still returns the root binder so the client can continue through the normal permission or denial result flow
  • SystemUI inject

    • Opens the Sui APK fd from Sui service and loads Sui Resources plus the permission dialog class
    • Attaches to the service and shows permission confirmation dialogs on callback
    • Registers secret-code style entry points and, when triggered, launches the Sui management UI hosted in the Settings process
  • Settings inject

    • Opens the Sui APK fd from Sui service and loads Sui Resources plus SuiActivity
    • Replaces ActivityThread instrumentation during Settings process startup
    • Maintains dynamic/pinned shortcuts and handles pinned-shortcut requests relayed from SystemUI
    • When the target Activity intent carries the Sui extra and token, instantiates and displays SuiActivity instead
  • adbd wrapper / preload (optional)

    • During post-fs-data, when adb root support is enabled, Sui prepares an adbd wrapper and preload library for /apex/com.android.adbd/bin/adbd or /system/bin/adbd
    • The wrapper rewrites --root_seclabel=... to the current root implementation’s SELinux domain and injects LD_PRELOAD
    • The preload hook intercepts selinux_android_setcon() / setcon() so adbd can switch into the root domain while restoring sockcreate to the expected adbd label

License

Sui is licensed under GPL-3.0-or-later.

Release History

v485-4575090

Published on May 22, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (485-4575090-release)
  • VersionCode: 485
  • Commit: 4575090
  • Build time: 3m 02s
  • SHA256: f194cb41bc658e7913305efa59de206c16d7d2f78ac9af2277c62bce5d058f30

Message

refactor: 提取共享 API 组件并优化服务端与 UI 性能

清理服务端与 UI 层的重复代码,并修复部分性能和逻辑隐患:

- 将 ui 和 module 中的重复工具类合并至 api/shared,并新增 BridgeConstants 统一跨层通信常量
- 调整 ManagementViewModel 加载模型,将分批串行加载替换为基于 Dispatchers.IO 的异步并发加载
- 将 SuiConfigManager 的配置检索改为 Map 映射,并为高频配置写盘增加 200ms 防抖节流
- 修改 Bridge 中的权限状态判断,明确互斥优先级(隐藏 > 拒绝 > Root > Shell)防止权限覆盖
- 增加 Native 层的安全防护:为 Zygisk 注入添加数据长度和初始化失败检查,并将 JNI 接口表静态化

此外,修复了 SuiDatabase 的并发初始化隐患与 SuiService 中的位运算错误,并清理了 UI 层的无效判断分支。

v484-d483c33

Published on May 18, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (484-d483c33-release)
  • VersionCode: 484
  • Commit: d483c33
  • Build time: 1m 21s
  • SHA256: 4b7f78f2ab168052b2d4b6facad8182c6f334e14b7f70a26015a2292de9a7a81

Message

docs: 添加日文 README 并同步多语言文档表述

v483-9701510

Published on May 18, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (483-9701510-release)
  • VersionCode: 483
  • Commit: 9701510
  • Build time: 2m 56s
  • SHA256: 34033bdc696c5bdeb0a0554a0f0f06d8870c924ac90dfa77cf7ba18c06061d1c

Message

docs: 添加可选的 adb root 支持相关说明

v482-c2d21cb

Published on May 18, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (482-c2d21cb-release)
  • VersionCode: 482
  • Commit: c2d21cb
  • Build time: 3m 53s
  • SHA256: 4c14c3b1f44e9e5d8c1fd8e5d4ae3859a50ac3db4445cb654a00f714f5860ab6

Message

build(deps): bump com.diffplug.spotless from 8.5.0 to 8.5.1 (#63)

Bumps com.diffplug.spotless from 8.5.0 to 8.5.1.

---
updated-dependencies:
- dependency-name: com.diffplug.spotless
  dependency-version: 8.5.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

v481-20de56d

Published on May 17, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (481-20de56d-release)
  • VersionCode: 481
  • Commit: 20de56d
  • Build time: 4m 03s
  • SHA256: 2c4ca4e3f54dfe0d9d18b5fa535c7e61882ecdc8c841cc517c21768e8bf50ed2

Message

build(deps): bump com.diffplug.spotless from 8.4.0 to 8.5.0 (#61)

Bumps com.diffplug.spotless from 8.4.0 to 8.5.0.

---
updated-dependencies:
- dependency-name: com.diffplug.spotless
  dependency-version: 8.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

v480-e333e8d

Published on May 15, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (480-e333e8d-release)
  • VersionCode: 480
  • Commit: e333e8d
  • Build time: 3m 09s
  • SHA256: 87e2f29832f9f4f86f7e1d04ccd23ce1ecbd3e1869196030e3f03ba6f0604e61

Message

Fix Japanese text (#60)

* Fix Japanese text

* Rename key for GitHub contributor link

---------

Co-authored-by: XiaoTong6666 <3278671549@qq.com>

v479-748ccf7

Published on May 14, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (479-748ccf7-release)
  • VersionCode: 479
  • Commit: 748ccf7
  • Build time: 3m 06s
  • SHA256: b60a7f61e44d15a1fb0ea2eb33f0662abbe914586b0d09fa7c4ee9ba80f7e140

Message

Add Japanese translate (#58)

* Add Japanese translate

* Fix Japanese text

* 貢献者を増やす

---------

Co-authored-by: XiaoTong6666 <3278671549@qq.com>

v478-3061557

Published on May 14, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (478-3061557-release)
  • VersionCode: 478
  • Commit: 3061557
  • Build time: 3m 51s
  • SHA256: 2dbc205bcb2843278257d1ea9e7137b41644ca3b49ebe996ee3d5e6c6acf7df5

Message

build(deps): bump com.google.android.material:material (#59)

Bumps [com.google.android.material:material](https://github.com/material-components/material-components-android) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/material-components/material-components-android/releases)
- [Commits](https://github.com/material-components/material-components-android/compare/1.13.0...1.14.0)

---
updated-dependencies:
- dependency-name: com.google.android.material:material
  dependency-version: 1.14.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

v477-0737d55

Published on May 13, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (477-0737d55-release)
  • VersionCode: 477
  • Commit: 0737d55
  • Build time: 1m 22s
  • SHA256: 7ab30fbd596aa97f47574affb1779ff3318de5a6f83db936cdca0ee8416b50e8

Message

ci(workflows): 先删除模块仓库同版本号的 release 和 tag 再重建

v475-510699d

Published on May 12, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (475-510699d-release)
  • VersionCode: 475
  • Commit: 510699d
  • Build time: 3m 28s
  • SHA256: eb657228d1d9e80603af9305b962fc42797a964298fc8af915215d15b91745d8

Message

build(deps): bump coroutines from 1.10.2 to 1.11.0 (#56)

Bumps `coroutines` from 1.10.2 to 1.11.0.

Updates `org.jetbrains.kotlinx:kotlinx-coroutines-core` from 1.10.2 to 1.11.0
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.10.2...1.11.0)

Updates `org.jetbrains.kotlinx:kotlinx-coroutines-android` from 1.10.2 to 1.11.0
- [Release notes](https://github.com/Kotlin/kotlinx.coroutines/releases)
- [Changelog](https://github.com/Kotlin/kotlinx.coroutines/blob/master/CHANGES.md)
- [Commits](https://github.com/Kotlin/kotlinx.coroutines/compare/1.10.2...1.11.0)

---
updated-dependencies:
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-core
  dependency-version: 1.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.jetbrains.kotlinx:kotlinx-coroutines-android
  dependency-version: 1.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

v474-9ecaf2e

Published on May 6, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (474-9ecaf2e-release)
  • VersionCode: 474
  • Commit: 9ecaf2e
  • Build time: 4m 02s
  • SHA256: 59b3a0cdd240be8c54077a36846c36055a965a1c4aadf6867f050ec550cbefe9

Message

build(deps): bump agp from 9.2.0 to 9.2.1 (#55)

Bumps `agp` from 9.2.0 to 9.2.1.

Updates `com.android.application` from 9.2.0 to 9.2.1

Updates `com.android.library` from 9.2.0 to 9.2.1

---
updated-dependencies:
- dependency-name: com.android.application
  dependency-version: 9.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: com.android.library
  dependency-version: 9.2.1
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

v473-6f8aa2f

Published on May 5, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (473-6f8aa2f-release)
  • VersionCode: 473
  • Commit: 6f8aa2f
  • Build time: 1m 20s
  • SHA256: c1650e93c2cb1524cdd64fc91d953215672ae6ff60e6b5586b4f9d9afb43d789

Message

docs: 更新 README 并补充权限与开发说明

v472-889b033

Published on May 5, 2026
Download

同步自 主仓库 构建产物喵

  • Version: v13.5.4.3 (472-889b033-release)
  • VersionCode: 472
  • Commit: 889b033
  • Build time: 1m 13s
  • SHA256: 71b48f53438630bf705fb3f56059e80639f4a23ef30579a25d11d6411c2349bb

Message

ci(workflows): 统一发布流程

- 合并 nightly 与 tag release 为统一发布 job
- 使用发布参数区分 nightly 与正式 release
- 支持 tag release 同步 KSU 仓库
- 支持 tag release 更新 pages 元数据
- 复用发布说明生成逻辑

Module Details

Module ID
zygisk-sui
427
Stars
13
Releases

Latest Version

v485-4575090
Released 5/22/2026
Download Now