1.不锁屏:
rameworks/base/packages/SettingsProvider/res/values/defaults.xml
- <integer name="def_sleep_timeout">-1</integer>
+ <integer name="def_sleep_timeout">10</integer>
- <bool name="def_lockscreen_disabled">false</bool>
+ <bool name="def_lockscreen_disabled">true</bool>
2.不休眠:
需要配合永不息屏
其实这里的永不息屏是伪“永不”! 实际上就是设置Integer的最大值,换算时间大约是25天~
/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
private long getSleepTimeoutLocked() {
final long timeout = mSleepTimeoutSetting;
if (timeout <= 0) {
return -1;
}
- return Math.max(timeout, mMinimumScreenOffTimeoutConfig);
+ return Math.max(timeout, Integer.MAX_VALUE);
}
private int getScreenOffTimeoutLocked(int sleepTimeout) {
....
if (sleepTimeout >= 0) {
timeout = Math.min(timeout, sleepTimeout);
}
+ if (sleepTimeout > 0 ) {
+ return Integer.MAX_VALUE;
+ }
return Math.max(timeout, mMinimumScreenOffTimeoutConfig);
}
mMinimumScreenOffTimeoutConfig所指向的默认值为:
路径: android/frameworks/base/core/res/res/values/config.xml
<integer name="config_minimumScreenOffTimeout">10000</integer>
3.屏幕灭屏但系统不休眠
android方案配置/init.xxx.rc中申请锁
chown system system /sys/power/wake_lock
chmod 0660 /sys/power/wake_lock
write /sys/power/wake_lock user_lock