首先在frameworksbasepackagesSettingsProviderresvaluesdefaults.xml中设置def_screen_off_timeout为-1,即
-1
然后修改alpspackagesappsSettingsresvaluesarrays.xml:
15 seconds
30 seconds
1 minute
2 minutes
10 minutes
30 minutes
never
15000
30000
60000
120000
600000
1800000
-1
接着修改对比语言value文件夹下的arrays.xml, 修改screen_timeout_entries对应的翻译。不用管那个msgid,只是google用来表示是他自己的资源而已,直接添加"永不休眠"即可。
然后是代码的改动:
frameworks/base/services/java/com/android/server/power/PowerManagerService.java
private void updateUserActivitySummaryLocked(long now, int dirty) {
.....
//change code here ==============
Slog.d(TAG,"mScreenOffTimeoutSetting ="+mScreenOffTimeoutSetting);
//if (mUserActivitySummary != 0 ) {
if (mUserActivitySummary != 0 && mScreenOffTimeoutSetting > 0) {
//change code here end ==============
Message msg = mHandler.obtainMessage(MSG_USER_ACTIVITY_TIMEOUT);
msg.setAsynchronous(true);
mHandler.sendMessageAtTime(msg, nextTimeout);
}
转载请注明出处:周木水的CSDN博客 https://blog.csdn.net/zhoumushui
我的GitHub:周木水的GitHub https://github.com/zhoumushui