If I buy a used and infected phone with a expensive spyware on it that the antivirus does not detect or is unable to remove than will flashing a new custom recovery and custom ROM make it safe to use?
What would be the proper way of doing it? Connect to computer and install new recovery first and then the rom or some other way?
Once I have done these two steps, can I be assured that my phone is clean?
And should I be worried about getting my computer infected?
Edit: If this is not enough then what other actions should I take to be sure that the phone is clean?
fastboot getvar all
(in fastboot mode) or fromadb shell ls -l /dev/block/*/*/*/by-name/*
(with usb-debugging) – alecxs Feb 08 '20 at 20:27