Recently I decided to try out Android Pay and found that my new phone doesn’t have NFC, and that the app refused to work on my old phone because it ran CyanogenMod. Fortunately after a little research I found restoring isn’t that hard.

SafetyNet API

Android Pay complained that the device has an unlocked bootloader, was rooted and ran a custom ROM. The documentation of the SafetyNet Attestation API suggests this means the app is looking for the ctsProfileMatch check as opposed to the more forgiving basicIntegrity check. Most notably the former doesn’t allow a “device with custom ROM (not rooted)”. I wouldn’t miss the root access or the unlocked bootloader at all, but not being able to use a custom ROM is sad.


The restoration isn’t complicated once I figured out how to do it, but the amount of information to wade through is overwhelming. To navigate the gazillion articles on the internet about this potentially risky topic, I started from XDA Developers.

As per Android Pay’s complaint I need to do 2 things:

  • Relock the bootloader
  • Reinstall an original version of the OS (and conveniently lose root access during the process)

After getting Flashtool and the firmware file (see below), just run Flashtool and follow the UI.


Flashtool can be used for both tasks. It’s opensource and supports Linux. Confusingly there are 2 releases available for download as of now, and Through trial and error I found that each works with different firmwares, presumably depending on how the firmware files are created.

“Original” Firmware

Next I need the firmware. There are plenty of posts on XDA Developers that show up in search results for “xperia zr stock rom”. I didn’t make a backup of a certain partition before installing CyanogenMod so I can’t have a completely original experience, in that I won’t be able to download OTA updates.

While trying I made the mistake of not checking and used an older version of Android that Android Pay doesn’t support. Flashtool also has a list of firmwares but the ones available for ZR are also old. I ended up using an Android 5.1.1 Lollipop build which works with Flashtool