am 13c589b6: Animate brightness with electron beam.
* commit '13c589b66c47aa4d988eecce9a12c39d580939c9': Animate brightness with electron beam.
This commit is contained in:
@@ -70,6 +70,12 @@ final class DisplayPowerController {
|
|||||||
private static final boolean DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT = false;
|
private static final boolean DEBUG_PRETEND_PROXIMITY_SENSOR_ABSENT = false;
|
||||||
private static final boolean DEBUG_PRETEND_LIGHT_SENSOR_ABSENT = false;
|
private static final boolean DEBUG_PRETEND_LIGHT_SENSOR_ABSENT = false;
|
||||||
|
|
||||||
|
// If true, uses the electron beam on animation.
|
||||||
|
// We might want to turn this off if we cannot get a guarantee that the screen
|
||||||
|
// actually turns on and starts showing new content after the call to set the
|
||||||
|
// screen state returns.
|
||||||
|
private static final boolean USE_ELECTRON_BEAM_ON_ANIMATION = true;
|
||||||
|
|
||||||
private static final int ELECTRON_BEAM_ON_ANIMATION_DURATION_MILLIS = 300;
|
private static final int ELECTRON_BEAM_ON_ANIMATION_DURATION_MILLIS = 300;
|
||||||
private static final int ELECTRON_BEAM_OFF_ANIMATION_DURATION_MILLIS = 600;
|
private static final int ELECTRON_BEAM_OFF_ANIMATION_DURATION_MILLIS = 600;
|
||||||
|
|
||||||
@@ -550,14 +556,19 @@ final class DisplayPowerController {
|
|||||||
// on animation immediately then the results are pretty ugly.
|
// on animation immediately then the results are pretty ugly.
|
||||||
if (!mElectronBeamOffAnimator.isStarted()) {
|
if (!mElectronBeamOffAnimator.isStarted()) {
|
||||||
setScreenOn(true);
|
setScreenOn(true);
|
||||||
if (!mElectronBeamOnAnimator.isStarted()) {
|
if (USE_ELECTRON_BEAM_ON_ANIMATION) {
|
||||||
if (mPowerState.getElectronBeamLevel() == 1.0f) {
|
if (!mElectronBeamOnAnimator.isStarted()) {
|
||||||
mPowerState.dismissElectronBeam();
|
if (mPowerState.getElectronBeamLevel() == 1.0f) {
|
||||||
} else if (mPowerState.prepareElectronBeam(true)) {
|
mPowerState.dismissElectronBeam();
|
||||||
mElectronBeamOnAnimator.start();
|
} else if (mPowerState.prepareElectronBeam(true)) {
|
||||||
} else {
|
mElectronBeamOnAnimator.start();
|
||||||
mElectronBeamOnAnimator.end();
|
} else {
|
||||||
|
mElectronBeamOnAnimator.end();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
mPowerState.setElectronBeamLevel(1.0f);
|
||||||
|
mPowerState.dismissElectronBeam();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -242,8 +242,9 @@ final class DisplayPowerState {
|
|||||||
mElectronBeam.draw(mElectronBeamLevel);
|
mElectronBeam.draw(mElectronBeamLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mDirty & (DIRTY_BRIGHTNESS | DIRTY_SCREEN_ON)) != 0) {
|
if ((mDirty & (DIRTY_BRIGHTNESS | DIRTY_SCREEN_ON | DIRTY_ELECTRON_BEAM)) != 0) {
|
||||||
mScreenBrightnessModulator.setBrightness(mScreenOn ? mScreenBrightness : 0);
|
mScreenBrightnessModulator.setBrightness(mScreenOn ?
|
||||||
|
(int)(mScreenBrightness * mElectronBeamLevel) : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((mDirty & DIRTY_SCREEN_ON) != 0 && mScreenOn) {
|
if ((mDirty & DIRTY_SCREEN_ON) != 0 && mScreenOn) {
|
||||||
|
|||||||
Reference in New Issue
Block a user