Merge "Allow display timeouts to be set in config.xml." into klp-modular-dev
This commit is contained in:
@@ -1181,6 +1181,49 @@
|
||||
-->
|
||||
<bool name="config_powerDecoupleInteractiveModeFromDisplay">false</bool>
|
||||
|
||||
<!-- User activity timeout: Minimum screen off timeout in milliseconds.
|
||||
|
||||
Sets a lower bound for the {@link Settings.System#SCREEN_OFF_TIMEOUT} setting
|
||||
which determines how soon the device will go to sleep when there is no
|
||||
user activity.
|
||||
|
||||
This value must be greater than zero, otherwise the device will immediately
|
||||
fall asleep again as soon as it is awoken.
|
||||
-->
|
||||
<integer name="config_minimumScreenOffTimeout">10000</integer>
|
||||
|
||||
<!-- User activity timeout: Maximum screen dim duration in milliseconds.
|
||||
|
||||
Sets an upper bound for how long the screen will dim before the device goes
|
||||
to sleep when there is no user activity. The dim duration is subtracted from
|
||||
the overall screen off timeout to determine the screen dim timeout.
|
||||
When the screen dim timeout expires, the screen will dim, shortly thereafter
|
||||
the device will go to sleep.
|
||||
|
||||
If the screen off timeout is very short, the dim duration may be reduced
|
||||
proportionally. See config_maximumScreenDimRatio.
|
||||
|
||||
This value may be zero in which case the screen will not dim before the
|
||||
device goes to sleep.
|
||||
-->
|
||||
<integer name="config_maximumScreenDimDuration">7000</integer>
|
||||
|
||||
<!-- User activity timeout: Maximum screen dim duration as a percentage of screen off timeout.
|
||||
|
||||
This resource is similar to config_maximumScreenDimDuration but the maximum
|
||||
screen dim duration is defined as a ratio of the overall screen off timeout
|
||||
instead of as an absolute value in milliseconds. This is useful for reducing
|
||||
the dim duration when the screen off timeout is very short.
|
||||
|
||||
When computing the screen dim duration, the power manager uses the lesser
|
||||
of the effective durations expressed by config_maximumScreenDimDuration and
|
||||
config_maximumScreenDimRatio.
|
||||
|
||||
This value must be between 0% and 100%. If the value is zero, the screen will not
|
||||
dim before the device goes to sleep.
|
||||
-->
|
||||
<fraction name="config_maximumScreenDimRatio">20%</fraction>
|
||||
|
||||
<!-- Base "touch slop" value used by ViewConfiguration as a
|
||||
movement threshold where scrolling should begin. -->
|
||||
<dimen name="config_viewConfigurationTouchSlop">8dp</dimen>
|
||||
|
||||
@@ -1633,6 +1633,9 @@
|
||||
<java-symbol type="string" name="enable_explore_by_touch_warning_message" />
|
||||
<java-symbol type="bool" name="config_powerDecoupleAutoSuspendModeFromDisplay" />
|
||||
<java-symbol type="bool" name="config_powerDecoupleInteractiveModeFromDisplay" />
|
||||
<java-symbol type="integer" name="config_minimumScreenOffTimeout" />
|
||||
<java-symbol type="integer" name="config_maximumScreenDimDuration" />
|
||||
<java-symbol type="fraction" name="config_maximumScreenDimRatio" />
|
||||
<java-symbol type="string" name="config_customAdbPublicKeyConfirmationComponent" />
|
||||
|
||||
<java-symbol type="layout" name="resolver_list" />
|
||||
|
||||
@@ -147,20 +147,9 @@ public final class PowerManagerService extends com.android.server.SystemService
|
||||
private static final int USER_ACTIVITY_SCREEN_BRIGHT = 1 << 0;
|
||||
private static final int USER_ACTIVITY_SCREEN_DIM = 1 << 1;
|
||||
|
||||
// Default and minimum screen off timeout in milliseconds.
|
||||
// Default timeout in milliseconds. This is only used until the settings
|
||||
// provider populates the actual default value (R.integer.def_screen_off_timeout).
|
||||
private static final int DEFAULT_SCREEN_OFF_TIMEOUT = 15 * 1000;
|
||||
private static final int MINIMUM_SCREEN_OFF_TIMEOUT = 10 * 1000;
|
||||
|
||||
// The screen dim duration, in milliseconds.
|
||||
// This is subtracted from the end of the screen off timeout so the
|
||||
// minimum screen off timeout should be longer than this.
|
||||
private static final int SCREEN_DIM_DURATION = 7 * 1000;
|
||||
|
||||
// The maximum screen dim time expressed as a ratio relative to the screen
|
||||
// off timeout. If the screen off timeout is very short then we want the
|
||||
// dim timeout to also be quite short so that most of the time is spent on.
|
||||
// Otherwise the user won't get much screen on time before dimming occurs.
|
||||
private static final float MAXIMUM_SCREEN_DIM_RATIO = 0.2f;
|
||||
|
||||
// The name of the boot animation service in init.rc.
|
||||
private static final String BOOT_ANIMATION_SERVICE = "bootanim";
|
||||
@@ -337,6 +326,20 @@ public final class PowerManagerService extends com.android.server.SystemService
|
||||
// True if dreams should be activated on dock.
|
||||
private boolean mDreamsActivateOnDockSetting;
|
||||
|
||||
// The minimum screen off timeout, in milliseconds.
|
||||
private int mMinimumScreenOffTimeoutConfig;
|
||||
|
||||
// The screen dim duration, in milliseconds.
|
||||
// This is subtracted from the end of the screen off timeout so the
|
||||
// minimum screen off timeout should be longer than this.
|
||||
private int mMaximumScreenDimDurationConfig;
|
||||
|
||||
// The maximum screen dim time expressed as a ratio relative to the screen
|
||||
// off timeout. If the screen off timeout is very short then we want the
|
||||
// dim timeout to also be quite short so that most of the time is spent on.
|
||||
// Otherwise the user won't get much screen on time before dimming occurs.
|
||||
private float mMaximumScreenDimRatioConfig;
|
||||
|
||||
// The screen off timeout setting value in milliseconds.
|
||||
private int mScreenOffTimeoutSetting;
|
||||
|
||||
@@ -565,6 +568,12 @@ public final class PowerManagerService extends com.android.server.SystemService
|
||||
com.android.internal.R.integer.config_dreamsBatteryLevelMinimumWhenNotPowered);
|
||||
mDreamsBatteryLevelDrainCutoffConfig = resources.getInteger(
|
||||
com.android.internal.R.integer.config_dreamsBatteryLevelDrainCutoff);
|
||||
mMinimumScreenOffTimeoutConfig = resources.getInteger(
|
||||
com.android.internal.R.integer.config_minimumScreenOffTimeout);
|
||||
mMaximumScreenDimDurationConfig = resources.getInteger(
|
||||
com.android.internal.R.integer.config_maximumScreenDimDuration);
|
||||
mMaximumScreenDimRatioConfig = resources.getFraction(
|
||||
com.android.internal.R.fraction.config_maximumScreenDimRatio, 1, 1);
|
||||
}
|
||||
|
||||
private void updateSettingsLocked() {
|
||||
@@ -1317,12 +1326,12 @@ public final class PowerManagerService extends com.android.server.SystemService
|
||||
if (mUserActivityTimeoutOverrideFromWindowManager >= 0) {
|
||||
timeout = (int)Math.min(timeout, mUserActivityTimeoutOverrideFromWindowManager);
|
||||
}
|
||||
return Math.max(timeout, MINIMUM_SCREEN_OFF_TIMEOUT);
|
||||
return Math.max(timeout, mMinimumScreenOffTimeoutConfig);
|
||||
}
|
||||
|
||||
private int getScreenDimDurationLocked(int screenOffTimeout) {
|
||||
return Math.min(SCREEN_DIM_DURATION,
|
||||
(int)(screenOffTimeout * MAXIMUM_SCREEN_DIM_RATIO));
|
||||
return Math.min(mMaximumScreenDimDurationConfig,
|
||||
(int)(screenOffTimeout * mMaximumScreenDimRatioConfig));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2085,6 +2094,9 @@ public final class PowerManagerService extends com.android.server.SystemService
|
||||
pw.println(" mDreamsEnabledSetting=" + mDreamsEnabledSetting);
|
||||
pw.println(" mDreamsActivateOnSleepSetting=" + mDreamsActivateOnSleepSetting);
|
||||
pw.println(" mDreamsActivateOnDockSetting=" + mDreamsActivateOnDockSetting);
|
||||
pw.println(" mMinimumScreenOffTimeoutConfig=" + mMinimumScreenOffTimeoutConfig);
|
||||
pw.println(" mMaximumScreenDimDurationConfig=" + mMaximumScreenDimDurationConfig);
|
||||
pw.println(" mMaximumScreenDimRatioConfig=" + mMaximumScreenDimRatioConfig);
|
||||
pw.println(" mScreenOffTimeoutSetting=" + mScreenOffTimeoutSetting);
|
||||
pw.println(" mMaximumScreenOffTimeoutFromDeviceAdmin="
|
||||
+ mMaximumScreenOffTimeoutFromDeviceAdmin + " (enforced="
|
||||
|
||||
Reference in New Issue
Block a user