As far as I can remember, some carriers disable this feature. Now, we have a few dozen phones that we want to deploy to some schools and we would like to disable this feature.
How do I achieve this? A few guesses that I have would be to add/edit something in
build.prop or some hidden Android API (can't find any here).
Update: I figured it out a long time ago. The solutions here do work gracefully and the phones behave properly. Normal WiFi is not affected (because
hostapd only manages the AP). Upon testing, the worst that happens is
2018-12-04 23:12:23.680 3207-3753/? E/SoftapController: Unable to open connection to supplicant on "/data/misc/wifi/hostapd/wlan0": No such file or directory
logcat. At the same time, the mobile hotspot setting switch flips back off automagically.
What I did was just rename
hostapd to something else. Moving/deleting/changing permissions would also work.