The power button on a smartphone is one of the most vulnerable elements: it breaks due to frequent pressing, gets stuck due to moisture, or simply stops responding. But what to do if there is a physical button out of order, but the phone is still working? Or do you want block it from accidental clicks (for example, in your pocket)? In this article, we will look legal ways to disable or reassign the power button without harm to the system - from built-in Android functions to third-party applications.
It is important to understand: completely it is impossible to disable the hardware button programmatically it is tied to low-level kernel processes. However, it can block it at the interface levelbe reassigned to other actions or simulate a click through software. The methods differ for smartphones with root access and without them, and also depend on the version of Android (starting with Android 9 Pie new restrictions have appeared for third-party applications).
If your goal is prevent accidental shutdown of the phone (for example, in a pocket or bag), just activate protection against accidental clicks in the settings. If the button is physically broken, you will need to reassign its functions to other keys or gestures. Below are detailed instructions for both cases.
1. Built-in protection against accidental clicks (without ROOT)
Modern smartphones Android 10+ have a built-in function to lock the power button when the device is in a pocket or bag. This option does not disable the button completely, but prevents accidental shutdown or rebooting.
How to activate:
- ๐ฑ Samsung: go to
Settings โ Lock screen โ Additional settings โ Protection against accidental clicksand enable the option. - ๐ฑ Xiaomi/Redmi/Poco: open
Settings โ Lock screen โ Advanced settings โ Key lock. - ๐ฑ Google Pixel: the function is called
Sensor blockingand is located inSettings โ System โ Gestures โ Sensor blocking. - ๐ฑ Other brands: look for options like
Preventing accidental clicksorPocket modein the lock screen settings.
This function works based on proximity sensor i accelerometer: if the phone is lying face down or in motion (for example, bag), the power button ignores short presses. However long hold (for a forced reboot) will still work.
โ ๏ธ Attention: On some models Huawei i Honor this feature may conflict with control gestures. If after activation the swipes stop working, turn it off or update the firmware.
2. Reassigning the power button through โAccessibilityโ
Android allows reassigning hardware buttons without ROOT, but with limitations. The most reliable way is to use the built-in tools Accessibility (Accessibility). This method works on most smartphones, including Samsung Galaxy, Xiaomi, OnePlus and Google Pixel.
Instructions:
- Open
Settings โ Accessibility โ Button management(name may differ). - Select
Power buttonorHardware buttons. - In the list of actions, select what you want to reassign to:
- ๐ Opening Google Assistant (voice assistant).
- ๐ฑ Launch an application (for example, a camera or flashlight).
- ๐ Inaction (the button will be ignored).
- ๐ Other action (for example, swipe to take a screenshot).
Method limitations:
- โ Does not work on Android 13+ for reassignment to system functions (for example, shutdown).
- โ Some brands (for example, Oppo i Vivo) block this option.
- โ Suitable for disabling the reaction to a short press, but a long hold (to reboot) will remain active.
โ๏ธ Preparation for reassigning the button
3. Using applications to block the button (without ROOT)
If the built-in methods are not suitable, you can use third-party applications. The best options:
| Application | Functions | Restrictions | Compatibility |
|---|---|---|---|
| Button Mapper | Reassigning buttons, blocking short/long presses, creating gestures. | Does not work on Android 12+ without ADB. Requires accessibility permissions. | Android 7โ11 |
| Power Button Control | Disable response to pressing, replace with gestures or virtual buttons. | On some Xiaomi requires disabling MIUI Optimization. | Android 8โ13 |
| GravityBox [Xposed] | Full control over buttons, including hold lock. | Requires ROOT or Magisk. Not compatible with Android 12+. | Android 5โ11 |
| Tasker | Creating automatic rules to ignore presses of the power button. | Complex setup, requires knowledge of trigger logic. | Android 6+ |
Example setup in Button Mapper:
- Install the application from Google Play.
- Grant permission
Accessibility. - Select
Power buttonโSingle press(short press). - In the list of actions, select
No action(inaction). - Save the profile and reboot the phone.
โ ๏ธ Attention: On Samsung One UI 5.0+ i Xiaomi HyperOS Button Mapper may not work without additional configuration via ADB. If after applying the changes the button is not blocked, try disabling MIUI optimization in the developer settings (Settings โ About phone โ Build number (7 taps) โ For developers โ Disable MIUI optimization).
If the power button is broken, but the phone turns on via charging, use the application Power Menu to simulate the shutdown menu through a notification.
4. Disabling the power button via ADB (for advanced users)
If the standard methods do not work, you can block the button via Android Debug Bridge (ADB). ROOT, but assumes working with the command line. Suitable for Android 8โ13.
Step-by-step guide:
- Enable
USB debuggingon your phone:- Go in
Settings โ About phone โ Build number(tap 7 times to unlock developer mode). - Return to
Settings โ System โ For Developersand activateUSB Debugging.
- Go in
adb.exe.adb shell settings put secure sysui_power_dialog 0
To block a long press (reboot):
adb shell settings put global power_key_long_press_action 0
To return standard behavior, use the commands:
adb shell settings delete secure sysui_power_dialog
adb shell settings delete global power_key_long_press_action
Method limitations:
- โ Doesn't work on Android 14+ due to new security restrictions.
- โ On some firmware (for example, ColorOS), changes are reset after a reboot.
- โ Suitable for temporary shutdown buttons (for example, on repair time).
What to do if ADB does not recognize the device?
Make sure that the drivers for your phone model are installed (download from the manufacturerโs website). Try using a different USB cable (preferably the original one). In the developer settings, enable the option USB debugging (security settings) i Allow changing ADB permissions.
5. Completely disabling the power button with root access
If you have ROOT access or installed Magisk, you can completely block the power button at the kernel level. This method is suitable for permanent shutdown (for example, if the button is physically broken and interferes with operation).
Methods:
- ๐ง Editing
keylayout:- Using Root Explorer go to
/system/usr/keylayout. - Find the file
Generic.klor{your_model}.kl. - Open the file in a text editor and find the line c
key 116 POWER. - Replace it with
#key 116 POWER(comment out). - Save the file, set the rights
644and reboot the phone.
- Using Root Explorer go to
- Install the module via Magisk Manager.
- In the module settings, select
Disable Power Button. - Reboot the device.
- โ ๏ธ Risk of "brick" (turning the phone into a "brick") if you incorrectly edit the system files.
- โ ๏ธ On some firmware (for example, MIUI) changes may be reset after the update.
- โ ๏ธ After disabling the button turn off the phone can only be accessed through ADB or removing the battery.
Warnings:
Use ROOT methods only if you are confident in your actions. To temporarily disable the button, applications or ADB are better suited.
6. Alternative ways to control your phone without the power button
If the power button is disabled or broken, the question arises: how to turn the phone on/off now? Here are some solutions:
- ๐ Gestures or touch buttons:
For example, on Xiaomi you can turn on
Double tap to wake(Settings โ Lock screen โ Double tap). On Samsung there is an optionRise to wake. - ๐ฑ Virtual button turn off:
Applications like Power Menu or Quick Reboot add a shutdown button to the notification panel.
- ๐ Automatic turn on when charging is connected:
On some phones (for example Google Pixel) this works by default. For other models, you will need the module Magisk
Charge Enable Power Button. - ๐ป Control via PC (ADB):
Commands for shutdown/reboot:
adb shell reboot -p # shutdownadb shell reboot # reboot - Connect the charger and wait 10-15 minutes (some models turn on automatically when charging).
- If yes OTG cable, connect the mouse - on some firmware the cursor can open the power menu.
- For Samsung s Bixby: hold the button Bixby + increase volume for 10 seconds to force a reboot.
If the power button completely brokenand the phone turns off, try:
7. Common mistakes and how to avoid them
When trying to disable the power button, users often encounter problems. Here are the most common of them and ways to solve them:
| Problem | Cause | Solution |
|---|---|---|
| The button is not blocked via Button Mapper | On Android 12+, additional permission is required ADB. | Run the command:
|
| After reboot, the settings are reset | The firmware resets user settings (for example, ColorOS). | Use Tasker to automatically apply the settings after loading. |
| The phone does not turn on after disabling the button | The button was the only way to wake up. | Connect the charger or use an OTG mouse to turn it on. |
| The application asks for ROOT, but there is none | Some functions (for example, hold lock) require superuser rights. | Use ADB or built-in accessibility settings. |
If none of the methods worked, check:
- ๐ Android version: on new versions (13+) many methods are blocked.
- ๐ Firmware: custom firmware (for example, LineageOS) may have its limitations.
- ๐ Phone brand: u Huawei i Honor often have their own button locking mechanisms.
- Remove the battery (if removable) for 10-15 seconds.
- If the battery is not removable, hold the power button + volume up for 20 seconds to force shutdown.
- After turning on, use Button Mapper or ADBto block the response to presses.
- On Android 10 and below this can be done through
Special Featuresor Button Mapper. - On Android 11+ Google has prohibited reassigning the power button to launch applications for security reasons.
- Workaround: Use Tasker to create a task that will launch the camera when you double-click the power button (if your firmware supports it).
- Connect the charger device โ some models (for example, Samsung, Google Pixel) turn on automatically when charging.
- Use OTG cable + mouse/keyboard โon some firmware you can call the power menu via a USB device.
- Connect the phone to the PC and send the command via ADB:
adb shell input keyevent 26 # simulation pressing the power button - Disassemble the phone and disconnect/connect the battery (only if you have experience!).
- Take it to service - technicians can turn on the phone via test points (service contacts on the board).
โ ๏ธ Attention: On phones with Android Go (for example, Nokia 1, Samsung Galaxy J2 Core) many methods do not work due to the reduced functionality of the system.
FAQ: Frequently asked questions
Is it possible to completely disable the power button without ROOT?
No. Without ROOT you can only reassign or block reaction click, but physically the button will remain active at the kernel level. A complete shutdown requires editing system files, which is only possible with superuser rights.
What to do if the power button is stuck and the phone constantly reboots?
Urgent measures:
If all else fails, take the phone to a service center to clean or replace the button.
Will the fingerprint or Face ID work if you turn off the power button?
Yes, biometric unlocking does not depend from the power button. It is controlled by a separate controller. However, on some models (for example OnePlus), the fingerprint may not work if the phone is completely turned off - you will still need a physical button or charge to turn it on.
Is it possible to reassign the power button to launch the camera, like on the iPhone?
Yes, but with limitations:
How to turn on the phone if the power button is broken and it turns off?
Methods in order of priority:
If the phone does not respond to anything, perhaps the problem is not in the button, but in power controller on the motherboard.