[Huawei P9 Guides, News, & Discussion] zgfg:
Decrypting Data partition and Internal memory, for TWRP access

Last night I had a chance to again decrypt Storage (on my second P9) – but now finding much shorter and simpler way than as previously described at:

https://xdaforums.com/showpost.php?p=79597320&postcount=17

I already had al10c00 b540 with OTA Patch02, with Tecalote's Network patch and Face add-on, Magisk, ECO Kernel - everything survived the process (Magisk: rooot, Modules, Magisk Hide list), including my saved fingerprints and face.

Content of Internal memory also survives (and of course, SD card, too).

Most apps and settings can be successfully backed-up and restored.

Whole process (download and prepare neccessary files in advance and save to SD card) takes cca 2 hours (incl. back-ups and restores - most time consuming), to again have fully working b540.

If you already have TWRP installed, you can do all steps (from the couch) directly on the phone (no need for PC and Fastboot)

Benefits:

- TWRP will be fully able to read/write to Data partition and Internal memory

- As such, you will be able to make full Nandroid backups from TWRP (including Data partition)

- TWRP will be able to do installations from Internal memory (not only from SD card)

- TWRP will be able to Wipe Dalwik (it's folder on Data partition - without decrypted Data, TWRP fails to wipe but does not report an error)

1) Before decrypting Storage, backup as much as you can (you can't backup Data partition by TWRP since it wasn't decrypted yet):

- By e.g. ApkExtrator (from Playstore), create/save Backup.apk (Huawei stock Backup app, but supposidely you have newer/updated version than the one coming with b540)

- Create one Backup (by Stock Backup app) with only the last two items from System Settings: WiFi & Passwords and Settings (such Backup requires Backup encryption password)

- Create second Backup with everything else (except Docs, Pics, Music), but with Backup encryption disabled (no need for password to open)

- Make onlline backups for Google account(s), WhatsApp, etc

Hence, before decrypting, I didn't unroot, did not remove PIN/Fingerprint/Face protection, did not flash stock Kernel (Recovery, Ramdisk) back - but decrypting Storage and restoring System worked fine

2) Reboot to TWRP (Pretoriano80's P9-EVA-8.0.0-TWRP-v4.img from OP instructions, installed to RecoveryRamdisk) and perform the following, in this order:

- Wipe, Swipe to factory reset (not Advanced Wipe, neither Format Data)

- Install (must be from SD Card since Internal memory is not yet decrypted) three ZIPs (in queue): update_data_full_public.zip (from b540 download), b540-update_full_EVA-AL10_all_cn.zip (from b540 download, but fixed by Tecalote to be flashable by TWRP) and Enable-Huawei-OTA.zip (from Tecalote's OP instructions)

- Install (Image) to RecoveryRamdisk: TWRP-8.0.0-EVA-DECRYPTION_SUPPORT.img (Chinese TWRP with decryption support)

- Reboot to Recovery

3) Once rebooted to to just installed Chinese TWRP:

- Click on Settings gear and switch language from Chinese to English

- Advance, Fix Encryption

- Reboot to System

(If you already had Chinese TWRP instead of Pretoraino80's, then perform both (2) and (3) from Chinese TWRP: Wipe, Install two ZIPs and Fix Encryption)

4) Boot to System:

- While booting, skip WiFi, Fingerprint, Google and Huawei account...

- Install Backup apk from (1) to update to the same (newer) Backup app you made back-ups with

- Open second/big Backup from (1) (you don't have keyboard at the moment but this Backup does not require Password to open) and restore only GBoard app with its settings

- Open first/small Backup from (1) (now you have GBoard to enter Password) and restore System Settings: WiFi & Passwords

- Phone should automatically connect to WiFi (WiFi settings and passwords are just restored)

- Open Settings, System, System Update and allow to install (3 MB) OTA Patch02 (update will work although you don't have stock RecoveryRamdisk, Ramdisk, and maybe Kernel)

5) Upon rebooting to System:

- Open second/big Backup from (1) and restore everything except GBoard (already restored) and System Settings: System UI and Desktop icon layout

- Open first/small Backup from (1) and restore remaining System Settings: Settings

- Open stock AppGallery app and let it update itself and then from its manager let it update offered Huawei apps

- Install Google Playstore (it does not backup/restore by Backup), you could have created Playstore.apk by ApkExtractor in (1) or apk must have been downloaded from https://www.apkmirror.com/apk/google-inc/google-play-store (prepare in advance, if Chrome is your browser - it was also not backed-up/restored by Backup)

- Configure Google account(s) and from Playstore, Library, install apps that were not backed-up/restored (like Google Chrome, Maps, etc)

- Restore WhatsApp and its chats, etc

- Open again second/big Backup from (1) and restore remaining System Settings: System UI and Desktop icon layout

- Go to Settings, Security, Fingerprint, re-enable your PIN/password and re-enable your previously saved fingerprint(s)

- Similarly, re-anable your previously saved face for unlocking

- Optionally, set-up Theme, Wallpaper(s), widgets - they also cannot be backed-up by the Backup app

Now, you will have have fully working AL10c00b540 Patch02 - with NW patch (it survived the process), Magisk, your restored apps and data/settings (double-check in Settings), home screen(s)...

6) Reboot to (Chinese) TWRP (to replace it back with Pretoriano's):

- If you go to Advanced, File Manager, you can see that TWRP now reads /data partition and /sdcard (which is Internal memory

- Install (Storage to install from can be now Internal memory): Disable-Huawei-OTA.zip (optionally but strongly adviced)

- Optionally (but strongly adviced) Install (Image) to RecoveryRamdisk: TP9-EVA-8.0.0-TWRP-v4.img and reboot to Recovery, and see that now Pretoriano's TWRP also fully supports Data partition and Internal memory

All resources (Chinese TWRP, b540-update_full_EVA-AL10_all_cn.zip, latest Backup and Playstore apps, etc) can be found on my Mega:

https://mega.nz/#F!JwkVyRya!Rb7OUE0z3PEpXBRxGOM-vQ

PS: Instead of using Chinese TWRP for the Fix encryption option, you can manually edit a file in Vendor partition:

https://xdaforums.com/showpost.php?p=79248438&postcount=16

However, on P9 you have to edit /vendor/etc/fstab.f2fs.hi3650 (not 3660).

And if Fixed Encryption by Chinese TWRP, the corresponding line reads as:

/dev/block/bootdevice/by-name/userdata /data f2fs nosuid,nodev,noatime,discard,inline_data,inline_xattr wait,encryptable=footer,check