/de-google-android_ADB_Tutorial

How to de-google, increase the security and improve the privacy and usability of the Asus Zenfone via ADB

GNU General Public License v3.0GPL-3.0

How to de-google, increase the security and improve the privacy and usability of the Asus Zenfone via ADB

In this article we will learn how to de-google the smartphone and uninstall all the bloatware that ships from factory without compromising device functionality. For this we will use the ADB command (android debug bridge) in Linux. When we buy an android smart-phone, in theory we get a Swiss army knife for everyday life, but in practice, as we buy it from consumer electronics the device comes with so many trackers from factory that we will never be able to take advantage of its full potential unless we make some changes. As the firms that produce them continue to prioritize not user experience and freedom, but rather the targeted advertising model that forces tracking of user behaviour, the myriad of trackers that this option entails slows down the device and makes it harder to use, often forcing the device to consume more memory, more battery and, should we decide to take action to counter this abusive behaviour, using disable or freeze, causing loops that will hinder network access. The only option is to prevent those apps from running without our consent, thus ceasing to compete with the apps we intend to use. Because these are system-level apps, Uninstall is the only effective command to stop them. We can then get rid of those .apk that only serve third party interests, doing nothing for the user-purchaser, who is the one who has the legitimate right to use the device as and only as he wishes. In order to enjoy the Swiss Army Knife for which we gave up our money, we have to clean the device we just bought! Yes it is the sad truth. We could pay more for somewhat factory cleaner alternatives like Volla Phone or Murena Fairphone 3+ - eSolutions - deGoogled phones and services or else clean the phone ourselves via adb. Just follow this manual.

Pre-requisites: when you first turn on your phone you must not have any SIM card with data plan or memory card inserted in your device and, despite the Google app asking us to do so, you must not allow your device to connect to any networks. And, of course, we must not enter any kind of credentials or phone number into any system app. Not clicking yes nor accepting nor agreeing to any questions the Google app asks us. Just keep saying no and set "later " until we can exit the app. Close the application. To access the developer tools that are hidden in android go to settings > about > software information > and repeatedly click build number seven times. You'll get a toast message saying "congratulations! You are now a programmer ". From there on the second-to-last entry in the settings should read developer options. So let's get to it!

  1. On the phone, enable usb debugging in the > settings > developer options. It is also advisable to select stay awake. In my case I opened the appManager, searched for the app to uninstall and kept the app open so I could verify that by running the adb command on the pc, the app disappeared effectively from the smartphone screen (it was no longer available to user 0).
  2. In Linux open the terminal, in the case of Kubuntu, open Konsole (CTL+ALT+T) and type adb devices which returns on the first line * deamon started successfully and on another line an 8 digit string with the serial number of the device.
  3. To uninstall the .apk itself you must type the command adb shell pm uninstall --user 0 (.apk name). For example, to uninstall google assist type adb shell pm uninstall --user 0 com.google.android.googlequickserchbox. The command returns on the line below the word "Success". In reality the .apk is still there but it is not available to user 0 (that's us) and therefore will not be executable.

What if we need to reinstall some of those apps?

The uninstall can be reversed with the install r command. First we need to find the location of the install file (the .apk). Just type adb shell pm dump com.google.android.<app-name> | grep Path which returns the path of the .apk and then we can reinstall it by typing adb shell pm install -r --user 0 /absolute/path/to/file/app-name_v0.0.0.apk (pseudo code). For example, if we want to continue to be able to install / uninstall / reinstall .apks from within the phone itself we have to reinstall one of the apps that are in the list below. First, we have to search for it by typing adb shell pm dump com.google.android.packageinstaller | grep Path which returns these two lines:

      codePath=/system/priv-app/GooglePackageInstaller
      resourcePath=/system/priv-app/GooglePackageInstaller

to reinstall we type adb shell pm install -r --user 0 /system/priv-app/GooglePackageInstaller which returns:

/com.google.android.packgeinstaller-1.apk pkg: /system/priv-app/GooglePackageInstaller
Success

List (with comments) of the 57 .apk to uninstall (.apk that contain trackers and can be replaced by better apps) and other useful commands. Note that this is the bloatware I found on my phone but the list depends on the device and manufacturer.

  adb devices //initialize communication with the device
  adb --help //help on all adb commands
  adb shell pm list permission-groups //view device permission groups
  adb shell pm list users //list users on the device
  adb shell pm get-install-location //see where apk is being installed
  adb shell pm list packages // list all apk installed for the user
  //commands for all .apk to uninstall (with some comments). Upon pressing ENTER and executing each command below, the program should return "Success":
   adb shell pm uninstall --user 0 com.google.android.onetimeinitializer
   adb shell pm uninstall --user 0 com.google.android.googlequicksearchbox //the google assistant that's always listening
   adb shell pm uninstall --user 0 com.google.android.marvin.talkback //the one that lets google listen to you
   adb shell pm uninstall --user 0 com.google.android.syncadapters.contacts //sends your contacts to google
   adb shell pm uninstall --user 0 com.google.android.apps.messaging
   adb shell pm uninstall --user 0 com.google.android.apps.docs
   adb shell pm uninstall --user 0 com.google.android.gsf.login
   adb shell pm uninstall --user 0 com.google.android.gsf
   adb shell pm uninstall --user 0 com.android.chrome
   adb shell pm uninstall --user 0 com.google.android.calendar
   adb shell pm uninstall --user 0 com.google.android.vending
   adb shell pm uninstall --user 0 com.google.android.gms
   adb shell pm uninstall --user 0 com.google.android.gm
   adb shell pm uninstall --user 0 com.google.android.youtube
   adb shell pm uninstall --user 0 com.google.android.youtube
   adb shell pm uninstall --user 0 com.google.android.apps.maps
   adb shell pm uninstall --user 0 com.google.android.apps.photos
   adb shell pm uninstall --user 0 com.google.android.talk
   adb shell pm uninstall --user 0 com.google.android.music
   adb shell pm uninstall --user 0 com.google.android.videos
   adb shell pm uninstall --user 0 com.google.android.feedback
   adb shell pm uninstall --user 0 com.google.android.webview
   adb shell pm uninstall --user 0 com.google.android.apps.docs.oem
   adb shell pm uninstall --user 0 com.google.android.tts
   adb shell pm uninstall --user 0 com.google.android.configupdater
   adb shell pm uninstall --user 0 com.google.android.partnersetup
   adb shell pm uninstall --user 0 com.google.android.packageinstaller //!Warning this is the app that allows you to manage .apks directly on android. See above how to reinstall it in case we need to manage apps without adb access. It has no trackers so we may not uninstall this one!
   adb shell pm uninstall --user 0 com.google.driveactivator
   adb shell pm uninstall --user 0 com.android.cellbroadcastreceiver //allow the government via isp to send you propaganda messages
   adb shell pm uninstall --user 0 com.google.android.backuptransport
   adb shell pm uninstall --user 0 com.android.vending
   adb shell pm uninstall --user 0 com.amazon.kindle //what is this doing on a phone?
   adb shell pm uninstall --user 0 com.tripadvisor.tripadvisor //what is this doing on a phone?
   adb shell pm uninstall --user 0 com.oma.drm //Censorship app which may prevent you from reading file content (not gnu/copyleft compliant and tries to impose copyright censorship)
   adb shell pm uninstall --user 0 com.qrd.omadownload
   adb shell pm uninstall --user 0 com.asus.dm //tries to download system updates (+-2GB) every time you enable a data connections: resembles a DDOS attack
   adb shell pm uninstall --user 0 com.ironsource.appcloud.oobe.asus
   adb shell pm uninstall --user 0 com.asus.ia.asusapp
   adb shell pm uninstall --user 0 com.asus.livedemo
   adb shell pm uninstall --user 0 com.asus.livedemoservice
   adb shell pm uninstall --user 0 com.asus.maxxaudio.audiowizard
   adb shell pm uninstall --user 0 com.asus.maxxaudio
   adb shell pm uninstall --user 0 com.asus.launcher
   adb shell pm uninstall --user 0 com.asus.server.azs
   adb shell pm uninstall --user 0 com.asus.weathertime
   adb shell pm uninstall --user 0 com.asus.gallery
   adb shell pm uninstall --user 0 com.asus.flashlight
   adb shell pm uninstall --user 0 com.asus.ephotoburst
   adb shell pm uninstall --user 0 com.asus.userfeedback
   adb shell pm uninstall --user 0 com.asus.calculator
   adb shell pm uninstall --user 0 com.asus.easylauncher
   adb shell pm uninstall --user 0 com.asus.filemanager
   adb shell pm uninstall --user 0 com.asus.soundrecorder
   adb shell pm uninstall --user 0 com.asus.ime //zenUI keyboard
   adb shell pm uninstall --user 0 com.asus.keyboard //zenUI keyboard 
   adb shell pm uninstall --user 0 com.asus.as //asus analytics
   adb shell pm uninstall --user 0 com.asus.contacts.theme.dark
   adb shell pm uninstall --user 0 com.asus.contacts //allows you to manage SIM contacts (useful if you have to use a dumbphone) but makes your .vcf contacts almost unusable by making *merges* that hide duplicate contacts (and there are alternative apps for managing SIM contacts)
   adb shell pm uninstall --user 0 com.asus.asusincallui //hi-jacks the dialer app
   adb shell pm uninstall --user 0 com.asus.camera
   adb shell pm uninstall --user 0 com.asus.deskclock
   adb shell pm uninstall --user 0 com.asus.systemupdate
   adb shell pm uninstall --user 0 com.asus.zentalk
   adb shell pm uninstall --user 0 com.qualcomm.location.XT //to use gps you only need com.qualcomm.location not the XT that keeps running even inside buildings mapping where you are and allowing triangulation plus every time you start gps it asks permission yhus nagging you until you say yes (dark design pattern)
  adb shell pm trim-caches //delete all applications cache
  adb shell pm reboot //restart the device

☞ Replacement apps list

Once the undesirable applications have been removed, they need to be replaced. Here is the list, in alphabetical order, of the FOSS apps (source code available for anyone to scrutinize and improve) and no trackers to make your phone a user-friendly Swiss army knife:

List made using List My Apps

A note about the assistance app!

We have uninstalled Google's assist app as it is too invasive of one's privacy as it listens and reports everything we say and also everything we type (if we use it together with the factory-shipped keyboard app, our typing history would also be sent to the manufacturer; in this case ASUS) under the pretext of "assisting" us and "improving (err... acknowledge!) the user experience". We should therefore replace it with one that has the possibility to work offline only. Once we have installed the KISS launcher we can use it not as the default launcher (for which I use Lawnchair but as an assist app. We can choose what we want the app to find for us: I told it to search only for a) contacts, b) device settings and c) shortcuts (but it's also possible to include web search providers and choose the search engine); I also keep the history frozen so as not to exponentially increase the app's database. To use KISS as an assistance app: go to settings > apps > icon cogwheel > default apps > assist app > and choose KISS Launcher from the list.

Now we can insert our cards into the device and configure it to our needs. The above list exhaustively covers the features of all the .apks we just uninstalled, and adds some more features respective to my personal requirements at the time of writing this tutorial; despite that eventually some people will not require so many apps while others may require more. The FOSS repositories are full of good applications that we can test.

How do we know which apps we should remove?

First we need to understand which apps on our device have trackers and which, for that reason, we should not trust. Both appManager and ClassyShark3xodus scan the system exposing all existing trackers. Both are reliable as they both use the ExodusPrivacy database.

Where to get alternative and trusty software?

We can browse the web or we can install Foxy Droid to manage our repos, apps and updates.

Here's the list of the repositories we should enable in foxydroid and it's web counterparts.

* R E P O S * * W E B *
https://f-droid.org/repo https://f-droid.org/en/packages/
https://f-droid.org/archive https://f-droid.org/en/packages
https://guardianproject.info/fdroid/repo https://guardianproject.info/
https://guardianproject.info/fdroid/archive https://guardianproject.info/
https://apt.izzysoft.de/fdroid/repo https://apt.izzysoft.de/fdroid/
https://cdn.kde.org/android/fdroid/repo https://cdn.kde.org/android/fdroid/repo/

Glossary:

  • adb = android debug bridge
  • apk = android package
  • shell = command line that communicates with operating system services
  • pm = package manager