Termux在后台运行
再来,按照系统版本输入命令,不需要root权限:
# Android 12L和Android 13
./adb shell "settings put global settings_enable_monitor_phantom_procs false"
# Android 12,无GMS
./adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647"
# Android 12,有GMS
./adb shell "/system/bin/device_config set_sync_disabled_for_tests persistent; /system/bin/device_config put activity_manager max_phantom_processes 2147483647"
重开机,Termux在后台运行时应该就不会被杀了。