In the project \frameworks\base\wifi\java\android\net\wifi\wifistatemachine.java, like the following code, is to set the WiFi hotspot to keep the state: the following:
Private class Hotspotautodisableobserver extends Contentobserver {public hotspotautodisableobserver (Handler Handl ER) {super (handler); Mcontext.getcontentresolver (). Registercontentobserver (Settings.System.getUriFor (Settings.System.WIFI_HOTSP Ot_auto_disable), false, this); } @Override public void OnChange (Boolean selfchange) {Super.onchange (selfchange); Mduration = Settings.System.getInt (Mcontext.getcontentresolver (), Settings.System.WIFI_HOTSPOT_AUTO_DISABLE, Settings.System.WIFI_HOTSPOT_AUTO_DISABLE_FOR_FIVE_MINS); if (mduration! = Settings.System.WIFI_HOTSPOT_AUTO_DISABLE_OFF && Mpluggedtype = = 0) {if (mclientn Um = = 0 && WifiStateMachine.this.getCurrentState () = = Mtetheredstate) {Malarmmanager.cancel (MI Ntentstophotspot); XLOG.D (TAG, "Set alarm for setting changed, Mduration:" + mduration); Malarmmanager.set (Alarmmanager.rtc_wakeup, System.currenttimemillis () + mduration * H Otspot_disable_ms, Mintentstophotspot); }} else {malarmmanager.cancel (mintentstophotspot); } } }
Modify the default value to always:
Mduration = Settings.System.getInt (Mcontext.getcontentresolver (), Settings.System.WIFI_HOTSPOT_AUTO_DISABLE, Settings.System.WIFI_HOTSPOT_AUTO_DISABLE_OFF);
In addition, the SYSTEM.XXXX constant defines the path in the source code: Project \frameworks\base\core\java\android\provider\settings.java
Modify WiFi hotspot in Android source code always on by default