How to encrypt deleted data on Android 10 I'm running a custom ROM (MIUI xiaomi.eu 12.0.2/Android 10QKQ1.90910.002) and my phone is rooted. I want to encrypt my old deleted data (photos and videos) so that they can't ever be recovered after selling my phone because right now I can recover them using apps like diskdigger.
You cannot encrypt data which has been deleted. As Tetsujin mentioned, you are meant to encrypt the data beforehand. You can then discard the encryption key.
What you want to accomplish, then—ensure that cleartext deleted data be unrecoverable—is inherently difficult. It's not trivial to hide these things from experienced forensic laboratories.
That said, unless you are trying to protect your data against an adversary such as a nation state, there are steps you can take. Re-encrypt your phone now and, after ensuring that data encryption is enable, initiate a full wipe. This should render apps like DiskDigger ineffective.