[DO NOT MERGE] Add a configuration to allow disabling auto-suspend
If a platform needs to control suspension explicitly, it can set 'config_enableAutoSuspend' to false to disable auto-suspend. Auto-suspend is enabled by default. This is only for Q. Autosuspend is done differently in R. Bug: 143203434 Test: Verified on desktop Automotive hardware Change-Id: Iac17a7d753b8cd5c0259059713fae29d6e5e6fb0
This commit is contained in:
@@ -4268,4 +4268,7 @@
|
||||
<!-- Boolean indicating whether frameworks needs to reset cell broadcast geo-fencing
|
||||
check after reboot or airplane mode toggling -->
|
||||
<bool translatable="false" name="reset_geo_fencing_check_after_boot_or_apm">false</bool>
|
||||
<!-- Boolean indicating that the system will use autoSuspend. If set to false, autoSuspend
|
||||
is not used and the system will only suspend upon an explicit request. -->
|
||||
<bool translatable="false" name="config_enableAutoSuspend">true</bool>
|
||||
</resources>
|
||||
|
||||
@@ -3854,4 +3854,5 @@
|
||||
|
||||
<java-symbol type="bool" name="config_automotiveHideNavBarForKeyboard" />
|
||||
<java-symbol type="bool" name="reset_geo_fencing_check_after_boot_or_apm" />
|
||||
<java-symbol type="bool" name="config_enableAutoSuspend" />
|
||||
</resources>
|
||||
|
||||
@@ -421,6 +421,8 @@ public final class PowerManagerService extends SystemService
|
||||
// True if doze should not be started until after the screen off transition.
|
||||
private boolean mDozeAfterScreenOff;
|
||||
|
||||
private boolean mEnableAutoSuspendConfig;
|
||||
|
||||
// The minimum screen off timeout, in milliseconds.
|
||||
private long mMinimumScreenOffTimeoutConfig;
|
||||
|
||||
@@ -954,6 +956,8 @@ public final class PowerManagerService extends SystemService
|
||||
com.android.internal.R.bool.config_powerDecoupleAutoSuspendModeFromDisplay);
|
||||
mDecoupleHalInteractiveModeFromDisplayConfig = resources.getBoolean(
|
||||
com.android.internal.R.bool.config_powerDecoupleInteractiveModeFromDisplay);
|
||||
mEnableAutoSuspendConfig = resources.getBoolean(
|
||||
com.android.internal.R.bool.config_enableAutoSuspend);
|
||||
mWakeUpWhenPluggedOrUnpluggedConfig = resources.getBoolean(
|
||||
com.android.internal.R.bool.config_unplugTurnsOnScreen);
|
||||
mWakeUpWhenPluggedOrUnpluggedInTheaterModeConfig = resources.getBoolean(
|
||||
@@ -2625,7 +2629,8 @@ public final class PowerManagerService extends SystemService
|
||||
if (!mDecoupleHalInteractiveModeFromDisplayConfig) {
|
||||
setHalInteractiveModeLocked(false);
|
||||
}
|
||||
if (!mDecoupleHalAutoSuspendModeFromDisplayConfig) {
|
||||
if (mEnableAutoSuspendConfig
|
||||
&& !mDecoupleHalAutoSuspendModeFromDisplayConfig) {
|
||||
setHalAutoSuspendModeLocked(true);
|
||||
}
|
||||
} else {
|
||||
@@ -2670,7 +2675,7 @@ public final class PowerManagerService extends SystemService
|
||||
private void updateSuspendBlockerLocked() {
|
||||
final boolean needWakeLockSuspendBlocker = ((mWakeLockSummary & WAKE_LOCK_CPU) != 0);
|
||||
final boolean needDisplaySuspendBlocker = needDisplaySuspendBlockerLocked();
|
||||
final boolean autoSuspend = !needDisplaySuspendBlocker;
|
||||
final boolean autoSuspend = mEnableAutoSuspendConfig && !needDisplaySuspendBlocker;
|
||||
final boolean interactive = mDisplayPowerRequest.isBrightOrDim();
|
||||
|
||||
// Disable auto-suspend if needed.
|
||||
|
||||
Reference in New Issue
Block a user