前言
在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>