android6.0默认60秒就会suspend,导致系统睡眠。实际上android的这些设置都是存放在sql数据库里的,也就是说可以直接通过修改数据库来不让android睡眠。
sqlite3 /data/data/com.android.providers.settings/databases/settings.db
select * from system;
UPDATE system SET value = '1800000' WHERE name = 'screen_off_timeout';
UPDATE system SET value = '-1' WHERE name = 'screen_off_timeout' ;
.exit
insert into system ('name','value') values ('lock_pattern_autolock',1);
更改系统默认值参数,设置屏幕睡眠时间为30分钟(1800 000ms),涉及文件:
frameworks/base/packages/SettingsProvider/res/values/defaults.xml
name="def_dim_screen">true
<integer name="def_screen_off_timeout">1800000integer>
<integer name="def_sleep_timeout">-1integer>
更改系统设置,当插入电源时,屏幕一直亮,涉及文件:
frameworks/base/packages/SettingsProvider/src/com/android/providers/settings/DatabaseHelper.java
修改如下设置:
loadSetting(stmt, Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
("1".equals(SystemProperties.get("ro.kernel.qemu")) ||
mContext.getResources().getBoolean(R.bool.def_stay_on_while_plugged_in))
? 1 : 1); //? 1 : 0); leavs patched.the '1' can let the android stay wake when plugged in.