Convert Figma logo to code with AI

topjohnwu logoMagisk

The Magic Mask for Android

47,030
11,874
47,030
25

Top Related Projects

3,737

Notes about tinkering with Android Project Treble

This tool is now dead...

Example code for "How-To SU"

Quick Overview

Magisk is an open-source rooting solution for Android devices. It provides a systemless interface for modifying the Android operating system while maintaining the integrity of the system partition, allowing users to customize their devices without tripping SafetyNet or other security measures.

Pros

  • Systemless root access, preserving system integrity
  • Modular design with support for custom modules
  • Regular updates and active community support
  • Ability to hide root from apps that don't support rooted devices

Cons

  • Requires unlocked bootloader, which may void warranty
  • Potential security risks if not used carefully
  • Can cause issues with some banking and payment apps
  • May require frequent updates to maintain compatibility with new Android versions

Getting Started

To install Magisk on your Android device:

  1. Unlock your device's bootloader (varies by manufacturer)
  2. Download the latest Magisk APK from the official GitHub repository
  3. Install the Magisk app on your device
  4. Use the Magisk app to patch your device's boot image
  5. Flash the patched boot image using fastboot or a custom recovery
# Example fastboot command to flash patched boot image
fastboot flash boot magisk_patched.img
  1. Reboot your device
  2. Open the Magisk app to verify installation and manage root access

Note: The exact steps may vary depending on your device model and Android version. Always follow the official documentation and proceed with caution, as rooting can potentially brick your device if not done correctly.

Competitor Comparisons

3,737

Pros of LineageOS/android

  • Provides a complete custom Android operating system
  • Supports a wide range of devices
  • Regular updates and security patches

Cons of LineageOS/android

  • More complex installation process
  • Requires full system replacement
  • May not be compatible with all apps

Code Comparison

LineageOS/android:

public class LineageSettings extends Settings {
    public static final String AUTHORITY = "lineagesettings";
    public static final Uri CONTENT_URI = Uri.parse("content://" + AUTHORITY);
    // ... more code ...
}

Magisk:

public class SuFile extends File {
    private SuFileInputStream is;
    private SuFileOutputStream os;
    // ... more code ...
}

The LineageOS/android repository contains code for a complete Android operating system, including custom settings and system modifications. In contrast, Magisk focuses on providing root access and system-level modifications without replacing the entire OS.

LineageOS offers a more comprehensive solution for users wanting a fully customized Android experience, while Magisk provides a more targeted approach for root access and system modifications on existing Android installations.

Notes about tinkering with Android Project Treble

Pros of treble_experimentations

  • Focuses on Project Treble and Generic System Images (GSIs)
  • Supports a wide range of devices through GSI compatibility
  • Provides tools and scripts for building custom GSIs

Cons of treble_experimentations

  • More complex setup and usage compared to Magisk
  • Limited to devices with Project Treble support
  • May have less frequent updates and community support

Code Comparison

Magisk (C++):

static int mount_root(const char *block_dev, const char *mnt_point) {
    char device[256];
    strcpy(device, block_dev);
    if (strncmp(device, "/dev/", 5) == 0)
        strcpy(device, &device[5]);

treble_experimentations (Shell):

mount_image() {
    mkdir "$2"
    if [ ! -f "$1" ]; then
        simg2img "$1" "$1.raw"
        mount -o loop "$1.raw" "$2"
    else

Both projects aim to enhance Android customization, but Magisk focuses on root access and system modifications, while treble_experimentations emphasizes GSI development and compatibility across devices. Magisk is generally more user-friendly and widely adopted, while treble_experimentations caters to advanced users interested in GSI development and testing.

This tool is now dead...

Pros of MagiskHidePropsConf

  • Focused specifically on device fingerprint spoofing and SafetyNet bypassing
  • Easier to use for those only interested in prop modifications
  • More frequently updated with new device fingerprints

Cons of MagiskHidePropsConf

  • Limited in scope compared to the full Magisk framework
  • Requires Magisk to be installed as a prerequisite
  • May not be as thoroughly tested as the main Magisk project

Code Comparison

Magisk (build.gradle):

android {
    compileSdkVersion 33
    defaultConfig {
        minSdkVersion 21
        targetSdkVersion 33
    }
}

MagiskHidePropsConf (module.prop):

id=MagiskHidePropsConf
name=MagiskHide Props Config
version=v6.1.2
versionCode=60
author=Didgeridoohan
description=Configure MagiskHide props

The code snippets highlight the different nature of these projects. Magisk is a full Android application with complex build configurations, while MagiskHidePropsConf is a Magisk module with a simpler structure focused on prop modifications.

MagiskHidePropsConf serves as a specialized tool within the Magisk ecosystem, offering targeted functionality for users seeking to modify device properties. While it lacks the comprehensive features of Magisk, it provides a streamlined solution for prop-related tasks, making it a valuable complement to the main Magisk framework.

Example code for "How-To SU"

Pros of libsuperuser

  • Lightweight library focused specifically on root access
  • Easier to integrate into existing projects
  • More granular control over root operations

Cons of libsuperuser

  • Less actively maintained compared to Magisk
  • Limited scope, primarily for root access management
  • Lacks advanced features like systemless modifications

Code Comparison

libsuperuser:

Shell.SU.run("mount -o rw,remount /system");
Shell.SU.run("cp /sdcard/file.txt /system/app/");
Shell.SU.run("mount -o ro,remount /system");

Magisk:

val module = createModule("MyModule")
module.mount("/system")
module.copyFile("/sdcard/file.txt", "/system/app/file.txt")
module.unmount()

The libsuperuser example shows direct shell commands for system modifications, while Magisk uses a more abstracted API for systemless modifications. Magisk's approach is generally safer and more flexible, allowing for easier management and removal of modifications.

Magisk offers a comprehensive suite of tools for root management, system modification, and module support, making it more versatile for advanced users and developers. However, libsuperuser may be preferable for simpler projects that only require basic root access functionality.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Downloads

This is not an officially supported Google product

Introduction

Magisk is a suite of open source software for customizing Android, supporting devices higher than Android 6.0.
Some highlight features:

  • MagiskSU: Provide root access for applications
  • Magisk Modules: Modify read-only partitions by installing modules
  • MagiskBoot: The most complete tool for unpacking and repacking Android boot images
  • Zygisk: Run code in every Android applications' processes

Downloads

Github is the only source where you can get official Magisk information and downloads.

Click the icon below to download Magisk apk.

Useful Links

Bug Reports

Only bug reports from Debug builds will be accepted.

For installation issues, upload both boot image and install logs.
For Magisk issues, upload boot logcat or dmesg.
For Magisk app crashes, record and upload the logcat when the crash occurs.

Translation Contributions

Default string resources for the Magisk app and its stub APK are located here:

  • app/core/src/main/res/values/strings.xml
  • app/stub/src/main/res/values/strings.xml

Translate each and place them in the respective locations ([module]/src/main/res/values-[lang]/strings.xml).

License

Magisk, including all git submodules are free software:
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation,
either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.