Smartphone owners Xiaomi often encounter intrusive advertising in system applications and an overloaded interface MIUI. Switching to pure Android (AOSP) allows you to get rid of excess garbage, significantly speed up the operation of the device and extend battery life. This solution is ideal for those who value minimalism and want to get a usage experience similar to Google Pixel.

However, the process of replacing the operating system requires care and strict adherence to instructions. Unlocking the bootloader is the first and mandatory step, which erases all data from the device. Before starting any manipulations, it is necessary to create a complete backup copy of important files, photos and contacts, since it will be impossible to restore them after formatting.

It is worth noting that not all models Xiaomi have the same support from the developer community. Flagship devices usually receive firmware updates faster and more stable than budget models. The success of the operation directly depends on the compatibility of the selected assembly ROM with the specific hardware of your smartphone.

Preparation of tools and files for firmware

For successful installation AOSP you will need a specific set of software on the computer. The main tool will be ADB i Fastboot, which allow you to interact with the device at a low level. Without these tools, you will not be able to unlock the bootloader or install a custom recovery.

You will also need a high-quality USB cable, preferably original or certified. Cheap cables often do not provide a stable connection, which can lead to errors in data transfer or, worse, interruption of the firmware process. Using USB 3.0 ports on the motherboard (at the back of the system unit) is preferable to ports on the front panel of the case.

You must first download the firmware image designed specifically for your model. It is important to check the file hash to ensure the integrity of the download. A damaged file can lead to the smartphone turning into a โ€œbrickโ€ and requiring complex recovery via EDL mode.

โ˜‘๏ธ Preparation checklist

Done: 0 / 4

Unlocking the Bootloader

Company Xiaomi blocks the bootloader by default, which prevents installation of third-party software. To remove restrictions, you need the official utility Mi Unlock Tool and account Mi Account. The process is not instantaneous: after submitting an application in the system, you often have to wait from 7 to 168 hours.

You need to activate developer mode in the smartphone settings. To do this, click seven times on the build number in the "About phone" section. Then in the "For Developers" menu, enable the "USB Debugging" and "Unlock Bootloader" items. Without these settings, the computer will not be able to recognize the device in the desired mode.

โš ๏ธ Attention: Unlocking the bootloader automatically performs a full data reset (Wipe Data). All photos, messages and applications will be deleted without the possibility of recovery.

After waiting for the period set by the manufacturer, connect the phone in Fastboot (holding down the volume down button when turning on) and run Mi Unlock Tool. The app will check the account status and, if all conditions are met, unlock the device. This step is critical for further installation TWRP.

Installing custom recovery TWRP

Custom recovery Xiaomi has limited functionality and does not allow installing unsigned firmware. TWRP (Team Win Recovery Project) is the gold standard for custom recovery, providing full access to the file system. Installation occurs through the mode Fastboot using the command in the console.

First you need to place the image file twrp.img in the folder with tools ADB. Then, having connected your smartphone in fast boot mode, run the command in the terminal:

fastboot flash recovery twrp.img

An important nuance for devices Xiaomi: immediately after flashing the recovery firmware, you cannot boot into a regular system. If you do this, the stock firmware will overwrite TWRP back. You must immediately hold down the combination of buttons (usually volume up + power) to enter the installed recovery.

In the menu TWRP first of all, it is recommended to make a backup of the current system (Backup section). This will create a fallback point in case the new firmware is unstable or doesn't suit you. Also in this menu, partitions are cleared Data and Cache before installing a new OS.

What to do if TWRP does not see the internal memory?

If after installing TWRP you see 0 MB of memory, you need to format the Data partition. To do this, go to Wipe โ†’ Format Data and enter "yes". This will delete all data, including music and photos, but will make the memory writable.

The process of installing clean AOSP firmware

After preparing the environment, you can proceed with the installation. Copy the zip archive with the firmware AOSP and, if necessary, the package Google Apps (GApps) to the internal memory or SD card. In the TWRP menu, select Install and specify the path to the firmware file.

The slider at the bottom of the screen will confirm the start of the process. Installation may take from 3 to 10 minutes, depending on the speed of the memory card and system capacity. At this time, a log of the operations being performed will be displayed on the screen, which is useful to read if something goes wrong.

  • ๐Ÿ“‚ Select the firmware file in the Install menu.
  • ๐Ÿ”˜ Confirm the action by moving the slider.
  • โณ Wait for the "Successful" message in log.
  • ๐Ÿ”„ Press the "Reboot System" button.

The first startup after flashing always takes longer than usual. The system optimizes applications and creates new configuration files. If the smartphone is stuck on the logo for more than 10 minutes, an incompatible software version was probably selected or partition cleaning (Wipe) was not performed.

๐Ÿ“Š What is the main goal of switching to pure Android?
Acceleration
No advertising
Interface design
New Android functions

Setting up Google Services and drivers

Pure Android (AOSP) is often supplied without Google services, since their distribution is licensed. You will need to independently install the package GApps (for example, OpenGApps or NikGApps), corresponding to the Android version and processor architecture (usually arm64). It is best to do this immediately through TWRP before the first launch.

After the system boots and connects to Wi-Fi, the standard Google setup wizard will launch. Sign in to your account to sync your contacts, calendar, and restore your app list from Play Market. Without this step, many popular applications, such as YouTube or Maps, will not work.

Some functions, such as VoLTE or NFC payment, may require additional patches or specific settings to work correctly. In pure Android, control of these functions is sometimes hidden or requires the installation of third-party modules if the firmware developer has not integrated them into the base assembly.

Component Purpose Where to download
GApps Google Services (Play Market, YouTube) opengapps.org
TWRP Custom recovery twrp.me
ADB/Fastboot Debugging tools developer.android.com
Magisk root access and modifications github.com/topjohnwu

Possible problems and solutions

The most common problem โ€” Bootloop (cyclic reboot). If your phone keeps rebooting, try logging into TWRP again and performing a hard reset (Format Data) and then reinstalling the firmware. Also, the cause may be a Dalvik cache conflict, which is cleared through the Wipe โ†’ Dalvik Cache menu.

Another common issue is a non-working camera or lack of sound. This indicates that the firmware does not contain proprietary drivers for your model. In such cases, you need to look for and install an additional firmware package or switch to another build marked as "Official" or "Stable".

โš ๏ธ Attention: TWRP menu interfaces and partition names may differ depending on the recovery version. Always carefully read the descriptions of actions before confirming (Swipe to confirm).

If after all the manipulations the device does not turn on and does not respond to buttons, it may have gone into mode EDL (Emergency Download Mode). In this case, you will need a cable with closed contacts (or disassembling the case) and a special utility QFIL for low-level recovery of stock firmware.

๐Ÿ’ก

Save the stock firmware to your computer before experiments. This is the only guaranteed way to return the device to its original state for sale or service.

Advantages and disadvantages of custom firmware

Switching to AOSP gives a noticeable increase in performance, especially on older models Xiaomi. The system consumes less RAM, animations become smoother, and background processes do not consume battery power collecting telemetry and displaying advertising. The user experience becomes more predictable and controllable.

However, there are also disadvantages. Cameras in custom firmware often shoot worse than in stock MIUI, due to the lack of proprietary image processing algorithms. There may also be problems with the operation of banking applications that have an unlocked bootloader and refuse to launch without additional tricks (for example, using Magisk Hide).

๐Ÿ’ก

Pure Android is a balance between performance/privacy and the convenience of standard camera and security functions.

In addition, security updates in custom builds depend on enthusiasts. If the developer abandons the project, your the phone may remain with vulnerabilities. Therefore, it is important to choose firmware with active support on forums such as 4PDA or XDA Developers.

Will the warranty expire after flashing?

Formally, unlocking the bootloader and changing the software will void the manufacturer's warranty. However, if you return the stock firmware. and again block the bootloader through the Mi Unlock Tool, it will be extremely difficult to visually determine the intervention in the service center, unless they conduct a deep diagnosis of the logs.

Is it possible to return everything as it was?

Yes, this is possible. You will need to download the official firmware (Recovery ROM) for your model, rename the file to update.zip, put it in the root of the internal memory and flash it through stock recovery or TWRP. After this, the bootloader can be blocked again.

Do banking applications work on pure Android?

By default, no, since they see an unlocked bootloader. For them to work, you need to install Magisk, enable Zygisk and. use modules to hide root access (DenyList). This is a game of cat and mouse, and there is no guarantee of 100% work.

Do you need to pay for the firmware?

No, all AOSP firmware, tools (TWRP, ADB) and Google Apps packages are distributed free of charge. You should pay only if you order the flashing service. in the workshop, but any user can do this independently.