Modern super user interface (SUI) implementation on Android. The name, Sui, also comes from a character.
Sui provides Java APIs, Shizuku API, for root apps. It mainly provides the ability to use Android APIs directly (almost in Java as the identity of the root, and start app's own AIDL-style Java service under root. This will make root app development much more comfortable.
Another advantage is that Sui does not add binaries to PATH
and does not install a manager app. This means we no longer need to spend a huge amount of time to fight with 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. Sui is not a full root solution, it requires Magisk to run.
Note, the behavior of existing apps that only supports "su" will NOT change.
You can download and install Sui from Magisk directly. Or, download the zip from release and use "Install from storage" in Magisk.
*#*#784784#*#*
in the default dialer appNote, the shortcut way requires your home app supports shortcut APIs that adds from Android 7.0 and 8.0. Unless you are using a old home app, you can the shortcut with no problem.
Sui provides interactive shell.
Since Sui does not add files to PATH
, the 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'.
https://github.com/RikkaApps/Shizuku-API
Clone with git clone --recurse-submodules
.
Gradle tasks:
Flavor
could be Riru
and Zygisk
, and BuildType
could be Debug
and Release
.
:module:assemble<Flavor><BuildType>
Generate Magisk module zip to out
.
:module:push<Flavor><BuildType>
Push the zip with adb to /data/local/tmp
.
:module:flash<Flavor><BuildType>
Install the zip with adb shell su -c magisk --install-module
.
:module:flashAndReboot<Flavor><BuildType>
Install the zip and reboot the device.
Sui requires Magisk (and Riru for non-Zygisk version). Magisk allows us to run processes as uid 0 and a "do anything" SELinux context. Riru or Zygisk allows us to inject into system server process and app processes.
In short, there are four parts:
Root process
This is a root process started by Magisk. This process starts a Java server that implements Shizuku API and private APIs used by other parts.
SystemServer inject
Binder#execTransact
and finally allow us to handle an unused binder callSystemUI inject
Resource
instance from itResource
and ClassLoader
when recevied callback from the root serverSettings inject
Resource
instance from itAcitivty
but with a special intent extraActivityThread#mInstrumentation
to intervene the Acitivty
instantiate process, if the intent has the speical extra, create our Activity
which uses our Resource
and ClassLoader