Prevent any Android app from changing WiFi state At some point in the last year I noticed that my Android device (HTC 10, Android 8.0.0) WiFi would turn on even when I had it turned off. I found out there is a permission called CHANGE_WIFI_STATE, which allows apps to enable/disable WiFi on my device.

I don't want this to happen. I want to be in full control of the WiFi state, for several reasons including the desire to avoid using bad WiFi without forgetting the access point name and key.

Is there any way I can achieve this without uninstalling the guilty apps? Ideally, I'd like to revoke access to the CHANGE_WIFI_STATE permission for all apps present and future, but I would be OK with doing it per-app too.
You can use Android's native permission manager (appops) to debar apps from using that permission. While you can use appops command using adb, it can become a pain because you need a PC to get that job done, unless you have root access. As an alternative, there are third-party GUI frontends for appops in Play Store, of which, I use App Ops - Permission Manager. It can work with both rooted and non-rooted  phone, although, it would still be relatively painful in non-rooted mode.

The app shows tutorial at initial startup, to setup the mode to grant it the requisite privilege. After that, you just find your app in the list, and toggle that permission listed with the title "Connect and Disconnect from Wi-Fi".

Under App Ops app's settings, you can setup a template (allowing or debarring a permission) which would apply on all the newly installed apps.