[Sony Xperia XZ Premium Themes, Apps, and Mods] Pointless816:
Hello,

I've created a simple .bat file which can be run from a Windows computer while your phone is booted into TWRP to remove various apps that I consider bloat. I have not encountered any issues in my usage the past week, but your usage pattern may vary. This is tested on a G8142 running Oreo 47.1.A.5.51, but there is no reason it should not work on other versions. This is limited to Windows, but the commands are all ADB-specific and have nothing to do with Windows, so it should also work on Mac & Linux by changing the file extension.

I take no responsibility if this messes up your phone!

But, all changes this script makes can be reversed by flashing system & oem with Newflasher.

Note:

This script will remove Sony Home! Please make sure you have an alternate launcher installed or remove that app from the script!!!

Additionally, the app removes Google Messages, Sony Clock, Sony Calendar, Chrome, Sony Email, Gmail, Google, various international keyboard layouts, and Text-to-speech functionality. All of these, or alternatives, can be re-installed through the Play Store though.

To Modify:

The .bat file can be modified by opening with any text editor. All apps are labeled with their name, as below:

::Google Messages

adb shell rm -rf /system/app/Messages

adb shell rm -rf /data/user/0/com.google.android.apps.messaging

To prevent this app from being uninstalled, just delete those lines.

To add an app that is not on the list, use an app such as App Inspector to find the directory the app is installed to and the directory its data is located in, then add those to the list as below:

adb shell rm -rf <app Source Dir, excluding last /******.apk>

adb shell rm -rf <app Data Dir>

In some instances, such as if the app has been updated from the Play Store, you may need to remove it from /data/app/ and from /system/app/ (or /system/priv-app) as below:

::Sony What's New

adb shell rm -rf /system/priv-app/sonyentrance2-release

adb shell rm -rf /data/app/com.sonymobile.entrance*

adb shell rm -rf /data/user/0/com.sonymobile.entrance

The * above is used as a wildcard, meaning that any folder that matches everything before the * will be deleted. This is needed because random strings of letters and numbers are added to the end of the app name when installed to /data/app/. Please be careful with your * use, since using something like "adb shell rm -rf /data/app/com.sonymobile.*" would clear out several apps' data!

Instructions:

Power down the device

Reboot into TWRP by holding Power and Volume Down (phone must not be plugged into computer yet)

Attach phone to computer

Unzip JunkCleaner.zip (this is not a flashable zip!) and extract JunkCleaner.bat

Move JunkCleaner.bat to a folder that contains adb.exe

Double click on JunkCleaner.bat and let run to completion

You're all set!

Known Issues:

Swiftkey may force close on you, to fix this, clear the cache from Settings -> Apps & notifications -> App Info -> Swiftkey Keyboard -> Storage -> Clear Cache

You will see a notification that com.sonymobile.rcahandler has force closed when you first boot the phone. This can be fixed by turning on Ultra Stamina mode, turning it off, then rebooting a second time after Ultra Stamina Mode has already rebooted your phone.

To Return to Stock/Reinstall any apps:

To get back to stock, just use Newflasher to reinstall system & oem partitions. This will restore all apps that this script removes.

Please let me know if there are any apps that you have safely removed that are not in my list, as I'm sure the amount of apps can be whittled down even further.