Reassigning the power button to Xiaomi: all the ways and hidden functions

The power button on Xiaomi smartphones is not just a way to turn the device on or off. MIUI It's got dozens of hidden features that 90 percent of users don't even know about: double tap to start the camera, hold on to the voice assistant, triple tap for emergency. SOS β€” And that's just the tip of the iceberg, but what if you don't want to use the standard combinations, you want to, for example, double-click a flashlight or lock the screen with a single touch?

In this article, we will discuss all possible ways to reassign the power button to Xiaomi, from built-in tools. MIUI 14/15 down-to-the-cloak ADB And third-party apps. You'll learn how to do this:

  • πŸ”„ Change the default action (single/double click, retention)
  • πŸ“± Set up power button gestures for quick access to apps
  • βš™οΈ Use it. ADB Extended functions (including prohibited functions) MIUI)
  • ⚠️ Bypass system limitations without root rights
  • πŸ”§ Restore the standard settings if something goes wrong

Important: Not all methods work on customized firmware (like Pixel Experience or LineageOS). MIUI, There are additional options available for devices with unlocked bootloader, which we will also consider.

πŸ“Š What Power button function do you want to reassign?
Double click
Retention
Triple press.
Action on lockdown
Other

MIUI Standard Settings: What You Can Change Without Root

Starting with MIUI 12, Xiaomi added built-in tools to reassign buttons, but hid them deep in the menu:

  1. Open Settings β†’ System β†’ Gestures and buttons.
  2. Select the Power button (on some models – Physical buttons).
  3. Here you will see the available options: πŸ”˜ Double tap: Launch the camera, flashlight or application (select from the list). πŸ”˜ Retention: Voice Assistant (Google Assistant or Xiao) AI), switch-on. πŸ”˜ Triple press: SOS User action (not available on all models).

Nana POCO F5, Redmi Note 12 and new flagships (Xiaomi 13 Ultra, 14 Pro) in this menu there is an additional Action item when blocking:

  • πŸ“΅ Turn off the screen with one tap (without delay).
  • πŸ”’ Block the device with a fingerprint + power-button.
  • πŸ“± Run an app when you hold on (like Google Pay for contactless payment).

Limitation: In standard settings, you can’t reassign a single click (it’s always responsible for locking/unlocking) and you can’t link system functions like turning on Mode on an airplane or Do Not Disturb – this will require you to do it. ADB.

πŸ’‘

If your menu does not have the "Power button" item, update it. MIUI Check the latest version or check the model of the device on some budget smartphones (e.g. Redmi). A2) function is missing.

Advanced settings through ADB: How to circumvent restrictions MIUI

For those who don’t have the standard options, there’s a way to reassign any action of the power button β€” including a single click β€” through the power button. ADB (Android Debug Bridge – This method works on all Xiaomi devices with an unlocked bootloader and does not require root rights.

You'll need:

  • πŸ–₯️ Computer with installed ADB Tools.
  • πŸ“± Included Debugging by USB on a smartphone (Settings) β†’ The phone. β†’ Version. MIUI β€” Press 7 times, then return to Settings β†’ Additionally. β†’ For developers).
  • πŸ”Œ USB-cable (preferably original).

Instructions:

  1. Connect your smartphone to your PC and execute the command: Adb devices Make sure that the device is determined (should appear its serial number).
  2. Enter the command to view current button assignments: adb shell settings list secure | Grep key Here we are interested in parameters power_key_long_press (retention) and power_key_double_press (double-click).
  3. To reassign the power button to start Google Assistant, use: adb shell settings put secure power_key_long_press 1 Other meanings: 0 β€” without action. 1 β€” Google Assistant. 2 β€” Xiao AI (China only). 3 β€” switch off.
adb shell settings put secure power_key_double_press 2

Where 2 is the action code for the flashlight. For the full list of codes, see the table below.

Code of operationFunctionWorks for MIUI.
0No action.βœ… All versions.
1Camera launchβœ… All versions.
2Lanternβœ… Starting with MIUI 12
3Voice assistantβœ… Depends on the region.
22SOS (flash-call)⚠️ Only in some models
How to reassign a single click of the power button?
This is possible only through modification of system files with root rights or custom recaveri (TWRP). Without root, you can not change a single click β€” MIUI Blocking these commands through ADB. Alternative: Use apps like Button Mapper (see next section).

After reassignment through ADB Changes will persist even after the reboot, but will reset to standard when updated MIUI. To get it all back, use it:

adb shell settings delete secure power_key_long_press


adb shell settings delete secure power_key_double_press

πŸ’‘

ADB It allows you to reassign only those actions that are already laid down in the MIUI. For example, you won’t be able to tie the power button to Spotify’s launch or mobile data enabled – you need third-party apps to do this.

Third-party apps: Button Mapper, Tasker and alternatives

If the built-in options and ADB Not enough, third-party utilities are coming to the rescue:

  • πŸŽ›οΈ Button Mapper – allows you to reassign any physical buttons (including power and volume control) to run applications, system functions or macros.
  • πŸ€– Tasker + AutoInput plugin – to create complex scenarios (e.g., β€œpower button retention” + shaking = set up").
  • πŸ”„ SecondScreen – specializes in button gestures (e.g., double clicking to switch between applications).

Let’s look at the Button Mapper:

  1. Download the app from Google Play.
  2. Grant permission for Special Opportunities (Settings) β†’ Special opportunities β†’ Button Mapper).
  3. Select the Power button and set up actions: πŸ”˜ Single Click: Screen locking (alternative to standard behavior). πŸ”˜ Double Click: Launch Google Keep or another app. πŸ”˜ Retention: on/off mode in the aircraft.

Save the settings and test.

The benefits of Button Mapper are:

  • βœ… It works without root.
  • βœ… Supports macros (e.g., β€œpower click”) + volume = screenshot").
  • βœ… System functions that are not available through ADB.

Disadvantages:

  • ⚠️ On some Xiaomi models (e.g. Redmi Note 10 Pro) the app may conflict with the MIUI, delaying the blocking.
  • ⚠️ After updating MIUI settings may reset.

Disable battery optimization for the application|Provide all requested permits|Test the settings in safe mode|Create a backup of current button assignments-->

Reassigning the power button on custom firmware (TWRP, root)

If your Xiaomi is running custom firmware (Pixel Experience, LineageOS, ArrowOS), the ability to reassign buttons is expanded significantly. Here you can change any action, including a single click, without restrictions. MIUI.

Ways:

  1. Through build.prop: Open the file /system/build.prop any text editor with root rights: ro.config.vc_keyboard_power_longpress=1 # 1 β€” Google Assistant, 0 β€” without action ro.config.vc_keyboard_power_doublepress=2 # 2 β€” Flashlight Save the file and restart the device.
  2. Xposed Framework (for Android) 7-10): Install the Xposed Additions module. In the module settings, select the Power Button and assign the desired actions.

Magisk

  • Install the Button Mapper Magisk Module.
  • Configure the buttons through its interface (similar to the application of the same name).

On custom firmware, you can assign a power button to run any application or system function, including those that are locked in the MIUI (For example, reboot to recovery or enable debugging USB).

πŸ’‘

Before editing build.prop, make sure to back it up! a syntax error can lead to bootloop (locked device turn on).

Frequent problems and their solutions

Reassigning the power button is a delicate process, and it doesn't always go smoothly. Here are the most common problems and ways to fix them:

⚠️ Note: If, after changes, ADB Button Mapper smartphone stopped responding to the power button, connect it to charging and hold the power button + Volume up for 10 seconds for forced reboot.

Problem.Reason.Decision
The power button does not respond to the pressingConflict with MIUI after modification ADBAdb shell settings delete secure power_key_long_press
Double clicks are triggered by accidentLow delay between pressingsIncrease the delay in Button Mapper (Double Press Delay setting)
No reassignment on custom firmware worksThere is no support in the core.Install the Button Mapper Magisk Module
The smartphone is spontaneously turned offReassigned single click to shut downReturn the standard settings through ADB or TWRP

If you use Button Mapper and notice that the smartphone has become slower to lock, try:

  • πŸ”„ Disable battery optimization for the application.
  • πŸ”„ Reduce the number of assigned actions (e.g., leave only a double click).
  • πŸ”„ Switch to switch to ADB-basic-function.

⚠️ Attention: On devices with MIUI Global Stable Some Teams ADB If you see a not allowed error after you enter the command, try using the Button Mapper or unlock the bootloader.

Reassign the power button on Xiaomi tablets (Pad) 5/6)

On Xiaomi Pad 5, Pad 6 and Pad 6 Pro, the power button behaves differently than on smartphones.

  • πŸ“± Locking/unlocking the screen.
  • πŸ” Calling Google Assistant (holding).
  • πŸ“· Camera Launch (Double Click if enabled in Settings).

Features of reassignment on tablets:

  1. MIUI for tablets has a separate button settings menu: Settings β†’ Display. β†’ Buttons and gestures.
  2. On the Pad 6 Pro, triple-click reassignment is available (for example, to run Xiaomi Notes).
  3. Through ADB You can assign a power button to enable Read Mode or Dark Theme: adb shell settings put secure power_key_long_press 23 where 23 β€” read-code.

Limitation: On Xiaomi tablets, you can't reassign a single click of the power button even with root rights - this is locked at the kernel level.Alternative: use gestures on the lock screen.

Security: What Cannot Be Reassigned and Why

Not all experiments with the power button are harmless, but some changes can:

  • 🚨 Lead to loss of warranty (if you use unofficial firmware or root).
  • 🚨 Cause software failures (for example, inability to unlock the device).
  • 🚨 Disrupt system services (for example, disable) SOS-challenge).

What can't be done:

  • ❌ Reassign a single click to turn off the device – the risk of accidental shutdown.
  • ❌ Assign a reset or login to recovery to the power button without emergency.
  • ❌ Use unverified ADB-team from dubious sources.

If you still encounter a problem (for example, the smartphone does not respond to the power button), try:

  1. Connect the device to charging and hold the power button + volume up to 15 seconds (forced reboot).
  2. If the screen is not turned on, connect your smartphone to your PC and do: adb reboot recovery
  3. In extreme cases, use the Mi Flash Tool to flash the device.

πŸ’‘

Before experimenting with the power button, back up your data through Settings β†’ Additionally. β†’ Backup and reset, which will keep you from losing important information when you crash.

FAQ: Answers to Frequent Questions

Can I reassign a single click of the power button without root?
No, in MIUI It's locked at the system level. The only way around is to use applications like Button Mapper, but they don't guarantee stable performance. On custom firmware like LineageOS, you can change a single click through build.prop editing or Magisk modules.
Why After Updating MIUI The power button settings have been dropped?
Updates MIUI frequently reset user settings associated with ADB To avoid this, re-apply the commands after the update. ADB Or reconfigure the Button Mapper, and if you use root, install the Button Mapper Magisk Module, which is more resistant to updates.
How to return the standard settings of the power button?
Ways: Through ADB: adb shell settings delete secure power_key_long_press adb shell settings delete secure power_key_double_press Through MIUI: Settings β†’ System system β†’ Resetting settings β†’ Reset button settings via Button Mapper: Open the app and click Reset to Default.
Does reassigning buttons to Xiaomi work with a locked bootloader?
Yes, but with limitations: βœ… Standard settings MIUI (Double click, retention – always working. βœ… Button Mapper – works without root, but may require permission for special features. ❌ ADB-Teams to change a single click do not work. ❌ Modification of build.prop – requires an unlocked bootloader.
Can I assign a power button to run a specific application?
Yes, but the way it works depends on your ability: πŸ“± No root: Use Button Mapper or Tasker (requires setting up the task to launch the application). πŸ“± With root: edit build.prop or install Magisk modules. Example command for Button Mapper (start Spotify by double click): Open Button Mapper and select Power Button β†’ Double Click. Under Action, select Launch the app and select Spotify. Save settings and provide all permissions requested.