Skip to content
zelect0rPublic

About

Root toggle module with English WebUI (And 17 other languages) for A/B Android devices, including OnePlus 8T. Disable root with a stock boot.img, restore it by booting OrangeFox.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Root Disable Enable Switch

Root off for daily use, root back on by booting OrangeFox. A small one-time hook in the OrangeFox ramdisk makes the restore automatic even on FBE/PIN protected devices, the ORS and root-on.zip remain as fallbacks. Everything ships in one module ZIP: the rdes module, a multilingual WebUI and the restore assets.

Changelog: changes since v1.7.5

v1.8.3: reliability, performance and documentation

  • Fixed stale download states that could leave crDroid, LineageOS or GApps polling forever after a worker crash or reboot.
  • Sped up recovery identification with a size/mtime cache and single-pass signature detection, and reuse resolved slots and boot devices.
  • Moved recovery backups after the two-tap confirmation, so the first tap no longer reads both recovery partitions.
  • Deduplicated recovery sources that point to the same file through /sdcard and /data/media/0.
  • Hardened OTA and GApps field parsing against pathname expansion and cached hash and manager bridge lookups.
  • Corrected the Undo/Restore instructions in all 18 languages and added contextual help for Update OrangeFox Hook and Delete Old Restore File.
  • Documented the automatic Play Store reset and refreshed the READMEs.

v1.8.2: GApps downloader, recovery reflash and product name

  • Added the Download GApps section (MindTheGapps and NikGapps with Android version, NikGapps release selection, included package list and SHA-256/size verification).
  • Added the Reflash Recovery On Active Slot section to scan and reflash recovery_a.img / recovery_b.img onto the active slot while preserving existing backups.
  • Updated the product name in module metadata, WebUI and docs to Root Disable Enable Switch.

v1.8.1: descriptive product name

  • The module manager and WebUI show Root Enable Disable Switch as the product name. Module IDs and file names remain rdes.

v1.8.0: hook update progress

  • Hook repair runs in the background so the WebUI stays responsive. Percentage progress covers image backup/read, unpacking, hook insertion, repacking, verification, writing and standalone restore-script rebuild.

v1.7.18: background hook repair

  • Hook updates can rebuild the pending restore script and patch available recovery slots while preserving original backups.

v1.7.8 to v1.7.11: conditional Safety Check repair

  • Safety Check detects when the active OrangeFox slot needs its hook updated and offers the repair button only when needed.

v1.7.6: active slot detection in recovery

  • The recovery restore script detects the active slot when OrangeFox starts, so ROM updates that switch slots no longer leave it tied to the previous slot.

MMRL: Please use MMRL v34016 with ZAMR (MMRL base URL: https://zelect0r.github.io/zamr/). Other MMRL versions are currently broken.

  • Module id: rdes
  • Module name: Root Disable Enable Switch
  • Works on: any A/B Android device with a root manager and OrangeFox - including OnePlus 8T / KB2003 (verified there: Android 17, APatch, active slot _b)

Features

  • boot.img is the stock / root-off image.
  • apatch*.img (or any other recognized patched image) is the patched / root-on image.
  • User-supplied images always take priority over the built-in defaults.
  • Two-tap Disable Root and confirmed Undo Disable Root in the WebUI.
  • Prepare folder and Disable Root both back up recovery_a.img and recovery_b.img into /sdcard/Download/rdes/ before anything is flashed. Existing backups are never overwritten.
  • OrangeFox restores root automatically via a ramdisk hook (works with FBE + PIN). openrecoveryscript (ORS) and root-on.zip are kept as fallbacks.
  • WebUI status reports slot, boot state, images, magic checks, ZIP, ORS, encryption, hook and pending state. The layout adapts to narrow and 1080p WebView widths, with compact confirmation buttons.
  • Safety Check is a read-only pre-flight checklist. It compares SHA-256 hashes of the active boot_<slot> against the expected image and the staged /data/unencrypted/rdes-on.img, and checks slot, magic, hook, ORS and FBE before disabling root.
  • Stale staged restore after an external APatch, Magisk, kernel or boot change: the old /data/unencrypted/rdes-on.img no longer matches the current patched image. Safety Check shows it as a warning, not a fatal error, while no restore is pending. The next Disable Root stages the current image again. Delete Old Restore File appears under Instructions - Safety & Notes only for that warning. It removes the old staged copy without flashing or rebooting and is blocked while a restore is pending. Long-press the button to show a short explanation in any language.
  • After an active A/B slot change, Safety Check inspects the active OrangeFox ramdisk. Update OrangeFox Hook appears directly in Safety Check only when the active recovery hook is missing or a pending restore script is missing. If the recovery hook is already present, the button rewrites only the small restore script and leaves the staged image and recovery partitions untouched. If the recovery hook is missing, it patches the available recovery slots and refreshes a pending restore script. The operation runs in the background, reports its progress in percent, and preserves first backups.
  • WebUI language button at the top right: English, German, French, Spanish, Russian, Polish, Chinese, Danish, Finnish, Greek, Italian, Japanese, Dutch, Czech, Hindi, Arabic, Brazilian Portuguese and Indonesian. It defaults to the system language and remembers a manual choice. Arabic switches the WebUI to right-to-left layout. The menu uses the shared webroot/i18n.js helper, each module keeps its own dictionary.
  • Two buttons directly below the language button: the mode button switches between Dark, Light and AMOLED, the accent button between eight colors (Blue, Green, Red, Purple, Orange, Cyan, Pink, Yellow). Both are independent, stored locally in WebUI storage and applied to buttons, status, menus, dialog and doctor output. Colors follow Material 3 roles (surface, primary container and on-colors) derived from the selected accent seed. The accent menu shows a color dot for each entry and a check mark on the active one.
  • Reboot button next to Disable Root / Undo Disable Root, with confirmation.
  • Keybox β†’ crDroid (optional, above Disable Root): imports the current keybox.xml into crDroid's Settings.Secure while root is still active. The previous setting and the original XML file (including its path) are backed up, together with TrickyStore's target list, patch level and the installed Play Integrity Fix configuration, which are copied into crDroid so STRONG still works while root is off. Undo Disable Root gives the XML back to TrickyStore and removes the crDroid keybox, target, patch and PIF values immediately. This handoff is intended exclusively for official crDroid builds, whose framework reads these Settings.Secure keys while root is off. It is not a generic keybox/PIF bridge: other ROMs do not consume these values, so the import has no effect there (Undo still removes them).
  • Safety Check also shows the current SELinux state (getenforce, ro.boot.selinux, androidboot.selinux= in /proc/cmdline) plus keybox XML, TrickyStore target list and PIF config validity and crDroid detection. All of it is read-only: rdes never patches the image or calls setenforce.
  • Disable Root runs a read-only Safety Check first and stops if a fatal check (slot, device, image magic or hash mismatch) fails.
  • Update root-on image (while root is on): dumps the active boot partition to a timestamped apatch-on-*.img in /sdcard/Download/rdes/. Existing images are not overwritten, the newest dump takes priority for Undo. This replaces the manual dd command after an OTA or root-manager update.
  • Export state report: writes status plus Safety Check output to /sdcard/Download/rdes/rdes-report.txt for comparison across boots.
  • crDroid OTA downloader (WebUI, read-only apart from the downloaded ZIP): lists all officially supported crDroid devices for the current Android branch, lets you pick any device, then any build from its official OTA JSON and a thread count from 1 to 16. The ZIP is downloaded in HTTP ranges into /sdcard/Download/rdes/ and verified against its size and SHA-256. If a mirror ignores Range and answers 200 instead of 206, the worker retries once as a single stream before reporting BAD_RANGE. Progress is polled in the WebUI and the download can be cancelled. SourceForge-only builds are included and marked [SF], their size is read from the download header. Verify ZIP rechecks an already downloaded file in the target folder against the catalog size and SHA-256 without downloading it again. Nothing is flashed and the device is not rebooted.
  • LineageOS OTA downloader (WebUI, read-only apart from the downloaded ZIP): uses the official LineageOS updater API, offers every device for the selected Android version and downloads the chosen nightly with the same 1-16 range engine into /sdcard/Download/rdes/. The SHA-256 from the API id is verified and the download can be cancelled. Verify ZIP rechecks an existing file in the target folder against that SHA-256 without downloading it again. The same 200-fallback applies. No flash and no reboot.
  • GApps downloader (WebUI, read-only apart from the downloaded ZIP): supports MindTheGapps and NikGapps for the detected device architecture, lets you pick an Android version, NikGapps release folder and variant, previews the included packages, and downloads with the 1-16 range engine into /sdcard/Download/rdes/. Verify ZIP checks SHA-256 when the provider publishes it, or verifies size and records the SHA-256 locally. No flash and no reboot.
  • Reflash Recovery On Active Slot (WebUI): scans /sdcard/Download/rdes/ for recovery_a.img and recovery_b.img, identifies the recovery image (OrangeFox, TWRP or StockRecovery), verifies the ANDROID! magic, preserves existing first-copy backups, and flashes the image to the active recovery slot without rebooting.
  • Payload tools (WebUI): scan Downloads for OTA ZIPs or payload.bin, list partitions, and extract selected images directly from a ZIP (no manual unpacking needed). Images are written to /sdcard/Download/rdes/ and checked against the SHA-256 from the payload manifest. The dumper supports full payloads with raw, XZ and bzip2 operations and never flashes or reboots.
  • Keybox β†’ crDroid is hidden when no crDroid signature is detected, since the handoff has no effect on other ROMs. If signature detection fails, the button stays visible and warns before the import instead. The import itself remains optional and manual.
  • Reset Play Store (next to the keybox button): clears Play Store, Play Services and Google Services Framework data after confirmation. Both root toggles now run this reset automatically after a successful Disable Root or Undo Disable Root, so Play Store re-evaluates device certification for the current boot state. The manual button remains available.

Requirements

  • A rooted device with an A/B boot layout (active slot detected automatically).
  • APatch, KernelSU, Magisk or MMRL with a root WebUI bridge.
  • OrangeFox recovery. For automatic restore on an encrypted device, apply the one-time ramdisk hook with tools/patch-orangefox.sh (reapply after every OrangeFox update). For the OnePlus 8T use OrangeFox R11.3 V33 (OrangeFox-R11.3-OPKONA-V33.img).
  • Two boot images in the download folder:
    • boot.img - stock image from your ROM build (root off)
    • apatch*.img - APatch-patched image (root on)
    • Patched images do not need to be renamed: apatch*.img, magisk_patched*.img, magisk*.img, kernelsu*.img, ksu*.img, rooted*.img, boot-patched*.img, boot_patched*.img and patched*.img are all detected, in that order. A timestamped apatch-on-*.img created by Update root-on image takes priority over them. boot.img stays reserved for the stock image.
    • If you do not already have copies:
      • Stock: extract boot.img from the payload.bin of your ROM/firmware with the WebUI Payload tools (directly from the OTA ZIP), or with payload-dumper-go / another payload dumper.
      • Patched: while root is still on, dump the active boot partition, e.g. dd if=/dev/block/by-name/boot_b of=/sdcard/Download/rdes/apatch.img bs=4M (boot_a/boot_b depends on ro.boot.slot_suffix, the by-name symlink resolves to the real block device). If you only have the stock image, patch a copy with APatch instead.

Folder layout

/sdcard/Download/rdes/ (visible to OrangeFox without root):

File Purpose
boot.img Stock image, flashed by Disable Root
apatch*.img (or other patched names) Patched image, first recognized match is used for restore
apatch-on-YYYYmmdd-HHMMSS.img Timestamped dump created by Update root-on image, newest one wins over the older images
recovery_a.img, recovery_b.img First-copy backups of both recovery slots, created by Prepare folder or automatically by Disable Root
rdes-report.txt Status + Safety Check export created by Export state report
crDroidAndroid-*.zip OTA ZIP created by crDroid OTA downloader (verified)
*.img extracted from payload.bin Partition images created by Payload tools. boot.img here is the stock image
payload-dump.bin, .payload-source Internal cache for the direct-ZIP payload dumper
lineage-*.zip OTA ZIP created by LineageOS OTA downloader (verified)
MindTheGapps-*.zip, NikGapps-*.zip GApps ZIP created by Download GApps (verified)
.ota-status, .ota-fetch-status, .ota-parts/ Internal progress/status files for the crDroid downloader
.los-ota-status, .los-fetch-status, .los-parts/ Internal progress/status files for the LineageOS downloader
.gapps-status, .gapps-fetch-status, .gapps-parts/ Internal progress/status files for the GApps downloader
root-on.zip Manual-install fallback ZIP

/data/adb/rdes/keybox/ holds the temporary handoff backup: keybox.xml, source (original path), secure-key, secure-format, secure-backup (previous value. secure-unset means it was never set), target-backup / target-unset for spoof_trickystore_target, patch-backup / patch-unset for spoof_trickystore_patch, pif-backup / pif-unset / pif-imported / pif-source for spoof_pif_config, and crdroid-applied. The backup is removed after a successful restore or handback.

When a disable is pending, the patched image and its restore script are staged in /data/unencrypted/rdes-on.img and /data/unencrypted/rdes-restore.sh. Fallback defaults are stored in /data/adb/rdes/images/ as boot-off.img and boot-on.img. Copy defaults to folder never overwrites your own files.

Installation

  1. Download the module ZIP from the latest release (for example rdes-v1.8.3.zip).
  2. Install it in APatch (or another root manager that supports Magisk-style modules). customize.sh sets the executable bits on the helper scripts and OrangeFox hook updater.
  3. Reboot, then open the module WebUI.
  4. Place your boot.img and patched image (for example apatch*.img or magisk_patched*.img) in /sdcard/Download/rdes/.
  5. Tap Prepare folder once to stage root-on.zip and back up the current patched boot image.
  6. On FBE devices, run Safety Check after an active slot change. Use Update OrangeFox Hook only when it reports a missing hook or a pending restore script for the previous slot. The button and its explanation appear only while that check is relevant.

WebUI

Button Action
Refresh status Shows slot, boot state, images, magic checks, ZIP, ORS, encryption, hook and pending state
Safety Check Read-only pre-flight checks, including boot/staged SHA-256 comparison
Update OrangeFox Hook Shown under Safety Check only when the active recovery hook or pending restore script is missing; rewrites only the script when possible, otherwise patches recovery slots, with percent progress shown while running
Delete Old Restore File Shown only when a stale restore is detected; removes the outdated staged copy, blocked while a restore is pending; long-press shows help
Prepare folder Stages root-on.zip, backs up the patched boot image and both recovery slots (also done automatically before disabling)
Copy defaults to folder Copies saved images without touching existing files
Keybox β†’ crDroid Optional: imports keybox.xml, target list, patch level and PIF config into crDroid after backing up the old values and file
Reset Play Store Clears Play Store / Play Services / GSF data after confirmation
Verify ZIP In the crDroid, LineageOS and GApps panels: checks an existing ZIP in the target folder against catalog size and SHA-256 (or size + recorded hash), without downloading again
Load GApps In the GApps panel: fetches available variants, release metadata and included package lists for MindTheGapps or NikGapps
Scan Recovery Images Scans /sdcard/Download/rdes/ for recovery_a.img and recovery_b.img backups
Reflash Active Recovery Validates the selected recovery backup and flashes it to the active recovery slot (no reboot)
Disable Root Tap twice, then confirm: backs up both recovery slots, flashes boot.img, stages the restore and resets Play data for a fresh certification check
Undo Disable Root Flashes the patched image, cancels a pending disable, returns the XML to TrickyStore, deletes crDroid's keybox/target/patch/PIF values and resets Play data (only while root is on)
Reboot Confirms, then reboots the device normally
🌐 language button Switches the whole UI (including status and messages). Auto (system) follows the WebView locale
πŸŒ™ mode button Switches between Dark, Light and AMOLED, the choice is remembered
🎨 accent button Switches between 8 accent colors (Blue, Green, Red, Purple, Orange, Cyan, Pink, Yellow), independent of the mode; color dot and check mark show the selection

The confirmation uses an in-page dialog, so no native WebView title/URL is shown. Its buttons are intentionally compact rather than full-width. Status is emitted as one KEY=value line because WebUI bridges such as ksu.exec() return only the last output line.

How it works

rdes WebUI - screenshot 1 rdes WebUI - screenshot 2 rdes WebUI - screenshot 3

Disable root

Disable Root checks the ANDROID! magic, detects the active slot, copies the patched image plus a restore script to /data/unencrypted/, writes a short ORS for unencrypted devices and flashes boot.img to boot_<slot>. After the reboot, APatch/Magisk signals are gone.

ORS written by Disable Root (fallback for unencrypted devices)
cmd sh /data/unencrypted/rdes-restore.sh
reboot

Re-enable root automatically

Boot OrangeFox (key combo or adb reboot recovery). The patched ramdisk calls /data/unencrypted/rdes-restore.sh from system/bin/runatboot.sh before the FBE decryption prompt, and again from system/bin/postrecoveryboot.sh after decryption as a fallback. The script flashes the staged patched image to the active boot slot, clears the pending marker and reboots into the patched system.

While a disable is pending, booting OrangeFox for any reason restores root. This is the intended trigger.

Undo a pending disable

While the running system is still rooted, Undo Disable Root flashes the patched image back and removes the marker, ORS and staged files. After that, a reboot stays rooted and OrangeFox will not restore anything.

Conditional WebUI buttons

Two buttons appear only when their check finds a matching condition:

  • Update OrangeFox Hook is shown in Safety Check when the active recovery hook is missing or a pending restore script still targets the previous slot. If only the script is missing, it rewrites the script and leaves the staged image and recovery partitions untouched. If the hook is missing, it patches the available recovery slots, keeps the first backups and refreshes a pending script. It runs in the background and reports progress in percent.
  • Delete Old Restore File is shown under Instructions - Safety and Notes only when a staged restore image is stale and no restore is pending. It removes the outdated copy from /data/unencrypted and /data/cache without flashing or rebooting. It is blocked while a restore is pending. Long-press the button for a short help text in the current language.

Optional crDroid keybox handoff

crDroid keeps its TrickyStore keybox in Settings.Secure, which can only be written while root is active. Keybox β†’ crDroid imports the on-disk keybox before root is disabled. It never runs automatically with Disable Root.

The helper mirrors an existing keybox-looking Secure value (raw XML or base64) back to the same key in the same format. If none exists yet, it uses the documented crDroid 13 / branch 17.0 default: spoof_trickystore_keybox with one unwrapped base64 layer of the trimmed, BOM-stripped XML. That avoids the wrong key on other ROM generations while still working out of the box.

crDroid alone defaults to AUTO targets and no patch spoof, which drops a keybox-only handoff to BASIC. The import therefore also copies /data/adb/tricky_store/target.txt and security_patch.txt into spoof_trickystore_target and spoof_trickystore_patch. The ! target syntax is supported by both implementations. Undo restores the previous values (or deletes them if they were unset), so crDroid is left exactly as before.

crDroid also needs its own PIF config. Without spoof_pif_config it returns BASIC even with a valid keybox. The import copies the installed PlayIntegrityFix / Integrity Box config (custom.pif.json, custom.pif.prop or a pif.* file in the rdes download folder) into spoof_pif_config. If no PIF config is found, the keybox is still imported and the WebUI reports PIF: nicht gefunden, in that case configure PIF in crDroid Settings first.

Keybox lookup order:

  1. /data/adb/tricky_store/keybox.xml
  2. /data/adb/teesim/keybox.xml
  3. /sdcard/Download/rdes/keybox.xml
  4. /data/media/0/Download/rdes/keybox.xml

The first handoff wins: later imports never overwrite the saved original. While the patched boot image is written, Undo returns the XML byte-exact to its saved source path - and also to /data/adb/tricky_store/keybox.xml if the source was elsewhere - then removes the Settings.Secure keybox key plus the spoof_trickystore_target, spoof_trickystore_patch and spoof_pif_config values this import wrote, restoring any previous values. Older handoffs that pre-date PIF support are migrated so their live PIF value is removed too. The temporary backups are removed afterwards. No separate boot service is installed in this version. The WebUI shows a toast when a keybox file is found (with its path) or missing, and the status lists the PIF state.

Reset Play Store data

Both Disable Root and Undo Disable Root clear Play Store, Play Services and GSF data automatically after the boot image is written and before the reboot. This is deliberate:

  • The toggle still runs with root available. After the reboot root is off, so the WebUI can no longer run pm clear.
  • Play Integrity and Play Store cache the previous certification result. Clearing the data forces a fresh check against the new boot state, so a cached result cannot make the toggle look unsuccessful.
  • The reset is best effort. If it fails, the toggle still completes and the WebUI shows a note. The manual button remains available.

Reset Play Store next to the keybox button runs the same reset on demand. It force-stops Google Play Services, Play Store and GSF, then clears their data. Google accounts normally remain, but Play services and the store reconfigure and resync. The keybox handoff itself never starts this reset automatically.

Manual fallback

If the hook is missing (for example right after an OrangeFox update), tap Install β†’ /sdcard/Download/rdes/root-on.zip β†’ Reboot System in OrangeFox. The ZIP flashes the recognized patched image itself, no image selection is needed.

Build from source

sh build.sh

This produces:

  • rdes.zip - module ZIP containing:
    • module.prop, customize.sh, action.sh
    • tools/webui.sh, tools/patch-orangefox.sh, tools/payload_dump
    • webroot/index.html, webroot/i18n.js
    • README.md
    • assets/root-on.zip (the fallback ZIP, as in previous builds)
  • root-on.zip - standalone OrangeFox recovery ZIP

Prepare folder copies assets/root-on.zip to /sdcard/Download/rdes/root-on.zip.

Safety and notes

  • The ANDROID! magic is checked before every flash.
  • The recovery restore script detects the active slot from ro.boot.slot_suffix or androidboot.slot_suffix in /proc/cmdline when OrangeFox starts. This handles ROM updates that switch A/B slots. The Android-side slot is only a fallback for recovery builds that expose neither value.
  • /cache is a symlink to /data/cache on many A/B devices. OrangeFox checks the ORS before decryption, so FBE devices need the ramdisk hook. The WebUI shows Encrypted: yes, Restore hook and Pending undo for diagnosis.
  • The ramdisk hook is device-specific and must be reapplied after updating OrangeFox. Original recovery images are backed up by the patch script.
  • Flashing the wrong image can make the system unbootable. In an emergency, manually flash the other image to boot in OrangeFox.
  • The ROM SELinux rule shell β†’ su comes from the ROM, not from APatch. It stays visible even with root off, this switch only removes the APatch/Magisk signals.

Support

If you find rdes useful and would like to support its development and maintenance, you can support me on Ko-fi.

β˜•οΈ Support zelect0r/rdes on Ko-fi

Your support helps me continue developing and maintaining rdes. Thank you! ❀️

License

Use at your own risk. Adapt and redistribute freely with attribution.


Copyright Β© 2026 zelect0r.

About

Root toggle module with English WebUI (And 17 other languages) for A/B Android devices, including OnePlus 8T. Disable root with a stock boot.img, restore it by booting OrangeFox.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages