remove xiaomi bloatwares using adb on linux
xiaomi offers smartphones with great hardware at affordable price but pre-installed some apps i don't need. some of them can be easily uninstalled, but some need additional effort. these are the steps to remove the craps using adb:
setup
enable usb debugging on the device:
download adb command line tool:
wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip
unzip platform-tools-latest-linux.zip
cd platform-tools/
connect the device to computer via usb, a pop up should appear on the device asking to allow the computer to perform usb debugging, tap ok.
then run this command to ensure the device is online:
./adb devices
if the device is listed as offline
, try unplugging, disable usb debugging on the device, reenable, and replug it.
open adb shell to control/interact with the device:
./adb shell
debloating
make a list of packages to uninstall. the easiest way to find the package name of an app is to open the google play store listing. for instance, xiaomi's file manager is here https://play.google.com/store/apps/details?id=com.mi.android.globalFileexplorer&hl=en
and the package name is com.mi.android.globalFileexplorer
.
beware that some packages should not be uninstalled as it will cause boot loop. please consult this list.
inside the adb shell, start uninstalling/disabling those craps, e.g.:
pm uninstall --user 0 com.mi.android.globalFileexplorer
pm uninstall --user 0 com.miui.videoplayer
pm uninstall --user 0 com.xiaomi.glgm
pm uninstall --user 0 com.mi.globalbrowser
pm uninstall --user 0 com.google.android.videos
# etc. etc.
useful commands:
pm uninstall --user 0 <package_name>
to uninstall an app and delete its local data.pm uninstall -k --user 0 <package_name>
to uninstall an app and retain its local data.cmd package install-existing <package_name>
to reinstall uninstalled app.pm disable-user --user 0 <package_name>
to disable an app.pm enable <package_name>
to re-enable disabled app.
finally hit ctrl-c to exit the shell and unplug the device.
conclusion
with great care, it's possible to uninstall or disable system apps pre-installed by manufacturer while preventing from the device becoming a useless paperweight. of course this won't rule out the possibility of state-sanctioned surveillance, but i think every smartphone is a spyware regardless of where it came from, but that's a topic for another day.