[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...)

#!/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/vendor.lineage.livedisplay@2.0-service.oneplus3'
rm -f '/system/vendor/etc/init/vendor.lineage.livedisplay@2.0-service.oneplus3.rc'
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.