forked from topjohnwu/magisk-module-installer
-
Notifications
You must be signed in to change notification settings - Fork 10
/
service.sh
32 lines (30 loc) · 1.96 KB
/
service.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/system/bin/sh
# Virtual memory tweaks - not really needed anymore
# stop perfd
# echo '100' > /proc/sys/vm/swappiness
# echo '0' > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
# echo '100' > /proc/sys/vm/vfs_cache_pressure
# echo '128' > /sys/block/mmcblk0/queue/read_ahead_kb
# echo '128' > /sys/block/mmcblk1/queue/read_ahead_kb
# echo '8000' > /proc/sys/vm/min_free_kbytes
# echo '0' > /proc/sys/vm/oom_kill_allocating_task
# echo '5' > /proc/sys/vm/dirty_ratio
# echo '20' > /proc/sys/vm/dirty_background_ratio
# chmod 666 /sys/module/lowmemorykiller/parameters/minfree
# chown root /sys/module/lowmemorykiller/parameters/minfree
# echo '21816,29088,36360,43632,50904,65448' > /sys/module/lowmemorykiller/parameters/minfree
# rm /data/system/perfd/default_values
# start perfd
# sleep 20
# Set Activity Manager's max. cached app number -> 160 (instead of the default 32 (or even lower 24):
# Disable MIUI's periodic cleaner service (PeriodicCleaner - check your logcat..)
# Obviously will throw an error if periodic service doesn't exist
# but at the moment I'm a bit lazy to implement proper SDK testing and exception handling..
# In case it throws an error - it just doesn't exist / won't work. Sorry -.-'
sleep 180
[ $(getprop ro.build.version.release) -gt 9 ] && cmd device_config set_sync_disabled_for_tests persistent
[ $(getprop ro.build.version.release) -gt 9 ] && cmd device_config put activity_manager max_cached_processes 256 || settings put global activity_manager_constants max_cached_processes=256
[ $(getprop ro.build.version.release) -gt 9 ] && cmd device_config put activity_manager max_phantom_processes 2147483647
[ $(getprop ro.build.version.release) -gt 9 ] && cmd settings put global settings_enable_monitor_phantom_procs false
[ $(getprop ro.build.version.release) -gt 9 ] && cmd device_config put activity_manager max_empty_time_millis 43200000
[ $(getprop ro.build.version.release) -gt 9 ] && cmd settings put global settings_enable_monitor_phantom_procs false