Added the "never sleep" function in Android display settings.
Set def_screen_off_timeout to-1 in frameworks \ base \ packages \ SettingsProvider \ res \ values \ defaults. xml, that is
-1
Then modify alps \ packages \ apps \ Settings \ res \ values \ arrays. xml:
15 seconds
30 seconds
1 minute
2 minutes
10 minutes
30 minutes
never
15000
30000
60000
120000
600000
1800000
-1
Next, modify arrays. xml in the value folder of the comparison language and the translation corresponding to screen_timeout_entries. You don't need to care about the msgid, but google just uses it to indicate that it is his own resource. "Never sleep" You can.
Then the code changes:
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); }
Reprinted please indicate the source: Zhou mu Shui CSDN blog http://blog.csdn.net/zhoumushui
My GitHub: Zhou mu Shui's GitHub https://github.com/zhoumushui