[Sony Xperia XZ2 Compact Questions & Answers] orapyt:
PLEASE DO NOT FOLLOW MY INSTRUCTIONS. I DO NOT KNOW WHAT I AM DOING.

Basically, I am a complete noob wanting to root my device - using Sony Xperia XZ2 Compact Dual (H8324, build 52.0.A.8.107, so that's Android 9)[1]. I'm hoping someone can check if what I'm doing is correct and answer a few questions, as I am much confused. I appreciate your help. Hopefully, this can help other people like me who want to get into rooting.

I've been reading a lot on this website and other websites, and I think I have a basic idea of what I am supposed to do, but I've been reading some info and I do not know what is outdated and am being overwhelmed.

Before all else, I should have adb and fastboot from the 'android-tools' package (installed from pamac-manager on Linux, but there are other ways to get it for other OS's)[2]. Also, connect device to PC.

First, I need to unlock the bootloader, which can be done using two methods[3]:

1. Using adb/fastboot by running these commands:

adb reboot bootloader
fastboot oem unlock-go

OR

2. Following Sony's guide on https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader/

Then, I need TWRP, which, officially, does not support the XZ2C, so I need a custom one, like MartinX3's (https://xdaforums.com/xperia-xz2/development/recovery-twrp-3-2-2-0-touch-recovery-t3821597)[4], for example:

Download 'Sony Xperia XZ2 Compact/android_9/twrp/custom_rom/2019-07-12_12-15-30_twrp_sodp_xz2c.tar.gz'[4] (which is the latest version as of me writing this).

Extract the archive

Open a terminal in the same directory[5]:

fastboot --disable-verity --disable-verification flash vbmeta vbmeta.img
fastboot boot twrp.img

In TWRP menu on the device, open Advanced Menu, "Install recovery ramdisk" using twrp.img

Finally, I need to install a root manager, Magisk, for example (https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445).

Download 'Latest Stable' (*.zip)

Download MagistManager from the GitHub link (*.apk)

Place the files somewhere on the device through the PC (Downloads folder, for example)

Boot into recovery (which will open TWRP(?))

Install the *.zip

Boot normally and install the *.apk

At this point, I should have a rooted Sony Xperia XZ2 Compact Dual?

Process related questions:

[1] Does build number matter when rooting? Or is it just the Android version?

[2] Are there any specific Sony drivers I need to install on my Linux PC, or is 'android-tools' enough?

[3] Does the method of unlocking the bootloader matter? Which is best for a beginner? Also, when doing the adb/fastboot method, should the device be connected in recovery mode before-hand?

[4] So, over here I am downloading the TWRP for the normal Sony Xperia XZ2 Compact, not the Dual SIM one. Does that matter? I do use the two SIM slots.

[5] Again, when doing these commands, should I be in recovery mode before-hand?

Other questions:

I've been reading a lot about the DRM thing and breaking some functionality, including the camera. Is that still a problem on Android 9? I heard it's mostly not. What am I loosing from unlocking the bootloader on Android 9?

I like to keep my device updated for the security patches. I read that I cannot do that through the device with root, but I have to flash it from my PC each time. Does anyone have a guide for Linux users? Do I loose root? Where do I even download the updates from?

Also, should I keep TWRP and Magisk updated for security and stability? How do I do that?

Thank you for reading this relatively long post, and I appreciate your help. :)