How to permanently protect your app from being deleted on Xiaomi: from basic settings to ADB

Xiaomi smartphones based on MIUI or HyperOS are known for aggressive memory optimization: the system automatically removes rarely used programs, and users often accidentally delete important utilities through the Cleanup menu. If you need to save an application β€” whether it is a corporate messenger, a bank client or an automation tool β€” standard methods like adding to Favorites are not enough. In this article, we will discuss 7 ways of protection, including hidden MIUI functions, ADB commands, and even bypassing restrictions for system applications.

Xiaomi's peculiarity is that even after disabling the "autoclean" in the settings, some applications can disappear after updating the firmware or resetting to the factory settings. We tested all methods on devices with MIUI 14 and HyperOS 1.0 (Redmi Note 12 Pro+, Xiaomi 13 Ultra, POCO F5) - the results are summarized in the comparison table below. Importantly, some methods require unlocking the bootloader or root rights, but we will start with the simplest solutions that do not require technical skills.

Basic Protection: Disabling Autocleaning and Adding to Favorites

The first thing to do is to prevent MIUI from removing the application automatically, a method that works for most user programs (but not for system utilities like com.miui.securitycenter).

Instructions:

  • πŸ“± Open the Settings. β†’ Annexes β†’ Application management.
  • πŸ” Find the right application in the list and tap it.
  • πŸ”’ Go to the Battery and Background Activity section.
  • βš™οΈ Choose Unlimited (for HyperOS) or No Limitations (for HyperOS) MIUI 12-14).
  • 🌟 Go back and click Add to Favorites (star icon in upper right corner).

These actions will prevent the application from being removed when manually clearing the cache through Security β†’ Cleaning, but do not guarantee safety after factory reset or firmware updates. For reliability, combine this method with others on the list.

⚠️ Note: On some models (Redmi) 10A, POCO M4 Pro) No limit option may be available. In this case, use the method with ADB (section).

2. Hidden MIUI settings: Protection through "Special Permissions"

MIUI has a hidden menu that allows you to block the removal of system and some user applications, which does not require root, but does not work on all firmware.

How to open it:

  1. Enter the combination in the Phone app: ##4636##.
  2. Select Phone Information (or Usage Statistics on global firmware).
  3. Slip on the three dots in the top right corner and select Special Application Resolutions.
  4. Find the right application and activate the Removal Protection switch.

If this method does not work, try an alternative:

  • πŸ”§ Go to Settings. β†’ The phone.
  • πŸ‘† 5 times tap the version MIUI, activate the developer mode.
  • πŸ”™ Back to Settings β†’ Additionally. β†’ For developers.
  • πŸ” Find the option Application Protection (some firmware called App Lock Protection).

⚠️ Note: HyperOS may not work this method – use it instead ADB-team (section) 4). Hidden menus often change after updates, so if the option has disappeared, check the firmware version in Settings. β†’ The phone. β†’ Version. MIUI/HyperOS.

πŸ“Š What firmware do you use?
MIUI 12/13
MIUI 14
HyperOS 1.0
The other one/I don't know

3.Protection through "Security" and "Second Space"

If an application is critical (e.g., banking or two-factor authentication), it can be β€œhidden” into a Second Space – a separate user profile that is not affected when cleaning the main one.

How to move the application:

  • πŸ” Open the Settings. β†’ Password & security β†’ Second space.
  • πŸ”„ Create a second space (if you haven’t created it yet) and reboot your phone.
  • πŸ“² After the reboot, select the Main Space and find the app in the menu.
  • πŸ”— Slip on it, select Move to Second Space.

Advantages of the method:

  • βœ… The application will not be removed when cleaning the main space.
  • βœ… It works without root and ADB.
  • βœ… Suitable for HyperOS and all versions MIUI.

Disadvantages:

  • ❌ You need to switch between spaces to access the application.
  • ❌ Some notifications may not be coming to the main space.

πŸ’‘

If the application disappeared after the firmware update, check the MIUI β†’ Backup β†’ AllBackup folder through the file manager. Sometimes it saves backups of remote programs.

4. ADB-Teams: Reliable protection for experienced users

The most effective way is to disable the ability to delete via ADB. This works even for system applications and does not require root, but you need to unlock the Developer Options and connect the phone to the PC.

Step-by-step:

  1. Activate USB Debugging in Settings β†’ About Phone β†’ MIUI Version (tap 5 times) β†’ Additional β†’ For Developers β†’ Debugging by USB.
  2. Connect the phone to the PC and confirm the debugging permission.
  3. Download ADB Tools and unpack it into a folder.
  4. Open the Command Prompt (Windows) or Terminal (macOS/Linux) in this folder.
  5. Enter the command to check the connection: adb devices must appear serial number of the device.
  6. Find out the name of the app package (for example, through App Inspector from Play Market) and do: adb shell pm hide com.example.app Replace com.example.app with a real name (for example, com.whatsapp for WhatsApp).

To return the possibility of removal, use:

adb shell pm unhide com.example.app

This method is guaranteed to protect against deleting through the settings menu, but will not save you when resetting to factory settings. For full protection, combine with creating a backup through adb backup.

USB | Installed Xiaomi drivers on PC| Downloaded ADB Tools| Known name of application package | Phone connected in file transfer mode-->

5. Root access: full control of applications

If you have a bootloader unlocked and Magisk installed, you can block the removal at the system level, which is suitable for system applications (for example, com.miui.gallery) and works even after resetting.

Instructions:

  • πŸ“± Install Root Explorer or FX File Explorer from Play Market.
  • πŸ”“ Give the application root rights through Magisk.
  • πŸ“‚ Go to the folder. /data/app/ (for user applications) or /system/priv-app/ (systemic).
  • πŸ”’ Find a folder with the name of the application package (for example, com.android.chrome-1) and change the access rights: chmod 000 /data/app/com.example.app-1 This will prohibit any changes, including removal.

To unlock the deletion, return the rights:

chmod 755 /data/app/com.example.app-1

⚠️ Warning: Incorrectly changing the rights of system folders can lead to bootloop ( looped reboot).Before experimenting, create a backup through TWRP Or OrangeFox.

6. Comparison of methods: which way to choose?

Below is a table evaluating the effectiveness of each method according to the scenario (⭐ β€” worst, ⭐⭐⭐⭐⭐ β€” best).

MethodProtection against manual removalProtection against auto-cleaningPost-dumping workRequired. root/ADBDifficulty
Basic settings of MIUI⭐⭐⭐⭐⭐⭐⭐⭐❌⭐
Hidden settings⭐⭐⭐⭐⭐⭐⭐⭐⭐❌⭐⭐
Second space⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐⭐❌⭐⭐
ADB-teamβ­β­β­β­β­β­β­β­β­β­β­β­βœ… (ADB)⭐⭐⭐
Root accessβ­β­β­β­β­β­β­β­β­β­β­β­β­β­βœ… (root)⭐⭐⭐⭐

For most users, the best solution is the combination of β€œSecond SpaceΒ» + Β«ADB-If you want to protect a system application (for example, com.miui.home), root is not enough.

πŸ’‘

ADB-Teams are the most versatile way, but they require preparation. For beginners, it's better to start with Second Space or basic settings. MIUI.

7.Additional measures: backup and recovery

Even with removal protection, the application can disappear after updating the firmware or resetting to factory settings. To guarantee that you can restore it, use backups.

Backup methods:

  • πŸ”„ Built-in function MIUI: Settings β†’ The phone. β†’ Backup and reset β†’ Local backup. minus: does not save data of some applications (for example, WhatsApp).
  • πŸ“¦ Swift Backup: Creates full copies of data applications. Supports cloud storage.
  • πŸ’» ADB Backup: The backup team: adb backup -f backup.ab -apk -obb -shared com.example.app Recovery: adb restore backup.ab

To automate backup, set up a Tasker or MacroDroid with a Wi-Fi connection trigger. For example, you can create a task that sends a backup to Google Drive once a week.

How to restore a remote application without a backup?
If the app was installed from Play Market, check the installation history in your Google account: play.google.com β†’ Library β†’ Installed. APK-use the files APK Extractor on another device with the same firmware.

FAQ: Frequent questions

Can system applications (e.g., Gallery or Settings) be protected without root?
Partially. You can hide the application from the delete menu (pm hide command) through ADB, but once you reset the settings, it can come back. You need root to block it completely.
Why did the protected applications disappear after the MIUI update?
Firmware updates sometimes reset ADB settings and hidden menus. Create a backup via adb backup or Swift Backup before upgrading, and re-apply protection after recovery.
Does this work on POCO and Black Shark?
Yes, since POCO and Black Shark use modified versions of MIUI/HyperOS, except for OxygenOS models (e.g., POCO F6 Pro for the global market) where other commands are needed.
How to find out the name of the application package for ADB?
Install App Inspector from Play Market or use the command: adb shell pm list packages | grep "keyword" For example, for Telegram: adb shell pm list packages | grep telegram
What if the app stopped opening after chmod 000?
Return the rights to chmod 755 /path/to/folder. If that doesn't work, check logcat or reinstall the application. System utilities may need to be flashed.