Disable Phantom Process Killer in android 12 & 13 and fix termux errors. We know that android 12 brings a revamped UI, privacy and security improvements, and a host of changes. While, Most of these changes are welcome, android 12+ also introduces some controversial changes to the background processes called Phantom Process killer. It has created havoc on apps like Termux. Google has submitted a patch that adds a toggle in developer options to disable the monitoring of phantom processes in android 13. It seems like many smartphone vendors aren’t updated the developer’s options by including this option.
Today, I am going to show how to disable the Phantom Process Killer in android 12 or 13 and fix termux errors. So let’s get started.
What the heck is a phantom process killer ?
It’s a background process limiter that kills the app processes using excessive CPU or system resources. Let’s say the parent app started spawning a child processes of more than 32, if they are found to be using an excessive CPU, the phantom process killer kicks in and kills the entire app Hierarchy. This happens without the consent of the user and the app gets killed automatically and creating a problem for the end-user experience.
TERMUX is a well-known app suffering from this background limitation. I was trying to run a Linux operating system using a TERMUX. After starting the VNC server within a few minutes, the TERMUX and its deployed processes got killed automatically.
You may see error message in the terminal without actually exiting the shell process yourself. This is kinda annoying and it prevents you from running Linux operating system on a non-rooted android device.
Anyway, to fix this issue, On your android device head over to the about page and tap on the build number 7 times to activate the developer options. Then enable android debugging from developer settings. Now, connect your android device to the computer. In my case, I am connecting to a windows 11 computer. If you see any popup on your device, go ahead and allow the permission.
Note: You need Adb & Fastboot Commands installed on your windows computer.
Now open a command prompt, and type ADB devices. You will see the device identifier. This means the computer can interact with Android devices using the ADB shell.
Now go ahead and execute the below commands, one after the other.
adb shell "/system/bin/device_config set_sync_disabled_for_tests persistent"
adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647"
adb shell settings put global settings_enable_monitor_phantom_procs false
These commands will disable the phantom process killer. To verify you need to run these two commands one by one.
adb shell "/system/bin/dumpsys activity settings | grep max_phantom_processes"
adb shell "/system/bin/device_config get activity_manager max_phantom_processes"
Make sure after running these two commands the return value should look the same as mine.
That means the phantom process killer is successfully disabled.