[Xperia Z2 General] djibe89:
[GUIDE/TUTORIAL/HOWTO] Sony Xperia Z2 Stock to Android 11

[GUIDE/TUTORIAL/HOWTO] Sony Xperia Z2 (sirius/D6502/D6503) Stock to Android 11 R / LineageOS 18.1

This detailed step-by-step guide helps you transform your Sony Xperia Z2 to a powerful one with Android 11.

Netflix and Disney+ work as 2022/09/19, gestures navigation too.

BEFORE GOING FURTHER

- Make sure you are with a Xperia Z2

Go to Menu > Settings > About phone > Model number is: D6502 or D6503.

- Make sure bootloader is unlockable

Open phone app, dial *#*#7378423#*#* > Service info > Configuration > Rooting status: Bootloader unlock allowed: Yes

If No, you can cry, you cannot get further.

In previous menu, go to SIM Lock and make sure all the networks start with [].

If not, ask your Telecom provider the SIM unlock code.

### You must be logged as a Microsoft Windows administrator to run console commands below.

### When you lose control of Xperia Z2, hold Power + Volume+ until phone restarts.

CHANGELOG

v1. Initial release

1) DOWNLOAD FILES

- djibe Xperia Z2 pack: https://bit.ly/djibe-xperia-z2

(contains Z2 USB official drivers + adb + fastboot + recovery TWRP 3.3.1-0 Arian + Magisk 25.2)

+ ROM LineageOS Official 18.1: https://xdaforums.com/t/lineageos-17-1-for-xperia-z2.4054605/

Download latest build: https://download.lineageos.org/sirius

+ BitGApps ARM 11 (v1.3+): https://xdaforums.com/t/custom-gapps-bitgapps-for-android.4012165/post-81060605

Download latest build: https://github.com/BiTGApps/BiTGApps-Release/releases

+ a microSD card. Copy ROM, BitGApps, Magisk on microSD card and insert it in phone.

+ Charge phone to 100%.

2) INSTALL DRIVERS

Right click on Windows Start menu > Device manager.

Right click on Computer's name (top of devices list) > Add legacy hardware.

Set folder's path of my Xperia_Z2_driver/ folder.

Click Next to install.

Reboot Windows.

3) IMEI NUMBER

On phone, go to Menu > Settings > About phone > Status > IMEI Information

Note the IMEI. Store it.

4) FIRMWARE NUMBER AND USB DEBUGGING

On phone, go to Menu > Settings > About phone > Build number

Make sure it is 23.5.A.1.291 and tap 7 times on it to unlock Developer options.

If not 23.5.A.1.291, go to Menu > Settings > About phone > Software update > System updates tab

### Don't go further if you are not with 23.5.A.1.291 firmware.

Go to Menu > Settings > Developer options > USB debugging, switch it ON and confirm it in next Dialog.

5) GENERATE BOOTLOADER UNLOCK CODE

From your PC, go to: https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader/

At the bottom of the page, in Select your device: Select Xperia Z2

Enter your IMEI + check both checkboxes after this.

Copy the unlock code.

6) FASTBOOT MODE

Connect phone to USB.

Open the flash/ folder from my pack.

In Windows address bar, type "cmd" and hit Enter. A Windows Command window will open.

Now type

adb devices

Command returns: List of devices attached

CB5A2829N6 unauthorized

If no Allow USB debugging? screen shows up on phone, disconnect and reconnect phone.

Check ON always allow from this computer and tap on OK.

Enter command:

adb reboot bootloader

Phone restarts and a blue light appears on phone's top border.

Go back to Windows Device Manager.

Xperia has a yellow triangle in Mobile devices and is called S1Boot Fastboot.

Right click on it > Update driver > Browse my computer for drivers > Choose from a list > Force Sony sa0111.

(https://www.sony.co.uk/electronics/support/articles/SX278901)

Now you can enter command:

fastboot devices

Command returns: CB5A2829N6 fastboot

7) UNLOCK BOOTLOADER

### All data will be lost

Fill the command with your Unlock Code:

fastboot oem unlock 0xYOURUNLOCKKEY

confirm with Enter. After 2 seconds, it is displayed OKAY.

Bootloader is unlocked !

8) FLASH TWRP RECOVERY 3.3

Still in fastboot, type in console :

fastboot flash recovery twrp-3.3.1-sirius-20200221.img

. Confirm with Enter.

Wait, then once the confirmed success,

type :

fastboot reboot

, confirm with Enter

Let phone restart.

Shut it down.

Hold Power + Volume- until phone vibrates and release buttons, wait during TWRP boot.

9) BACKUP CURRENT ROM

You are now in TWRP recovery, Swipe to Allow Modifications.

Go to Backup, select Boot, EFS, System partitions.

Tap on Select Storage and select MicroSD Card.

Swipe to Backup.

Go to TWRP Home screen.

Go to Wipe > Advanced Wipe > Select Dalvik, Cache, Data, Internal Storage, System and swipe to confirm erasing.

Go to Wipe > Format Data, type yes and tap on botton right check icon.

10) INSTALL ROM, GAPPS AND MAGISK

Back to TWRP home menu.

Go to Install > Select Storage > Micro SD card > OK

Select lineage*.zip.

### If you get an error and flash fails, go to Reboot > Recovery and wait for TWRP to reboot.

Add more zip > BitGapps*.zip file,

Swipe to confirm flash.

Wait while Install Zips are flashed.

Root install (Optional):

Go to Reboot > Recovery

Back to TWRP > Go to Install > flash Magisk*.zip

At the end, tap on Wipe Cache/Dalvik, then Reboot System.

Wait during boot.

(Google search app will probably crash during Setup).

11) ROOT (Optional)

### Disney+ and Netflix tested without Root !

Configure Android as you like.

Magisk root starts with Android.

You can manage permissions and extra modules with Magisk Manager app.

If Magisk Manager doesn't download apk. Download official apk here: https://github.com/topjohnwu/Magisk/releases

12) TWEAKS

Go to Settings > About phone > Tap 7 times on Build number.

Go to Settings > System > Advanced > Developer options.

Advanced restart switched ON (Hold power > Restart > Restart to recovery to access TWRP easily later)

Android debugging switched ON

Windows animation scale to Animation scale .5x

Same for Transition animation scale and Animator duration scale to improve reactivity

For faster GPS fix, use GPS Status and Toolbox and download A-GPS data.

Your phone is a rocket, enjoy ;-)

Thanks: LineageOS team, TWRP team, BitGApps team, @NeoArian, @TheHitMan, TopJohnWu