android6.0 解决wifi不休眠问题

前言

在Settings里面,选中电池,查看详细电量使用记录,发现手机在休眠状态下,WLAN一直不休眠(使用电量显示一条直线),分析原因发现在WLAN-》高级-》在休眠状态下保持WLAN网络连接是始终,将默认选项改为永不,或者仅限充电时就能解决WLAN不休眠问题。

修改内容

zhoujinyan@bdsvr6-S2600CP:~/C10/src/LINUX/android$ git diff
diff --git a/src/LINUX/android/packages/apps/Settings/src/com/android/settings/wifi/AdvancedWifiSettings.java b/src/LINUX/android/packages/apps/Settings/src/com/android/settings/wifi/AdvancedWifiSettings.java
old mode 100644
new mode 100755
index eb2b526..18f6591
--- a/src/LINUX/android/packages/apps/Settings/src/com/android/settings/wifi/AdvancedWifiSettings.java
+++ b/src/LINUX/android/packages/apps/Settings/src/com/android/settings/wifi/AdvancedWifiSettings.java
@@ -254,7 +254,7 @@ public class AdvancedWifiSettings extends SettingsPreferenceFragment
             sleepPolicyPref.setOnPreferenceChangeListener(this);
             int value = Settings.Global.getInt(getContentResolver(),
                     Settings.Global.WIFI_SLEEP_POLICY,
-                    Settings.Global.WIFI_SLEEP_POLICY_NEVER);
+                    Settings.Global.WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED ); //C10-modify the device is on battery, and never go to sleep when the device is plugged in -zhoujinyan -20191113
             String stringValue = String.valueOf(value);
             sleepPolicyPref.setValue(stringValue);
             updateSleepPolicySummary(sleepPolicyPref, stringValue);
zhoujinyan@bdsvr6-S2600CP:~/C10/src/LINUX/android$
diff --git a/src/LINUX/android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml b/src/LINUX/android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
index 4d47fec..a5abdd7 100755
--- a/src/LINUX/android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
+++ b/src/LINUX/android/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
@@ -49,7 +49,7 @@
     <bool name="def_usb_mass_storage_enabled">true</bool>
     <bool name="def_wifi_on">false</bool>
     <!-- 0 == never, 1 == only when plugged in, 2 == always -->
-    <integer name="def_wifi_sleep_policy">2</integer>
+    <integer name="def_wifi_sleep_policy">1</integer>
     <bool name="def_networks_available_notification_on">true</bool>
 
     <bool name="def_backup_enabled">false</bool>

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值