Android5.0 Setting 中添加永不休眠选项,选择后机器过大概7,8秒还是休眠了!!


1。修改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

    

    修改对比语言value文件夹下的arrays.xml, 修改screen_timeout_entries对应的翻译。不用管那个msgid,只是google用来表示是他自己的资源而已,直接添加"不灭"即可,请知悉。

2,若是android4.2的code,请在前面的修改基础上再修改下面的代码:

PowerManagerService.java

private void updateUserActivitySummaryLocked(long now, int dirty) {

.....

 3。最后对packages/apps/Settings/src/com/android/settings下的DisplaySettings.java文件进行修改,修改如下

//change code here ==============

                      Slog.d(TAG,"mScreenOffTimeoutSetting ="+mScreenOffTimeoutSetting);

                      //if (mUserActivitySummary != 0 ) {

                if (mUserActivitySummary != 0 && nextTimeout >= 0&& mScreenOffTimeoutSetting > 0) {

//change code here  end ==============

                    Message msg = mHandler.obtainMessage(MSG_USER_ACTIVITY_TIMEOUT);

                    msg.setAsynchronous(true);

                    mHandler.sendMessageAtTime(msg, nextTimeout);

                }
 

//change code here ==============

                     if (currentTimeout < 0) {
            // Unsupported value
//summary = "";
            final CharSequence[] entries = preference.getEntries();
            final CharSequence[] values = preference.getEntryValues();
            summary = entries[values.length - 1].toString();//modify summary = ""

//change code here  end ==============

参考MTK 对4.0的解法在5.0上做出修改后,可在Setting 中出现Never选项,,打印出相应的值 已经是 - 1 了,但是选择后机器过了大概7,8秒就休眠了,没有达到不休眠的效果,这是什么原因呢??
 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


你可能感兴趣的:(Android5.0 Setting 中添加永不休眠选项,选择后机器过大概7,8秒还是休眠了!!)