I won’t describe what this recovery does or features it has, because these are redundant information. You should know what TWRP is good for if you are going to flash this.
I’d recommend to read everything in this post, if you care about your expensive phone.
Let’s start with the installation process
- First of all you need to modify the vbmeta partition which handles partition verification.
You can do that by simply following the on the how to root your device guide https://forum.xda-developers.com/gal...-odin-t3930099
(If you don’t want to flash all the partitions you can also just extract the patched vbmeta image and flash only that image).
- Once the modified vbmeta image was flashed you probably have to wipe your data.
- When your device boots successfully you can set it up, make sure OEM unlock is greyed out/enabled in developer settings (if it doesn't show up, connect to a network first) and then boot into download mode and flash the TWRP recovery (if you want to preserve root access you need to patch the recovery image first in Magisk).
- Enjoy TWRP!
So that was the easy part. The hard part is to completely read these following points!
- Things you have to consider when preserving root with TWRP
The Galaxy A70 is a system-as-root device (https://source.android.com/devices/b...system-as-root). That means Magisk can no longer be installed in the boot image and the only other way to have Magisk installed without a modified system or vendor partition is the recovery partition (that’s why you have to patch the TWRP image). Generally that shouldn’t cause any problems, but when Magisk is only installed on the recovery partition, then that also means the device must boot from recovery, so the kernel in the recovery partition must be compatible with system, vendor and all other partitions (firmware etc.). Now here comes the big problem! TWRP only works with a custom kernel and Samsung doesn’t always release their kernel sources on time, that means you might be stuck with an older firmware if you want to preserve root access and want to have TWRP installed. As for now the latest firmware isn’t compatible with the kernel source Samsung has uploaded and you must be on an older version to have Magisk working with TWRP. I can’t give you the exact firmware versions which will work the a patched TWRP image, because there are different variants of this phone (A705FN, A705GM, etc.). Either search this thread for advice or find it out for yourself. If the patched TWRP bricks your device, you can just flash the stock rom again.
Decryption works on this TWRP release, but only partially. That means you have to open the Settings Application first on your phone and disable a feature called strong protection. You can find it in Settings->Biometrics and scurity>Other security settings. It doesn’t matter when you disable it. Flash TWRP first and disable it, fine. Disable it and flash TWRP afterwards, fine. Never disable it, also fine, TWRP just fails to decrypt your data, but won’t do any harm. This feature probably is Strongbox, something Google has introduced with Android 9 (https://developer.android.com/traini...icles/keystore). I am not sure though, I didn’t really put much research into that.
There is not much else to say for now. If you run into problems, then make a detailed post and I will extend this first post if necessary.
Developers specific details
Kernel sources are a combination of SM-A705GM_SWA_PP_Opensource and SM-A705MN_LA_PP_Opensource (A705MN as base and DTS files from A705GM)
- TWRP modifications
For decryption you have to comment out some code.
In https://github.com/omnirom/android_b...eyStorage4.cpp look for the function bool retrieveKey and comment out the if statement if (auth.usesKeymaster()). This should be always true!
- Recovery image size
For some reason the ramdisk has a size limit, so I used LZMA compression to get its size down as much as possible.
- During kernel compilation you will run into a DTC error. Apparently Samsung didn’t bother to update their DTC source in the kernel and you have to use their precompiled binary, that means you just have to replaced the compiled DTC file with a precompiled one. (cp kernel/samsung/a70q/tools/dtc out/target/product/a70q/obj/KERNEL_OBJ/scripts/dtc/dtc).
- Device tree of Redmi Note 7 Pro (https://github.com/TeamWin/android_device_xiaomi_violet). Helped a lot!
- Topjohnwu for the detailed installation guide (https://topjohnwu.github.io/Magisk/i...system-as-root)
- TWRP Galaxy S10 thread for describing System-as-root pretty well
https://github.com/Grarak/android_de..._a70q/releases (Also changelog)
Note The download is a zip file, unpack it and you will get the recovery image. To flash it in Odin pack it as tar with 7zip or a compression tool of your liking.