How to Add Exceptions to Xiaomi Cleanup: The Complete Guide

Xiaomi smartphones are known for their optimized memory management system, but sometimes automatic cleaning removes important files or cache of the desired applications. If you notice that after cleaning photos, documents or application data disappear, then it’s time to set up exceptions. In this article, we will discuss how to protect files from deletion on Redmi, POCO and Mi devices with a MIUI shell.

The problem is that by default, the system considers even useful data to be “junk”: messenger cache, downloaded maps in the navigators or temporary game files. Without the right settings, you risk losing hours of downloaded content or working documents. Fortunately, MIUI allows you to flexibly manage exceptions - you just need to know where to look.

Why Xiaomi is Deleting Files

Automatic cleaning in Xiaomi works on an algorithm that analyzes:

  • 📅 Date of last use – files older than 30 days are considered unnecessary.
  • 🗑️ Data type – cache, temporary files, thumbnails of images.
  • 📉 Occupied space – if there is a lack of memory, the system removes everything in a row.
  • ⚙️ Application settings – some programs (such as a gallery) label files as “junk».

The problem is compounded by the fact that MIUI doesn't always correctly recognize important data, such as:

  • 📸 Original photos from the folder DCIM/.thumbnails (thumbnail).
  • 🎮 Save games if they are stored in a cache (e.g. Genshin Impact or PUBG Mobile).
  • 📄 PDF-files and documents downloaded through the browser.
  • 🗺️ Offline maps Google Maps or Yandex.Navigator.

To avoid losses, you need to manually tell the system which data to not touch, and then we will look at all the ways to add exceptions, from standard MIUI tools to hidden functions.

📊 How often do you clear your memory on Xiaomi?
Once a week.
Once a month
Only when the place ends.
Never clean.

Method 1: Exceptions to “Memory Cleanup” (standard method)

The easiest way is to use the built-in Cleanup utility (formerly Security) and it is available on all Xiaomi devices with MIUI 12 and later.

  1. Open the Cleanup app (icon with broomstick).
  2. Go to the “Deep Cleaning” tab.
  3. Press three points (⋮) in the upper right corner and select "Settings».
  4. Slip on the "Exceptions."
  5. Turn on the switch next to the desired apps or add folders manually through Add.

This menu can be protected:

  • 📱 Applications – their cache and data will not be deleted.
  • 📁 Folders – specify the path to the directory (for example, /storage/emulated/0/Download/Important).
  • 🔄 Extension files – for example, all.pdf or.apk files.

Method limitation: Some system folders (e.g. Android/data) cannot be added to exceptions through this interface.

Data messengers (Telegram, WhatsApp)

Offline maps of navigators

Game savers (e.g. Genshin Impact)

Folder with important documents (Download/Work)

Streaming services cache (Netflix, YouTube)-->

Method 2: Protect folders through the “Files” (MIUI File Manager)

If the standard Cleanup doesn’t allow you to add the folder you want, use MIUI File Manager, which works even for system directories:

  1. Open the Files app.
  2. Go to the folder you want to protect (for example, Download or DCIM/Camera).
  3. Tap it on three points (⋮) and select "Properties».
  4. Activate the option “Add to cleaning exceptions”.

Advantages of this method:

  • 🔒 It works for all folders, including system folders.
  • 📌 You can protect the attached directories (for example, only Download/Projects, Not the entire Download folder).
  • 🔄 Changes apply immediately, without rebooting.

Important: if the folder is on SD-card, it must first be connected as internal storage in the phone settings (Settings) → Warehouse → SD-map → Set it up as internal, otherwise the system won't be able to protect it.

What if the “Add to Exceptions” option is inactive?
If the button is gray, it means: 1. the folder is already protected (check in "Clean" → "Exceptions"). 2. You do not have enough rights (root access for system folders is needed). 3. The folder is on a removable drive that is not connected as internal storage.

Method 3: Using ADB for hidden exceptions

For advanced users, there is a way to add exceptions through ADB (Android Debug Bridge), which will help protect system data that cannot be selected through the standard interface.

  • 🖥️ Computer with installed ADB-driver.
  • 📱 Included debugging by USB on the phone (Settings) → The phone. → Version. MIUI → 7 times tap to unlock the developer menu, then Settings → Additionally. → For developers → Debugging by USB).
  • 🔌 USB-Type C Cable (preferably original).

Instructions:

  1. Connect your phone to your PC and confirm access via USB.
  2. Open the command line (Windows) or terminal (macOS/Linux) and type:
adb shell pm grant com.miui.cleanmaster android.permission.WRITE_SECURE_SETTINGS


adb shell settings put global deep_clean_white_list "package:com.example.app|/storage/emulated/0/Download"

Where:

  • com.example.app is the application identifier (you can find out through the App Inspector or adb shell pm list packages).
  • /storage/emulated/0/Download is the path to the folder.

To apply a few exceptions, list them through the vertical line (|):

adb shell settings put global deep_clean_white_list "package:com.whatsapp|package:com.google.android.apps.maps|/storage/emulated/0/DCIM/Camera"

💡

Before using ADB, back up your data. Incorrect commands can disrupt the system.

Method 4: Disabling Automatic Cleaning for Individual Applications

If you don’t need to fully protect folders, but only save the data of a particular application (for example, Telegram cache or Chrome downloads), use the Battery and Performance settings:

  1. Go to Settings → Applications → Application Management.
  2. Select the app you want (such as WhatsApp).
  3. Put it on the Battery.
  4. Enable the "No Limits" option.
  5. Go back and select “Clean” → turn off “Car Clean”.

This will prevent:

  • 🗑️ Removal of the app cache.
  • ⏳ Forced stop of background activity.
  • 📥 Cleaning up uploaded files (for example, media from chat rooms).

The downside of the method is that the application will consume more power, as the system will not limit its operation in the background.

Table: What can and cannot be protected from cleaning

Type of dataCan exceptions be added to theMethodNotes
Application cache✅ Yes.“Cleaning” → “Exceptions” or App SettingsDoes not work for system applications (e.g., Gallery)
Folders on internal memory✅ Yes.“Files” → “Properties” → “Add to Exceptions”You cannot protect root system folders (e.g. /data)
Data on SD-map⚠️ Partially.Only if the card is connected as an internal storageFor external drives need root rights
System files (/data/data)❌ No.Only through ADB or rootRisk of disrupting the system
Offline maps✅ Yes.“Files” → select a folder with maps (for example, Android/data/com.google.android.apps.maps)After updating the application, the path may change

If your case doesn't make it to the table, try combining methods, such as protecting the saves of Genshin Impact:

  1. Add the Android/data/miHoYo.GenshinImpact folder to the exceptions via Files.
  2. Disable autoclean for the Genshin Impact app in the settings.
  3. Stop optimizing the battery for the game.

What to do if exceptions don’t work

Sometimes even after setting up exceptions, MIUI continues to delete files.

⚠️ Note: If you use third-party cleaners (such as CCleaner or Files by Google), they ignore settings. MIUI. Turn off auto-cleaning in these apps or remove them.

  • 🔄 Reset cleaning settings: Go to Settings → Annexes → Application management → Cleanup → Warehouse → Clean the data. It will reset all the exceptions, and then you have to add them again.
  • 📱 Update MIUI: In older versions (below). MIUI 12) the exception function is unstable. Update the system to Settings → The phone. → Update MIUI.
  • 🔧 Manual editing of configs: For power users: in file /data/system/package_restrictions.xml You can manually write exceptions (root required).

If the problem persists, check:

  • 📊 Is there enough free space on the device (less than 10% of memory causes aggressive cleaning).
  • 🔋 Is the mode "Saving charge" turned on - it intensively cleanses the background processes.
  • 🛠️ Are there any viruses (check through “Security» → «Scanner»).

💡

If exceptions don't work, check the third-party cleaners first, then update the MIUI. 90% of the time, the problem is solved by these actions.

FAQ: Frequent questions about Xiaomi cleanup exceptions

Can I protect the photo folder from being cleaned?
Yes, for that: Open the Files app. Go to the folder. DCIM/Camera (Or another folder with a photo. Press three dots (⋮) → «Properties» → «Add to the exceptions cleaning. If the option is inactive, then the folder is already protected or is on the SD-A card not connected as an internal storage.
Why did my exceptions reset after the MIUI update?
For major system updates (e.g., from MIUI 13 to MIUI 14), the cleaning settings are reset. To avoid losses: Back up important data before upgrading. After updating, add the exceptions again via Cleanup → Settings → Exceptions. If you use ADB, you also need to re-run the commands.
How to protect your application data if it is not on the exclusion list?
If the application does not appear in Cleanup → Exceptions, try: Turn off auto-cleaning in the application settings (Settings → Apps → [application name] → Cleanup). Add a folder with its data to exceptions via Files (a path usually Android/data/[package.name]). Use ADB to force add (see Method 3).
Will the cleanup remove files from the cloud services (Google Drive, Mi Cloud)?
No, automatic cleaning. MIUI none: 🌥️ Files in Google Drive, Mi Cloud or other cloud storage. 📎 Data synced to your account (contacts, notes, calendar) but if you download files from the cloud to your device (like the Download folder), they can be deleted» → «Properties».
How to check which files were deleted during cleaning?
MIUI maintains a cleanup log, but it is not always accessible to the user. To track deleted files: Install File Manager+ or Root Explorer (root required). Check the /data/log/cleaner folder, there may be logs there. Use data recovery utilities (such as DiskDigger) if files are critical. To prevent this, set up regular backups through Settings → Additional → Backup and Reset.