Android顯示設定中增加“永不休眠”功能,android顯示設定

來源:互聯網
上載者:User

Android顯示設定中增加“永不休眠”功能,android顯示設定


首先在frameworks\base\packages\SettingsProvider\res\values\defaults.xml中設定def_screen_off_timeout為-1,即
<integer name="def_screen_off_timeout">-1</integer>
然後修改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>


接著修改對比語言value檔案夾下的arrays.xml, 修改screen_timeout_entries對應的翻譯。不用管那個msgid,只是google用來表示是他自己的資源而已,直接添加<item >"永不休眠"</item>即可。


然後是代碼的改動:

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部落格 http://blog.csdn.net/zhoumushui

我的GitHub:周木水的GitHub https://github.com/zhoumushui


 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.