[OnePlus 6T  ROMs, Kernels, Recoveries, & Other Dev] ky41083:
Reserve Image

I've seen more than a few posts about the content of the reserve image being lost, or not present in the first place (broken fonts, missing wallpapers, etc). There is a Magisk module floating around that can quick fix this, so I am assuming there are more than a few people out there that have this problem. I got irritated (bored?) enough to finally go to bat with it. Hopefully this comes in handy, I have not seen the 2nd part of this solution posted anywhere else.

There is some interaction between a TWRP data partition wipe, and the content of the reserve image going away. If you do a data wipe from the stock recovery, this content is not lost. If you do a data wipe from TWRP, this content is lost. In both cases, the reserve image itself remains present at /data/reserve.img. If you do a data wipe from TWRP and loose the content, doing another data wipe from the stock recovery does NOT bring this content back.

The only way I could manage to restore the content was to dirty flash the stock ROM zip from https://xdaforums.com/oneplus-6t/how-to/oneplus-6t-global-repo-oxygen-os-builds-t3865396. I found it easier to dirty flash from TWRP, though it may very well work if you dirty flash it from stock recovery. You do NOT need to factory reset to fix anything that I ran into.

I'm guessing whatever changes are restored by following this process could be integrated into, or excluded from, the TWRP data wipe routine. I'm also guessing they could likely be integrated into a script to make this whole process simpler. If anyone wants to pick this up and do that, please do. I'm bowing out at this point, my phone is fixed, hehe. To the good stuff:

---------------------

There was a factory reset queued in one of my slots from when I first setup this phone. During a reboot from that slot with stock recovery installed for testing, it proceeded to do a full factory reset that I did not expect or plan for. Everything on the phone was wiped. I had current backups synced to another device, luckily.

- Make sure you are on the latest TWRP from https://xdaforums.com/oneplus-6t/development/recovery-unofficial-twrp-touch-recovery-t3861482

- If you use the reserve image Magisk module, remove it

- Don't be that guy, backup your stuff, copy the backup OFF of your phone

- Download the full update ZIP for your current build from the URL above

- Copy full update ZIP + latest TWRP img to phone

- Boot phone into TWRP

- Install full update ZIP

- Advanced -> Install Recovery Ramdisk -> TWRP img file (this (re)installs TWRP to both slots)

- If you run a custom kernel / Magisk:

----- Reboot -> Recovery (TWRP again)

----- Install custom kernel

----- Install Magisk

- If you DON'T run a custom kernel / Magisk:

----- Reboot -> System

At this point you should have the additional wallpapers / apps / etc. restored, and all of your data should be intact. If not, rinse and repeat. It may be helpful to (re)flash the stock full update ZIP to both slots. By the time I made it this far, that was the state my phone was in, but I highly doubt it's necessary.

All is not well, however. The stock Recorder app, which is important if you want to use the integrated call recording feature, does not work. Every time you open it, it will complain about missing permissions. It will have the storage permission twice, if you allow one it will allow the other, and every time you open the permissions screen you will see the 2x storage entries refresh and swap places. Fun, right? This happens when the Recorder app is not present the very first time Android boots. When you drop in the Recorder app after the fact, this is where you end up. Clearing app permissions using any of the GUI methods does not fix it, even though it should. Thankfully Android is very modular in nature...

After you do the steps below, every single app on your device will re-request, once, every single permission it wants. Annoying, yes. More annoying than a factory reset, starting completely over and having to grant all of these permissions again on top of everything else anyhow? Nope, not even a little.

- Boot into TWRP

- Advanced -> File Manager

- Rename the following file: /data/system/users/0/runtime-permissions.xml

- Reboot -> System

Android will now rebuild the entire runtime-permissions.xml file, correctly this time. Opening the recorder app will request the correct permissions, and you can actually grant them now.

Good things happen in quarantine. Without it, I would never have had time to figure this out, let alone document it :p Have fun, hopefully this helps a few people out. I love you!