步骤一:
源码/frameworks/base/packages/SettingsProvider/res/values/defaults.xml
修改<integername="def_screen_off_timeout">6000</integer>为: <integername="def_screen_off_timeout">-1</integer>
步骤二:
源码/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java
修改getScreenOffTimeoutLocked()函数为:
private int getScreenOffTimeoutLocked(intsleepTimeout) { int nosleep; int timeout = mScreenOffTimeoutSetting; if(isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked()) { timeout = Math.min(timeout,mMaximumScreenOffTimeoutFromDeviceAdmin); } if(mUserActivityTimeoutOverrideFromWindowManager >= 0) { timeout = (int)Math.min(timeout,mUserActivityTimeoutOverrideFromWindowManager); } if (sleepTimeout >= 0) { timeout = Math.min(timeout,sleepTimeout); } nosleep = mScreenOffTimeoutSetting; if(nosleep <0) { nosleep = mMaximumScreenOffTimeoutFromDeviceAdmin; return Math.max(nosleep,mMaximumScreenOffTimeoutFromDeviceAdmin); } return Math.max(timeout,mMinimumScreenOffTimeoutConfig); }