If youโve ever looked at a developerโs settings on a Xiaomi smartphone or tried to figure out why some apps donโt work as expected, youโve probably come across the term activities, a term that often raises questions among users, especially when it comes to optimizing the system, debugging apps, or even solving performance issues.
Unlike standard terms like โprocessesโ or โservices,โ activities are a deeper level of interaction with the Android operating system that directly affects how apps are displayed and function on the screen. In MIUI, Xiaomiโs branded shell, managing these elements has its own features that every advanced user should know about. Next, we will discuss what they are, how they relate to the operation of the smartphone, and why they sometimes have to be adjusted manually.
What are activities in Android and MIUI?
The term activity in the context of Android refers to one user interface screen with the ability to interact. Simply put, each application window you see is a separate activity. For example, in the Telegram messenger, the main chat tape, the screen of a particular dialogue and profile settings are three different activities, even if they belong to the same application.
In MIUI, the activities management system inherits the standard Android mechanisms, but with some modifications. For example, Xiaomi is actively using energy-saving optimizations that can force background activity to close if not used, which leads to some applications โflying outโ or losing state when switching between tasks.
- ๐ฑ One appendix = Many activities. For example, in Mi Fit, the statistics screen, device settings and user profile are different activities.
- ๐ Every activity goes through stages: creation (onCreate), launch (onStart), renewal (onResume) and destruction (onDestroy).
- โก Performance impact: The more open activities, the more RAM the system consumes.
It is important to understand that activities are not the same as processes or services. A process can contain multiple activities, and a service (such as playing music in the background) has no graphical interface at all. In MIUI, this distinction is critical because the system aggressively manages resources, closing unnecessary activities to save battery life.
Why do you need activities in Xiaomi smartphones?
The main function of activities is to provide smooth and logical navigation between the application screens. Without them, it would be impossible to implement things like:
- ๐ Return to the previous screen with the "Back" button".
- ๐ Save the state of the application when folding (for example, an open form of input into Google Docs).
- ๐ Instantly switch between tasks in the menu of recent applications.
But MIUI activities play another role, and they become targets for system optimizations, such as MIUI Optimization (which is the default feature) which can force background activity to close if it has not been used for a while, leading to:
| Advantages of optimization of activities | Cons of optimization of activities |
|---|---|
| โ Savings in battery charge | โ Applications โfly outโ from memory |
| โ Reducing the load on the processor | โ Loss of unsaved data (e.g. draft messages) |
| โ Faster operation of the system as a whole | โ Delays in returning to the annex |
Thatโs why some Xiaomi users prefer to disable aggressive optimizations or customize exceptions for individual applications.
๐ก
If the application is constantly restarted when you return to it, try adding it to battery exceptions: Settings โ Applications โ Battery Management โ Application selection โ No restrictions
How to watch active activities on Xiaomi?
Unlike the processes you see in Task Manager, the list of current activities is hidden from the average user, but there are several ways to access it:
1. via ADB (for advanced users)
Using the adb shell dumpsys activity command, you can display a complete list of running activities.
- Connect your smartphone to your PC and enable USB debugging in the developer settings.
- Enter at the terminal: adb shell dumpsys activity activities | grep "hist"
This team will show the history of recent activities, including their status (paused, stopped, resumed).
2. Through monitoring applications
Some third-party utilities, such as Simple Activity Logger or Developer Assistant, can display current activities in real time, but they require ADB or root permissions.
What is the status of โpausedโ in activity?
3. Through system logcat
If you want to track how a particular application behaves, you can use a logcat with a filter on its package:
adb logcat | grep "com.example.app"This will help identify lifecycle issues (such as why an app gets dyed when it returns to the previous screen).
Enable debugging on USB| Install ADB on PC| Download logcat application (e.g. Logcat Extreme)| Run command to monitor-->
How do activities affect Xiaomiโs performance?
The more activities you have in memory at the same time, the more resources you use, and in MIUI, this is especially noticeable because of two factors:
- Limited RAM: Even Xiaomiโs flagship models (such as the Xiaomi 14 Ultra) have tight limits on background processes, and if activities are not optimized, the system begins to โhangโ.
- Aggressive Memory Manager.MIUI closes background activities faster than stock Android, which can interfere with multitasking.
Signs that activities are overloading the system:
- ๐ข Slowing down animations when switching between applications.
- ๐ Apps are restarted instead of restarted (e.g. YouTube starts buffering again).
- ๐ Fast battery discharge due to constant reboot activities.
โ ๏ธ Note: If you notice that after the update MIUI applications have become more "fly out", check the optimization settings in Settings โ Special facilities โ Optimization MIUI. Sometimes resetting them helps to disable and re-enable this feature.
In Xiaomi models with 8GB of RAM or less, the system can force activities to close after 5-10 minutes of inactivity, even if there are exceptions in the battery settings, this is due to the operation of the MIUI kernel, which prioritizes background services (for example, Mi Cloud or Security) over user applications.
How to manage activities to optimize the smartphone?
If you are experiencing problems due to improper activities management, there are several ways to solve them:
1. disable MIUI optimization for individual applications
Go to: Settings โ Annexes โ Application management โ [Select the application] โ Battery โ No restrictions.
This will prevent the forced closure of its activities.
2.Use of the Developer Mode
Enable Do Not Limit Background Processes in Developer Settings โ About Phone โ MIUI Version โ Tap 7 times, then return to Additional โ For Developers. However, this can increase battery consumption.
3 Manual closure of unnecessary activities
With ADB, you can force the closure of a specific activity:
adb shell am kill com.package.nameReplace com.package.name with an app identifier (e.g. com.android.chrome for Google Chrome).
๐ก
Disabling MIUI optimization for critical applications (messengers, navigators) significantly improves their performance, but can reduce battery life by 10-15%.
Frequent problems with MIUI activities and their solutions
Xiaomi users often face typical activities-related problems, including the most common:
| Problem. | Reason. | Decision |
|---|---|---|
| The application restarts when it is returned to it | Activity destroyed by the system due to memory shortage | Add the app to battery exclusions or increase the limit of background processes in the developer settings |
| The app screen "blinks" when folded | Activity life cycle conflict (e.g., onPause โ onStop โ onDestroy) | Update the app or clean its cache |
| These forms are not saved when switching. | Activity does not implement the onSaveInstanceState method | Contact the app developer - it's a bug in its code |
One of the most frustrating problems is leaking activities when the application does not close them correctly, which leads to increased memory consumption. For example, in MIUI 14, some users complained that Mi Video leaves up to 5-6 unnecessary activities in memory, even after the application is closed, usually by reinstalling the program or rolling back to the previous version.
โ ๏ธ Note: If after the update MIUI If you notice that your smartphone has become more "hang" when opening applications, check the logs for errors such as ActivityManager: Timeout executing. This indicates problems with the life cycle of activities that can only be fixed by resetting settings or rolling back firmware.
Security and security: can they be replaced?
Android (and MIUI) has a mechanism for intercepting activities through Intent, which is used by legitimate applications (for example, to integrate with other services) and by malicious phishing.
For example, a fraudulent application can create an activity that mimics the Mi Account login screen and intercept the user's input to protect against this:
- ๐ Install apps only from Google Play or Mi App Store.
- ๐ก๏ธ Check the permissions of applications in Settings โ Annexes โ Permits.
- ๐ Look at this carefully. URL in the browser address bar โ fake activity often opens links with typos (for example, mi-acount.com instead of account.xiaomi.com).
MIUI 13/14 adds protection against tampering with activities through App Cloning, and if you notice an app is behaving suspiciously (e.g. asking for a password to be re-entered for no reason), check if it is a clone:
- Open the Settings โ Applications.
- Find a suspicious app and check if there is a double icon nearby.