二、AOSP-不锁屏不休眠

一、不锁屏

1、源码路径

/frameworks/base/packages/SettingsProvider/res/values/defaults.xml

2、android源码
<bool name="def_lockscreen_disabled">falsebool>
3、修改优化
<bool name="def_lockscreen_disabled">truebool>

二、不休眠

1、配置修改

a-源码路径

/frameworks/base/core/res/res/values/config.xml

b-android源码
<integer name="config_minimumScreenOffTimeout">10000integer>
c-修改优化
<integer name="config_minimumScreenOffTimeout">-1integer>

2、代码增加判断

a-源码路径

/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java

b-android源码
  private int getScreenOffTimeoutLocked(int sleepTimeout) {
        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);
        }
        return Math.max(timeout, mMinimumScreenOffTimeoutConfig);
    }
c-修改优化
  private int getScreenOffTimeoutLocked(int sleepTimeout) {
        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);
        }
        //zjp update
	    if (mMinimumScreenOffTimeoutConfig < 0 ) {
	        return mMaximumScreenOffTimeoutFromDeviceAdmin;
	    }
        return Math.max(timeout, mMinimumScreenOffTimeoutConfig);
    }

你可能感兴趣的:(AOSP-android,8.x源码定制,android,java,linux)