How to remove apps from userspace on a Xiaomi Redmi 5/S2 (Android) Phone

The Xiaomi budget line phones are very nice phones, but tent to send a lot of advertisements through the Miui launcher, apps like games are trying to do the same.

There is a variety of options to limit this.

  • Install a PI-Hole on your local network to remove trackers and advertisement from your local network (not covered in this blog)
  • Install a DNS changer (like DNS66 or DNSpipe) on your phone and use an adblocking DNS server – like your Pi-Hole – to limit the amount of tracking and advertisements (not covered in this blog)
  • Better, install a VPN like Wireguard or openVPN on your Pi-Hole and deal also with open Wifi networks.
  • Third, remove some apps from your ph to deal one that you don’t like.

Personally I use a Pi-Hole on my network and make use of a Wireguard VPN on my Pi-Hole. However still unnecessary applications try to use the internet, claiming CPU and data (so battery) and like the games application of Xiaomi tries to push advertisements to your phone.

So, it is possible to remove the apps from the userspace of your Android Mobile with ADB. So your first step will be installing adb on your computer. Having done this you have to prepare your mobile phone to accept adb communication.

This can be achieved by going to the settings menu of your Xiaomi and go to System Settings / Additional Settings. Somewhere at the bottom you will find Developer options. Go in this item and switch on developer options and a bit lower switch on USB debugging. Almost ready.

Now connect your Phone with a USB cable to your computer and your computer will try to recognize the device (hopefully it does). This is the procedure in Windows 10.. open a command prompt and go to the folder you placed adb in, type a first command (be carefull this will remove your default android browser):

adb shell pm uninstall -k –user 0 com.android.browser

It starts the adb server and fails because your phone does not accept your commands. So now you have to look at your phones screen and accept your computer a allowed to send adb commands to your phone.

Resent the command and you will notice that the default android browser is gone (I don’t like the default browser).

As you will see the beginning of the command starts with adb shell pm uninstall -k –user 0 and then you have the code of the application you want to remove in com.android.browser.

Here are the applications I removed (notice I used powershell ./adb)

./adb shell pm uninstall -k –user 0 com.android.browser
./adb shell pm uninstall -k –user 0 com.android.thememanager
./adb shell pm uninstall -k –user 0 com.google.android.gm
./adb shell pm uninstall -k –user 0 com.google.android.music
./adb shell pm uninstall -k –user 0 com.google.android.videos
./adb shell pm uninstall -k –user 0 com.miui.notes
./adb shell pm uninstall -k –user 0 com.xiaomi.midrop
./adb shell pm uninstall -k –user 0 com.xiaomi.mipicks
./adb shell pm uninstall -k –user 0 com.xiaomi.glgm
./adb shell pm uninstall -k –user 0 com.facebook.services
./adb shell pm uninstall -k –user 0 com.facebook.system
./adb shell pm uninstall -k –user 0 com.facebook.appmanager

You could als replace the Miui launcher by Lawnchair to avoid advertisements, but do not uninstall it! Did you do somethin wrong, reset your Phone to factory defaults and restart the process. These changes only remain until a factory reset.

However with

./adb shell cmd package install-existing <package name>” you can reinstall a package

Up