Added the "never sleep" function in Android display settings. android display settings

Source: Internet
Author: User

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


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.