设置-wifi-高级设置,选择仅充电时保持WLAN开启/睡眠期间不保持wlan的开启状态,手机锁屏休眠几分钟后,再点亮屏幕,wifi一直显示开启状态


解决方法:缩短响应的时间;

具体方法:

路径:frameworks/base/services/java/com/android/server/wifi/WifiController.java

代码: class WifiController extends StateMachine {
      * being enabled but not active exceeds the battery drain caused by
      * re-establishing a connection to the mobile data network.
      */
–    private static final long DEFAULT_IDLE_MS = 15 * 60 * 1000; /* 15 minutes */
+    private static final long DEFAULT_IDLE_MS = 1 * 60 * 1000; /* 1 minutes */