[Sony Xperia M4 Aqua] YoshiX007:
#include
/*
* Your warranty is now void.
*
* I am not responsible for bricked devices, dead SD cards, SafetyNet updates,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about features included in this TUTORIAL/GUIDE
* before flashing it! YOU are choosing to make these modifications, and if
* you point the finger at me for messing up your device, I will laugh at you a lot.
*/

This Tutorial/Guide is to install Magisk in Sony Xperia M4 Aqua. Tested in E2303

You need UNLOCKED BOOTLOADER and this TWRP (Download TWRP 3.2.1-0) (https://xdaforums.com/m4-aqua/development/recovery-twrp-touch-recovery-3-1-1-0-t3636920).

Steps:

0.Remove any other root (SuperSU or Magisk) and Xposed. Make sure you have stock Sony Kernel.

1.Download BootBridge-Magisk-v14-M4A.zip

2.Boot TWRP (Volume DOWN + Power).

3.Flash BootBridge-Magisk-v14-M4A.zip

4.Reboot to system and update Magisk Manager (if needed)

5.Check "Preserve AVB 2.0/dm-verity", update to latest Magisk using "Direct Install", reboot and check SafetyNet.

6.(Optional) Install Systemless Xposed (don't forget Xposed Installer) and reboot. It takes 5 min to boot. (Android 6.0 = SDK 23) (https://xdaforums.com/xposed/unofficial-systemless-xposed-t3388268).

Systemless Xposed does not pass SafetyNet!!!

Thanks to:
[MENTION=2233641]AdrianDC[/MENTION] (BootBridge)
[MENTION=6548273]dani020110[/MENTION] (TWRP for M4 Aqua)
[MENTION=5984363]osmank3[/MENTION] (Steps to get Magisk v15.x working)
[MENTION=4470081]topjohnwu[/MENTION] (Magisk and Systemless Xposed Framework)
[MENTION=4419114]rovo89[/MENTION] (Original Xposed Framework)

Google (Android)

Sony (Xperia M4 Aqua)

Me [MENTION=7588456]YoshiX007[/MENTION] (Tutorial)

Old steps

Download Center

SuperSU: http://xdaforums.com/apps/supersu/2014-09-02-supersu-v2-05-t2868133

Suhide: http://xdaforums.com/apps/supersu/suhide-t3450396

Latest RootSwitch in first two posts (1.3.3.2 at writing time): https://www.asus.com/zentalk/tw/thread-173542-1-1.html

Minimal Fastboot: https://drive.google.com/file/d/0B7sssTaAqVsscWdRWVBaU05NWjA/view?usp=sharing Mirror: http://vlctv.webcindario.com/Xperia/MINIFASTBOOT.rar

Boot 26.3.A.0.131

Boot for E2303 (rename it to boot.img): https://goo.gl/PBXtNe

Boot for E2306 (rename it to boot.img): https://goo.gl/8sKHZ1

Boot for E2312 (rename it to boot.img): https://goo.gl/XYeqe2

Boot for E2333 AND E2363 (rename it to boot.img): https://goo.gl/ZzHOhL

Boot for E2353 (rename it to boot.img): https://goo.gl/IZRzKM

Boot 26.3.A.1.33

Boot for E2303 (rename it to boot.img): https://goo.gl/mVuWcu

Boot for E2306 (rename it to boot.img): https://goo.gl/2Z3NuK

Boot for E2312 (rename it to boot.img): https://goo.gl/6H9fiV

Boot for E2333 (rename it to boot.img): https://goo.gl/fhdVVW

Boot for E2353 (rename it to boot.img): https://goo.gl/8atYQm

Boot for E2363 (rename it to boot.img): https://goo.gl/ZsUupP

(OPTIONAL) If you want xposed

Material Design Xposed Installer: http://xdaforums.com/xposed/material-design-xposed-installer-t3137758

Xposed Framework 86.2 CheckMod https://drive.google.com/file/d/0B7sssTaAqVssc05GTVl1enJQb1U/view?usp=sharing

This Tutorial/Guide is for root and install Xposed in Sony Xperia M4 Aqua :highfive:

You need UNLOCKED BOOTLOADER.

Tested only in E2303 26.3.A.1.33 with Xposed installed, you need UNLOCKED BOOTLOADER.

It is easy :)

Resumed steps:

0.(If you have Magisk installed or you used this tuto before the update) Flash Magisk Uninstaller to get a clean start and flash latest Sony stock ROM.

1.Download needed files : your boot.img, minifastboot, (optional(xposed, xposed installer)) ,SuperSU and RootSwitch (Search in download center)

2.Flash your corresponding boot from Download Center and Start TWRP with volume UP (YES UP, NO DOWN).

3.1 Flash SuperSU ZIP.

3.2 Flash Suhide ZIP

4.1 Reboot and install RootSwitch 1.2.4

4.2 Reboot, disable root in RootSwitch and check SafetyNet.

5. Go away and play PoGO.

(Optional)

6. Go TWRP, clean dalvik/art cache, flash Xposed ZIP and install DVDandroid's Material Design Xposed Installer.

Explained Steps:

0.(If you have Magisk installed or you used this tuto before the update) Flash Magisk Uninstaller to get a clean start and flash latest Sony stock ROM.

1.Download (Search in download center) and copy:

TO PC:

MiniFastboot, (Search in download center)

To MINIFASTBOOT folder:

Your boot.img from download center

TO ExtSD:

SuperSU and RootSwitch. (Xposed Framework, Material Design Xposed Installer)

2.1. Flash boot (fastboot):

Go to MINIFASTBOOT folder and boot into fastboot mode, type in the shell:
fastboot devices
fastboot flash boot boot.img
fastboot reboot

2.2 Start TWRP Recovery: WITH VOLUME

UP;)

2.2.1 Power off
2.2.2 Power on
2.2.3 When the yellow led lights and press volume UP and wait

3. Install ZIPs

3.1 Install SuperSU+Suhide
3.2 Reboot system
(It is going to take some time)

4.1 Install RootSwitch

4.2 Reboot, check "Stop all su daemons", disable root in RootSwitch and check SafetyNet.

(Optional) 4.3 Go TWRP, clean dalvik/art cache, flash Xposed ZIP and install DVDandroid's Material Design Xposed Installer.

5 :svetius:??????????:svetius:

6. :victory:Profit!!!!!!!!:victory:

Thanks to:

[MENTION=4815990]99poison[/MENTION] (:victory:advise about every update :good:)

shakalaca from Asus Developer Club (RootSwitch)

[MENTION=631273]Chainfire[/MENTION] (SuperSU, Suhide, Systemless Root...)

[MENTION=4544860]osm0sis[/MENTION] (Android Image Kitchen)

[MENTION=5345056]DVDandroid[/MENTION] (Material Design Xposed Installer)

[MENTION=5051448]PiSpecialist[/MENTION] (Base boot.img)

[MENTION=4470081]topjohnwu[/MENTION] (Systemless Xposed Framework)

Sony (Xperia M4 Aqua)

Google (Android,ADB and Fastboot)

Me [MENTION=7588456]YoshiX007[/MENTION] (Tutorial and remodded kernels)