Removing bloatware from a Samsung smartphone

I recently bought a Samsung smartphone powered by Android 10 and it came with a lot of useless, pre-installed apps(not surprising, as they did this). Some of them showed ads on lockscreen (Glance), some downloaded and installed “useful” apps without my consent (Galaxy Store), some offered to donate to charity on my behalf in exchange for voluntarily viewing ads, and one offered me to route all URLs I visit through their servers to be logged, mined and sold for “Ultra Data Saving” (Samsung Max). Most of these cannot be uninstalled nor even disabled as we do for normal apps. But fortunately, we can uninstall them using Android Debug Bridge (see this post) and it does not require us to root our phone. This process is easy and reversible, we just need to install ADB on our computer and enable USB debugging on our smartphone. This post is about how to do it using a GNU/Linux system.

Installing Android Debug Bridge (ADB)

Most GNU/Linux distros have ADB packaged in their official repositories. On Debian and its derivatives, install it using:

sudo apt install adb

On Fedora:

sudo dnf install android-tools

If installed successfully, running adb start-server will print something like * daemon started successfully.

Uninstalling bloatware using ADB shell

Enable USB Debugging on Android and connect it to the computer. Tap “Allow” when prompted “Allow USB Debugging?” on Android. If successful, running adb devices on the terminal will print at least one device. Now we can drop to the Unix shell of Android using the command adb shell. This will give us a shell that will have the necessary commands to find and remove such applications.

Finding package names

Before removing these offending apps, we need to find their package names. To list package names of all applications installed on the device, use this command on the adb shell:

pm list packages

We can also pipe it through grep like pm list packages | grep "samsung" to list all applications which have samsung in their package name. Unfortunately, this can get difficult as some of these apps have completely different package names. In particular, Glance had the package name which I had a hard time figuring out. For making this step easier, install App Manager Android application and use it to find package names. I searched for “samsung” on it and closely inspected all applications which had “samsung” in its package name. There is a Samsung Galaxy S10 bloatware list and most of the packages listed there can be found on my phone as well. For me, the must remove packages were:, for preventing apps from being automatically installed, for removing ads from lockscreen
com.opera.max.oem and, for removing "Ultra Data Saver" spyware, the "App Cloud" bloatware

Uninstalling applications

Once we got the package names, we can uninstall from adb shell using the command:

pm uninstall -k --user 0 <package name>

where <package name> is the package name of the application we would like to remove. Repeat this step to remove all unnecessary packages.
Don’t worry if you uninstall essential packages, it will only be removed for the primary user and the -k option will keep the app data even after removal. To reinstall an application, we can use:

pm install-existing <package name>

These apps will return after a factory reset or an OTA update and needs to be uninstalled again (On the bright side, this ensures that we can never brick our phone this way as the fix is just a factory reset away if anything goes wrong).
I’ve uninstalled about twenty applications so far and there are certainly more that could be removed. It is really disappointing that the phone we paid for comes pre-installed with these annoying apps made purposefully difficult to remove/disable, but at least for the time being we can remove them using adb.