With the recent sanctions on ZTE, it seems unlikely that the Axon 7 will still be receiving security updates for Android. Fortunately, third party ROMs like LineageOS still receive updates and can replace the version of Android ZTE installed on the phone, provided you are willing to risk having an expensive paperweight instead of working device.
This is not a complete guide for how to flash your phone. I wrote it up in case anyone else runs into similar problems to mine and is struggling to figure out what is going on. What follows is provided as is, with no guarantee that the procedure described will work for you as well as it did for me. Caveat Lector
Unlocking the bootloader
In order to install a different ROM, we need to unlock the phone’s bootloader. We also need to make sure our phone can connect to a computer, so we need to have a computer (obviously) and a USB cable (USB-c to standard USB 1 or 2). Then we need to enable developer mode (and bootloader unlocking) on the phone. Depending on how up-to-date your software is, getting access to developer mode takes different steps, so be sure to read a recent guide on this topic. I used the one located here
Make sure to back up your phone!
If you have anything you are interested in having survive this install, make sure you’ve backed it up before proceeding with the rest of this guide. Ideally, you’ve backed up to both Google’s cloud and your personal laptop for extra redundancy.
Getting to fastboot:
The first problem was how to get to fastboot? Fastboot lets you flash (overwrite) what is roughly the phone’s equivalent to firmware and the bios, i.e., the thing that pops when you turn on your computer before Windows/Linux/macOS load. Unfortunately, ZTE locked off this mode in an update some time ago, so our first task is to gain access to it. I achieved this by using the axon7tools program. As the program refused to run in Linux using w.i.n.e (wine is not an emulator), I was forced to perform an unholy summoning and boot windows 10.
I started by running the axon7tools’ script for unlocking the bootloader. This lead to a prompt about install Miflash, a program whose (un)installer is only in Chinese. While I find this somewhat dubious, scanning with Windows defender did not reveal any viruses/worms/trojans. A subsequent scan from Linux of the drive using CLAM (with the ClamTK front end) found no viruses, but YMMV.
- miflash (obtained via axon 7 toolkit)
Following the prompts from axon7tools, I used miflash to regain access to recovery mode. The toolkit downloaded the installer and other requisite files for me. Be careful to follow the directions exactly here, as this is a step where you could brick your phone. If the toolkit or my guide are old when you read this post, you should find something more up-to-date to be on the safe side.
Now you should be able to use the toolkit to install twrp on your phone. Be sure to follow both the toolkit’s and (later) twrp’s prompts, as if you install twrp incorrectly I’m not sure what you’ll need to do in order to proceed with the rest of this guide.
You can find the offical guide from Lineage OS here I don’t think it is complete enough to deal with all circumstances, but it gives you a good idea of what this process involves.
Wiping the previous install.
Within twrp, select wipe, followed by advanced. Then select system, data, and cache. Congratulations, you now don’t have an operating system.
To get an operating system, you need to copy an installer you downloaded, e.g., LineageOS, over to your phone via USB. This is easily done when the phone is in “recovery mode”, which should be synonymous with twrp at this point.
Avoiding error 7
My first attempt at installing led to an error where the install
script (run from within twrp) refused to run due to the installer not
recognizing my phone as an Axon 7 U. To fix this error, you need to
remove phone version test from lineage’s installer script. You can
find this in the ziped installer at:
META-INF/com/google/android/update-script. Simply open the installer
script and delete the asserts at the top of the file. For me, this was
every line above the line beginning “ ui_print( “. Make sure to save
the file as plain text, using the same encoding as the original file
(e.g., you’ll get an error if you mix windows with UNIX style
endlines). Now copy over the modified zipped installer to your
First Lineage OS (failed)
At this point, I ran the lineage OS installer (along with the GAPS add-on), and on bootup was faced with the loading screen for lineage OS, which then never finished booting. This occurred dispute letting the bootup last for between 10 and 20 minutes. At this point, I decided to try a different OS.
Then Lineage OS for microG (failed, but told me why)
I next tried Lineage OS for microG, a fork of Lineage OS that comes installed with apps that perform similarly to Google’s apps (GAPS), but are free software/open source. This install had the same problem as the standard Lineage OS install, but had me type the password to decrypt my phone. Once I’d typed in the password, the OS told me that while it detected an encrypted partition, it was corrupted, and the phone needed to be completely wiped and the OS re-installed. This is an interesting error, as I’d already completely wiped the phone using twrp, so the encrypted partition shouldn’t be detected anymore. It turns out that while twrp can wipe out an encrypted partition, it can’t (as of now) delete the header that tells the OS there is an encrypted partition. Hence the “corruption” message.
Dealing with Encryption (that hadn’t been removed):
In order to remove the encryption, I had to use something other than twrp. Booting the phone into fastboot and using adb from the command line was the solution. adb has the ability to essentially reformat the partition, thereby destroying the old encryption header.
As adb is a command line application, here’s the command I used:
adb shell recovery --wipe_data
Note: You need adb and fastboot installed on your computer to run this. You also need to have your phone connected to your computer and in fastboot mode.
Finally, installing Lineage OS.
Now, reboot the phone into recovery mode, copy your installer over, run the installer+options, and reboot.
Procedure in short:
- Unlock bootloader
- Install twrp.
- Wipe phone.
- Install OS+options(GAPS)
- Reboot and wait.
Option: Installing GAPS
If you want to have Google’s apps (e.g., gmail, calendar, etc) then you need to install GAPS before rebooting.
Rooting: Optional addition.
You can decide to root (gain administrator level access) your phone now or wait until later. Rooting lets you install a phone-wide adblocker, so you can then block ads from wasting your data and battery in every app. The downside is that some banking apps, among others, may refuse to run. I’d recommend installing magisk, as it is easier to remove if you end up changing your mind. Magisk can, as of this writing, conceal itself from the security check the banking apps use to detect rooting, so you may end up with the best of both worlds.
Where to go if you have problems
I make no guarantees that what I’m describing currently matches the correct, safe way to install a different ROM to your Axon 7. XDA is generally the best place to find up to date information, but can be difficult to navigate. The reddit pages and official websites for the various programs/software mentioned here also often have instruction for installing.