Added the "never sleep" function in Android display settings. android display settings
Set def_screen_off_timeout to-1 in frameworks \ base \ packages \ SettingsProvider \ res \ values \ defaults. xml, that is
<Integer name = "def_screen_off_timeout">-1 </integer>
Then modify alps \ packages \ apps \ Settings \ res \ values \ arrays. xml:
<!-- Display settings. The delay in inactivity before the screen is turned off. These are shown ain a list dialog. --> <string-array name="screen_timeout_entries"> <item>15 seconds</item> <item>30 seconds</item> <item>1 minute</item> <item>2 minutes</item> <item>10 minutes</item> <item>30 minutes</item> <item>never</item> </string-array> <!-- Do not translate. --> <string-array name="screen_timeout_values" translatable="false"> <!-- Do not translate. --> <item>15000</item> <!-- Do not translate. --> <item>30000</item> <!-- Do not translate. --> <item>60000</item> <!-- Do not translate. --> <item>120000</item> <!-- Do not translate. --> <item>600000</item> <!-- Do not translate. --> <item>1800000</item> <item>-1</item> </string-array>
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 worry about the msgid, but google is used to indicate that it is his own resource. Simply add <item> "never sleep" </item>.
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