Why Android Kills Background Apps (and How to Stop It): OEM RAM Management, Phantom Process Killer & Battery Whitelisting Explained (2026)

Verdict: When an Android phone terminates your music player, drops a continuous VPN tunnel, or delays push notifications from messaging apps, the culprit is almost never insufficient physical RAM. Instead, it is driven by aggressive proprietary OEM battery-saver daemons (such as Samsung’s Device Care “Deep Sleep”, Xiaomi’s MIUI/HyperOS Memory Cleaner, and OnePlus’s Quick Launch freeze) overriding the standard Linux Low Memory Killer Daemon (LMKD) and Android’s Phantom Process Killer (which enforces a strict limit of 32 child processes per UID). You can prevent apps from being terminated by locking them in the Recent Apps carousel, setting App Battery Usage to “Unrestricted”, disabling OEM memory auto-clear schedules, and using ADB to disable the Phantom Process Killer.

One of the enduring ironies of modern Android flagship hardware is that you can purchase a device with 12GB, 16GB, or even 24GB of physical RAM, only to have the operating system violently kill a pedometer, torrent client, podcast player, or messenger five minutes after locking your screen.

For app developers and power users, aggressive background app killing has long been cataloged as a critical usability barrier. While recalibrating your phone’s battery management system can resolve inaccurate gauge readings, OEM smartphone manufacturers compete aggressively in battery endurance test rankings; to post extra hours of screen-on time in benchmark reviews, they implement proprietary background task killers that disregard Android’s standard background execution guidelines.

Here is an engineering overview of how Android manages application lifecycles, how OEM task killers intervene, and the step-by-step methods to whitelist mission-critical apps permanently.


The Android Background Process Hierarchy

To understand why an app gets terminated, you must first understand how the core Android framework categorizes processes. The operating system assigns every running task an oom_adj_score (Out of Memory Adjustment Score) ranging from -1000 (critical system process) to 1000 (cached, expendable background app). When free memory runs low, the Linux Low Memory Killer Daemon (LMKD) scans the process list and kills higher-scoring tasks first.

Process Priority Tieroom_adj_score RangeTypical ExamplesLMKD Kill Vulnerability
Foreground Process0The active app currently visible on screen; interactive UINever killed unless extreme kernel out-of-memory crash
Visible / Perceptible Process100 to 200Picture-in-picture video; overlay widgets; accessibility servicesProtected; killed only under critical memory pressure
Service Process (Foreground Service)200 to 400Spotify / YouTube Music with notification; active GPS navigation; VPNProtected in stock Android, but heavily targeted by OEM battery daemons
Cached / Background Process700 to 900Apps minimized when pressing Home; paused games in memoryStandard reclamation target; safely terminated to free buffer cache
Empty / Orphaned Process900 to 1000Defunct app processes retained only to speed up cold re-launchTerminated immediately when any active task requests memory allocation

The Real Culprit: Proprietary OEM Battery Daemons

In standard AOSP (Android Open Source Project) running on Google Pixel devices, a process running a legitimate Foreground Service—accompanied by an active persistent notification in the status bar—is virtually immune to termination unless memory reaches catastrophic exhaustion.

However, major smartphone vendors layer custom background-killing services over the Linux kernel:

  • Samsung One UI: Employs Device Care (App Power Management). It divides apps into “Sleeping apps” and “Deep sleeping apps”. If an app runs a background service for several consecutive minutes without screen interaction, One UI places it in deep sleep, halting its alarms, wakelocks, and sync jobs completely.
  • Xiaomi HyperOS / MIUI: Integrates a proprietary daemon called MIUI Battery Saver. By default, it restricts background activity for every newly installed third-party app after 10 minutes of screen-off time, ignoring standard foreground notification flags.
  • OnePlus / OPPO / Realme (ColorOS / OxygenOS): Features aggressive RAM optimization that caps background processes, kills wake locks, and restricts “Auto-Launch” permissions, preventing messaging apps from starting after a device reboot.

What Is the “Phantom Process Killer” in Android?

Introduced in Android 12 and maintained across Android 13, 14, 15, 16, and 17, the Phantom Process Killer is an internal Android framework component designed to stop rogue background apps from spawning heavy CPU-draining sub-processes.

Here is how it works: whenever an app runs, it is allowed to fork child processes (for example, a terminal emulator, a game compiler, or a background torrent client spawning networking threads). The Phantom Process Killer enforces a hard ceiling: maximum 32 child processes across all background apps combined, and caps the cumulative CPU usage of those child processes. If a background app exceeds this threshold, the kernel immediately issues a SIGKILL signal, crashing the background service without notifying the user.


Step-by-Step: How to Stop Android from Killing Your Apps

Step 1: Set App Battery Usage to “Unrestricted”

This is the fundamental operating system toggle that exempts an app from Android’s unified battery optimization framework (Doze mode):

  1. Go to Settings > Apps > See all apps.
  2. Select your target application (e.g., your music app, VPN, smart watch companion, or automation utility).
  3. Tap App battery usage (or Battery).
  4. Change the selection from Optimized to Unrestricted.

Step 2: Lock the App in the Recent Apps Carousel

Locking an app marks its PID (Process ID) with a persistent keep-alive flag, preventing OEM task killers from wiping it when you tap “Clear All” in the multitasking switcher:

  1. Swipe up from the bottom of your screen to open the Recent Apps / Multitasking view.
  2. Locate the card of the application you want to preserve.
  3. Tap the App icon above the preview card (or long-press the card).
  4. Tap Lock this app (or Keep open). A small padlock icon will appear on the card.

Step 3: Remove from Samsung “Deep Sleeping Apps” (One UI)

  1. Open Settings > Battery (or Device care > Battery).
  2. Tap Background usage limits.
  3. Ensure Put unused apps to sleep is either disabled or check both Sleeping apps and Deep sleeping apps lists.
  4. If your app appears in either list, tap the trash/remove icon and delete it.
  5. Tap Never auto-sleeping apps, tap the + icon, and add your mission-critical app to this permanent exclusion whitelist.

Step 4: Disable MIUI / HyperOS Battery Saver (Xiaomi, Poco, Redmi)

  1. Open Settings > Apps > Manage apps.
  2. Select your app > enable Autostart (allow background autostart).
  3. Scroll down to Battery saver and change the setting from MIUI Battery Saver (recommended) to No restrictions.
  4. Under Settings > Battery > Gear icon, verify that Clear cache when device is locked is set to Never.

Step 5: Disable the Phantom Process Killer via ADB (Power Users)

If you run advanced local utilities (such as Termux, local Python servers, Syncthing, or heavy torrent downloaders), Android’s 32-process limit will still kill your tasks regardless of UI battery settings. You can permanently disable the Phantom Process Killer using Android Debug Bridge (ADB):

  1. Enable Developer options and toggle on USB debugging on your smartphone.
  2. Connect your phone to a PC/Mac with ADB installed.
  3. Open your terminal and run the following command to verify connection:
    adb devices
  4. Execute the following command to disable the Phantom Process Killer:
    adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647"
  5. To prevent DeviceConfig from resetting this value on reboot in Android 13/14/15/16/17, run:
    adb shell "/system/bin/device_config set_sync_disabled_for_tests persistent"

Summary Checklist: Keeping Apps Alive

To guarantee that a background service never gets terminated unexpectedly, follow this three-layer rule:

  • Layer 1 (OS Permission): Set Battery Usage to Unrestricted in App Info.
  • Layer 2 (OEM Daemon): Add to Never Auto-Sleeping (Samsung) or enable Autostart + No Restrictions (Xiaomi/OnePlus).
  • Layer 3 (Multitasking Engine): Keep the app locked in the Recent Apps switcher with the padlock icon.

Applying these adjustments ensures continuous background audio playback, immediate message receipt, reliable fitness syncing, and uninterrupted VPN protection.

More from author

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related posts

Advertisment

Latest posts

LPDDR5X vs LPDDR5T vs LPDDR5 Smartphone RAM: 6400 vs 8533 vs 9600 Mbps, On-Device AI Bandwidth & Battery Efficiency Compared (2026)

Verdict: For modern smartphones, the choice between LPDDR5, LPDDR5X, and LPDDR5T memory is the single most critical hardware bottleneck for on-device generative AI and...

Phone Wi-Fi Keeps Disconnecting and Reconnecting Every Few Minutes? 7 Real DHCP Lease, MAC Randomization & Wi-Fi Roaming Fixes (2026)

Verdict: When a smartphone repeatedly drops its Wi-Fi connection and reconnects every two to five minutes, the fault is rarely a failing wireless antenna....

How to Calibrate Phone Battery on Android & iPhone: BMS Coulomb Counter Reset vs Voltage Re-Sync Explained (2026)

Verdict: Calibrating a modern smartphone battery does not revive lost chemical capacity; instead, it recalibrates the Battery Management System (BMS) fuel-gauge microchip and Coulomb...