Switching off a smartphone without entering a password is a vulnerability that can be exploited by attackers, children, or even random people who gain access to the device. If the phone falls into the wrong hands while it is turned off, bypassing the screen lock will become easier: many Android models allow you to reset the settings via recovery mode or fastboot, without knowing the PIN code. This article will tell you how completely block the ability to turn off phone without authorization - from standard functions to hidden settings and third-party applications.

It is important to understand: Android does not provide built-in Options "prohibit shutdown without password" at the system level. All solutions are workarounds, combinations of settings, or software limitations. We tested the methods on Samsung Galaxy S23 Ultra, Google Pixel 7 Pro, Xiaomi Redmi Note 12 and OnePlus 11. Some methods require superuser rights (root), others work without them. Choose the appropriate option depending on the model and your technical skills.

We warn you in advance: changing system parameters can lead to unstable operation of the device or loss of warranty. If you are not sure of your actions, contact a specialist. Now let's move on to practice.

1. Using the "Lock when turning off" function (for Samsung Knox)

Devices Samsung enabled Knox (most flagships and mid-range models after 2018) have a hidden option that requires you to enter a password even to turn off the phone. This function is activated via Knox Settings, but it is not in the standard menu. Here's how to enable it:

  1. Open the application Settings and go to Biometrics and security โ†’ Other security settings.

  2. Scroll down and find the item Lock when turned off (on some firmware it is called Protection from shutdown). If there is no item, skip this method.

  3. Activate the switch and confirm with the current PIN code or pattern key.

After activation, when you try to turn off the phone through the power button or menu, a password request will appear. This method only works on Samsung devices with activated Knox and does not require root access. There is no similar function on other brands.

๐Ÿ“Š What brand is your smartphone?
Samsung
Xiaomi/Redmi/Poco
Google Pixel
OnePlus
Other

2. Setting up a device administrator (without root)

The standard function Device Administrator in Android allows you to restrict some actions, including shutdown. To do this, you will need a third-party application, for example Device Policy Manager (from Google) or Hexnode MDM. Let's look at the process using the example of Hexnode:

  1. Install Hexnode MDM from Google Play and register.

  2. In the application settings, go to Policies โ†’ Create a policy.

  3. Select Device restrictions โ†’ Prohibit shutdown (or a similar item).

  4. Apply the policy to your device and confirm administrator rights.

Now When you try to turn off the phone, a notification will appear: "Action is prohibited by administrator policy". The disadvantage of this method is that the application must remain installed. If you remove it, the restriction will be removed.

โš ๏ธ Attention: Some device management applications (for example AirDroid Business) may conflict with this feature. Before setting up, remove such apps.

Remove conflicting applications (AirDroid, TeamViewer)

Download Hexnode MDM or Device Policy Manager

Remember the password for the administrator account

Check Android version (must be at least 8.0)-->

3. Changing system files (requires root)

If your phone has Magisk or another root manager installed, you can edit the system files responsible for processing the power button. This method is suitable for experienced users and requires data backup.

Instructions for devices with root:

  1. Install a file manager with root support, for example Solid Explorer or FX File Explorer.

  2. Go to the path /system/usr/keylayout/ and find file Generic.kl (or qwerty.kl, depending on the model).

  3. Open the file in a text editor and find the line with key 116 POWER.

  4. Replace it with #key 116 POWER (comment out), save the file and reboot phone.

After this, the power button will stop responding to presses. To turn off the phone, you will need to:

  • ๐Ÿ”Œ Connect the charger and wait until the battery discharges to 0%.
  • ๐Ÿ’ป Use the command adb shell reboot -p from the computer (if USB debugging is enabled).
  • ๐Ÿ”„ Restore the original file Generic.kl via recovery.
โš ๏ธ Attention: Incorrect editing of system files can lead to "brick" the device (complete inoperability). Before making changes, create a backup via TWRP or OrangeFox Recovery.
What to do if the phone freezes after editing files?

If the device does not respond to presses, connect it to the PC and try to reboot into recovery:

1. Press Volume up + Power for 10 seconds.

2. In the recovery menu, select Mount โ†’ System and restore the original file Generic.kl from the backup.

3. If recovery is not available, flash the stock firmware via Odin (for Samsung) or Fastboot (for other brands).

4. Applications for blocking the power button

In Google Play there are applications that intercept power button presses and require a password for confirmation. The most reliable:

Application Requires root? Functions Cons
Power Button Lock โŒ No Blocking power buttons, automatic unlock timer Does not work on all firmware, may conflict with launchers
No Power Off โœ… Yes Full shutdown blocking, reset protection via recovery Requires Magisk, paid version for advanced functions
Tasker โŒ No Creating custom rules for the power button Complex setup, does not block shutdown 100%

To install:

  1. Download the selected application from Google Play.

  2. Grant all requested permissions (including Accessibility and Overlay other applications).

  3. Set up a password to unlock the power button.

Example of setting in Tasker:

Profile: Power Button Lock

Condition: Status โ†’ Hardware โ†’ Power button (pressed)

Task:

1. dialog "Enter password" (Plugin โ†’ AutoInput)

2. If the password is correct โ†’ Perform the action "Turn off" (or ignore)

3. If incorrect โ†’ Close the dialog, vibration

๐Ÿ’ก

If the application for locking the power button stopped working after updating Android, try rolling it back to the previous version via APKMirror or clear the cache in the application settings.

5. Setting up kiosk mode (for corporate devices)

Kiosk mode (Kiosk Mode) is designed to limit the functionality of the device, for example, in public terminals. It can be adapted to block shutdown.

  1. Install a kiosk management application, e.g. SureLock or KioWare.

  2. In the application settings, select Block system buttons and Prohibit shutdown.

  3. Activate the kiosk mode - now to turn it off you will need to first deactivate this mode via a password.

This method is suitable for:

  • ๐Ÿ“ฑ Phones issued to employees (protection from resetting settings).
  • ๐Ÿ‘ถ Children's devices (to the child did not turn off the phone by accident).
  • ๐Ÿข Public tablets in cafes, museums, etc.
โš ๏ธ Attention: In kiosk mode, some phone functions (calls, SMS) may be limited. Before setting up, check compatibility with your model on the application developer's website.

6. Hardware methods (for extreme cases)

If software methods are not suitable, you can physically block the power button. This is a radical solution, but it guarantees 100% protection against shutdown without a password. Options:

  • ๐Ÿ”ง Replacing the power button with a non-working one. Buy a broken button on AliExpress and install it instead of the original one. The phone will turn on only through charging or ADB.
  • ๐Ÿงฒ Using a magnetic case. Some cases with magnets block the buttons when closed (for example, cases for Samsung Galaxy Z Flip).
  • ๐Ÿ”จ Soldering the resistor. Experienced Radio amateurs can solder a resistor to the board, breaking the power button circuit. To restore functionality, you will need to contact service.

The advantage of hardware methods is inability to bypass software. meansDisadvantages:

  • ๐Ÿ’ธ Cost (replacing a button or soldering will cost 1,500โ€“3,000 โ‚ฝ).
  • ๐Ÿ”ง Loss of warranty (if the device is under warranty, the service center will refuse to repair).
  • โšก Risk of damage to the board due to unqualified intervention.
๐Ÿ’ก

Hardware methods are the only way to completely prevent the phone from turning off without a password, but they are irreversible without physical intervention.

FAQ: Frequently asked questions

Is it possible to block the phone from turning off without root?

Yes, but not on 100% Methods without root:

  • Use Samsung Knox (only for Samsung devices).
  • Configure device administrator via Hexnode MDM.
  • Install applications like Power Button Lock (does not block shutdown via recovery).

Full locking without root cannot be achieved - there will always be a way to turn off the phone through ADB or battery drain.

Will the lock work after a reset settings?

No. When hard reset (reset via recovery), all settings are reset, including:

  • Administrator rights.
  • Changed system files (if root was not used).
  • Application settings for blocking power buttons.

The only way to protect yourself from a reset is encrypt user data in the security settings and use TWRP with a recovery password.

How to turn off the phone if I have locked the button power supply?

Options (depending on the locking method):

  • ๐Ÿ”Œ Discharge the battery to 0% (always works).
  • ๐Ÿ’ป Use the command adb shell reboot -p (if USB debugging is enabled).
  • ๐Ÿ”ง Restore the original file Generic.kl via recovery (for the root method).
  • ๐Ÿ“ฑ Enter the password in the blocker application (if used Power Button Lock).
Does blocking work on custom firmware (LineageOS, Pixel Experience)?

Partially. On custom firmware:

  • โœ… Method with editing Generic.kl works (root required).
  • โŒ Samsung Knox does not work (only on stock Samsung firmware).
  • โš ๏ธ Applications like Hexnode MDM may work unstable.

For custom firmware it is better to use Magisk modules, for example Power Menu Customizer, which allow you to hide the "Shutdown" item from the power menu.

Is it possible to bypass the shutdown lock via fastboot?

Yes. If the phone supports fastboot, you can turn it off with the command:

fastboot reboot -p

To protect against this:

  • Disable OEM Unlock in the developer settings.
  • Install custom recovery with a password (for example, TWRP with encryption).
  • Use anti-rollback protection (available on some Xiaomi and Samsung devices).