HOW TO FLASH ROOTED ANDROID 8 ON SONY XPERIA XZ1 COMPACT IN WINDOWS 7 ENVIRONMENT

HOW TO FLASH ROOTED ANDROID 8 ON SONY XPERIA XZ1 COMPACT IN WINDOWS 7 ENVIRONMENT
Page content

UPDATED ON: 2023-04-20 Important update, substantial refactoring, many errors fixed

▒ PREFACE WORDS

Following instruction is dedicated to flashing stock Android 8.0 firmware for Russian region, but almost all information can be applied to USA or any other region firmware. So, no restrictions here.

Remember that all commands and programs should be executed with admin privileges and your account must have administrator rights!
If something goes wrong for some reason be sure to check [TROUBLESHOOTING] section!

[WHY ANDROID 8.0?]


▒ COPYING NEEDED FILES TO SD-CARD

To make process more convenient copy in advance following files:

  • Custom TWRP recovery to flash root access and fix camera /// twrp-3.5.2_9-0-lilac.img
    [copy to ADB folder on your computer]
  • Magisk application to gain root /// Magisk-v20.1.zip
    [copy to sd-card, of course you can copy to internal storage too, but files will be lost after flashing firmware and you’ll have to copy them over again]
  • DRM fix to restore Camera functionality /// DRM-FIX.zip
    [copy to sd-card, of course you can copy to internal storage too, but files will be lost after flashing firmware and you’ll have to copy them over again]

[ONE-PLACE & ONE FILE DOWNLOAD LINK]


▲ BACK TO TOP

▒ INSTALLING FLASHTOOL & DRIVERS

It is a known fact that newer Sony phones should be flashed by [Newflasher].
But today we are talking about vintage phone, so [Flashtool] is preferred.

I recommend to use version somewhere around 0.9.27 - 0.9.33.
Below 0.9.27 XZ1 Compact is not supported or supported badly.
Above 0.9.33 flashing is unreliably awful. Version 0.9.33 can be downloaded [HERE].

Flashtool distribution already comes with Xperia drivers.
In Drivers folder you’ll find Flashtool-drivers.exe.

  • Execute it with admin privileges, also make sure that Vista compatibility is turned on
  • Check the following drivers: [x] Flashmode Drivers [x] Fastboot Drivers
  • Agree to install Sony Mobile Software Update
  • Confirm google Android USB driver

▲ BACK TO TOP

█ UNLOCKING BOOT LOADER

First thing you’ll need to do is to unlock boot loader of the phone.

To get the idea about can you unlock it or not you can by means of phone dialing with not-so simple combination:

*#*#7378423#*#*

Service Info ► Configuration ► Rooting Status
In Bootloader unlock allowed section you should have Yes. Otherwise unlocking is not possible.
If unlocking is possible write down IMEI of your phone, which you can find right in this section too.

Settings ► System ► About Phone ► Build Number ► Tap 5-6 times to enable developer settings
Settings ► System ► Developer options ► OEM unlocking ► ON
Settings ► System ► Developer options ► Debugging ► Debugging USB ► ON

If OEM unlocking option is grayed out:

  • turn WiFi on to connect to internet
  • turn off automatic date & time zone and set them manually:

Settings ► System Date & Time ► Automatic date & time ► OFF
Settings ► System Date & Time ► Automatic time zone ► OFF

Then reboot device and check again for availability of OEM unlocking option.

  • Visit [developer.sonymobile.com]
  • Select Xperia XZ1 Compact in device dropdown list
  • Enter previously copied device IMEI number
  • Press sumbit to get personal code
  • [Grab ADB tools] version r31.0.3 is confirmed to work flawlessly
  • Extract tools to something like C:\ADB
  • Turn off smartphone
  • Press VOLUME UP button and holding it down plug USB cable to phone
  • Blue led will indicate that you are fastboot mode, however screen will stay back
  • Make sure that you don’t have unknown devices with question mark in the device manager.
    If ADB interface is installed not correctly you should install it by force.
    First thing to try is [Leshcat driver]. Still not working? Try [stock Sony 1.01 driver].
    One more [classic driver]. Last resort is to use [Snappy driver pack].
  • After you convinced that ADB interface is installed correctly open command line [WIN] + [R]
cmd

Change to tools directory:

cd c:\adb

Check connected devices

fastboot devices

If everything is fine you should see something like:

your-device-serial-number fastboot

To unlock phone execute the following:

fastboot oem unlock 0x****************

where

0x**************** 

….is a number from Sony website.

Warning! Case of letters matters!

143n56b09

is not the same as:

143N56B09

After completion ADB should return:

OKAY!

Unplug USB cable, smartphone will turn off. Congrats, now you have unlocked device!


▲ BACK TO TOP

▒ PREPARING FIRMWARE

Latest Android 8.0 version is dated back to 2018/09/01. Marked as: 47.1.A.16.20.
Everything above contain unwanted Neural API to collect your personal data and sell it to third-parties.

In my case it will be firmware for Russian region [English language is fully supported].
[Download firmware] in Flashtool FTF format.
Naming should look like this: 14_G8441_47.1.A.16.20_1310-5279_R9B.ftf

Good place to download firmwares for other regions is [AndroidFileHost].
List of XZ1 Compact develeopers can be found [HERE].

Warning! If you do not follow provided instructions you probably end up with something like:

Unable to read TA unit 10021 error=-22 hex (00002725)

….during flashing process, at least if you are using Flashtool.

So, obey and do the things as they should be done.

  • Rename firmware extension from FTF to ZIP
  • Open archive in 7-Zip or WinRar
  • Extract file: boot_delivery.xml to your desktop
  • Delete boot_delivery.xml directly in arhive in your compression utility [software should do repacking]
  • Navigate to boot folder in your compression utility
  • Drag’n’drop previously extracted boot_delivery.xml from desktop to boot folder in your archiver [software will repack things]
  • Rename back firmware extension from ZIP to FTF
  • Launch Flashtool at least once, then exit program
  • Put newly cooked firmware to C:\Users\USER_NAME\.flashTool\firmwares

You have prepared firmware and ready for hassle-free flashing.


▲ BACK TO TOP

█ FLASHING DEVICE

  • Execute Flashtool with admin privileges
  • Click lightning icon and select Flashmode [now you should see Sony Xperia XZ1 Compact firmware]
  • Click triple times on drop-down arrows
  • Select 47.1.A.16.20 to see CONTENT section filled with files
  • Mark check-boxes in SIN section: [x] APPSLOG [x] USERDATA
  • Hit FLASH button to begin process
  • Then Flashtool will ask you to:
    • turn off your phone
    • press VOLUME DOWN button
    • and after that plug USB cable

Green LED on the device will indicate that phone is ready for flashing.
After that flasher will ask a question:

Those data are not in the FSC script and will be skipped:
RESET-NON-SECURE-ADB
Do you want to continue?
  • Answer YES to continue.
  • Power down device after flashing to check newly installed operating system

If everything is correct application will begin flashing.


▲ BACK TO TOP

█ FLASHING TWRP CUSTOM RECOVERY

Side-loading TWRP recovery is a mandatory step to gain easy root access later on.
TWRP can be side-loaded only to unlocked smartphone!

  • Extract from previously downloaded archive file with the name twrp-3.5.2_9-0-lilac.img and put it into ADB tools folder [for me it is C:\ADB]
  • Turn off smartphone
  • Hold down VOLUME UP button, plug USB cable
  • As soon as you see blue led on smartphone release VOLUME UP [you are in Fastboot mode now]
  • Open command line [WIN] + [R]
cmd

Change to tools directory:

cd c:\adb

Check connected devices:

fastboot devices

If everything is fine you should see something like:

your-device-serial-number fastboot

Flash custom TWRP recovery:

fastboot flash recovery twrp-3.5.2_9-0-lilac.img

After that you should see double OK and exclamation FINISHED!
Unplug USB cable, led light and smartphone will shutdown.


▲ BACK TO TOP

█ ROOTING DEVICE

Many of you understand that if you want to control your device fully it should be rooted. We’ll do it with the help of previously installed TWRP recovery.

  • Turn off smartphone
  • Enter TWRP recovery: hold simultaneously POWER and VOLUME DOWN buttons
  • After one-time vibration release POWER button
  • On appearance of blue Teamwin logo release VOLUME DOWN button
  • Swipe to allow modifications
  • Tap INSTALL ► select previously copied:
    Magisk-v20.1.zipSwipe to confirm Flash
  • Exit to starting menu
  • Reboot device by selecting: Reboot ► System

One more congrats, you are a fully fledged device owner!


▲ BACK TO TOP

█ RESTORING ORIGINAL SONY CAMERA APP

If you have black screen in original Sony camera application do the following:

  • Turn off smartphone
  • Enter TWRP recovery: hold simultaneously POWER and VOLUME DOWN buttons
  • After one-time vibration release POWER button
  • On appearance of blue Teamwin logo release VOLUME DOWN button
  • Tap INSTALL ► select previously copied:
    DRM-FIX.zipSwipe to confirm Flash
  • Exit to starting menu
  • Reboot device by selecting: Reboot ► System

Camera should be fixed now.


▲ BACK TO TOP

█ TROUBLESHOOTING

  • Before doin’ things unload all unneeded software from memory, start with a clean desktop
  • During flashing disable all antiviruses, firewalls and system protection utilities
  • Always use USB port on the back of your computer, in case of failure try different USB ports
  • Use original USB cable, if something is not working try to use another cable
  • Still no luck? Try to use generic USB 2.0 ports instead of blue USB 3.0 ports

For those of you who like to mess around with many devices at the same time, you can easily run into troubles like corrupted system files and registry branches. In such case i recommend to do the following things:

  • Uninstall all phone drivers from device manager
  • Uninstall all mobile drivers from control panel
  • Do one pass of [CCleaner]
  • Do one pass of [DISM++]
  • Reboot machine
  • Use excellent [USB DVIEW] to remove traces of previously installed USB devices
  • Right after that run [USB OBLIVION] to finalize cleanup of USB configuration
  • Reboot machine / Try again

As a last resort turn off signature protection of installed drivers:
Hit [F8] during system startup and select Disable driver signature enforcement.
Warning! In some motherboards [F8] execute boot order menu, in such case hit [F8] again right after you select appropriate disk for booting.

If you end up with not working Sony camera you’ve messed up DRM-keys, look through the article for solution.
Nevertheless I prefer to use [OpenCamera].


▲ BACK TO TOP

▒ RELEVANT STUFF

Make sure to [install additional software] like firewall, proper browsers, navigational maps, or whatever you need.
Privacy tweaks [here]. Other Android related things [here].

Hope that tutorial will be useful piece of information.
If you’ll notice any inconsistencies or errors please [report me back].