2017-10-19 19:19:26 -04:00
#!/bin/bash
2020-11-17 10:11:40 -05:00
#DivestOS: A privacy focused mobile distribution
2022-05-01 01:13:46 -04:00
#Copyright (c) 2017-2021 Divested Computing Group
2017-11-05 10:58:01 -05:00
#
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <https://www.gnu.org/licenses/>.
2021-10-16 19:15:19 -04:00
umask 0022;
2021-10-16 15:28:15 -04:00
set -euo pipefail;
2021-10-16 19:15:19 -04:00
source " $DOS_SCRIPTS_COMMON /Shell.sh " ;
2017-10-19 19:19:26 -04:00
#Attempts to increase performance and battery life
2021-10-16 16:28:41 -04:00
#Last verified: 2021-10-16
2017-10-19 19:19:26 -04:00
2018-04-23 08:59:18 -04:00
echo "Optimizing..." ;
2017-10-19 19:19:26 -04:00
2021-07-08 20:41:33 -04:00
if enter "frameworks/base" ; then
2019-03-17 17:27:51 -04:00
sed -i 's/ScaleSetting = 1.0f;/ScaleSetting = 0.5f;/' services/java/com/android/server/wm/WindowManagerService.java & >/dev/null || true;
sed -i 's/AnimationScale = 1.0f;/AnimationScale = 0.5f;/' services/java/com/android/server/wm/WindowManagerService.java & >/dev/null || true;
sed -i 's/DurationnScale = 1.0f;/DurationScale = 0.5f;/' services/java/com/android/server/wm/WindowManagerService.java & >/dev/null || true;
sed -i 's/ScaleSetting = 1.0f;/ScaleSetting = 0.5f;/' services/core/java/com/android/server/wm/WindowManagerService.java & >/dev/null || true;
sed -i 's/AnimationScale = 1.0f;/AnimationScale = 0.5f;/' services/core/java/com/android/server/wm/WindowManagerService.java & >/dev/null || true;
sed -i 's/DurationnScale = 1.0f;/DurationScale = 0.5f;/' services/core/java/com/android/server/wm/WindowManagerService.java & >/dev/null || true;
2017-11-07 04:35:41 -05:00
#sed -i 's|||'
2021-07-08 20:41:33 -04:00
fi ;
2017-10-19 19:19:26 -04:00
2021-07-08 20:41:33 -04:00
if enter "kernel" ; then
2018-06-23 00:21:48 -04:00
sed -i "s/#define VM_MAX_READAHEAD\t128/#define VM_MAX_READAHEAD\t512/" ./*/*/include/linux/mm.h; #Lee Susman <lsusman@codeaurora.org>: Change the VM_MAX_READAHEAD value from the default 128KB to 512KB. This will allow the readahead window to grow to a maximum size of 512KB, which greatly benefits to sequential read throughput.
2021-07-08 20:41:33 -04:00
fi ;
2018-05-20 23:28:01 -04:00
2018-06-29 00:55:21 -04:00
cd " $DOS_BUILD_BASE " ;
2021-10-16 15:28:15 -04:00
echo -e "\e[0;32m[SCRIPT COMPLETE] Optimizing complete\e[0m" ;