As an alternative to the other answer, I bring a more definitive approach, based on addon.d
and targeted at system apps deletion.
Remember that, unlike the pm
based method, which can be reversed at will, apps deleted with this approach can only be reobtained by commenting out the appropriate lines in the debloater script and reapplying the OTA update.
Introduction
Any shell script in the /system/addon.d
directory is executed right after an OTA update has been applied. The order of execution depends on the integer at the beginning of a file's name, since scripts are evaluated in increasing order.
The code
The removal of a system app is simply a matter of issuing rm -rf
on the app's parent directory. We can thus write a script so that these removals are carried out seamlessly after each update.
If, for example, we want to remove the stock Email
app, our script will look like
#!/sbin/sh
rm -rf "/system/app/Email"
Here, the #!/sbin/sh
is a mandatory line that instructs TWRP about which program will evaluate the script. Do not remove it.
rm -rf
is a command used to forcibly remove whatever follows it in a recursive fashion. Thus, rm -rf "/system/app/Email"
removes the /system/app/Email
directory and everything inside it, thereby deleting the Email app altogether.
To add more apps to the list, simply append more rm -rf
statements as per the example, replacing /system/app/Email
with the path of the app you want to remove.
Finalizing
Once you're done writing the script, you'll need to copy it to /system/addon.d
. In order to be executed, its name should begin with an integer, followed by a hyphen. For the sake of this answer, I'll call it 99-debloat.sh
, which makes it be evaluated after the other addon scripts.
After that, you'll likely need to change the script's permissions and ownership. To change the permissions, use
chmod 755 /system/addon.d/99-debloat.sh
To alter the ownership, use
chown 0.0 /system/addon.d/99-debloat.sh
A full example
The method described in this answer is the one I myself use; I'll add my personal 99-debloat.sh
script here for reference.
#!/sbin/sh
app="/system/app"
priv_app="/system/priv-app"
rm -rf $app/Calendar
rm -rf $app/Email
rm -rf $app/FM2
rm -rf $app/PicoTts
rm -rf $app/Stk
rm -rf $priv_app/FlipFlap
rm -rf $priv_app/Gallery2
rm -rf $priv_app/Snap
rm -rf $priv_app/WeatherProvider