Steps:
- Make sure your phone is encrypted
- Unlock the bootloader (OEM unlocking)
- Erase user-data partition
Not enough! Your device seems bricked, but since you can enter recovery mode it can be saved by reformatting the filesystem (ext2 -> ext4, repair system).
To actually brick your device:
- Boot your phone into fastboot mode
- Make sure the bootloader is unlocked
- With the fastboot command flash a new boot.img to the boot partition
- Done
Interesting facts about Android:
- When unlocking the bootloader all your data gets wiped
- Does not let you downgrade to older firmware versions
Also don’t ever rely on the Google backup function:
- Google backups can only be restored on initial system setup
- Google backups don’t contain any app data (so what’s the point of this backup?)
- Google will sync your phone contacts into your Google account, the contacts you backed up can not be restored otherwise
- System settings are all lost even if you backed them up
Instead, backup your data using OEM tools (OnePlus Clone, Samsung whatever ..).