Installing LineageOS in the Sony Xperia XZ2 Compact Dual (in GNU/Linux) 4/5: Bringing back Sony’s stock camera app


I have no responsibility whatsoever if this guideline causes any harm to your device. The intention of these posts are solely as personal notes for myself. Follow them at your own risk.


Through these steps I will unlock the phone’s bootloader, erasing all data. This includes the DRM keys stored in the Trim Area (TA) partition. I’ll attempt backing them up but, as of today, there is no way of restoring them to the previous state nor knowing if the actual backup is usable at all.

Without these DRM keys, several audio and video proprietary functionality provided by Sony won’t be available including some camera post-processing features, color gamut profiles, white balance, noise reduction, X-Reality Video Enhancement, DSEE HX, ClearAudio+, and Widevine L1 support for HD Netflix.

Bringing back the stock camera

In the previous posts we have downgraded the stock firmware from Sony, backed up the Trim Area (TA) partition and installed LineageOS.

Thanks to the great people from the xda-developers forum we have the chance to add Sony’s stock camera app. We will adb sideload it the same way we installed Magisk in the previous post, for example

First, the zip is called SemcCamera ( at the moment of writing this) and it is, currently, the only add-on available for the Official LineageOS 17.1 image for the xz2c phone.

We download the file, reboot into Recovery Mode and plug the phone to the computer with the USB cable. Select Apply Update -> Apply from ADB:

root$ adb sideload
Total xfer: 1.00x

Now, Go back -> Reboot system now.

Currently, the stock camera won’t work out of the box. It needs to disable SELinux or set as Permissive. Luckly, since we have Magisk installed and we can grant root privileges, we can install SELinuxModeChanger and do so.

That’s it, now you should be able to use Sony’s stock camera!

Extra treat: add Sony’s Bokeh app

Sony also provides a nice application for taking fancy photos: Bokeh (Background defocus).

Unfortunately, we cannot install it just from Google’s Play Store since it claims that the app is not compatible with this phone.

However, we can force the installation, for example, using the Aurora Store.

Finally, if you want to know about some bumps I got during the road, continue to the Appendixes.

5 thoughts on “Installing LineageOS in the Sony Xperia XZ2 Compact Dual (in GNU/Linux) 4/5: Bringing back Sony’s stock camera app

  1. Hi, thanks for the article !
    Would it work on lineage 20 ? I’ve read the stock camera libs are not supported anymore since android 11. But then what if I do the same procedure with a sony camera app that was developped for a sony phone with android > 11 ?

  2. I’m running LineageOS 19 in my phone right now. I followed the same steps. Mostly they are unchanged although I wasn’t able to install Open GApps at the time (they weren’t available) and the way to make use of the camera (and other Sony stock apps) has changed.

    Right now, I have them installed as Magisk modules from:

    Probably, they work in a similar way for LineageOS 20 and you should be able to find instructions about that without much trouble.

    I’d recommend joining the Xperia XZ2/3 lounge Telegram group.

  3. Hi, I’ve just stumbled upon this blog after installing LineageOS 20 and noticing the camera quality on my Xperia XZ2C getting really bad. I unfortunately already flashed the ROM and unlocked my bootloader, so I haven’t backed up the “TA partition” that you are talking about in this article. Is that a problem, or can I install the camera app anyways? Thanks for any replies.

  4. I don’t have experience with LineageOS 20 so I don’t know which is the status of the camera app. However, I don’t think there should be any problem to install the camera app if you have not backed up the “TA partition”. Those are 2 unrelated things.

    Take a look at my previous comment, you have there a couple of links to dig for more information.

Leave a Reply

Your email address will not be published. Required fields are marked *