[MOD][TWRP] LOS16 Tweak script - Please share yours also![9.0][3/3T][24/07/19] - OnePlus 3 & 3T Cross Device Themes, Apps & Mods

The last months I am using LOS16 (Pie) on my OP3T and have implemented some tweaks to let it work as I want it to be.
The tweaks I am doing are implemented after a dirty flash, which I am doing roughly once a month.
After the dirty flash I am using the script enclosed to remove some apps, to clear as much as possible and startup almost clean without loosing settings.
Ofcourse also some other stuff like build.prop and userinit.sh settings are implemented.
Note:
Some people say it is not wise to clean all stuff like I do in the script, because a lot of writing is done afterwards, like building caches etc....
But, in my experience, the OP3(t) is a real killer and the cache building does not bother me.
Even after 3 years of heavy usage, everything is like new and performance is great.
So may be the result is a little more wearage of SSD, but I like a clean system and do not expect any troubles when only doing this once a month.
I want to share the script because it can help others, but I am sure there other OP3(t) users are also using scripts to optimise some settings, remove apps etc.... which can help me also.
So please, feel free to add your script(s) also and make this a place where OP3(t) users can find information to make their own script.
When you have some questions, please let me know!
BTW:
Never use a script like this when you do not know what it is doing, and ofcourse using it at your own risk!!
First read every line of it, try to understand what it is doing and what you are missing afterwards when implementing without any change (apps, launcher etc...)
Code:
#!/sbin/sh
#
# Script by 2Tweak
# Last modified 25-07-2019
################################################
# First setup
clear
sleep 0.3
echo
echo "##########################################"
echo "# ROM DEBLOAT SCRIPT #"
echo "##########################################"
echo
mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system
sleep 0.3
################################################
echo -n "Shrinking ROM to the bare minimum..."
# app list to remove
applist="
AntHalService
AudioFX
BackupRestoreConfirmation
BasicDreams
BluetoothMidiService
BookmarkProvider
BuiltInPrintService
Calendar
CaptivePortalLogin
CNEService
CallLogBackup
CellBroadcastReceiver
CompanionDeviceManager
Contacts
CtsShimPrebuilt
CtsShimPrivPrebuilt
DocumentsUI
EasterEgg
Eleven
Email
ExactCalculator
Exchange2
Gallery2
HTMLViewer
InputDevices
Jelly
LatinIME
LineageSetupWizard
LiveWallpapersPicker
LockClock
ManagedProvisioning
OneTimeInitializer
OneplusDoze
OneplusPocketMode
PhotoTable
PrintRecommendationService
SharedStorageBackup
SimAppDialog
Stk
Tag
Terminal
Traceur
TrebuchetQuickStep
Updater
UserDictionaryProvider
VpnDialogs
WallpaperBackup
WeatherProvider
WfdService
"
for appname in $applist
do
if [ -e /system/app/$appname ]; then
chmod -R 777 /system/app/$appname
rm -rf /system/app/$appname
fi
if [ -e /system/priv-app/$appname ]; then
chmod -R 777 /system/priv-app/$appname
rm -rf /system/priv-app/$appname
fi
done
echo " done!"
sleep 0.3
################################################
echo -n "Removing junk files................."
# file list to cleanup
filelist="
/cache
/data/anr
/data/backup
/data/cache
/data/dalvik-cache
/data/lineageos_updates
/data/local/tmp
/data/lost+found
/data/ota
/data/ota_package
/data/resource-cache
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/package_cache
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/system/usagestats/daily
/data/tombstones
/sdcard/DCIM/.thumbnails
/system/bin/bootanimation
/system/media/bootanimation.zip
"
for filename in $filelist
do
if [ -d $filename ]; then
chmod -R 777 $filename
rm -rf $filename/*
fi
if [ -f $filename ]; then
chmod 777 $filename
rm -f $filename
fi
done
# Remove bak, log and tmp files
find /data -iname "*.bak" -type f -exec rm -f {} +
find /data -iname "*.log" -type f -exec rm -f {} +
find /data -iname "*.tmp" -type f -exec rm -f {} +
find /data -iname "*.odex" -type f -exec rm -f {} +
find /data -iname "*.vdex" -type f -exec rm -f {} +
find /system -iname "*.bak" -type f -exec rm -f {} +
find /system -iname "*.log" -type f -exec rm -f {} +
find /system -iname "*.tmp" -type f -exec rm -f {} +
# Some other useless system related files
rm -f /data/stock_boot_*.img.gz
# Reduce fonts to the bare minimum
find /system/fonts ! -iname "*roboto*.*" ! -name "DroidSansMono.ttf" -type f -exec rm -f {} +
# Some resets after firmware upgrades
# Reset NFC
rm -f /data/nfc/nfaStorage.bin1
# Remove passwords
rm -f /data/system/locksettings.db
rm -f /data/system/locksettings.db-shm
rm -f /data/system/locksettings.db-wal
rm -f /data/system/gatekeeper.password.key
rm -f /data/system/gatekeeper.pattern.key
# Reset fingerprint
rm -f /data/system/users/0/fpdata/user.db
rm -f /data/system/users/0/settings_fingerprint.xml
echo " done!"
sleep 0.3
################################################
echo -n "Cleaning app data..................."
for i in $(ls /data/data/)
do
if [ -e /data/data/$i/cache ]; then
chmod -R 777 /data/data/$i/cache
rm -rf /data/data/$i/cache/*
fi
if [ -e /data/data/$i/code_cache ]; then
chmod -R 777 /data/data/$i/code_cache
rm -rf /data/data/$i/code_cache/*
fi
if [ -e /data/data/$i/files/.Fabric ]; then
chmod -R 777 /data/data/$i/files/.Fabric
rm -rf /data/data/$i/files/.Fabric/*
fi
if [ -e /data/data/$i/files/cache ]; then
chmod -R 777 /data/data/$i/files/cache
rm -rf /data/data/$i/files/cache/*
fi
if [ -e /data/data/$i/app_webview ]; then
chmod -R 777 /data/data/$i/app_webview
# keep cookies for webapp logins
if [ -e /data/data/$i/app_webview/Cookies ]; then
mv -f /data/data/$i/app_webview/Cookies /data/local/tmp/$i.Cookies
fi
rm -rf /data/data/$i/app_webview/*
if [ -e /data/local/tmp/$i.Cookies ]; then
mv -f /data/local/tmp/$i.Cookies /data/data/$i/app_webview/Cookies
fi
fi
done
for j in $(ls /data/app/)
do
if [ -e /data/app/$j/oat/arm ]; then
chmod -R 777 /data/app/$j/oat/arm
rm -rf /data/app/$j/oat/arm/*
fi
if [ -e /data/app/$j/oat/arm64 ]; then
chmod -R 777 /data/app/$j/oat/arm64
rm -rf /data/app/$j/oat/arm64/*
fi
done
for k in $(ls /sdcard/Android/data/)
do
if [ -e /sdcard/Android/data/$k/cache ]; then
chmod -R 777 /sdcard/Android/data/$k/cache
rm -rf /sdcard/Android/data/$k/cache/*
fi
done
# App specific
rm -rf /data/data/com.abnamro.nl.mobile.payments/app_dex/oat/arm64/*
rm -rf /data/data/org.fdroid.fdroid/files/*.apk
rm -rf /data/data/org.videolan.vlc/app_vlc/*
# Remove empty directories
find /data/data -type d -depth -exec rmdir {} + 2>/dev/null
find /sdcard -type d -depth -exec rmdir {} + 2>/dev/null
echo " done!"
sleep 0.3
################################################
echo -n "Optimizing app databases............"
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /sdcard -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
echo " done!"
sleep 0.3
################################################
echo -n "Setting log permissions read-only..."
chmod 000 /data/system/dropbox
chmod 000 /data/system/procstats
chmod 000 /data/system/usagestats/0/daily
chmod 000 /data/system/usagestats/0/monthly
chmod 000 /data/system/usagestats/0/weekly
chmod 000 /data/system/usagestats/0/yearly
echo " done!"
sleep 0.3
################################################
echo -n "Repair Phone Is Starting error......"
rm -f '/system/vendor/bin/hw/[email protected]'
rm -f '/system/vendor/etc/init/[email protected]'
fname="/system/vendor/etc/vintf/manifest.xml"
found=0
startstop=0
tstr=""
nstr=""
IFS=$'\n'
while read line
do
if [[ "$line" == *'<hal'* ]]; then
startstop=1
elif [[ "$line" == *'</hal'* ]]; then
startstop=2
elif [[ "$line" == *'livedisplay'* ]]; then
found=1
fi
if [ $startstop -eq 1 ]; then
tstr="${tstr}\n${line}"
elif [ $startstop -eq 2 ]; then
tstr="${tstr}\n${line}"
if [ $found -eq 0 ]; then
nstr="${nstr}${tstr}"
else
found=0
fi
tstr=""
startstop=0
else
if [ "$nstr" == "" ]; then
nstr="${line}"
else
nstr="${nstr}\n${line}"
fi
fi
done <"$fname"
echo $nstr > $fname
echo " done!"
sleep 0.3
################################################
echo -n "Adding my build.prop settings......."
fname="/system/build.prop"
tmpvar=$(sed '/.*My settings.*/{s///;q;}' $fname | sed '$d')
echo "$tmpvar" > $fname
echo '
# My settings
# Disable multi user
fw.max_users=1
fw.show_multiuserui=0
fw.show_hidden_users=0
fw.power_user_switcher=0
# Disable logging, checks and sending data
logcat.live=disable
profiler.force_disable_err_rpt=1
profiler.force_disable_ulog=1
persist.android.strictmode=0
ro.config.nocheckin=1
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
# Disable boot animation
debug.sf.nobootanimation=1
# Disable USB debugging notification
persist.adb.notify=0
# Improve call quality
ro.ril.enable.amr.wideband=1
# Better network signals
persist.cust.tel.eons=1
ro.config.hw_fast_dormancy=1
# Enable Volte functionality
persist.dbg.ims_volte_enable=1
persist.dbg.volte_avail_ovr=1
persist.dbg.vt_avail_ovr=1
persist.dbg.wfc_avail_ovr=1
persist.volte_enalbed_by_hw=1
# Disable scrolling cache
persist.sys.scrollingcache=4
# Optimize Dalvik
dalvik.vm.dexopt-flags=v=n,o=v,m=y
# Power Savings
ro.ril.power_collapse=1
pm.sleep_mode=1
wifi.supplicant_scan_interval=500
ro.mot.eri.losalert.delay=1000
# End of my settings
' >> $fname
chmod 644 $fname
echo " done!"
sleep 0.3
################################################
echo -n "Adding my gps.conf settings........."
rm -f /system/vendor/etc/gps.conf
touch /system/vendor/etc/gps.conf
echo '# My settings
# NTP Server - only one allowed!
NTP_SERVER=nl.pool.ntp.org
# Debug level
DEBUG_LEVEL=0
# End of my settings
' > /system/vendor/etc/gps.conf
chmod 644 /system/vendor/etc/gps.conf
echo " done!"
sleep 0.3
################################################
echo -n "Adding my userinit.sh settings......"
echo '#!/system/bin/sh
# My settings
# Stop perfd before implementing tweaks
stop perfd
# Perfect mount options
mount -o remount,noatime,noauto_da_alloc,nodiratime,barrier=0,commit=60,nobh /system
mount -o remount,noatime,noauto_da_alloc,rw,nosuid,nodev,nodiratime,barrier=0,commit=60,nobh /data
mount -o remount,noatime,noauto_da_alloc,rw,nosuid,nodev,nodiratime,barrier=0,commit=60,nobh /cache
# Flags blocks as non-rotational and increases cache size
LOOP=`ls -d /sys/block/loop*`
RAM=`ls -d /sys/block/ram*`
for j in $LOOP $RAM
do
chmod 666 $j/queue/rotational
echo 0 > $j/queue/rotational
chmod 444 $j/queue/rotational
chmod 666 $j/queue/read_ahead_kb
echo 2048 > $j/queue/read_ahead_kb
chmod 444 $j/queue/read_ahead_kb
done
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /storage/emulated/0 -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
# Enable power_efficient workqueue
chmod 666 sys/module/workqueue/parameters/power_efficient
echo 1 > /sys/module/workqueue/parameters/power_efficient
chmod 444 sys/module/workqueue/parameters/power_efficient
# Battery tweaks
chmod 666 proc/sys/vm/dirty_expire_centisecs
echo 1000 > /proc/sys/vm/dirty_expire_centisecs
chmod 444 proc/sys/vm/dirty_expire_centisecs
chmod 666 proc/sys/vm/dirty_writeback_centisecs
echo 2000 > /proc/sys/vm/dirty_writeback_centisecs
chmod 444 proc/sys/vm/dirty_writeback_centisecs
# Miscellaneous
chmod 666 /sys/module/sync/parameters/fsync_enabled
echo 'N' > /sys/module/sync/parameters/fsync_enabled
chmod 444 /sys/module/sync/parameters/fsync_enabled
chmod 666 /sys/block/sda/queue/iostats
echo '0' > /sys/block/sda/queue/iostats
chmod 444 /sys/block/sda/queue/iostats
# Start perfd again
start perfd
# Fstrim on boot
if [ -e /data/adb/magisk/busybox ]; then
/data/adb/magisk/busybox fstrim /cache &
/data/adb/magisk/busybox fstrim /data &
/data/adb/magisk/busybox fstrim /system &
fi
# End of my settings
' > /data/local/userinit.sh
chmod 777 /data/local/userinit.sh
echo " done!"
sleep 0.3
################################################
echo -n "Change all timestamps..............."
# Useless but nice to have most dates set to install date again
find / -type d -exec touch {} + 2>/dev/null
find / -type f -exec touch {} + 2>/dev/null
echo " done!"
sleep 0.3
################################################
if [ -e /data/adb/magisk/busybox ]; then
echo -n "Optimising disks using fstrim......."
/data/adb/magisk/busybox fstrim /cache
/data/adb/magisk/busybox fstrim /data
/data/adb/magisk/busybox fstrim /system
echo " done!"
fi
echo
Further setup (25-07-2019):
Oxygen 9.04 firmware
TWRP 3.3.1-0
Lineage OS 16
Flashkernel r58 (3.18.140) (sometimes changing to Mady's out of curiousity but performancewise I prefer Flash)
Magisk v19.3
Librechair launcher
No Google stuff, using AuroraStore and AuroraDroid as playstores.

Made some changes in setup to test if I can live without root and as simple as possible.
Further:
- removed some stuff from script,
- solved some small typings,
- added some more apk's and files to remove
I do not like the chmod lines in my userinit.sh, so probably I will add an array for that later.
Code:
#!/sbin/sh
#
# Script by 2Tweak
# Last modified 12-08-2019
################################################
# First setup
clear
echo
echo "##########################################"
echo "# ROM DEBLOAT SCRIPT #"
echo "##########################################"
echo
mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system
################################################
echo -n "Shrinking ROM to the bare minimum..."
# app list to remove
applist="
AntHalService
AudioFX
BackupRestoreConfirmation
BasicDreams
BluetoothMidiService
BookmarkProvider
BuiltInPrintService
Calendar
CaptivePortalLogin
CNEService
CallLogBackup
CellBroadcastReceiver
CompanionDeviceManager
com.qualcomm.location
Contacts
CtsShimPrebuilt
CtsShimPrivPrebuilt
Development
DocumentsUI
EasterEgg
Eleven
Email
ExactCalculator
Exchange2
Gallery2
HTMLViewer
InputDevices
Jelly
LatinIME
LineageSetupWizard
LiveWallpapersPicker
LockClock
ManagedProvisioning
OneTimeInitializer
OneplusDoze
OneplusPocketMode
PhotoTable
PrintRecommendationService
Profiles
SharedStorageBackup
SimAppDialog
Stk
Tag
Terminal
Traceur
Updater
UserDictionaryProvider
VpnDialogs
WallpaperBackup
WallpaperCropper
WeatherProvider
WfdService
"
for appname in $applist
do
if [ -e /system/app/$appname ]; then
chmod -R 777 /system/app/$appname
rm -rf /system/app/$appname
fi
if [ -e /system/priv-app/$appname ]; then
chmod -R 777 /system/priv-app/$appname
rm -rf /system/priv-app/$appname
fi
done
echo " done!"
################################################
echo -n "Removing unneeded and junk files...."
# file list to cleanup
filelist="
/cache
/data/anr
/data/backup
/data/cache
/data/dalvik-cache
/data/lineageos_updates
/data/local/tmp
/data/lost+found
/data/misc/bootstat
/data/ota
/data/ota_package
/data/resource-cache
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/package_cache
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/daily
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/tombstones
/sdcard/DCIM/thumbnails
/system/bin/bootanimation
/system/media/bootanimation.zip
"
for filename in $filelist
do
if [ -d $filename ]; then
chmod -R 777 $filename
rm -rf $filename/*
fi
if [ -f $filename ]; then
chmod 777 $filename
rm -f $filename
fi
done
# Remove bak, log, tmp and dex files
find /data -iname "*.bak" -type f -exec rm -f {} +
find /data -iname "*.log" -type f -exec rm -f {} +
find /data -iname "*.tmp" -type f -exec rm -f {} +
find /data -iname "*.odex" -type f -exec rm -f {} +
find /data -iname "*.vdex" -type f -exec rm -f {} +
find /system -iname "*.bak" -type f -exec rm -f {} +
find /system -iname "*.log" -type f -exec rm -f {} +
find /system -iname "*.tmp" -type f -exec rm -f {} +
# Some other useless system related files
rm -f /data/stock_boot_*.img.gz
rm -rf /system/vendor/overlay
# Some resets after firmware upgrades
# Reset NFC
rm -f /data/nfc/nfaStorage.bin1
# Remove passwords
rm -f /data/system/locksettings.db
rm -f /data/system/locksettings.db-shm
rm -f /data/system/locksettings.db-wal
rm -f /data/system/gatekeeper.password.key
rm -f /data/system/gatekeeper.pattern.key
# Reset fingerprint
rm -f /data/system/users/0/fpdata/user.db
rm -f /data/system/users/0/settings_fingerprint.xml
# Reduce fonts to the bare minimum
find /system/fonts ! -iname "*roboto*.*" ! -name "DroidSansMono.ttf" ! -name "NotoColorEmoji.ttf" -type f -exec rm -f {} +
echo " done!"
################################################
echo -n "Cleaning app data..................."
for i in $(ls /data/data/)
do
if [ -e /data/data/$i/cache ]; then
chmod -R 777 /data/data/$i/cache
rm -rf /data/data/$i/cache/*
fi
if [ -e /data/data/$i/code_cache ]; then
chmod -R 777 /data/data/$i/code_cache
rm -rf /data/data/$i/code_cache/*
fi
if [ -e /data/data/$i/files/.Fabric ]; then
chmod -R 777 /data/data/$i/files/.Fabric
rm -rf /data/data/$i/files/.Fabric/*
fi
if [ -e /data/data/$i/files/cache ]; then
chmod -R 777 /data/data/$i/files/cache
rm -rf /data/data/$i/files/cache/*
fi
if [ -e /data/data/$i/app_webview ]; then
chmod -R 777 /data/data/$i/app_webview
# keep cookies for webapp logins
if [ -e /data/data/$i/app_webview/Cookies ]; then
mv -f /data/data/$i/app_webview/Cookies /data/local/tmp/$i.Cookies
fi
rm -rf /data/data/$i/app_webview/*
if [ -e /data/local/tmp/$i.Cookies ]; then
mv -f /data/local/tmp/$i.Cookies /data/data/$i/app_webview/Cookies
fi
fi
done
for j in $(ls /data/app/)
do
if [ -e /data/app/$j/oat/arm ]; then
chmod -R 777 /data/app/$j/oat/arm
rm -rf /data/app/$j/oat/arm/*
fi
if [ -e /data/app/$j/oat/arm64 ]; then
chmod -R 777 /data/app/$j/oat/arm64
rm -rf /data/app/$j/oat/arm64/*
fi
done
for k in $(ls /sdcard/Android/data/)
do
if [ -e /sdcard/Android/data/$k/cache ]; then
chmod -R 777 /sdcard/Android/data/$k/cache
rm -rf /sdcard/Android/data/$k/cache/*
fi
done
# App specific
rm -rf /data/data/com.abnamro.nl.mobile.payments/app_dex/oat/arm64/*
rm -rf /data/data/org.fdroid.fdroid/files/*.apk
rm -rf /data/data/org.videolan.vlc/app_vlc/*
# Remove empty directories
find /data/data -type d -depth -exec rmdir {} + 2>/dev/null
find /sdcard -type d -depth -exec rmdir {} + 2>/dev/null
echo " done!"
################################################
echo -n "Optimizing app databases............"
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /sdcard -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
echo " done!"
################################################
echo -n "Setting log permissions read-only..."
chmod 000 /data/tombstones
chmod 000 /data/system/dropbox
chmod 000 /data/system/graphicsstats
chmod 000 /data/system/procstats
chmod 000 /data/system/usagestats/0/daily
chmod 000 /data/system/usagestats/0/weekly
chmod 000 /data/system/usagestats/0/monthly
chmod 000 /data/system/usagestats/0/yearly
echo " done!"
################################################
echo -n "Repair Phone Is Starting error......"
rm -f '/system/vendor/bin/hw/[email protected]'
rm -f '/system/vendor/etc/init/[email protected]'
fname="/system/vendor/etc/vintf/manifest.xml"
found=0
startstop=0
tstr=""
nstr=""
IFS=$'\n'
while read line
do
if [[ "$line" == *'<hal'* ]]; then
startstop=1
elif [[ "$line" == *'</hal'* ]]; then
startstop=2
elif [[ "$line" == *'livedisplay'* ]]; then
found=1
fi
if [ $startstop -eq 1 ]; then
tstr="${tstr}\n${line}"
elif [ $startstop -eq 2 ]; then
tstr="${tstr}\n${line}"
if [ $found -eq 0 ]; then
nstr="${nstr}${tstr}"
else
found=0
fi
tstr=""
startstop=0
else
if [ "$nstr" == "" ]; then
nstr="${line}"
else
nstr="${nstr}\n${line}"
fi
fi
done <"$fname"
echo $nstr > $fname
echo " done!"
################################################
echo -n "Adding my build.prop settings......."
fname="/system/build.prop"
tmpvar=$(sed '/.*My settings.*/{s///;q;}' $fname | sed '$d')
echo "$tmpvar" > $fname
echo '
# My settings
# Disable multi user
fw.max_users=1
fw.show_multiuserui=0
fw.show_hidden_users=0
fw.power_user_switcher=0
# Disable logging, checks and sending data
logcat.live=disable
profiler.force_disable_err_rpt=1
profiler.force_disable_ulog=1
persist.android.strictmode=0
ro.config.nocheckin=1
ro.kernel.android.checkjni=0
ro.kernel.checkjni=0
# Disable boot animation
debug.sf.nobootanimation=1
# Disable USB debugging notification
persist.adb.notify=0
# Disable dithering
persist.sys.use_dithering=0
# Disable scrolling cache
persist.sys.scrollingcache=4
# Optimize Dalvik
dalvik.vm.dexopt-flags=v=n,o=v,m=y
# Power Savings
ro.ril.power_collapse=1
pm.sleep_mode=1
wifi.supplicant_scan_interval=500
ro.mot.eri.losalert.delay=1000
# End of my settings
' >> $fname
chmod 644 $fname
echo " done!"
################################################
echo -n "Adding my gps.conf settings........."
rm -f /system/vendor/etc/gps.conf
touch /system/vendor/etc/gps.conf
echo '# My settings
# NTP Server - only one allowed!
NTP_SERVER=nl.pool.ntp.org
# Debug level
DEBUG_LEVEL=0
# End of my settings
' > /system/vendor/etc/gps.conf
chmod 644 /system/vendor/etc/gps.conf
echo " done!"
################################################
echo -n "Adding my userinit.sh settings......"
echo '#!/system/bin/sh
# My settings
# Stop perfd before implementing tweaks
stop perfd
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /storage/emulated/0 -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
# Enable power_efficient workqueue
chmod 666 sys/module/workqueue/parameters/power_efficient
echo '1' > /sys/module/workqueue/parameters/power_efficient
chmod 444 sys/module/workqueue/parameters/power_efficient
# Battery tweaks
chmod 666 proc/sys/vm/dirty_expire_centisecs
echo '1000' > /proc/sys/vm/dirty_expire_centisecs
chmod 444 proc/sys/vm/dirty_expire_centisecs
chmod 666 proc/sys/vm/dirty_writeback_centisecs
echo '2000' > /proc/sys/vm/dirty_writeback_centisecs
chmod 444 proc/sys/vm/dirty_writeback_centisecs
# Disable fsync
chmod 666 /sys/module/sync/parameters/fsync_enabled
echo 'N' > /sys/module/sync/parameters/fsync_enabled
chmod 444 /sys/module/sync/parameters/fsync_enabled
# Disable iostats
chmod 666 /sys/block/sda/queue/iostats
echo '0' > /sys/block/sda/queue/iostats
chmod 444 /sys/block/sda/queue/iostats
# Start perfd again
start perfd
# Fstrim on boot
if [ -e /storage/emulated/fstrim ]; then
chmod 777 /storage/emulated/fstrim
/storage/emulated/fstrim /cache &
/storage/emulated/fstrim /data &
/storage/emulated/fstrim /system &
fi
# End of my settings
' > /data/local/userinit.sh
chmod 777 /data/local/userinit.sh
echo " done!"
################################################
if [ -e /sdcard/Config/Device/fstrim ]; then
echo -n "Optimising disks using fstrim......."
chmod 777 /sdcard/Config/Device/fstrim
/sdcard/Config/Device/fstrim /cache
/sdcard/Config/Device/fstrim /data
/sdcard/Config/Device/fstrim /system
echo " done!"
fi
echo
Further setup (12-08-2019):
Oxygen 9.05 firmware
TWRP 3.3.1-0
Lineage OS 16
Flashkernel r58 (3.18.140)
No Google stuff, using AuroraStore and AuroraDroid as playstores.
Magisk removed (no root), back to default Trebuchet launcher
Copied fstrim to /sdcard/Config/Device to use it in my script and userinit.sh.
I used trimmer app to get a good working fstrim, but probably also available elsewhere.

Removed some stuff because of issues, not working, or even not existing parameters in build.prop.
Pretty basic but working very well for me.
Code:
#!/sbin/sh
#
# Script by 2Tweak
# Last modified 24-08-2019
# Recommended to read before doing all kind of tweaks:
# https://************/most-common-android-optimization-myths-debunked/
################################################
# First setup
clear
echo
echo "##########################################"
echo "# ROM DEBLOAT SCRIPT #"
echo "##########################################"
echo
mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system
################################################
echo -n "Shrinking ROM to the bare minimum..."
# app list to remove
applist="
AntHalService
AudioFX
BackupRestoreConfirmation
BasicDreams
BluetoothMidiService
BookmarkProvider
BuiltInPrintService
Calendar
CaptivePortalLogin
CNEService
CallLogBackup
CellBroadcastReceiver
CompanionDeviceManager
Contacts
CtsShimPrebuilt
CtsShimPrivPrebuilt
Development
DocumentsUI
EasterEgg
Eleven
Email
ExactCalculator
Exchange2
Gallery2
HTMLViewer
InputDevices
Jelly
LatinIME
LineageSetupWizard
LiveWallpapersPicker
LockClock
ManagedProvisioning
OneTimeInitializer
OneplusDoze
OneplusPocketMode
PhotoTable
PrintRecommendationService
Profiles
SharedStorageBackup
SimAppDialog
Stk
Tag
Terminal
Traceur
Updater
UserDictionaryProvider
VpnDialogs
WallpaperBackup
WallpaperCropper
WeatherProvider
WfdService
"
for appname in $applist
do
if [ -e /system/app/$appname ]; then
chmod -R 777 /system/app/$appname
rm -rf /system/app/$appname
fi
if [ -e /system/priv-app/$appname ]; then
chmod -R 777 /system/priv-app/$appname
rm -rf /system/priv-app/$appname
fi
done
echo " done!"
################################################
echo -n "Removing unneeded and junk files...."
# file list to cleanup
filelist="
/cache
/data/anr
/data/backup
/data/cache
/data/dalvik-cache
/data/lineageos_updates
/data/local/tmp
/data/lost+found
/data/misc/bootstat
/data/ota
/data/ota_package
/data/resource-cache
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/package_cache
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/daily
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/tombstones
/sdcard/DCIM/thumbnails
/system/bin/bootanimation
/system/media/bootanimation.zip
"
for filename in $filelist
do
if [ -d $filename ]; then
chmod -R 777 $filename
rm -rf $filename/*
fi
if [ -f $filename ]; then
chmod 777 $filename
rm -f $filename
fi
done
# Remove bak, log, tmp and dex files
find /data -iname "*.bak" -type f -exec rm -f {} +
find /data -iname "*.log" -type f -exec rm -f {} +
find /data -iname "*.tmp" -type f -exec rm -f {} +
find /data -iname "*.odex" -type f -exec rm -f {} +
find /data -iname "*.vdex" -type f -exec rm -f {} +
find /system -iname "*.bak" -type f -exec rm -f {} +
find /system -iname "*.log" -type f -exec rm -f {} +
find /system -iname "*.tmp" -type f -exec rm -f {} +
# Some other useless system related files
rm -f /data/stock_boot_*.img.gz
rm -rf /system/vendor/overlay
# Some resets after firmware upgrades
# Reset NFC
rm -f /data/nfc/nfaStorage.bin1
# Remove passwords
rm -f /data/system/locksettings.db
rm -f /data/system/locksettings.db-shm
rm -f /data/system/locksettings.db-wal
rm -f /data/system/gatekeeper.password.key
rm -f /data/system/gatekeeper.pattern.key
# Reset fingerprint
rm -f /data/system/users/0/fpdata/user.db
rm -f /data/system/users/0/settings_fingerprint.xml
echo " done!"
################################################
echo -n "Disable live display functionality.."
rm -f '/system/vendor/bin/hw/[email protected]'
rm -f '/system/vendor/etc/init/[email protected]'
fname="/system/vendor/etc/vintf/manifest.xml"
found=0
startstop=0
tstr=""
nstr=""
IFS=$'\n'
while read line
do
if [[ "$line" == *'<hal'* ]]; then
startstop=1
elif [[ "$line" == *'</hal'* ]]; then
startstop=2
elif [[ "$line" == *'livedisplay'* ]]; then
found=1
fi
if [ $startstop -eq 1 ]; then
tstr="${tstr}\n${line}"
elif [ $startstop -eq 2 ]; then
tstr="${tstr}\n${line}"
if [ $found -eq 0 ]; then
nstr="${nstr}${tstr}"
else
found=0
fi
tstr=""
startstop=0
else
if [ "$nstr" == "" ]; then
nstr="${line}"
else
nstr="${nstr}\n${line}"
fi
fi
done <"$fname"
echo $nstr > $fname
echo " done!"
################################################
echo -n "Cleaning app data..................."
for i in $(ls /data/data/)
do
if [ -e /data/data/$i/cache ]; then
chmod -R 777 /data/data/$i/cache
rm -rf /data/data/$i/cache/*
fi
if [ -e /data/data/$i/code_cache ]; then
chmod -R 777 /data/data/$i/code_cache
rm -rf /data/data/$i/code_cache/*
fi
if [ -e /data/data/$i/files/.Fabric ]; then
chmod -R 777 /data/data/$i/files/.Fabric
rm -rf /data/data/$i/files/.Fabric/*
fi
if [ -e /data/data/$i/files/cache ]; then
chmod -R 777 /data/data/$i/files/cache
rm -rf /data/data/$i/files/cache/*
fi
if [ -e /data/data/$i/app_webview ]; then
chmod -R 777 /data/data/$i/app_webview
# keep cookies for webapp logins
if [ -e /data/data/$i/app_webview/Cookies ]; then
mv -f /data/data/$i/app_webview/Cookies /data/local/tmp/$i.Cookies
fi
rm -rf /data/data/$i/app_webview/*
if [ -e /data/local/tmp/$i.Cookies ]; then
mv -f /data/local/tmp/$i.Cookies /data/data/$i/app_webview/Cookies
fi
fi
done
for j in $(ls /data/app/)
do
if [ -e /data/app/$j/oat/arm ]; then
chmod -R 777 /data/app/$j/oat/arm
rm -rf /data/app/$j/oat/arm/*
fi
if [ -e /data/app/$j/oat/arm64 ]; then
chmod -R 777 /data/app/$j/oat/arm64
rm -rf /data/app/$j/oat/arm64/*
fi
done
for k in $(ls /sdcard/Android/data/)
do
if [ -e /sdcard/Android/data/$k/cache ]; then
chmod -R 777 /sdcard/Android/data/$k/cache
rm -rf /sdcard/Android/data/$k/cache/*
fi
done
# App specific
rm -rf /data/data/com.abnamro.nl.mobile.payments/app_dex/oat/arm64/*
rm -rf /data/data/org.fdroid.fdroid/files/*.apk
rm -rf /data/data/org.videolan.vlc/app_vlc/*
# Remove empty directories
find /data/data -type d -depth -exec rmdir {} + 2>/dev/null
find /sdcard -type d -depth -exec rmdir {} + 2>/dev/null
echo " done!"
################################################
echo -n "Optimizing app databases............"
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /sdcard -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
echo " done!"
################################################
echo -n "Setting log permissions read-only..."
chmod 000 /data/tombstones
chmod 000 /data/system/dropbox
chmod 000 /data/system/graphicsstats
chmod 000 /data/system/procstats
chmod 000 /data/system/usagestats/0/daily
chmod 000 /data/system/usagestats/0/weekly
chmod 000 /data/system/usagestats/0/monthly
chmod 000 /data/system/usagestats/0/yearly
echo " done!"
################################################
echo -n "Adding my build.prop settings......."
fname="/system/build.prop"
tmpvar=$(sed '/.*My settings.*/{s///;q;}' $fname | sed '$d')
echo "$tmpvar" > $fname
echo '
# My settings
# Disable multi user
fw.max_users=1
fw.show_multiuserui=0
fw.show_hidden_users=0
fw.power_user_switcher=0
# Disable logging
logcat.live=disable
# Remove fps limit
debug.gr.swapinterval=0
# Disable boot animation
debug.sf.nobootanimation=1
# Disable USB debugging notification
persist.adb.notify=0
# Disable dithering
persist.sys.use_dithering=0
# Disable scrolling cache
persist.sys.scrollingcache=4
# Optimize Dalvik
dalvik.vm.dexopt-flags=v=n,o=v,m=y
# Disable ring delay
ro.telephony.call_ring.delay=0
ring.delay=0
# Misc power Savings
wifi.supplicant_scan_interval=500
ro.mot.eri.losalert.delay=1000
# End of my settings
' >> $fname
chmod 644 $fname
echo " done!"
################################################
echo -n "Adding my gps.conf settings........."
rm -f /system/vendor/etc/gps.conf
touch /system/vendor/etc/gps.conf
echo '# My settings
# NTP Server - only one allowed!
NTP_SERVER=nl.pool.ntp.org
# Debug level
DEBUG_LEVEL=0
# End of my settings
' > /system/vendor/etc/gps.conf
chmod 644 /system/vendor/etc/gps.conf
echo " done!"
################################################
echo -n "Adding my userinit.sh settings......"
echo '#!/system/bin/sh
# My settings
# Stop perfd - no side effects found
stop perfd
# Switch to noop
for i in /sys/block/mmc*; do
echo noop > $i/queue/scheduler
echo 0 > $i/queue/iostats
done
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /storage/emulated/0 -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
# Battery tweaks
chmod 666 /proc/sys/vm/dirty_expire_centisecs
echo 1000 > /proc/sys/vm/dirty_expire_centisecs
chmod 444 /proc/sys/vm/dirty_expire_centisecs
chmod 666 /proc/sys/vm/dirty_writeback_centisecs
echo 2000 > /proc/sys/vm/dirty_writeback_centisecs
chmod 444 /proc/sys/vm/dirty_writeback_centisecs
# Enable power_efficient workqueue
chmod 666 /sys/module/workqueue/parameters/power_efficient
echo 1 > /sys/module/workqueue/parameters/power_efficient
chmod 444 /sys/module/workqueue/parameters/power_efficient
# Disable fsync
chmod 666 /sys/module/sync/parameters/fsync_enabled
echo N > /sys/module/sync/parameters/fsync_enabled
chmod 444 /sys/module/sync/parameters/fsync_enabled
# Disable iostats
chmod 666 /sys/block/sda/queue/iostats
echo 0 > /sys/block/sda/queue/iostats
chmod 444 /sys/block/sda/queue/iostats
# Fstrim on boot
if [ -e /storage/emulated/fstrim ]; then
chmod 777 /storage/emulated/fstrim
/storage/emulated/fstrim /cache
/storage/emulated/fstrim /data
/storage/emulated/fstrim /system
fi
# End of my settings
' > /data/local/userinit.sh
chmod 777 /data/local/userinit.sh
echo " done!"
################################################
if [ -e /sdcard/Config/Device/fstrim ]; then
echo -n "Optimising disks using fstrim......."
chmod 777 /sdcard/Config/Device/fstrim
/sdcard/Config/Device/fstrim /cache
/sdcard/Config/Device/fstrim /data
/sdcard/Config/Device/fstrim /system
echo " done!"
fi
echo
Further setup (24-08-2019):
Oxygen 9.05 firmware
TWRP 3.3.1-0
Lineage OS 16
Flashkernel r58 (3.18.140)
No Google stuff, using AuroraStore and AuroraDroid as playstores.
Magisk removed (no root),
Default Trebuchet launcher
Copied fstrim to /sdcard/Config/Device to use it in my script and userinit.sh.
I used trimmer app to get a good working fstrim, but probably also available elsewhere.

<removed>

After some reading and some input from people like @anupritaisno1 I came to the next setup.
I went back to rootless, encrypted my phone and made two scripts instead of one.
The install.sh script is used after installing the firmware, rom and kernel (normal dirty flashes) and is only removing the packages I am not using as some log files, and other useless stuff. Also used to implement some tweaks (userinit.sh, gps.conf, build.prop).
The cleanup.sh script is a script for removing all cache, dalvik-cache, app-caches etc.. and is the part I was only using about once a month to start almost clean without loosing settings.
install.sh, used to remove packages I am not using, some logging and other stuff, implementing some tweaks (userinit.sh):
Code:
#!/sbin/sh
#
# Script by 2Tweak
# Last modified 07-09-2019
################################################
# First setup
clear
echo
echo "##########################################"
echo "# DEBLOAT AND TWEAK SCRIPT #"
echo "##########################################"
echo
mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system
################################################
echo -n "Shrinking ROM to the bare minimum..."
# app list to remove
applist="
AntHalService
AudioFX
BasicDreams
BluetoothMidiService
BookmarkProvider
BuiltInPrintService
Calendar
CaptivePortalLogin
CNEService
CallLogBackup
CellBroadcastReceiver
CompanionDeviceManager
Contacts
CtsShimPrebuilt
CtsShimPrivPrebuilt
DocumentsUI
EasterEgg
Eleven
Email
ExactCalculator
Exchange2
Gallery2
HTMLViewer
InputDevices
Jelly
LineageSetupWizard
LiveWallpapersPicker
LockClock
ManagedProvisioning
OneTimeInitializer
PhotoTable
PrintRecommendationService
SharedStorageBackup
SimAppDialog
Stk
Tag
Terminal
Traceur
Updater
UserDictionaryProvider
VpnDialogs
WallpaperBackup
WfdService
"
for appname in $applist
do
if [ -e /system/app/$appname ]; then
chmod -R 777 /system/app/$appname
rm -rf /system/app/$appname
fi
if [ -e /system/priv-app/$appname ]; then
chmod -R 777 /system/priv-app/$appname
rm -rf /system/priv-app/$appname
fi
done
echo " done!"
################################################
echo -n "Removing unneeded and junk files...."
# file list to cleanup
filelist="
/cache
/data/anr
/data/backup
/data/lineageos_updates
/data/local/tmp
/data/lost+found
/data/misc/bootstat
/data/ota
/data/ota_package
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/daily
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/tombstones
/system/bin/bootanimation
/system/media/bootanimation.zip
"
for filename in $filelist
do
if [ -d $filename ]; then
chmod -R 777 $filename
rm -rf $filename/*
fi
if [ -f $filename ]; then
chmod 777 $filename
rm -f $filename
fi
done
# Remove bak, log, tmp files
find /data -iname "*.bak" -type f -exec rm -f {} +
find /data -iname "*.log" -type f -exec rm -f {} +
find /data -iname "*.tmp" -type f -exec rm -f {} +
find /system -iname "*.bak" -type f -exec rm -f {} +
find /system -iname "*.log" -type f -exec rm -f {} +
find /system -iname "*.tmp" -type f -exec rm -f {} +
echo " done!"
################################################
echo -n "Cleaning app data..................."
for i in $(ls /data/data/)
do
if [ -e /data/data/$i/app_webview ]; then
chmod -R 777 /data/data/$i/app_webview
# keep cookies for webapp logins
if [ -e /data/data/$i/app_webview/Cookies ]; then
mv -f /data/data/$i/app_webview/Cookies /data/local/tmp/$i.Cookies
fi
rm -rf /data/data/$i/app_webview/*
if [ -e /data/local/tmp/$i.Cookies ]; then
mv -f /data/local/tmp/$i.Cookies /data/data/$i/app_webview/Cookies
fi
fi
done
for k in $(ls /sdcard/Android/data/)
do
if [ -e /sdcard/Android/data/$k/cache ]; then
chmod -R 777 /sdcard/Android/data/$k/cache
rm -rf /sdcard/Android/data/$k/cache/*
fi
done
echo " done!"
################################################
echo -n "Optimizing app databases............"
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /sdcard -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
echo " done!"
################################################
echo -n "Setting log permissions read-only..."
chmod 000 /data/tombstones
chmod 000 /data/system/dropbox
chmod 000 /data/system/graphicsstats
chmod 000 /data/system/procstats
chmod 000 /data/system/usagestats/0/daily
chmod 000 /data/system/usagestats/0/weekly
chmod 000 /data/system/usagestats/0/monthly
chmod 000 /data/system/usagestats/0/yearly
echo " done!"
################################################
echo -n "Adding my build.prop settings......."
fname="/system/build.prop"
tmpvar=$(sed '/.*My settings.*/{s///;q;}' $fname | sed '$d')
echo "$tmpvar" > $fname
echo '
# My settings
# Disable multi user
fw.max_users=1
fw.show_multiuserui=0
fw.show_hidden_users=0
fw.power_user_switcher=0
# Disable logging
logcat.live=disable
# Disable boot animation
debug.sf.nobootanimation=1
# Disable USB debugging notification
persist.adb.notify=0
# Enable VoLTE
persist.dbg.ims_volte_enable=1
persist.dbg.volte_avail_ovr=1
persist.dbg.vt_avail_ovr=1
persist.dbg.wfc_avail_ovr=1
persist.radio.rat_on=combine
persist.radio.data_ltd_sys_ind=1
persist.radio.data_con_rprt=1
persist.radio.calls.on.ims=1
# End of my settings
' >> $fname
chmod 644 $fname
echo " done!"
################################################
echo -n "Adding my gps.conf settings........."
rm -f /system/vendor/etc/gps.conf
touch /system/vendor/etc/gps.conf
echo '# My settings
# NTP Server - only one allowed!
NTP_SERVER=nl.pool.ntp.org
# Debug level
DEBUG_LEVEL=0
# End of my settings
' > /system/vendor/etc/gps.conf
chmod 644 /system/vendor/etc/gps.conf
echo " done!"
################################################
echo -n "Adding my userinit.sh settings......"
echo '#!/system/bin/sh
# My settings
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /storage/emulated/0 -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
# Disable iostats
chmod 666 /sys/block/sda/queue/iostats
echo "0" > /sys/block/sda/queue/iostats
chmod 444 /sys/block/sda/queue/iostats
# Disable some wakelocks
if [ -e /sys/devices/virtual/misc/boeffla_wakelock_blocker ]; then
echo "IPA_WS;NETLINK;bms;netmgr_wl;qcom_rx_wakelock;sensor_SMD;wlan;wlan_extscan_wl;wlan_ipa;wlan_pno_wl;wlan_wow_wl" > /sys/devices/virtual/misc/boeffla_wakelock_blocker/wakelock_blocker
fi
# End of my settings
' > /data/local/userinit.sh
chmod 777 /data/local/userinit.sh
echo " done!"
echo
cleanup.sh, used about once a month to have the feeling I start with an almost clean system (probably useless):
Code:
]#!/sbin/sh
#
# Script by 2Tweak
# Last modified 06-09-2019
################################################
# First setup
clear
echo
echo "##########################################"
echo "# DEEP CLEAN SCRIPT #"
echo "##########################################"
echo
mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system
################################################
echo -n "Removing unneeded and junk files...."
# file list to cleanup
filelist="
/cache
/data/anr
/data/backup
/data/cache
/data/dalvik-cache
/data/lineageos_updates
/data/local/tmp
/data/lost+found
/data/misc/bootstat
/data/ota
/data/ota_package
/data/resource-cache
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/package_cache
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/daily
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/tombstones
/system/bin/bootanimation
/system/media/bootanimation.zip
"
for filename in $filelist
do
if [ -d $filename ]; then
chmod -R 777 $filename
rm -rf $filename/*
fi
if [ -f $filename ]; then
chmod 777 $filename
rm -f $filename
fi
done
# Remove bak, log, tmp and dex files
find /data -iname "*.bak" -type f -exec rm -f {} +
find /data -iname "*.log" -type f -exec rm -f {} +
find /data -iname "*.tmp" -type f -exec rm -f {} +
find /data -iname "*.odex" -type f -exec rm -f {} +
find /data -iname "*.vdex" -type f -exec rm -f {} +
find /system -iname "*.bak" -type f -exec rm -f {} +
find /system -iname "*.log" -type f -exec rm -f {} +
find /system -iname "*.tmp" -type f -exec rm -f {} +
# Some other useless system related files
rm -f /data/stock_boot_*.img.gz
rm -rf /system/vendor/overlay
echo " done!"
################################################
echo -n "Cleaning app data and caches........"
for i in $(ls /data/data/)
do
if [ -e /data/data/$i/cache ]; then
chmod -R 777 /data/data/$i/cache
rm -rf /data/data/$i/cache/*
fi
if [ -e /data/data/$i/code_cache ]; then
chmod -R 777 /data/data/$i/code_cache
rm -rf /data/data/$i/code_cache/*
fi
if [ -e /data/data/$i/files/.Fabric ]; then
chmod -R 777 /data/data/$i/files/.Fabric
rm -rf /data/data/$i/files/.Fabric/*
fi
if [ -e /data/data/$i/files/cache ]; then
chmod -R 777 /data/data/$i/files/cache
rm -rf /data/data/$i/files/cache/*
fi
if [ -e /data/data/$i/app_webview ]; then
chmod -R 777 /data/data/$i/app_webview
# keep cookies for webapp logins
if [ -e /data/data/$i/app_webview/Cookies ]; then
mv -f /data/data/$i/app_webview/Cookies /data/local/tmp/$i.Cookies
fi
rm -rf /data/data/$i/app_webview/*
if [ -e /data/local/tmp/$i.Cookies ]; then
mv -f /data/local/tmp/$i.Cookies /data/data/$i/app_webview/Cookies
fi
fi
done
for k in $(ls /sdcard/Android/data/)
do
if [ -e /sdcard/Android/data/$k/cache ]; then
chmod -R 777 /sdcard/Android/data/$k/cache
rm -rf /sdcard/Android/data/$k/cache/*
fi
done
echo " done!"
################################################
echo -n "Cleaning app oat files.............."
for j in $(ls /data/app/)
do
if [ -e /data/app/$j/oat/arm ]; then
chmod -R 777 /data/app/$j/oat/arm
rm -rf /data/app/$j/oat/arm/*
fi
if [ -e /data/app/$j/oat/arm64 ]; then
chmod -R 777 /data/app/$j/oat/arm64
rm -rf /data/app/$j/oat/arm64/*
fi
done
echo " done!"
################################################
echo -n "Remove some app specific files......"
# App specific
rm -rf /data/data/org.fdroid.fdroid/files/*.apk
rm -rf /data/data/org.videolan.vlc/app_vlc/*
echo " done!"
################################################
echo -n "Remove empty directories............"
# Remove empty directories
find /data/data -type d -depth -exec rmdir {} + 2>/dev/null
find /sdcard -type d -depth -exec rmdir {} + 2>/dev/null
echo " done!"
################################################
echo -n "Optimizing app databases............"
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /sdcard -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
echo " done!"
################################################
echo -n "Setting log permissions read-only..."
chmod 000 /data/tombstones
chmod 000 /data/system/dropbox
chmod 000 /data/system/graphicsstats
chmod 000 /data/system/procstats
chmod 000 /data/system/usagestats/0/daily
chmod 000 /data/system/usagestats/0/weekly
chmod 000 /data/system/usagestats/0/monthly
chmod 000 /data/system/usagestats/0/yearly
echo " done!"
echo
My setup now:
Oxygen 9.05 firmware
op3_recovery 3.3.1-0 from @anupritaisno1
Lineage OS 16
Flash kernel 3.18.140
No Google stuff, using FDroid and Aurora Store as playstores.
The idea was to have a topic where also other people would share their scripts, tweaks etc...
Am I really the only one tweaking a little around??

2Tweak said:
Am I really the only one tweaking a little around??
Click to expand...
Click to collapse
Seems so
Instead of disabling fsync try raising the fsync interval
The default is 5 seconds. Most filesystems will allow up to 300
It can be changed as:
Code:
mount -o commit=300,remount /data
Remember the higher you set it the higher the chance of data loss in case of system failure
Some filesystems will warn you in dmesg if you set the commit interval too high

anupritaisno1 said:
Seems so
Instead of disabling fsync try raising the fsync interval
The default is 5 seconds. Most filesystems will allow up to 300
It can be changed as:
Code:
mount -o commit=300,remount /data
Remember the higher you set it the higher the chance of data loss in case of system failure
Some filesystems will warn you in dmesg if you set the commit interval too high
Click to expand...
Click to collapse
Thanks, will give it a try.

2Tweak said:
Am I really the only one tweaking a little around??
Click to expand...
Click to collapse
I can think of some reasons:
- many people are over the use of scripts and just flash one of the magic magisk modules (up to debate if they are useful and if at all which of them)
- Lack of understanding which stuff is save to remove and what breaks if you do so (I struggle with this point myself) Maybe there is a neat list what the removed apks do? I mean most are pretty self explaining but not all.
Maybe my response is useless because I might not be part of the target audience but I'm still very grateful that you took your time to set up this thread and that you shared your findings and thoughts with us. I learned some new things by visiting this thread

SenseSei said:
I can think of some reasons:
- many people are over the use of scripts and just flash one of the magic magisk modules (up to debate if they are useful and if at all which of them)
- Lack of understanding which stuff is save to remove and what breaks if you do so (I struggle with this point myself) Maybe there is a neat list what the removed apks do? I mean most are pretty self explaining but not all.
Maybe my response is useless because I might not be part of the target audience but I'm still very grateful that you took your time to set up this thread and that you shared your findings and thoughts with us. I learned some new things by visiting this thread
Click to expand...
Click to collapse
Thanks for your response SenseSei, nice to hear you have learned something! :good:
That is how it works, with sharing information we all benefit!
I understand your comment about some kind of neat list of what apk's are doing.
In fact I have searched the internet a lot, but did not keep a list with explanations...
When I see an apk which is not on my list already and I do not know what it is doing, I simply search on the internet.
Then I can make my decision to remove it or not, test if it is not breaking other parts and add it to my list or not.
I was planning to switch to Glassrom last weekend, but because I am very happy with my Lineage installation at the moment AND Android 10 is on it's way, I have decided to keep using Lineage till the switch to 10.
This also means I switched back to my old behaviour; one script with removal of apk's, some tweaks in build.prop and userinit.sh and the deep clean included.
Keep in mind it is not wise to use this every day, Android need's time to settle and using this script every day will result in higher drain and wearage of your drive.
Some small things added / changed. For example I included the remount with raised fsync interval for /data instead of disabling fsync completely; a tip of @anupritaisno1. Based on some tips from him the script is also changed a little; removed some spaces and added quotes to improve riability. Font removal is back, though more fonts are kept to keep special characters in for example the weather app I am using. I added the removal of the live display stuff again because I am not using it. The 'PIS'-error is solved though, so therefor you do not need the live display removal anymore.
My setup still is:
- Firmware 9.05
- TWRP from anupritaisno1
- Lineage 16 latest nightly
- Flash kernel 3.18.140 latest (hardened kernel; fast, secure and stable)
- No Google stuff, using FDroid and AuroraStore for app installs and updates
Code:
#!/sbin/sh
#
# Script by 2Tweak
# Last modified 17-09-2019
################################################
# First setup
clear
echo
echo "##########################################"
echo "# LINEAGE CLEANUP SCRIPT #"
echo "##########################################"
echo
mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system
################################################
echo -n "Shrinking ROM to the bare minimum..."
# app list to remove
applist="
AntHalService
AudioFX
BackupRestoreConfirmation
BasicDreams
BluetoothMidiService
BookmarkProvider
BuiltInPrintService
Calendar
CaptivePortalLogin
CNEService
CallLogBackup
CellBroadcastReceiver
CompanionDeviceManager
com.qualcomm.location
Contacts
CtsShimPrebuilt
CtsShimPrivPrebuilt
Development
DocumentsUI
EasterEgg
Eleven
Email
ExactCalculator
Exchange2
Gallery2
HTMLViewer
InputDevices
Jelly
LineageSetupWizard
LiveWallpapersPicker
LockClock
ManagedProvisioning
OneTimeInitializer
OneplusDoze
OneplusPocketMode
PhotoTable
PrintRecommendationService
SharedStorageBackup
SimAppDialog
Stk
Tag
Terminal
Traceur
Updater
UserDictionaryProvider
VpnDialogs
WallpaperBackup
WallpaperCropper
WeatherProvider
WfdService
"
for appname in $applist
do
if [ -e /system/app/"$appname" ]; then
chmod -R 777 /system/app/"$appname"
rm -rf /system/app/"$appname"
fi
if [ -e /system/priv-app/"$appname" ]; then
chmod -R 777 /system/priv-app/"$appname"
rm -rf /system/priv-app/"$appname"
fi
done
echo " done!"
################################################
echo -n "Removing unneeded and junk files...."
# file list to cleanup
filelist="
/cache
/data/anr
/data/backup
/data/cache
/data/dalvik-cache
/data/lineageos_updates
/data/local/tmp
/data/lost+found
/data/misc/bootstat
/data/ota
/data/ota_package
/data/resource-cache
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/package_cache
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/daily
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/tombstones
/system/bin/bootanimation
/system/media/bootanimation.zip
"
for filename in $filelist
do
if [ -d "$filename" ]; then
chmod -R 777 "$filename"
rm -rf "${filename:?}"/*
fi
if [ -f "$filename" ]; then
chmod 777 "$filename"
rm -f "$filename"
fi
done
# Remove bak, log, tmp files
find /data -iname "*.bak" -iname "*.log" -iname "*.tmp" -iname "*.odex" -iname "*.vdex" -type f -exec rm -f {} +
find /system -iname "*.bak" -iname "*.log" -iname "*.tmp" -type f -exec rm -f {} +
# Reduce fonts to the bare minimum
find /system/fonts ! -iname "*roboto*.*" ! -name "DroidSansMono.ttf" ! -name "NotoColorEmoji.ttf" -name "NotoSansSymbols-Regular-Subsetted*.ttf" -type f -exec rm -f {} +
# Some other useless system related files
rm -f /data/stock_boot_*.img.gz
rm -rf /system/vendor/overlay
echo " done!"
################################################
echo -n "Cleaning app data..................."
for i in $(ls /data/data/)
do
if [ -e /data/data/"$i"/cache ]; then
chmod -R 777 /data/data/"$i"/cache
rm -rf /data/data/"$i"/cache/*
fi
if [ -e /data/data/"$i"/code_cache ]; then
chmod -R 777 /data/data/"$i"/code_cache
rm -rf /data/data/"$i"/code_cache/*
fi
if [ -e /data/data/"$i"/files/.Fabric ]; then
chmod -R 777 /data/data/"$i"/files/.Fabric
rm -rf /data/data/"$i"/files/.Fabric/*
fi
if [ -e /data/data/"$i"/files/cache ]; then
chmod -R 777 /data/data/"$i"/files/cache
rm -rf /data/data/"$i"/files/cache/*
fi
if [ -e /data/data/"$i"/app_webview ]; then
chmod -R 777 /data/data/"$i"/app_webview
# keep cookies for webapp logins
if [ -e /data/data/"$i"/app_webview/Cookies ]; then
mv -f /data/data/"$i"/app_webview/Cookies /data/local/tmp/"$i".Cookies
fi
rm -rf /data/data/"$i"/app_webview/*
if [ -e /data/local/tmp/"$i".Cookies ]; then
mv -f /data/local/tmp/"$i".Cookies /data/data/"$i"/app_webview/Cookies
fi
fi
done
for k in $(ls /sdcard/Android/data/)
do
if [ -e /sdcard/Android/data/"$k"/cache ]; then
chmod -R 777 /sdcard/Android/data/"$k"/cache
rm -rf /sdcard/Android/data/"$k"/cache/*
fi
done
echo " done!"
################################################
echo -n "Cleaning app oat files.............."
for j in $(ls /data/app/)
do
if [ -e /data/app/"$j"/oat/arm ]; then
chmod -R 777 /data/app/"$j"/oat/arm
rm -rf /data/app/"$j"/oat/arm/*
fi
if [ -e /data/app/"$j"/oat/arm64 ]; then
chmod -R 777 /data/app/"$j"/oat/arm64
rm -rf /data/app/"$j"/oat/arm64/*
fi
done
echo " done!"
################################################
echo -n "Remove some app specific files......"
# App specific
rm -rf /data/data/com.abnamro.nl.mobile.payments/app_dex/oat/arm64/*
rm -rf /data/data/org.fdroid.fdroid/files/*.apk
rm -rf /data/data/org.videolan.vlc/app_vlc/*
echo " done!"
################################################
echo -n "Optimizing app databases............"
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done
for i in $(find /sdcard -iname "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done
echo " done!"
################################################
echo -n "Remove live display functionality..."
rm -f '/system/vendor/bin/hw/[email protected]'
rm -f '/system/vendor/etc/init/[email protected]'
fname="/system/vendor/etc/vintf/manifest.xml"
found=0
startstop=0
tstr=""
nstr=""
IFS=$'\n'
while read line
do
if [[ "$line" == *'<hal'* ]]; then
startstop=1
elif [[ "$line" == *'</hal'* ]]; then
startstop=2
elif [[ "$line" == *'livedisplay'* ]]; then
found=1
fi
if [ $startstop -eq 1 ]; then
tstr="${tstr}\n${line}"
elif [ $startstop -eq 2 ]; then
tstr="${tstr}\n${line}"
if [ $found -eq 0 ]; then
nstr="${nstr}${tstr}"
else
found=0
fi
tstr=""
startstop=0
else
if [ "$nstr" == "" ]; then
nstr="${line}"
else
nstr="${nstr}\n${line}"
fi
fi
done <"$fname"
echo $nstr > $fname
echo " done!"
################################################
echo -n "Remove empty directories............"
# Remove empty directories
find /data/data -type d -depth -exec rmdir {} + 2>/dev/null
find /sdcard -type d -depth -exec rmdir {} + 2>/dev/null
echo " done!"
################################################
echo -n "Setting log permissions read-only..."
chmod 000 /data/tombstones
chmod 000 /data/system/dropbox
chmod 000 /data/system/graphicsstats
chmod 000 /data/system/procstats
chmod 000 /data/system/usagestats/0/daily
chmod 000 /data/system/usagestats/0/weekly
chmod 000 /data/system/usagestats/0/monthly
chmod 000 /data/system/usagestats/0/yearly
echo " done!"
################################################
echo -n "Adding my build.prop settings......."
fname="/system/build.prop"
tmpvar=$(sed '/.*My settings.*/{s///;q;}' $fname | sed '$d')
echo "$tmpvar" > $fname
echo '
# My settings
# Disable multi user
fw.max_users=1
fw.show_multiuserui=0
fw.show_hidden_users=0
fw.power_user_switcher=0
# Disable logging
logcat.live=disable
# Disable boot animation
debug.sf.nobootanimation=1
# Disable USB debugging notification
persist.adb.notify=0
# Disable ring delay
ro.telephony.call_ring.delay=0
ring.delay=0
# Remove fps limit
debug.gr.swapinterval=0
# Disable dithering
persist.sys.use_dithering=0
# Disable scrolling cache
persist.sys.scrollingcache=4
# End of my settings
' >> $fname
chmod 644 $fname
echo " done!"
################################################
echo -n "Adding my gps.conf settings........."
rm -f /system/vendor/etc/gps.conf
touch /system/vendor/etc/gps.conf
echo '# My settings
# NTP Server - only one allowed!
NTP_SERVER=nl.pool.ntp.org
# Debug level
DEBUG_LEVEL=0
# End of my settings
' > /system/vendor/etc/gps.conf
chmod 644 /system/vendor/etc/gps.conf
echo " done!"
################################################
echo -n "Adding my userinit.sh settings......"
echo '#!/system/bin/sh
# My settings
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /storage/emulated/0 -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
# Instead of disabling fsync remount with higher fsync interval
mount -o remount,rw,commit=300 /data
# Enable power_efficient workqueue
chmod 666 /sys/module/workqueue/parameters/power_efficient
echo 1 > /sys/module/workqueue/parameters/power_efficient
chmod 444 /sys/module/workqueue/parameters/power_efficient
# Disable iostats
chmod 666 /sys/block/sda/queue/iostats
echo "0" > /sys/block/sda/queue/iostats
chmod 444 /sys/block/sda/queue/iostats
# When there, use Boeffla to disable some wakelocks
if [ -e /sys/devices/virtual/misc/boeffla_wakelock_blocker ]; then
echo "IPA_WS;NETLINK;bms;netmgr_wl;qcom_rx_wakelock;sensor_SMD;wlan;wlan_extscan_wl;wlan_ipa;wlan_pno_wl;wlan_wow_wl" > /sys/devices/virtual/misc/boeffla_wakelock_blocker/wakelock_blocker
fi
# End of my settings
' > /data/local/userinit.sh
chmod 777 /data/local/userinit.sh
echo " done!"
echo

2Tweak said:
Thanks for your response SenseSei, nice to hear you have learned something! :good:
That is how it works, with sharing information we all benefit!
I understand your comment about some kind of neat list of what apk's are doing.
In fact I have searched the internet a lot, but did not keep a list with explanations...
When I see an apk which is not on my list already and I do not know what it is doing, I simply search on the internet.
Then I can make my decision to remove it or not, test if it is not breaking other parts and add it to my list or not.
I was planning to switch to Glassrom last weekend, but because I am very happy with my Lineage installation at the moment AND Android 10 is on it's way, I have decided to keep using Lineage till the switch to 10.
This also means I switched back to my old behaviour; one script with removal of apk's, some tweaks in build.prop and userinit.sh and the deep clean included.
Keep in mind it is not wise to use this every day, Android need's time to settle and using this script every day will result in higher drain and wearage of your drive.
Some small things added / changed. For example I included the remount with raised fsync interval for /data instead of disabling fsync completely; a tip of @anupritaisno1. Based on some tips from him the script is also changed a little; removed some spaces and added quotes to improve riability. Font removal is back, though more fonts are kept to keep special characters in for example the weather app I am using. I added the removal of the live display stuff again because I am not using it. The 'PIS'-error is solved though, so therefor you do not need the live display removal anymore.
My setup still is:
- Firmware 9.05
- TWRP from anupritaisno1
- Lineage 16 latest nightly
- Flash kernel 3.18.140 latest (hardened kernel; fast, secure and stable)
- No Google stuff, using FDroid and AuroraStore for app installs and updates
Code:
#!/sbin/sh
#
# Script by 2Tweak
# Last modified 17-09-2019
################################################
# First setup
clear
echo
echo "##########################################"
echo "# LINEAGE CLEANUP SCRIPT #"
echo "##########################################"
echo
mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system
################################################
echo -n "Shrinking ROM to the bare minimum..."
# app list to remove
applist="
AntHalService
AudioFX
BackupRestoreConfirmation
BasicDreams
BluetoothMidiService
BookmarkProvider
BuiltInPrintService
Calendar
CaptivePortalLogin
CNEService
CallLogBackup
CellBroadcastReceiver
CompanionDeviceManager
com.qualcomm.location
Contacts
CtsShimPrebuilt
CtsShimPrivPrebuilt
Development
DocumentsUI
EasterEgg
Eleven
Email
ExactCalculator
Exchange2
Gallery2
HTMLViewer
InputDevices
Jelly
LineageSetupWizard
LiveWallpapersPicker
LockClock
ManagedProvisioning
OneTimeInitializer
OneplusDoze
OneplusPocketMode
PhotoTable
PrintRecommendationService
SharedStorageBackup
SimAppDialog
Stk
Tag
Terminal
Traceur
Updater
UserDictionaryProvider
VpnDialogs
WallpaperBackup
WallpaperCropper
WeatherProvider
WfdService
"
for appname in $applist
do
if [ -e /system/app/"$appname" ]; then
chmod -R 777 /system/app/"$appname"
rm -rf /system/app/"$appname"
fi
if [ -e /system/priv-app/"$appname" ]; then
chmod -R 777 /system/priv-app/"$appname"
rm -rf /system/priv-app/"$appname"
fi
done
echo " done!"
################################################
echo -n "Removing unneeded and junk files...."
# file list to cleanup
filelist="
/cache
/data/anr
/data/backup
/data/cache
/data/dalvik-cache
/data/lineageos_updates
/data/local/tmp
/data/lost+found
/data/misc/bootstat
/data/ota
/data/ota_package
/data/resource-cache
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/package_cache
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/daily
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/tombstones
/system/bin/bootanimation
/system/media/bootanimation.zip
"
for filename in $filelist
do
if [ -d "$filename" ]; then
chmod -R 777 "$filename"
rm -rf "${filename:?}"/*
fi
if [ -f "$filename" ]; then
chmod 777 "$filename"
rm -f "$filename"
fi
done
# Remove bak, log, tmp files
find /data -iname "*.bak" -iname "*.log" -iname "*.tmp" -iname "*.odex" -iname "*.vdex" -type f -exec rm -f {} +
find /system -iname "*.bak" -iname "*.log" -iname "*.tmp" -type f -exec rm -f {} +
# Reduce fonts to the bare minimum
find /system/fonts ! -iname "*roboto*.*" ! -name "DroidSansMono.ttf" ! -name "NotoColorEmoji.ttf" -name "NotoSansSymbols-Regular-Subsetted*.ttf" -type f -exec rm -f {} +
# Some other useless system related files
rm -f /data/stock_boot_*.img.gz
rm -rf /system/vendor/overlay
echo " done!"
################################################
echo -n "Cleaning app data..................."
for i in $(ls /data/data/)
do
if [ -e /data/data/"$i"/cache ]; then
chmod -R 777 /data/data/"$i"/cache
rm -rf /data/data/"$i"/cache/*
fi
if [ -e /data/data/"$i"/code_cache ]; then
chmod -R 777 /data/data/"$i"/code_cache
rm -rf /data/data/"$i"/code_cache/*
fi
if [ -e /data/data/"$i"/files/.Fabric ]; then
chmod -R 777 /data/data/"$i"/files/.Fabric
rm -rf /data/data/"$i"/files/.Fabric/*
fi
if [ -e /data/data/"$i"/files/cache ]; then
chmod -R 777 /data/data/"$i"/files/cache
rm -rf /data/data/"$i"/files/cache/*
fi
if [ -e /data/data/"$i"/app_webview ]; then
chmod -R 777 /data/data/"$i"/app_webview
# keep cookies for webapp logins
if [ -e /data/data/"$i"/app_webview/Cookies ]; then
mv -f /data/data/"$i"/app_webview/Cookies /data/local/tmp/"$i".Cookies
fi
rm -rf /data/data/"$i"/app_webview/*
if [ -e /data/local/tmp/"$i".Cookies ]; then
mv -f /data/local/tmp/"$i".Cookies /data/data/"$i"/app_webview/Cookies
fi
fi
done
for k in $(ls /sdcard/Android/data/)
do
if [ -e /sdcard/Android/data/"$k"/cache ]; then
chmod -R 777 /sdcard/Android/data/"$k"/cache
rm -rf /sdcard/Android/data/"$k"/cache/*
fi
done
echo " done!"
################################################
echo -n "Cleaning app oat files.............."
for j in $(ls /data/app/)
do
if [ -e /data/app/"$j"/oat/arm ]; then
chmod -R 777 /data/app/"$j"/oat/arm
rm -rf /data/app/"$j"/oat/arm/*
fi
if [ -e /data/app/"$j"/oat/arm64 ]; then
chmod -R 777 /data/app/"$j"/oat/arm64
rm -rf /data/app/"$j"/oat/arm64/*
fi
done
echo " done!"
################################################
echo -n "Remove some app specific files......"
# App specific
rm -rf /data/data/com.abnamro.nl.mobile.payments/app_dex/oat/arm64/*
rm -rf /data/data/org.fdroid.fdroid/files/*.apk
rm -rf /data/data/org.videolan.vlc/app_vlc/*
echo " done!"
################################################
echo -n "Optimizing app databases............"
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done
for i in $(find /sdcard -iname "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done
echo " done!"
################################################
echo -n "Remove live display functionality..."
rm -f '/system/vendor/bin/hw/[email protected]'
rm -f '/system/vendor/etc/init/[email protected]'
fname="/system/vendor/etc/vintf/manifest.xml"
found=0
startstop=0
tstr=""
nstr=""
IFS=$'\n'
while read line
do
if [[ "$line" == *'<hal'* ]]; then
startstop=1
elif [[ "$line" == *'</hal'* ]]; then
startstop=2
elif [[ "$line" == *'livedisplay'* ]]; then
found=1
fi
if [ $startstop -eq 1 ]; then
tstr="${tstr}\n${line}"
elif [ $startstop -eq 2 ]; then
tstr="${tstr}\n${line}"
if [ $found -eq 0 ]; then
nstr="${nstr}${tstr}"
else
found=0
fi
tstr=""
startstop=0
else
if [ "$nstr" == "" ]; then
nstr="${line}"
else
nstr="${nstr}\n${line}"
fi
fi
done <"$fname"
echo $nstr > $fname
echo " done!"
################################################
echo -n "Remove empty directories............"
# Remove empty directories
find /data/data -type d -depth -exec rmdir {} + 2>/dev/null
find /sdcard -type d -depth -exec rmdir {} + 2>/dev/null
echo " done!"
################################################
echo -n "Setting log permissions read-only..."
chmod 000 /data/tombstones
chmod 000 /data/system/dropbox
chmod 000 /data/system/graphicsstats
chmod 000 /data/system/procstats
chmod 000 /data/system/usagestats/0/daily
chmod 000 /data/system/usagestats/0/weekly
chmod 000 /data/system/usagestats/0/monthly
chmod 000 /data/system/usagestats/0/yearly
echo " done!"
################################################
echo -n "Adding my build.prop settings......."
fname="/system/build.prop"
tmpvar=$(sed '/.*My settings.*/{s///;q;}' $fname | sed '$d')
echo "$tmpvar" > $fname
echo '
# My settings
# Disable multi user
fw.max_users=1
fw.show_multiuserui=0
fw.show_hidden_users=0
fw.power_user_switcher=0
# Disable logging
logcat.live=disable
# Disable boot animation
debug.sf.nobootanimation=1
# Disable USB debugging notification
persist.adb.notify=0
# Disable ring delay
ro.telephony.call_ring.delay=0
ring.delay=0
# Remove fps limit
debug.gr.swapinterval=0
# Disable dithering
persist.sys.use_dithering=0
# Disable scrolling cache
persist.sys.scrollingcache=4
# End of my settings
' >> $fname
chmod 644 $fname
echo " done!"
################################################
echo -n "Adding my gps.conf settings........."
rm -f /system/vendor/etc/gps.conf
touch /system/vendor/etc/gps.conf
echo '# My settings
# NTP Server - only one allowed!
NTP_SERVER=nl.pool.ntp.org
# Debug level
DEBUG_LEVEL=0
# End of my settings
' > /system/vendor/etc/gps.conf
chmod 644 /system/vendor/etc/gps.conf
echo " done!"
################################################
echo -n "Adding my userinit.sh settings......"
echo '#!/system/bin/sh
# My settings
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /storage/emulated/0 -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
# Instead of disabling fsync remount with higher fsync interval
mount -o remount,rw,commit=300 /data
# Enable power_efficient workqueue
chmod 666 /sys/module/workqueue/parameters/power_efficient
echo 1 > /sys/module/workqueue/parameters/power_efficient
chmod 444 /sys/module/workqueue/parameters/power_efficient
# Disable iostats
chmod 666 /sys/block/sda/queue/iostats
echo "0" > /sys/block/sda/queue/iostats
chmod 444 /sys/block/sda/queue/iostats
# When there, use Boeffla to disable some wakelocks
if [ -e /sys/devices/virtual/misc/boeffla_wakelock_blocker ]; then
echo "IPA_WS;NETLINK;bms;netmgr_wl;qcom_rx_wakelock;sensor_SMD;wlan;wlan_extscan_wl;wlan_ipa;wlan_pno_wl;wlan_wow_wl" > /sys/devices/virtual/misc/boeffla_wakelock_blocker/wakelock_blocker
fi
# End of my settings
' > /data/local/userinit.sh
chmod 777 /data/local/userinit.sh
echo " done!"
echo
Click to expand...
Click to collapse
Fixed it some more
Code:
# Script by 2Tweak
# Last modified 17-09-2019
################################################
# First setup
clear
echo
echo "##########################################"
echo "# LINEAGE CLEANUP SCRIPT #"
echo "##########################################"
echo
mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system
################################################
echo -n "Shrinking ROM to the bare minimum..."
# app list to remove
applist="
AntHalService
AudioFX
BackupRestoreConfirmation
BasicDreams
BluetoothMidiService
BookmarkProvider
BuiltInPrintService
Calendar
CaptivePortalLogin
CNEService
CallLogBackup
CellBroadcastReceiver
CompanionDeviceManager
com.qualcomm.location
Contacts
CtsShimPrebuilt
CtsShimPrivPrebuilt
Development
DocumentsUI
EasterEgg
Eleven
Email
ExactCalculator
Exchange2
Gallery2
HTMLViewer
InputDevices
Jelly
LineageSetupWizard
LiveWallpapersPicker
LockClock
ManagedProvisioning
OneTimeInitializer
OneplusDoze
OneplusPocketMode
PhotoTable
PrintRecommendationService
SharedStorageBackup
SimAppDialog
Stk
Tag
Terminal
Traceur
Updater
UserDictionaryProvider
VpnDialogs
WallpaperBackup
WallpaperCropper
WeatherProvider
WfdService
"
for appname in $applist
do
if [ -e /system/app/"$appname" ]; then
chmod -R 777 /system/app/"$appname"
rm -rf /system/app/"$appname"
fi
if [ -e /system/priv-app/"$appname" ]; then
chmod -R 777 /system/priv-app/"$appname"
rm -rf /system/priv-app/"$appname"
fi
done
echo " done!"
################################################
echo -n "Removing unneeded and junk files...."
# file list to cleanup
filelist="
/cache
/data/anr
/data/backup
/data/cache
/data/dalvik-cache
/data/lineageos_updates
/data/local/tmp
/data/lost+found
/data/misc/bootstat
/data/ota
/data/ota_package
/data/resource-cache
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/package_cache
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/daily
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/tombstones
/system/bin/bootanimation
/system/media/bootanimation.zip
"
for filename in $filelist
do
if [ -d "$filename" ]; then
chmod -R 777 "$filename"
rm -rf "${filename:?}"/*
fi
if [ -f "$filename" ]; then
chmod 777 "$filename"
rm -f "$filename"
fi
done
# Remove bak, log, tmp files
find /data -iname "*.bak" -iname "*.log" -iname "*.tmp" -iname "*.odex" -iname "*.vdex" -type f -exec rm -f {} +
find /system -iname "*.bak" -iname "*.log" -iname "*.tmp" -type f -exec rm -f {} +
# Reduce fonts to the bare minimum
find /system/fonts ! -iname "*roboto*.*" ! -name "DroidSansMono.ttf" ! -name "NotoColorEmoji.ttf" -name "NotoSansSymbols-Regular-Subsetted*.ttf" -type f -exec rm -f {} +
# Some other useless system related files
rm -f /data/stock_boot_*.img.gz
rm -rf /system/vendor/overlay
echo " done!"
################################################
echo -n "Cleaning app data..................."
for i in $(ls /data/data/)
do
if [ -e /data/data/"$i"/cache ]; then
chmod -R 777 /data/data/"$i"/cache
rm -rf /data/data/"$i"/cache/*
fi
if [ -e /data/data/"$i"/code_cache ]; then
chmod -R 777 /data/data/"$i"/code_cache
rm -rf /data/data/"$i"/code_cache/*
fi
if [ -e /data/data/"$i"/files/.Fabric ]; then
chmod -R 777 /data/data/"$i"/files/.Fabric
rm -rf /data/data/"$i"/files/.Fabric/*
fi
if [ -e /data/data/"$i"/files/cache ]; then
chmod -R 777 /data/data/"$i"/files/cache
rm -rf /data/data/"$i"/files/cache/*
fi
if [ -e /data/data/"$i"/app_webview ]; then
chmod -R 777 /data/data/"$i"/app_webview
# keep cookies for webapp logins
if [ -e /data/data/"$i"/app_webview/Cookies ]; then
mv -f /data/data/"$i"/app_webview/Cookies /data/local/tmp/"$i".Cookies
fi
rm -rf /data/data/"$i"/app_webview/*
if [ -e /data/local/tmp/"$i".Cookies ]; then
mv -f /data/local/tmp/"$i".Cookies /data/data/"$i"/app_webview/Cookies
fi
fi
done
for k in $(ls /sdcard/Android/data/)
do
if [ -e /sdcard/Android/data/"$k"/cache ]; then
chmod -R 777 /sdcard/Android/data/"$k"/cache
rm -rf /sdcard/Android/data/"$k"/cache/*
fi
done
echo " done!"
################################################
echo -n "Cleaning app oat files.............."
for j in $(ls /data/app/)
do
if [ -e /data/app/"$j"/oat/arm ]; then
chmod -R 777 /data/app/"$j"/oat/arm
rm -rf /data/app/"$j"/oat/arm/*
fi
if [ -e /data/app/"$j"/oat/arm64 ]; then
chmod -R 777 /data/app/"$j"/oat/arm64
rm -rf /data/app/"$j"/oat/arm64/*
fi
done
echo " done!"
################################################
echo -n "Remove some app specific files......"
# App specific
rm -rf /data/data/com.abnamro.nl.mobile.payments/app_dex/oat/arm64/*
rm -rf /data/data/org.fdroid.fdroid/files/*.apk
rm -rf /data/data/org.videolan.vlc/app_vlc/*
echo " done!"
################################################
echo -n "Optimizing app databases............"
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done
for i in $(find /sdcard -iname "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done
echo " done!"
################################################
echo -n "Remove live display functionality..."
rm -f '/system/vendor/bin/hw/[email protected]'
rm -f '/system/vendor/etc/init/[email protected]'
fname="/system/vendor/etc/vintf/manifest.xml"
found=0
startstop=0
tstr=""
nstr=""
IFS=$'\n'
while read line
do
if [[ "$line" == *'<hal'* ]]; then
startstop=1
elif [[ "$line" == *'</hal'* ]]; then
startstop=2
elif [[ "$line" == *'livedisplay'* ]]; then
found=1
fi
if [ $startstop -eq 1 ]; then
tstr="${tstr}\n${line}"
elif [ $startstop -eq 2 ]; then
tstr="${tstr}\n${line}"
if [ $found -eq 0 ]; then
nstr="${nstr}${tstr}"
else
found=0
fi
tstr=""
startstop=0
else
if [ "$nstr" == "" ]; then
nstr="${line}"
else
nstr="${nstr}\n${line}"
fi
fi
done <"$fname"
echo "$nstr" > $fname
echo " done!"
################################################
echo -n "Remove empty directories............"
# Remove empty directories
find /data/data -type d -depth -exec rmdir {} + 2>/dev/null
find /sdcard -type d -depth -exec rmdir {} + 2>/dev/null
echo " done!"
################################################
echo -n "Setting log permissions read-only..."
chmod 000 /data/tombstones
chmod 000 /data/system/dropbox
chmod 000 /data/system/graphicsstats
chmod 000 /data/system/procstats
chmod 000 /data/system/usagestats/0/daily
chmod 000 /data/system/usagestats/0/weekly
chmod 000 /data/system/usagestats/0/monthly
chmod 000 /data/system/usagestats/0/yearly
echo " done!"
################################################
echo -n "Adding my build.prop settings......."
fname="/system/build.prop"
tmpvar=$(sed '/.*My settings.*/{s///;q;}' $fname | sed '$d')
echo "$tmpvar" > $fname
echo '
# My settings
# Disable multi user
fw.max_users=1
fw.show_multiuserui=0
fw.show_hidden_users=0
fw.power_user_switcher=0
# Disable logging
logcat.live=disable
# Disable boot animation
debug.sf.nobootanimation=1
# Disable USB debugging notification
persist.adb.notify=0
# Disable ring delay
ro.telephony.call_ring.delay=0
ring.delay=0
# Remove fps limit
debug.gr.swapinterval=0
# Disable dithering
persist.sys.use_dithering=0
# Disable scrolling cache
persist.sys.scrollingcache=4
# End of my settings
' >> $fname
chmod 644 $fname
echo " done!"
################################################
echo -n "Adding my gps.conf settings........."
rm -f /system/vendor/etc/gps.conf
touch /system/vendor/etc/gps.conf
echo '# My settings
# NTP Server - only one allowed!
NTP_SERVER=nl.pool.ntp.org
# Debug level
DEBUG_LEVEL=0
# End of my settings
' > /system/vendor/etc/gps.conf
chmod 644 /system/vendor/etc/gps.conf
echo " done!"
################################################
echo -n "Adding my userinit.sh settings......"
echo '#!/system/bin/sh
# My settings
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /storage/emulated/0 -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
# Instead of disabling fsync remount with higher fsync interval
mount -o remount,rw,commit=300 /data
# Enable power_efficient workqueue
chmod 666 /sys/module/workqueue/parameters/power_efficient
echo 1 > /sys/module/workqueue/parameters/power_efficient
chmod 444 /sys/module/workqueue/parameters/power_efficient
# Disable iostats
chmod 666 /sys/block/sda/queue/iostats
echo "0" > /sys/block/sda/queue/iostats
chmod 444 /sys/block/sda/queue/iostats
# When there, use Boeffla to disable some wakelocks
if [ -e /sys/devices/virtual/misc/boeffla_wakelock_blocker ]; then
echo "IPA_WS;NETLINK;bms;netmgr_wl;qcom_rx_wakelock;sensor_SMD;wlan;wlan_extscan_wl;wlan_ipa;wlan_pno_wl;wlan_wow_wl" > /sys/devices/virtual/misc/boeffla_wakelock_blocker/wakelock_blocker
fi
# End of my settings
' > /data/local/userinit.sh
chmod 777 /data/local/userinit.sh
echo " done!"
echo

anupritaisno1 said:
Fixed it some more
Code:
<cut>
Click to expand...
Click to collapse
I compared both scripts, but why did you remove the first two lines?
Further you added quotes for the echo command:
Code:
echo "$nstr" > $fname
which is indeed a good one; thanks!
Further any changes?

The latest script for Pie I guess, seeing a lot of Android 10 activity and always been an early adapter....
Some changes:
Switched back to LibreChair as launcher. Very nice option is the ability to shape your own icons (see screenshot)
Really like Apkgrabber and Aurora, so using the combi Aurora Droid, Aurora Store (wo automatic update) and Apkgrabber now instead of GPS.
Added New Pipe and Transistor to my apps but has nothing to do with the basic setup
Setup still:
Firmware 9.05
TWRP from anupritaisno1
Latest Lineage Nightly 16.0 (Pie)
Latest Flash Kernel (3.18.140)
Further the tweak and cleanup script is pretty stable now.
Nothing to optimise or other tweaks I want to implement, so here the latest lineage.sh (also added as attachment):
Code:
#!/sbin/sh
#
# Script by 2Tweak
# Last modified 21-09-2019
################################################
# First setup
clear
echo
echo "##########################################"
echo "# LINEAGE CLEANUP SCRIPT #"
echo "##########################################"
echo
mount -o remount,rw /cache
mount -o remount,rw /data
mount -o remount,rw /sdcard
mount -o remount,rw /system
################################################
echo -n "Shrinking ROM to the bare minimum..."
# app list to remove
applist="
AntHalService
AudioFX
BackupRestoreConfirmation
BasicDreams
BluetoothMidiService
BookmarkProvider
BuiltInPrintService
Calendar
CaptivePortalLogin
CNEService
CallLogBackup
CellBroadcastReceiver
CompanionDeviceManager
com.qualcomm.location
Contacts
CtsShimPrebuilt
CtsShimPrivPrebuilt
Development
DocumentsUI
EasterEgg
Eleven
Email
ExactCalculator
Exchange2
Gallery2
HTMLViewer
InputDevices
Jelly
LineageSetupWizard
LiveWallpapersPicker
LockClock
ManagedProvisioning
OneTimeInitializer
OneplusDoze
OneplusPocketMode
PhotoTable
PrintRecommendationService
SharedStorageBackup
SimAppDialog
Stk
Tag
Terminal
Traceur
TrebuchetQuickStep
Updater
UserDictionaryProvider
VpnDialogs
WallpaperBackup
WallpaperCropper
WeatherProvider
WfdService
"
for appname in $applist
do
if [ -e /system/app/"$appname" ]; then
chmod -R 777 /system/app/"$appname"
rm -rf /system/app/"$appname"
fi
if [ -e /system/priv-app/"$appname" ]; then
chmod -R 777 /system/priv-app/"$appname"
rm -rf /system/priv-app/"$appname"
fi
done
echo " done!"
################################################
echo -n "Removing unneeded and junk files...."
# file list to cleanup
filelist="
/cache
/data/anr
/data/backup
/data/cache
/data/dalvik-cache
/data/lineageos_updates
/data/local/tmp
/data/lost+found
/data/misc/bootstat
/data/ota
/data/ota_package
/data/resource-cache
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/package_cache
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/daily
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/tombstones
/system/bin/bootanimation
/system/media/bootanimation.zip
"
for filename in $filelist
do
if [ -d "$filename" ]; then
chmod -R 777 "$filename"
rm -rf "${filename:?}"/*
fi
if [ -f "$filename" ]; then
chmod 777 "$filename"
rm -f "$filename"
fi
done
# Remove bak, log, tmp files
find /data -iname "*.bak" -iname "*.log" -iname "*.tmp" -iname "*.odex" -iname "*.vdex" -type f -exec rm -f {} +
find /system -iname "*.bak" -iname "*.log" -iname "*.tmp" -type f -exec rm -f {} +
# Reduce fonts to the bare minimum
find /system/fonts ! -iname "*roboto*.*" ! -name "DroidSansMono.ttf" ! -name "NotoColorEmoji.ttf" -name "NotoSansSymbols-Regular-Subsetted*.ttf" -type f -exec rm -f {} +
# Some other useless system related files
rm -f /data/stock_boot_*.img.gz
rm -rf /system/vendor/overlay
echo " done!"
################################################
echo -n "Cleaning app data..................."
for i in $(ls /data/data/)
do
if [ -e /data/data/"$i"/cache ]; then
chmod -R 777 /data/data/"$i"/cache
rm -rf /data/data/"$i"/cache/*
fi
if [ -e /data/data/"$i"/code_cache ]; then
chmod -R 777 /data/data/"$i"/code_cache
rm -rf /data/data/"$i"/code_cache/*
fi
if [ -e /data/data/"$i"/files/.Fabric ]; then
chmod -R 777 /data/data/"$i"/files/.Fabric
rm -rf /data/data/"$i"/files/.Fabric/*
fi
if [ -e /data/data/"$i"/files/cache ]; then
chmod -R 777 /data/data/"$i"/files/cache
rm -rf /data/data/"$i"/files/cache/*
fi
if [ -e /data/data/"$i"/app_webview ]; then
chmod -R 777 /data/data/"$i"/app_webview
# keep cookies for webapp logins
if [ -e /data/data/"$i"/app_webview/Cookies ]; then
mv -f /data/data/"$i"/app_webview/Cookies /data/local/tmp/"$i".Cookies
fi
rm -rf /data/data/"$i"/app_webview/*
if [ -e /data/local/tmp/"$i".Cookies ]; then
mv -f /data/local/tmp/"$i".Cookies /data/data/"$i"/app_webview/Cookies
fi
fi
done
for k in $(ls /sdcard/Android/data/)
do
if [ -e /sdcard/Android/data/"$k"/cache ]; then
chmod -R 777 /sdcard/Android/data/"$k"/cache
rm -rf /sdcard/Android/data/"$k"/cache/*
fi
done
echo " done!"
################################################
echo -n "Cleaning app oat files.............."
for j in $(ls /data/app/)
do
if [ -e /data/app/"$j"/oat/arm ]; then
chmod -R 777 /data/app/"$j"/oat/arm
rm -rf /data/app/"$j"/oat/arm/*
fi
if [ -e /data/app/"$j"/oat/arm64 ]; then
chmod -R 777 /data/app/"$j"/oat/arm64
rm -rf /data/app/"$j"/oat/arm64/*
fi
done
echo " done!"
################################################
echo -n "Remove some app specific files......"
# App specific
rm -rf /data/data/com.abnamro.nl.mobile.payments/app_dex/oat/arm64/*
rm -rf /data/data/org.fdroid.fdroid/files/*.apk
rm -rf /data/data/org.videolan.vlc/app_vlc/*
echo " done!"
################################################
echo -n "Optimizing app databases............"
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done
for i in $(find /sdcard -iname "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done
echo " done!"
################################################
echo -n "Remove live display functionality..."
rm -f '/system/vendor/bin/hw/[email protected]'
rm -f '/system/vendor/etc/init/[email protected]'
fname="/system/vendor/etc/vintf/manifest.xml"
found=0
startstop=0
tstr=""
nstr=""
IFS=$'\n'
while read line
do
if [[ "$line" == *'<hal'* ]]; then
startstop=1
elif [[ "$line" == *'</hal'* ]]; then
startstop=2
elif [[ "$line" == *'livedisplay'* ]]; then
found=1
fi
if [ $startstop -eq 1 ]; then
tstr="${tstr}\n${line}"
elif [ $startstop -eq 2 ]; then
tstr="${tstr}\n${line}"
if [ $found -eq 0 ]; then
nstr="${nstr}${tstr}"
else
found=0
fi
tstr=""
startstop=0
else
if [ "$nstr" == "" ]; then
nstr="${line}"
else
nstr="${nstr}\n${line}"
fi
fi
done <"$fname"
echo "$nstr" > $fname
echo " done!"
################################################
echo -n "Remove empty directories............"
# Remove empty directories
find /data/data -type d -depth -exec rmdir {} + 2>/dev/null
find /sdcard -type d -depth -exec rmdir {} + 2>/dev/null
echo " done!"
################################################
echo -n "Setting log permissions read-only..."
chmod 000 /data/tombstones
chmod 000 /data/system/dropbox
chmod 000 /data/system/graphicsstats
chmod 000 /data/system/procstats
chmod 000 /data/system/usagestats/0/daily
chmod 000 /data/system/usagestats/0/weekly
chmod 000 /data/system/usagestats/0/monthly
chmod 000 /data/system/usagestats/0/yearly
echo " done!"
################################################
echo -n "Adding my build.prop settings......."
fname="/system/build.prop"
tmpvar=$(sed '/.*My settings.*/{s///;q;}' $fname | sed '$d')
echo "$tmpvar" > $fname
echo '
# My settings
# Disable multi user
fw.max_users=1
fw.show_multiuserui=0
fw.show_hidden_users=0
fw.power_user_switcher=0
# Disable logging
logcat.live=disable
# Disable boot animation
debug.sf.nobootanimation=1
# Disable USB debugging notification
persist.adb.notify=0
# Disable ring delay
ro.telephony.call_ring.delay=0
ring.delay=0
# Remove fps limit
debug.gr.swapinterval=0
# Disable dithering
persist.sys.use_dithering=0
# Disable scrolling cache
persist.sys.scrollingcache=4
# End of my settings
' >> $fname
chmod 644 $fname
echo " done!"
################################################
echo -n "Adding my gps.conf settings........."
rm -f /system/vendor/etc/gps.conf
touch /system/vendor/etc/gps.conf
echo '# My settings
# NTP Server - only one allowed!
NTP_SERVER=nl.pool.ntp.org
# Debug level
DEBUG_LEVEL=0
# End of my settings
' > /system/vendor/etc/gps.conf
chmod 644 /system/vendor/etc/gps.conf
echo " done!"
################################################
echo -n "Adding my userinit.sh settings......"
echo '#!/system/bin/sh
# My settings
# Optimize databases
for i in $(find /data -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
for i in $(find /storage/emulated/0 -iname "*.db" -type f)
do
sqlite3 $i "VACUUM;" 2>/dev/null
sqlite3 $i "REINDEX;" 2>/dev/null
done
# Instead of disabling fsync remount with higher fsync interval
mount -o remount,rw,commit=300 /data
# Enable power_efficient workqueue
chmod 666 /sys/module/workqueue/parameters/power_efficient
echo 1 > /sys/module/workqueue/parameters/power_efficient
chmod 444 /sys/module/workqueue/parameters/power_efficient
# Disable iostats
chmod 666 /sys/block/sda/queue/iostats
echo "0" > /sys/block/sda/queue/iostats
chmod 444 /sys/block/sda/queue/iostats
# When there, use Boeffla to disable some wakelocks
if [ -e /sys/devices/virtual/misc/boeffla_wakelock_blocker ]; then
echo "IPA_WS;NETLINK;bms;netmgr_wl;qcom_rx_wakelock;sensor_SMD;wlan;wlan_extscan_wl;wlan_ipa;wlan_pno_wl;wlan_wow_wl" > /sys/devices/virtual/misc/boeffla_wakelock_blocker/wakelock_blocker
fi
# End of my settings
' > /data/local/userinit.sh
chmod 777 /data/local/userinit.sh
echo " done!"
echo
As you probably know; use at your own risc!
---

I am on NOS 10 at the moment and started with a new, in fact my old approach.
Not using Magisk or SuperSU and keeping it as default as possible.
Using adb to disable packages without removing, next step will be a short twrp cleanup script once a month for cache and other crap files.
Using the following bat file for disabling packages and setting some optimised doze settings:
Code:
:setup
@echo off
color 0A
cls
echo.
echo Connect device...
adb devices
:packages
echo.
echo Disable packages...
:: Tag
adb shell pm disable-user --user 0 com.android.apps.tag
adb shell am force-stop com.android.apps.tag
adb shell pm clear com.android.apps.tag
:: BackupRestoreConfirmation
adb shell pm disable-user --user 0 com.android.backupconfirm
adb shell am force-stop com.android.backupconfirm
adb shell pm clear com.android.backupconfirm
:: BuiltInPrintService
adb shell pm disable-user --user 0 com.android.bips
adb shell am force-stop com.android.bips
adb shell pm clear com.android.bips
:: BluetoothMidiService
adb shell pm disable-user --user 0 com.android.bluetoothmidiservice
adb shell am force-stop com.android.bluetoothmidiservice
adb shell pm clear com.android.bluetoothmidiservice
:: BookmarkProvider
adb shell pm disable-user --user 0 com.android.bookmarkprovider
adb shell am force-stop com.android.bookmarkprovider
adb shell pm clear com.android.bookmarkprovider
:: Calendar
adb shell pm disable-user --user 0 com.android.calendar
adb shell am force-stop com.android.calendar
adb shell pm clear com.android.calendar
:: CallLogBackup >> HAVE TO TEST!!
adb shell pm disable-user --user 0 com.android.calllogbackup
adb shell am force-stop com.android.calllogbackup
adb shell pm clear com.android.calllogbackup
:: CaptivePortalLogin
adb shell pm disable-user --user 0 com.android.captiveportallogin
adb shell am force-stop com.android.captiveportallogin
adb shell pm clear com.android.captiveportallogin
:: CellBroadcastReceiver
adb shell pm disable-user --user 0 com.android.cellbroadcastreceiver
adb shell am force-stop com.android.cellbroadcastreceiver
adb shell pm clear com.android.cellbroadcastreceiver
:: CompanionDeviceManager
adb shell pm disable-user --user 0 com.android.companiondevicemanager
adb shell am force-stop com.android.companiondevicemanager
adb shell pm clear com.android.companiondevicemanager
:: Contacts
adb shell pm disable-user --user 0 com.android.contacts
adb shell am force-stop com.android.contacts
adb shell pm clear com.android.contacts
:: CtsShimPrebuilt
adb shell pm disable-user --user 0 com.android.cts.ctsshim
adb shell am force-stop com.android.cts.ctsshim
adb shell pm clear com.android.cts.ctsshim
:: CtsShimPrivPrebuilt
adb shell pm disable-user --user 0 com.android.cts.priv.ctsshim
adb shell am force-stop com.android.cts.priv.ctsshim
adb shell pm clear com.android.cts.priv.ctsshim
:: DocumentsUI
adb shell pm disable-user --user 0 com.android.documentsui
adb shell am force-stop com.android.documentsui
adb shell pm clear com.android.documentsui
:: BasicDreams
adb shell pm disable-user --user 0 com.android.dreams.basic
adb shell am force-stop com.android.dreams.basic
adb shell pm clear com.android.dreams.basic
:: PhotoTable
adb shell pm disable-user --user 0 com.android.dreams.phototable
adb shell am force-stop com.android.dreams.phototable
adb shell pm clear com.android.dreams.phototable
:: DynamicSystemInstallationService
adb shell pm disable-user --user 0 com.android.dynsystem
adb shell am force-stop com.android.dynsystem
adb shell pm clear com.android.dynsystem
:: EasterEgg
adb shell pm disable-user --user 0 com.android.egg
adb shell am force-stop com.android.egg
adb shell pm clear com.android.egg
:: Email
adb shell pm disable-user --user 0 com.android.email
adb shell am force-stop com.android.email
adb shell pm clear com.android.email
:: ExternalStorageProvider
adb shell pm disable-user --user 0 com.android.externalstorage
adb shell am force-stop com.android.externalstorage
adb shell pm clear com.android.externalstorage
:: Gallery2
adb shell pm disable-user --user 0 com.android.gallery3d
adb shell am force-stop com.android.gallery3d
adb shell pm clear com.android.gallery3d
:: InputDevices
adb shell pm disable-user --user 0 com.android.inputdevices
adb shell am force-stop com.android.inputdevices
adb shell pm clear com.android.inputdevices
:: DisplayCutoutEmulationCorner
adb shell pm disable-user --user 0 com.android.internal.display.cutout.emulation.corner
adb shell am force-stop com.android.internal.display.cutout.emulation.corner
adb shell pm clear com.android.internal.display.cutout.emulation.corner
:: DisplayCutoutEmulationDouble
adb shell pm disable-user --user 0 com.android.internal.display.cutout.emulation.double
adb shell am force-stop com.android.internal.display.cutout.emulation.double
adb shell pm clear com.android.internal.display.cutout.emulation.double
:: DisplayCutoutEmulationTall
adb shell pm disable-user --user 0 com.android.internal.display.cutout.emulation.tall
adb shell am force-stop com.android.internal.display.cutout.emulation.tall
adb shell pm clear com.android.internal.display.cutout.emulation.tall
:: LocalTransport
adb shell pm disable-user --user 0 com.android.localtransport
adb shell am force-stop com.android.localtransport
adb shell pm clear com.android.localtransport
:: ManagedProvisioning
adb shell pm disable-user --user 0 com.android.managedprovisioning
adb shell am force-stop com.android.managedprovisioning
adb shell pm clear com.android.managedprovisioning
:: Music
adb shell pm disable-user --user 0 com.android.music
adb shell am force-stop com.android.music
adb shell pm clear com.android.music
:: MusicFX
adb shell pm disable-user --user 0 com.android.musicfx
adb shell am force-stop com.android.musicfx
adb shell pm clear com.android.musicfx
:: NfcNci
adb shell pm disable-user --user 0 com.android.nfc
adb shell am force-stop com.android.nfc
adb shell pm clear com.android.nfc
:: OneTimeInitializer
adb shell pm disable-user --user 0 com.android.onetimeinitializer
adb shell am force-stop com.android.onetimeinitializer
adb shell pm clear com.android.onetimeinitializer
:: PrintRecommendationService
adb shell pm disable-user --user 0 com.android.printservice.recommendation
adb shell am force-stop com.android.printservice.recommendation
adb shell pm clear com.android.printservice.recommendation
:: QuickSearchBox
adb shell pm disable-user --user 0 com.android.quicksearchbox
adb shell am force-stop com.android.quicksearchbox
adb shell pm clear com.android.quicksearchbox
:: SettingsIntelligence
adb shell pm disable-user --user 0 com.android.settings.intelligence
adb shell am force-stop com.android.settings.intelligence
adb shell pm clear com.android.settings.intelligence
:: SharedStorageBackup
adb shell pm disable-user --user 0 com.android.sharedstoragebackup
adb shell am force-stop com.android.sharedstoragebackup
adb shell pm clear com.android.sharedstoragebackup
:: SimAppDialog
adb shell pm disable-user --user 0 com.android.simappdialog
adb shell am force-stop com.android.simappdialog
adb shell pm clear com.android.simappdialog
:: Stk
adb shell pm disable-user --user 0 com.android.stk
adb shell am force-stop com.android.stk
adb shell pm clear com.android.stk
:: Terminal
adb shell pm disable-user --user 0 com.android.terminal
adb shell am force-stop com.android.terminal
adb shell pm clear com.android.terminal
:: Traceur
adb shell pm disable-user --user 0 com.android.traceur
adb shell am force-stop com.android.traceur
adb shell pm clear com.android.traceur
:: UserDictionaryProvider
adb shell pm disable-user --user 0 com.android.providers.userdictionary
adb shell am force-stop com.android.providers.userdictionary
adb shell pm clear com.android.providers.userdictionary
:: VpnDialogs
adb shell pm disable-user --user 0 com.android.vpndialogs
adb shell am force-stop com.android.vpndialogs
adb shell pm clear com.android.vpndialogs
:: WallpaperBackup
adb shell pm disable-user --user 0 com.android.wallpaperbackup
adb shell am force-stop com.android.wallpaperbackup
adb shell pm clear com.android.wallpaperbackup
:: LiveWallpapersPicker
adb shell pm disable-user --user 0 com.android.wallpaper.livepicker
adb shell am force-stop com.android.wallpaper.livepicker
adb shell pm clear com.android.wallpaper.livepicker
:: AntHalService
adb shell pm disable-user --user 0 com.dsi.ant.server
adb shell am force-stop com.dsi.ant.server
adb shell pm clear com.dsi.ant.server
:: HTMLViewer
adb shell pm disable-user --user 0 com.android.htmlviewer
adb shell am force-stop com.android.htmlviewer
adb shell pm clear com.android.htmlviewer
:: WfdService
adb shell pm disable-user --user 0 com.qualcomm.wfd.service
adb shell am force-stop com.qualcomm.wfd.service
adb shell pm clear com.qualcomm.wfd.service
:: datastatusnotification
adb shell pm disable-user --user 0 com.qti.qualcomm.datastatusnotification
adb shell am force-stop com.qti.qualcomm.datastatusnotification
adb shell pm clear com.qti.qualcomm.datastatusnotification
:: CNEService
adb shell pm disable-user --user 0 com.quicinc.cne.CNEService
adb shell am force-stop com.quicinc.cne.CNEService
adb shell pm clear com.quicinc.cne.CNEService
:: SoterService
adb shell pm disable-user --user 0 com.tencent.soter.soterserver
adb shell am force-stop com.tencent.soter.soterserver
adb shell pm clear com.tencent.soter.soterserver
:: Unknown
adb shell pm disable-user --user 0 org.chromium.webview_shell
adb shell am force-stop org.chromium.webview_shell
adb shell pm clear org.chromium.webview_shell
:: DO NOT DISABLE WHEN USING PASSWORD:
:: LatinIME - com.android.inputmethod.latin
:: DO NOT DISABLE WHEN NO OTHER LAUNCHER IS USED:
:: Launcher3QuickStep - com.android.launcher3
:: DO NOT DISABLE AT FIRST BOOT:
:: OneTimeInitializer - com.android.onetimeinitializer
:: DO NOT DISABLE ON NITROGEN BECAUSE OF CRASH ON BOOT:
:: WallpaperCropper - com.android.wallpapercropper
:doze
echo.
echo Modify doze settings...
:: Remove old modified settings
adb shell settings delete global device_idle_constants
:: Enable doze
adb shell dumpsys deviceidle enable
:: To put phone in deep sleep immediately
adb shell dumpsys deviceidle force-idle
:: Modified doze settings
adb shell settings put global device_idle_constants inactive_to=15000,sensing_to=0,locating_to=0,location_accuracy=20.0,motion_inactive_to=0,idle_after_inactive_to=0,idle_pending_to=60000,max_idle_pending_to=120000,idle_pending_factor=2.0,idle_to=900000,max_idle_to=86400000,idle_factor=2.0,min_time_to_alarm=600000,max_temp_app_whitelist_duration=10000,mms_temp_app_whitelist_duration=10000,sms_temp_app_whitelist_duration=10000
:reboot
echo.
echo Press button to reboot phone...
pause
adb reboot

GuestK00264 said:
I am on NOS 10 at the moment and started with a new, in fact my old approach.
Not using Magisk or SuperSU and keeping it as default as possible.
Using adb to disable packages without removing, next step will be a short twrp cleanup script once a month for cache and other crap files.
Using the following bat file for disabling packages and setting some optimised doze settings:
Click to expand...
Click to collapse
Hi!
Why did you go back to trebuchet, is there anything wrong with librechair? I installed librechair today and I kinda like it, so I'm curious whether you found a downside or just prefer the more simplistic trebuchet..
Thanks in advance

Okay script people, i'm currently using the following to delete a font on Pie ROMs:
Code:
run_program("/sbin/mount", "/system");
ui_print(" ");
ui_print("***Working***");
delete_recursive(
"/system/fonts/NotoColorEmoji.ttf"
);
ui_print("Removing Emoji");
show_progress(8.800000, 5);
run_program("/sbin/umount", "/system");
ui_print(" ");
ui_print("Done.");
ui_print("Ready to reboot.");
How should this be adapted to work on Android 10? As far as i know the folder is now system/system/fonts which is easy to change, but is there anything that needs changing regarding the mount point now that system is root? I know that bash scripts need adapting but don't know about edify.
Thanks.

<deleted>

<deleted>

The script as using it for latest LOS18.1:
Code:
#!/sbin/sh
#
# Last modified 2022-01-01
#############################################################
clear
sleep 0.1
echo
echo "#######################################################"
echo "# ANDROID SETUP SCRIPT #"
echo "#######################################################"
echo
# User input to choose what to do
echo "Choose one of the following options:"
echo "S or s = Setup Android without cleaning"
echo "C or c = Deep clean current installation"
echo "F or f = Setup Android including deep clean"
echo "Q or q = Quit the script"
echo
while true
do
# (1) prompt user, and read command line argument
# the second line is producing a backslash to hide output
read -s -n1 answer
echo -n -e "\b \b"
# (2) handle the input we were given
case $answer in
[sS]* ) parm="1"
echo "Your choice:"
echo "Setup of Android without cleaning"
break;;
[cC]* ) parm="2"
echo "Your choice:"
echo "Deep clean of current installation"
break;;
[fF]* ) parm="3"
echo "Your choice:"
echo "Setup of Android including deep clean"
break;;
[qQ]* ) echo "Exited script"
echo
exit;;
* ) echo "Please enter an existing option...";;
esac
done
echo
echo "#######################################################"
echo
#############################################################
echo -n "First script setup..............................."
# Mount or remount drives read-write
umount /system 2>/dev/null
umount /system_root 2>/dev/null
mount -o rw /cache 2>/dev/null
mount -o rw /data 2>/dev/null
mount -o rw /sdcard 2>/dev/null
mount -o rw /system_root 2>/dev/null
# Mount vendor/firmware_mnt
if ! mountpoint -q "/system_root/system/vendor/firmware_mnt"; then
mount /dev/block/by-name/modem /system_root/system/vendor/firmware_mnt
fi
if [ ! -e "/system_root/system/vendor/firmware_mnt" ]; then
echo " done!"
echo ""
echo "ERROR:"
echo "/system/vendor not mounted correctly, exiting script"
exit
fi
echo " done!"
#############################################################
if [ "$parm" == "1" ] || [ "$parm" == "3" ]; then
echo -n "Remove some system apps, modules and services...."
applist="
AntHalService
AudioFX
BasicDreams
BluetoothMidiService
BookmarkProvider
BuiltInPrintService
CallLogBackup
CaptivePortalLogin
CarrierDefaultApp
CellBroadcastLegacyApp
CneApp
CompanionDeviceManager
CtsShimPrebuilt
CtsShimPrivPrebuilt
datastatusnotification
dpmserviceapp
DynamicSystemInstallationService
EasterEgg
Eleven
embms
Gallery2
HTMLViewer
IFAAService
InputDevices
IWlanService
Jelly
LineageSetupWizard
LineageThemesStub
LiveWallpapersPicker
ManagedProvisioning
OneTimeInitializer
PhotoTable
PowerOffAlarm
PrintRecommendationService
QuickAccessWallet
Seedvault
SimAppDialog
SoterService
Stk
Traceur
Updater
VpnDialogs
WallpaperBackup
WallpaperCropper
WAPPushManager
"
# BASIC:
# AudioFX
# Eleven
# Gallery2
# IFAAService
# Jelly
# PowerOffAlarm
# SoterService
# Updater
for appname in $applist
do
if [ -e "/system_root/system/app/$appname" ]; then
chmod -R 777 "/system_root/system/app/$appname" 2>/dev/null
rm -rf "/system_root/system/app/$appname" 2>/dev/null
fi
if [ -e "/system_root/system/priv-app/$appname" ]; then
chmod -R 777 "/system_root/system/priv-app/$appname" 2>/dev/null
rm -rf "/system_root/system/priv-app/$appname" 2>/dev/null
fi
if [ -e "/system_root/system/product/app/$appname" ]; then
chmod -R 777 "/system_root/system/product/app/$appname" 2>/dev/null
rm -rf "/system_root/system/product/app/$appname" 2>/dev/null
fi
if [ -e "/system_root/system/product/priv-app/$appname" ]; then
chmod -R 777 "/system_root/system/product/priv-app/$appname" 2>/dev/null
rm -rf "/system_root/system/product/priv-app/$appname" 2>/dev/null
fi
if [ -e "/system_root/system/system_ext/app/$appname" ]; then
chmod -R 777 "/system_root/system/system_ext/app/$appname" 2>/dev/null
rm -rf "/system_root/system/system_ext/app/$appname" 2>/dev/null
fi
if [ -e "/system_root/system/system_ext/priv-app/$appname" ]; then
chmod -R 777 "/system_root/system/system_ext/priv-app/$appname" 2>/dev/null
rm -rf "/system_root/system/system_ext/priv-app/$appname" 2>/dev/null
fi
if [ -e "/system_root/system/vendor/app/$appname" ]; then
chmod -R 777 "/system_root/system/vendor/app/$appname" 2>/dev/null
rm -rf "/system_root/system/vendor/app/$appname" 2>/dev/null
fi
done
# Remove Soter Ifaa and Alipay blobs
# https://forum.xda-developers.com/oneplus-3/how-to/guide-deblob-alipay-ifaa-tencent-soter-t4064893/
find /system_root/system ! -name "*manager*" -name "*alipay*" -name "*soter*" -name "*ifaa*" -type f -exec rm -f {} + 2>/dev/null
# Remove emergency service
rm -rf /system_root/system/apex/com.android.cellbroadcast 2>/dev/null
# Reduce fonts to the bare minimum
find /system_root/system/fonts ! -name "Roboto*.*" ! -name "DroidSansMono.ttf" ! -name "NotoColorEmoji.ttf" ! -name "NotoSansSymbols-Regular-Subsetted*.ttf" -type f -exec rm -f {} +
# Remove most overlay and related stuff
rm -rf /system_root/system/product/fonts 2>/dev/null
find /system_root/system/product/overlay -maxdepth 1 -mindepth 1 -not -name "*LineageBlackTheme*" -not -name "." -exec rm -rf {} +
echo " done!"
fi
#############################################################
if [ "$parm" == "1" ] || [ "$parm" == "3" ]; then
echo -n "Remove live display functionality................"
rm -f '/system_root/system/vendor/bin/hw/[email protected]'
rm -f '/system_root/system/vendor/etc/init/[email protected]'
found=0
startstop=0
tstr=""
nstr=""
IFS=$'\n'
while read line
do
if [[ "$line" == *'<hal'* ]]; then
startstop=1
elif [[ "$line" == *'</hal'* ]]; then
startstop=2
elif [[ "$line" == *'livedisplay'* ]]; then
found=1
fi
if [ $startstop -eq 1 ]; then
tstr="${tstr}\n${line}"
elif [ $startstop -eq 2 ]; then
tstr="${tstr}\n${line}"
if [ $found -eq 0 ]; then
nstr="${nstr}${tstr}"
else
found=0
fi
tstr=""
startstop=0
else
if [ "$nstr" == "" ]; then
nstr="${line}"
else
nstr="${nstr}\n${line}"
fi
fi
done < "/system_root/system/vendor/etc/vintf/manifest.xml"
echo "$nstr" > "/system_root/system/vendor/etc/vintf/manifest.xml"
chmod 644 "/system_root/system/vendor/etc/vintf/manifest.xml"
echo " done!"
fi
#############################################################
if [ "$parm" == "1" ] || [ "$parm" == "3" ]; then
if [ -e /sdcard/Config/System/arm64_SystemWebView.apk ]; then
echo -n "Adding Bromite webview (install also after boot!)"
cp -f /sdcard/Config/System/arm64_SystemWebView.apk /system_root/system/product/app/webview/webview.apk
chmod 644 /system_root/system/product/app/webview/webview.apk
echo " done!"
fi
fi
#############################################################
if [ "$parm" == "1" ] || [ "$parm" == "3" ]; then
if [ -e /sdcard/Config/System/bootanimation.zip ]; then
echo -n "Adding customized boot animation................."
rm -f /system_root/system/media/bootanimation.zip
cp -f /sdcard/Config/System/bootanimation.zip /system_root/system/media/bootanimation.zip
chmod 644 /system_root/system/media/bootanimation.zip
echo " done!"
fi
fi
#############################################################
if [ "$parm" == "1" ] || [ "$parm" == "3" ]; then
echo -n "Adding optimised build.prop settings............."
iname="/system_root/system/vendor/build.prop"
jname="/system_root/system/build.prop"
kname="/system_root/system/product/build.prop"
lname="/system_root/system/system_ext/build.prop"
# Replace 3250mv by 3400mv for battery
sed -i 's/3250/3400/g' $jname
# Disable iwlan in build.prop as we actually removed the apk
sed -i 's/persist.data.iwlan.enable=true/persist.data.iwlan.enable=false/g' $jname
# Disable CNE in build.prop as we actually removed the apk
sed -i 's/persist.vendor.cne.feature=1/persist.vendor.cne.feature=0/g' $jname
# Remove all settings we are using in build.prop files
proplist="
persist.vendor.cne.feature
logcat.live
ro.config.nocheckin
profiler.force_disable_err_rpt
profiler.force_disable_ulog
pm.sleep_mode
ro.ril.disable.power.collapse
ro.ril.power_collapse
persist.android.strictmode
ro.kernel.checkjni
ro.kernel.android.checkjni
dalvik.vm.checkjni
dalvik.vm.dexopt-data-only
dalvik.vm.verify-bytecode
dalvik.vm.dexopt-flags
dalvik.vm.execution-mode
ro.mot.eri.losalert.delay
wifi.supplicant_scan_interval
debug.composition.type
debug.sf.hw
persist.debug.wfd.enable
ro.sf.lcd_density
hwui.disable_vsync
debug.sf.no_hw_vsync
hwui.render_dirty_regions
persist.sys.use_dithering
ro.build.selinux
ro.debuggable
ro.secure
ro.build.tags
ro.product.build.tags
ro.system.build.tags
ro.system_ext.build.tags
ro.vendor.build.tags
ro.build.type
ro.product.build.type
ro.system.build.type
ro.system_ext.build.type
ro.vendor.build.type
ro.build.version.security_patch
ro.vendor.build.security_patch
fw.max_users
fw.power_user_switcher
fw.show_hidden_users
fw.show_multiuserui
audio.safemedia.bypass
persist.adb.notify
"
for propname in $proplist
do
tmpvar1=$(sed "/$propname/d" $iname)
echo "$tmpvar1" > $iname
tmpvar2=$(sed "/$propname/d" $jname)
echo "$tmpvar2" > $jname
tmpvar3=$(sed "/$propname/d" $kname)
echo "$tmpvar3" > $kname
tmpvar4=$(sed "/$propname/d" $lname)
echo "$tmpvar4" > $lname
done
# Now add or replace settings
tmpvar5=$(sed '/.*My settings.*/{s///;q;}' $iname | sed '$d')
echo "$tmpvar5" > $iname
echo '
# My settings
# LOGGING & ERRORS
logcat.live=disable
ro.config.nocheckin=1
profiler.force_disable_err_rpt=1
profiler.force_disable_ulog=1
# EFFICIENCY
pm.sleep_mode=1
ro.ril.disable.power.collapse=0
ro.ril.power_collapse=1
persist.android.strictmode=0
ro.kernel.checkjni=0
ro.kernel.android.checkjni=0
dalvik.vm.checkjni=false
dalvik.vm.dexopt-data-only=1
dalvik.vm.verify-bytecode=false
dalvik.vm.dexopt-flags=v=n,o=a,u=y
dalvik.vm.execution-mode=int:jit
ro.mot.eri.losalert.delay=1000
wifi.supplicant_scan_interval=360
debug.composition.type=gpu
debug.sf.hw=1
# MIRACAST DISABLE
persist.debug.wfd.enable=0
# SCREEN
ro.sf.lcd_density=432
hwui.disable_vsync=true
debug.sf.no_hw_vsync=1
hwui.render_dirty_regions=false
persist.sys.use_dithering=0
# SECURITY SPOOFING
ro.build.selinux=0
ro.debuggable=0
ro.secure=1
ro.build.tags=release-keys
ro.product.build.tags=release-keys
ro.system.build.tags=release-keys
ro.system_ext.build.tags=release-keys
ro.vendor.build.tags=release-keys
ro.build.type=user
ro.product.build.type=user
ro.system.build.type=user
ro.system_ext.build.type=user
ro.vendor.build.type=user
ro.build.version.security_patch=2022-01-03
ro.vendor.build.security_patch=2022-01-03
# SINGLE USER
fw.max_users=1
fw.power_user_switcher=0
fw.show_hidden_users=0
fw.show_multiuserui=0
# WARNINGS
audio.safemedia.bypass=true
persist.adb.notify=0
' >> $iname
chmod 644 $iname
chmod 644 $jname
chmod 644 $kname
chmod 644 $lname
echo " done!"
fi
#############################################################
if [ "$parm" == "1" ] || [ "$parm" == "3" ]; then
echo -n "Adding optimised gps.conf settings..............."
rm -f "/system_root/system/vendor/etc/gps.conf"
rm -f "/system_root/system/etc/gps_debug.conf"
touch "/system_root/system/vendor/etc/gps.conf"
echo '# My secure gps only settings
# NTP Server - only one allowed!
NTP_SERVER=nl.pool.ntp.org
# Standalone mode
SUPL_MODE=0
# Disable AGPS injection
AGPS_CONFIG_INJECT=0
# No XTRA testing
XTRA_TEST_ENABLED=0
# AGPS secure settings
SUPL_HOST=localhost
SUPL_PORT=7275
SUPL_TLS_HOST=localhost
# Accuracy all better then 5000m
ACCURACY_THRES=5000
# Give position immediately also without lock
INTERMEDIATE_POS=1
# Debug level
DEBUG_LEVEL=0
# GPS lock for privacy when switched off
GPS_LOCK=3
# Disable emergency SUPL
SUPL_ES=0
# End of my settings
' > "/system_root/system/vendor/etc/gps.conf"
cp -f "/system_root/system/vendor/etc/gps.conf" "/system_root/system/etc/gps_debug.conf"
chmod 644 "/system_root/system/vendor/etc/gps.conf"
chmod 644 "/system_root/system/etc/gps_debug.conf"
echo " done!"
fi
#############################################################
if [ "$parm" == "2" ] || [ "$parm" == "3" ]; then
echo -n "Cleanup system files............................."
# file list to cleanup
filelist="
/cache
/data/anr
/data/backup
/data/cache
/data/dalvik-cache
/data/local/tmp
/data/lost+found
/data/misc/bootstat
/data/ota
/data/ota_package
/data/resource-cache
/data/system/battery-history
/data/system/battery-saver
/data/system/batterystats-checkin.bin
/data/system/batterystats-daily.bin
/data/system/batterystats.bin
/data/system/dropbox
/data/system/graphicsstats
/data/system/install_sessions.xml
/data/system/last-fstrim
/data/system/package_cache
/data/system/procstats
/data/system/syncmanager-log
/data/system/uiderrors.txt
/data/system/usagestats/0/daily
/data/system/usagestats/0/monthly
/data/system/usagestats/0/weekly
/data/system/usagestats/0/yearly
/data/tombstones
/data/xtended_updates
/sdcard/DCIM/.thumbnails
/sdcard/Movies/.thumbnails
/sdcard/Music/.thumbnails
/sdcard/Pictures/.thumbnails
"
for filename in $filelist
do
if [ -d "$filename" ]; then
chmod -R 777 "$filename" 2>/dev/null
rm -rf "${filename:?}"/* 2>/dev/null
fi
if [ -f "$filename" ]; then
chmod 777 "$filename" 2>/dev/null
rm -f "$filename" 2>/dev/null
fi
done
# Remove bak, log, tmp files in /system
find /system_root/system -name "*.bak" -name "*.log" -name "*.tmp" -exec rm -f {} + 2>/dev/null
# Misc stuff
rm -f "/system_root/system/vendor/recovery-from-boot.p" 2>/dev/null
rm -f "/system_root/system/vendor/recovery-from-boot.bak" 2>/dev/null
# App specific
rm -rf /data/data/com.abnamro.nl.mobile.payments/app_dex/oat/arm64/* 2>/dev/null
rm -rf /data/data/org.fdroid.fdroid/files/*.apk 2>/dev/null
rm -rf /data/data/org.videolan.vlc/app_vlc/* 2>/dev/null
# Battery stuff
rm -rf /data/system/batt*.* 2>/dev/null
rm -rf /data/system/batt* 2>/dev/null
echo " done!"
fi
#############################################################
if [ "$parm" == "2" ] || [ "$parm" == "3" ]; then
echo -n "Cleanup app data................................."
# Remove bak, log, tmp, odex, vdex files
find /data -iname "*.bak" -iname "*.log" -iname "*.tmp" -iname "*.odex" -iname "*.vdex" -exec rm -f {} + 2>/dev/null
find /sdcard -iname "*.bak" -iname "*.log" -iname "*.tmp" -iname "*.odex" -iname "*.vdex" -exec rm -f {} + 2>/dev/null
# Some app file cleanup
for i in $(ls /data/data/)
do
if [ -e /data/data/"$i"/cache ]; then
chmod -R 777 /data/data/"$i"/cache 2>/dev/null
rm -rf /data/data/"$i"/cache/* 2>/dev/null
fi
if [ -e /data/data/"$i"/code_cache ]; then
chmod -R 777 /data/data/"$i"/code_cache 2>/dev/null
rm -rf /data/data/"$i"/code_cache/* 2>/dev/null
fi
if [ -e /data/data/"$i"/files/.Fabric ]; then
chmod -R 777 /data/data/"$i"/files/.Fabric 2>/dev/null
rm -rf /data/data/"$i"/files/.Fabric/* 2>/dev/null
fi
if [ -e /data/data/"$i"/files/cache ]; then
chmod -R 777 /data/data/"$i"/files/cache 2>/dev/null
rm -rf /data/data/"$i"/files/cache/* 2>/dev/null
fi
if [ -e /data/data/"$i"/app_webview ]; then
find /data/data/"$i"/app_webview ! -name "Cookies*" -type f -exec rm -f {} + 2>/dev/null
find /data/data/"$i"/app_webview -type d -depth -exec rmdir {} + 2>/dev/null
fi
done
for k in $(ls /sdcard/Android/data/)
do
if [ -e /sdcard/Android/data/"$k"/cache ]; then
chmod -R 777 /sdcard/Android/data/"$k"/cache 2>/dev/null
rm -rf /sdcard/Android/data/"$k"/cache/* 2>/dev/null
fi
done
# App specific
rm -rf /data/data/com.abnamro.nl.mobile.payments/app_dex/oat/arm64/* 2>/dev/null
rm -rf /data/data/org.fdroid.fdroid/files/*.apk 2>/dev/null
rm -rf /data/data/org.videolan.vlc/app_vlc/* 2>/dev/null
echo " done!"
fi
#############################################################
if [ "$parm" == "2" ] || [ "$parm" == "3" ]; then
echo -n "Cleanup empty directories........................"
# Remove empty directories
find /sdcard ! -name "*Downloads*" ! -name "*Camera*" -type d -depth -exec rmdir {} + 2>/dev/null
# Just to be sure they are (still) there...
mkdir /sdcard/Download 2>/dev/null
mkdir -p /sdcard/DCIM/Camera 2>/dev/null
chmod -R 770 /sdcard/Download 2>/dev/null
chmod -R 770 /sdcard/DCIM 2>/dev/null
echo " done!"
fi
#############################################################
echo -n "Optimising app databases........................."
# Optimize databases
for i in $(find /data -name "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done
for i in $(find /sdcard -name "*.db" -type f)
do
sqlite3 "$i" "VACUUM;" 2>/dev/null
sqlite3 "$i" "REINDEX;" 2>/dev/null
done
echo " done!"
#############################################################
# If available, run fstrim to optimise disks
if [ -e /sdcard/Config/System/fstrim ]; then
echo -n "Optimising disks using fstrim...................."
chmod 777 /sdcard/Config/System/fstrim
/sdcard/Config/System/fstrim /cache 2>/dev/null
/sdcard/Config/System/fstrim /data 2>/dev/null
/sdcard/Config/System/fstrim /sdcard 2>/dev/null
/sdcard/Config/System/fstrim /system 2>/dev/null
echo " done!"
fi
#############################################################
echo -n "Let us finish and unmount disks.................."
umount /system_root/system/vendor/firmware_mnt
umount /system 2>/dev/null
umount /system_root 2>/dev/null
echo " done!"
#############################################################
# User input to choose what to do
echo
echo "#######################################################"
echo
echo "Script completed, what now?"
echo "R or r = Reboot to system"
echo "Q or q = Quit the script"
echo
while true
do
# (1) prompt user, and read command line argument
# the second line is producing a backslash to hide output
read -s -n1 answer
echo -n -e "\b \b"
# (2) handle the input we were given
case $answer in
[rR]* ) echo "Your choice:"
echo "Reboot to system"
echo
sleep 0.5
reboot;;
[qQ]* ) echo "Your choice:"
echo "Quit the script"
echo
exit;;
* ) echo "Please enter an existing option...";;
esac
done
echo

Related

[MOD][ICS/JB] Liquid Speed/Speed it v8 [Tweaks][18/09/2013]

Code:
* Your warranty is now void..
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, you getting dumped or you getting fired because your phone
* bootloops and alarm does not go off. Please do some research if you have any
* YOU are choosing to make these modifications.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Requirements :-
- Android 4.0+
- Custom kernel (with init.d support)
- Root and Busybox installed
- 3MB of free space in "/system".
Feature :-
- Full memory management.
- kernel tweaks and improvements for better performance and battery life.
- Entropy generator engine used to reduce lags.
- Zipalign apps in "/system" and apps in "/data" every 48 hours which result in less RAM usage.
- Sqlite optimizations and faster database access.
- CPU governors tweaks and improvements for better performance and battery life.
- Increased SD Card read-ahead cache to 2048 KB .
- Ad blocking.
- Default.prop tweaks and improvements.
- Cleans log files and tombstones at every boot.
- Many other tweaks for better performance and battery life!
Steps :-
- go to system/etc/init.d/delete all files in it
- Download the zip
- Flash zip via recovery
- Feel the difference (1st boot may take time)
Some part of my Default .prop
#enable harware egl profile
debug.egl.profiler=1
#16BIT transparency , Smother Scrolling
persist.sys.use_16bpp_alpha=1
#debug.composition.type=gpu
debug.composition.type=c2d
debug.performance.tuning=1
debug.enabletr=true
debug.qctwa.preservebuf=1
dev.pm.dyn_samplingrate=1
video.accelerate.hw=1
ro.vold.umsdirtyratio=20
debug.overlayui.enable=1
debug.egl.hw=1
ro.fb.mode=1
hw3d.force=1
persist.sys.composition.type=c2d
persist.sys.ui.hw=1
ro.sf.compbypass.enable=0
#Enable tile rendering
debug.enabletr=true
persist.sys.composition.type=gpu
#3d performance
persist.android.strictmode=0
ro.min_pointer_dur=1
ro.secure=0
#Media quality
ro.media.enc.jpeg.quality=100
ro.media.dec.jpeg.memcap=8000000
ro.media.enc.hprof.vid.bps=8000000
ro.media.dec.aud.wma.enabled=1
ro.media.dec.vid.wmv.enabled=1
ro.media.cam.preview.fps=0
ro.media.codec_priority_for_thumb=so
#Speed liquid
persist.service.lgospd.enable=0
persist.service.pcsync.enable=0
# For sensor sleep control
ro.ril.sensor.sleep.control=1
#loggers
ro.config.htc.nocheckin=1
ro.config.nocheckin=1
profiler.force_disable_ulog=1
profiler.force_disable_err_rpt=1
#Scrolling
windowsmgr.max_events_per_sec=90
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
#battery saver
ro.ril.disable.power.collapse=1
pm.sleep_mode=1
usb_wakeup=enable
proximity_incall=enable
power_supply.wakeup=enable
ro.config.hw_power_saving=1
ro.config.hw_fast_dormancy=1
ro.config.hw_quickpoweron=true
persist.sys.use_dithering=0
#improve battery under no signal -- need test
ro.mot.eri.losalert.delay=1000
#net speedtweaks
net.tcp.buffersize.default=4096,87380,256960,4096, 16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.hspda=4096,87380,256960,4096,16 384,256960
net.tcp.buffersize.hspa=4096,87380,256960,4096,163 84,256960
#streaming faster
media.stagefright.enable-player=true
media.stagefright.enable-meta=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=true
media.stagefright.enable-aac=true
media.stagefright.enable-qcp=true
media.stagefright.enable-record=true
Some part of INIT.D :-
# Disable Logger
busybox rm /dev/log/main
# Busybox Remounting
busybox mount -o remount,noatime,barrier=0,nobh /system
busybox mount -o remount,noatime,barrier=0,nobh /data
busybox mount -o remount,noatime,barrier=0,nobh /cache
echo "Mounted Busybox"
# clearing junk files
busybox find /data/data -type d -iname "*cache*" -exec busybox rm -f {}/* ';' -exec echo "Cleared {}" ';'
rm -f /data/local/*.apk
rm -f /data/local/tmp/*.apk
rm -f /data/*.log
rm -f /data/log/*.log
rm -f /cache/*.*
rm -f /cache/recovery/*.*
rm -f /data/system/dropbox/*.txt
rm -f /data/backup/pending/*.tmp
rm -f /data/tombstones/*.*
echo "Junk cleared"
# Defrag Database Files
for i in \
`find /data -iname "*.db"`
do \
sqlite3 $i 'VACUUM;';
# Move Dalvik-Cache To Cache Partition
CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
if [ $CACHESIZE -gt 4000 ]
then
echo "Large cache detected, moving dalvik-cache to /cache"
if [ ! -d /cache/dalvik-cache ]
then
busybox rm -rf /cache/dalvik-cache /data/dalvik-cache
mkdir /cache/dalvik-cache /data/dalvik-cache
fi
busybox chown 1000:1000 /cache/dalvik-cache
busybox chmod 0771 /cache/dalvik-cache
busybox mount -o bind /cache/dalvik-cache /data/dalvik-cache
busybox chown 1000:1000 /data/dalvik-cache
busybox chmod 0771 /data/dalvik-cache
else
echo "Small cache detected, dalvik-cache will remain on /data"
fi
echo "Moved Dalvik-Cache To Cache Partition"
# Mod: Battery
setprop wifi.supplicant_scan_interval=180
setprop pm.sleep_mode=1
setprop ro.ril.disable.power.collapse=1
# Mod: Performance
setprop ro.kernel.android.checkjni=0
setprop persist.sys.purgeable_assets=1
setprop debug.sf.hw=1
setprop ro.telephony.call_ring.delay=0
setprop ro.foreground_app_mem=1280
setprop ro.visible_app_mem=2560
setprop ro.perceptible_app_mem=3840
setprop ro.heavy_weight_app_mem=6400
setprop ro.secondary_server_mem=7680
setprop ro.backup_app_mem=8960
setprop ro.home_app_mem=2048
setprop ro.hidden_app_mem=12800
setprop ro.content_provider_mem=15360
setprop ro.empty_app_mem=20480
setprop ro.foreground_app_adj=0
setprop ro.visible_app_adj=1
setprop ro.perceptible_app_adj=2
setprop ro.heavy_weight_app_adj=4
setprop ro.secondary_server_adj=5
setprop ro.backup_app_adj=6
setprop ro.home_app_adj=1
setprop ro.hidden_app_min_adj=7
setprop ro.empty_app_adj=15
# Mod: Graphics
setprop debug.performance.tuning=1
setprop video.accelerate.hw=1
setprop ro.media.dec.jpeg.memcap=8000000
setprop ro.media.enc.hprof.vid.bps=8000000
setprop persist.sys.use_dithering 1
# Touch Screen Sensitivity
echo 7035 > /sys/class/touch/switch/set_touchscreen;
echo 8002 > /sys/class/touch/switch/set_touchscreen;
echo 11000 > /sys/class/touch/switch/set_touchscreen;
echo 13060 > /sys/class/touch/switch/set_touchscreen;
echo 14005 > /sys/class/touch/switch/set_touchscreen;
# Renice Apps
renice -20 `pidof com.android.phone`
renice -19 `pidof com.android.inputmethod.latin`
renice -19 `pidof com.swype.android.inputmethod`
renice -17 `pidof com.android.systemui`
renice -9 `pidof com.android.settings`
renice -9 `pidof com.android.vending`
renice -6 `pidof com.sec.android.app.camera`
renice -6 `pidof com.sec.android.app.fm`
renice -6 `pidof com.google.android.apps.maps`
renice -4 `pidof com.google.android.apps.googlevoice`
renice -3 `pidof android.process.media`
# SqLite Optimize
for i in \
`busybox find /data -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
if [ -d "/dbdata" ]; then
for i in \
`busybox find /dbdata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
if [ -d "/datadata" ]; then
for i in \
`busybox find /datadata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
for i in \
`busybox find /sdcard -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
echo "SqLite Database Optimized"
echo "System Optimized And Boosted at $( date +"%m-%d-%Y %H:%M:%S" )"
function mountrw {
mount|grep "/system "|grep rw >/dev/null
[ $? -eq 1 ] && mount -o remount,rw $(mount|grep "/system "|awk '{ print $1 }') /system
}
function mountro {
mount|grep "/system "|grep ro >/dev/null
[ $? -eq 1 ] && mount -o remount,ro $(mount|grep "/system "|awk '{ print $1 }') /system
}
echo " Starting package optimization"
echo "Starting ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )"
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
mountrw;
echo ZipAligning $(basename $apk)
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed DC;
fi;
else
echo Velocity ZipAlign already completed on $apk
fi;
done;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk)
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed DC
fi;
else
echo Velocity ZipAlign already completed on $apk
fi;
done;
mountro;
echo "ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )"
​
Tested on Xperia neov (thanxx to watermelon90)
reserved
There are zip, 1st for ics Rom while 2nd one is for jellybean Rom and above? Thanks for ur hardwork bro..
nope
WaterMelon90 said:
There are zip, 1st for ics Rom while 2nd one is for jellybean Rom and above? Thanks for ur hardwork bro..
Click to expand...
Click to collapse
2nd is for gingerbread no jb
So there is not for jb in this thread?
it is
WaterMelon90 said:
So there is not for jb in this thread?
Click to expand...
Click to collapse
the 1 st one
gauravj said:
the 1 st one
Click to expand...
Click to collapse
ok..will try and report.
Is this for speeding up the performance of the mobile? I am running on ICS, whether this supports ICS?
Please confirm before I can try this...
Cheers
SeneoV
yes
SeneoV said:
Is this for speeding up the performance of the mobile? I am running on ICS, whether this supports ICS?
Please confirm before I can try this...
Cheers
SeneoV
Click to expand...
Click to collapse
custom kernel is must required
Hey bro, tested it in MIUI v5 by ZduneX25, Feel smooth but after 1 day, become lag, i delete the file and re-flash again. Still a bit lag for UI or opening apps.
thnxx
WaterMelon90 said:
Hey bro, tested it in MIUI v5 by ZduneX25, Feel smooth but after 1 day, become lag, i delete the file and re-flash again. Still a bit lag for UI or opening apps.
Click to expand...
Click to collapse
thnxx for reporting bro as i said u i will provide different tweaks for miui to asap :victory:
gauravj said:
thnxx for reporting bro as i said u i will provide different tweaks for miui to asap :victory:
Click to expand...
Click to collapse
Nice work and thx bro!
help
WaterMelon90 said:
Nice work and thx bro!
Click to expand...
Click to collapse
provide me service.jar present in framework folder (of miui)
After flash this tweak led for sms stop working. Led for missed call working normally.
neo V,Unlimited™ ROM 2.0,suave kernel
tnx
here is the service.jar from miui. :highfive:
WaterMelon90 said:
here is the service.jar from miui. :highfive:
Click to expand...
Click to collapse
will pm asap:highfive:
how to check init.d supports ???
sagar.andro said:
how to check init.d supports ???
Click to expand...
Click to collapse
go to root access,
root -> system -> etc -> find is there any int.d folder.
U may use ES file manager.
How can i unninstall this tweak ? cuz from 2-3% overnight drain ,its 10-12%
i deleted all init.d tweaks :-?
Callliope said:
How can i unninstall this tweak ? cuz from 2-3% overnight drain ,its 10-12%
i deleted all init.d tweaks :-?
Click to expand...
Click to collapse
Just delete all the file in the int.d file and reboot. that's all.

[MOD][Tweaks][S2]*LiQuid Speed*[05/11/2013]

Code:
* Your warranty is now void..
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, you getting dumped or you getting fired because your phone
* bootloops and alarm does not go off. Please do some research if you have any
* YOU are choosing to make these modifications.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Requirements :-
- Android 2.3 +
- Custom kernel (with init.d support)
- Root and Busybox installed
- 3MB of free space in "/system".
Feature :-
- Full memory management.
- kernel tweaks and improvements for better performance and battery life.
- Entropy generator engine used to reduce lags.
- Zipalign apps in "/system" and apps in "/data" every 48 hours which result in less RAM usage.
- Sqlite optimizations and faster database access.
- CPU governors tweaks and improvements for better performance and battery life.
- Increased SD Card read-ahead cache to 2048 KB .
- Ad blocking.
- Default.prop tweaks and improvements.
- Cleans log files and tombstones at every boot.
- Many other tweaks for better performance and battery life!
Steps :-
- go to system/etc/init.d/delete all files in it
- Download the zip
- Flash zip via recovery
- Feel the difference (1st boot may take time)
User praise :-
1c3_5n0w :- I'm not usually this vulgar but HOLY SH*T. My device is flying, look up in the sky!!! I come from xElite 2.0 which is a lag free GB ROM and I switched to an ICS ROM which is the Xperia Play Z Final v5 and look at the free RAM, and the battery, oh wowwww. Thanks a lot BOSS, this makes my Play, like a BOSS
fliperpl :- Installed with ROM ULTIMATE HD 5.1 and works pretty well. Phone is faster and UI seems to be smoother. Thanks
$lim $hady :- Awesome....!!!!!!!!! One word Awesome....!!!! Playing Subway Surfers without a Single Lag... Feels like my phone is running on GB.
skaloyskie :- Thanks man! I've noticed that my phone suffered less lag even I'm using Opera mini (Multi-tabbed browsing) and downloading movies via torrent. Nice
iossux :- U rock bro really boosted my performance
Some part of my Default .prop
#enable harware egl profile
debug.egl.profiler=1
#16BIT transparency , Smother Scrolling
persist.sys.use_16bpp_alpha=1
#debug.composition.type=gpu
debug.composition.type=c2d
debug.performance.tuning=1
debug.enabletr=true
debug.qctwa.preservebuf=1
dev.pm.dyn_samplingrate=1
video.accelerate.hw=1
ro.vold.umsdirtyratio=20
debug.overlayui.enable=1
debug.egl.hw=1
ro.fb.mode=1
hw3d.force=1
persist.sys.composition.type=c2d
persist.sys.ui.hw=1
ro.sf.compbypass.enable=0
#Enable tile rendering
debug.enabletr=true
persist.sys.composition.type=gpu
#3d performance
persist.android.strictmode=0
ro.min_pointer_dur=1
ro.secure=0
#Media quality
ro.media.enc.jpeg.quality=100
ro.media.dec.jpeg.memcap=8000000
ro.media.enc.hprof.vid.bps=8000000
ro.media.dec.aud.wma.enabled=1
ro.media.dec.vid.wmv.enabled=1
ro.media.cam.preview.fps=0
ro.media.codec_priority_for_thumb=so
#Speed liquid
persist.service.lgospd.enable=0
persist.service.pcsync.enable=0
# For sensor sleep control
ro.ril.sensor.sleep.control=1
#loggers
ro.config.htc.nocheckin=1
ro.config.nocheckin=1
profiler.force_disable_ulog=1
profiler.force_disable_err_rpt=1
#Scrolling
windowsmgr.max_events_per_sec=90
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
#battery saver
ro.ril.disable.power.collapse=1
pm.sleep_mode=1
usb_wakeup=enable
proximity_incall=enable
power_supply.wakeup=enable
ro.config.hw_power_saving=1
ro.config.hw_fast_dormancy=1
ro.config.hw_quickpoweron=true
persist.sys.use_dithering=0
#improve battery under no signal -- need test
ro.mot.eri.losalert.delay=1000
#net speedtweaks
net.tcp.buffersize.default=4096,87380,256960,4096, 16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.hspda=4096,87380,256960,4096,16 384,256960
net.tcp.buffersize.hspa=4096,87380,256960,4096,163 84,256960
#streaming faster
media.stagefright.enable-player=true
media.stagefright.enable-meta=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=true
media.stagefright.enable-aac=true
media.stagefright.enable-qcp=true
media.stagefright.enable-record=true
Some part of INIT.D :-
# Disable Logger
busybox rm /dev/log/main
# Busybox Remounting
busybox mount -o remount,noatime,barrier=0,nobh /system
busybox mount -o remount,noatime,barrier=0,nobh /data
busybox mount -o remount,noatime,barrier=0,nobh /cache
echo "Mounted Busybox"
# clearing junk files
busybox find /data/data -type d -iname "*cache*" -exec busybox rm -f {}/* ';' -exec echo "Cleared {}" ';'
rm -f /data/local/*.apk
rm -f /data/local/tmp/*.apk
rm -f /data/*.log
rm -f /data/log/*.log
rm -f /cache/*.*
rm -f /cache/recovery/*.*
rm -f /data/system/dropbox/*.txt
rm -f /data/backup/pending/*.tmp
rm -f /data/tombstones/*.*
echo "Junk cleared"
# Defrag Database Files
for i in \
`find /data -iname "*.db"`
do \
sqlite3 $i 'VACUUM;';
# Move Dalvik-Cache To Cache Partition
CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
if [ $CACHESIZE -gt 4000 ]
then
echo "Large cache detected, moving dalvik-cache to /cache"
if [ ! -d /cache/dalvik-cache ]
then
busybox rm -rf /cache/dalvik-cache /data/dalvik-cache
mkdir /cache/dalvik-cache /data/dalvik-cache
fi
busybox chown 1000:1000 /cache/dalvik-cache
busybox chmod 0771 /cache/dalvik-cache
busybox mount -o bind /cache/dalvik-cache /data/dalvik-cache
busybox chown 1000:1000 /data/dalvik-cache
busybox chmod 0771 /data/dalvik-cache
else
echo "Small cache detected, dalvik-cache will remain on /data"
fi
echo "Moved Dalvik-Cache To Cache Partition"
# Mod: Battery
setprop wifi.supplicant_scan_interval=180
setprop pm.sleep_mode=1
setprop ro.ril.disable.power.collapse=1
# Mod: Performance
setprop ro.kernel.android.checkjni=0
setprop persist.sys.purgeable_assets=1
setprop debug.sf.hw=1
setprop ro.telephony.call_ring.delay=0
setprop ro.foreground_app_mem=1280
setprop ro.visible_app_mem=2560
setprop ro.perceptible_app_mem=3840
setprop ro.heavy_weight_app_mem=6400
setprop ro.secondary_server_mem=7680
setprop ro.backup_app_mem=8960
setprop ro.home_app_mem=2048
setprop ro.hidden_app_mem=12800
setprop ro.content_provider_mem=15360
setprop ro.empty_app_mem=20480
setprop ro.foreground_app_adj=0
setprop ro.visible_app_adj=1
setprop ro.perceptible_app_adj=2
setprop ro.heavy_weight_app_adj=4
setprop ro.secondary_server_adj=5
setprop ro.backup_app_adj=6
setprop ro.home_app_adj=1
setprop ro.hidden_app_min_adj=7
setprop ro.empty_app_adj=15
# Mod: Graphics
setprop debug.performance.tuning=1
setprop video.accelerate.hw=1
setprop ro.media.dec.jpeg.memcap=8000000
setprop ro.media.enc.hprof.vid.bps=8000000
setprop persist.sys.use_dithering 1
# Touch Screen Sensitivity
echo 7035 > /sys/class/touch/switch/set_touchscreen;
echo 8002 > /sys/class/touch/switch/set_touchscreen;
echo 11000 > /sys/class/touch/switch/set_touchscreen;
echo 13060 > /sys/class/touch/switch/set_touchscreen;
echo 14005 > /sys/class/touch/switch/set_touchscreen;
# Renice Apps
renice -20 `pidof com.android.phone`
renice -19 `pidof com.android.inputmethod.latin`
renice -19 `pidof com.swype.android.inputmethod`
renice -17 `pidof com.android.systemui`
renice -9 `pidof com.android.settings`
renice -9 `pidof com.android.vending`
renice -6 `pidof com.sec.android.app.camera`
renice -6 `pidof com.sec.android.app.fm`
renice -6 `pidof com.google.android.apps.maps`
renice -4 `pidof com.google.android.apps.googlevoice`
renice -3 `pidof android.process.media`
# SqLite Optimize
for i in \
`busybox find /data -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
if [ -d "/dbdata" ]; then
for i in \
`busybox find /dbdata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
if [ -d "/datadata" ]; then
for i in \
`busybox find /datadata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
for i in \
`busybox find /sdcard -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
echo "SqLite Database Optimized"
echo "System Optimized And Boosted at $( date +"%m-%d-%Y %H:%M:%S" )"
function mountrw {
mount|grep "/system "|grep rw >/dev/null
[ $? -eq 1 ] && mount -o remount,rw $(mount|grep "/system "|awk '{ print $1 }') /system
}
function mountro {
mount|grep "/system "|grep ro >/dev/null
[ $? -eq 1 ] && mount -o remount,ro $(mount|grep "/system "|awk '{ print $1 }') /system
}
echo " Starting package optimization"
echo "Starting ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )"
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
mountrw;
echo ZipAligning $(basename $apk)
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed DC;
fi;
else
echo Velocity ZipAlign already completed on $apk
fi;
done;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk)
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed DC
fi;
else
echo Velocity ZipAlign already completed on $apk
fi;
done;
mountro;
echo "ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )"
credits
persanno
exblaze
kuro
Is it working for JB 4.1.2 roms ??
Can you provide a flashable zip to remove the mod just in case?
lucky_sidhu said:
Is it working for JB 4.1.2 roms ??
Click to expand...
Click to collapse
Just flashed on Biftor v14. Flash took about 3-4 mins so dont panic. Rom boots fine but too early for me to ppst if it makes a difference yet.
Sent from my GT-I9100 using Tapatalk 4
works fine?
thx man
Very Speed my Phone => Rocket (rom S2ROMS4MODS-V2)
wis1152 said:
Just flashed on Biftor v14. Flash took about 3-4 mins so dont panic. Rom boots fine but too early for me to ppst if it makes a difference yet.
Sent from my GT-I9100 using Tapatalk 4
Click to expand...
Click to collapse
thnx for your response. I'll try it on Neat ROM Lite 5.3.1
Ad block is not working
Still ads appearing at web pages
Sent from my GT-I9100 using Tapatalk
I can't find any improvement....
You should try Adaway app to get rid of the ads. Works quite well
casperusm said:
Ad block is not working
Still ads appearing at web pages
Sent from my GT-I9100 using Tapatalk
Click to expand...
Click to collapse
You
Damn it feels so fast on Neat ROM 5.3.1 Lite...New life to an old phone hehehe. :good:
Xviolence said:
Code:
* Your warranty is now void..
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, you getting dumped or you getting fired because your phone
* bootloops and alarm does not go off. Please do some research if you have any
* YOU are choosing to make these modifications.
Requirements :-
- Android 2.3 +
- Custom kernel (with init.d support)
- Root and Busybox installed
- 3MB of free space in "/system".
Feature :-
- Full memory management.
- kernel tweaks and improvements for better performance and battery life.
- Entropy generator engine used to reduce lags.
- Zipalign apps in "/system" and apps in "/data" every 48 hours which result in less RAM usage.
- Sqlite optimizations and faster database access.
- CPU governors tweaks and improvements for better performance and battery life.
- Increased SD Card read-ahead cache to 2048 KB .
- Ad blocking.
- Default.prop tweaks and improvements.
- Cleans log files and tombstones at every boot.
- Many other tweaks for better performance and battery life!
Steps :-
- go to system/etc/init.d/delete all files in it
- Download the zip
- Flash zip via recovery
- Feel the difference (1st boot may take time)
User praise :-
1c3_5n0w :- I'm not usually this vulgar but HOLY SH*T. My device is flying, look up in the sky!!! I come from xElite 2.0 which is a lag free GB ROM and I switched to an ICS ROM which is the Xperia Play Z Final v5 and look at the free RAM, and the battery, oh wowwww. Thanks a lot BOSS, this makes my Play, like a BOSS
fliperpl :- Installed with ROM ULTIMATE HD 5.1 and works pretty well. Phone is faster and UI seems to be smoother. Thanks
$lim $hady :- Awesome....!!!!!!!!! One word Awesome....!!!! Playing Subway Surfers without a Single Lag... Feels like my phone is running on GB.
skaloyskie :- Thanks man! I've noticed that my phone suffered less lag even I'm using Opera mini (Multi-tabbed browsing) and downloading movies via torrent. Nice
iossux :- U rock bro really boosted my performance
Some part of my Default .prop
#enable harware egl profile
debug.egl.profiler=1
#16BIT transparency , Smother Scrolling
persist.sys.use_16bpp_alpha=1
#debug.composition.type=gpu
debug.composition.type=c2d
debug.performance.tuning=1
debug.enabletr=true
debug.qctwa.preservebuf=1
dev.pm.dyn_samplingrate=1
video.accelerate.hw=1
ro.vold.umsdirtyratio=20
debug.overlayui.enable=1
debug.egl.hw=1
ro.fb.mode=1
hw3d.force=1
persist.sys.composition.type=c2d
persist.sys.ui.hw=1
ro.sf.compbypass.enable=0
#Enable tile rendering
debug.enabletr=true
persist.sys.composition.type=gpu
#3d performance
persist.android.strictmode=0
ro.min_pointer_dur=1
ro.secure=0
#Media quality
ro.media.enc.jpeg.quality=100
ro.media.dec.jpeg.memcap=8000000
ro.media.enc.hprof.vid.bps=8000000
ro.media.dec.aud.wma.enabled=1
ro.media.dec.vid.wmv.enabled=1
ro.media.cam.preview.fps=0
ro.media.codec_priority_for_thumb=so
#Speed liquid
persist.service.lgospd.enable=0
persist.service.pcsync.enable=0
# For sensor sleep control
ro.ril.sensor.sleep.control=1
#loggers
ro.config.htc.nocheckin=1
ro.config.nocheckin=1
profiler.force_disable_ulog=1
profiler.force_disable_err_rpt=1
#Scrolling
windowsmgr.max_events_per_sec=90
ro.max.fling_velocity=12000
ro.min.fling_velocity=8000
#battery saver
ro.ril.disable.power.collapse=1
pm.sleep_mode=1
usb_wakeup=enable
proximity_incall=enable
power_supply.wakeup=enable
ro.config.hw_power_saving=1
ro.config.hw_fast_dormancy=1
ro.config.hw_quickpoweron=true
persist.sys.use_dithering=0
#improve battery under no signal -- need test
ro.mot.eri.losalert.delay=1000
#net speedtweaks
net.tcp.buffersize.default=4096,87380,256960,4096, 16384,256960
net.tcp.buffersize.wifi=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.umts=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.gprs=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.edge=4096,87380,256960,4096,163 84,256960
net.tcp.buffersize.hspda=4096,87380,256960,4096,16 384,256960
net.tcp.buffersize.hspa=4096,87380,256960,4096,163 84,256960
#streaming faster
media.stagefright.enable-player=true
media.stagefright.enable-meta=true
media.stagefright.enable-scan=true
media.stagefright.enable-http=true
media.stagefright.enable-aac=true
media.stagefright.enable-qcp=true
media.stagefright.enable-record=true
Some part of INIT.D :-
# Disable Logger
busybox rm /dev/log/main
# Busybox Remounting
busybox mount -o remount,noatime,barrier=0,nobh /system
busybox mount -o remount,noatime,barrier=0,nobh /data
busybox mount -o remount,noatime,barrier=0,nobh /cache
echo "Mounted Busybox"
# clearing junk files
busybox find /data/data -type d -iname "*cache*" -exec busybox rm -f {}/* ';' -exec echo "Cleared {}" ';'
rm -f /data/local/*.apk
rm -f /data/local/tmp/*.apk
rm -f /data/*.log
rm -f /data/log/*.log
rm -f /cache/*.*
rm -f /cache/recovery/*.*
rm -f /data/system/dropbox/*.txt
rm -f /data/backup/pending/*.tmp
rm -f /data/tombstones/*.*
echo "Junk cleared"
# Defrag Database Files
for i in \
`find /data -iname "*.db"`
do \
sqlite3 $i 'VACUUM;';
# Move Dalvik-Cache To Cache Partition
CACHESIZE=$(df -k /cache | tail -n1 | tr -s ' ' | cut -d ' ' -f2)
if [ $CACHESIZE -gt 4000 ]
then
echo "Large cache detected, moving dalvik-cache to /cache"
if [ ! -d /cache/dalvik-cache ]
then
busybox rm -rf /cache/dalvik-cache /data/dalvik-cache
mkdir /cache/dalvik-cache /data/dalvik-cache
fi
busybox chown 1000:1000 /cache/dalvik-cache
busybox chmod 0771 /cache/dalvik-cache
busybox mount -o bind /cache/dalvik-cache /data/dalvik-cache
busybox chown 1000:1000 /data/dalvik-cache
busybox chmod 0771 /data/dalvik-cache
else
echo "Small cache detected, dalvik-cache will remain on /data"
fi
echo "Moved Dalvik-Cache To Cache Partition"
# Mod: Battery
setprop wifi.supplicant_scan_interval=180
setprop pm.sleep_mode=1
setprop ro.ril.disable.power.collapse=1
# Mod: Performance
setprop ro.kernel.android.checkjni=0
setprop persist.sys.purgeable_assets=1
setprop debug.sf.hw=1
setprop ro.telephony.call_ring.delay=0
setprop ro.foreground_app_mem=1280
setprop ro.visible_app_mem=2560
setprop ro.perceptible_app_mem=3840
setprop ro.heavy_weight_app_mem=6400
setprop ro.secondary_server_mem=7680
setprop ro.backup_app_mem=8960
setprop ro.home_app_mem=2048
setprop ro.hidden_app_mem=12800
setprop ro.content_provider_mem=15360
setprop ro.empty_app_mem=20480
setprop ro.foreground_app_adj=0
setprop ro.visible_app_adj=1
setprop ro.perceptible_app_adj=2
setprop ro.heavy_weight_app_adj=4
setprop ro.secondary_server_adj=5
setprop ro.backup_app_adj=6
setprop ro.home_app_adj=1
setprop ro.hidden_app_min_adj=7
setprop ro.empty_app_adj=15
# Mod: Graphics
setprop debug.performance.tuning=1
setprop video.accelerate.hw=1
setprop ro.media.dec.jpeg.memcap=8000000
setprop ro.media.enc.hprof.vid.bps=8000000
setprop persist.sys.use_dithering 1
# Touch Screen Sensitivity
echo 7035 > /sys/class/touch/switch/set_touchscreen;
echo 8002 > /sys/class/touch/switch/set_touchscreen;
echo 11000 > /sys/class/touch/switch/set_touchscreen;
echo 13060 > /sys/class/touch/switch/set_touchscreen;
echo 14005 > /sys/class/touch/switch/set_touchscreen;
# Renice Apps
renice -20 `pidof com.android.phone`
renice -19 `pidof com.android.inputmethod.latin`
renice -19 `pidof com.swype.android.inputmethod`
renice -17 `pidof com.android.systemui`
renice -9 `pidof com.android.settings`
renice -9 `pidof com.android.vending`
renice -6 `pidof com.sec.android.app.camera`
renice -6 `pidof com.sec.android.app.fm`
renice -6 `pidof com.google.android.apps.maps`
renice -4 `pidof com.google.android.apps.googlevoice`
renice -3 `pidof android.process.media`
# SqLite Optimize
for i in \
`busybox find /data -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
if [ -d "/dbdata" ]; then
for i in \
`busybox find /dbdata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
if [ -d "/datadata" ]; then
for i in \
`busybox find /datadata -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
fi;
for i in \
`busybox find /sdcard -iname "*.db"`;
do \
/system/xbin/sqlite3 $i 'VACUUM;';
/system/xbin/sqlite3 $i 'REINDEX;';
done;
echo "SqLite Database Optimized"
echo "System Optimized And Boosted at $( date +"%m-%d-%Y %H:%M:%S" )"
function mountrw {
mount|grep "/system "|grep rw >/dev/null
[ $? -eq 1 ] && mount -o remount,rw $(mount|grep "/system "|awk '{ print $1 }') /system
}
function mountro {
mount|grep "/system "|grep ro >/dev/null
[ $? -eq 1 ] && mount -o remount,ro $(mount|grep "/system "|awk '{ print $1 }') /system
}
echo " Starting package optimization"
echo "Starting ZipAlign $( date +"%m-%d-%Y %H:%M:%S" )"
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
mountrw;
echo ZipAligning $(basename $apk)
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed DC;
fi;
else
echo Velocity ZipAlign already completed on $apk
fi;
done;
for apk in /data/app/*.apk ; do
zipalign -c 4 $apk;
ZIPCHECK=$?;
if [ $ZIPCHECK -eq 1 ]; then
echo ZipAligning $(basename $apk)
zipalign -f 4 $apk /cache/$(basename $apk);
if [ -e /cache/$(basename $apk) ]; then
cp -f -p /cache/$(basename $apk) $apk
rm /cache/$(basename $apk);
else
echo ZipAligning $(basename $apk) Failed DC
fi;
else
echo Velocity ZipAlign already completed on $apk
fi;
done;
mountro;
echo "ZipAlign finished at $( date +"%m-%d-%Y %H:%M:%S" )"
credits
persanno
exblaze
kuro
Click to expand...
Click to collapse
Man, this "tweak" is a MONSTER !!!
listen to this,
i have two rom, personnal dualboot PreciousRom (neatRom 4.1.2 Based) / Biftor V14.
I use @dorimanx V8.43v15 Kernel and use extreme Performance Stweaks profil
I delete manualy files and put yours instead in init.d
I add manualy your default.prop contents in build.prop.
I never see a rom boot speeeeed like that now
Can i use your stuff in future release of my Precious ROM (with some kitkat stuff inside) ?
thanks fot your thread .
can i just add INIT.D files?
ALWA7SH6 said:
can i just add INIT.D files?
Click to expand...
Click to collapse
i think you can. save your init.d files before....
thnx
Troubadour666 said:
Man, this "tweak" is a MONSTER !!!
listen to this,
i have two rom, personnal dualboot PreciousRom (neatRom 4.1.2 Based) / Biftor V14.
I use @dorimanx V8.43v15 Kernel and use extreme Performance Stweaks profil
I delete manualy files and put yours instead in init.d
I add manualy your default.prop contents in build.prop.
I never see a rom boot speeeeed like that now
Can i use your stuff in future release of my Precious ROM (with some kitkat stuff inside) ?
thanks fot your thread .
Click to expand...
Click to collapse
sure u can use it in ur rom

Android:adb chroot: can't execute /system/bin/sh

I'm trying to install Linux on android according to this guide: androlinux .com /android-ubuntu-development/how-to-install-ubuntu-on-android/ threw all the necessary files to the memory card. The problem is when it has a file bootubuntu:
Code:
#modprobe ext2
busybox mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mknod /dev/loop1 b 7 0
losetup /dev/block/loop1 /sdcard/ubuntu/ubuntu.img
mount -t ext4 /dev/block/loop1 /data/local/ubuntu
#mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
chroot $mnt /system/bin/sh
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/loop1
Got an error when calling `chroot: can not execute '/system/bin/sh': no such file or directory`
Despite this, the file exists, I checked to `ls -la /system/bin/sh`
What to do?

Modifying build.prop via script

I'm trying to create a script to modify the build.prop file 'automatically'.
I want the script to check for entries I define and:
1. If they do not exist add them
2. If they do exist, check the value, and if it does not match what I've define modify it.
I found a much older (2012) thread and took a script from there. But it doesn't work.
It runs but outputs nothing, not changing the build.prop
I've attached the script. Is it correct?
Code:
#!/system/bin/sh
# Definitions
file=/system/build.prop
tmpf=/system.buildprop.bak
line_list="wifi.supplicant_scan_interval=120 ro.sf.lcd_density=480"
# Function to get args as needed for loop
getargs() {
par=$1
line=`echo $par |cut -d"=" -f1`
arg=`echo $par |cut -d"=" -f2`
}
# Loop to make all changes in line_list
for x in $line_lst; do
# Get all needed arguments
getargs $x
# Write this change to a tmp file to check on it
oldarg=`grep $line $file |cut -d"=" -f2`
sed "s/$line=.*/$line=${arg}/g" $file > $tmpf
# Check if the change was made
chknewarg=`grep $line $tmpf |cut -d"=" -f2`
if [ "$chknewarg" = "$arg" ]; then
cp $tmpf $file
if [ -f $tmpf ]; then
rm $tmpf
fi
echo "File edited"
else
if [ -f $tmpf ]; then
rm $tmpf
fi
echo "Expected $arg, got $chknewarg instead"
exit 1
fi
# If it doesn't exist at all append it to the file
chkexists=`grep -c $line $file`
if [ $chkexists -eq 0 ]; then
echo "$x" >> $file
fi
done
exit 0
I would certainly like to also know how to do this via update script.

[Error] Installing Ubuntu in Android (urgent help needed)

Can anyone help me solve this issue?
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
This is the boot script i am using
PHP:
###########################################
# Linux boot script V9 for Android #
# Built by Zachary Powell (zacthespack) #
# and Martin Møller (Tuxling) #
# Thanks to: #
# Johan Vromans #
# Marshall Levin #
# and to everyone at XDA! #
# Updated to work on Lenovo Tablets and #
# with ext4 .img files by Robherc #
# Feel free to edit/use this script as you#
# like but credit Linuxonandroid.org #
###########################################
# $ver: V9 #
###########################################
###########################################
# This is a function we use to stop the #
# script in case of errors #
###########################################
error_exit() {
echo "Error: $1"
exit 1
}
###########################################
# Set up variables #
###########################################
if [ -f /data/data/com.zpwebsites.linuxonandroid/files/busybox ]; then
export bbox=/data/data/com.zpwebsites.linuxonandroid/files/busybox
elif [ -f /data/data/com.zpwebsites.linuxonandroid.opensource/files/busybox ]; then
export bbox=/data/data/com.zpwebsites.linuxonandroid.opensource/files/busybox
else
export bbox=/system/xbin/busybox
fi
export usermounts=android # Base folder all user mounts are done in, should be moved to app later
export imgfile=$(dirname $0)/ubuntu.img # Default image file, another can be set by using an argument
export bin=/system/bin
export mnt=/data/local/mnt
export USER=root
if [[ ! -d $mnt ]]; then mkdir $mnt; fi
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
export SdMounted=no
###########################################
# Handle arguments if present #
###########################################
if [ $# -ne 0 ]; then
if [ -f $1 ]; then # Is full path present?
imgfile=$1
elif [ -f $(dirname $0)/$1 ]; then # Is only a filename present?
imgfile=$(dirname $0)/$1
else
error_exit "Image file not found!($1)"
fi
fi
###########################################
# If a md5 file is found we check it here #
###########################################
if [ -f $imgfile.md5 ]; then
echo "MD5 file found, use to check .img file? (y/n)"
read answer
if [ $answer == y ]; then
echo -n "Validating image checksum... "
$bbox md5sum -c -s $imgfile.md5
if [ $? -ne 0 ];then
echo "FAILED!"
error_exit "Checksum failed! The image is corrupted!"
else
echo "OK"
rm $imgfile.md5
fi
fi
fi
################################
# Find and read config file #
# or use defaults if not found #
################################
use_swap=no
cfgfile=$imgfile.config # Default config file if not specified
if [ -f $imgfile.config ]; then
source $imgfile.config
fi
###########################################
# Set Swap up if wanted #
# #
###########################################
if [ $use_swap == yes ]; then
if [ -f $imgfile.swap ]; then
echo "Swap file found, using file"
echo "Turning on swap (if it errors here you do not have swap support)"
swapon $imgfile.swap
else
echo "Creating Swap file"
dd if=/dev/zero of=$imgfile.swap bs=1048576 count=1024
mkswap $imgfile.swap
echo "Turning on swap (if it errors here you do not have swap support)"
swapon $imgfile.swap
fi
fi
###########################################
# Set up loop device and mount image #
###########################################
echo -n "Checking loop device... "
if [ -b /dev/block/loop255 ]; then
echo "FOUND"
else
echo "MISSING"
# Loop device not found so we create it and verify it was actually created
echo -n "Creating loop device... "
$bbox mknod /dev/block/loop255 b 7 255
if [ -b /dev/block/loop255 ]; then
echo "OK"
else
echo "FAILED"
error_exit "Unable to create loop device!"
fi
fi
$bbox losetup /dev/block/loop255 $imgfile
if [ $? -ne 0 ];then error_exit "Unable to attach image to loop device! (Image = $imgfile)"; fi
$bbox mount -t auto /dev/block/loop255 $mnt
if [ $? -ne 0 ];then error_exit "Unable to mount the loop device!"; fi
###########################################
# Mount all required partitions #
###########################################
$bbox mount -o bind /dev $mnt/dev
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/dev!"; fi
$bbox mount -t devpts devpts $mnt/dev/pts
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/dev/pts!"; fi
$bbox mount -t proc proc $mnt/proc
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/proc!"; fi
$bbox mount -t sysfs sysfs $mnt/sys
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/sys!"; fi
$bbox mount -o bind /sdcard $mnt/sdcard
if [ $? -ne 0 ];then error_exit "Unable to bind $mnt/sdcard!"; fi
if [[ ! -d $mnt/root/cfg ]]; then mkdir $mnt/root/cfg; fi
$bbox mount -o bind $(dirname $imgfile) $mnt/root/cfg
###########################################
# Checks if you have a external sdcard #
# and mounts it if you do #
###########################################
if [ -d /sdcard/external_sd ]; then
$bbox mount -o bind /sdcard/external_sd $mnt/external_sd
if [ $? == 0 ];then SdMounted="Yes"; fi
elif [ -d /Removable/MicroSD ]; then
$bbox mount -o bind /Removable/MicroSD $mnt/external_sd
if [ $? == 0 ];then SdMounted="Yes"; fi
elif [ -d /storage/sdcard1 ]; then
$bbox mount -o bind /storage/sdcard1 $mnt/external_sd
if [ $? == 0 ];then SdMounted="Yes"; fi
elif [ -d /storage/extSdCard ]; then
$bbox mount -o bind /storage/extSdCard $mnt/external_sd
if [ $? == 0 ];then SdMounted="Yes"; fi
# This last elif statemet will mount internal memory to /external_sd
# within the chroot environment on some devices.
# You may wish to comment it out if this behavior affects you
elif [ -d /storage ]; then
$bbox mount -o bind /storage $mnt/external_sd
if [ $? == 0 ];then SdMounted="Yes"; fi
# This is the end of the statement to comment out
fi
###########################################
# Mount all user defined mounts if any #
###########################################
if [ -f $imgfile.mounts ]; then
olddir=$(pwd)
echo "Mounting user mounts"
cd $mnt
if [[ ! -d $mnt/$usermounts ]]; then $bbox mkdir -p $usermounts; fi
echo "# Script to unmount user defined mounts, do not delete or edit!" > $imgfile.shutdown
echo "cd $mnt/$usermounts" > $imgfile.shutdown
cd $mnt/$usermounts
for entry in $(cat "$imgfile.mounts"); do
ANDROID=${entry%;*}
LINUX=${entry#*;}
if [[ -d $ANDROID ]]; then
echo -n "Mounting $ANDROID to $usermounts/$LINUX... "
if [[ ! -d $mnt/$usermounts/$LINUX ]]; then $bbox mkdir -p $LINUX; fi
$bbox mount -o bind $ANDROID $mnt/$usermounts/$LINUX &> /dev/null
if [ $? -ne 0 ];then
echo FAIL
if [[ -d $mnt/$usermounts/$LINUX ]]; then $bbox rmdir -p $LINUX; fi
else
echo OK
echo "$bbox umount $mnt/$usermounts/$LINUX" >> $imgfile.shutdown
echo "$bbox rmdir -p $LINUX" >> $imgfile.shutdown
fi
else
echo "Android folder not found: $ANDROID"
fi
done
echo "cd $mnt" >> $imgfile.shutdown
echo "$bbox rmdir -p $usermounts" >> $imgfile.shutdown
cd $olddir
else
echo "No user defined mount points"
fi
###########################################
# Sets up network forwarding #
###########################################
$bbox sysctl -w net.ipv4.ip_forward=1
if [ $? -ne 0 ];then error_exit "Unable to forward network!"; fi
# If NOT $mnt/root/DONOTDELETE.txt exists we setup hosts and resolv.conf now
if [ ! -f $mnt/root/DONOTDELETE.txt ]; then
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
if [ $? -ne 0 ];then error_exit "Unable to write resolv.conf file!"; fi
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts
if [ $? -ne 0 ];then error_exit "Unable to write hosts file!"; fi
fi
###########################################
# Chroot into ubuntu #
###########################################
$bbox chroot $mnt /root/init.sh $(basename $imgfile)
###########################################
# Shut down ubuntu #
###########################################
echo "Shutting down Linux ARM"
#for pid in `lsof | grep $mnt | sed -e's/ / /g' | cut -d' ' -f2`; do kill -9 $pid >/dev/null 2>&1; done
for pid in `$bbox lsof | $bbox grep $mnt | $bbox sed -e's/ / /g' | $bbox cut -d' ' -f2`; do $bbox kill -9 $pid >/dev/null 2>&1; done
sleep 5
###########################################
# Unmount all user defined mounts if any #
###########################################
if [ -f $imgfile.shutdown ]; then
echo "Unmounting user defined mounts"
sh $imgfile.shutdown
rm $imgfile.shutdown
fi
$bbox umount $mnt/root/cfg
$bbox umount $mnt/sdcard
if [ $SdMounted == "Yes" ];then $bbox umount $mnt/external_sd; fi
$bbox umount $mnt/dev/pts
$bbox umount $mnt/dev
$bbox umount $mnt/proc
$bbox umount $mnt/sys
$bbox umount $mnt
$bbox losetup -d /dev/block/loop255 &> /dev/null

Categories

Resources