A Magisk module to disable the power menu while the screen is locked on Android devices.
lockscreen-powermenu-blocker is a shell-based Magisk module that prevents access to the power menu when your device is locked. This enhances device security by ensuring no one can power off, restart, or access other power menu options from the lockscreen.
- Blocks power menu access when the screen is locked
- Universal and efficient: dynamically detects the correct input device for the power key
- Minimal CPU usage
- Easy to install and uninstall
The module uses a background shell script to monitor the power key event. If the power button is held down while the device is locked, the script quickly turns the screen off, preventing the power menu from being shown.
- Download the ZIP:
Get the latest release from the Releases page. - Flash in Magisk:
- Open the Magisk app.
- Go to Modules.
- Tap "Install from storage" and select the ZIP file.
- Reboot your device.
- Remove the module from the Magisk app and reboot your device.
- Android devices with Magisk installed
- No hardcoded event device: works universally across most Android devices
- Requires access to
/system/bin/shand thegeteventutility
- The script runs as a background service to monitor power button events.
- It dynamically locates the input device responsible for power key events.
- When the power key is pressed while the device is locked, the script triggers a screen-off event, blocking the power menu.
See system/bin/lockscreen-powermenu-blocker.sh for the main implementation.
Contributions and feedback are welcome!