Sony Mobile is one of the most open source and developer friendly OEMs out there with programs like Hero Open Source Developer and Sony Open Devices. Sony has published guides on how to build the Linux 4.4 kernel or the latest Android release, and even how to unlock the bootloader of their devices. Unfortunately, unlocking the bootloader of any Sony Xperia device leads to a lot of undesirable outcomes. For instance, the camera is totally broken, resulting in nothing but green pictures. Other software features like Sony's video and audio enhancements are also broken, even if you stick to the stock ROM. Losing Sony's video and audio tweaks are one thing, but having to deal with a broken camera is a trade-off that many are unwilling to make. Fortunately, it seems that the Android Pie update no longer breaks the camera on Xperia devices with unlocked bootloaders.

For context, Sony Xperia devices have a trim area (TA) partition that contains the DRM keys and other device-specific information like the IMEI, Serial Number, MAC address, etc. Unlocking the bootloader wipes the DRM keys in the TA partition. Once it's wiped, there's no way to restore it without a backup (which you can't make unless you already have root). Without the DRM keys, Sony's proprietary audio and video features (X-Reality Video Enhancement, DSEE HX, ClearAudio+, etc.) won't work on the stock ROM. However, unlocking the bootloader also incidentally breaks the camera functionality because of a likely error involving failing to read the DRM keys (the issue is still not well understood). (Thanks to XDA Recognized Developers Myself5 and Luk1337 for the explanation.) Sony even warns you of this before unlocking the bootloader:

"Certain pre-loaded content on your device may also be inaccessible due to the removal of DRM security keys. For devices running recent software versions, for instance Xperia Z3, the removal of DRM security keys may affect advanced camera functionality. For example, noise reduction algorithms might be removed, and performance when taking photos in low-light conditions might be affected." - Sony Mobile

The list of DRM-related features you would lose include some camera post-processing features, color gamut profiles, white balance, X-Reality Video Enhancement, DSEE HX, ClearAudio+, and Widevine L1 support for HD Netflix. Over time, some clever developers like XDA Senior Members tobias.waldvogel, mbc07, munjeni, and others discovered ways to restore the lost functionality by either modifying core system libraries or simulating a locked device without root. Sony likely intended for the DRM-related features to be broken after unlocking the bootloader, but it's unclear whether the camera taking green pictures is intentional.

Nonetheless, using tricks may no longer be necessary to at least get the camera working, as XDA Senior Member Miustone and others discovered after updating their devices to Android Pie. XDA Senior Member LazerL0rd was kind enough to record a video for us showing that his rooted Sony Xperia XZ Premium running Android 9 Pie is still able to use the camera. He also tested which features are working and which are still broken as intended by Sony:

  • What works: Color Gamut profiles, Camera no longer takes green pictures (quality not guaranteed to be the same, but it works at least), White Balance, Camera2API (FULL without RAW for rear camera, LIMITED for front camera)
  • What doesn't work: X-Reality Video Enhancement, DSEE HX, ClearAudio+, Widevine L1

In summary, all the DRM-related audio and video features are still not working, but the camera is no longer broken which was a huge issue for Sony users.

We're not sure what made Sony decide to no longer break the camera when unlocking the bootloader, but we hope it wasn't just a mistake when updating their devices to Android Pie. We don't see why Sony felt the need to limit access to their camera, video, and audio features for users who unlock the bootloader, especially because it forced some community members to turn to third-party paid services. Android Pie is currently available for the following Sony Xperia devices, so if you have one of the devices listed below then you should be able to enjoy custom ROMs without entirely sacrificing the camera.

  • Sony Xperia XZ Premium
  • Sony Xperia XZ1
  • Sony Xperia XZ1 Compact
  • Sony Xperia XZ2
  • Sony Xperia XZ2 Compact
  • Sony Xperia XZ2 Premium
  • Sony Xperia XZ3 (bootloader unlock not yet available)

This article was updated at 10:08AM CT to make the distinction between the DRM fix and camera more clear.