privacy – Android security issues


I’ve discovered unusual activity on my samsung galaxy s6(Android 7.0)
Random pages would open.
Random apps would open.
The encode your device option was missing in the settings menu.

Ich wiped and restored it.
I changed all the passwords.
I still had artifacts during online use(pictures i didnt tap on would open)

Any ways after wiping restoring changing passwords encoding using vpn(of someone trustworthy)
Of making sure my device is safe??