Advertisement
Guest User

Untitled

a guest
Oct 24th, 2018
1,324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.86 KB | None | 0 0
  1. #!/system/bin/sh
  2. # NFS-INJECTOR
  3. # BY 2018 K1ks
  4. #=======================================================================#
  5. # This program is free/donate software : you can't redistribute it and/or modify
  6. # This program is distributed in the hope that it will be useful
  7. # Skynet is everywhere, on XDA, various forums and sites.
  8. # I make a point of keeping control in all the fields for Skynet .
  9. # I am not responsible for bricked devices, dead SD cards, corrupted partition, nuclear disasters
  10. # No to upload on additionals clouds.
  11. # Another thing, the ideas which are in Skynet remains mine.
  12. # NO ONE AT ALL CAN USE ANY OF MY CODES
  13. #=======================================================================#
  14.  
  15. # A/B Device =========================================#
  16.  
  17. if [ -d /system_root ]; then
  18. SYSTEM=/system_root/system
  19. SYS=system_root
  20. else
  21. SYSTEM=/system
  22. SYS=system
  23. fi;
  24.  
  25. # PATH LOG =========================================#
  26.  
  27. LOG=/data/nfs.log
  28. LOGMOUNT=/data/nfsmount.log
  29.  
  30. if [ -e $LOG ]; then
  31. rm $LOG;
  32. fi;
  33. if [ -e $LOGMOUNT ]; then
  34. rm -f $LOGMOUNT
  35. fi;
  36.  
  37. echo "//////// NFS-INJECTOR ~~" | tee -a $LOG
  38. echo "" | tee -a $LOG;
  39.  
  40. # PATH LOG =========================================#
  41.  
  42. while ! pgrep com.android ;
  43. do
  44. sleep 30
  45. done
  46.  
  47. # Mount RW =========================================#
  48.  
  49. for X in $( mount | grep $SYS | cut -d " " -f3);
  50. do
  51. mount -o noatime,remount,rw,discard,barrier=0,commit=60,noauto_da_alloc,delalloc $X 2>/dev/null
  52. done
  53.  
  54. mount >> $LOGMOUNT
  55.  
  56. # Disable Sysctl to prevent ROM interference =========================================#
  57.  
  58. if [ -e $SYSTEM/etc/sysctl.conf ]; then
  59. mv -f $SYSTEM/etc/sysctl.conf $SYSTEM/etc/sysctl.conf.bak
  60. fi;
  61.  
  62. # Init.d Permissive SELinux =========================================#
  63.  
  64. SE=$( cat /sys/fs/selinux/enforce) 2>/dev/null
  65.  
  66. if [ -e /sys/fs/selinux/enforce ]; then
  67. chmod 0666 /sys/fs/selinux/enforce
  68. setenforce 0
  69. echo "0" > /sys/fs/selinux/enforce
  70. chmod 0444 /sys/fs/selinux/enforce
  71.  
  72. if [ "$SE" -eq 1 ]; then
  73. echo "* Security Enhanced Linux : Enforcing *" | tee -a $LOG
  74. elif [ "$SE" -eq 0 ]; then
  75. echo "* Security Enhanced Linux : Permissive *" | tee -a $LOG
  76. fi;
  77. fi;
  78.  
  79. # VM Tweaks =========================================#
  80.  
  81. MEM=` free -m | awk '/Mem:/{print $2}'`
  82. mem=` free | grep Mem | awk '{print $2}'`;
  83. fs=$(($MEM/4*256))
  84. MP=$(($mem*1/16))
  85.  
  86. chmod 0644 /proc/sys/*; 2>/dev/null
  87. sysctl -e -w vm.oom_kill_allocating_task=0 2>/dev/null
  88. sysctl -e -w vm.dirty_background_ratio=1 2>/dev/null
  89. sysctl -e -w vm.dirty_ratio=99 2>/dev/null
  90. sysctl -e -w vm.vfs_cache_pressure=50 2>/dev/null
  91. sysctl -e -w vm.overcommit_memory=1 2>/dev/null
  92. sysctl -e -w vm.min_free_order_shift=4 2>/dev/null
  93. sysctl -e -w vm.laptop_mode=1 2>/dev/null
  94. sysctl -e -w vm.block_dump=0 2>/dev/null
  95. sysctl -e -w vm.oom_dump_tasks=1 2>/dev/null
  96. sysctl -e -w vm.dirty_writeback_centisecs=0 2>/dev/null
  97. sysctl -e -w vm.dirty_expire_centisecs=0 2>/dev/null
  98. sysctl -e -w fs.lease-break-time=5 2>/dev/null
  99. sysctl -e -w fs.leases-enable=1 2>/dev/null
  100. sysctl -e -w fs.inotify.max_user_instances=192 2>/dev/null
  101. sysctl -e -w fs.inotify.max_user_watches=12288 2>/dev/null
  102. sysctl -e -w fs.inotify.max_queued_events=24576 2>/dev/null
  103. sysctl -e -w fs.file-max=$fs 2>/dev/null
  104. sysctl -e -w vm.compact_memory=1 2>/dev/null
  105. sysctl -e -w vm.compact_unevictable_allowed=1 2>/dev/null
  106. sysctl -e -w vm.max_map_count=$MP
  107.  
  108. echo "* Kernel VM = Activated *" | tee -a $LOG;
  109.  
  110. # LMK PERFORMANCE =========================================#
  111.  
  112. HP=$((MEM/5));
  113. HG=$((HP/2));
  114.  
  115. setprop dalvik.vm.heapsize $HP"m"
  116. setprop dalvik.vm.heapgrowthlimit $HG"m"
  117.  
  118. if [ -e /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk ]; then
  119. chmod 0666 /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk;
  120. echo "1" > /sys/module/lowmemorykiller/parameters/enable_adaptive_lmk
  121. setprop lmk.autocalc true;
  122. fi;
  123.  
  124. FP=$((($MEM*2/100)*1024/4));
  125. VP=$((($MEM*3/100)*1024/4));
  126. SR=$((($MEM*6/100)*1024/4));
  127. HP=$((($MEM*10/100)*1024/4));
  128. CR=$((($MEM*14/100)*1024/4));
  129. EP=$((($MEM*15/100)*1024/4));
  130.  
  131. chmod 0666 /sys/module/lowmemorykiller/parameters/minfree;
  132. echo "$FP,$VP,$SR,$HP,$CR,$EP" > /sys/module/lowmemorykiller/parameters/minfree;
  133.  
  134. chmod 0666 /sys/module/lowmemorykiller/parameters/adj;
  135. echo "0,3,6,10,12,15" > /sys/module/lowmemorykiller/parameters/adj;
  136.  
  137. if [ -e /sys/module/lowmemorykiller/parameters/cost ]; then
  138. chmod 0666 /sys/module/lowmemorykiller/parameters/cost;
  139. echo "64" > /sys/module/lowmemorykiller/parameters/cost;
  140. fi;
  141.  
  142. MFK=$(($SR*4/5))
  143. MFK1=$(($MFK/2))
  144. sysctl -e -w vm.min_free_kbytes=$MFK;
  145.  
  146. if [ -e /proc/sys/vm/extra_free_kbytes ]; then
  147. sysctl -e -w vm.extra_free_kbytes=$MFK1;
  148. setprop sys.sysctl.extra_free_kbytes $MFK1;
  149. fi;
  150.  
  151. if [ -e /sys/module/lowmemorykiller/parameters/lmk_fast_run ]; then
  152. chmod 0666 /sys/module/lowmemorykiller/parameters/lmk_fast_run;
  153. echo "1" > /sys/module/lowmemorykiller/parameters/lmk_fast_run;
  154. fi;
  155.  
  156. if [ -e /sys/module/lowmemorykiller/parameters/debug_adj ]; then
  157. chmod 0666 /sys/module/lowmemorykiller/parameters/debug_adj;
  158. echo "0" > /sys/module/lowmemorykiller/parameters/debug_adj;
  159. fi;
  160.  
  161. if [ -e /sys/module/lowmemorykiller/parameters/fudgeswap ]; then
  162. chmod 0666 /sys/module/lowmemorykiller/parameters/fudgeswap
  163. echo "1024" > /sys/module/lowmemorykiller/parameters/fudgeswap
  164. fi;
  165.  
  166. if [ -e /sys/module/lowmemorykiller/parameters/debug_level ]; then
  167. chmod 0666 /sys/module/lowmemorykiller/parameters/debug_level
  168. echo "0" > /sys/module/lowmemorykiller/parameters/debug_level
  169. fi;
  170.  
  171. echo "* Lmk Performance Optimizer = Activated *" | tee -a $LOG;
  172.  
  173. # ZRAM/SWAP ADJUSTEMENTS =========================================#
  174.  
  175. zram=0
  176. zswap=0
  177.  
  178. ZR=` grep -l zram0 /proc/swaps`
  179. SW=` grep -l swap /proc/swaps`
  180. ZS=` grep -l zswap /proc/swaps`
  181.  
  182. if [ -e /proc/swaps ]; then
  183. if [ "$ZR" == "/proc/swaps" ]; then
  184. sysctl -e -w vm.swappiness=30
  185. sysctl -e -w vm.page-cluster=2
  186. echo "* Zram = Logarithmics Values Adjusted *" | tee -a $LOG
  187. zram=1
  188. elif [ "$SW" == "/proc/swaps" ]; then
  189. sysctl -e -w vm.swappiness=30
  190. sysctl -e -w vm.page-cluster=2
  191. echo "* Other Swap = Logarithmics Values Adjusted *" | tee -a $LOG
  192. elif [ "$ZS" == "/proc/swaps" ]; then
  193. sysctl -e -w vm.swappiness=30
  194. sysctl -e -w vm.page-cluster=2
  195. echo "* ZSwap Swap = Logarithmics Values Adjusted *" | tee -a $LOG
  196. zswap=1
  197. else
  198. sysctl -e -w vm.swappiness=0
  199. sysctl -e -w vm.page-cluster=0
  200. echo "* No Swap = Logarithmics Values Disabled *" | tee -a $LOG
  201. fi;
  202. else
  203. sysctl -e -w vm.swappiness=0
  204. sysctl -e -w vm.page-cluster=0
  205. echo "* No Swap = Logarithmics Values Disabled" | tee -a $LOG
  206. fi;
  207.  
  208. # Storage I/O Scheduler =========================================#
  209.  
  210. MMC=` ls -d /sys/block/mmc*`;
  211. SD=` ls -d /sys/block/sd*`;
  212. LOOP=` ls -d /sys/block/loop*`;
  213. RAM=` ls -d /sys/block/ram*`;
  214. ZRAM=` ls -d /sys/block/zram*`;
  215. NR=$(($MEM*1/2))
  216. KB=$(($MEM*2/3))
  217.  
  218. for X in $MMC $SD $LOOP $RAM $ZRAM
  219. do
  220.  
  221. echo "0" > $X/queue/rotational 2>/dev/null
  222. echo "0" > $X/queue/iostats 2>/dev/null
  223. echo "$NR" > $X/queue/nr_requests 2>/dev/null
  224. echo "0" > $X/queue/nomerges 2>/dev/null
  225. echo "2" > $X/queue/rq_affinity 2>/dev/null
  226. echo "0" > $X/queue/add_random 2>/dev/null
  227. echo "$KB" > $X/queue/read_ahead_kb 2>/dev/null
  228. echo "250" > $X/queue/iosched/read_expire 2>/dev/null
  229. echo "2500" > $X/queue/iosched/write_expire 2>/dev/null
  230. echo "3" > $X/queue/iosched/writes_starved 2>/dev/null
  231. echo "1" > $X/queue/iosched/front_merges 2>/dev/null
  232. echo "16" > $X/queue/iosched/fifo_batch 2>/dev/null
  233. echo "100" > $X/queue/iosched/hp_read_quantum 2>/dev/null
  234. echo "75" > $X/queue/iosched/rp_read_quantum 2>/dev/null
  235. echo "5" > $X/queue/iosched/hp_swrite_quantum 2>/dev/null
  236. echo "4" > $X/queue/iosched/rp_swrite_quantum 2>/dev/null
  237. echo "3" > $X/queue/iosched/rp_read_quantum 2>/dev/null
  238. echo "1" > $X/queue/iosched/lp_read_quantum 2>/dev/null
  239. echo "1" > $X/queue/iosched/lp_swrite_quantum 2>/dev/null
  240. echo "15" > $X/queue/iosched/read_idle 2>/dev/null
  241. echo "25" > $X/queue/iosched/read_idle_freq 2>/dev/null
  242. echo "1" > $X/queue/iosched/back_seek_penalty 2>/dev/null
  243. echo "16384 " > $X/queue/iosched/back_seek_max 2>/dev/null
  244. echo "120" > $X/queue/iosched/fifo_expire_sync 2>/dev/null
  245. echo "250" > $X/queue/iosched/fifo_expire_async 2>/dev/null
  246. echo "0" > $X/queue/iosched/slice_idle 2>/dev/null
  247. echo "8" > $X/queue/iosched/group_idle 2>/dev/null
  248. echo "1" > $X/queue/iosched/low_latency 2>/dev/null
  249. echo "10" > $X/queue/iosched/quantum 2>/dev/null
  250. echo "40" > $X/queue/iosched/slice_async 2>/dev/null
  251. echo "2" > $X/queue/iosched/slice_async_rq 2>/dev/null
  252. echo "100" > $X/queue/iosched/slice_sync 2>/dev/null
  253. echo "300" > $X/queue/iosched/target_latencymax_time 2>/dev/null
  254. echo "18" > $X/queue/iosched/async_scale 2>/dev/null
  255. echo "8" > $X/queue/iosched/read_scale 2>/dev/null
  256. echo "12" > $X/queue/iosched/sync_scale 2>/dev/null
  257. echo "10" > $X/queue/iosched/write_scale 2>/dev/null
  258. echo "3" > $X/queue/iosched/writes_starved 2>/dev/null
  259. echo "300" > $X/queue/iosched/sync_expire 2>/dev/null
  260. echo "3000" > $X/queue/iosched/async_expire 2>/dev/null
  261. echo "5" $X/queue/iosched/sleep_latency_multiple 2>/dev/null
  262. echo "200" $X/queue/iosched/async_read_expire 2>/dev/null
  263. echo "500" $X/queue/iosched/async_write_expire 2>/dev/null
  264. echo "100" $X/queue/iosched/sync_read_expire 2>/dev/null
  265. echo "350" $X/queue/iosched/sync_write_expire 2>/dev/null
  266.  
  267. done
  268.  
  269. if [ "` ls /sys/devices/virtual/bdi/179*/read_ahead_kb`" ]; then
  270. for RH in /sys/devices/virtual/bdi/179*/read_ahead_kb;
  271. do
  272. echo "$KB" > $RH
  273. done
  274. fi 2>/dev/null;
  275.  
  276. for I in ` find /sys/devices/platform -name iostats`;
  277. do echo "0" > $I;
  278. done
  279.  
  280. echo "* Storage I/O Scheduler = Activated *" | tee -a $LOG;
  281.  
  282. # UKSM/KSM =========================================#
  283.  
  284. if [ -e /sys/kernel/mm/uksm/run ]; then
  285. echo "1" > /sys/kernel/mm/uksm/run;
  286. setprop ro.config.ksm.support true;
  287. echo "low" > /sys/kernel/mm/uksm/cpu_governor;
  288. echo "600" > /sys/kernel/mm/uksm/sleep_millisecs;
  289. echo "* UKSM = Activated *" | tee -a $LOG;
  290. elif [ -e /sys/kernel/mm/ksm/run ]; then
  291. echo "1" > /sys/kernel/mm/ksm/run;
  292. setprop ro.config.ksm.support true;
  293. echo "128" > /sys/kernel/mm/ksm/pages_to_scan;
  294. echo "6000" > /sys/kernel/mm/ksm/sleep_millisecs;
  295. echo "1" > /sys/kernel/mm/ksm/deferred_timer;
  296. echo "* KSM = Activated *" | tee -a $LOG;
  297. fi;
  298.  
  299. # Zram / Zswap =========================================#
  300. ALG=lz4
  301. ZR=$(($MEM/4))
  302.  
  303.  
  304. if [ "$zram" -eq 1 ]; then
  305. echo "1" > /sys/block/zram0/reset;
  306. echo "$((ZR*1024*1024))" > /sys/block/zram0/disksize
  307. sysctl -e -w vm.swappiness=30
  308. sysctl -e -w vm.page-cluster=2
  309. mkswap /dev/block/zram0 > /dev/null 2>&1;
  310. swapon /dev/block/zram0 > /dev/null 2>&1;
  311. setprop ro.config.zram.support true
  312. setprop zram.disksize $ZR
  313.  
  314. if [ -e /sys/block/zram0/comp_algorithm ]; then
  315. echo "$ALG" > /sys/block/zram0/comp_algorithm
  316. fi;
  317. if [ -e /sys/block/zram0/max_comp_streams ]; then
  318. echo "4" > /sys/block/zram0/max_comp_streams
  319. fi;
  320. echo "* ZRAM = Activated for $ZR MB *" | tee -a $LOG;
  321. fi;
  322.  
  323. if [ "$zswap" -eq 1 ]; then
  324. if [ -e /sys/module/zswap/parameters/enabled ]; then
  325. echo "Y" > /sys/module/zswap/parameters/enabled
  326. fi;
  327. if [ -e /sys/module/zswap/parameters/compressor ]; then
  328. echo "$ALG" > /sys/module/zswap/parameters/compressor
  329. fi;
  330. if [ -e /sys/module/zswap/parameters/max_pool_percent ]; then
  331. echo "30" > /sys/module/zswap/parameters/max_pool_percent
  332. fi;
  333. if [ -e /sys/module/zswap/parameters/zpool ]; then
  334. echo "z3fold" > /sys/module/zswap/parameters/zpool
  335. fi;
  336. sysctl -e -w vm.swappiness=30
  337. sysctl -e -w vm.page-cluster=2
  338. echo "* ZSwap = Activated *" | tee -a $LOG;
  339. fi;
  340.  
  341. # Doze Settings Custom =========================================#
  342.  
  343. SDK=$(getprop ro.build.version.sdk);
  344.  
  345. if [ "$SDK" -ge "23" ]; then
  346. settings put global device_idle_constants light_after_inactive_to=30000 2>/dev/null
  347. settings put global device_idle_constants light_pre_idle_to=30000 2>/dev/null
  348. settings put global device_idle_constants light_idle_to=30000 2>/dev/null
  349. settings put global device_idle_constants light_idle_factor=2.0 2>/dev/null
  350. settings put global device_idle_constants light_max_idle_to=60000 2>/dev/null
  351. settings put global device_idle_constants light_idle_maintenance_min_budget=30000 2>/dev/null
  352. settings put global device_idle_constants light_idle_maintenance_max_budget=60000 2>/dev/null
  353. settings put global device_idle_constants min_light_maintenance_time=5000 2>/dev/null
  354. settings put global device_idle_constants min_deep_maintenance_time=10000 2>/dev/null
  355. settings put global device_idle_constants inactive_to=60000 2>/dev/null
  356. settings put global device_idle_constants sensing_to=0 2>/dev/null
  357. settings put global device_idle_constants locating_to=0 2>/dev/null
  358. settings put global device_idle_constants location_accuracy=20.0 2>/dev/null
  359. settings put global device_idle_constants motion_inactive_to=5000 2>/dev/null
  360. settings put global device_idle_constants idle_after_inactive_to=0 2>/dev/null
  361. settings put global device_idle_constants idle_pending_to=30000 2>/dev/null
  362. settings put global device_idle_constants max_idle_pending_to=60000 2>/dev/null
  363. settings put global device_idle_constants idle_pending_factor=2.0 2>/dev/null
  364. settings put global device_idle_constants idle_to=3600000 2>/dev/null
  365. settings put global device_idle_constants max_idle_to=21600000 2>/dev/null
  366. settings put global device_idle_constants idle_factor=2.0 2>/dev/null
  367. settings put global device_idle_constants min_time_to_alarm=3600000 2>/dev/null
  368. settings put global device_idle_constants max_temp_app_whitelist_duration=20000 2>/dev/null
  369. settings put global device_idle_constants mms_temp_app_whitelist_duration=20000 2>/dev/null
  370. settings put global device_idle_constants sms_temp_app_whitelist_duration=20000 2>/dev/null
  371. settings put global device_idle_constants notification_whitelist_duration=20000 2>/dev/null
  372. echo "* Doze Settings Custom = Activated *" | tee -a $LOG
  373. fi;
  374.  
  375. # FIX GOOGLE PLAY SERVICE =========================================#
  376.  
  377. for apk in $(pm list packages -3 | sed 's/package://g' | sort); do
  378. # Analytics
  379. pm disable $apk/com.google.android.gms.analytics.AnalyticsService
  380. pm disable $apk/com.google.android.gms.analytics.AnalyticsJobService
  381. pm disable $apk/com.google.android.gms.analytics.CampaignTrackingService
  382. pm disable $apk/com.google.android.gms.measurement.AppMeasurementService
  383. pm disable $apk/com.google.android.gms.measurement.AppMeasurementJobService
  384. pm disable $apk/com.google.android.gms.analytics.AnalyticsReceiver
  385. pm disable $apk/com.google.android.gms.analytics.CampaignTrackingReceiver
  386. pm disable $apk/com.google.android.gms.measurement.AppMeasurementInstallReferrerReceiver
  387. pm disable $apk/com.google.android.gms.measurement.AppMeasurementReceiver
  388. pm disable $apk/com.google.android.gms.measurement.AppMeasurementContentProvider
  389. pm disable $apk/com.crashlytics.android.CrashlyticsInitProvider
  390. # Ads
  391. pm disable $apk/com.google.android.gms.ads.AdActivity
  392. # Firebase
  393. pm disable $apk/com.google.firebase.iid.FirebaseInstanceIdService
  394. done
  395.  
  396. echo "* Fix GP Services Extented = Activated *" | tee -a $LOG;
  397.  
  398. # Network Speed and Throughput =========================================#
  399.  
  400. sysctl -e -w net.ipv4.tcp_timestamps=1
  401. sysctl -e -w net.ipv4.tcp_fin_timeout=45
  402. sysctl -e -w net.ipv4.tcp_challenge_ack_limit=999
  403. sysctl -e -w net.ipv4.conf.all.rp_filter=2
  404. sysctl -e -w net.ipv4.conf.default.rp_filter=2
  405. sysctl -e -w net.ipv4.tcp_no_metrics_save=1
  406. sysctl -e -w net.ipv4.tcp_synack_retries=3
  407. sysctl -e -w net.ipv4.tcp_keepalive_intvl=45
  408. sysctl -e -w net.ipv4.tcp_keepalive_probes=9
  409. sysctl -e -w net.ipv4.tcp_window_scaling=1
  410. sysctl -e -w net.ipv4.tcp_sack=1
  411. sysctl -e -w net.ipv4.tcp_fack=1
  412. sysctl -e -w net.ipv4.tcp_moderate_rcvbuf=1
  413.  
  414. for len in /sys/class/net/*;
  415. do echo "100" > $len/tx_queue_len;
  416. done;
  417.  
  418. tcp=/proc/sys/net/ipv4/tcp_available_congestion_control
  419.  
  420. if grep -l 'westwood' $tcp; then
  421. echo "westwood" > /proc/sys/net/ipv4/tcp_congestion_control
  422. STAT=Westwood
  423. else
  424. echo "reno" > /proc/sys/net/ipv4/tcp_congestion_control
  425. STAT=Reno
  426. fi;
  427.  
  428. settings put global wifi_idle_ms 300000;
  429. settings put secure wifi_idle_ms 300000;
  430. settings put secure wifi_watchdog_poor_network_test_enabled 0
  431. settings put global tether_dun_required 0
  432.  
  433. echo "* Network Speed $STAT = Activated *" | tee -a $LOG
  434.  
  435. # Entropy/Random Daemon =========================================#
  436.  
  437. RNGD=$SYSTEM/bin/rngd
  438.  
  439. if [ "` pgrep hwrng`" ]; then
  440.  
  441. sysctl -e -w kernel.random.read_wakeup_threshold=512 2>/dev/null
  442. sysctl -e -w kernel.random.write_wakeup_threshold=1024 2>/dev/null
  443. sysctl -e -w kernel.random.urandom_min_reseed_secs=60 2>/dev/null
  444. echo "* Auto Random = Generated (hwrng) *" | tee -a $LOG;
  445.  
  446. elif [ "` pgrep qrngd`" ]; then
  447.  
  448. sysctl -e -w kernel.random.read_wakeup_threshold=512 2>/dev/null
  449. sysctl -e -w kernel.random.write_wakeup_threshold=1024 2>/dev/null
  450. sysctl -e -w kernel.random.urandom_min_reseed_secs=60 2>/dev/null
  451. echo "* Auto Random = Generated (rng) *" | tee -a $LOG
  452.  
  453. else
  454.  
  455. sysctl -e -w kernel.random.read_wakeup_threshold=512 2>/dev/null
  456. sysctl -e -w kernel.random.write_wakeup_threshold=1024 2>/dev/null
  457. sysctl -e -w kernel.random.urandom_min_reseed_secs=60 2>/dev/null
  458. $RNGD -t 1 -T 1 -s 512 --fill-watermark=100%
  459.  
  460. sleep 2
  461.  
  462. PID=$( pgrep rngd)
  463. echo "-8" > /proc/$PID/oom_adj
  464. renice 5 $PID
  465. echo "* Auto Entropy = Generated *" | tee -a $LOG;
  466. fi;
  467.  
  468. # DEEP SLEEP ENHANCEMENT =========================================#
  469.  
  470. for i in ` ls /sys/class/scsi_disk/`; do
  471. cat /sys/class/scsi_disk/$i/write_protect 2>/dev/null | grep 1 >/dev/null
  472. if [ $? -eq 0 ]; then
  473. echo "temporary none" > /sys/class/scsi_disk/$i/cache_type
  474. fi;
  475. done
  476.  
  477. # SLEEPING BT =========================================#
  478.  
  479. for P in ` find find /sys/ -name pwrnap`;
  480. do echo "0" > $P;
  481. done
  482.  
  483. # DEBUGGING / LOGGERS =========================================#
  484.  
  485. for i in $( find /sys/ -name debug_mask); do
  486. echo "0" > $i;
  487. done;
  488.  
  489. if [ -e /sys/module/logger/parameters/log_mode ]; then
  490. echo "2" > /sys/module/logger/parameters/log_mode
  491. echo "* Disabling Loggers = Activated *" | tee -a $LOG;
  492. fi;
  493.  
  494. echo "* Misc = Activated *" | tee -a $LOG
  495.  
  496. # Launcher / SystemUi Keeper/ =========================================#
  497. # LMK List Commom Launchers for Priority
  498.  
  499. list="com.google.android.launcher org.lineageos.trebuchet com.google.android.apps.plus com.deletescape.launchair com.android.launcher3 com.actionlauncher.playstore com.yandex.launcher com.google.android.apps.nexuslauncher com.miui9launcher.miuithemes com.huawei.android.launcher com.miui.home com.cma.launcher.lite com.jiubang.go.mini.launcher com.kkmlauncher-1 com.uprui.launcher.marshmallow com.android.launcher org.adw.launcher org.adwfreak.launcher net.alamoapps.launcher com.anddoes.launcher com.android.lmt com.chrislacy.actionlauncher.pro com.cyanogenmod.trebuchet com.gau.go.launcherex com.gtp.nextlauncher com.miui.mihome2 com.mobint.hololauncher com.mobint.hololauncher.hd com.qihoo360.launcher com.teslacoilsw.launcher com.tsf.shell org.zeam com.sonyericsson.home com.xperiaZ5.home com.sonymobile.simplehome com.teslacoilsw.launcher.prime com.miui.home com.anddoes.launcher.pro-1 com.anddoes.launcher-2 com.actionlauncher.playstore com.lge.launcher2 com.sec.android.app.launcher com.sec.android.app.twlauncher com.gtp.nextlauncher com.cyanogenport.trebuchet";
  500.  
  501. while sleep 60; do
  502. for class in $list; do
  503. if [ `pgrep $class | head -n 1` ]; then
  504. launcher=`pgrep $class`;
  505. echo -17 > /proc/$launcher/oom_adj;
  506. chmod 100 /proc/$launcher/oom_adj;
  507. renice -18 $launcher;
  508. fi;
  509. done;
  510. exit;
  511. done&
  512.  
  513. while sleep 3; do
  514. if [ `$bb pidof com.android.systemui` ]; then
  515. systemui=`pidof com.android.systemui`;
  516. renice -18 $systemui;
  517. echo -17 > /proc/$systemui/oom_adj;
  518. chmod 100 /proc/$systemui/oom_adj;
  519. exit;
  520. fi;
  521. done&
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement