[Xiaomi Redmi Note 5 Pro ROMs, Kernels, Recoveries,] htchd2sucks:
A summary of the problem I have with RN5:

Coming from LOS15.1, with the latest 10.0.1 firmware, I "clean flashed" PixelExperience_whyred-9.0-20181018-1551-OFFICIAL.zip. That means advanced wipe in TWRP and wiped everything but USB and MicroSD.

Then I installed PE and reboot.

Just after reboot it loads the G logo, then google animation and "To start Android draw your pattern".

The problem is I never set a pattern, and I'm using a PIN to de-encrypt the phone:

- I know the pin.

- The pin works, if I boot in TWRP, it asks me before to load TWRP to enter the encryption password, which I know and do, and then TWRP decrypts the phone successfully.

I have "clean flashed" the phone again, advanced wipe all but USB and MicroSD, and flash the LOS15.1 zip. I boot the phone and it immediately asks me for... a PIN! Which is normal. If I enter it, it proceeds loading LOS151.

So I went in the settings of LOS15.1 and disabled any "Secure Startup" options (pin, pattern, etc...). Then "cleaned flashed" again and installed PE again.

Same problem, it loads and asks me to draw a pattern.

I'm quite confused:

-Why I one of the rare having that issue?

-Why, if I cleaned flashed, it would keep (or not) some "secure startup" settings?

-Why it is asking me for PATTERN instead of PIN?

-Why I know the encryption password, I am able to use it in LOS, but not in PE?

-To the best of my memory, I haven't done anything extra in MIUI, and I do know the encryption password...

Additionally, I have tried several options such as:

- Flashing 2 zip files allegedely removing "pattern/key" related ".key" or ".db" files, same problem.

- Looked in TWRP to mount /system and try to find related files myself. There's no such files (I do see files and folders in /data and in /system, just not any key or .db files)

- Tried ADB shell, but since device is not authorized, I can't really connect. In recovery it looks adb strange characters, and in "safe mode" it changes nothing.

I'm thinking there might be a way to tell "Android PIE" from PE to "asks me for PIN instead of PATTERN after boot, but I can't find that information or how to do either. Maybe I should flash a specially made zip in TWRP? Do you people with PE have any .key related files in "/data/system"? what about in /system?

Thanks!

Edit:

I though I had found a working workaround (NOOOOOO!!!!):

Caution; the following actually removes encryption, lol, whoopsie. it's the same as "format data" in TWRP... :cyclops:

Reboot into fastboot (turn off, hold volume down+ power)

Connect phone to computer and launch an adb device to verify it's connected

Then type: fastboot format userdata

mke2fs 1.43.3 (04-Sep-2016)

Creating filesystem with 13465591 4k blocks and 3366912 inodes

Filesystem UUID: 11e52f8c-d4fc-11e8-9dce-cf1d31b522b3

Superblock backups stored on blocks:

32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,

4096000, 7962624, 11239424

Allocating group tables: done

Writing inode tables: done

Creating journal (65536 blocks): done

Writing superblocks and filesystem accounting information: done

Sending 'userdata' (4493 KB) OKAY [ 0.165s]

Writing 'userdata' OKAY [ -0.000s]

Finished. Total time: 0.414s

Then:

fastboot reboot

Rebooting

Finished. Total time: 0.000s

Now it took longer to load after the G logo, and it's now asking me for the SIM PIN. I entered it and it start to setup google!

....................

I realized while loading TWRP that it did not ask me anymore for encryption PIN, which meant.... NOOOO I HAD FORMATTED DATA!!!!

Now the important question is where is stored "userdata"?

How come it's not wiped using TWRP?

And what did I just delete (what contains userdata) ? Answer: Looks I just deleted data (removed encryption).