The Magisk Manager APK can now be flashed from within TWRP
Topjohnwu, the developer of Magisk, announced a major change today to the popular open-source rooting tool. The biggest change is that the binaries and scripts required to root your phone are now contained within the Manager app rather than being downloaded over the Internet. As a result, you’ll only need to download one file — the latest version of the Magisk Manager APK — to both root your phone and manage root access.
• No more separate zip for installation
• The Magisk Manager APK *itself* is a custom recovery flashable zip (magic!!)
• Magisk Manager is now fully tied to Magisk releases
• Installation and uninstallation will be 100% offline as everything is included in the APK
— John Wu (@topjohnwu) January 22, 2021
Before today’s update, the most common method to install Magisk was to first install the Manager app, then from within the Manager app download the latest flashable ZIP containing Magisk’s required binaries and scripts for installation, and finally flash that ZIP in a custom recovery like TWRP. After today’s update, all you have to do is download the latest Manager APK, change its extension to ZIP so it’ll be recognized as a flashable file by TWRP, and then flash the ZIP. The reason this can work is that APK files follow the ZIP file format, so with a few modifications, it’s possible for an APK to act as both an Android installation package and as a flashable ZIP file recognized by TWRP.
Besides reducing complexity, this also makes the entire installation and uninstallation process completely offline. Previously, the Manager app required an active Internet connection in order to download the latest Magisk ZIP from GitHub. Since the required binaries and scripts are contained within the Manager APK, you can bypass needing to download any files on the target device you want to root.
In addition, topjohnwu says that, by shipping all binaries as “native libraries” of the Manager APK, the target SDK version of the Manager app can be set to 29 or higher. The reason, he says, is because of Android 10’s SELinux restrictions on executing files within an app’s home directory — the same restrictions that forced the Termux developers to abandon serving updates to the app on Google Play. However, the target SDK version has not yet been increased and will be addressed in a future commit.