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

Source: Internet
Author: User

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


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.