Many malicious third-party apps will automatically start when your HTC device boots or set themselves as device administrators to make the apps more difficult to uninstall. To prevent this from happening, uninstall or disable any suspicious apps.
If you don't see any suspicious apps, uninstall any recently downloaded apps that were installed shortly before the symptoms appeared.
If this doesn't fix the issue, you may need to do a factory reset.
In phones with Android 5 or higher, Device Protection may be enabled, which means that after the factory reset, you'll need to sign in using the same Google Account that was logged into your phone. If you forgot your Google Account password, use your computer web browser and go to www.google.com/accounts/recovery to reset your password first.
To perform a factory reset:
The phone will reboot and reset.