Restore device integrity and remove persistent malware by unrooting, flashing stock firmware, and performing a factory reset.