修改系统设置默认值:platform/frameworks/base/packages/SettingsProvider/res/values/defaults.xml,将其中的:

false

false

这两项的值都改为 true:

true

true

修改 platform/frameworks/base/services/core/java/com/android/server/power/PowerManagerService.java 中

private void updateStayOnLocked(int dirty) {

if ((dirty & (DIRTY_BATTERY_STATE | DIRTY_SETTINGS)) != 0) {

final boolean wasStayOn = mStayOn;

if (mStayOnWhilePluggedInSetting != 0

&& !isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked()) {

mStayOn = mBatteryManagerInternal.isPowered(mStayOnWhilePluggedInSetting);

} else {

mStayOn = false;

}

if (mStayOn != wasStayOn) {

mDirty |= DIRTY_STAY_ON;

}

}

}

改为:

private void updateStayOnLocked(int dirty) {

if ((dirty & (DIRTY_BATTERY_STATE | DIRTY_SETTINGS)) != 0) {

final boolean wasStayOn = mStayOn;

if (mStayOnWhilePluggedInSetting != 0

&& !isMaximumScreenOffTimeoutFromDeviceAdminEnforcedLocked()) {

mStayOn = mBatteryManagerInternal.isPowered(mStayOnWhilePluggedInSetting);

} else {

mStayOn = false;

}

mStayOn = true;

if (mStayOn != wasStayOn) {

mDirty |= DIRTY_STAY_ON;

}

}

}

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐