Skip to content

feat(app): hide direct install and uninstall when bootloader is locked - #29

Merged
pixincreate merged 2 commits into
masterfrom
feat/locked-bootloader-guard
Aug 14, 2026
Merged

feat(app): hide direct install and uninstall when bootloader is locked#29
pixincreate merged 2 commits into
masterfrom
feat/locked-bootloader-guard

Conversation

@pixincreate

Copy link
Copy Markdown
Owner

Closes #28

Detect bootloader lock state via system properties (ro.boot.vbmeta.device_state) and restrict risky operations:

  • Hide Direct Install — writing to boot partition on a locked bootloader risks softbrick
  • Hide Install to Inactive Slot — same risk as Direct Install
  • Hide Uninstall — uninstalling Magisk on a locked bootloader is unrecoverable without OEM unlock

Still available: Select and Patch a File, Download and Patch a File, install options (keep_verity, keep_enc, recovery_mode) — these produce a patched image file that the user handles externally.

Changes apply to both the new Compose UI (apk-ng) and the legacy Fragment UI (apk).

@pixincreate pixincreate self-assigned this Jun 1, 2026
@pixincreate pixincreate added the enhancement New feature or request label Jun 1, 2026
@pixincreate pixincreate changed the title Hide direct install and uninstall when bootloader is locked feat(): hide direct install and uninstall when bootloader is locked Jun 1, 2026
@pixincreate pixincreate changed the title feat(): hide direct install and uninstall when bootloader is locked feat(app): hide direct install and uninstall when bootloader is locked Jun 1, 2026
@pixincreate
pixincreate force-pushed the feat/locked-bootloader-guard branch from 98329e5 to 1ffe51b Compare June 1, 2026 11:35
@pixincreate
pixincreate requested a review from Copilot June 1, 2026 16:23

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds bootloader lock-state detection and uses it to hide risky Magisk operations (direct flashing, inactive-slot flashing, uninstall) when the device bootloader is locked, across both the legacy (Fragments/XML) and new Compose UI.

Changes:

  • Introduces Info.isBootloaderLocked based on system properties (ro.boot.vbmeta.device_state, fallback ro.boot.flash.locked).
  • Hides Direct Install and Install to Inactive Slot when bootloader is locked (legacy + Compose).
  • Hides Uninstall when bootloader is locked (legacy + Compose).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
app/core/src/main/java/com/topjohnwu/magisk/core/Info.kt Adds bootloader lock-state detection used by UIs/viewmodels.
app/apk/src/main/res/layout/fragment_install_md2.xml Hides “Direct Install” method on locked bootloaders in legacy UI.
app/apk/src/main/res/layout/fragment_home_md2.xml Hides legacy uninstall button on locked bootloaders.
app/apk/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt Propagates lock-state into legacy install flow logic (noSecondSlot).
app/apk-ng/src/main/java/com/topjohnwu/magisk/ui/install/InstallViewModel.kt Propagates lock-state into Compose install flow logic (noSecondSlot).
app/apk-ng/src/main/java/com/topjohnwu/magisk/ui/install/InstallBottomSheet.kt Hides Compose “Direct Install” entry when bootloader is locked.
app/apk-ng/src/main/java/com/topjohnwu/magisk/ui/home/HomeScreen.kt Hides Compose uninstall button when bootloader is locked.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/core/src/main/java/com/topjohnwu/magisk/core/Info.kt Outdated
Comment thread app/apk/src/main/res/layout/fragment_home_md2.xml
Comment thread app/apk/src/main/res/layout/fragment_install_md2.xml

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@pixincreate
pixincreate marked this pull request as ready for review June 1, 2026 17:26
@pixincreate
pixincreate force-pushed the master branch 2 times, most recently from 1fb02cc to 6bbb994 Compare July 13, 2026 14:56
@github-actions
github-actions Bot force-pushed the master branch 2 times, most recently from b859b9d to c601cd4 Compare August 4, 2026 08:00
@pixincreate
pixincreate force-pushed the master branch 3 times, most recently from 065ca99 to d03451e Compare August 13, 2026 07:44
On devices with locked bootloaders and integrated Magisk root
(e.g. GrapheneOS with Magisk), direct install to boot partition and
uninstall operations present a softbrick risk. Only allow patching
a file (which the user handles externally) in such environments.

- Add isBootloaderLocked detection via ro.boot.vbmeta.device_state
- apk-ng: Hide Direct Install and Install to Inactive Slot when locked
- apk-ng: Hide Uninstall button when locked
- apk (legacy): Same changes for the older UI
…uards, fix spacer

- Cache isBootloaderLocked as eager val with case-insensitive comparison
- Add hard guard in install() for locked-incompatible methods
- Sanitize methodId on state restore in legacy ViewModel
- Fix spacer visibility gap when bootloader locked + env active
@pixincreate
pixincreate force-pushed the feat/locked-bootloader-guard branch from 7b95874 to 575fa8a Compare August 14, 2026 10:46
@pixincreate
pixincreate merged commit 6652224 into master Aug 14, 2026
25 checks passed
@pixincreate
pixincreate deleted the feat/locked-bootloader-guard branch August 14, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE](app): hide direct install and uninstall when bootloader is locked

2 participants