am 5177979b: am e333e674: Add a function to boost screen brightness temporarily. automerge: 0ed053e automerge: a80162f

* commit '5177979bbd7459179648057ba00a6399aeb26357':
  Add a function to boost screen brightness temporarily.
This commit is contained in:
Jeff Brown
2014-11-01 17:51:16 +00:00
committed by Android Git Automerger
6 changed files with 141 additions and 7 deletions

View File

@@ -172,9 +172,12 @@ public abstract class DisplayManagerInternal {
// If true, enables automatic brightness control.
public boolean useAutoBrightness;
//If true, scales the brightness to half of desired.
// If true, scales the brightness to half of desired.
public boolean lowPowerMode;
// If true, applies a brightness boost.
public boolean boostScreenBrightness;
// If true, prevents the screen from completely turning on if it is currently off.
// The display does not enter a "ready" state if this flag is true and screen on is
// blocked. The window manager policy blocks screen on while it prepares the keyguard to
@@ -216,6 +219,7 @@ public abstract class DisplayManagerInternal {
useAutoBrightness = other.useAutoBrightness;
blockScreenOn = other.blockScreenOn;
lowPowerMode = other.lowPowerMode;
boostScreenBrightness = other.boostScreenBrightness;
dozeScreenBrightness = other.dozeScreenBrightness;
dozeScreenState = other.dozeScreenState;
}
@@ -235,6 +239,7 @@ public abstract class DisplayManagerInternal {
&& useAutoBrightness == other.useAutoBrightness
&& blockScreenOn == other.blockScreenOn
&& lowPowerMode == other.lowPowerMode
&& boostScreenBrightness == other.boostScreenBrightness
&& dozeScreenBrightness == other.dozeScreenBrightness
&& dozeScreenState == other.dozeScreenState;
}
@@ -253,6 +258,7 @@ public abstract class DisplayManagerInternal {
+ ", useAutoBrightness=" + useAutoBrightness
+ ", blockScreenOn=" + blockScreenOn
+ ", lowPowerMode=" + lowPowerMode
+ ", boostScreenBrightness=" + boostScreenBrightness
+ ", dozeScreenBrightness=" + dozeScreenBrightness
+ ", dozeScreenState=" + Display.stateToString(dozeScreenState);
}

View File

@@ -50,6 +50,7 @@ interface IPowerManager
void setStayOnSetting(int val);
void setMaximumScreenOffTimeoutFromDeviceAdmin(int timeMs);
void boostScreenBrightness(long time);
// temporarily overrides the screen brightness settings to allow the user to
// see the effect of a settings change without applying it immediately

View File

@@ -668,6 +668,28 @@ public final class PowerManager {
}
}
/**
* Boosts the brightness of the screen to maximum for a predetermined
* period of time. This is used to make the screen more readable in bright
* daylight for a short duration.
* <p>
* Requires the {@link android.Manifest.permission#DEVICE_POWER} permission.
* </p>
*
* @param time The time when the request to boost was issued, in the
* {@link SystemClock#uptimeMillis()} time base. This timestamp is used to correctly
* order the boost request with other power management functions. It should be set
* to the timestamp of the input event that caused the request to boost.
*
* @hide Requires signature permission.
*/
public void boostScreenBrightness(long time) {
try {
mService.boostScreenBrightness(time);
} catch (RemoteException e) {
}
}
/**
* Sets the brightness of the backlights (screen, keyboard, button).
* <p>