[Sony Xperia M4 Aqua] spinning_quirK:
http://xdaforums.com/m4-aqua

I have just successfully completed all 3 steps in the title and would like to compile the information so that more people can report more success. Many thanks and all credit to the threadstarter of this guide, the devs of the amazing Flashtool, and the dev of this newly created TOUCH version of the TWRP recovery (finally!)

DISCLAIMER:

[B]Your warranty is now void. [/B][U]DO THIS AT YOUR OWN RISK.[/U]

I am not responsible for bricked devices, bootloops, dead SD cards, thermonuclear war,
or you getting fired because the alarm app failed.

Please do some research if you have any concerns about any of the steps in this guide before performing them!

YOU are choosing to make these modifications,
please own your actions and don't be a baby about it.

Bootloader Unlock (instructions taken from this guide)

0. First check if your phone allows unlocking by dialing *#*#7378423#*#* , when Service Menu opens, go to Service Info, then Configuration; scroll down to read Rooting Status.

If "Bootloader unlocked" says yes, skip to the next section on Root.

If it says no (unlocked allowed), great, proceed on to next step.

If it says no (unlocked disallowed) or something like that, I'm sorry, unlocking won't work on your phone. Lodge a complaint with your mobile provider for locking it.

Getting the unlock code (skip to Step 5 if you already have it)

1. Go to Sony's official bootloader unlocking website.

2. Select Xperia M or M2 in the dropdown.

3. Follow all the steps (including *#06# to note your phone's IMEI number)

4. COPY the unlock code and paste and save it in a text file on your desktop.

Ensuring Flashtool recognises phone

5. Download Flashtool here and install it.

(To apply the 0.9.19.10 patch, install 0.9.19.8 and replace x10flasher.jar with the one from the patch. Default install folder is C:\Flashtool , don't change it)

6. Open Flashtool, connect your phone via USB. (

Make sure USB Debugging is enabled in Developer Options

). If Flashtool warns that ADB driver is not installed, go to the Sony website to download them. If Flashtool recognises phone, skip to Step 11.

7. Unzip the Sony drivers into a folder.

8. Boot into Advanced Startup on Windows and disable signed driver enforcement (I'm sorry, you have to Google this for your specific Windows installation)

9. When Windows has restarted, go to Device Manager, click on the ADB Interface item with the yellow questionmark, click Update Drivers, Search Manually, Have Disk, and then open the folder where the Sony driver inf is. select the ADB inf and install it. Warnings will pop up but install the drivers anyway. When done, the yellow questionmark will be replaced by something normal.

10. Verify that Flashtool recognises phone by connecting the USB cable when phone is on. You should see information about phone kernel and ROM version.

<Congratulations for making it this far>

Setting up Flashtool for use

11. With Flashtool open and phone connected, click on Devices in Flashtool menu > Check Drivers.

12. More information will pop up. Under ADB Devices, your phone's serial number will be stated (something like 10 digits and letters). Copy that serial number.

13. Go to %USERPROFILE%\.flashTool\mydevices .

14. Create a new folder in here and rename it to the serial number.

15. Open the serial number folder, create a new text file and rename it "ulcode.txt" (without the quotes).

16. Open the text file, paste your bootloader unlock code, save and close the file.

For step 16, as a precaution, copy and paste the serial number folder inside registeredDevices too. I didn't test which folder was being used by Flashtool for the unlock.

Actual unlocking of bootloader

17. With Flashtool open and phone connected, click on the BLU button. Follow all instructions. One involves VOL UP, the other involves VOL DOWN (for fastboot), please take note to do both, it's not deja vu.

18. When you have done so correctly, Flashtool will pop a small dialog with your IMEI and unlock code already pasted inside.

19. Take a deep breath and click unlock.

20. Check in main window that bootloader has indeed been unlocked.

21. Unplug the USB cable and boot your phone to check that everything should be normal.

CONGRATULATIONS, YOUR WARRANTY IS NOW VOID. :laugh:

Installing TWRP recovery (with touch capability but NO external SD card mount yet as of 13 Nov 2015)

0. Make sure your bootloader is unlocked before proceeding.

1. The download link is from the M4 Aqua Marshmallow Site, scroll to the bottom. (XDA thread is here)

2. Download and save the recovery.img file anywhere you like.

3. Copy and paste recovery.img to C:\Flashtool\x10flasher_lib .

4. Install the recovery using fastboot using the instructions based on this website (thanks and credits to Shyam Karnani):

Flashtool comes with its own ADB interface so we don't need to install any new ones or the bloated Android SDK.

a) Open a command window inside the folder C:\Flashtool\x10flasher_lib (shift-rightclick and select "open command window here")

b) Connect phone to the computer using the USB cable.

c) type "adb reboot bootloader" (without quotes) in the command window and press enter (if asked to allow USB debugging in the phone screen, touch ok)

d) when the phone has entered fastboot, type "fastboot flash recovery recovery.img" (without quotes) and enter. Check that there are no errors produced by the flashing.

e) type "fastboot reboot" and enter.

The phone now has TWRP recovery but NO ROOT.

To boot into recovery

1. Simultaneously press the Power button and Volume down until your device vibrates.

2. Quickly release the Power button, but keep pressing Volume down.

3. When you see the TWRP screen, release Volume down. You have now successfully entered recovery mode.

(Instructions from Sony Developer website)

Rooting using SuperSU

0. Check that you have flashed a custom recovery. If not, please refer to steps right above.

1. Download SuperSU from the official website.

2. Connect your phone and transfer the zip file to the INTERNAL storage (because no recovery can mount external SD card yet as of 13 Nov 2015).

3. Power off phone and boot into TWRP recovery.

(An info dialog will popup asking if you want to keep read-only for /system. I chose NOT to keep, but need someone with knowledge to explain if read-only will block rooting procedure. It will, right?)

4. Touch the Install button and scroll to find the supersu zip.

5. Install the supersu zip. When done, clearing cache/Dalvik is optional (can be done using Titanium Backup anyway once you have root).

6. Reboot system.

Enjoy your root! :good: