Nuking a phone

Factory reset

  1. Enable Airplane mode
  2. Power off
  3. Remove SIM card
  4. Power on
  5. Settings > General management > Reset > Factory data reset

Initial setup

  1. Language: English (Australia). (Start)
  2. Wi-Fi: Off. (Next)
  3. Terms and Conditions: EULA (but nothing else). (Next)
  4. Date & time: [as appropriate]. (Next)
  5. Name: [leave empty]. (Next)
  6. Lock type: [as appropriate]
  7. Secure startup: Require PIN when device powers on. (Continue)
  8. Set PIN: [as appropriate]. (Done)
  9. Notifications (for lock screen): Off. (Done)
  10. Google Services: Disable All. (Accept)
  11. Samsung account: [no]. (Skip twice)
  12. More useful features: Turn off Secure your stuff. (Finish)
  13. Enable Airplane mode

Debloat

Enable USB debugging

  1. Settings > About phone > Software information
  2. Tap Build number 7 times
  3. Home
  4. Settings > Developer options
  5. Turn on USB debugging

Universal Android Debloater

See Universal Android Debloater.

On a computer:

$ sudo apt install android-sdk-platform-tools qpdf
$ git clone https://gitlab.com/W1nst0n/universal-android-debloater.git

Connect the phone by USB cable, then:

$ cd universal-android-debloater/
$ ./debloat_script.sh

Although remaining_packages.txt will be generated immediately upon arriving at the main menu, it misses the package au.com.optus.selfservice. The following regex package search gets absolutely everything:

  1. ADB backup: N
  2. Force-uninstall: 1
  3. Choose action: 0 (Packages search)
  4. Regex: .*
  5. Copy the output to debloat-list.txt
  6. Comment out packages to be kept with hashes
  7. Press any key to continue

For the result, see [debloat-list.txt].

Then do the actual debloating:

  1. ADB backup: N
  2. Force-uninstall: 1
  3. Choose action: 3 (Debloat packages)
  4. Your selection: 7 (External list)
  5. Path to the list: [as appropriate]

Unfortunately, at the time of writing (commit 8b93202ba61a), the above external-list debloating doesn't work; it just prints "Nothing to debloat". A workaround is to:

  1. Wrap all non-commented package names in quotes
  2. Stuff the result into the AOSP.sh declaration
  3. Run the debloater for the AOSP list

For some reason au.com.optus.selfservice remains, so run the debloater to remove it individually (or clear data & uninstall manually).

Finally:

  1. X (Exit and reboot the phone)

Finish up

  1. Settings > Apps > 3-dot menu
  2. Settings > Apps > Every app (even System apps)
  3. Power off
  4. Insert SIM card
  5. Power on

Install F-Droid etc.

On a computer:

  1. Get F-Droid.apk and F-Droid.apk.asc (PGP Signature) from f-droid.org
  2. Get the (official binary releases) Primary key fingerprint 37D2 ... from Release Channels and Signing Keys (henceforth referred to as <key>)
  3. Verify the binary release (note the keyserver is important)
    $ gpg --keyserver hkps://keyserver.ubuntu.com --receive-keys "<key>"
    $ gpg --verify F-Droid.apk.asc F-Droid.apk
    
  4. Copy F-Droid.apk to phone

On the phone:

  1. Settings > Lock screen and security > Unknown sources: enabled
  2. Install F-Droid.apk
  3. Disable Airplane mode
  4. Connect to Wi-Fi
  5. Install Termux, Aurora Store, etc.